From dcb8e995aa7b4b5598812e58145b2a9ca57533cd Mon Sep 17 00:00:00 2001 From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com> Date: Thu, 29 Jan 2026 10:22:19 +0800 Subject: [PATCH] 工序颜色与下班 --- src/components/Common/CommonTable/index.js | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ src/mes/teamInfo/index.js | 43 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 91 insertions(+), 25 deletions(-) diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 23d9bc8..fde7f43 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -2395,27 +2395,21 @@ class CommonTableRc extends React.Component { colorValue = t.background; } else { const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState; - switch (Number(sState)) { // 根据状态显示颜色 - case 0: - colorValue = '#808080'; /* 0:灰色 */ - break; - case 1: - colorValue = '#808080'; /* 1:灰色 */ - break; + switch ( + Number(sState) // 根据状态显示颜色 + ) { case 2: - colorValue = '#ff4d4f'; /* 2:红色 */ - break; - case 3: - colorValue = '#d4b106'; /* 3:黄色 */ + colorValue = "#FF6600"; /* 2:等待:黄色 */ break; case 4: - colorValue = '#000000'; /* 黑色 */ + colorValue = "#648c4b"; /* 4:已完成:绿色 */ break; - case 5: - colorValue = '#49aa19'; /* 5:绿色 */ + case 1: + case 3: + colorValue = "#106abe"; /* 1、3:进行中:蓝色 */ break; default: - colorValue = '#000000'; + colorValue = "#000000"; } } return ( @@ -12328,18 +12322,18 @@ const useGetTableBtnOprSetting = props => { const btnsConfig = gdsconfigformslave.find( item => item.sControlName?.toLowerCase().includes("btnenventdel") - ) || {}; + ) || {}; props.parentProps.onExecInstructSet({ btnConfig: { ...btnsConfig, sInstruct: btnsConfig.sInstruct }, tableLineParams: { - ...params + ...params }, nextProps: { ...props, - [`${tableName}SelectedRowKeys`]: [record.sId] + [`${tableName}SelectedRowKeys`]: [record.sId] } }); }} @@ -12444,7 +12438,50 @@ const useGetTableBtnOprSetting = props => { /> ); }; + } else if (btnType.includes("btnenventmanualofftwork")) { + if (bManual) { + resultTemp.mesDel = params => { + const { record, tableName } = params; + const { sDefault: str } = btnTableDelConfig; + let disabled = props.getBtnDisabled({ + str, + defaultValue: false, + record + }); + if (props.parentProps.bMesBill && !str) { + disabled = !props.enabled; + } + return ( + + ); + }; + } } + }); result = resultTemp; diff --git a/src/mes/teamInfo/index.js b/src/mes/teamInfo/index.js index 9a123ef..cace3af 100644 --- a/src/mes/teamInfo/index.js +++ b/src/mes/teamInfo/index.js @@ -502,32 +502,61 @@ const TeamInfo = baseProps => { bManual }; const tableHeight = bManual ? "calc(88vh - 80px)" : "calc(25vh - 80px)"; - let bManualTableProps - let bManualSlaveTableProps + let faceProps = { ...props, faceModal, setFaceModal, }; + let bManualTableProps = null; + let bManualSlaveTableProps = null; + if (bManual) { + // 获取主表和从表的基础配置 const tableBaseProps = commonBusiness.getTableTypes("slave", props); const slaveTableBaseProps = commonBusiness.getTableTypes("slave1", props); + + // 初始化主表 props bManualTableProps = { ...tableBaseProps, - selectedRowKeys: tableBaseProps.selectedRowKeys ? tableBaseProps.selectedRowKeys : [tableBaseProps?.data?.sId], fixedHeight: "calc(50vh - 218px)", tableBtnsWidth: "180px", + }; + + // 如果主表没有 selectedRowKeys,设为第一行 sId + if ( + !bManualTableProps.selectedRowKeys || + bManualTableProps.selectedRowKeys.length === 0 + ) { + const firstId = bManualTableProps.data?.[0]?.sId; + if (firstId !== undefined) { + bManualTableProps.selectedRowKeys = [firstId]; + // 可选:同步到父状态(如果需要) + // props.onSaveState?.({ selectedRowKeys: [firstId] }); + } } + + // 获取当前选中的主表 sId + const selectedParentId = bManualTableProps.selectedRowKeys?.[0]; + + // 过滤从表数据:只保留 sParentId 匹配的项 + const filteredSlaveData = slaveTableBaseProps?.data?.filter( + item => item.sParentId === selectedParentId + ) || []; + + // 构建从表 props bManualSlaveTableProps = { ...slaveTableBaseProps, - data: slaveTableBaseProps?.data?.filter(item => item.sParentId === bManualTableProps.selectedRowKeys?.[0]), - fixedHeight: "calc(50vh - 126px)" - } + data: filteredSlaveData, + fixedHeight: "calc(50vh - 126px)", + }; + + // 更新 faceProps 的 config faceProps = { ...faceProps, gdsconfigformslave: slaveTableBaseProps?.config?.gdsconfigformslave, - } + }; } const handleSave = (props) => { -- libgit2 0.22.2