From e990680159c908a149458ab640ffc92196b84cd0 Mon Sep 17 00:00:00 2001 From: helloDy <1615073571@qq.com> Date: Tue, 18 Jun 2024 08:47:53 +0800 Subject: [PATCH] bug --- src/views/produce/target/add-or-updata.vue | 96 +++++++++++-------- src/views/produce/target/index.vue | 11 ++- src/views/produce/workOrder/add-or-updata.vue | 10 +- src/views/produce/workOrder/index.vue | 18 ++-- 4 files changed, 79 insertions(+), 56 deletions(-) diff --git a/src/views/produce/target/add-or-updata.vue b/src/views/produce/target/add-or-updata.vue index 34ab3ac..43b7cd3 100644 --- a/src/views/produce/target/add-or-updata.vue +++ b/src/views/produce/target/add-or-updata.vue @@ -1,7 +1,7 @@ @@ -11,7 +11,7 @@ {{ dataForm.id ? '编辑' : '新增' }}
- + @@ -29,7 +29,7 @@ - + @@ -40,19 +40,19 @@ - + - - + + - + - + @@ -265,9 +265,10 @@ export default { teamList: [], sectionList: [], visible: false, - reportTime: undefined, + // reportTime: undefined, week: undefined, dataForm: { + reportTime: undefined, factoryType: 0, id: undefined, factory: undefined, @@ -303,9 +304,9 @@ export default { }, // materialList: [], dataRule: { - // materialId: [{ required: true, message: "", trigger: "blur" }], - // workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }], - // num: [{ required: true, message: "数量不能为空", trigger: "blur" }], + factory: [{ required: true, message: "工厂名称不能为空", trigger: "chnage" }], + reportTime: [{ required: true, message: "时间不能为空", trigger: "change" }], + targetType: [{ required: true, message: "时间维度不能为空", trigger: "change" }] // detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }], // logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }], @@ -316,6 +317,13 @@ export default { // this.getCurrentTime() }, methods: { + setReportTime() { + this.dataForm.reportTime = this.week + }, + clearTime() { + this.week = undefined + this.dataForm.reportTime = undefined + }, formClear() { if (this.$refs.dataForm !== undefined) { this.$refs.dataForm.resetFields() @@ -325,35 +333,41 @@ export default { // this.dataForm.targetTime = undefined // }, handleClose() { - // 新增 - if (this.dataForm.targetType === 1) { - this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : undefined - } else { - this.dataForm.targetTime = this.reportTime ? Number(this.reportTime) : undefined - } - if (this.dataForm.id) { - // 修改 - updateProduceTarget({ - ...this.dataForm - }).then(res => { - if (res.code === 0) { - this.$message.success('修改成功!') - this.visible = false - this.$emit('refreshDataList') + this.$refs["form"].validate(valid => { + if (valid) { + // 新增 + if (this.dataForm.targetType === 1) { + this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : '' + } else { + this.dataForm.targetTime = this.dataForm.reportTime ? Number(this.dataForm.reportTime) : '' } - }) - } else { - // 新增 - createProduce({ - ...this.dataForm - }).then(res => { - if (res.code === 0) { - this.$message.success('新增成功!') - this.visible = false - this.$emit('refreshDataList') + if (this.dataForm.id) { + // 修改 + updateProduceTarget({ + ...this.dataForm, + reportTime: undefined + }).then(res => { + if (res.code === 0) { + this.$message.success('修改成功!') + this.visible = false + this.$emit('refreshDataList') + } + }) + } else { + // 新增 + createProduce({ + ...this.dataForm, + reportTime: undefined + }).then(res => { + if (res.code === 0) { + this.$message.success('新增成功!') + this.visible = false + this.$emit('refreshDataList') + } + }) } - }) - } + } + }) }, init(id) { this.dataForm.id = id || undefined @@ -363,7 +377,8 @@ export default { getProduceTargetDetail(this.dataForm.id).then(res => { this.dataForm = res.data if (this.dataForm.targetType === 0 || this.dataForm.targetType === 2 || this.dataForm.targetType === 3) { - this.reportTime = String(this.dataForm.targetTime) + // this.dataForm.reportTime = String(this.dataForm.targetTime) + this.$set(this.dataForm, 'reportTime', String(this.dataForm.targetTime)) } if (this.dataForm.targetType === 1) { const date = new Date() @@ -372,6 +387,7 @@ export default { date.setDate((Number(String(this.dataForm.targetTime).slice(4)) - 1)* 7 + 1) // console.log('你好', date, moment(date).format('yyyyWW'), String(this.dataForm.targetTime).slice(4)) this.week = date + this.$set(this.dataForm, 'reportTime', date) } }) } diff --git a/src/views/produce/target/index.vue b/src/views/produce/target/index.vue index 876ef83..5d09d83 100644 --- a/src/views/produce/target/index.vue +++ b/src/views/produce/target/index.vue @@ -1,7 +1,7 @@ @@ -24,7 +24,7 @@ - + @@ -458,6 +458,13 @@ export default { this.changeTime() }, methods: { + clearTime() { + this.listQuery.beginTime = undefined + this.listQuery.endTime = undefined + this.listQuery.reportTime = [] + this.start = undefined + this.end = undefined + }, handleImport() { this.upload.title = "生产目标导入"; this.upload.open = true; diff --git a/src/views/produce/workOrder/add-or-updata.vue b/src/views/produce/workOrder/add-or-updata.vue index 5e2a301..b52d0ba 100644 --- a/src/views/produce/workOrder/add-or-updata.vue +++ b/src/views/produce/workOrder/add-or-updata.vue @@ -1,7 +1,7 @@ @@ -23,7 +23,7 @@

工单类型

-

{{ ['', '芯片订单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}

+

{{ ['', '芯片工单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}

工单来源

@@ -39,7 +39,7 @@

工单状态

-

{{ ['未开始', '生产中', '已完成'][dataForm.orderStatus] }}

+

{{ ['', '未开始', '生产中', '已完成'][dataForm.orderStatus] }}

投入状态

@@ -83,7 +83,7 @@
-
+
@@ -267,7 +267,7 @@ export default { this.pieChart = echarts.init(this.$refs['pie']) this.pieChart.setOption({ title: { - text: '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%', + text: !isNaN((pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100) ? ( '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%') : '产品良率 -', left: 'center' // subtext: 'Fake Data' }, diff --git a/src/views/produce/workOrder/index.vue b/src/views/produce/workOrder/index.vue index 4f39c19..eae0180 100644 --- a/src/views/produce/workOrder/index.vue +++ b/src/views/produce/workOrder/index.vue @@ -1,7 +1,7 @@ @@ -88,7 +88,7 @@ export default { factorys: ['瑞昌中建材', '邯郸中建材', '株洲中建材', '佳木斯中建材', '成都中建材', '凯盛光伏', '蚌埠兴科'], factoryNum: [0, 0, 0, 0, 0, 0, 0], inputNum: 0, - heightNum: 210, + heightNum: 180, factoryList, factoryArray, listQuery: { @@ -141,15 +141,15 @@ export default { selectOptions: [ { label: '未开始', - value: 0 - }, - { - label: '生产中', value: 1 }, { - label: '已完成', + label: '生产中', value: 2 + }, + { + label: '已完成', + value: 3 } ], labelField: "label", @@ -247,7 +247,7 @@ export default { prop: 'orderStatus', label: '工单状态', // filter: publicFormatter('workorder_status') - filter: (val) => ['未开始', '生产中', '已完成'][val], + filter: (val) => ['', '未开始', '生产中', '已完成'][val], }, { prop: 'startTime', @@ -396,7 +396,7 @@ export default { background-color: #fff; border-radius: 4px; padding: 16px 16px 0; - height: calc(100vh - 80px); + height: calc(100vh - 40px); overflow: auto; }