Commit dcb8e995aa7b4b5598812e58145b2a9ca57533cd
1 parent
57b0ff64
工序颜色与下班
Showing
2 changed files
with
91 additions
and
25 deletions
src/components/Common/CommonTable/index.js
| @@ -2395,27 +2395,21 @@ class CommonTableRc extends React.Component { | @@ -2395,27 +2395,21 @@ class CommonTableRc extends React.Component { | ||
| 2395 | colorValue = t.background; | 2395 | colorValue = t.background; |
| 2396 | } else { | 2396 | } else { |
| 2397 | const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState; | 2397 | const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState; |
| 2398 | - switch (Number(sState)) { // 根据状态显示颜色 | ||
| 2399 | - case 0: | ||
| 2400 | - colorValue = '#808080'; /* 0:灰色 */ | ||
| 2401 | - break; | ||
| 2402 | - case 1: | ||
| 2403 | - colorValue = '#808080'; /* 1:灰色 */ | ||
| 2404 | - break; | 2398 | + switch ( |
| 2399 | + Number(sState) // 根据状态显示颜色 | ||
| 2400 | + ) { | ||
| 2405 | case 2: | 2401 | case 2: |
| 2406 | - colorValue = '#ff4d4f'; /* 2:红色 */ | ||
| 2407 | - break; | ||
| 2408 | - case 3: | ||
| 2409 | - colorValue = '#d4b106'; /* 3:黄色 */ | 2402 | + colorValue = "#FF6600"; /* 2:等待:黄色 */ |
| 2410 | break; | 2403 | break; |
| 2411 | case 4: | 2404 | case 4: |
| 2412 | - colorValue = '#000000'; /* 黑色 */ | 2405 | + colorValue = "#648c4b"; /* 4:已完成:绿色 */ |
| 2413 | break; | 2406 | break; |
| 2414 | - case 5: | ||
| 2415 | - colorValue = '#49aa19'; /* 5:绿色 */ | 2407 | + case 1: |
| 2408 | + case 3: | ||
| 2409 | + colorValue = "#106abe"; /* 1、3:进行中:蓝色 */ | ||
| 2416 | break; | 2410 | break; |
| 2417 | default: | 2411 | default: |
| 2418 | - colorValue = '#000000'; | 2412 | + colorValue = "#000000"; |
| 2419 | } | 2413 | } |
| 2420 | } | 2414 | } |
| 2421 | return ( | 2415 | return ( |
| @@ -12328,18 +12322,18 @@ const useGetTableBtnOprSetting = props => { | @@ -12328,18 +12322,18 @@ const useGetTableBtnOprSetting = props => { | ||
| 12328 | const btnsConfig = | 12322 | const btnsConfig = |
| 12329 | gdsconfigformslave.find( | 12323 | gdsconfigformslave.find( |
| 12330 | item => item.sControlName?.toLowerCase().includes("btnenventdel") | 12324 | item => item.sControlName?.toLowerCase().includes("btnenventdel") |
| 12331 | - ) || {}; | 12325 | + ) || {}; |
| 12332 | props.parentProps.onExecInstructSet({ | 12326 | props.parentProps.onExecInstructSet({ |
| 12333 | btnConfig: { | 12327 | btnConfig: { |
| 12334 | ...btnsConfig, | 12328 | ...btnsConfig, |
| 12335 | sInstruct: btnsConfig.sInstruct | 12329 | sInstruct: btnsConfig.sInstruct |
| 12336 | }, | 12330 | }, |
| 12337 | tableLineParams: { | 12331 | tableLineParams: { |
| 12338 | - ...params | 12332 | + ...params |
| 12339 | }, | 12333 | }, |
| 12340 | nextProps: { | 12334 | nextProps: { |
| 12341 | ...props, | 12335 | ...props, |
| 12342 | - [`${tableName}SelectedRowKeys`]: [record.sId] | 12336 | + [`${tableName}SelectedRowKeys`]: [record.sId] |
| 12343 | } | 12337 | } |
| 12344 | }); | 12338 | }); |
| 12345 | }} | 12339 | }} |
| @@ -12444,7 +12438,50 @@ const useGetTableBtnOprSetting = props => { | @@ -12444,7 +12438,50 @@ const useGetTableBtnOprSetting = props => { | ||
| 12444 | /> | 12438 | /> |
| 12445 | ); | 12439 | ); |
| 12446 | }; | 12440 | }; |
| 12441 | + } else if (btnType.includes("btnenventmanualofftwork")) { | ||
| 12442 | + if (bManual) { | ||
| 12443 | + resultTemp.mesDel = params => { | ||
| 12444 | + const { record, tableName } = params; | ||
| 12445 | + const { sDefault: str } = btnTableDelConfig; | ||
| 12446 | + let disabled = props.getBtnDisabled({ | ||
| 12447 | + str, | ||
| 12448 | + defaultValue: false, | ||
| 12449 | + record | ||
| 12450 | + }); | ||
| 12451 | + if (props.parentProps.bMesBill && !str) { | ||
| 12452 | + disabled = !props.enabled; | ||
| 12453 | + } | ||
| 12454 | + return ( | ||
| 12455 | + <Button | ||
| 12456 | + disabled={disabled} | ||
| 12457 | + style={{ background: '#faad14', color: '#fff' }} | ||
| 12458 | + onClick={e => { | ||
| 12459 | + e.stopPropagation(); | ||
| 12460 | + // props.onMesTableLineDel && props.onMesTableLineDel(params); | ||
| 12461 | + const btnsConfig = | ||
| 12462 | + gdsconfigformslave.find( | ||
| 12463 | + item => item.sControlName?.toLowerCase().includes("enventofftwork") | ||
| 12464 | + ) || {}; | ||
| 12465 | + props.parentProps.onExecInstructSet({ | ||
| 12466 | + btnConfig: { | ||
| 12467 | + ...btnsConfig, | ||
| 12468 | + sInstruct: btnsConfig.sInstruct | ||
| 12469 | + }, | ||
| 12470 | + tableLineParams: { | ||
| 12471 | + ...params | ||
| 12472 | + }, | ||
| 12473 | + nextProps: { | ||
| 12474 | + ...props, | ||
| 12475 | + [`${tableName}SelectedRowKeys`]: [record.sId] | ||
| 12476 | + } | ||
| 12477 | + }); | ||
| 12478 | + }} | ||
| 12479 | + >下班</Button> | ||
| 12480 | + ); | ||
| 12481 | + }; | ||
| 12482 | + } | ||
| 12447 | } | 12483 | } |
| 12484 | + | ||
| 12448 | }); | 12485 | }); |
| 12449 | 12486 | ||
| 12450 | result = resultTemp; | 12487 | result = resultTemp; |
src/mes/teamInfo/index.js
| @@ -502,32 +502,61 @@ const TeamInfo = baseProps => { | @@ -502,32 +502,61 @@ const TeamInfo = baseProps => { | ||
| 502 | bManual | 502 | bManual |
| 503 | }; | 503 | }; |
| 504 | const tableHeight = bManual ? "calc(88vh - 80px)" : "calc(25vh - 80px)"; | 504 | const tableHeight = bManual ? "calc(88vh - 80px)" : "calc(25vh - 80px)"; |
| 505 | - let bManualTableProps | ||
| 506 | - let bManualSlaveTableProps | 505 | + |
| 507 | let faceProps = { | 506 | let faceProps = { |
| 508 | ...props, | 507 | ...props, |
| 509 | faceModal, | 508 | faceModal, |
| 510 | setFaceModal, | 509 | setFaceModal, |
| 511 | 510 | ||
| 512 | }; | 511 | }; |
| 512 | + let bManualTableProps = null; | ||
| 513 | + let bManualSlaveTableProps = null; | ||
| 514 | + | ||
| 513 | if (bManual) { | 515 | if (bManual) { |
| 516 | + // 获取主表和从表的基础配置 | ||
| 514 | const tableBaseProps = commonBusiness.getTableTypes("slave", props); | 517 | const tableBaseProps = commonBusiness.getTableTypes("slave", props); |
| 515 | const slaveTableBaseProps = commonBusiness.getTableTypes("slave1", props); | 518 | const slaveTableBaseProps = commonBusiness.getTableTypes("slave1", props); |
| 519 | + | ||
| 520 | + // 初始化主表 props | ||
| 516 | bManualTableProps = { | 521 | bManualTableProps = { |
| 517 | ...tableBaseProps, | 522 | ...tableBaseProps, |
| 518 | - selectedRowKeys: tableBaseProps.selectedRowKeys ? tableBaseProps.selectedRowKeys : [tableBaseProps?.data?.sId], | ||
| 519 | fixedHeight: "calc(50vh - 218px)", | 523 | fixedHeight: "calc(50vh - 218px)", |
| 520 | tableBtnsWidth: "180px", | 524 | tableBtnsWidth: "180px", |
| 525 | + }; | ||
| 526 | + | ||
| 527 | + // 如果主表没有 selectedRowKeys,设为第一行 sId | ||
| 528 | + if ( | ||
| 529 | + !bManualTableProps.selectedRowKeys || | ||
| 530 | + bManualTableProps.selectedRowKeys.length === 0 | ||
| 531 | + ) { | ||
| 532 | + const firstId = bManualTableProps.data?.[0]?.sId; | ||
| 533 | + if (firstId !== undefined) { | ||
| 534 | + bManualTableProps.selectedRowKeys = [firstId]; | ||
| 535 | + // 可选:同步到父状态(如果需要) | ||
| 536 | + // props.onSaveState?.({ selectedRowKeys: [firstId] }); | ||
| 537 | + } | ||
| 521 | } | 538 | } |
| 539 | + | ||
| 540 | + // 获取当前选中的主表 sId | ||
| 541 | + const selectedParentId = bManualTableProps.selectedRowKeys?.[0]; | ||
| 542 | + | ||
| 543 | + // 过滤从表数据:只保留 sParentId 匹配的项 | ||
| 544 | + const filteredSlaveData = slaveTableBaseProps?.data?.filter( | ||
| 545 | + item => item.sParentId === selectedParentId | ||
| 546 | + ) || []; | ||
| 547 | + | ||
| 548 | + // 构建从表 props | ||
| 522 | bManualSlaveTableProps = { | 549 | bManualSlaveTableProps = { |
| 523 | ...slaveTableBaseProps, | 550 | ...slaveTableBaseProps, |
| 524 | - data: slaveTableBaseProps?.data?.filter(item => item.sParentId === bManualTableProps.selectedRowKeys?.[0]), | ||
| 525 | - fixedHeight: "calc(50vh - 126px)" | ||
| 526 | - } | 551 | + data: filteredSlaveData, |
| 552 | + fixedHeight: "calc(50vh - 126px)", | ||
| 553 | + }; | ||
| 554 | + | ||
| 555 | + // 更新 faceProps 的 config | ||
| 527 | faceProps = { | 556 | faceProps = { |
| 528 | ...faceProps, | 557 | ...faceProps, |
| 529 | gdsconfigformslave: slaveTableBaseProps?.config?.gdsconfigformslave, | 558 | gdsconfigformslave: slaveTableBaseProps?.config?.gdsconfigformslave, |
| 530 | - } | 559 | + }; |
| 531 | } | 560 | } |
| 532 | 561 | ||
| 533 | const handleSave = (props) => { | 562 | const handleSave = (props) => { |