From 7e0cf107c3d373390c4cb5a4e2e37f4b35c4ff96 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 3 Nov 2023 16:01:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=85=BB=E5=B7=A5=E5=8D=95-=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/upkeepOrder/index.vue | 198 ++++++++++++------------- 1 file changed, 96 insertions(+), 102 deletions(-) diff --git a/src/views/device/upkeepOrder/index.vue b/src/views/device/upkeepOrder/index.vue index 127513e..a9e0242 100644 --- a/src/views/device/upkeepOrder/index.vue +++ b/src/views/device/upkeepOrder/index.vue @@ -206,7 +206,7 @@ plain icon="el-icon-plus" size="mini" - @click="orderDialog = true" + @click="cilckFastWork" v-hasPermi="['device:upkeepOrder:add']" >快速工单 @@ -355,7 +355,19 @@ - + + + + + + + + + + + + + + + + + 取 消 - 确 定 + 确 定 @@ -732,7 +758,7 @@ import { updateUpkeepOrder } from "@/api/device/upkeepOrder"; import {formatEquItem, querySpareList} from "@/api/device/upkeepPlan"; -import {getEquList} from "@/api/device/plan"; +import {getEquList, getPersonList, getWorkCenter} from "@/api/device/plan"; import {getDeviceOrder} from "@/api/device/deviceOrder"; export default { @@ -868,10 +894,50 @@ export default { this.getList(); }, methods: { + // 获取工作中心 + setWorkCenter() { + getWorkCenter().then(response => { + this.workCenterList = response.data; + }) + }, + // 点击快速工单按钮 + cilckFastWork(){ + this.selectPersonList = []; + this.personList = []; + this.setPerson(); + this.setWorkCenter(); + this.orderDialog = true; + }, + // 保养人员穿梭框 + filterMethod(query, item) { + return item.label.indexOf(query) > -1; + }, + // 快速工单提交按钮操作 + subOrder() { + console.log("提交按钮") + console.log(this.form) + this.form.personList = this.selectPersonList; + addUpkeepOrder(this.form).then(response => { + this.$modal.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }); + }, // 编辑标准确认按钮 standardBtn() { this.editorItem = false; }, + // 获取人员List-置入穿梭框信息 + setPerson() { + getPersonList().then(response => { + for (let i = 0; i < response.data.length; i++) { + this.personList.push({ + label: response.data[i].nickName + '(' + response.data[i].userName + ')', + key: response.data[i].userId, + }) + } + }); + }, // 删除标准 delStandard(e) { e.showFlag = false; @@ -923,6 +989,7 @@ export default { return } + this.form.equipmentItem = []; // 处理信息 formatEquItem(this.selectEquList).then(response => { @@ -1002,98 +1069,7 @@ export default { }, // 改变巡检周期事件 changeArray(e) { - console.log(e) - console.log(this.form.planTimeArray) - if (this.form.planLoop == null) { - this.$message({ - message: '请输入循环周期!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - if (this.form.planLoopType == null) { - this.$message({ - message: '请选择循环类型!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - - // 检验 - if (this.form.planLoopType == 'day') { - // 计算日期差值(以毫秒为单位) - let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); - // 转换为天数 - let days = Math.floor(diff / (1000 * 60 * 60 * 24)); - - if (days > this.form.planLoop) { - this.$message({ - message: '可执行时间范围为' + days + '天,循环周期为' + days + '天,超过循环周期' + (days - this.form.planLoop) + '天,请重新选择执行时间!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - } - - if (this.form.planLoopType == 'week') { - // 计算日期差值(以毫秒为单位) - let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); - // 转换为周数 - let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7)); - - if (weeks > (this.form.planLoop / 7)) { - this.$message({ - message: '可执行时间范围为' + weeks + '周,循环周期为' + weeks + '周,超过循环周期' + (weeks * 7 - this.form.planLoop) + '天,请重新选择执行时间!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - } - - if (this.form.planLoopType == 'month') { - let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth(); - - if (monthsDiff > this.form.planLoop) { - this.$message({ - message: '可执行时间范围为' + monthsDiff + '月,循环周期为' + monthsDiff + '月,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - } - - if (this.form.planLoopType == 'season') { - let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth(); - - if (monthsDiff * 3 > this.form.planLoop) { - this.$message({ - message: '可执行时间范围为' + monthsDiff * 3 + '季度,循环周期为' + monthsDiff * 3 + '季度,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - } - - if (this.form.planLoopType == 'year') { - // 计算年份差值 - let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear(); - - if (yearsDiff > this.form.planLoop) { - this.$message({ - message: '可执行时间范围为' + yearsDiff + '年,循环周期为' + yearsDiff + '年,超过循环周期' + (yearsDiff - this.form.planLoop) + '年,请重新选择执行时间!', - type: 'warning' - }) - this.form.planTimeArray = []; - return - } - } - + console.log("改变了保养执行时间") }, // 选择备件确定按钮 confirmSelectSpareBtn() { @@ -1206,7 +1182,7 @@ export default { this.single = selection.length !== 1 this.multiple = !selection.length }, - /** 新增按钮操作 */ + /** 快速工单按钮操作 */ handleAdd() { this.reset(); this.open = true; @@ -1226,6 +1202,8 @@ export default { }, /** 提交按钮 */ submitForm() { + console.log("提交按钮") + console.log(this.form) this.$refs["form"].validate(valid => { if (valid) { if (this.form.orderId != null) { @@ -1235,11 +1213,13 @@ export default { this.getList(); }); } else { - addUpkeepOrder(this.form).then(response => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }); + console.log("提交按钮") + console.log(this.form) + // addUpkeepOrder(this.form).then(response => { + // this.$modal.msgSuccess("新增成功"); + // this.open = false; + // this.getList(); + // }); } } }); @@ -1264,3 +1244,17 @@ export default { } }; +