<template> <!-- 【单证】 计划单统计表 --> <div id="costAllocationTotal"> <!-- 查询区域 --> <a-card :bordered="false"> <div class="table-page-search-wrapper"> <a-form layout="inline" @keyup.enter.native="searchQuery"> <a-row :gutter="24"> <a-col :md="6" :sm="8"> <a-form-item label="计划号"> <a-input placeholder="请输入计划号" v-model="queryParam.planNo"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="对单人"> <a-input placeholder="请输入" v-model="queryParam.planMan"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="日期" has-feedback> <a-range-picker :placeholder="['开始时间', '结束时间']" format="YYYY-MM-DD" style="width: 100%" v-model="dverifyDate" @change="changeCreateTime" /> <!-- <a-input placeholder="请输入日期" v-model="queryParam.dverifyDate"></a-input> --> </a-form-item> </a-col> <template v-if="toggleSearchStatus"> <!-- <a-col :md="6" :sm="8"> <a-form-item label="是否存在对单人"> <a-select v-model="queryParam.isPlanMan" placeholder="" > <a-select-option value="">请选择</a-select-option> <a-select-option value="是">是</a-select-option> <a-select-option value="否">否</a-select-option> </a-select> </a-form-item> </a-col> --> <a-col :md="6" :sm="8"> <a-form-item label="面损表单据状态"> <a-select mode="multiple" @change="handleChange"> <!-- <a-select-option value="">请选择</a-select-option> --> <a-select-option value="保存">保存</a-select-option> <a-select-option value="提交">提交</a-select-option> <a-select-option value="返单">返单</a-select-option> <a-select-option value="完成">完成</a-select-option> <a-select-option value="初审通过">初审通过</a-select-option> <a-select-option value="已指派">已指派</a-select-option> </a-select> <!-- <a-input placeholder="请输入面损表单据状态" v-model="queryParam.fstatus"></a-input> --> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="分配表单据状态"> <a-select mode="multiple" @change="handleChangeCstatus"> <!-- <a-select-option value="">请选择</a-select-option> --> <a-select-option value="保存">保存</a-select-option> <a-select-option value="提交">提交</a-select-option> <a-select-option value="返单">返单</a-select-option> <a-select-option value="完成">完成</a-select-option> <a-select-option value="已指派">已指派</a-select-option> </a-select> <!-- <a-input placeholder="请输入分配表单据状态" v-model="queryParam.cstatus"></a-input> --> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="部门"> <a-input placeholder="请输入部门" v-model="queryParam.department"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="业务员"> <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="计划师傅/制单人"> <a-input placeholder="请输入" v-model="queryParam.maker"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="备注"> <a-input placeholder="请输入" v-model="queryParam.remarks"></a-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> <a-form-item label="审核结束日期"> <a-range-picker :placeholder="['开始时间', '结束时间']" format="YYYY-MM-DD" v-model="ffirstApproveDate" @change="changeFfirstApproveDate" /> <!-- <a-date-picker placeholder="请选择审核结束日期" style="width:100%;" :format="dateFormat" v-model="queryParam.ffirstApproveDate" @change="changeFfirstApproveDate" /> --> </a-form-item> </a-col> </template> <a-col :md="6" :sm="8"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a @click="handleToggleSearch" style="margin-left: 8px"> {{ toggleSearchStatus ? '收起' : '展开' }} <a-icon :type="toggleSearchStatus ? 'up' : 'down'" /> </a> </span> </a-col> </a-row> </a-form> </div> </a-card> <!-- table区域 --> <a-spin :spinning="loading"> <a-card :bordered="false" style=" marginTop:10px;"> <div class="table-operator"> <a-button type="primary" @click="exportList('计划单统计表')" icon="plus">导出</a-button> </div> <a-table bordered rowKey="index" :columns="costAllocationColumns" :data-source="costAllocationData" :loading="loading" :customRow="rowClick" :pagination="pagination" :scroll="{ x: 1500,y:450 }" @change="handleTableChange" > <span slot="remarks" slot-scope="text, record"> <a-input placeholder="请输入" v-model="record.remarks" v-if="record.enter=='1'"></a-input> <span v-if="record.enter=='0'">{{ record.remarks }}</span> </span> <span slot="planMan" slot-scope="text, record"> <a-input placeholder="请输入" v-model="record.planMan" v-if="record.enter=='1'"></a-input> <span v-if="record.enter=='0'">{{ record.planMan }}</span> </span> <span slot="ffinalApproveDate" slot-scope="text, record"> <a-date-picker style="width: 100%" v-model="record.ffinalApproveDate" :format="dateFormat" v-if="record.enter=='1'"> </a-date-picker> <!-- <a-input placeholder="请输入" v-model="record.ffinalApproveDate" v-if="record.enter=='1'"></a-input> --> <span v-if="record.enter=='0'">{{text}}</span> </span> <span slot="readyEndDate" slot-scope="text, record"> <a-date-picker style="width: 100%" v-model="record.readyEndDate" :format="dateFormat" v-if="record.enter=='1'" @change="changeReadyEndData()"> </a-date-picker> <span v-if="record.enter=='0'">{{text}}</span> </span> <span slot="option" slot-scope="text, record"> <a :disabled="record.enter=='0'" @click="sava(record)"> 保存</a> <a-divider type="vertical" /> <a :disabled="record.enter=='0'" @click="cancel(record)"> 取消</a> </span> </a-table> </a-card> </a-spin> <!-- 详情 大抽屉 --> <!-- <costDetail-drawer ref="costDetailDrawer" :fatherList="getCostList" @ok="modalFormOk"></costDetail-drawer> --> </div> </template> <script> import { JeecgListMixin } from '@/mixins/JeecgListMixin' import JEllipsis from '@/components/jeecg/JEllipsis' import moment from 'moment' import { downFile } from '@/api/manage' import costDetailDrawer from '@views/cost-allocation-total/costDetailDrawer.vue' import { checkList,savaList,savaList1 } from '@api/document/inancialReconciliation.js' export default { name: 'inancialReconciliation', // 成本分配汇总 单证 mixins: [JeecgListMixin], components: { JEllipsis, moment, costDetailDrawer }, data() { let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> return { dverifyDate:[], ffirstApproveDate:[], costAllocationColumns: [ { title: '计划单号', width: 120, dataIndex: 'planNo', fixed: 'left', className: 'replacecolor' }, { title: '日期', width: 120, dataIndex: 'dverifyDate', className: 'replacecolor' }, { title: '部门', width: 120, dataIndex: 'department', className: 'replacecolor', sorter:(a,b)=> { let temp1=""; let temp2=""; if(a.department!=null){ temp1=a.department; } if(b.department!=null){ temp2=b.department; } return temp1.localeCompare(temp2); }, }, { title: '业务员', width: 120, dataIndex: 'salesman', className: 'replacecolor' }, { title: '计划师傅/制单人', width: 150, dataIndex: 'maker', className: 'replacecolor'}, { title: '对单人(手输人)', width: 220, dataIndex: 'planMan', align: 'left', className: 'replacecolor', scopedSlots: { customRender: 'planMan' }, sorter:(a,b)=> { let temp1=""; let temp2=""; if(a.planMan!=null){ temp1=a.planMan; } if(b.planMan!=null){ temp2=b.planMan; } return temp1.localeCompare(temp2); }, }, // { // title: '创建时间', // dataIndex: 'createTime', // align: 'center', // sorter: true, // customRender: text => { // return moment(text).format('YYYY-MM-DD') // } // }, { title: '交单日期', width: 120, dataIndex: 'fsubmitDate', customRender: text => { if(text!==''&&text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.fsubmitDate) > new Date(b.fsubmitDate) ? 1 : -1; }, }, { title: '返单日期', width: 120, dataIndex: 'frejectDate', customRender: text => { if(text!==''&&text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.frejectDate) > new Date(b.frejectDate) ? 1 : -1; }, }, { title: '审核结束日期', width: 120, dataIndex: 'ffirstApproveDate', customRender: text => { if(text!=='' && text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.ffirstApproveDate) > new Date(b.ffirstApproveDate) ? 1 : -1; }, }, { title: '核纱结束日期', width: 150, dataIndex: 'ffinalApproveDate', scopedSlots: { customRender: 'ffinalApproveDate' }, // customRender: text => { // if(text!==''&&text){ // return moment(text).format('YYYY-MM-DD') // }else{ // return '' // } // }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.ffinalApproveDate) > new Date(b.ffinalApproveDate) ? 1 : -1; }, }, { title: '面损表单据状态', width: 120, dataIndex: 'fstatus', className: 'replacecolor', sorter:(a,b)=> { let temp1=""; let temp2=""; if(a.fstatus!=null){ temp1=a.fstatus; } if(b.fstatus!=null){ temp2=b.fstatus; } return temp1.localeCompare(temp2); }, }, { title: '交单日期', width: 120, dataIndex: 'csubmitDate', customRender: text => { if(text!==''&&text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.csubmitDate) > new Date(b.csubmitDate) ? 1 : -1; }, }, { title: '刷成衣结束日期', width: 170, dataIndex: 'readyEndDate', scopedSlots: { customRender: 'readyEndDate' }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.readyEndDate) > new Date(b.readyEndDate) ? 1 : -1; }, }, { title: '返单日期', width: 120, dataIndex: 'crejectDate', customRender: text => { if(text!==''&&text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.crejectDate) > new Date(b.crejectDate) ? 1 : -1; }, }, { title: '结束日期', width: 120, dataIndex: 'cfirstApproveDate', customRender: text => { if(text!==''&&text){ return moment(text).format('YYYY-MM-DD') }else{ return '' } }, className: 'replacecolor', sorter: (a, b) => { return new Date(a.cfirstApproveDate) > new Date(b.cfirstApproveDate) ? 1 : -1; }, }, { title: '分配表单据状态', width: 120, dataIndex: 'cstatus', className: 'replacecolor', sorter:(a,b)=> { let temp1=""; let temp2=""; if(a.cstatus!=null){ temp1=a.cstatus; } if(b.cstatus!=null){ temp2=b.cstatus; } return temp1.localeCompare(temp2); }, }, { title: '备注', width: 180, dataIndex: 'remarks', className: 'replacecolor', scopedSlots: { customRender: 'remarks' }, }, { title: '操作', width: 180, dataIndex: 'option', className: 'replacecolor', fixed: 'right', scopedSlots: { customRender: 'option' }, }, ], costAllocationData: [], // 查询条件 queryParam: { // index: '', // planNum: '', // customerShortame: '', pageSize:50, pageNo: '' // 点击的页数 }, // 分页 pagination: { pageSizeOptions: ["50","100","150", "500"], showSizeChanger: true, pageSize:50 }, dateFormat: 'YYYY-MM-DD', loading: false // 表格加载 } }, async created() { await this.defaultData() await this.getCostList() document.title = '计划单统计表'+ ' · ' + '马菲羊' }, methods: { // 分页查询 getCostList() { this.$nextTick(() => { this.loading = true checkList(this.queryParam).then(res => { this.loading = false if (res.success) { this.costAllocationData = res.result.records this.costAllocationData.map(item=>{ item.enter = '0' item.ffinalApproveDate = item.ffinalApproveDate!==''&&item.ffinalApproveDate ? moment(item.ffinalApproveDate).format('YYYY-MM-DD'):'' item.readyEndDate = item.readyEndDate!==''&&item.readyEndDate ? moment(item.readyEndDate).format('YYYY-MM-DD'):'' }) this.pagination = { total: res.result.total, current: res.result.current, pageSize: res.result.size, pageSizeOptions: ["50","100","150", "500"], showSizeChanger: true, } }else{ this.$message.error(res.message); } }) }) }, defaultData(){ var tYear = new Date().getFullYear() var startTime = new Date(tYear, 0, 1) this.dverifyDate=[moment(startTime),moment(new Date())] this.queryParam.dverifyDateE=this.dverifyDate[1].format('YYYY-MM-DD') this.queryParam.dverifyDateB=this.dverifyDate[0].format('YYYY-MM-DD') }, searchQuery() { this.getCostList() }, changeReadyEndData(){ this.$forceUpdate() }, handleChange(value){ this.queryParam.fstatus = value.toString() }, handleChangeCstatus(value){ this.queryParam.cstatus = value.toString() }, changeCreateTime(){ this.queryParam.dverifyDateE=( this.dverifyDate.length==2)?this.dverifyDate[1].format('YYYY-MM-DD'):'' this.queryParam.dverifyDateB=( this.dverifyDate.length==2)?this.dverifyDate[0].format('YYYY-MM-DD'):'' }, searchReset() { this.queryParam.pageNo = '' this.queryParam = {} this.defaultData() this.getCostList() }, changeFfirstApproveDate(){ this.queryParam.ffirstApproveDateE=( this.ffirstApproveDate.length==2)?this.ffirstApproveDate[1].format('YYYY-MM-DD'):'' this.queryParam.ffirstApproveDateB=( this.ffirstApproveDate.length==2)?this.ffirstApproveDate[0].format('YYYY-MM-DD'):'' }, rowClick(record) { return { on: { dblclick: () => { record.enter ='1' this.$forceUpdate() } } } }, cancel(record){ record.enter = '0' this.getCostList() this.$forceUpdate() }, sava(record){ this.loading = true var obj={ planNum : record.planNo, planMan:record.planMan, remarks:record.remarks, id:record.id, readyEndDate: record.readyEndDate!==''&&record.readyEndDate ? moment(record.readyEndDate).format('YYYY-MM-DD HH:mm:ss'):'' } var newObj ={ ccode:record.planNo, final_date: record.ffinalApproveDate!==''&&record.ffinalApproveDate ? moment(record.ffinalApproveDate).format('YYYY-MM-DD HH:mm:ss'):'' } savaList(obj).then(res => { this.loading = false if (res.success) { this.$message.success('保存成功') this.getCostList() }else{ this.$message.error(res.message); } }) savaList1(newObj).then(res => { this.loading = false if (res.success) { this.$message.success('保存成功') this.getCostList() }else{ this.$message.error(res.message); } }) }, //导出 exportList(fileName){ var params = this.queryParam this.loading = true downFile('/orderData/syCostLossReview/planExportXls', params).then(data => { console.log('888') this.loading = false if (!data) { this.$message.warning('文件下载失败') return } if (typeof window.navigator.msSaveBlob !== 'undefined') { window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), 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', fileName + '.xlsx') document.body.appendChild(link) link.click() document.body.removeChild(link) // 下载完成移除元素 window.URL.revokeObjectURL(url) // 释放掉blob对象 } }) }, handleTableChange(pagination, filters, sorter) { this.queryParam.pageNo = pagination.current this.queryParam.pageSize = pagination.pageSize this.getCostList() }, }, computed: {}, mounted() {} } </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>