From b2297f323e084c8ecba36cc90d812521f90811f9 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 26 Jul 2023 15:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97(=E7=BB=B4=E6=8A=A4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mes/pro/order.js | 4 +- src/views/mes/pro/order/index.vue | 231 ++++++++++++++++++++++-------- 2 files changed, 172 insertions(+), 63 deletions(-) diff --git a/src/api/mes/pro/order.js b/src/api/mes/pro/order.js index 79cd21f1..c1a115e7 100644 --- a/src/api/mes/pro/order.js +++ b/src/api/mes/pro/order.js @@ -35,9 +35,9 @@ export function getConvert() { } // 获取线体 -export function getprodLineShift() { +export function getprodLineShift(orderType) { return request({ - url: '/mes/order/getProdLineShift', + url: '/mes/order/getProdLineShift/'+'?type='+orderType, method: 'get', }) } diff --git a/src/views/mes/pro/order/index.vue b/src/views/mes/pro/order/index.vue index 0beaf834..0d9830ac 100644 --- a/src/views/mes/pro/order/index.vue +++ b/src/views/mes/pro/order/index.vue @@ -33,16 +33,24 @@ @keyup.enter.native="handleQuery" /> - - + + - + v-for="dict in dict.type.order_status" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + + + + 搜索 @@ -51,6 +59,16 @@ + + 新增 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -252,19 +349,16 @@ export default { name: "Order", + dicts: ['product_type', 'order_status'], components: { Treeselect }, data() { return { - // 拆分状态选择 - statusOptions:[{ - key:1, - value:"已拆分" - },{ - key:0, - value:"未拆分" - }], + // 表单参数 + form: {}, + // 新增模块 + dialogVisible: false, //以下为新内容 productList:[], //工单遮罩层 @@ -312,7 +406,6 @@ refreshTable: true, // 查询参数 queryParams: { - status: null, planFactoryCode: null, orderType: null, orderCode: null, @@ -345,23 +438,62 @@ }; }, created() { - this.getList(); + + var now = new Date(); + // 转换日期格式 + const year = now.getFullYear(); // 获取年份 + const month = String(now.getMonth() + 1).padStart(2, '0'); // 获取月份 + const day = String(now.getDate()).padStart(2, '0'); // 获取日期 + const date = `${year}-${month}-${day}`; + + this.loading = true; + this.queryParams.status = 'o0'; + this.queryParams.planProDate = date; + listOrder(this.queryParams).then(response => { + this.orderList = this.handleTree(response.data, "orderCode", "parentOrder"); + this.loading = false; + }); }, methods: { + // 判空、空串 + checkNull(entity) { + if (entity !== undefined && entity !== '' && entity !== null){ + return 1; + } + return 0; + }, + handleClose(done) { + this.$confirm('确认关闭?') + .then(_ => { + this.reset(); + done(); + }) + .catch(_ => {}); + }, /** 提交按钮 */ submitForm() { + // 表单校验 + if (this.checkNull(this.form.prodCode) == 0 || this.checkNull(this.form.planProDate) == 0 || this.checkNull(this.form.prodDesc) == 0 || this.checkNull(this.form.planComplete) == 0 || this.checkNull(this.form.quantity) == 0 || this.checkNull(this.form.unit) == 0 || this.checkNull(this.form.prodType) == 0){ + this.$message({ + message:'数据不能为空!', + type:'warning' + }) + return; + } this.$refs["form"].validate(valid => { if (valid) { if (this.form.id != null) { updateOrder(this.form).then(response => { this.$modal.msgSuccess("修改成功"); - this.open = false; + this.dialogVisible = false; + this.reset(); this.getList(); }); } else { addOrder(this.form).then(response => { this.$modal.msgSuccess("新增成功"); - this.open = false; + this.dialogVisible = false; + this.reset(); this.getList(); }); } @@ -370,16 +502,19 @@ }, /** 检验批次编码是否重复 */ batchCodeChange(e){ - for (let i = 1; i < this.formFields.length;i++){ - if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){ - this.$message({ - message: '批次号不能重复', - type: 'warning' - }) - this.formFields = [{ - batchCode: '', - batchQuantity: '' - }] + if (this.formFields.length>1){ + for (let i = 0; i < this.formFields.length-1; i++){ + if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){ + this.$message({ + message:'批次号不能重复!', + type:'warning' + }) + this.formFields = [{ + batchCode: '', + batchQuantity: '' + }] + return; + } } } }, @@ -420,6 +555,7 @@ }) return; } + //整理订单传入到后端 this.splitForm.formFields = this.formFields; //整理数据往后端发送 @@ -457,22 +593,6 @@ batchCode: '', batchQuantity: '' }], - // 获取该订单下最新订单列表 - getOrderList(id).then(response => { - if(response.code == 500){ - this.$modal.msgError(response.msg); - }; - // 设置最新数据 - this.productData[0] = response.data; - // 在获取到新的数据后执行以下代码 - this.proLoading = true; // 设置加载状态为true,表示正在加载 - this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格 - this.$nextTick(() => { - // 使用$nextTick来等待DOM更新完成 - this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格 - this.proLoading = false; // 设置加载状态为false,表示加载完成 - }); - }) // 获取该订单下的最新工单列表 getWorkOrderList(id).then(response => { @@ -493,23 +613,12 @@ if (check){ setTimeout(() => { - this.resetQuery(); + this.getList(); // 等待1秒后执行的代码 this.splitOpen = false; }, 500); } }, - // 调试 - submitForm(formName) { - this.$refs[formName].validate((valid) => { - if (valid) { - alert('submit!'); - } else { - console.log('error submit!!'); - return false; - } - }); - }, /** 动态添加表单 */ addField() { //如果批次数量大于等于拆分数量则不允许拆分 @@ -564,13 +673,13 @@ }, // 取消按钮 cancel() { - this.splitOpen = false; + this.dialogVisible = false; this.open = false; this.reset(); }, // 表单重置 reset() { - this.splitForm = { + this.form = { id: null, planFactoryCode: null, orderType: null, @@ -626,7 +735,7 @@ this.resetForm("queryForm"); this.handleQuery(); }, - /** 新增按钮操作 */ + /** 拆分按钮操作 */ handleAdd(row) { this.reset(); this.getTreeselect(); @@ -694,7 +803,7 @@ //初始化日期为默认今天 this.splitForm.productDate = new Date(); //获取成型机和班次 - getprodLineShift().then(response => { + getprodLineShift(row.orderType).then(response => { this.proline = response.data.lines; this.workShift = response.data.shifts; });