From 4f82231b2d626437b74eaaa1cbae27b579a1dbf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <14166000+zhangtonghai@user.noreply.gitee.com> Date: Mon, 30 Sep 2024 08:51:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B4=B9=E7=94=A8=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FeeCustTemplate/TenantAuditStepModal.vue | 36 +++++-- .../infoclient/FeeCustTemplate/columns.tsx | 48 ++++++++-- .../infoclient/FeeCustTemplate/feeField.vue | 96 +++++++++---------- .../infoclient/FeeCustTemplate/index.vue | 14 +++ .../infoclient/menu2/TenantAuditStepModal.vue | 6 +- src/views/baseinfo/infoclient/menu2/index.vue | 4 +- .../FeeCustTemplate/TenantAuditStepModal.vue | 36 +++++-- src/views/fee/FeeCustTemplate/columns.tsx | 48 ++++++++-- src/views/fee/FeeCustTemplate/feeField.vue | 96 +++++++++---------- src/views/fee/FeeCustTemplate/index.vue | 14 +++ 10 files changed, 262 insertions(+), 136 deletions(-) diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue index 1da08530..8143894d 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/TenantAuditStepModal.vue @@ -55,6 +55,8 @@ import { ApiEdit, ApiInfo } from './api' // 提升消息混入 import { useMessage } from '/@/hooks/web/useMessage' + import { useUserStore } from '/@/store/modules/user' + const userStore = useUserStore() const props = defineProps({ customerName: { type: String }, customerId: { type: String }, @@ -62,6 +64,7 @@ // 声明Emits const emit = defineEmits(['success', 'register']) const isUpdate = ref(true) + const isCopy = ref(false) const detailId = ref() // 按钮loading const loading = ref(false) @@ -78,6 +81,7 @@ resetFields() setModalProps({ confirmLoading: false, loading: true }) isUpdate.value = !!data?.isUpdate + isCopy.value = !!data?.isCopy if (unref(isUpdate)) { setModalProps({ confirmLoading: true }) rowId.value = data.record.id @@ -91,13 +95,31 @@ detailId.value = res.data.id } } else { - detailId.value = '' - setFieldsValue({ - customerName: props.customerName, - customerId: props.customerId, - }) - feeField.value.SetData([]) - feeField.value.condition = '' + if (isCopy.value) { + setModalProps({ confirmLoading: true }) + const res: API.DataResult = await ApiInfo({ id: unref(data.record.id) }) + if (res.succeeded) { + setFieldsValue({ + ...res.data, + id: '', + }) + res.data.details.forEach((item) => { + delete item.id + }) + feeField.value.SetData(res.data.details) + feeField.value.condition = res.data.condition + // detailId.value = res.data.id + } + } else { + detailId.value = '' + setFieldsValue({ + customerName: props.customerName, + customerId: props.customerId, + saleOrgId: userStore.getUserInfo.userOrgs[0].orgId, + }) + feeField.value.SetData([]) + feeField.value.condition = '' + } } setModalProps({ loading: false }) }, diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx b/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx index 6faf2ccc..caf6eeed 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/columns.tsx @@ -3,8 +3,8 @@ import { BasicColumn, FormSchema } from '/@/components/Table' import { Tag } from 'ant-design-vue' // 引入字典数据 import { getDictOption } from '/@/utils/dictUtil' -// 下拉框数据接口 -import { GetClientListByCode } from '/@/api/common' + +import { getOrgList } from '/@/api/common' // 往来单位下拉框数据 const companyDict = ref([]) let businessType: any = [ @@ -32,10 +32,10 @@ export const columns: BasicColumn[] = [ dataIndex: 'feeCategory', width: 120, customRender: ({ text }) => { - if (text == 1) { - return '应收' - } else if (text == 2) { - return '应付' + if (text == '1') { + return '收' + } else if (text == '2') { + return '付' } return text }, @@ -99,8 +99,8 @@ export const searchFormSchema: FormSchema[] = [ colProps: { span: 4 }, componentProps: { options: [ - { label: '应收', value: 1 }, - { label: '应付', value: 2 }, + { label: '收', value: '1' }, + { label: '付', value: '2' }, ], }, }, @@ -245,8 +245,8 @@ export const formSchema: FormSchema[] = [ colProps: { span: 6 }, componentProps: { options: [ - { label: '应收', value: 1 }, - { label: '应付', value: 2 }, + { label: '收', value: '1' }, + { label: '付', value: '2' }, ], }, }, @@ -293,6 +293,34 @@ export const formSchema: FormSchema[] = [ component: 'InputNumber', colProps: { span: 6 }, }, + { + field: 'saleOrgId', + label: '分公司', + component: 'ApiSelect', + colProps: { span: 6 }, + componentProps: ({ formModel }) => { + return { + api: getOrgList, + labelField: 'label', + valueField: 'id', + resultField: 'data', + allowClear: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onChange: (e, obj) => { + if (e && obj) { + formModel.saleOrgName = obj.label + formModel.saleOrgId = obj.id + } + if (!e && !obj) { + formModel.saleOrgName = '' + formModel.saleOrgId = '' + } + }, + } + }, + }, { field: 'description', label: '模板说明', diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue index bf667046..71b82fae 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/feeField.vue @@ -209,6 +209,10 @@ // 添加行 const addRow = () => { list.value.push({}) + const hot = hotTb.value.hotInstance + nextTick(() => { + hot.selectCell(list.value.length - 1, 1) + }) } // 定义表格所有列 @@ -265,49 +269,41 @@ data: 'unit', type: 'dropdown', source: async (query, process) => { - // if (unitDict.value && unitDict.value.length) { - // const dict = unitDict.value.map((item) => { - // 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) - // } - const results = [ - { label: '20GP', name: '20GP', value: '22G0' }, - { label: '40GP', name: '40GP', value: '42G0' }, - ] - const dict = results.map((res) => { - return res.label - }) - process(dict) - }, - }, - { - title: '费用类型', - width: 80, - data: 'feeTypeName', - type: 'dropdown', - source: async (query, process) => { - if (currencyDict.value.length) { - process(currencyDict.value) + if (unitDict.value && unitDict.value.length) { + const dict = unitDict.value.map((item) => { + return item.name + }) + process(dict) } else { - const results = [ - { label: '应收', value: 1 }, - { label: '应付', value: 2 }, - ] - const dict = results.map((res) => { - return res.label + const results = await feeUnitDict() + unitDict.value = results + const dict = results.map((item) => { + return item.name }) process(dict) } }, }, + // { + // title: '费用类型', + // width: 80, + // data: 'feeTypeName', + // type: 'dropdown', + // source: async (query, process) => { + // if (currencyDict.value.length) { + // process(currencyDict.value) + // } else { + // const results = [ + // { label: '应收', value: 1 }, + // { label: '应付', value: 2 }, + // ] + // const dict = results.map((res) => { + // return res.label + // }) + // process(dict) + // } + // }, + // }, { title: '是否箱型', width: 100, @@ -574,19 +570,19 @@ if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') { let dict = {} 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] === '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) => { diff --git a/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue b/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue index d5bc6c40..e6249945 100644 --- a/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue +++ b/src/views/baseinfo/infoclient/FeeCustTemplate/index.vue @@ -23,6 +23,13 @@