Commit 2aa40c6e9e579d55d8bcad5bfb77e15d3539cb72
1 parent
7f17dfc3
快速报价后道参数功能开发;
Showing
2 changed files
with
84 additions
and
4 deletions
src/components/QuickQuote/index.jsx
| ... | ... | @@ -1300,15 +1300,21 @@ const BoxComponent = props => { |
| 1300 | 1300 | const upViewProps20 = getUpViewPropsByITag(20); |
| 1301 | 1301 | |
| 1302 | 1302 | const { sBackProcessData = [] } = slaveRowData; |
| 1303 | + | |
| 1304 | + const [downAbleConfigsNew, setDownAbleConfigsNew] = useState([]); | |
| 1305 | + useEffect(() => { | |
| 1306 | + setDownAbleConfigsNew(downAbleConfigs); | |
| 1307 | + }, [selectedNode.showName, boxModel]); | |
| 1308 | + | |
| 1303 | 1309 | // 获取sType为2的 |
| 1304 | 1310 | const downViewProps = { |
| 1305 | 1311 | ...props, |
| 1306 | - viewConfigs: downAbleConfigs.filter(item => item.sPartsName === boxModel || !item.sPartsName), | |
| 1307 | - tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigs }, | |
| 1312 | + viewConfigs: downAbleConfigsNew.filter(item => item.sPartsName === boxModel || !item.sPartsName), | |
| 1313 | + tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigsNew }, | |
| 1308 | 1314 | iColValueView: 24, |
| 1309 | 1315 | viewRow: slaveRowData, |
| 1310 | 1316 | getViewRow: config => { |
| 1311 | - return sBackProcessData.find(item => item[config.sName]) || {}; | |
| 1317 | + return sBackProcessData.find(item => item[config.sName0 || config.sName]) || {}; | |
| 1312 | 1318 | }, |
| 1313 | 1319 | tableName: `slaveDown${boxModel}`, |
| 1314 | 1320 | getSqlDropDownData: (...args) => { |
| ... | ... | @@ -1384,6 +1390,51 @@ const BoxComponent = props => { |
| 1384 | 1390 | "" |
| 1385 | 1391 | ); |
| 1386 | 1392 | }, |
| 1393 | + extraContent2: child => { | |
| 1394 | + return ( | |
| 1395 | + <div className={styles.downOperations}> | |
| 1396 | + {!child.sParentName ? ( | |
| 1397 | + <Button | |
| 1398 | + icon={<PlusOutlined />} | |
| 1399 | + type="link" | |
| 1400 | + onClick={() => { | |
| 1401 | + setDownAbleConfigsNew(pre => { | |
| 1402 | + const iIndex = pre.findIndex(item => item.sId === child.sId); | |
| 1403 | + const childLen = pre.filter(item => item.sParentName === child.showName).length; | |
| 1404 | + const newSId = commonUtils.createSid(); | |
| 1405 | + const newConfig = { | |
| 1406 | + ...child, | |
| 1407 | + sId: newSId, | |
| 1408 | + sParentName: child.showName, | |
| 1409 | + sName: `${child.sName}_${newSId}`, | |
| 1410 | + }; | |
| 1411 | + return [...pre.slice(0, iIndex + childLen + 1), newConfig, ...pre.slice(iIndex + childLen + 1)]; | |
| 1412 | + }); | |
| 1413 | + }} | |
| 1414 | + /> | |
| 1415 | + ) : ( | |
| 1416 | + <Button | |
| 1417 | + icon={<MinusOutlined />} | |
| 1418 | + type="link" | |
| 1419 | + onClick={() => { | |
| 1420 | + setDownAbleConfigsNew(pre => { | |
| 1421 | + const iIndex = pre.findIndex(item => item.sId === child.sId); | |
| 1422 | + return [...pre.slice(0, iIndex), ...pre.slice(iIndex + 1)]; | |
| 1423 | + }); | |
| 1424 | + | |
| 1425 | + const slaveRowIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); | |
| 1426 | + props.setState(pre => { | |
| 1427 | + const { sBackProcessData = [] } = slaveData[slaveRowIndex]; | |
| 1428 | + const iIndex = sBackProcessData.findIndex(item => item[child.sName]); | |
| 1429 | + slaveData[slaveRowIndex].sBackProcessData.splice(iIndex, 1); | |
| 1430 | + return { ...pre, slaveData }; | |
| 1431 | + }); | |
| 1432 | + }} | |
| 1433 | + /> | |
| 1434 | + )} | |
| 1435 | + </div> | |
| 1436 | + ); | |
| 1437 | + }, | |
| 1387 | 1438 | }; |
| 1388 | 1439 | |
| 1389 | 1440 | // 获取sType为3的 |
| ... | ... | @@ -1737,7 +1788,7 @@ const BoxComponent = props => { |
| 1737 | 1788 | <> |
| 1738 | 1789 | {/* <Divider {...dividerProps}>后道参数</Divider> */} |
| 1739 | 1790 | <div className={styles.boxPart2}> |
| 1740 | - <div className={styles.viewTable}> | |
| 1791 | + <div className={`${styles.viewTable} ${styles.viewTableDownView}`}> | |
| 1741 | 1792 | <CommonViewTable {...downViewProps} /> |
| 1742 | 1793 | </div> |
| 1743 | 1794 | </div> | ... | ... |
src/components/QuickQuote/index.less
| ... | ... | @@ -144,6 +144,14 @@ |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | + .viewTableDownView { | |
| 148 | + :global { | |
| 149 | + .viewStyle { | |
| 150 | + padding-right: 14px; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 147 | 155 | .viewTable1 { |
| 148 | 156 | padding: 0 20px 0 0; |
| 149 | 157 | } |
| ... | ... | @@ -413,4 +421,25 @@ |
| 413 | 421 | width: calc(100% - 200px); |
| 414 | 422 | height: 100%; |
| 415 | 423 | } |
| 424 | +} | |
| 425 | + | |
| 426 | +.downOperations { | |
| 427 | + position: absolute; | |
| 428 | + top: -4px; | |
| 429 | + right: -14px; | |
| 430 | + display: flex; | |
| 431 | + flex-direction: column; | |
| 432 | + z-index: 1000; | |
| 433 | + | |
| 434 | + :global { | |
| 435 | + button { | |
| 436 | + padding: 0; | |
| 437 | + width: 16px; | |
| 438 | + height: 16px; | |
| 439 | + | |
| 440 | + >span { | |
| 441 | + font-size: 10px; | |
| 442 | + } | |
| 443 | + } | |
| 444 | + } | |
| 416 | 445 | } |
| 417 | 446 | \ No newline at end of file | ... | ... |