diff --git a/src/views/device/deviceOrder/index.vue b/src/views/device/deviceOrder/index.vue index d5f4e056..e4bf2724 100644 --- a/src/views/device/deviceOrder/index.vue +++ b/src/views/device/deviceOrder/index.vue @@ -948,12 +948,14 @@ export default { } this.$modal.confirm('是否确认删除计划工单编号为"' + orderCodes + '"的数据项?').then(function () { - return delDeviceOrder(orderIds); - }).then(() => { - this.getList(); - this.$modal.msgSuccess("删除成功"); - }).catch(() => { - }); + delDeviceOrder(orderIds).then(response => { + if (response.code != 500) { + this.$modal.msgSuccess("删除成功"); + this.getList(); + } + }).catch(() => { + }); + }) }, /** 导出按钮操作 */ handleExport() { diff --git a/src/views/device/inspectionPlan/index.vue b/src/views/device/inspectionPlan/index.vue index 8d0e1c06..9f35e46b 100644 --- a/src/views/device/inspectionPlan/index.vue +++ b/src/views/device/inspectionPlan/index.vue @@ -377,18 +377,18 @@
- + - + - + - + - + - + - + - + { if (valid) { + if (this.selectPersonList.length == 0) { + this.$message({ + message: "请请选择人员!", + type: "warning" + }) + return + } this.planLoading = true; if (this.form.planId != null) { this.form.personList = this.selectPersonList; diff --git a/src/views/device/spotCheckPlan/index.vue b/src/views/device/spotCheckPlan/index.vue index a91052ed..cbdf74c1 100644 --- a/src/views/device/spotCheckPlan/index.vue +++ b/src/views/device/spotCheckPlan/index.vue @@ -394,17 +394,17 @@
- + - - - + + + - + - + - + - - - - + + { @@ -969,13 +960,13 @@ export default { // 检查项名称 var itemName = this.form.equipmentItem[i].equPlanDetailList[j].itemName; - for (let k = 0; k < this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList.length; k++){ + for (let k = 0; k < this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList.length; k++) { if (this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k].showFlag == true) { this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k].itemName = itemName; if (this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k].standardType == "qualitative") { this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k].standardTypeName = "定性"; - }else { + } else { this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k].standardTypeName = "定量"; } this.itemDetailList.push(this.form.equipmentItem[i].equPlanDetailList[j].equPlanStandardList[k]); @@ -1056,93 +1047,126 @@ export default { }, // 下一步 stepNext() { - if (this.form.planWorkshop == null) { - this.$message({ - message: '请选择车间!', - type: 'warning' - }) - return + // 校验 + if (this.spotCheckStep == 0) { + if (this.form.planName == null) { + this.$message({ + message: "计划名称不能为空!", + type: "warning" + }) + return + } + if (this.form.planLoop <= 0) { + this.$message({ + message: "循环周期不可小于等于’0‘!", + type: "warning" + }) + return + } + if (this.form.planLoopStart == null) { + this.$message({ + message: "点检开始时间不能为空!", + type: "warning" + }) + return + } + if (this.form.planWorkshop == null) { + this.$message({ + message: "车间不能为空!", + type: "warning" + }) + return + } + } + if (this.spotCheckStep == 1) { + if (this.form.equipmentItem.length == 0) { + this.$message({ + message: "请选择设备!", + type: "warning" + }) + return + } } this.spotCheckStep++; }, - /** 查询点检计划列表 */ - getList() { - this.loading = true; + /** 查询点检计划列表 */ + getList() { + this.loading = true; listPlan(this.queryParams).then(response => { this.spotCheckPlanList = response.rows; this.total = response.total; this.loading = false; }); - }, - // 取消按钮 - cancel() { - this.open = false; - this.reset(); - }, - // 表单重置 - reset() { - this.form = { - planId: null, - planCode: null, - planName: null, - planWorkshop: null, - planProdLine: null, - equipmentName: null, - equipmentCode: null, - planLoop: null, - planLoopType: 'day', - planLoopStart: null, - planLoopEnd: null, - planPerson: null, - planStatus: '0', - planRestrict: '1', + }, + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + // 表单重置 + reset() { + this.form = { + planId: null, + planCode: null, + planName: null, + planWorkshop: null, + planProdLine: null, + equipmentName: null, + equipmentCode: null, + planLoop: null, + planLoopType: 'day', + planLoopStart: null, + planLoopEnd: null, + planPerson: null, + planStatus: '0', + planRestrict: '1', planType: "spotInspection", - planOutsource: null, - workCode: null, - upkeep: null, - calculationRule: null, - shutDown: null, - factoryCode: null, - attr1: null, - attr2: null, - attr3: null, - delFlag: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, + planOutsource: null, + workCode: null, + upkeep: null, + calculationRule: null, + shutDown: null, + factoryCode: null, + attr1: null, + attr2: null, + attr3: null, + delFlag: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, createTimeArray: [], updateTimeArray: [], planTimeArray: [], equipmentItem: [], personList: [], loopStartArray: [], - }; - this.resetForm("form"); - }, - /** 搜索按钮操作 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm("queryForm"); + }; + this.resetForm("form"); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); // 重置日期范围 this.queryParams.createTimeArray = []; this.queryParams.updateTimeArray = []; this.queryParams.loopStartArray = []; - this.handleQuery(); - }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.planId) - this.single = selection.length!==1 - this.multiple = !selection.length - }, - /** 新增按钮操作 */ - handleAdd() { + this.handleQuery(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.planId) + this.single = selection.length !== 1 + this.multiple = !selection.length + }, + /** 新增按钮操作 */ + handleAdd() { this.reset(); // 清除缓存 this.resetQuery(); @@ -1153,11 +1177,11 @@ export default { this.setPerson(); this.setWorkCenter(); - this.open = true; - this.title = "添加点检计划"; - }, - /** 修改按钮操作 */ - handleUpdate(row) { + this.open = true; + this.title = "添加点检计划"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { this.reset(); // 清除缓存 this.queryEquipment = []; @@ -1184,13 +1208,20 @@ export default { this.open = true; this.title = "修改计划"; }) - }, - /** 提交按钮 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { + }, + /** 提交按钮 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.selectPersonList.length == 0) { + this.$message({ + message: "请请选择人员!", + type: "warning" + }) + return + } this.planLoading = true; - if (this.form.planId != null) { + if (this.form.planId != null) { this.form.personList = this.selectPersonList; updatePlan(this.form).then(response => { this.planLoading = false; @@ -1198,21 +1229,21 @@ export default { this.open = false; this.getList(); }); - } else { + } else { this.form.personList = this.selectPersonList; addPlan(this.form).then(response => { this.planLoading = false; - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 删除按钮操作 */ - handleDelete(row) { - const planIds = row.planId || this.ids; + this.$modal.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + const planIds = row.planId || this.ids; var planCodes = ''; // 处理信息 @@ -1232,20 +1263,21 @@ export default { } } - this.$modal.confirm('是否确认删除计划编号为"' + planCodes + '"的数据项?').then(function() { - return delPlan(planIds); - }).then(() => { - this.getList(); - this.$modal.msgSuccess("删除成功"); - }).catch(() => {}); - }, - /** 导出按钮操作 */ - handleExport() { - this.download('device/spotCheckPlan/export', { - ...this.queryParams - }, `spotCheckPlan_${new Date().getTime()}.xlsx`) - } - } + this.$modal.confirm('是否确认删除计划编号为"' + planCodes + '"的数据项?').then(function () { + return delPlan(planIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => { + }); + }, + /** 导出按钮操作 */ + handleExport() { + this.download('device/spotCheckPlan/export', { + ...this.queryParams + }, `spotCheckPlan_${new Date().getTime()}.xlsx`) + } + } };