From ca5e2ad560f41a7626b4b8d727e7e7a3fd8fb35b Mon Sep 17 00:00:00 2001 From: lijingjia Date: Thu, 29 Aug 2024 14:37:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E8=BF=90=E5=87=BA=E5=8F=A3bug?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Form/src/components/InputTextArea.vue | 7 +- src/hooks/component/useFormItem.ts | 1 + .../detail/components/ladingInfo.tsx | 10 +- .../operation/seaexport/detail/index.vue | 15 ++- .../seaexport/detail/modules/baseInfo.tsx | 3 +- .../seaexport/detail/modules/basicInfo.vue | 1 - .../seaexport/detail/modules/cargoInfo.vue | 91 +++++++++++-------- .../seaexport/detail/modules/goodsTable.vue | 74 ++++++++++++--- .../seaexport/detail/modules/mailingInfo.vue | 8 +- 9 files changed, 137 insertions(+), 73 deletions(-) diff --git a/src/components/Form/src/components/InputTextArea.vue b/src/components/Form/src/components/InputTextArea.vue index 6fc06534..11222fea 100644 --- a/src/components/Form/src/components/InputTextArea.vue +++ b/src/components/Form/src/components/InputTextArea.vue @@ -52,11 +52,11 @@ }, label: { type: String } }, - emits: ['change', 'update:value'], + emits: ['blur', 'update:value'], setup(props, { emit }) { const attrs = useAttrs() const { t } = useI18n() - const [state] = useRuleFormItem(props, 'value', 'change') + const [state] = useRuleFormItem(props, 'value', 'blur') // 切割的字符数组 const cutList = attrs.value.slice || [] function emitChange() { @@ -138,7 +138,8 @@ return text.replace(/ \s*$/gm, '') } // 转换大写 - const textareaBlur = () => { + const textareaBlur = (_, ...args) => { + emit('blur', _, ...args) if (cutList.length == 0 || !state.value) return state.value = ToCDB(state.value).toUpperCase() // 清除每行最后的空格 diff --git a/src/hooks/component/useFormItem.ts b/src/hooks/component/useFormItem.ts index 87c0e74f..14bce533 100644 --- a/src/hooks/component/useFormItem.ts +++ b/src/hooks/component/useFormItem.ts @@ -22,6 +22,7 @@ export function useRuleFormItem, + flag ): [WritableComputedRef, (val: V) => void, DeepReadonly] export function useRuleFormItem( diff --git a/src/views/operation/seaexport/detail/components/ladingInfo.tsx b/src/views/operation/seaexport/detail/components/ladingInfo.tsx index cd7bb6b3..75532e9f 100644 --- a/src/views/operation/seaexport/detail/components/ladingInfo.tsx +++ b/src/views/operation/seaexport/detail/components/ladingInfo.tsx @@ -990,6 +990,11 @@ export const storageColumns: BasicColumn[] = [ dataIndex: 'slotBookingNo', width: 100, }, + { + title: '箱型箱量(余量)', + dataIndex: 'ctnStat', + width: 120 + }, { title: '合约号', dataIndex: 'contractNo', @@ -1039,11 +1044,6 @@ export const storageColumns: BasicColumn[] = [ title: '订舱编号', dataIndex: 'slotNo', width: 150 - }, - { - title: '箱型箱量(余量)', - dataIndex: 'ctnStat', - width: 120 } ] diff --git a/src/views/operation/seaexport/detail/index.vue b/src/views/operation/seaexport/detail/index.vue index 36aef12e..49829530 100644 --- a/src/views/operation/seaexport/detail/index.vue +++ b/src/views/operation/seaexport/detail/index.vue @@ -103,7 +103,7 @@ businessType="1" > - + {{ completeText }} @@ -307,9 +307,6 @@ if (route.query.id && !id.value) { id.value = route.query.id } - bookingDetails.value = { - orderContactList: [] - } if (id.value) { // 详情 excuteRules.value = [] @@ -334,6 +331,9 @@ id: id.value, }) .then(async (res) => { + bookingDetails.value = { + orderContactList: [] + } if (route.query.isCopy) { res.data = { ...res.data, @@ -378,7 +378,6 @@ // 货物信息表单 const goodsForm = await RefcargoInfo.value.validateFields() // 校验箱型价格 - console.log(goodsForm.ctnPriceInfo) if (goodsForm.ctnPriceInfo && goodsForm.ctnPriceInfo.length) { for (let i = 0; i < goodsForm.ctnPriceInfo.length; i++) { if (!goodsForm.ctnPriceInfo[i].ctn) { @@ -651,7 +650,7 @@ businessType: '1', taskTypeName: type || route.query.status } - completeTask(type) + completeTask(type, true) if (type) postData['hasCabin'] = true loading.value = true await CreateTask(postData).then(res => { @@ -814,7 +813,7 @@ }) } // 完成任务 - const completeTask = (type) => { + const completeTask = (type, b) => { const { fullPath } = route //获取当前路径 const postData = { businessId: id.value, @@ -825,7 +824,7 @@ } if (type) postData.autoCreateNext = false SetTaskStatus(postData).then(res => { - createMessage.success('操作成功!') + if (!b) createMessage.success('操作成功!') tabStore.closeTabByKey(fullPath, router) }) } diff --git a/src/views/operation/seaexport/detail/modules/baseInfo.tsx b/src/views/operation/seaexport/detail/modules/baseInfo.tsx index a75979aa..8e2c8b3d 100644 --- a/src/views/operation/seaexport/detail/modules/baseInfo.tsx +++ b/src/views/operation/seaexport/detail/modules/baseInfo.tsx @@ -452,7 +452,6 @@ export const mailingInfoFormSchemaL: FormSchema[] = [ return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, onChange: (e, obj) => { - console.log(e, obj) if (e && obj) { formModel.shipperId = obj.id formModel.shipperContent = obj.content @@ -540,7 +539,7 @@ export const mailingInfoFormSchemaL: FormSchema[] = [ } if (e === undefined && obj === undefined) { formModel.notifyPartyId = null - formModel.notifyPartyContent = null + formModel.notifyPartyContent = '' formModel.notifyParty = '' } } diff --git a/src/views/operation/seaexport/detail/modules/basicInfo.vue b/src/views/operation/seaexport/detail/modules/basicInfo.vue index 35fce10b..df763039 100644 --- a/src/views/operation/seaexport/detail/modules/basicInfo.vue +++ b/src/views/operation/seaexport/detail/modules/basicInfo.vue @@ -217,7 +217,6 @@ emitter.emit('seaAddNotes', item.value) } else if (item.key == 'customerName') { // 修改委托单位带出值 - console.log(item) emitter.emit('customerBack', item.value) } } diff --git a/src/views/operation/seaexport/detail/modules/cargoInfo.vue b/src/views/operation/seaexport/detail/modules/cargoInfo.vue index e1749ac2..a19d543e 100644 --- a/src/views/operation/seaexport/detail/modules/cargoInfo.vue +++ b/src/views/operation/seaexport/detail/modules/cargoInfo.vue @@ -49,7 +49,9 @@ style="width: 66px" :fieldNames="{ label: 'ctnName', - value: 'id' + value: 'id', + ctnCode: 'ediCode', + ctnSize: 'ctnSize' }" :options="optionsStore.getOptionsByCode('GetCtnSelectList')" :filter-option="filterOption" @@ -58,7 +60,7 @@
箱量* - +
报价* @@ -105,6 +107,7 @@ import { ref, watch, onMounted, computed } from 'vue' import { useRoute } from 'vue-router' import { getDictOption } from '/@/utils/dictUtil' + import emitter from '/@/utils/Bus' import { BatchDelBusinessCtnPrice } from '/@/views/operation/seaexport/api/BookingLedger' import { useOptionsStore } from '/@/store/modules/options' import GoodsTable from '/@/views/baseinfo/goods/index.vue' @@ -425,48 +428,62 @@ // }) // } }) - function SetTOTALNO(SS) { - let DSS = SS.toString() - const i = DSS.indexOf('\n') - let num = 0 - let strKind = '' - let enCapital = '' - if (i > 0) { - const slist = DSS.split('\n') - for (let i = 0; i < slist.length; i += 1) { - const member = slist[i] - const strNum: any = GetStringNum(member) - if (i == 0) { - strKind = member.substring(strNum.length) - } - num = parseFloat(num).add(parseFloat(strNum)) - } - if (strKind !== '') { - enCapital = strKind - } else { - strKind = props.details.kindpkgs - enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.' - } - } else { - const strNum: any = GetStringNum(DSS) - strKind = DSS.substring(strNum.length) - if (strKind !== '') { - enCapital = strKind - } else { - strKind = props.details.kindpkgs - enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.' - } - } - return enCapital - } + // function SetTOTALNO(SS) { + // let DSS = SS.toString() + // const i = DSS.indexOf('\n') + // let num = 0 + // let strKind = '' + // let enCapital = '' + // if (i > 0) { + // const slist = DSS.split('\n') + // for (let i = 0; i < slist.length; i += 1) { + // const member = slist[i] + // const strNum: any = GetStringNum(member) + // if (i == 0) { + // strKind = member.substring(strNum.length) + // } + // num = parseFloat(num).add(parseFloat(strNum)) + // } + // if (strKind !== '') { + // enCapital = strKind + // } else { + // strKind = props.details.kindpkgs + // enCapital = ToEn(num).toUpperCase() + ' ' + strKind + ' ONLY.' + // } + // } else { + // const strNum: any = GetStringNum(DSS) + // strKind = DSS.substring(strNum.length) + // if (strKind !== '') { + // enCapital = strKind + // } else { + // strKind = props.details.kindpkgs + // enCapital = 'SAY:' + ToEn(strNum).toUpperCase() + ' ' + strKind + ' ONLY.' + // } + // } + // return enCapital + // } // 选择箱型触发 const ctnChange = (v, item) => { - console.log(item) + let data = {} optionsStore.getOptionsByCode('GetCtnSelectList').forEach(row => { if (row.id == v) { item.ctn = row.ctnName + data = row + } + }) + // 触发表格数据 + emitter.emit('ctnTable', data) + } + // 箱量change + const ctnNumChange = (v, item) => { + let data = {} + optionsStore.getOptionsByCode('GetCtnSelectList').forEach(row => { + if (row.ctnName == item.ctn) { + data = row } }) + // 触发表格数据 + emitter.emit('ctnNumTable', { item, data }) } function ToEn(a) { // eslint-disable-next-line no-array-constructor diff --git a/src/views/operation/seaexport/detail/modules/goodsTable.vue b/src/views/operation/seaexport/detail/modules/goodsTable.vue index 3dab5668..493633fb 100644 --- a/src/views/operation/seaexport/detail/modules/goodsTable.vue +++ b/src/views/operation/seaexport/detail/modules/goodsTable.vue @@ -236,7 +236,7 @@ BatchDelOpCtnDetail, GetCtnSelectList, } from '/@/views/operation/seaexport/api/BookingLedger' - import { ref, Ref, watchEffect, watch, onMounted, nextTick } from 'vue' + import { ref, Ref, watchEffect, watch, onMounted, nextTick, onUnmounted } from 'vue' import { useMessage } from '/@/hooks/web/useMessage' const { notification, createMessage } = useMessage() import { useRoute } from 'vue-router' @@ -245,6 +245,7 @@ import { getDictOption } from '/@/utils/dictUtil' import { GetPackageSelectList } from '/@/views/operation/seaexport/api/BookingLedger' import { createVNode } from 'vue' + import emitter from '/@/utils/Bus' import { Modal } from 'ant-design-vue' registerAllModules() import * as XLSX from 'xlsx' @@ -269,11 +270,7 @@ if (nval.id) { GetCtnList(nval) } - }, - { - deep: true, - immediate: true, - }, + } ) // 主表 const hotmain = ref(null) @@ -326,7 +323,6 @@ // 下拉框数据,可以同步或者异步返回(异步需要process返回) source: async (query, process) => { const res = (await GetCtnSelectList({ queryKey: query }))?.data - if (!ctnDict.value.length) ctnDict.value = res const dict = res.map((res) => { return res.ctnName }) @@ -856,9 +852,7 @@ // ) const { data } = res if (data.length == 0) { - list.value = [{ - selectd: false - }] + list.value = [{}] } else { list.value = [] totalPkgs.value = 0 @@ -1567,6 +1561,7 @@ } } function handleRefsh() { + alert(1) GetCtnList(props.details) } function handleOpen() { @@ -1667,7 +1662,7 @@ fixedColumnsLeft: 1, // 需要隐藏的列 hiddenColumns: { - columns: [1, 2, 3], + columns: [1, 2, 3, 6], indicators: true, }, // 控制回车移动 @@ -1781,7 +1776,6 @@ } // 计算箱量 if (changes[0][1] === 'ctnNum') { - console.log(ctnDict.value) let RData = 0 list.value.forEach((e) => { if (e.ctnNum) { @@ -1797,7 +1791,7 @@ } }) totalCtn.value = RData - if (list.value[changes[0][0]]['teu'] && changes[0][3]) { + if (teu && changes[0][3]) { list.value[changes[0][0]]['teu'] = parseInt(teu) * parseInt(changes[0][3]) } } @@ -1990,6 +1984,60 @@ } } }) + // 箱量联动 + emitter.on('ctnNumTable', (data) => { + list.value.forEach(item => { + if (item.ctn == data.item.ctn) { + item.ctnNum = data.item.ctnNum + if (data.data.teu) { + item['teu'] = Number(data.data.teu) * (Number(item.ctnNum) || 0) + } + } + }) + }) + // 箱型价格联动集装箱表格 + emitter.on('ctnTable', (data) => { + const cList = list.value + if (cList && cList.length) { + let flag = true + cList.forEach(item => { + if (item.ctn == data.ctnName) { + flag = false + } + }) + if (flag) { + if (cList && cList.length) { + if (!cList[0].ctn) { + cList[0].ctn = data.ctnName + cList[0].ctnCode = data.ediCode + cList[0].tareWeight = data.ctnWeight + } else { + cList.push({ + ctn: data.ctnName, + ctnCode: data.ediCode, + tareWeight: data.ctnWeight + }) + } + } else { + cList.push({ + ctn: data.ctnName, + ctnCode: data.ediCode, + tareWeight: data.ctnWeight + }) + } + } + } else { + cList.push({ + ctnCode: data.ediCode, + ctn: data.ctnName, + size: data.ctnSize + }) + } + }) + }) + onUnmounted(() => { + emitter.off('ctnTable') + emitter.off('ctnNumTable') }) defineExpose({ list, diff --git a/src/views/operation/seaexport/detail/modules/mailingInfo.vue b/src/views/operation/seaexport/detail/modules/mailingInfo.vue index 68353d29..f075a0eb 100644 --- a/src/views/operation/seaexport/detail/modules/mailingInfo.vue +++ b/src/views/operation/seaexport/detail/modules/mailingInfo.vue @@ -185,11 +185,11 @@ templateName: '', content: '' } - if (key == 'shipper') { + if (key == '2') { postData.id = model.shipperId postData.templateName = model.shipper postData.content = model.shipperContent - } else if (key == 'consignee') { + } else if (key == '1') { postData.id = model.consigneeId postData.templateName = model.consignee postData.content = model.consigneeContent @@ -208,9 +208,9 @@ // 新建模版 temFlag.value = true let content = '' - if (key == 'shipper') { + if (key == '2') { content = model.shipperContent - } else if (key == 'consignee') { + } else if (key == '1') { content = model.consigneeContent } else { content = model.notifyPartyContent