From 6617614920ddd4ca12369b0fa76b3d5c0e6b9060 Mon Sep 17 00:00:00 2001 From: qb <1191961160@qq.com> Date: Fri, 19 Apr 2024 09:49:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=9B=B6=E6=8B=85?= =?UTF-8?q?=E5=BC=80=E5=8D=95=E6=94=B9=E5=8D=95=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/waybill/CreateZeroOrder.vue | 217 +++++++++++++++++++++----- 1 file changed, 179 insertions(+), 38 deletions(-) diff --git a/src/views/waybill/CreateZeroOrder.vue b/src/views/waybill/CreateZeroOrder.vue index 604d3f85..1ab466c7 100644 --- a/src/views/waybill/CreateZeroOrder.vue +++ b/src/views/waybill/CreateZeroOrder.vue @@ -7,7 +7,7 @@ :inline="true" :rules="details.rules" :model="query" - class="el-fr-d" + class="table_form" label-width="100px" > @@ -843,6 +843,63 @@ + + + + + + + + + + + + + + + + + + + +
+ 取 消 + 确 认 +
+
@@ -862,7 +919,7 @@ import dayjs from 'dayjs'; import { mapGetters } from 'vuex'; /** 获取字典 */ import { getDictionaryBiz } from '@/api/system/dict'; -import { downloadXls, computeNumber, debounce } from '@/utils/util'; +import { downloadXls, computeNumber, debounce, setNodeHeight } from '@/utils/util'; import { getLazyTreeAll } from '@/api/base/region'; import { ElMessage, ElMessageBox } from 'element-plus'; import type { FormInstance, FormRules } from 'element-plus'; @@ -888,6 +945,7 @@ const instance = getCurrentInstance(); // 获取表单实例 const ruleFormRef = ref(); +const causeFormRef = ref(); // vuex const $store = useStore(); @@ -1205,6 +1263,8 @@ const details = reactive({ popUpShow: { /** 是否继续开单 */ titleVisited: false, + /** 改单原因 */ + titleVisited: false, }, itemRules: { /** 计价方式 */ @@ -1265,6 +1325,43 @@ const details = reactive({ /** 装卸费 */ // { name: '仓库存储费', key: 'storageFee' }, ], + /** 修改原因 */ + causeForm: {}, + /** 修改列表 */ + changeColumnList: [ + { + prop: 'itemName', + label: '修改项', + type: 1, + values: '', + width: '', + checkarr: [], + fixed: false, + sortable: true, + }, + { + prop: 'oldValue', + label: '修改前', + type: 1, + values: '', + width: '', + checkarr: [], + fixed: false, + sortable: true, + }, + { + prop: 'newValue', + label: '修改后', + type: 1, + values: '', + width: '', + checkarr: [], + fixed: false, + sortable: false, + }, + ], + /** 修改数据 */ + changeData: [], }); const { query, data, drawerShow, loadingObj } = toRefs(details); @@ -1912,33 +2009,43 @@ const handleSubmit = (formEl: FormInstance | undefined) => { // 记录提交参数 details.submitData = submitData; + // const response = await postUpdateWaybillVerify(submitData); + // if (response.data.code !== 200) return; + + // if (!response.data.data) return ElMessage.warning('没有更改的数据'); + + // ElMessageBox.alert(response.data.data.replaceAll(';', '
'), '被更改数据', { + // dangerouslyUseHTMLString: true, + // confirmButtonText: '确认', + // callback: async (action: Action) => { + // try { + // details.loadingObj.submitLoadingBtn = true; + + // const res = await postUpdateWaybill(submitData); + // const { code, msg } = res.data; + // if (code !== 200) return; + // if (msg) ElMessage.success(msg); + + // back(); + // } catch (error) { + // console.log('error :>> ', error); + // } finally { + // details.loadingObj.submitLoadingBtn = false; + // } + // }, + // }); + const response = await postUpdateWaybillVerify(submitData); if (response.data.code !== 200) return; - if (!response.data.data) return ElMessage.warning('没有更改的数据'); - - ElMessageBox.alert(response.data.data.replaceAll(';', '
'), '被更改数据', { - // if you want to disable its autofocus - // autofocus: false, - dangerouslyUseHTMLString: true, - confirmButtonText: '确认', - callback: async (action: Action) => { - try { - details.loadingObj.submitLoadingBtn = true; - - const res = await postUpdateWaybill(submitData); - const { code, msg } = res.data; - if (code !== 200) return; - if (msg) ElMessage.success(msg); - - back(); - } catch (error) { - console.log('error :>> ', error); - } finally { - details.loadingObj.submitLoadingBtn = false; - } - }, - }); + if (!response.data.data || response.data.data.length === 0) + return ElMessage.warning('没有更改的数据'); + + details.changeData = response.data.data; + details.popUpShow.causeVisited = true; + await nextTick(); + + setNodeHeight(tableNode.value.$el, '40vh'); } const { code, msg } = res.data; @@ -2087,6 +2194,39 @@ const handleFindPrice = async (condition?: any) => { } }; +/** 改单提交 */ +const handleSubmitCause = () => { + causeFormRef.value.validate(async valid => { + if (!valid) return; + + const submitData = { ...details.submitData, ...details.causeForm }; + for (let i = 0; i < details.query.editWaybillReasonTypeList.length; i++) { + const value = details.query.editWaybillReasonTypeList[i]; + + if (value.dictKey !== details.causeForm.editResonCode) continue; + + submitData.editReson = value.dictValue; + break; + } + + try { + details.loadingObj.submitLoadingBtn = true; + details.popUpShow.causeVisited = false; + + const res = await postUpdateWaybill(submitData); + const { code, msg } = res.data; + if (code !== 200) return; + if (msg) ElMessage.success(msg); + + back(); + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.submitLoadingBtn = false; + } + }); +}; + watch( () => $route.query, () => { @@ -2100,14 +2240,20 @@ watch(