From 6b5f78ae3edbceed53ea419f39f5cc5695d78ff4 Mon Sep 17 00:00:00 2001 From: lijingjia Date: Thu, 5 Sep 2024 11:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E5=AE=A1=E6=A0=B8=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CostEntry/feeTable.vue | 138 +++++++++++++----- src/views/fee/code/columns.tsx | 18 ++- .../seaexport/detail/modules/baseInfo.tsx | 2 +- .../seaexport/detail/modules/cargoInfo.vue | 2 +- src/views/system/user/UserModal.vue | 6 +- src/views/system/user/columns.tsx | 4 +- 6 files changed, 122 insertions(+), 48 deletions(-) diff --git a/src/components/CostEntry/feeTable.vue b/src/components/CostEntry/feeTable.vue index da624aac..b97ed57e 100644 --- a/src/components/CostEntry/feeTable.vue +++ b/src/components/CostEntry/feeTable.vue @@ -40,11 +40,8 @@ ref, watch, watchEffect, - computed, - unref, defineComponent, onMounted, - reactive, nextTick, provide, } from 'vue' @@ -62,6 +59,8 @@ // 结算对象下拉数据 import { GetClientListByCode } from '/@/api/common' import { useMessage } from '/@/hooks/web/useMessage' + // 引入字典接口 + import { getDictOption } from '/@/utils/dictUtil' const { createMessage } = useMessage() defineComponent({ HotTable, @@ -100,12 +99,22 @@ const feeDict = ref([]) // 费用标准字典 const unitDict = ref([]) + getDictOption('fee_unit').then(res => { + let b = [] + if (props.details.ctnInfo && props.details.ctnInfo.length) { + const a = props.details.ctnInfo.filter(item => { + return item.ctn + }) + b = a.map(item => { + return { label: item.ctn, value: item.ctn, name: item.ctnCode } + }) + } + unitDict.value = [...b, ...res] + }) // 币别字典 const currencyDict = ref([]) // 费用对象字典数据 const companyDict = ref([]) - // 引入字典接口 - import { getDictOption } from '/@/utils/dictUtil' // 表格插件 const hotTb = ref(null) // loading @@ -237,13 +246,6 @@ return item.value + '-' + item.name }) process(dict) - } else { - const results = await feeUnitDict() - unitDict.value = results - const dict = results.map((item) => { - return item.value + '-' + item.name - }) - process(dict) } }, }, @@ -468,29 +470,63 @@ // 这里定义了编辑,自动填充和拷贝数据的处理逻辑 if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') { let dict = {} - changes.forEach((res) => { - // 修改费用名称 - if (res[1] === 'feeName') { + if (changes.length == 1) { + // 只修改一个操作框来联动行内数据 + if (changes[0][1] === 'feeName') { + // 修改费用名称联动带出(英文名称、客户类别、结算对象、标准、币别等) // 获取当前选中的字典对象数据 const item = feeDict.value.filter((item) => { return changes[0][3].includes(item.name) }) if (item) dict = item[0] - list.value[res[0]]['feeName'] = changes[0][3].split('-')[1] - list.value[res[0]]['feeEnName'] = dict['enName'] - list.value[res[0]]['currency'] = dict['defaultCurrency'] - list.value[res[0]]['unitText'] = dict['defaultUnitName'] - list.value[res[0]]['unit'] = dict['defaultUnit'] - list.value[res[0]]['customerTypeText'] = dict['defaultDebitName'] - list.value[res[0]]['customerType'] = dict['defaultDebit'] - list.value[res[0]]['isOpen'] = dict['isOpen'] - list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay'] - list.value[res[0]]['isInvoice'] = dict['isInvoice'] - list.value[res[0]]['feeFrt'] = dict['feeFrt'] - list.value[res[0]]['feeCode'] = dict['code'] - list.value[res[0]]['taxRate'] = dict['taxRate'] + list.value[changes[0][0]]['feeName'] = changes[0][3].split('-')[1] + list.value[changes[0][0]]['feeEnName'] = dict['enName'] + list.value[changes[0][0]]['currency'] = dict['defaultCurrency'] + list.value[changes[0][0]]['customerTypeText'] = dict['defaultDebitName'] + list.value[changes[0][0]]['customerType'] = dict['defaultDebit'] + list.value[changes[0][0]]['isOpen'] = dict['isOpen'] + list.value[changes[0][0]]['isAdvancedPay'] = dict['isAdvancedPay'] + list.value[changes[0][0]]['isInvoice'] = dict['isInvoice'] + list.value[changes[0][0]]['feeFrt'] = dict['feeFrt'] + list.value[changes[0][0]]['feeCode'] = dict['code'] + list.value[changes[0][0]]['taxRate'] = dict['taxRate'] + // 费用代码维护的单位标准是箱型,默认带出集装箱表格第一条数据,否则带出默认标准 + if (dict.defaultUnit == 'XX') { + if (props?.details?.ctnInfo && props?.details?.ctnInfo?.length) { + list.value[changes[0][0]]['unitText'] = props.details.ctnInfo[0].ctn + list.value[changes[0][0]]['unit'] = props.details.ctnInfo[0].ctnCode + list.value[changes[0][0]]['quantity'] = props.details.ctnInfo[0].ctnNum + } + } else { + list.value[changes[0][0]]['unitText'] = dict['defaultUnitName'] + list.value[changes[0][0]]['unit'] = dict['defaultUnit'] + // 联动带出计费标准带出的数量 + const uItem = unitDict.value.filter((item) => { + return list.value[changes[0][0]]['unitText'].includes(item.name) + }) + if (uItem) dict = uItem[0] + if (dict && dict?.value) { + GetUnitSelectInfo({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => { + list.value[changes[0][0]]['quantity'] = res.data.quantity + }) + } + } + // 根据客户类别带出相应的费用对象 + getDictOption('djy_cust_prop').then((res) => { + const item = res.filter((item) => { + return list.value[changes[0][0]]['customerTypeText'].includes(item.name) + }) + if (item) dict = item[0] + if (dict.value) { + // 调用接口取费用对象 + GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => { + list.value[changes[0][0]]['customerCode'] = res.data.clientId + list.value[changes[0][0]]['customerName'] = res.data.clientName + }) + } + }) } - }) + } // 修改费用英文名称 if (changes[0][1] === 'feeEnName') { } @@ -513,11 +549,12 @@ list.value[changes[0][0]]['customerType'] = dict?.value list.value[changes[0][0]]['customerTypeText'] = changes[0][3].split('-')[1] // 调用接口取费用对象 - console.log(props.details) - GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => { - list.value[changes[0][0]]['customerCode'] = res.data.clientId - list.value[changes[0][0]]['customerName'] = res.data.clientName - }) + if (dict && dict.value) { + GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => { + list.value[changes[0][0]]['customerCode'] = res.data.clientId + list.value[changes[0][0]]['customerName'] = res.data.clientName + }) + } }) } // 修改单位 @@ -700,7 +737,7 @@ }) } // 选择插入 - const selectInsert = (v) => { + const selectInsert = async (v) => { const selectData = JSON.parse(JSON.stringify(list.value)) // 选择插入 if (v === 1) { @@ -720,6 +757,36 @@ const res = selectData.filter((item) => { return item.selected }) + // 费用代码 + const feeList = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data + res.forEach(data => { + const item = feeList.filter((item) => { + return item.name == data.feeName + }) + // 自动更换客户类别客户类别 + if (item && item.length) { + // 如果当前所选的这一行数据是应收,则把客户类型和客户换成默认应付的数据 + if (data.customerTypeText == item[0].defaultCreditName) { + data.customerTypeText = item[0].defaultDebitName + data.customerType = item[0].defaultDebit + } + // 如果当前所选的这一行数据是应付,则把客户类型和客户换成默认应收的数据 + if (data.customerTypeText == item[0].defaultDebitName) { + data.customerTypeText = item[0].defaultCreditName + data.customerType = item[0].defaultCredit + } + // 调用接口取费用对象 + if (data && data.customerType) { + GetClientSelectInfoByCode({ code: data.customerType, businessId: props.id, businessType: props.type }).then(res => { + data.customerCode = res.data.clientId + data.customerName = res.data.clientName + }) + } else { + data.customerCode = '' + data.customerName = '' + } + } + }) emits('broInsert', res) } else { // 全部插入 @@ -734,7 +801,6 @@ item.feeType = 1 } }) - console.log(selectData) emits('broInsert', selectData) } } diff --git a/src/views/fee/code/columns.tsx b/src/views/fee/code/columns.tsx index 08b6f3f6..31677c0c 100644 --- a/src/views/fee/code/columns.tsx +++ b/src/views/fee/code/columns.tsx @@ -11,6 +11,10 @@ import { getDictOption } from '/@/utils/dictUtil' import { GetFeeCurrencySelectList } from '/@/api/common' // 引入计费标准字典 import { feeUnitDict } from '/@/hooks/dict/index' +const unitDict = ref([]) +getDictOption('fee_unit').then(res => { + unitDict.value = res +}) // 客户类别下拉框数据 const customTypeDict = ref([]) // 付费方式字典 @@ -214,14 +218,17 @@ export const formSchema: FormSchema[] = [ field: 'defaultUnit', label: '默认计费标准', defaultValue: '', - component: 'ApiSelect', + component: 'Select', colProps: { span: 8 }, componentProps: ({ formModel }) => { return { - api: feeUnitDict, - labelField: 'name', - valueField: 'value', - resultField: 'data', + options: unitDict, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + getPopupContainer: () => document.body, onChange: (v, obj) => { formModel.defaultUnitName = obj?.label || '' } @@ -252,6 +259,7 @@ export const formSchema: FormSchema[] = [ labelField: 'label', valueField: 'value', resultField: 'data', + getPopupContainer: () => document.body, filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, diff --git a/src/views/operation/seaexport/detail/modules/baseInfo.tsx b/src/views/operation/seaexport/detail/modules/baseInfo.tsx index ad09c160..9b16790d 100644 --- a/src/views/operation/seaexport/detail/modules/baseInfo.tsx +++ b/src/views/operation/seaexport/detail/modules/baseInfo.tsx @@ -1995,7 +1995,7 @@ export const cargoInfoFormSchema4: FormSchema[] = [ slot: 'ctnPriceInfo', component: 'Input', required: false, - defaultValue: [{}], + defaultValue: [{ guidePrice: 0, floorPrice: 0 }], colProps: { span: 24 }, }, { diff --git a/src/views/operation/seaexport/detail/modules/cargoInfo.vue b/src/views/operation/seaexport/detail/modules/cargoInfo.vue index fd0070f2..02fadba8 100644 --- a/src/views/operation/seaexport/detail/modules/cargoInfo.vue +++ b/src/views/operation/seaexport/detail/modules/cargoInfo.vue @@ -74,7 +74,7 @@ - + diff --git a/src/views/system/user/UserModal.vue b/src/views/system/user/UserModal.vue index ea119b19..0971dd95 100644 --- a/src/views/system/user/UserModal.vue +++ b/src/views/system/user/UserModal.vue @@ -81,11 +81,11 @@ /> {{ model.isDispatcher ? '是' : '否'}} -