Commit c107d09c0220ea815069d99a26eb7b98b7deafeb
1 parent
2336b2fa
commonbill功能v1;
Showing
7 changed files
with
212 additions
and
96 deletions
src/components/Common/CommonHooks/useCommonBase.js
| @@ -56,33 +56,51 @@ const useCommonBase = props => { | @@ -56,33 +56,51 @@ const useCommonBase = props => { | ||
| 56 | } | 56 | } |
| 57 | const { sModelsId, app } = state; | 57 | const { sModelsId, app } = state; |
| 58 | const formData = await handleGetModelConfig({ sModelsId }); | 58 | const formData = await handleGetModelConfig({ sModelsId }); |
| 59 | + | ||
| 60 | + const addState = {}; | ||
| 61 | + let pageRoute = props.sModelType; | ||
| 62 | + // 如果是弹窗且没有pageLayout,则认为是commonBill | ||
| 63 | + if (commonUtils.isNotEmptyObject(props.parentProps) && formData.length && !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')) { | ||
| 64 | + pageRoute = '/indexPage/commonBill'; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + if (formData.length && !props.currentContent && ['/indexPage/commonList', '/indexPage/commonBill'].includes(pageRoute) && !formData[0].gdsconfigformslave.some(item => item.sControlName === 'pageLayout')) { | ||
| 68 | + if (pageRoute === '/indexPage/commonList') { | ||
| 69 | + formData[0].sGrd = 'slave'; | ||
| 70 | + formData[0].gdsconfigformslave.push({ | ||
| 71 | + sId: commonUtils.createSid(), | ||
| 72 | + sControlName: 'pageLayout', | ||
| 73 | + sDefault: JSON.stringify([["slave"],[{"configList":[{"sName":"slave","sTabName":"","sEnglishTabName":"","sBig5TabName":"","showType":"table","bHideTitle":true,"tableBtnsConfig":[]}],"mode":"advanced","height":"100%","width":"100%"}]]) | ||
| 74 | + }) | ||
| 75 | + } else if (pageRoute === '/indexPage/commonBill') { | ||
| 76 | + const { sLanguage } = app.userinfo; | ||
| 77 | + const [tableList, tabConfig] = [[], []]; | ||
| 78 | + formData.forEach((item, index) => { | ||
| 79 | + if (index === 0) { | ||
| 80 | + item.sGrd = 'master'; | ||
| 81 | + tableList.push('master'); | ||
| 82 | + tabConfig.push({"configList":[{"sName":"master","showType":"form","bHideTitle":true,"defaultEnabled":true}],"mode":"advanced","height":"auto","width":"100%"}); | ||
| 83 | + } else { | ||
| 84 | + const tablename = `slave${index - 2 < 0 ? '' : index - 2}`; | ||
| 85 | + item.sGrd = tablename; | ||
| 86 | + tableList.push(tablename); | ||
| 87 | + if (!tabConfig[1]) { | ||
| 88 | + tabConfig.push({"configList":[],"mode":"advanced"}); | ||
| 89 | + } | ||
| 90 | + tabConfig[1].configList.push({"sName":tablename,"sTabName":item[sLanguage],"showType":"table","defaultEnabled":true,"bHideTitle":true}); | ||
| 91 | + } | ||
| 92 | + }); | ||
| 93 | + formData[0].gdsconfigformslave.push({ | ||
| 94 | + sId: commonUtils.createSid(), | ||
| 95 | + sControlName: 'pageLayout', | ||
| 96 | + sDefault: JSON.stringify([tableList, tabConfig]) | ||
| 97 | + }) | ||
| 98 | + addState.bMesBill = true; | ||
| 99 | + addState.copyTo = { master: { maxBillNo: 'sBillNo' } }; | ||
| 100 | + } | ||
| 101 | + } | ||
| 59 | 102 | ||
| 60 | - // 班组报工特殊处理 | ||
| 61 | - // if (state.sModelsId === "12710101117087404588200") { | ||
| 62 | - // const { userinfo = {} } = app; | ||
| 63 | - // const globalData = commonUtils.convertStrToObj( | ||
| 64 | - // localStorage.xlybusinessglobalData | ||
| 65 | - // ); | ||
| 66 | - // const iInterface = | ||
| 67 | - // globalData.currentWorkOrderInfo?.iInterface || userinfo.iInterface; | ||
| 68 | - // const iIndex = formData.findIndex(item => item.sGrd === "table1"); | ||
| 69 | - // if (iIndex !== -1) { | ||
| 70 | - // const iIndex1 = formData[iIndex].gdsconfigformslave.findIndex( | ||
| 71 | - // item => item.sName === "sBoardNo" | ||
| 72 | - // ); | ||
| 73 | - // if (iIndex1 !== -1) { | ||
| 74 | - // if (iInterface === 10) { | ||
| 75 | - // // 包装的托盘计数信息托盘板号改为包装板号 | ||
| 76 | - // formData[iIndex].gdsconfigformslave[iIndex1].showName = "包装板号"; | ||
| 77 | - // } else if (iInterface === 9) { | ||
| 78 | - // // 品检的托盘计数信息托盘板号改为质检板号 | ||
| 79 | - // formData[iIndex].gdsconfigformslave[iIndex1].showName = "质检板号"; | ||
| 80 | - // } | ||
| 81 | - // } | ||
| 82 | - // } | ||
| 83 | - // } | ||
| 84 | - | ||
| 85 | - handleSaveState({ formData }); | 103 | + handleSaveState({ formData, ...addState }); |
| 86 | }, []); | 104 | }, []); |
| 87 | 105 | ||
| 88 | const { callbackRefresh, callback } = state; | 106 | const { callbackRefresh, callback } = state; |
src/components/Common/CommonViewTable/index.js
| @@ -487,7 +487,7 @@ class CommonViewTableRc extends Component { | @@ -487,7 +487,7 @@ class CommonViewTableRc extends Component { | ||
| 487 | enabledNew = true; | 487 | enabledNew = true; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | - if (this.props.enabledNew !== undefined) { | 490 | + if (!this.props.bMesBill && this.props.enabledNew !== undefined) { |
| 491 | enabledNew = this.props.enabledNew; | 491 | enabledNew = this.props.enabledNew; |
| 492 | } | 492 | } |
| 493 | 493 |
src/mes/common/commonModelComponent/index.js
| @@ -29,7 +29,8 @@ const useCommonModelEvent = props => { | @@ -29,7 +29,8 @@ const useCommonModelEvent = props => { | ||
| 29 | enabled, | 29 | enabled, |
| 30 | copyTo, | 30 | copyTo, |
| 31 | sFilterConditions, // 父页面过滤条件 | 31 | sFilterConditions, // 父页面过滤条件 |
| 32 | - noGetData // 不要加载数据,根据另一张表选中行加载时用 | 32 | + noGetData, // 不要加载数据,根据另一张表选中行加载时用 |
| 33 | + currentId, | ||
| 33 | } = props; | 34 | } = props; |
| 34 | 35 | ||
| 35 | let formData = | 36 | let formData = |
| @@ -279,24 +280,31 @@ const useCommonModelEvent = props => { | @@ -279,24 +280,31 @@ const useCommonModelEvent = props => { | ||
| 279 | pageLayout = handleGetFilterPageLayout(pageLayout); | 280 | pageLayout = handleGetFilterPageLayout(pageLayout); |
| 280 | const [tableList, tabConfig] = pageLayout; | 281 | const [tableList, tabConfig] = pageLayout; |
| 281 | const colunmData = handleGetColumnData(tableList, true); | 282 | const colunmData = handleGetColumnData(tableList, true); |
| 282 | - const result = !noGetData | ||
| 283 | - ? await handleGetData(tableList, true, true) | ||
| 284 | - : await handleGetData( | ||
| 285 | - tableList.filter( | ||
| 286 | - item => | ||
| 287 | - item === "workerOrderBatchMaterial" || item === "plateInfo" | ||
| 288 | - ), | ||
| 289 | - true, | ||
| 290 | - true | ||
| 291 | - ); | 283 | + let result = {}; |
| 284 | + if (!commonUtils.isEmptyObject(copyTo) && !refreshCount) { | ||
| 285 | + | ||
| 286 | + } else if (noGetData) { | ||
| 287 | + result = await await handleGetData( | ||
| 288 | + tableList.filter( | ||
| 289 | + item => | ||
| 290 | + item === "workerOrderBatchMaterial" || item === "plateInfo" | ||
| 291 | + ), | ||
| 292 | + true, | ||
| 293 | + true | ||
| 294 | + ); | ||
| 295 | + } else { | ||
| 296 | + result = await handleGetData(tableList, true, true); | ||
| 297 | + } | ||
| 298 | + if (!currentId) { | ||
| 299 | + addState.bFinish = props.bFinish ? props.bFinish + 1 : 1; | ||
| 300 | + } | ||
| 292 | addState = { | 301 | addState = { |
| 293 | ...addState, | 302 | ...addState, |
| 294 | tableList, | 303 | tableList, |
| 295 | tabConfig, | 304 | tabConfig, |
| 296 | ...colunmData, | 305 | ...colunmData, |
| 297 | ...result, | 306 | ...result, |
| 298 | - firstTableName: tableList[0], | ||
| 299 | - bFinish: props.bFinish ? props.bFinish + 1 : 1 | 307 | + firstTableName: tableList[0] |
| 300 | }; | 308 | }; |
| 301 | // 读码时,点下料不需要选中,使用指令集 clearrowkey, 发现与这个是异步的,导致还是选中状态。 | 309 | // 读码时,点下料不需要选中,使用指令集 clearrowkey, 发现与这个是异步的,导致还是选中状态。 |
| 302 | // addState["salveWydm1SelectedRowKeys"] = []; // 0806解决生成检验标示后选中状态消失 | 310 | // addState["salveWydm1SelectedRowKeys"] = []; // 0806解决生成检验标示后选中状态消失 |
| @@ -327,7 +335,7 @@ const useCommonModelEvent = props => { | @@ -327,7 +335,7 @@ const useCommonModelEvent = props => { | ||
| 327 | [ | 335 | [ |
| 328 | formData.length, | 336 | formData.length, |
| 329 | refreshCount, | 337 | refreshCount, |
| 330 | - enabled, | 338 | + // enabled, |
| 331 | noGetData, | 339 | noGetData, |
| 332 | JSON.stringify(sFilterConditions) | 340 | JSON.stringify(sFilterConditions) |
| 333 | ] | 341 | ] |
| @@ -567,6 +575,14 @@ const useCommonModelEvent = props => { | @@ -567,6 +575,14 @@ const useCommonModelEvent = props => { | ||
| 567 | conditonValues.sSReserve1 = props.sSReserve1; | 575 | conditonValues.sSReserve1 = props.sSReserve1; |
| 568 | } | 576 | } |
| 569 | 577 | ||
| 578 | + if (currentId) { | ||
| 579 | + if (tableName === 'master') { | ||
| 580 | + conditonValues.sId = currentId; | ||
| 581 | + } else { | ||
| 582 | + conditonValues.sParentId = currentId; | ||
| 583 | + } | ||
| 584 | + } | ||
| 585 | + | ||
| 570 | const result = | 586 | const result = |
| 571 | (await props.onGetDataSet({ | 587 | (await props.onGetDataSet({ |
| 572 | name: tableName, | 588 | name: tableName, |
| @@ -1138,7 +1154,7 @@ const useGetSelectedDataGroup = props => { | @@ -1138,7 +1154,7 @@ const useGetSelectedDataGroup = props => { | ||
| 1138 | [`${tableName}SelectedRowKeys`]: selectedRowKeys = [] | 1154 | [`${tableName}SelectedRowKeys`]: selectedRowKeys = [] |
| 1139 | } = props; | 1155 | } = props; |
| 1140 | 1156 | ||
| 1141 | - if (selectedRowKeys.length) { | 1157 | + if (tableName !== 'master' && selectedRowKeys.length) { |
| 1142 | const rowData = tableData.find( | 1158 | const rowData = tableData.find( |
| 1143 | item => | 1159 | item => |
| 1144 | selectedRowKeys.includes(item.sId) || | 1160 | selectedRowKeys.includes(item.sId) || |
| @@ -1185,7 +1201,7 @@ const CommonModel = baseProps => { | @@ -1185,7 +1201,7 @@ const CommonModel = baseProps => { | ||
| 1185 | }; | 1201 | }; |
| 1186 | 1202 | ||
| 1187 | const CommonModelComponent = props => { | 1203 | const CommonModelComponent = props => { |
| 1188 | - const { tabConfig = [], level, modelStyle, app } = props; | 1204 | + const { tabConfig = [], level, modelStyle, app, bMesBill, enabled } = props; |
| 1189 | const { userinfo } = app; | 1205 | const { userinfo } = app; |
| 1190 | const sLanguage = userinfo.sLanguage; | 1206 | const sLanguage = userinfo.sLanguage; |
| 1191 | const getComponent = (config, index = 0) => { | 1207 | const getComponent = (config, index = 0) => { |
| @@ -1220,7 +1236,7 @@ const CommonModelComponent = props => { | @@ -1220,7 +1236,7 @@ const CommonModelComponent = props => { | ||
| 1220 | const componentProps = { | 1236 | const componentProps = { |
| 1221 | ...props, | 1237 | ...props, |
| 1222 | showType, // 展示类型(表单/表格) | 1238 | showType, // 展示类型(表单/表格) |
| 1223 | - enabled: defaultEnabled, // 是否可编辑 | 1239 | + enabled: !bMesBill ? defaultEnabled: enabled, // 是否可编辑 |
| 1224 | sTabName, // 标题名称 | 1240 | sTabName, // 标题名称 |
| 1225 | sName, // 配置对应的sGrd | 1241 | sName, // 配置对应的sGrd |
| 1226 | bHideTitle, //隐藏标题 | 1242 | bHideTitle, //隐藏标题 |
| @@ -1242,9 +1258,16 @@ const CommonModelComponent = props => { | @@ -1242,9 +1258,16 @@ const CommonModelComponent = props => { | ||
| 1242 | } | 1258 | } |
| 1243 | }; | 1259 | }; |
| 1244 | 1260 | ||
| 1261 | + const extraStyle = {}; | ||
| 1262 | + if (bMesBill) { | ||
| 1263 | + extraStyle.display = 'flex'; | ||
| 1264 | + extraStyle.flexDirection = 'column'; | ||
| 1265 | + extraStyle.paddingTop = 5; | ||
| 1266 | + } | ||
| 1267 | + | ||
| 1245 | return ( | 1268 | return ( |
| 1246 | <> | 1269 | <> |
| 1247 | - <div className={styles.commonModel} style={modelStyle}> | 1270 | + <div className={styles.commonModel} style={{ ...modelStyle, ...extraStyle }}> |
| 1248 | {tabConfig.map(item => { | 1271 | {tabConfig.map(item => { |
| 1249 | const { | 1272 | const { |
| 1250 | configList = [], | 1273 | configList = [], |
| @@ -1427,7 +1450,7 @@ const TabTitleComponent = props => { | @@ -1427,7 +1450,7 @@ const TabTitleComponent = props => { | ||
| 1427 | 1450 | ||
| 1428 | // 表单组件 | 1451 | // 表单组件 |
| 1429 | const CommonViewTableComponent = props => { | 1452 | const CommonViewTableComponent = props => { |
| 1430 | - const { sTabName, showType, sName } = props; | 1453 | + const { sTabName = "", showType, sName } = props; |
| 1431 | if (showType !== "form") return ""; | 1454 | if (showType !== "form") return ""; |
| 1432 | 1455 | ||
| 1433 | const { | 1456 | const { |
src/mes/common/commonOperationBarComponent/MesToolbar.js
0 → 100644
| 1 | +import { message } from "antd"; | ||
| 2 | +import * as commonUtils from "@/utils/utils"; | ||
| 3 | + | ||
| 4 | +const ToolbarFun = (props) => { | ||
| 5 | + const { btnConfig, bMesBill } = props; | ||
| 6 | + const currentMesPane = commonUtils.getAppData("currentMesPane"); | ||
| 7 | + const { sModelType } = currentMesPane; | ||
| 8 | + if (!["/indexPage/commonList", "/indexPage/commonBill"].includes(sModelType) && !bMesBill) { | ||
| 9 | + return false; | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + const { sControlName } = btnConfig; | ||
| 13 | + const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); | ||
| 14 | + if (btnName === 'btnadd') { | ||
| 15 | + handleAdd(props); | ||
| 16 | + } else if (btnName === 'btnsave') { | ||
| 17 | + handleSave(props); | ||
| 18 | + } else if (btnName === 'btnupd') { | ||
| 19 | + props.onSaveState({ enabled: true }); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + return true; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +// 新增 | ||
| 27 | +const handleAdd = (props) => { | ||
| 28 | + const { slaveConfig } = props; | ||
| 29 | + const picArrConfig = slaveConfig.gdsconfigformslave.find(item => item.sName === 'picArr'); | ||
| 30 | + if (!picArrConfig) { | ||
| 31 | + message.error('请先配置picArr字段'); | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + const { sActiveId } = picArrConfig; | ||
| 36 | + if (!sActiveId) { | ||
| 37 | + message.error('请先配置弹窗界面'); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + const { app } = props; | ||
| 41 | + const { managementData } = app; | ||
| 42 | + const menuList = managementData.reduce((result, item) => { | ||
| 43 | + result = [...result, ...item.children]; | ||
| 44 | + return result; | ||
| 45 | + }, []); | ||
| 46 | + | ||
| 47 | + const menu = menuList.find(item => item.sId === sActiveId); | ||
| 48 | + if (!menu) { | ||
| 49 | + message.error('弹窗界面不在MES菜单中'); | ||
| 50 | + return; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + app.globalFun.onChangeRouter({ | ||
| 54 | + type: "id", | ||
| 55 | + path: [menu.sParentId, menu.sId], | ||
| 56 | + sModelType: menu.sName, | ||
| 57 | + // sParentConditions, | ||
| 58 | + copyTo: { | ||
| 59 | + master: { maxBillNo: 'sBillNo' } | ||
| 60 | + } | ||
| 61 | + }); | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +const handleSave = (props) => { | ||
| 65 | + props.onExecInstructSet({ | ||
| 66 | + btnConfig: { | ||
| 67 | + showName: "保存", | ||
| 68 | + sInstruct: JSON.stringify([ | ||
| 69 | + { | ||
| 70 | + opr: "save", | ||
| 71 | + }, | ||
| 72 | + { | ||
| 73 | + opr: "refresh", | ||
| 74 | + }, | ||
| 75 | + ]) | ||
| 76 | + }, | ||
| 77 | + inscallback: () => { | ||
| 78 | + props.onSaveState({ | ||
| 79 | + currentId: props.masterData.sId, enabled: false | ||
| 80 | + }); | ||
| 81 | + } | ||
| 82 | + }); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +export default ToolbarFun; | ||
| 0 | \ No newline at end of file | 86 | \ No newline at end of file |
src/mes/common/commonOperationBarComponent/index.js
| @@ -8,6 +8,7 @@ import * as commonBusiness from "@/components/Common/commonBusiness"; | @@ -8,6 +8,7 @@ import * as commonBusiness from "@/components/Common/commonBusiness"; | ||
| 8 | import StaticEditTable from "@/components/Common/CommonTable"; | 8 | import StaticEditTable from "@/components/Common/CommonTable"; |
| 9 | import costomPageFun from "@/mes/costomPageFun"; | 9 | import costomPageFun from "@/mes/costomPageFun"; |
| 10 | import * as commonConfig from "@/utils/config"; | 10 | import * as commonConfig from "@/utils/config"; |
| 11 | +import MesToolbar from "./MesToolbar"; | ||
| 11 | 12 | ||
| 12 | import styles from "./index.less"; | 13 | import styles from "./index.less"; |
| 13 | import { Button, Space, Input, Modal, Dropdown, Popconfirm } from "antd"; | 14 | import { Button, Space, Input, Modal, Dropdown, Popconfirm } from "antd"; |
| @@ -92,6 +93,11 @@ const useCommonOperationBarComponentEvent = props => { | @@ -92,6 +93,11 @@ const useCommonOperationBarComponentEvent = props => { | ||
| 92 | const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); | 93 | const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); |
| 93 | const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); | 94 | const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); |
| 94 | 95 | ||
| 96 | + // 走工具栏功能逻辑 | ||
| 97 | + if (MesToolbar({ ...props, btnConfig: config })) { | ||
| 98 | + return; | ||
| 99 | + } | ||
| 100 | + | ||
| 95 | // 自定义按钮事件 | 101 | // 自定义按钮事件 |
| 96 | if ( | 102 | if ( |
| 97 | costomPageFun({ | 103 | costomPageFun({ |
| @@ -472,7 +478,7 @@ const useCommonOperationBarComponentEvent = props => { | @@ -472,7 +478,7 @@ const useCommonOperationBarComponentEvent = props => { | ||
| 472 | onClick: handleBtnClick.bind(this, config, searchField) | 478 | onClick: handleBtnClick.bind(this, config, searchField) |
| 473 | }; | 479 | }; |
| 474 | 480 | ||
| 475 | - const { sDefault } = config; | 481 | + const { sDefault, sControlName } = config; |
| 476 | 482 | ||
| 477 | const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); | 483 | const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); |
| 478 | const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); | 484 | const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); |
| @@ -589,6 +595,17 @@ const useCommonOperationBarComponentEvent = props => { | @@ -589,6 +595,17 @@ const useCommonOperationBarComponentEvent = props => { | ||
| 589 | } catch (error) { | 595 | } catch (error) { |
| 590 | console.log("=====err", { tempData, str: sDefault, strNew, error }); | 596 | console.log("=====err", { tempData, str: sDefault, strNew, error }); |
| 591 | } | 597 | } |
| 598 | + } else if (props.bMesBill) { | ||
| 599 | + const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); | ||
| 600 | + if (props.enabled) { | ||
| 601 | + if (["btnupd"].includes(btnName)) { | ||
| 602 | + defaultProps.disabled = true; | ||
| 603 | + } | ||
| 604 | + } else { | ||
| 605 | + if (["btnsave"].includes(btnName)) { | ||
| 606 | + defaultProps.disabled = true; | ||
| 607 | + } | ||
| 608 | + } | ||
| 592 | } | 609 | } |
| 593 | 610 | ||
| 594 | const { sColor } = config; | 611 | const { sColor } = config; |
src/mes/indexMes/index.js
| @@ -242,6 +242,7 @@ const useIndexMesEvent = props => { | @@ -242,6 +242,7 @@ const useIndexMesEvent = props => { | ||
| 242 | sModelType, | 242 | sModelType, |
| 243 | type, | 243 | type, |
| 244 | path = [], | 244 | path = [], |
| 245 | + copyTo, | ||
| 245 | sParentConditions = {} // 上层页面带过来的查询条件 | 246 | sParentConditions = {} // 上层页面带过来的查询条件 |
| 246 | } = params; | 247 | } = params; |
| 247 | const { managementData = [] } = props.app; | 248 | const { managementData = [] } = props.app; |
| @@ -261,7 +262,8 @@ const useIndexMesEvent = props => { | @@ -261,7 +262,8 @@ const useIndexMesEvent = props => { | ||
| 261 | routerPath: [menuMapOpposite[currentContent]], | 262 | routerPath: [menuMapOpposite[currentContent]], |
| 262 | sModelsId, | 263 | sModelsId, |
| 263 | sModelType, | 264 | sModelType, |
| 264 | - sParentConditions | 265 | + sParentConditions, |
| 266 | + copyTo | ||
| 265 | }); | 267 | }); |
| 266 | } else if (type === "id") { | 268 | } else if (type === "id") { |
| 267 | // 未上班不能进维修保养 | 269 | // 未上班不能进维修保养 |
| @@ -282,7 +284,8 @@ const useIndexMesEvent = props => { | @@ -282,7 +284,8 @@ const useIndexMesEvent = props => { | ||
| 282 | routerPath: [menuMapOpposite[lv1]], | 284 | routerPath: [menuMapOpposite[lv1]], |
| 283 | sModelsId: lv2, | 285 | sModelsId: lv2, |
| 284 | sModelType, | 286 | sModelType, |
| 285 | - sParentConditions | 287 | + sParentConditions, |
| 288 | + copyTo | ||
| 286 | } | 289 | } |
| 287 | ]); | 290 | ]); |
| 288 | } else { | 291 | } else { |
| @@ -293,7 +296,8 @@ const useIndexMesEvent = props => { | @@ -293,7 +296,8 @@ const useIndexMesEvent = props => { | ||
| 293 | routerPath, | 296 | routerPath, |
| 294 | sModelsId, | 297 | sModelsId, |
| 295 | sModelType, | 298 | sModelType, |
| 296 | - sParentConditions | 299 | + sParentConditions, |
| 300 | + copyTo | ||
| 297 | } | 301 | } |
| 298 | ]); | 302 | ]); |
| 299 | } | 303 | } |
| @@ -323,12 +327,12 @@ const useIndexMesEvent = props => { | @@ -323,12 +327,12 @@ const useIndexMesEvent = props => { | ||
| 323 | }, []); | 327 | }, []); |
| 324 | 328 | ||
| 325 | // 监听菜单变化 | 329 | // 监听菜单变化 |
| 326 | - const { currentContent, sModelsId, sModelType, sParentConditions } = state; | 330 | + const { currentContent, sModelsId, sModelType, sParentConditions, copyTo } = state; |
| 327 | useEffect( | 331 | useEffect( |
| 328 | () => { | 332 | () => { |
| 329 | props.dispatch({ | 333 | props.dispatch({ |
| 330 | type: "app/saveCurrentMesPane", | 334 | type: "app/saveCurrentMesPane", |
| 331 | - payload: { currentContent, sModelsId, sModelType, sParentConditions } | 335 | + payload: { currentContent, sModelsId, sModelType, sParentConditions, copyTo } |
| 332 | }); | 336 | }); |
| 333 | }, | 337 | }, |
| 334 | [currentContent, sModelsId, sModelType] | 338 | [currentContent, sModelsId, sModelType] |
src/mes/scheduledTasks/machineTasks/index.js
| @@ -343,7 +343,12 @@ const useInfoEvent = props => { | @@ -343,7 +343,12 @@ const useInfoEvent = props => { | ||
| 343 | // 开工、暂停事件 | 343 | // 开工、暂停事件 |
| 344 | const handleTableBtnClick = async item => { | 344 | const handleTableBtnClick = async item => { |
| 345 | const { tableName, index, record, tableData, config, iFlag } = item; | 345 | const { tableName, index, record, tableData, config, iFlag } = item; |
| 346 | - const { showName } = config; | 346 | + const { showName, sControlName } = config; |
| 347 | + | ||
| 348 | + if (sControlName === 'BtnProductionReporting') { | ||
| 349 | + props.onTableBtnClick(item); | ||
| 350 | + return; | ||
| 351 | + } | ||
| 347 | if (showName === "完工") { | 352 | if (showName === "完工") { |
| 348 | Modal.confirm({ | 353 | Modal.confirm({ |
| 349 | title: "温馨提示:", | 354 | title: "温馨提示:", |
| @@ -356,7 +361,6 @@ const useInfoEvent = props => { | @@ -356,7 +361,6 @@ const useInfoEvent = props => { | ||
| 356 | }); | 361 | }); |
| 357 | return; | 362 | return; |
| 358 | } | 363 | } |
| 359 | - // const iStar = index === 0 ? 1 : 2; | ||
| 360 | const { iStar } = record; | 364 | const { iStar } = record; |
| 361 | 365 | ||
| 362 | if (iStar === 1) { | 366 | if (iStar === 1) { |
| @@ -511,9 +515,13 @@ const MachineTasks = baseProps => { | @@ -511,9 +515,13 @@ const MachineTasks = baseProps => { | ||
| 511 | 515 | ||
| 512 | // 表格业务 | 516 | // 表格业务 |
| 513 | const [sSrcNo, setSSrcNo] = useState(""); | 517 | const [sSrcNo, setSSrcNo] = useState(""); |
| 518 | + const tableBtnsConfig = slave0Config?.gdsconfigformslave?.filter( | ||
| 519 | + item => item.sControlName === "BtnProductionReporting" | ||
| 520 | + ) || []; | ||
| 514 | // 顶部表格配置 | 521 | // 顶部表格配置 |
| 515 | const tableProps = { | 522 | const tableProps = { |
| 516 | ...commonBusiness.getTableTypes("slave0", props), | 523 | ...commonBusiness.getTableTypes("slave0", props), |
| 524 | + data: [{ sId: "123" }], | ||
| 517 | tableProps: { | 525 | tableProps: { |
| 518 | onChange: () => {}, | 526 | onChange: () => {}, |
| 519 | loading: isTableLoading | 527 | loading: isTableLoading |
| @@ -521,15 +529,6 @@ const MachineTasks = baseProps => { | @@ -521,15 +529,6 @@ const MachineTasks = baseProps => { | ||
| 521 | tableBtnsConfig: params => { | 529 | tableBtnsConfig: params => { |
| 522 | const { record, index } = params; | 530 | const { record, index } = params; |
| 523 | const { iStar } = record; | 531 | const { iStar } = record; |
| 524 | - // const iStar = index === 0 ? 1 : 2; | ||
| 525 | - | ||
| 526 | - // const bStart = iStar === 1; | ||
| 527 | - // const bPause = iStar === 2; | ||
| 528 | - | ||
| 529 | - // 1 :开工状态(显示暂停) 2: 暂停状态(显示开工) 3: 完工状态(显示完工,灰色) | ||
| 530 | - // 开工:开工接口(现在)1:正常, -7:有开工,要有提示, -1: 错误提示 | ||
| 531 | - // -7 :完工: iFlag:3 (完工上一条) 暂停:iFlag:2 (暂停上一条) | ||
| 532 | - // 暂停:新接口 | ||
| 533 | 532 | ||
| 534 | let showName, btnBgColor, sDefault; | 533 | let showName, btnBgColor, sDefault; |
| 535 | if (iStar === 1) { | 534 | if (iStar === 1) { |
| @@ -550,44 +549,14 @@ const MachineTasks = baseProps => { | @@ -550,44 +549,14 @@ const MachineTasks = baseProps => { | ||
| 550 | 549 | ||
| 551 | return [ | 550 | return [ |
| 552 | { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, | 551 | { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig }, |
| 553 | - { showName: "完工", btnBgColor: "#1890FF", sDefault } | 552 | + { showName: "完工", btnBgColor: "#1890FF", sDefault }, |
| 553 | + ...tableBtnsConfig | ||
| 554 | ]; | 554 | ]; |
| 555 | - | ||
| 556 | - // return [ | ||
| 557 | - // { | ||
| 558 | - // ...startWorkConfig, | ||
| 559 | - // showName: "开工", | ||
| 560 | - // btnBgColor: bStart ? "#1890FF" : "#AAA" | ||
| 561 | - // }, | ||
| 562 | - // { | ||
| 563 | - // ...pauseWorkConfig, | ||
| 564 | - // showName: "暂停", | ||
| 565 | - // btnBgColor: bPause ? "#FAAD14" : "#AAA" | ||
| 566 | - // } | ||
| 567 | - // ]; | ||
| 568 | }, | 555 | }, |
| 569 | onTableBtnClick: item => { | 556 | onTableBtnClick: item => { |
| 570 | props.onTableBtnClick(item); | 557 | props.onTableBtnClick(item); |
| 571 | - return; | ||
| 572 | - // 通用按钮操作 | ||
| 573 | - // props.onTableBtnClick(item); | ||
| 574 | - const { tableName, index, record, tableData, config } = item; | ||
| 575 | - const { iStar } = record; | ||
| 576 | - const { showName } = config; | ||
| 577 | - if (iStar === 1 && showName === "开工") { | ||
| 578 | - setTableLoading(true); | ||
| 579 | - props.onStartWork(item).finally(() => { | ||
| 580 | - setTableLoading(false); | ||
| 581 | - }); | ||
| 582 | - } else if (iStar === 2 && showName === "暂停") { | ||
| 583 | - setTableLoading(true); | ||
| 584 | - handlePause({ item, props }).finally(() => { | ||
| 585 | - setTableLoading(false); | ||
| 586 | - props.onRefresh(); | ||
| 587 | - }); | ||
| 588 | - } | ||
| 589 | }, | 558 | }, |
| 590 | - tableBtnsWidth: "190px", | 559 | + tableBtnsWidth: "280px", |
| 591 | fixedHeight: "335px" | 560 | fixedHeight: "335px" |
| 592 | }; | 561 | }; |
| 593 | // 全部按钮事件 | 562 | // 全部按钮事件 |