diff --git a/src/components/Form/src/Ds/components/DEdit.vue b/src/components/Form/src/Ds/components/DEdit.vue index 37b907f7..2c0b56ab 100644 --- a/src/components/Form/src/Ds/components/DEdit.vue +++ b/src/components/Form/src/Ds/components/DEdit.vue @@ -107,19 +107,19 @@ RData = props.unCheckedChildren } } else { - if (props.label == '来源明细') { - appStore.getSourceData.forEach((item) => { - item.children.forEach((item2) => { - if (item2.id == state.value) { - RData = item2.detailName - } - }) - }) - // RData = props.ShowName - } else { - RData = state.value - // RData = state.value ? state.value.replace(/\"/g, '') : '' - } + // if (props.label == '来源明细') { + // appStore.getSourceData.forEach((item) => { + // item.children.forEach((item2) => { + // if (item2.id == state.value) { + // RData = item2.detailName + // } + // }) + // }) + // // RData = props.ShowName + // } else { + RData = state.value + // RData = state.value ? state.value.replace(/\"/g, '') : '' + // } } } diff --git a/src/views/baseinfo/infoclient/EditColumns.tsx b/src/views/baseinfo/infoclient/EditColumns.tsx index 50527bb5..e4669aad 100644 --- a/src/views/baseinfo/infoclient/EditColumns.tsx +++ b/src/views/baseinfo/infoclient/EditColumns.tsx @@ -1,3 +1,4 @@ +import { ref } from 'vue' import { FormSchema } from '/@/components/Table' import { useOptionsStore } from '/@/store/modules/options' const optionsStore = useOptionsStore() @@ -8,7 +9,10 @@ import { GetCustomerServiceList, GetOperatorUserList, GetVouchingClerkList, + GetClientSourceSelectList, + GetClientSourceDetailSelectList, } from '/@/views/operation/seaexport/api/BookingLedger' +const sourceDetailId = ref([]) let ClientCountryList = [] const res4: API.DataResult = await getClientCountrySelectList() if (res4.succeeded) { @@ -589,20 +593,43 @@ export const EditformSchema: FormSchema[] = [ required: false, dynamicDisabled: false, colProps: { span: 4 }, - componentProps: (e) => { - const { formActionType, formModel } = e + componentProps: (En) => { return { - allowClear: true, - showSearch: true, - option: optionsStore.getOptionsByCode('GetClientSourceSelectList'), + api: GetClientSourceSelectList, labelField: 'sourceName', valueField: 'id', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, + onChange: async (e, obj) => { + const { formModel, formActionType } = En + if (e && obj) { + formModel.sourceId = obj.value + formModel.sourceName = obj.label + } + if (!e && !obj) { + formModel.sourceId = '' + formModel.sourceName = '' + } + if (e) { + const FnsourceDetailId: any = await GetClientSourceDetailSelectList({ + id: e, + }) + if (FnsourceDetailId.succeeded) { + sourceDetailId.value.splice(0) + FnsourceDetailId.data.forEach((e) => { + sourceDetailId.value.push({ label: e.detailName, value: e.id }) + }) + } + if (formActionType) { + formModel.sourceDetailId = '' + } + } + }, onEdit: () => { - const { formActionType } = e - formActionType ? formActionType.linkageForm(e) : null + const { formActionType } = En + formActionType ? formActionType.linkageForm(En) : null }, } }, @@ -619,12 +646,31 @@ export const EditformSchema: FormSchema[] = [ field: 'sourceDetailId', component: 'DEdit', colProps: { span: 4 }, - componentProps: (e) => { + dynamicDisabled: ({ values }) => { + return !values.sourceId + }, + componentProps: (En) => { return { allowClear: true, + options: sourceDetailId.value, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onChange: (e, obj) => { + const { formModel } = En + if (e && obj) { + formModel.sourceDetailId = obj.value + formModel.sourceDetailName = obj.label + } + if (!e && !obj) { + formModel.sourceDetailId = '' + formModel.sourceDetailName = '' + } + }, onEdit: () => { - const { formActionType } = e - formActionType ? formActionType.linkageForm(e) : null + const { formActionType } = En + formActionType ? formActionType.linkageForm(En) : null }, } }, diff --git a/src/views/baseinfo/infoclient/columns.tsx b/src/views/baseinfo/infoclient/columns.tsx index 4991f9f4..f48fdfaa 100644 --- a/src/views/baseinfo/infoclient/columns.tsx +++ b/src/views/baseinfo/infoclient/columns.tsx @@ -1,3 +1,4 @@ +import { ref } from 'vue' import { BasicColumn, FormSchema } from '/@/components/Table' import { Tag } from 'ant-design-vue' // 字典 @@ -16,13 +17,9 @@ import { GetCustomerServiceList, GetOperatorUserList, GetVouchingClerkList, + GetClientSourceSelectList, } from '/@/views/operation/seaexport/api/BookingLedger' -import { useOptionsStore } from '/@/store/modules/options' -const optionsStore = useOptionsStore() -import { useRoute } from 'vue-router' -import { placeholderSign } from 'element-plus/es/components/table-v2/src/private' -import { max } from 'lodash' -const route = useRoute() +const sourceDetailId = ref([]) // exports {} let ClientFrtList = [] const res: API.DataResult = await getClientFrtSelectList() @@ -929,71 +926,79 @@ export const formSchema: FormSchema[] = [ required: false, dynamicDisabled: false, colProps: { span: 4 }, - componentProps: ({ formActionType, formModel }) => { - return { - allowClear: true, - showSearch: true, - option: optionsStore.getOptionsByCode('GetClientSourceSelectList'), - labelField: 'sourceName', - valueField: 'id', - filterOption: (input: string, option: any) => { - return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }, - onChange: async (e, obj) => { - if (e && obj) { - formModel.sourceId = obj.value - formModel.sourceName = obj.label - } - if (!e && !obj) { - formModel.sourceId = '' - formModel.sourceName = '' - } - if (e) { - if (formActionType) { - const { updateSchema } = formActionType - let Arr: any = [] - await GetClientSourceDetailSelectList({ id: e }).then((res) => { - res.data.forEach((item) => { - Arr.push({ label: item.detailName, value: item.id }) - }) - }) - updateSchema({ - label: '来源明细', - field: 'sourceDetailId', - component: 'Select', - required: false, - dynamicDisabled: ({ values }) => { - return !values.sourceId - }, - colProps: { span: 4 }, - componentProps: ({ formModel }) => { - return { - allowClear: true, - options: Arr, - showSearch: true, - filterOption: (input: string, option: any) => { - return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }, - onChange: (e, obj) => { - if (e && obj) { - formModel.sourceDetailId = obj.value - formModel.sourceDetailName = obj.label - } - if (!e && !obj) { - formModel.sourceDetailId = '' - formModel.sourceDetailName = '' - } - }, - } - }, - }) - } - } - formModel.sourceDetailId = '' - }, - } - }, }, + // { + // label: '业务来源', + // field: 'sourceId', + // component: 'ApiSelect', + // required: false, + // dynamicDisabled: false, + // colProps: { span: 4 }, + // componentProps: ({ formActionType, formModel }) => { + // return { + // allowClear: true, + // showSearch: true, + // option: optionsStore.getOptionsByCode('GetClientSourceSelectList'), + // labelField: 'sourceName', + // valueField: 'id', + // filterOption: (input: string, option: any) => { + // return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + // }, + // onChange: async (e, obj) => { + // if (e && obj) { + // formModel.sourceId = obj.value + // formModel.sourceName = obj.label + // } + // if (!e && !obj) { + // formModel.sourceId = '' + // formModel.sourceName = '' + // } + // if (e) { + // if (formActionType) { + // const { updateSchema } = formActionType + // let Arr: any = [] + // await GetClientSourceDetailSelectList({ id: e }).then((res) => { + // res.data.forEach((item) => { + // Arr.push({ label: item.detailName, value: item.id }) + // }) + // }) + // updateSchema({ + // label: '来源明细', + // field: 'sourceDetailId', + // component: 'Select', + // required: false, + // dynamicDisabled: ({ values }) => { + // return !values.sourceId + // }, + // colProps: { span: 4 }, + // componentProps: ({ formModel }) => { + // return { + // allowClear: true, + // options: Arr, + // showSearch: true, + // filterOption: (input: string, option: any) => { + // return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + // }, + // onChange: (e, obj) => { + // if (e && obj) { + // formModel.sourceDetailId = obj.value + // formModel.sourceDetailName = obj.label + // } + // if (!e && !obj) { + // formModel.sourceDetailId = '' + // formModel.sourceDetailName = '' + // } + // }, + // } + // }, + // }) + // } + // } + // formModel.sourceDetailId = '' + // }, + // } + // }, + // }, // 来源明细Name { label: '', @@ -1001,11 +1006,11 @@ export const formSchema: FormSchema[] = [ component: 'Input', show: false, }, - { - field: 'sourceDetailId', label: '来源明细', + field: 'sourceDetailId', component: 'Select', + required: false, colProps: { span: 4 }, },