From fbdb39ff0606182eebc767319fe4d2e081a69870 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: Wed, 21 Aug 2024 15:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D=20?= =?UTF-8?q?=E6=89=80=E5=B1=9E=E9=9B=86=E5=9B=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/common/index.ts | 10 ++++ src/views/baseinfo/infoclient/columns.tsx | 71 ++++++++++++++++------- 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/api/common/index.ts b/src/api/common/index.ts index ed59198d..85b2d663 100644 --- a/src/api/common/index.ts +++ b/src/api/common/index.ts @@ -89,6 +89,16 @@ enum Api { GetControllerClientList = '/mainApi/ClientCommon/GetControllerClientListByKey', // 用户下拉 GetUserList = '/mainApi/Common/GetUserList', + // 获取所有往来单位下拉列表 (Auth) + GetAllClientList = '/mainApi/ClientCommon/GetAllClientList', +} +// 所有往来单位下拉数据 +export function GetAllClientList(params) { + return request({ + url: Api.GetAllClientList, + method: 'get', + params, + }) } // 用户下拉数据 export function GetUserList(params) { diff --git a/src/views/baseinfo/infoclient/columns.tsx b/src/views/baseinfo/infoclient/columns.tsx index 5e1d77d0..9f4925f1 100644 --- a/src/views/baseinfo/infoclient/columns.tsx +++ b/src/views/baseinfo/infoclient/columns.tsx @@ -20,6 +20,7 @@ import { getDeptList, GetFeeCurrencySelectList, GetUserList, + GetAllClientList, } from '/@/api/common' import { GetClientSourceDetailSelectList } from '/@/views/operation/seaexport/api/BookingLedger' import { getOrgTree } from '/@/api/system/org' @@ -546,39 +547,67 @@ export const formSchema: FormSchema[] = [ { field: 'pcorpId', label: '所属集团', - component: 'TreeSelect', defaultValue: '', + component: 'ApiSelect', colProps: { span: 4 }, componentProps: ({ formModel }) => { return { - treeData: OrgTree, - allowClear: true, - showSearch: true, + api: GetAllClientList, + labelField: 'shortName', + valueField: 'id', + resultField: 'data', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, - onChange: (e) => { - if (e) { - const ForTree = (data, key, callback) => { - for (let i = 0; i < data.length; i++) { - if (data[i].value == key) { - return callback(data[i], i, data) - } - if (data[i].children) { - ForTree(data[i].children, key, callback) - } - } - } - let obj: any = {} - ForTree(OrgTree, e, (item, index, arr) => { - obj = item - }) - formModel.pcorpName = obj.title + onChange: (e, obj) => { + if (e && obj) { + formModel.pcorpId = obj.value + formModel.pcorpName = obj.label + } + if (!e && !obj) { + formModel.pcorpId = '' + formModel.pcorpName = '' } }, } }, }, + // { + // field: 'pcorpId', + // label: '所属集团', + // component: 'TreeSelect', + // defaultValue: '', + // colProps: { span: 4 }, + // componentProps: ({ formModel }) => { + // return { + // treeData: OrgTree, + // allowClear: true, + // showSearch: true, + // filterOption: (input: string, option: any) => { + // return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + // }, + // onChange: (e) => { + // if (e) { + // const ForTree = (data, key, callback) => { + // for (let i = 0; i < data.length; i++) { + // if (data[i].value == key) { + // return callback(data[i], i, data) + // } + // if (data[i].children) { + // ForTree(data[i].children, key, callback) + // } + // } + // } + // let obj: any = {} + // ForTree(OrgTree, e, (item, index, arr) => { + // obj = item + // }) + // formModel.pcorpName = obj.title + // } + // }, + // } + // }, + // }, { field: 'Divider1', component: 'Divider',