|
|
|
|
@ -133,6 +133,17 @@
|
|
|
|
|
v-hasPermi="['mes:prepare:export']"
|
|
|
|
|
>打印反冲物料</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="success"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="showBatchPrint"
|
|
|
|
|
v-hasPermi="['mes:prepare:export']"
|
|
|
|
|
>批量打印生产物料</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
@ -303,7 +314,7 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listPrepare, getPrepare, delPrepare, addPrepare, updatePrepare } from "@/api/mes/prepare";
|
|
|
|
|
import {printPrepareByCode,printPrepareXByCode} from "@/api/mes/prepareDetail";
|
|
|
|
|
import {printBatchPrepare, printPrepareByCode, printPrepareXByCode} from "@/api/mes/prepareDetail";
|
|
|
|
|
import moment from "moment/moment";
|
|
|
|
|
import JsBarcode from 'jsbarcode';
|
|
|
|
|
// import { listPrepareDetail, getPrepareDetail, delPrepareDetail, addPrepareDetail, updatePrepareDetail } from "@/api/mes/prepareDetail";
|
|
|
|
|
@ -663,7 +674,53 @@ export default {
|
|
|
|
|
this.download('mes/prepare/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `prepare_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 打印预览(生产物料)
|
|
|
|
|
showBatchPrint() {
|
|
|
|
|
if(this.queryParams.productDate == null){
|
|
|
|
|
this.$modal.msgError("请选择工单生产日期");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.shengchan = true;
|
|
|
|
|
// 清楚缓存
|
|
|
|
|
this.printData.workCenter = "暂无数据";
|
|
|
|
|
this.printData.pageNo =0 ;
|
|
|
|
|
this.printData.printDate = null;
|
|
|
|
|
this.printData.workTable = [];
|
|
|
|
|
this.printData.factory = null;
|
|
|
|
|
this.printData.productDate = null;
|
|
|
|
|
this.printData.prodLineCode = null;
|
|
|
|
|
// 打开工单信息对话框
|
|
|
|
|
this.printDialogVisible = true;
|
|
|
|
|
this.newWorkerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.refreshNewWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
printBatchPrepare({
|
|
|
|
|
productDate:this.queryParams.productDate
|
|
|
|
|
}).then(response => {
|
|
|
|
|
this.printData.printTitle = '订单物料';
|
|
|
|
|
this.printData.factory = response.data[0].factoryCode
|
|
|
|
|
this.printData.productDate = moment(this.queryParams.productDate).format('YYYY-MM-DD')
|
|
|
|
|
this.printData.printDate = moment(new Date()).format('YYYY-MM-DD')
|
|
|
|
|
this.printData.workTable = response.data
|
|
|
|
|
this.printData.pageNo = response.data.length;
|
|
|
|
|
let chunkedArray = [];
|
|
|
|
|
|
|
|
|
|
// 遍历this.printData.workTable
|
|
|
|
|
for (let i = 0; i < this.printData.workTable.length; i += (i==0?this.fenyeNumber:this.fenyeNumberTwo)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 使用slice方法从当前索引i开始切割,切割长度为10(如果剩余元素少于10,则切割剩余所有元素)
|
|
|
|
|
let chunk = this.printData.workTable.slice(i, i + (i==0?this.fenyeNumber:this.fenyeNumberTwo));
|
|
|
|
|
// 将切割后的数组添加到chunkedArray中
|
|
|
|
|
chunkedArray.push(chunk);
|
|
|
|
|
}
|
|
|
|
|
this.printData.workTable = chunkedArray;
|
|
|
|
|
this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.newWorkerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
|
|
|
|
|
this.generateBarcode(this.printData.productDate); //条码 根据打印日期生成
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|