From a145108480405843620b70ba175666097084c48a Mon Sep 17 00:00:00 2001 From: lijingjia Date: Mon, 17 Jun 2024 10:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=81=E5=88=AB=E4=BB=A3=E7=A0=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/fee/code/columns.tsx | 147 +++++++++++++++--------- src/views/fee/code/components/Modal.vue | 23 ++-- 2 files changed, 106 insertions(+), 64 deletions(-) diff --git a/src/views/fee/code/columns.tsx b/src/views/fee/code/columns.tsx index e060826d..08b6f3f6 100644 --- a/src/views/fee/code/columns.tsx +++ b/src/views/fee/code/columns.tsx @@ -21,12 +21,6 @@ const reconciliationCategorygDict = ref([]) const costGroupingDict = ref([]) // 发票商品名称字典 const productNameDict = ref([]) -// 自定义绑定参数 -export const dsParams = { - defaultCreditName: '', - defaultDebitName: '', - defaultUnitName: '' -} export const columns: BasicColumn[] = [ { title: '费用代码', @@ -222,62 +216,90 @@ export const formSchema: FormSchema[] = [ defaultValue: '', component: 'ApiSelect', colProps: { span: 8 }, - componentProps: () => { + componentProps: ({ formModel }) => { return { api: feeUnitDict, labelField: 'name', valueField: 'value', resultField: 'data', onChange: (v, obj) => { - dsParams.defaultUnitName = obj?.label || '' + formModel.defaultUnitName = obj?.label || '' } } } }, + { + label: '', + field: 'defaultUnitName', + component: 'Input', + show: false + }, { field: 'defaultDebit', label: '默认收费客户类型', - component: 'Select', + component: 'ApiSelect', defaultValue: '', - colProps: { span: 8 },componentProps: () => { - getDictOption('djy_cust_prop').then(data => { - customTypeDict.value = data - }) + colProps: { span: 8 }, + componentProps: ({ formModel }) => { return { - options: customTypeDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('djy_cust_prop').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, onChange: (v, obj) => { - dsParams.defaultDebitName = obj?.label || '' + formModel.defaultDebitName = obj?.label || '' } } } }, + { + label: '', + field: 'defaultDebitName', + component: 'Input', + show: false + }, { field: 'defaultCredit', label: '默认付费客户类型', - component: 'Select', + component: 'ApiSelect', defaultValue: '', - colProps: { span: 8 },componentProps: () => { - getDictOption('djy_cust_prop').then(data => { - customTypeDict.value = data - }) + colProps: { span: 8 }, + componentProps: ({ formModel }) => { return { - options: customTypeDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('djy_cust_prop').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, onChange: (v, obj) => { - dsParams.defaultCreditName = obj?.label || '' + formModel.defaultCreditName = obj?.label || '' } } } }, + { + label: '', + field: 'defaultCreditName', + component: 'Input', + show: false + }, { field: 'defaultCurrency', label: '默认币别', @@ -296,16 +318,21 @@ export const formSchema: FormSchema[] = [ { field: 'feeFrt', label: '默认FRT', - component: 'Select', + component: 'ApiSelect', defaultValue: '', - colProps: { span: 8 },componentProps: () => { - getDictOption('payment_method').then(data => { - payMethodsDict.value = data - }) + colProps: { span: 8 }, + componentProps: () => { return { - options: payMethodsDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('payment_method').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 } @@ -327,16 +354,20 @@ export const formSchema: FormSchema[] = [ field: 'feeGroup', label: '费用分组', defaultValue: '', - component: 'Select', + component: 'ApiSelect', colProps: { span: 8 }, componentProps: () => { - getDictOption('cost_grouping').then(data => { - costGroupingDict.value = data - }) return { - options: costGroupingDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('cost_grouping').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 } @@ -347,16 +378,20 @@ export const formSchema: FormSchema[] = [ field: 'checkingType', label: '对账类别', defaultValue: '', - component: 'Select', + component: 'ApiSelect', colProps: { span: 8 }, componentProps: () => { - getDictOption('reconciliation_category').then(data => { - reconciliationCategorygDict.value = data - }) return { - options: reconciliationCategorygDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('reconciliation_category').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 } @@ -370,13 +405,17 @@ export const formSchema: FormSchema[] = [ component: 'Select', colProps: { span: 8 }, componentProps: () => { - getDictOption('product_name').then(data => { - productNameDict.value = data - }) return { - options: productNameDict.value, - allowClear: true, - showSearch: true, + api: () => { + return new Promise((resolve) => { + getDictOption('product_name').then((res) => { + resolve(res) + }) + }) + }, + labelField: 'label', + valueField: 'value', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 } diff --git a/src/views/fee/code/components/Modal.vue b/src/views/fee/code/components/Modal.vue index 38343c3b..ab97f27a 100644 --- a/src/views/fee/code/components/Modal.vue +++ b/src/views/fee/code/components/Modal.vue @@ -15,15 +15,18 @@ > + @@ -64,7 +67,7 @@ import { BasicModal, useModalInner } from '/@/components/Modal' import { BasicForm, useForm } from '/@/components/Form/index' // 币别字段数据 - import { formSchema, dsParams } from '../columns' + import { formSchema } from '../columns' // 币别相关接口 import { EditFeeCode, GetFeeCodeInfo } from '../api' // 提升消息混入 @@ -128,7 +131,7 @@ const values = await validate() loading.value = true setModalProps({ confirmLoading: true, loading: true }) - const res: API.DataResult = await EditFeeCode(Object.assign(values, formData, dsParams)) + const res: API.DataResult = await EditFeeCode(Object.assign(values, formData)) loading.value = false if (res.succeeded) { createMessage.success(res.message)