Commit d9cd5ff067ba980c47f4f04d36a378d2b76465fe
1 parent
4dd549ba
简化代码
Showing
1 changed file
with
7 additions
and
4 deletions
src/mes/common/siderInfoComponent/index.js
| ... | ... | @@ -635,10 +635,13 @@ const DeviceTargetInfoComponent = () => { |
| 635 | 635 | const equipmentTargetInformation = commonFunc.showLocalMessage(props, 'equipmentTargetInformation', '设备及目标信息'); |
| 636 | 636 | const { workOrderInfoData = [] } = props; |
| 637 | 637 | const sColumnConfig = JSON.parse(workOrderInfoData[0]?.sColumnConfig || '[]'); |
| 638 | - const [first] = sColumnConfig | |
| 639 | - const otherList = sColumnConfig.slice(1).filter(item => item.bVisible === 1); | |
| 640 | - const sNamesInArr2 = new Set(otherList.map(item => item.sName)); // 或 item.sname | |
| 641 | - const result = showConfig.filter(item => sNamesInArr2.has(item.sName)); // 或 item.sname | |
| 638 | + const visibleFieldNames = new Set( | |
| 639 | + sColumnConfig | |
| 640 | + .slice(1) | |
| 641 | + .filter(col => col?.bVisible === 1) | |
| 642 | + .map(col => col.sName) | |
| 643 | + ); | |
| 644 | + const result = showConfig.filter(field => visibleFieldNames.has(field.sName)); // 筛选数据 | |
| 642 | 645 | return ( |
| 643 | 646 | |
| 644 | 647 | <div className={styles.deviceTargetInfo}> | ... | ... |