From ca84dcf4420f9d80c2b9ba2c1e857508fecf73b3 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Mon, 12 Aug 2024 14:18:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/order/mobileCreate.vue | 212 +++++++++++++++++++++++++------ 1 file changed, 176 insertions(+), 36 deletions(-) diff --git a/src/views/order/mobileCreate.vue b/src/views/order/mobileCreate.vue index b5da924..42e733d 100644 --- a/src/views/order/mobileCreate.vue +++ b/src/views/order/mobileCreate.vue @@ -63,6 +63,7 @@ size="small" :data="equipments" :columns="table" + @on-row-click="row => equipmentSelect(pickedEquipments, row, false)" @on-select="(selection, row) => equipmentSelect(selection, row, false)" @on-select-cancel="(selection, row) => equipmentSelect(selection, row, false)" @on-select-all="(selection) => equipmentSelect(selection, {}, true)" @@ -90,44 +91,55 @@ - +
-

{{ item._name }}

+

{{ ++index }}.{{ item._name }}

+
- - - - - - - - - {{ i.key }} - - - - - - - - - - - - - - - - - {{ i.label }} - - - + + + + + + + + + + + {{ i.key }} + + + + + + + + + + + + + + + + + {{ i.label }} + + + + +
@@ -153,7 +165,9 @@ import Calendar from "v-calendar/src/components/Calendar.vue"; import DatePicker from "v-calendar/src/components/DatePicker.vue"; import { show } from "@/api/system/customFormField"; -import { index } from "@/api/system/baseForm"; +import {index, save} from "@/api/system/baseForm"; +import {uuid} from "@/utils"; +import {checkTransfer} from "@/api/other"; export default { components: { @@ -225,6 +239,47 @@ export default { } }, methods: { + startTimePick (row) { + if (row._last) { + const [hour, min] = row.start_time + .split(":") + .map((i) => Number(i)); + let addTime = { + hour: Math.floor(row._last), + min: (row._last % 1) * 60, + }; + let resTime = { + hour: + hour + addTime.hour + (min + addTime.min >= 60 ? 1 : 0), + min: (min + addTime.min) % 60, + }; + row.end_time = `${resTime.hour + .toString() + .padStart(2, "0")}:${resTime.min + .toString() + .padStart(2, "0")}`; + } + }, + lastTimePick (row) { + const [hour, min] = row.start_time + .split(":") + .map((i) => Number(i)); + let addTime = { + hour: Math.floor(row._last), + min: (row._last % 1) * 60, + }; + let resTime = { + hour: + hour + addTime.hour + (min + addTime.min >= 60 ? 1 : 0), + min: (min + addTime.min) % 60, + }; + row.end_time = `${resTime.hour + .toString() + .padStart(2, "0")}:${resTime.min + .toString() + .padStart(2, "0")}`; + }, + handleAreaCheckAll (e) { this.select.filter[2].value = e ? this.areas.map(i => i.value).toString() : ""; this.isIndeterminateArea = false; @@ -366,6 +421,7 @@ export default { this.form = this.pickedEquipments.map(i => ({ equipment_id: i.id, start_time: "", + _last: 0, end_time: "", content: "", level: 1, @@ -375,10 +431,89 @@ export default { _shuibengtaishu: i.shuibengtaishu, _name: i.name, leibie: "", + _isShow: true, })) this.step++; } }, + + + async submit() { + const submitData = this.form.filter( + (i) => i.start_time || i.end_time || i.content + ); + + let isNeed = 0; + try { + await this.$confirm("是否需要走流程?","提示",{ + confirmButtonText: "需要", + cancelButtonText: "不需要", + type: "info", + closeOnClickModal: false, + distinguishCancelAndClose: true + }) + isNeed = 1; + } catch (e) { + if (e === 'cancel') { + isNeed = 0; + } else { + return + } + } + + const uid = uuid(); + let promiseAll = []; + let loadingInstance = this.$loading({ + lock: true, + background: "rgba(0,0,0,0.4)", + text: "正在加载中...", + }); + for (let j = 0;j < submitData.length;j++) { + let i = submitData[j] + + delete i["equipment_id-span"]; + delete i["_index"]; + delete i["_rowKey"]; + + i.start_time = `${this.date} ${i.start_time}`; + i.end_time = i.end_time ? `${this.date} ${i.end_time}` : ''; + i.no = uid; + i.status = 1; + + try { + const res = await checkTransfer({ + start_time: i.start_time, + end_time: i.end_time, + equipment_id: i.equipment_id, + diaolingleixing: i.diaolingleixing + }) + promiseAll.push( + save( + { + table_name: "transfers", + ...i, + shifouzouliucheng: isNeed, + is_adjust: -1 + }, + false + ) + ); + } catch (e) { + + } + } + Promise.all(promiseAll) + .then((res) => { + loadingInstance.close(); + this.$message({ + type: "success", + message: `成功创建${res.length}条调令`, + }); + }) + .catch((_) => { + loadingInstance.close(); + }); + }, }, computed: {}, watch: { @@ -459,6 +594,11 @@ export default { z-index: 999999999; } } +h3 { + text-align: center; + color: $primaryColor; + line-height: 2; +} @media (max-width: 768px) { ::v-deep .el-checkbox { margin-right: 0;