Commit 72cc653ecc51616413be71b4ad6e8a33d9b85296
1 parent
5cef2391
1.增加上报参数区域
Showing
1 changed file
with
100 additions
and
1 deletions
src/mes/common/commonModelComponent/index.js
| ... | ... | @@ -293,7 +293,7 @@ const useCommonModelEvent = props => { |
| 293 | 293 | result = await handleGetData( |
| 294 | 294 | tableList.filter( |
| 295 | 295 | item => |
| 296 | - item === "workerOrderBatchMaterial" || item === "plateInfo" | |
| 296 | + item === "palletBatchMaterial" || item === "workerOrderBatchMaterial" || item === "plateInfo" | |
| 297 | 297 | ), |
| 298 | 298 | true, |
| 299 | 299 | true |
| ... | ... | @@ -2338,6 +2338,61 @@ const CommonViewTableComponent = props => { |
| 2338 | 2338 | const { masterData, sModelsType, app } = props |
| 2339 | 2339 | const { bCheck = false } = masterData || {} |
| 2340 | 2340 | const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); |
| 2341 | + | |
| 2342 | + // 上报参数区域状态管理 | |
| 2343 | + const [reportExpand, setReportExpand] = useState(true); | |
| 2344 | + | |
| 2345 | + // 解析上报参数 | |
| 2346 | + let reportParam = null; | |
| 2347 | + if(true || props.sModelsId === '17087428780006438414984564455000'){ | |
| 2348 | + if(viewRow.sReportParam){ | |
| 2349 | + reportParam = JSON.parse(viewRow.sReportParam); | |
| 2350 | + } | |
| 2351 | + } | |
| 2352 | + | |
| 2353 | + // 构建上报参数的配置 | |
| 2354 | + const reportViewConfigs = reportParam ? Object.keys(reportParam).filter(key => key.startsWith('sParam') && !key.includes('Default') && !key.includes('NotEmpty') && !key.includes('DropDown')).map(key => { | |
| 2355 | + const paramNum = key.replace('sParam', ''); | |
| 2356 | + // 查找对应的下拉数据源 sParamDropDown1, sParamDropDown2... | |
| 2357 | + const dropDownKey = `sParamDropDown${paramNum}`; | |
| 2358 | + const hasDropDown = reportParam[dropDownKey] && Object.keys(reportParam[dropDownKey]).length > 0; | |
| 2359 | + | |
| 2360 | + return { | |
| 2361 | + sId: key, | |
| 2362 | + sName: key, | |
| 2363 | + showName: reportParam[key] || key, | |
| 2364 | + sControlName: `reportParam_${key}`, | |
| 2365 | + iColValue: 8, | |
| 2366 | + iOrder: parseInt(paramNum) || 0, | |
| 2367 | + bVisible: true, | |
| 2368 | + bReadonly: false, // 允许编辑 | |
| 2369 | + enabled: true, // 确保字段可编辑 | |
| 2370 | + sDefault: reportParam[`${key}Default`] || '', | |
| 2371 | + sDropDownType: hasDropDown ? 'sql' : '', | |
| 2372 | + sChineseDropDown: hasDropDown ? JSON.stringify(reportParam[dropDownKey]) : '', | |
| 2373 | + showDropDropDown: hasDropDown ? JSON.stringify(reportParam[dropDownKey]) : '', | |
| 2374 | + iTag: 3, // iTag=3 强制允许编辑(CommonViewTable中iTag=3时enabledNew=true) | |
| 2375 | + specialControl: false // 确保不是特殊控件 | |
| 2376 | + }; | |
| 2377 | + }) : []; | |
| 2378 | + | |
| 2379 | + // 构建上报参数的视图数据 | |
| 2380 | + const reportViewRow = reportParam ? Object.keys(reportParam).filter(key => key.startsWith('sParam') && !key.includes('Default') && !key.includes('NotEmpty') && !key.includes('DropDown')).reduce((acc, key) => { | |
| 2381 | + acc[key] = reportParam[`${key}Default`] || ''; | |
| 2382 | + return acc; | |
| 2383 | + }, {}) : {}; | |
| 2384 | + | |
| 2385 | + const reportProps = { | |
| 2386 | + ...props, | |
| 2387 | + viewConfigs: reportViewConfigs, | |
| 2388 | + tableConfig: config, | |
| 2389 | + iColValueView: 24, | |
| 2390 | + viewRow: reportViewRow, | |
| 2391 | + tableName: `${sName}_report`, | |
| 2392 | + enabled: props.enabled, // 继承父组件的 enabled 属性 | |
| 2393 | + enabledNew: props.enabledNew // 继承父组件的 enabledNew 属性 | |
| 2394 | + }; | |
| 2395 | + | |
| 2341 | 2396 | return ( |
| 2342 | 2397 | <> |
| 2343 | 2398 | {sName === "master" ? ( |
| ... | ... | @@ -2361,6 +2416,11 @@ const CommonViewTableComponent = props => { |
| 2361 | 2416 | viewProps.enabledNew = false; |
| 2362 | 2417 | } |
| 2363 | 2418 | |
| 2419 | + // 传递上报参数给主视图 | |
| 2420 | + if(reportParam){ | |
| 2421 | + viewProps.reportParam = reportParam; | |
| 2422 | + } | |
| 2423 | + | |
| 2364 | 2424 | return ( |
| 2365 | 2425 | <> |
| 2366 | 2426 | <TabTitleComponent {...props} sTabName={groupList[index]} /> |
| ... | ... | @@ -2368,6 +2428,45 @@ const CommonViewTableComponent = props => { |
| 2368 | 2428 | </> |
| 2369 | 2429 | ); |
| 2370 | 2430 | })} |
| 2431 | + | |
| 2432 | + {/* 上报参数区域 - 只显示一次,放在循环外面 */} | |
| 2433 | + {reportParam && reportViewConfigs.length > 0 && ( | |
| 2434 | + <div style={{ marginTop: '10px', border: '1px solid #d9d9d9', borderRadius: '4px', fontSize: '14px' }}> | |
| 2435 | + {/* 上报参数标题栏 */} | |
| 2436 | + <div | |
| 2437 | + style={{ | |
| 2438 | + display: 'flex', | |
| 2439 | + alignItems: 'center', | |
| 2440 | + height: '36px', | |
| 2441 | + fontSize: '16px', | |
| 2442 | + cursor: 'pointer', | |
| 2443 | + borderBottom: '1px solid #d9d9d9', | |
| 2444 | + paddingLeft: '12px', | |
| 2445 | + fontWeight: 'bold', | |
| 2446 | + color: '#1890ff' | |
| 2447 | + }} | |
| 2448 | + onClick={() => setReportExpand(!reportExpand)} | |
| 2449 | + > | |
| 2450 | + <span style={{ | |
| 2451 | + width: '0', | |
| 2452 | + height: '0', | |
| 2453 | + borderLeft: '6px solid transparent', | |
| 2454 | + borderRight: '6px solid transparent', | |
| 2455 | + borderTop: reportExpand ? '6px solid #1890ff' : 'none', | |
| 2456 | + borderBottom: reportExpand ? 'none' : '6px solid #1890ff', | |
| 2457 | + marginRight: '8px' | |
| 2458 | + }} /> | |
| 2459 | + 上报参数 | |
| 2460 | + </div> | |
| 2461 | + | |
| 2462 | + {/* 上报参数内容 */} | |
| 2463 | + {reportExpand && ( | |
| 2464 | + <div style={{ padding: '10px', fontSize: '14px' }}> | |
| 2465 | + <CommonViewTable {...reportProps} /> | |
| 2466 | + </div> | |
| 2467 | + )} | |
| 2468 | + </div> | |
| 2469 | + )} | |
| 2371 | 2470 | {sName !== "master" ? ( |
| 2372 | 2471 | <CommonOperationBarComponent {...operationBarProps} /> |
| 2373 | 2472 | ) : ( | ... | ... |