diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js index f03dc19..b4542d2 100644 --- a/src/components/Common/CommonHooks/useCommonBase.js +++ b/src/components/Common/CommonHooks/useCommonBase.js @@ -1669,7 +1669,7 @@ const useCommonBase = props => { tbName, sConfigName } = sRulesObj; - console.log("tbName:", tbName); + console.log("tbName:", tbName,); /* 主表单表字段根据条件控制 其他字段的显示与隐藏 */ if (commonUtils.isEmptyObject(tbName)) { if (commonUtils.isNotEmptyArr(condition)) { @@ -2724,7 +2724,6 @@ const useCommonBase = props => { } = params; const { sControlName = "", sInstruct } = config; const sControlLowerName = sControlName.toLowerCase(); - // 调用指令集 if (sInstruct) { handleExecInstructSet({ @@ -3055,10 +3054,97 @@ const useCommonBase = props => { }; // 复制到 - const handleCopyTo = ({ tableName, config, record }) => { - const { sActiveId, sActiveName } = config; - }; + const handleCopyTo = async (nextProps, name, sActiveId) => { + /* 待用数据声明 */ + const { + masterConfig, + masterData, + slaveData, + controlData, + materialsData, + processData, + packData, + app, + token, + sModelsId, + formRoute, + slaveSelectedRowKeys, + } = props; + console.log("🚀 ~ handleCopyTo ~ props:", props, nextProps) + const { sActiveName } = nextProps.config; + let sParentConditions = {}; + props.onOpenCommonModal({ + type: "commonModal", + sActiveId, + sActiveName, + sParentConditions, + parentProps: nextProps, + onOk: data => { + window.debugger && console.log("=====onOk"); + }, + onCancel: () => { + window.debugger && console.log("=====onCancel"); + } + }); + return + // 从表有sCopyToCondition则不能复制,并提示 + if (commonUtils.isNotEmptyArr(slaveData) && name.includes('.')) { + const sCopyToConditionIndex = slaveData.findIndex(item => item.sCopyToCondition); + if (sCopyToConditionIndex !== -1) { + message.warning(slaveData[sCopyToConditionIndex].sCopyToCondition); + return; + } + } + + const copyTo = {}; + // const copyToConfig = masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes(name)); + copyTo.name = name; + copyTo.config = copyToConfig; + copyTo.masterData = masterData; + copyTo.slaveData = slaveData; + copyTo.controlData = controlData; + copyTo.materialsData = materialsData; + copyTo.processData = processData; + copyTo.packData = packData; + copyTo.srcFormRoute = formRoute; + + // 部分红冲,需要将选中的从表数据带过去 + if (name.includes('Portion')) { + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { + message.warning('请选择至少一条从表数据'); + return; + } + const filterSlaveData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId)); + copyTo.slaveData = filterSlaveData; + } + if (sModelsId === '12710101116943091653680' && name === 'BtnCopyTo.alumite') { + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { + message.warning('请选择至少一条从表数据'); + return; + } + } + + + const tbSuffix = ''; + let sId = ''; + if (!commonUtils.isEmpty(slaveData)) { + sId = slaveData[0].sId; + } else { + sId = masterData.sId; + } + const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`; + const values = { sSlaveId: sId }; + const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; + if (dataReturn.code === 1) { + if (dataReturn.dataset.rows.length > 0) { + console.log(dataReturn, 'dataReturn'); + + } else { + + } + } + }; // 合并config配置和所有sButtonEnabled配置 const handleMergeTableConfig = tableConfig => { const { sRulesJsonTotal } = state; @@ -3338,7 +3424,7 @@ const useCommonBase = props => { const { data } = await commonServices.postValueService(token, value, url); if (data.code === 1) { /* 数据删除成功 */ - + if (sModelsType !== 'commonOeeBill') { handleDelDataSuccess(props); } else { @@ -3351,7 +3437,7 @@ const useCommonBase = props => { }; /* 数据删除成功跳转到新路由即pane */ const handleDelDataSuccess = (props) => { - + }; const returnProps = { diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 70b2133..5bf28ba 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4376,10 +4376,12 @@ class CommonTableRc extends React.Component { search = false; } } + console.log(props, 'props.data'); + if ( column.dataIndex === "spicture" || column.dataIndex === "tableLastEmpty" || - props.data?.some(item => + props?.data?.some(item => item.costomEnabledList?.includes(column.dataIndex) ) ) { @@ -4793,6 +4795,8 @@ class CommonTableRc extends React.Component { }} /> } + console.log(props?.parentProps?.sModelType, props, 'messsss'); + if (this.isPopupShow) { const enabled = this.getTableBtnState('BtnPopup', record); @@ -4808,6 +4812,7 @@ class CommonTableRc extends React.Component { tableData: props.data }) : props.tableBtnsConfig || []; + console.log(tableBtnsConfig, typeof props.tableBtnsConfig === "function", 'tableBtnsConfig'); return (
{tableBtnsConfig.map(config => { - const { showName, btnBgColor, sColor, sDefault: str } = config; + if (!config) return + const { showName, btnBgColor, sColor, sDefault: str, sControlName } = config; const disabled = props.getBtnDisabled({ str, defaultValue: false, @@ -4859,6 +4865,11 @@ class CommonTableRc extends React.Component { const { [this.rowKey]: rowKeyId } = record; const { selectedRowKeys = [] } = props; + if (sControlName.includes('BtnTableCopyTo.ActProduceReport')) { + const copyToConfig = props?.config?.gdsconfigformslave.filter(x=>x.sControlName.includes('BtnTableCopyTo.ActProduceReport')) + props.onCopyTo(props.name, config.sActiveId, config, copyToConfig, record) + return + } if (selectedRowKeys.includes(rowKeyId)) { onTempTableBtnClick(); } else { @@ -4867,7 +4878,7 @@ class CommonTableRc extends React.Component { [`${props.name}SelectedRowKeys`]: [rowKeyId] }, nextProps => { - + onTempTableBtnClick(nextProps); } ); @@ -5049,7 +5060,7 @@ class CommonTableRc extends React.Component { ) : ( "" )} - {props.mesAdd + {props.mesAdd && props?.parentProps?.sModelType !== '/indexPage/commonList' ? props.mesAdd({ tableName: props.name, tableClassName: this.state.tableClassName @@ -12206,7 +12217,7 @@ const useGetTableBtnOprSetting = props => { // sDefault = const btnList = gdsconfigformslave.filter(item => item.bVisible && item.sControlName.includes('Btn')) sDefault = btnList?.map(item => { - return getButtonName(item.sControlName.toLowerCase()) + return getButtonName(item.sControlName.toLowerCase()) }).join(',') } // sDefault = sDefault + ',materials' diff --git a/src/default.less b/src/default.less index 332c04e..d3aaa19 100644 --- a/src/default.less +++ b/src/default.less @@ -228,7 +228,14 @@ padding: @td_padding_sub; } } - + .readonlyStyle{ + .ant-form-item-control-input-content { + input[disabled] { + background: #f1f2f8 !important; + } + } + + } input[disabled] { color: #000 !important; background: #fff !important; @@ -364,8 +371,9 @@ margin-left: 6px; margin-top: 6px; } + } - + .ant-modal { max-width: unset; } @@ -1012,4 +1020,11 @@ display: none; } } + .readonlyStyle { + background: #f1f2f8 !important; + + .sActiveIdStyle { + background: #f1f2f8 !important; + } + } } \ No newline at end of file diff --git a/src/mes/common/commonModelComponent/index.js b/src/mes/common/commonModelComponent/index.js index 4b14816..06ef866 100644 --- a/src/mes/common/commonModelComponent/index.js +++ b/src/mes/common/commonModelComponent/index.js @@ -401,6 +401,7 @@ const useCommonModelEvent = props => { if (commonUtils.isEmptyObject(copyTo)) return; const { masterConfig, sModelsId, masterData } = props; + const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {} if (masterData && masterData.sBillNo) return let masterDataCopyTo = {}; for (const key in copyTo) { @@ -417,15 +418,52 @@ const useCommonModelEvent = props => { sFormId: sModelsId, ...masterDataCopyTo }; - props.onSaveState({ masterData: masterDataNew, enabled: true }); + const addState = {}; // 始终初始化为对象 + // if (Array.isArray(copyToConfig) && copyToConfig.length > 0) { + // copyToConfig.forEach(item => { + // if (item?.sControlName) { + // const name = item.sControlName.split('.').pop(); + // if (name && name.includes('slave')) { + // addState[`${name}Data`] = { + // ...commonFunc.getDefaultData(`${name}Config`), + // handleType: "add", + // sId: commonUtils.createSid(), + // sFormId: sModelsId, + // ...commonFunc.getAssignFieldValue(item.sAssignField, record) + // }; + // } + // } + // }); + // } + props.onSaveState({ masterData: masterDataNew, enabled: true, ...addState }); }, [props.bFinish] ); const { gdsconfigformslave } = props?.slaveConfig || {} - const copyConfig = gdsconfigformslave?.filter(x => x.sControlName.includes('BtnCopyTo')) useEffect(() => { + const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {} + if (!props.masterData) return + if (!copyToConfig) return + const addState = {}; // 始终初始化为对象 + if (Array.isArray(copyToConfig) && copyToConfig.length > 0) { + copyToConfig.forEach(item => { + if (item?.sControlName) { + const nameList = item.sControlName.split('.'); + if (nameList && nameList.length > 2) { + const name = nameList.pop() + addState[`${name}Data`] = [{ + ...commonFunc.getDefaultData(`${name}Config`), + handleType: "add", + sId: commonUtils.createSid(), + ...commonFunc.getAssignFieldValue(item.sAssignField, record) + }]; + } + } + }); + } + props.onSaveState({ ...addState }); - }, []) + }, [props.masterData]) // 如果是表单类型,并且主表数据为空,默认为编辑状态 // useEffect( @@ -470,12 +508,12 @@ const useCommonModelEvent = props => { // 获取数据集 const handleGetData = async (tableList = [], isWait, bInit) => { + const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {} let addState = {}; + let copy = {} for (let i = 0; i < tableList.length; i++) { const tableName = tableList[i]; const config = formData.find(item => item.sGrd === tableName); - console.log(config, 'config'); - if (!config || tableName.includes("FirstlineSelected")) continue; const conditonValues = props.onGetSqlConditionValues(config); let { [`${tableName}Filter`]: bFilter } = props; @@ -652,7 +690,22 @@ const useCommonModelEvent = props => { } } } - addState = { ...addState, ...result }; + // if (copyToConfig && copyToConfig.length) { + // copyToConfig.forEach(item => { + // const name = item.sControlName.split('.').pop() + // if (name === tableName) { + // const data = commonFunc.getAssignFieldValue(item.sAssignField, record) + // copy[`${tableName}Data`] = { + // ...commonFunc.getDefaultData(name + 'Config'), + // handleType: "add", + // sId: commonUtils.createSid(), + // sFormId: sModelsId, + // ...data + // } + // } + // }) + // } + addState = { ...addState, ...result, ...copy }; if (tableName === "tableS0" && props.sSReserve1) { addState.sSReserve1 = undefined; @@ -1193,7 +1246,6 @@ const CommonModel = baseProps => { ? useCommonModelEvent(baseProps) : useCommonModelEvent(useCommonBase(baseProps)); const { bFinish } = props; - if (!bFinish) return ""; const { tabConfig = [] } = props; @@ -1544,7 +1596,7 @@ const CommonViewTableComponent = props => { return gdsconfigformslave.filter( item => item.sName && - item.bControl && + item.bVisible && item.sControlName.indexOf("Btn") === -1 && item.sControlName.indexOf("_") === -1 ); @@ -1557,7 +1609,7 @@ const CommonViewTableComponent = props => { ); } }); - + const operationBarProps = { ...props, sName, diff --git a/src/mes/common/commonOperationBarComponent/MesToolbar.js b/src/mes/common/commonOperationBarComponent/MesToolbar.js index 3fd5cf1..9412d12 100644 --- a/src/mes/common/commonOperationBarComponent/MesToolbar.js +++ b/src/mes/common/commonOperationBarComponent/MesToolbar.js @@ -1,25 +1,29 @@ /* eslint-disable */ import { message } from "antd"; import * as commonUtils from "@/utils/utils"; - +import * as commonFunc from "@/components/Common/commonFunc"; const ToolbarFun = (props) => { const { btnConfig, bMesBill } = props; const currentMesPane = commonUtils.getAppData("currentMesPane"); - const { sModelType } = currentMesPane; - - if (!["/indexPage/commonList", "/indexPage/commonBill", "/indexMes/processReport"].includes(sModelType) && !bMesBill) { + const { sModelType = '' } = currentMesPane; + const { sControlName } = btnConfig; + const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); + if ((btnName.includes('btnscanface')) && !bMesBill) { + handleScanFace(props); + return true + } else if (!["/indexPage/commonList", "/indexPage/commonBill"].includes(sModelType) && !bMesBill) { return false; } - const { sControlName } = btnConfig; - const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); + // const { sControlName } = btnConfig; + // const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); if (btnName === 'btnadd') { handleAdd(props); } else if (btnName === 'btnsave') { handleSave(props); } else if (btnName === 'btnupd') { props.onSaveState({ enabled: true }); - } else if (btnName === 'btnscanface' || btnName === 'btnscanface1') { + } else if (btnName.includes('btnscanface')) { handleScanFace(props); } else if (btnName === 'btncancel') { props.onCancel() @@ -96,8 +100,6 @@ const handleSave = (props) => { ]) }, inscallback: () => { - console.log(1111, 'footer'); - props.onSaveState({ currentId: props.masterData.sId, enabled: false }); @@ -129,10 +131,14 @@ const handleScanFace = (props) => { faceData: { sFaceParentId: faceData[0].sParentId, sFaceEmployeeNo: faceData[0].sEmployeeNo }, onSuccess: (_, dataset) => { const { proData = [] } = dataset.rows[0].dataSet; - const { [`${addData}Data`]: tableData = [] } = props; + const { [`${addData}Data`]: tableData = [], [`${addData}Config`]: config = {} } = props; + const { btnConfig = {}, copyToConfig = [], record = {} } = props?.parentProps || {} + const copyConfig = config?.gdsconfigformslave?.find(item => item.sControlName.toLowerCase().includes('btnscanface')) proData.forEach(item => { + const data = commonFunc.getAssignFieldValue(copyConfig?.sAssignField, item) tableData.push({ ...item, + ...data, sId: commonUtils.createSid(), handleType: "add", sParentId: props.masterData.sId, diff --git a/src/mes/scheduledTasks/machineTasks/index.js b/src/mes/scheduledTasks/machineTasks/index.js index 91bb0ad..d1c0f64 100644 --- a/src/mes/scheduledTasks/machineTasks/index.js +++ b/src/mes/scheduledTasks/machineTasks/index.js @@ -1,9 +1,10 @@ /* - * @Author: Sakura + * @Author: Sakura * @LastEditors: Sakura - * @Date: 2024-02-28 9:55:04 - * @Description: 计划任务 ---- 机台任务 - */ + * @Date: 2024-02-28 9:55:04 + * @Description: 计划任务 ---- 机台任务 + */ +/* eslint-disable */ import React, { useEffect, useRef, useState } from "react"; import moment from "moment"; import { @@ -250,11 +251,9 @@ const useInfoEvent = props => { plcMachinedata: record }; - const url = `${ - commonConfig.server_host - }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${ - record.sMachineId - }`; + const url = `${commonConfig.server_host + }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${record.sMachineId + }`; const returnData = (await commonServices.postValueService( app.token, value, @@ -344,7 +343,7 @@ const useInfoEvent = props => { const handleTableBtnClick = async item => { const { tableName, index, record, tableData, config, iFlag } = item; const { showName, sControlName } = config; - + if (sControlName === 'BtnProductionReporting') { props.onTableBtnClick(item); return; @@ -445,13 +444,11 @@ const useInfoEvent = props => { const { app } = props; const { sId } = item.record; const { token } = app; - const url = `${ - commonConfig.server_host - }oee/updateProductionplan/${sId}/${iFlag}${ - pauseValue + const url = `${commonConfig.server_host + }oee/updateProductionplan/${sId}/${iFlag}${pauseValue ? `?sWorkOrderChangeMemo=${encodeURIComponent(pauseValue)}` : "" - }`; + }`; const dataReturn = (await commonServices.getService(token, url)).data; if (dataReturn.code === 1) { handleRefresh(); @@ -497,6 +494,7 @@ const MachineTasks = baseProps => { slave2Column, slave2Data = [] } = props; + console.log("🚀 ~ MachineTasks ~ props:", props) const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); @@ -512,24 +510,46 @@ const MachineTasks = baseProps => { slave0Config?.gdsconfigformslave?.find( item => item.sControlName === "BtnTableCopyTo.pauseWork" ) || {}; - + // 产量上报按钮 + const actProduceReportConfig = slave0Config?.gdsconfigformslave?.find( + item => item.sControlName === 'BtnTableCopyTo.ActProduceReport' + ) || {}; + const copytoConfig = slave0Config?.gdsconfigformslave?.find( + item => item.sControlName === "BtnTableCopyTo" + ) || {}; // 表格业务 const [sSrcNo, setSSrcNo] = useState(""); const tableBtnsConfig = slave0Config?.gdsconfigformslave?.filter( - item => item.sControlName === "BtnProductionReporting" - ) || []; + item => item.sControlName === "BtnProductionReporting" + ) || []; + const handleCopyTo = async (name, sActiveId, btnConfig, copyToConfig, record) => { + let sParentConditions = {}; + const { sActiveName } = btnConfig; + props.onOpenCommonModal({ + type: "commonModal", + sActiveId, + title: sActiveName, + sParentConditions, + parentProps: { ...props, btnConfig, copyToConfig, record }, + onOk: data => { + window.debugger && console.log("=====onOk"); + }, + onCancel: () => { + window.debugger && console.log("=====onCancel"); + } + }); + } // 顶部表格配置 const tableProps = { ...commonBusiness.getTableTypes("slave0", props), // data: [{ sId: "123" }], tableProps: { - onChange: () => {}, + onChange: () => { }, loading: isTableLoading }, tableBtnsConfig: params => { const { record, index } = params; - const { iStar } = record; - + const { iStar, bManual } = record; let showName, btnBgColor, sDefault; if (iStar === 1) { showName = "暂停"; @@ -547,17 +567,20 @@ const MachineTasks = baseProps => { sDefault = "${false}"; } + const outPut = bManual ? [actProduceReportConfig] : [{ showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, + { showName: "完工", btnBgColor: "#1890FF", sDefault }] return [ - { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, - { showName: "完工", btnBgColor: "#1890FF", sDefault }, - ...tableBtnsConfig + ...outPut, + ...tableBtnsConfig, + ]; }, onTableBtnClick: item => { props.onTableBtnClick(item); }, - tableBtnsWidth: "280px", - fixedHeight: "335px" + tableBtnsWidth: "200px", + fixedHeight: "335px", + onCopyTo: handleCopyTo }; // 全部按钮事件 const tableAll = () => {