From 8fbcbc9c365e911b561d17834f8e350974ca1439 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 20 5月 2025 12:43:13 +0800 Subject: [PATCH] 22 --- PipeLineLems/pipelinelems_web/src/utils/myformUtils.ts | 64 ++++++++++++++++++++++++++++++++ PipeLineLems/pipelinelems_web/src/config/menu.ts | 14 +++++++ 2 files changed, 78 insertions(+), 0 deletions(-) diff --git a/PipeLineLems/pipelinelems_web/src/config/menu.ts b/PipeLineLems/pipelinelems_web/src/config/menu.ts index f52b44f..b502312 100644 --- a/PipeLineLems/pipelinelems_web/src/config/menu.ts +++ b/PipeLineLems/pipelinelems_web/src/config/menu.ts @@ -1,5 +1,12 @@ export const menu: Record<string,any>[] = [ { + "name": "浣滀笟浠诲姟", + "path": "/information-base/WorkTask", + "patchName": "WorkTask", + "icon": "p", + "notPage": false + }, + { "name": "浣滀笟璁″垝", "path": "/information-base/WorkPlan", "patchName": "WorkPlan", @@ -64,6 +71,13 @@ } ]; export const menuMap: Record<string,any> = { + "WorkTask": { + "name": "浣滀笟浠诲姟", + "path": "/information-base/WorkTask", + "patchName": "WorkTask", + "icon": "p", + "notPage": false + }, "WorkPlan": { "name": "浣滀笟璁″垝", "path": "/information-base/WorkPlan", diff --git a/PipeLineLems/pipelinelems_web/src/utils/myformUtils.ts b/PipeLineLems/pipelinelems_web/src/utils/myformUtils.ts new file mode 100644 index 0000000..3eb0225 --- /dev/null +++ b/PipeLineLems/pipelinelems_web/src/utils/myformUtils.ts @@ -0,0 +1,64 @@ + +//琛ㄥ崟宸ュ叿鏂囦欢 +/** + * 閫氱敤楂樼骇鏌ヨ琛ㄥ崟鏁版嵁鏀堕泦鍑芥暟 + * @param {Array} formItems - 琛ㄥ崟閰嶇疆椤规暟缁� + * @param {Object} formData - 琛ㄥ崟鏁版嵁瀵硅薄 + * @returns {Object} - 鏀堕泦鐨勮〃鍗曟暟鎹� + */ +export const collectFormDataForHighQuery = (formItems, formData) => { + const data = {}; + + // 閬嶅巻琛ㄥ崟閰嶇疆鏀堕泦鏁版嵁 + formItems.forEach(item => { + // 鏀堕泦鍩虹瀛楁 + data[item.prop] = formData.value[item.prop] || ''; + + // 鏀堕泦杩囨护妯″紡瀛楁 + if (item.highSelectAttrs && item.highSelectAttrs.prop) { + const filterModeProp = item.highSelectAttrs.prop; + data[filterModeProp] = formData.value[filterModeProp] || ''; + } + }); + + return data; + } + + /** + * 閲嶇疆楂樼骇鏌ヨ鐨勮繃婊ゆā寮� + * @param formItems - 琛ㄥ崟閰嶇疆椤规暟缁� + * @param formData - 琛ㄥ崟鏁版嵁瀵硅薄 + */ + export const onResetForHighSelect = (formItems, formData) => { + // 閬嶅巻鎵�鏈夎〃鍗曞瓧娈� + formItems.forEach(item => { + // 妫�鏌ュ瓧娈垫槸鍚︽湁楂樼骇鏌ヨ鐨勮繃婊ゆā寮忛厤缃� + if (item.highSelectAttrs && item.highSelectAttrs.prop) { + const filterModeProp = item.highSelectAttrs.prop; + const options = item.highSelectAttrs.options || []; + + // 濡傛灉瀛樺湪閫夐」锛屽垯璁剧疆涓虹涓�涓�夐」鐨勫�� + if (options.length > 0) { + // 鍋囪閫夐」鏍煎紡涓� { value, label } 鎴栫被浼肩粨鏋� + const firstValue = options[0].value !== undefined ? options[0].value : options[0]; + formData.value[filterModeProp] = firstValue; + } + } + }); +} + +/** + * 閲嶇疆楂樼骇鏌ヨ + * @param formItems - 琛ㄥ崟閰嶇疆椤规暟缁� + * @param formData - 琛ㄥ崟鏁版嵁瀵硅薄 + */ +export const onResetForHighQuery = (formItems, formData) => { + // 1. 娓呯┖鎵�鏈夊熀纭�瀛楁锛堜笉鍖呭惈杩囨护妯″紡瀛楁锛� + const baseFields = formItems.reduce((acc, item) => { + acc[item.prop] = ''; + return acc; + }, {}); + + // 2. 搴旂敤鍩虹瀛楁鍒濆鍊� + formData.value = { ...baseFields }; +} \ No newline at end of file -- Gitblit v1.9.3