Commit cf760575c00a503b3ec9a205bb284586b8cd6529

Authored by Min
2 parents 8c0ed9c0 b2552854

Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi

src/components/Common/PersonCenter/MenuSearchPopovor.js
@@ -16,14 +16,43 @@ const MenuSearchPopovor = props => { @@ -16,14 +16,43 @@ const MenuSearchPopovor = props => {
16 [] 16 []
17 ); 17 );
18 18
  19 + const { modelCenter, kpiData } = app;
  20 +
19 const popovorRef = useRef(null); 21 const popovorRef = useRef(null);
20 - const handleTabClick = useCallback(e => { 22 + const handleTabClick = useCallback(option => {
  23 + const { data, type } = option;
  24 + if (type === 1) {
  25 + const record = data;
  26 + const newsId = record.sId;
  27 + const newKey = new Date().getTime().toString();
  28 + const route = record.sName;
  29 + const title = record.sMenuName;
  30 + const pane = {
  31 + title, route, formId: newsId, key: newKey, sModelsType: record.sModelType, fromKey: "1", sSrcModelsId: '1',
  32 + currentIndex: 0,
  33 + };
  34 + onAddPane(pane);
  35 + return;
  36 + } else if (type === 2) {
  37 + const record = data;
  38 + const newsId = record.sResultModelId;
  39 + const newKey = new Date().getTime().toString();
  40 + const route = record.sResultModelName;
  41 + const title = record.sResultModelMenuName;
  42 + const pane = {
  43 + title, route, formId: newsId, key: newKey, sModelsType: record.sResultModelType, fromKey: "1",
  44 + currentIndex: 0,
  45 + };
  46 + onAddPane(pane);
  47 + return
  48 + }
  49 +
21 const paneKey = new Date().getTime().toString(); 50 const paneKey = new Date().getTime().toString();
22 - const formId = e.sId;  
23 - const route = e.sName;  
24 - const title = e.sMenuName;  
25 - const sModelsType = e.sModelType;  
26 - const { sProcName } = e; 51 + const formId = data.sId;
  52 + const route = data.sName;
  53 + const title = data.sMenuName;
  54 + const sModelsType = data.sModelType;
  55 + const { sProcName } = data;
27 for (const each of app.panes) { 56 for (const each of app.panes) {
28 /* 解决导航栏打开页签,Modal不消失问题 */ 57 /* 解决导航栏打开页签,Modal不消失问题 */
29 each.notCurrentPane = true; 58 each.notCurrentPane = true;
@@ -139,10 +168,33 @@ const MenuSearchPopovor = props => { @@ -139,10 +168,33 @@ const MenuSearchPopovor = props => {
139 }); 168 });
140 } 169 }
141 170
142 - return [...commonlyUsedOption, ...options]; 171 + const columnWorkMatters = commonFunc.showMessage(app.commonConst, 'columnWorkMatters');
  172 + const columnContent = commonFunc.showMessage(app.commonConst, 'columnContent');
  173 + const { model = {} } = kpiData || modelCenter || {};
  174 + const modelOptions = [{ label: renderTitle('', columnWorkMatters), options: [] }, { label: renderTitle('', columnContent), options: [] }];
  175 + Object.keys(model).filter((_, index) => index === 0).forEach(key => {
  176 + const value = model[key];
  177 + value.forEach(item => {
  178 + const { sId, sMenuUnMemo, sResultModelId, sMenuWorkFruit } = item;
  179 + modelOptions[0].options.push({
  180 + label: sMenuUnMemo,
  181 + value: sId,
  182 + data: item,
  183 + type: 1
  184 + });
  185 + modelOptions[1].options.push({
  186 + label: sMenuWorkFruit,
  187 + value: `${sId},${sResultModelId}`,
  188 + data: item,
  189 + type: 2
  190 + });
  191 + });
  192 + });
  193 +
  194 + return [...commonlyUsedOption, ...options, ...modelOptions];
143 }, [menuPanel.panelMenus]); 195 }, [menuPanel.panelMenus]);
144 196
145 - const searchTitle = commonFunc.showMessage(app.commonConst, 'btnSearch') || '搜索122'; 197 + const searchTitle = commonFunc.showMessage(app.commonConst, 'btnSearch') || '搜索';
146 198
147 return ( 199 return (
148 <div ref={popovorRef}> 200 <div ref={popovorRef}>
@@ -157,18 +209,23 @@ const MenuSearchPopovor = props =&gt; { @@ -157,18 +209,23 @@ const MenuSearchPopovor = props =&gt; {
157 }} 209 }}
158 filterOption={(inputValue, option) => { 210 filterOption={(inputValue, option) => {
159 let result = false; 211 let result = false;
160 - const { data } = option; 212 + const { data, value } = option;
161 if (commonUtils.isNotEmptyObject(data)) { 213 if (commonUtils.isNotEmptyObject(data)) {
162 - const { sMenuName, parentMenu, grandParentMenu } = data; 214 + const { sMenuName, parentMenu = {}, grandParentMenu = {}, sMenuUnMemo, sMenuWorkFruit } = data;
163 const { sMenuName: sMenuName1 } = parentMenu; 215 const { sMenuName: sMenuName1 } = parentMenu;
164 const { sMenuName: sMenuName2 } = grandParentMenu; 216 const { sMenuName: sMenuName2 } = grandParentMenu;
  217 + const bMenuWorkFruit = value.includes(',');
165 const result0 = 218 const result0 =
166 - sMenuName.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1; 219 + sMenuName && sMenuName.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
167 const result1 = 220 const result1 =
168 - sMenuName1.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1; 221 + sMenuName1 && sMenuName1.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
169 const result2 = 222 const result2 =
170 - sMenuName2.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;  
171 - result = result0 || result1 || result2; 223 + sMenuName2 && sMenuName2.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
  224 + const result3 =
  225 + !bMenuWorkFruit && sMenuUnMemo && sMenuUnMemo.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
  226 + const result4 =
  227 + bMenuWorkFruit && sMenuWorkFruit && sMenuWorkFruit.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
  228 + result = result0 || result1 || result2 || result3 || result4;
172 } 229 }
173 return result; 230 return result;
174 }} 231 }}
@@ -176,7 +233,7 @@ const MenuSearchPopovor = props =&gt; { @@ -176,7 +233,7 @@ const MenuSearchPopovor = props =&gt; {
176 // popovorRef.current.animate([{ width: '250px' }, { width: 0 }], { 233 // popovorRef.current.animate([{ width: '250px' }, { width: 0 }], {
177 // duration: 2000, iterations: 1 234 // duration: 2000, iterations: 1
178 // }); 235 // });
179 - handleTabClick(option.data); 236 + handleTabClick(option);
180 onSetMenuSearchPopoverVisible(false); 237 onSetMenuSearchPopoverVisible(false);
181 }} 238 }}
182 > 239 >