diff --git a/src/api/common/index.ts b/src/api/common/index.ts index 7d042e64..1c3c18fa 100644 --- a/src/api/common/index.ts +++ b/src/api/common/index.ts @@ -509,7 +509,14 @@ export function GetCarrierSelectList(params) { params, }) } - +// // 船公司下拉 客户端 +// export function GetCarrierSelectList(params) { +// return request({ +// url: '/mainApi/ClientCommon/GetCarrierSelectList', +// method: 'get', +// params, +// }) +// } // 切换组织机构 export function ChangeOrg(params) { return request({ diff --git a/src/views/baseinfo/infoclient/ClientAccountDateModal.vue b/src/views/baseinfo/infoclient/ClientAccountDateModal.vue index 945df593..b2010f54 100644 --- a/src/views/baseinfo/infoclient/ClientAccountDateModal.vue +++ b/src/views/baseinfo/infoclient/ClientAccountDateModal.vue @@ -8,42 +8,6 @@ @ok="handleSave" > -
-
- - - 新增 - - - - - 删除 - - -
-
- - - - -
-
diff --git a/src/views/baseinfo/infoclient/EditColumns.tsx b/src/views/baseinfo/infoclient/EditColumns.tsx index cc9ab315..25d9c732 100644 --- a/src/views/baseinfo/infoclient/EditColumns.tsx +++ b/src/views/baseinfo/infoclient/EditColumns.tsx @@ -64,7 +64,7 @@ const res14: API.DataResult = await GetTenantBanks({ currency: 'CNY' }) if (res14.succeeded) { rmbAccountData = [] res14.data.forEach((e) => { - rmbAccountData.push({ label: e.accountName, value: e.id, ...e }) + rmbAccountData.push({ label: `${e.bankName}-${e.bankAccountNo}`, value: e.id, ...e }) }) } let usdAccountData: any = [] @@ -72,7 +72,7 @@ const res15: API.DataResult = await GetTenantBanks({ currency: 'USD' }) if (res15.succeeded) { usdAccountData = [] res15.data.forEach((e) => { - usdAccountData.push({ label: e.accountName, value: e.id, ...e }) + usdAccountData.push({ label: `${e.bankName}-${e.bankAccountNo}`, value: e.id, ...e }) }) } export const EditformSchema: FormSchema[] = [ diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue index eaa08723..f0cea9a9 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue @@ -52,7 +52,7 @@ // 字段数据 import { formSchema } from './columns' // 相关接口 - import { ApiEdit, ApiBulkEdit, ApiInfo } from './api' + import { ApiEdit, ApiBulkEdit, ApiBulkEditDetails, ApiInfo } from './api' import { feeUnitDict } from '/@/hooks/dict/index' // 提升消息混入 import { useMessage } from '/@/hooks/web/useMessage' @@ -73,14 +73,29 @@ const loading = ref(false) const rowId = ref('') const { createMessage } = useMessage() - const [registerForm, { resetFields, setFieldsValue, getFieldsValue, validate, updateSchema }] = - useForm({ - labelWidth: 100, - schemas: formSchema, - showActionButtonGroup: false, - }) + const [ + registerForm, + { + resetFields, + setFieldsValue, + appendSchemaByField, + removeSchemaByField, + getFieldsValue, + validate, + updateSchema, + }, + ] = useForm({ + labelWidth: 100, + schemas: formSchema, + showActionButtonGroup: false, + }) + const unitArr = ref([]) + const BulkInfoArr = ref([]) const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner( async (data) => { + unitArr.value.forEach((item) => { + removeSchemaByField(`${item}unitP`) + }) resetFields() setModalProps({ confirmLoading: false, loading: true }) isUpdate.value = !!data?.isUpdate @@ -129,13 +144,54 @@ feeField.value.condition = res.data.condition // detailId.value = res.data.id } + } else if (isBulk.value) { + detailId.value = '' + setFieldsValue({ + customerName: props.customerName, + customerId: props.customerId, + isBulk: true, + }) + // 添加 对应单位 单票输入 + const UnitList = await feeUnitDict() + unitArr.value.splice(0) + BulkInfoArr.value.splice(0) + ids.value.forEach(async (e) => { + const res: any = await ApiInfo({ id: unref(e) }) + BulkInfoArr.value.push(res.data) + if (res.succeeded) { + res.data.details.forEach((item: any) => { + if (unitArr.value.indexOf(item.unit) == -1) { + unitArr.value.push(item.unit) + UnitList.forEach((Unit: any) => { + if (item.unit == Unit.value) { + appendSchemaByField( + [ + { + field: `${Unit.value}unitP`, + label: `${Unit.label}含税单价`, + component: 'Input', + colProps: { span: 6 }, + componentProps: { + placeholder: `${Unit.label}含税单价`, + }, + }, + ], + undefined, + ) + } + }) + } + }) + } + }) + feeField.value.SetData([]) + feeField.value.condition = '' } else { detailId.value = '' setFieldsValue({ customerName: props.customerName, customerId: props.customerId, saleOrgId: userStore.getUserInfo.userOrgs[0].orgId, - isBulk: isBulk.value ? true : false, }) feeField.value.SetData([]) feeField.value.condition = '' @@ -164,7 +220,9 @@ detailId.value = res.data.id } } - const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑')) + const getTitle = computed(() => + !unref(isUpdate) ? (!unref(isBulk) ? '批量编辑' : '新增') : '编辑', + ) // 费用表格 const feeField = ref() async function handleSave(exit) { @@ -181,6 +239,18 @@ let res: any = null console.log(isBulk.value, 11111111111) if (isBulk.value) { + let ApiDetailsData: any = [] + // 批量修改 费用明细 + BulkInfoArr.value.forEach((e) => { + e.details.forEach((item) => { + unitArr.value.forEach((item2) => { + if (item2 == item.unit && values[`${item2}unitP`]) { + ApiDetailsData.push({ ...item, taxUnitPrice: values[`${item2}unitP`] }) + } + }) + }) + }) + await ApiBulkEditDetails(ApiDetailsData) let ApiData: any = [] ids.value.forEach((e) => { ApiData.push({ ...values, id: e }) diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx b/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx index b8684c21..452b84eb 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx @@ -5,7 +5,12 @@ import { Tag } from 'ant-design-vue' import { getDictOption } from '/@/utils/dictUtil' import { useUserStore } from '/@/store/modules/user' const userStore: any = useUserStore() -import { getOrgList, GetClientPortSelectList, GetCarrierSelectList } from '/@/api/common' +import { + getOrgList, + GetClientPortSelectList, + GetCarrierSelectList, + GetSupplierListByCode, +} from '/@/api/common' import { GetClientLanesSelectList, GetAgentCnClientList, @@ -32,13 +37,17 @@ GetCarrierSelectList().then((res) => { carrierIdList.value = res.data }) const forwarderIdList = ref([]) -GetAgentCnClientList().then((res) => { +GetSupplierListByCode().then((res) => { forwarderIdList.value = res.data }) const mblFrtCodeList = ref([]) GetClientFrtSelectList().then((res) => { mblFrtCodeList.value = res.data }) +const PortList = ref([]) +GetClientPortSelectList().then((res) => { + PortList.value = res.data +}) // 业务来源明细数据 const sourceDetailId = ref([]) export const columns: BasicColumn[] = [ @@ -78,12 +87,34 @@ export const columns: BasicColumn[] = [ { title: '起运港', dataIndex: 'polCode', + sorter: true, width: 200, + customRender: ({ record }) => { + let name = '' + PortList.value.some((item: any) => { + if (record.polCode == item.ediCode) { + name = `${item.cnName}/${item.portName}` + return true + } + }) + return name + }, }, { title: '卸货港', dataIndex: 'podCode', + sorter: true, width: 200, + customRender: ({ record }) => { + let name = '' + PortList.value.some((item: any) => { + if (record.podCode == item.ediCode) { + name = `${item.cnName}/${item.portName}` + return true + } + }) + return name + }, }, { dataIndex: 'laneId', @@ -137,12 +168,12 @@ export const columns: BasicColumn[] = [ dataIndex: 'forwarderId', title: '订舱口', sorter: true, - width: 200, + width: 280, customRender: ({ record }) => { let name = '' forwarderIdList.value.some((item: any) => { if (record.forwarderId == item.id) { - name = item.shortName + name = item.pinYinCode return true } }) @@ -275,12 +306,32 @@ export const viewColumns: BasicColumn[] = [ dataIndex: 'polCode', sorter: true, width: 200, + customRender: ({ record }) => { + let name = '' + PortList.value.some((item: any) => { + if (record.polCode == item.ediCode) { + name = `${item.cnName}/${item.portName}` + return true + } + }) + return name + }, }, { title: '卸货港', dataIndex: 'podCode', sorter: true, width: 200, + customRender: ({ record }) => { + let name = '' + PortList.value.some((item: any) => { + if (record.podCode == item.ediCode) { + name = `${item.cnName}/${item.portName}` + return true + } + }) + return name + }, }, { dataIndex: 'laneName', @@ -547,16 +598,19 @@ export const searchFormSchema: FormSchema[] = [ }, }, { - label: '订舱口', field: 'forwarderId', + label: '订舱口', component: 'ApiSelect', required: false, + // labelSlot: 'yardId', dynamicDisabled: false, colProps: { span: 4 }, componentProps: ({ formModel }) => { return { - api: GetAgentCnClientList, - labelField: 'shortName', + api: GetSupplierListByCode, + params: { code: 'Booking' }, + labelField: 'pinYinCode', + showName: 'description', valueField: 'id', resultField: 'data', filterOption: (input: string, option: any) => { @@ -927,16 +981,19 @@ export const formSchema: FormSchema[] = [ }, }, { - label: '订舱口', field: 'forwarderId', + label: '订舱口', component: 'ApiSelect', required: false, + // labelSlot: 'yardId', dynamicDisabled: false, colProps: { span: 6 }, componentProps: ({ formModel }) => { return { - api: GetAgentCnClientList, - labelField: 'shortName', + api: GetSupplierListByCode, + params: { code: 'Booking' }, + labelField: 'pinYinCode', + showName: 'description', valueField: 'id', resultField: 'data', filterOption: (input: string, option: any) => { diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue index 2fea6708..85bf45c1 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue @@ -11,10 +11,14 @@ 添加 - + + + 复制 + + ([]) // 费用名称字典 const feeDict = ref([]) // 结算对象下拉数据 @@ -302,29 +306,6 @@ className: 'htCenter', readOnly: false, }, - // { - // title: '结算对象', - // width: 130, - // data: 'customerName', - // type: 'dropdown', - // source: async (query, process) => { - // // 获取当前选中行 - // const rowIndex = hotTb.value.hotInstance.getActiveEditor().row - // const code = list.value[rowIndex]?.customerType || null - // GetClientListByCode({ code }).then((res) => { - // const { data } = res - // data.forEach((item) => { - // item['label'] = item.shortName - // item['value'] = item.codeName - // }) - // companyDict.value = data - // const dict = data.map((item) => { - // return item.codeName + '-' + item.shortName - // }) - // process(dict) - // }) - // }, - // }, { title: '费用名称', width: 130, @@ -357,7 +338,7 @@ { title: '单位标准', width: 130, - data: 'unit', + data: 'unitText', type: 'dropdown', source: async (query, process) => { if (unitDict.value && unitDict.value.length) { @@ -425,6 +406,7 @@ data: 'unitPrice', type: 'numeric', format: '0.00', + readOnly: true, }, { title: '汇率', @@ -468,161 +450,6 @@ data: 'isAdvancedPay', type: 'checkbox', }, - // { - // title: '费用英文名称', - // width: 130, - // data: 'feeEnName', - // type: 'dropdown', - // source: async (query, process) => { - // const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data - // if (!feeDict.value.length) feeDict.value = res - // const dict = res.map((res) => { - // return res.enName - // }) - // process(dict) - // }, - // }, - // { - // title: '客户类别', - // width: 130, - // data: 'customerTypeText', - // type: 'dropdown', - // source: async (query, process) => { - // const results = await getDictOption('djy_cust_prop') - // const dict = results.map((item) => { - // return item.value + '-' + item.name - // }) - // process(dict) - // }, - // }, - - // { - // title: '数量', - // width: 120, - // data: 'quantity', - // type: 'numeric', - // format: '0', - // }, - // { - // title: '不含税单价', - // width: 120, - // data: 'noTaxPrice', - // type: 'numeric', - // readOnly: true, - // }, - // { - // title: '不含税金额', - // width: 120, - // data: 'noTaxAmount', - // type: 'numeric', - // format: '0.00', - // readOnly: true, - // }, - // { - // title: '金额', - // width: 120, - // data: 'amount', - // type: 'numeric', - // }, - - // { - // title: '备注', - // width: 120, - // data: 'note', - // }, - - // { - // title: '销项税额', - // width: 100, - // data: 'accTaxAmount', - // readOnly: true, - // }, - // { - // title: '销项金额', - // width: 100, - // data: 'accAmount', - // readOnly: true, - // }, - // { - // title: '是否机密', - // width: 100, - // data: 'isOpen', - // type: 'checkbox', - // }, - - // { - // title: 'FRT', - // width: 120, - // data: 'feeFrt', - // type: 'dropdown', - // source: ['PP', 'CC'], - // }, - // { - // title: '录入人', - // width: 100, - // data: 'createByName', - // readOnly: true, - // }, - // { - // title: '录入日期', - // width: 100, - // data: 'createTime', - // readOnly: true, - // }, - // { - // title: '结算金额', - // width: 100, - // data: 'settlementAmount', - // readOnly: true, - // }, - // { - // title: '已开票金额', - // width: 100, - // data: 'invoiceAmount', - // readOnly: true, - // }, - // { - // title: '对账编号', - // width: 100, - // data: 'debitNo', - // readOnly: true, - // }, - // { - // title: '修改人', - // width: 100, - // data: 'updateByName', - // readOnly: true, - // }, - // { - // title: '修改日期', - // width: 100, - // data: 'updateTime', - // readOnly: true, - // }, - // { - // title: '发票申请金额', - // width: 100, - // data: 'orderInvoiceAmount', - // readOnly: true, - // }, - // { - // title: '未开票金额', - // width: 100, - // data: 'debitNo', - // readOnly: true, - // }, - // { - // title: '审核人', - // width: 100, - // data: 'auditOperator', - // readOnly: true, - // }, - // { - // title: '审核日期', - // width: 100, - // data: 'auditDate', - // readOnly: true, - // }, ] // 表格配置项 const settings = { @@ -659,21 +486,8 @@ afterChange(changes, source) { // 这里定义了编辑,自动填充和拷贝数据的处理逻辑 if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') { - let dict = {} + let dict: any = {} changes.forEach((res) => { - // // 费用类型 - // if (changes[0][1] === 'feeTypeName') { - // const res = [ - // { label: '应收', value: 1 }, - // { label: '应付', value: 2 }, - // ] - // const item = res.filter((item) => { - // return item.label === changes[0][3] - // }) - // if (item) dict = item[0] - // list.value[changes[0][0]]['feeType'] = dict?.value - // list.value[changes[0][0]]['feeTypeName'] = dict?.label - // } // 修改费用对象 if (changes[0][1] === 'customerName') { const item = companyDict.value.filter((item) => { @@ -691,61 +505,43 @@ }) if (item) dict = item[0] // feeType + console.log(dict) list.value[res[0]]['feeName'] = changes[0][3].split('-')[1] list.value[res[0]]['feeCode'] = dict['code'] list.value[res[0]]['feeId'] = dict['id'] list.value[res[0]]['unit'] = dict['defaultUnit'] + list.value[res[0]]['unitText'] = dict['defaultUnitName'] list.value[res[0]]['currency'] = dict['defaultCurrency'] + if (dict['defaultCurrency'] == 'RMB') { + list.value[res[0]]['exchangeRate'] = 1 + } else { + list.value[res[0]]['exchangeRate'] = '【根据设置汇率生成】' + } list.value[res[0]]['taxRate'] = dict['taxRate'] list.value[res[0]]['isInvoice'] = dict['isInvoice'] list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay'] - // list.value[res[0]]['feeEnName'] = dict['enName'] - // list.value[res[0]]['unitText'] = dict['defaultUnitName'] - // 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]]['feeFrt'] = dict['feeFrt'] } }) + // 修改币别 + if (changes[0][1] === 'currency') { + if (changes[0][3] == 'RMB') { + list.value[changes[0][0]]['exchangeRate'] = 1 + } else { + list.value[changes[0][0]]['exchangeRate'] = '【根据设置汇率生成】' + } + } // 修改单位 - if (changes[0][1] === 'unit') { + if (changes[0][1] === 'unitText') { const item = unitDict.value.filter((item) => { return changes[0][3].includes(item.name) }) if (item) dict = item[0] + if (!/^[\u3400-\u9FBF]+$/.test(dict.label)) { + list.value[changes[0][0]]['isCtn'] = true + } list.value[changes[0][0]]['unit'] = dict?.value - // list.value[changes[0][0]]['unitText'] = changes[0][3].split('-')[1] - // 业务数据有件数,修改单位,带出件数 - // const text = list.value[changes[0][0]]['unitText'] - // if (text == '单票') { - // list.value[changes[0][0]]['quantity'] = 1 - // } else if (text == '件数') { - // list.value[changes[0][0]]['quantity'] = props.details.pkgs - // } else if (text == '重量') { - // list.value[changes[0][0]]['quantity'] = props.details.kgs - // } else if (text == '尺码') { - // list.value[changes[0][0]]['quantity'] = props.details.cbm - // } else if (text == '计费吨') { - // let r = props.details.kgs - // const k = (props.details.pkgs || 0) / 1000 - // if (k > r) { - // r = k - // } - // list.value[changes[0][0]]['quantity'] = r + list.value[changes[0][0]]['unitText'] = dict?.label } - // // 修改币别 - // if (changes[0][1] === 'currencyName') { - // const item = currencyDict.value.filter((item) => { - // return item.name === changes[0][3] - // }) - // if (item) dict = item[0] - // list.value[changes[0][0]]['currency'] = dict?.codeName - // } - // ============================ - // // 修改费用英文名称 - // if (changes[0][1] === 'feeEnName') { - // } // 修改客户类别 if (changes[0][1] === 'customerTypeText') { @@ -758,61 +554,6 @@ list.value[changes[0][0]]['customerTypeText'] = changes[0][3].split('-')[1] }) } - - // // 当前操作的行 - // const index = changes[0][0] - // // 修改不含税单价计算 - // if (changes[0][1] === 'noTaxPrice') { - // // 单价 - // list.value[index].unitPrice = Number( - // (changes[0][3] || 0) * ((list.value[index].taxRate || 0) / 100 + 1), - // ).toFixed(6) - // // 金额 - // list.value[index].amount = Number( - // (list.value[index].unitPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (changes[0][3] || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } - // // 修改单价计算 - // if (changes[0][1] === 'unitPrice') { - // // 不含税单价 - // list.value[index].noTaxPrice = Number( - // (changes[0][3] || 0) / ((list.value[index].taxRate || 0) / 100 + 1), - // ).toFixed(6) - // // 金额 - // list.value[index].amount = Number( - // (changes[0][3] || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } - // // 修改数量 - // if (changes[0][1] === 'quantity') { - // // 金额 - // list.value[index].amount = Number( - // (changes[0][3] || 0) * (list.value[index].unitPrice || 0), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (changes[0][3] || 0) * (list.value[index].noTaxPrice || 0), - // ).toFixed(6) - // } - // // 修改税率 - // if (changes[0][1] === 'taxRate') { - // // 不含税单价 - // list.value[index].noTaxPrice = Number( - // (list.value[index].unitPrice || 0) / ((changes[0][3] || 0) / 100 + 1), - // ).toFixed(6) - // // 不含税金额 - // list.value[index].noTaxAmount = Number( - // (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0), - // ).toFixed(6) - // } } }, } @@ -889,6 +630,13 @@ deep: true, }, ) + const copyRow = () => { + list.value.forEach((item: any) => { + if (item.selected) { + list.value.push({ ...item, id: '' }) + } + }) + } // 删除行 const deleteRow = async () => { // list.value.forEach((item: any, index) => { diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue index 8b01bfc3..b0b7dd85 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue @@ -4,7 +4,7 @@