From 226ad601bb8326814c3e94efd6f476014f6a9e66 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 27 六月 2024 23:06:47 +0800 Subject: [PATCH] 产品工艺路线工序配置更新 --- src/api/tigerapi/system.ts | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts index 01ccd9d..775bfba 100644 --- a/src/api/tigerapi/system.ts +++ b/src/api/tigerapi/system.ts @@ -280,15 +280,23 @@ return result; } -export function convertToTree<T>(data: T[], parentId: string, id: string, pid?: string) { +/** + * @description: 鏍戝舰琛ㄧ粨鏋勮浆鏍戝舰Json + * @param {T} data + * @param {string} parentField 鐖跺瓧娈靛悕 + * @param {string} idField 鍞竴key瀛楁鍚� + * @param {string} pid_val 鐖秈d鍊� + * @return {*} + */ +export function convertToTree<T>(data: T[], parentField: string, idField: string, pid?: string) { const result: T[] = []; let temp: T[] = []; const _pid = isNullOrEmpty(pid) ? '' : pid; for (let i = 0; i < data.length; i++) { - const currPid = data[i][parentId] == null ? '' : data[i][parentId]; + const currPid = data[i][parentField] == null ? '' : data[i][parentField]; if (currPid === _pid) { - const obj = data[i] as {}; - temp = convertToTree(data, parentId, id, data[i][id]); + const obj = data[i] as T; + temp = convertToTree(data, parentField, idField, data[i][idField]); if (temp.length > 0) { obj['children'] = temp; } @@ -737,7 +745,7 @@ } async function getListByPageAsync(params: any) { const data = await defHttp.post( - { url: Api.QueryUrl, params }, + { url: Api.QueryUrl, params,timeout:50000 }, { isTransformResponse: false, }, -- Gitblit v1.9.3