123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <!-- 辅料 转入数量 成本分配统计表 -->
- <a-modal
- title="转入数量"
- v-model="ingInQuaModVis"
- :confirmLoading="confirmLoading"
- width="86%"
- style="top:330px;left:100px;"
- @cancel="cancel"
- :footer="null"
- >
- <!-- tabel 加载 -->
- <a-spin :spinning="confirmLoading">
- <a-table :loading="loading" bordered :columns="columns" :data-source="data" :pagination="false">
- <span slot="unitCost" slot-scope="text,record">
- <a-input placeholder="请输入" v-model="record.unitCost" @blur="changeUnitCost(record)"/>
- </span>
- </a-table>
- <!-- 导出 打印 返回 -->
- <a-row style="marginTop:20px;">
- <a-col :md="24" :sm="12">
- <span style="float: right;" class="table-operator">
- <a-button type="primary" icon="download" @click="handleExportXls('辅料转入')">导出</a-button>
- <!-- <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
- <a-button type="primary" @click="cancel" icon="rollback">取消</a-button>
- </span>
- </a-col>
- </a-row>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import { downFile,downFile1 } from '@/api/manage'
- export default {
- name: 'IngInQuaModal', // 辅料 转入数量 弹框
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment },
- data() {
- return {
- // 辅料- 转入数量 表头
- columns: [
- {
- title: '存货名称',
- dataIndex: 'goodsName',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '计划单号',
- dataIndex: 'planCode',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '转入数量',
- dataIndex: 'number',
- width: 120,
- className: 'replacecolor',
- customRender: (text, record, index) => {
- var re = Number(text).toFixed(4)
- return re
- }
- },
- {
- title: '单位成本',
- dataIndex: 'unitCost',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'unitCost' },
- },
- {
- title: '总成本',
- dataIndex: 'cost',
- width: 120,
- className: 'replacecolor',
- }
- ],
- data: [],
- loading: false, // 表格加载
- planNum:'',
- record:'',
- // orderDataform: this.$form.createForm(this),
- confirmLoading: false,
- ingInQuaModVis: false
- }
- },
- // 接收父组件 方法
- props: {
- father: {
- type: Function,
- default: null
- },
- planNum:{
- type: String,
- default: null
- }
- },
- methods: {
- // 导出
- handleExportXls(fileName) {
- console.log('需导出的fileName:', fileName)
- const params = {
- planNum:this.planNum,
- sytransferIngreDeent :this.data,
- sheetName:'辅料转入'
- }
- console.log('导出参数', params)
- downFile1('/cost/syCostAllocation/exportXlsSyCostAllocation', params).then(data => {
- console.log('888')
- if (!data) {
- this.$message.warning('文件下载失败')
- return
- }
- if (typeof window.navigator.msSaveBlob !== 'undefined') {
- window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), this.planNum+'-'+fileName + '.xlsx')
- } else {
- let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
- let link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- link.setAttribute('download', this.planNum+'-'+fileName + '.xlsx')
- document.body.appendChild(link)
- link.click()
- document.body.removeChild(link) // 下载完成移除元素
- window.URL.revokeObjectURL(url) // 释放掉blob对象
- }
- })
- },
- // 打印
- print() {},
- changeUnitCost(record){
- record.unitCost = Number(record.unitCost).toFixed(4)
- this.$set(record,'cost',(Number(record.unitCost)* Number(record.number)).toFixed(4))
- },
- cancel() {
- console.log('返回成本分配统计表')
- this.ingInQuaModVis = false
- var allCost = 0
- this.data.map(item=>{
- if(item.cost){
- allCost +=Number(item.cost)
- }else{
- allCost +=0
- }
- })
- this.$emit('close',allCost,this.record)
- }
- }
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- @import '~@assets/less/overwriter.less';
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // /deep/ th.replacecolor {
- // background-color: #ccc;
- // }
- </style>
|