Commit a41bfe087d16f8f47f0188d5b0708053556c9d0f

Authored by Min
1 parent d1fbb993

1.完善MES多语言翻译

src/mes/common/commonModelComponent/index.js
... ... @@ -678,6 +678,7 @@ const useCommonModelEvent = props => {
678 678 const { refreshTableListCount = 0 } = props;
679 679 let addState = {
680 680 refreshTableList: [],
  681 + refreshTableListCount: refreshTableListCount + 1,
681 682 ...(await handleGetData(refreshTableList, true))
682 683 };
683 684  
... ... @@ -1105,7 +1106,7 @@ const useComputedCommonDivHeight = props => {
1105 1106 ) {
1106 1107 returnHeight = `calc(${returnHeight} - 40px)`;
1107 1108 }
1108   -
  1109 +
1109 1110 // 下料界面板材信息
1110 1111 if(sTabName=='版材信息'){
1111 1112 returnHeight = `calc(100% - 10px)`;
... ... @@ -1608,7 +1609,7 @@ const CommonViewTableComponent = props => {
1608 1609  
1609 1610 if(viewProps.tableS0Data && viewProps.tableS0Data.length!==0){
1610 1611 viewProps.reportPeopleSelectedRowKeys = viewProps.tableS0Data[0].sMainAssistantTransId?.split(",")
1611   -
  1612 +
1612 1613 }
1613 1614  
1614 1615 if (commonUtils.isEmptyObject(viewRow)) {
... ... @@ -1626,8 +1627,8 @@ const CommonViewTableComponent = props => {
1626 1627 reportRef={reportRef.current || {}}
1627 1628 hasShowInfo={viewProps.viewRow}
1628 1629 />
1629   -
1630   -
  1630 +
  1631 +
1631 1632 </>
1632 1633 );
1633 1634 })}
... ...
src/mes/common/commonOperationBarComponent/index.js
... ... @@ -78,6 +78,25 @@ const useCommonOperationBarComponentEvent = props =&gt; {
78 78 // 按钮点击事件
79 79 const clickRef = useRef(null);
80 80 const handleBtnClick = async (config, searchField) => {
  81 + if (config?.sMinValue === "99") { // 二次确认
  82 + const result = await new Promise(resolve => {
  83 + Modal.confirm({
  84 + title: "温馨提示:",
  85 + content: "是否确认此操作?",
  86 + okText: "确认",
  87 + cancelText: "取消",
  88 + onOk() {
  89 + setTimeout(() => {
  90 + resolve(true);
  91 + }, 500);
  92 + },
  93 + onCancel() {
  94 + resolve(false);
  95 + }
  96 + });
  97 + });
  98 + if (!result) return;
  99 + }
81 100 // 限制半秒内只能点一次
82 101 if (clickRef.current) return;
83 102 clickRef.current = true;
... ...
src/mes/scheduledTasks/machineTasks/index.js
... ... @@ -4,1115 +4,1165 @@
4 4 * @Date: 2024-02-28 9:55:04
5 5 * @Description: 计划任务 ---- 机台任务
6 6 */
7   -import React, { useEffect, useRef, useState } from "react";
8   -import moment from "moment";
9   -import {
10   - Carousel,
11   - Col,
12   - Row,
13   - Button,
14   - Input,
15   - Modal,
16   - Space,
17   - Dropdown,
18   - message,
19   - Tooltip
20   -} from "antd";
21   -import { SettingTwoTone } from "@ant-design/icons";
22   -import * as commonFunc from "@/components/Common/commonFunc";
23   -import * as commonUtils from "@/utils/utils";
24   -import * as commonConfig from "@/utils/config";
25   -import * as commonBusiness from "@/components/Common/commonBusiness";
26   -import * as commonServices from "@/services/services";
27   -import useCommonBase from "@/components/Common/CommonHooks/useCommonBase";
28   -import StaticEditTable from "@/components/Common/CommonTable";
29   -import styles from "./index.less";
30   -import taskInfoIcon from "../assets/taskInfo2.png";
31   -import statusIcon from "../assets/status.png";
32   -import taskIcon from "../assets/task.png";
33   -import timeIcon from "../assets/time.png";
34   -import { handleOeeBtnEent } from "./common/handlePause";
35   -import { operationFetch } from "../../productionExec/productionExecMain/operationFetch";
36   -
37   -// 业务层
38   -const useInfoEvent = props => {
39   - const { formData } = props;
40   - const [refreshCount, setRefreshCount] = useState(0);
41   -
42   - useEffect(
43   - async () => {
44   - if (commonUtils.isNotEmptyArr(formData)) {
45   - const colunmData = handleGetColumnData(formData, true);
46   - const result = await handleGetData(formData, true);
47   - const addState = {
48   - ...colunmData,
49   - ...result
50   - };
51   - props.onSaveState(addState);
52   - }
53   - },
54   - [formData, refreshCount]
55   - );
56   -
57   - // 获取表头数据
58   - const handleGetColumnData = (formData = [], isWait) => {
59   - let addState = {};
60   - for (let i = 0; i < formData.length; i++) {
61   - const config = formData[i];
62   - const column = commonFunc.getHeaderConfig(config);
63   - addState = {
64   - ...addState,
65   - [`slave${i}Column`]: column,
66   - [`slave${i}Config`]: config
  7 + import React, { useEffect, useRef, useState } from "react";
  8 + import moment from "moment";
  9 + import {
  10 + Carousel,
  11 + Col,
  12 + Row,
  13 + Button,
  14 + Input,
  15 + Modal,
  16 + Space,
  17 + Dropdown,
  18 + message,
  19 + Tooltip
  20 + } from "antd";
  21 + import { SettingTwoTone } from "@ant-design/icons";
  22 + import * as commonFunc from "@/components/Common/commonFunc";
  23 + import * as commonUtils from "@/utils/utils";
  24 + import * as commonConfig from "@/utils/config";
  25 + import * as commonBusiness from "@/components/Common/commonBusiness";
  26 + import * as commonServices from "@/services/services";
  27 + import useCommonBase from "@/components/Common/CommonHooks/useCommonBase";
  28 + import StaticEditTable from "@/components/Common/CommonTable";
  29 + import CommonViewTable from "@/components/Common/CommonViewTable";
  30 + import styles from "./index.less";
  31 + import taskInfoIcon from "../assets/taskInfo2.png";
  32 + import statusIcon from "../assets/status.png";
  33 + import taskIcon from "../assets/task.png";
  34 + import timeIcon from "../assets/time.png";
  35 + import { handleOeeBtnEent } from "./common/handlePause";
  36 + import { operationFetch } from "../../productionExec/productionExecMain/operationFetch";
  37 +
  38 + // 业务层
  39 + const useInfoEvent = props => {
  40 + const { formData } = props;
  41 + const [refreshCount, setRefreshCount] = useState(0);
  42 +
  43 + useEffect(
  44 + async () => {
  45 + if (commonUtils.isNotEmptyArr(formData)) {
  46 + const colunmData = handleGetColumnData(formData, true);
  47 + const result = await handleGetData(formData, true);
  48 + const addState = {
  49 + ...colunmData,
  50 + ...result
  51 + };
  52 + props.onSaveState(addState);
  53 + }
  54 + },
  55 + [formData, refreshCount]
  56 + );
  57 +
  58 + // 获取表头数据
  59 + const handleGetColumnData = (formData = [], isWait) => {
  60 + let addState = {};
  61 + for (let i = 0; i < formData.length; i++) {
  62 + const config = formData[i];
  63 + const column = commonFunc.getHeaderConfig(config);
  64 + addState = {
  65 + ...addState,
  66 + [`slave${i}Column`]: column,
  67 + [`slave${i}Config`]: config
  68 + };
  69 + }
  70 + if (isWait) {
  71 + return addState;
  72 + } else {
  73 + props.onSaveState(addState);
  74 + }
67 75 };
68   - }
69   - if (isWait) {
70   - return addState;
71   - } else {
72   - props.onSaveState(addState);
73   - }
74   - };
75   -
76   - // 获取数据集
77   - const handleGetData = async (formData = [], isWait, filter) => {
78   - let addState = {};
79   - for (let i = 0; i < formData.length; i++) {
80   - const config = formData[i];
81   - if (!config) continue;
82   -
83   - const conditonValues = props.onGetSqlConditionValues(config);
84   -
85   - if (config.sSqlStr === "Sp_OEE_ProductionReport") {
86   - conditonValues.sMachineId_s_pro = props.app.sMachineNameSId;
87   - }
88 76  
89   - // 前期生产或反馈问题表必须有非空过滤条件
90   - if (
91   - (i === 1 && Object.values(conditonValues).includes("")) ||
92   - Object.values(conditonValues).includes(undefined)
93   - ) {
94   - continue;
95   - }
  77 + // 获取数据集
  78 + const handleGetData = async (formData = [], isWait, filter) => {
  79 + let addState = {};
  80 + for (let i = 0; i < formData.length; i++) {
  81 + const config = formData[i];
  82 + if (!config) continue;
96 83  
97   - const bFilter = [];
98   - if (filter) {
99   - Object.keys(filter).forEach(key => {
100   - bFilter.push({
101   - bFilterName: key,
102   - bFilterCondition: "like",
103   - bFilterValue: filter[key]
104   - });
105   - });
106   - }
  84 + const conditonValues = props.onGetSqlConditionValues(config);
107 85  
108   - const result =
109   - (await props.onGetDataSet({
110   - name: `slave${i}`,
111   - configData: config,
112   - condition: {
113   - bFilter,
114   - sSqlCondition: { ...conditonValues }
115   - },
116   - isWait: true
117   - })) || {};
118   - props.setTempRef(result);
119   - addState = { ...addState, ...result };
120   - }
121   - props.setTempRef({}, true);
122   - if (isWait) {
123   - return addState;
124   - } else {
125   - props.onSaveState(addState);
126   - }
127   - };
128   -
129   - // 查询
130   - const handleSearch = sWorkOrderNo => {
131   - handleGetData([formData[0]], false, {
132   - sWorkOrderNo
133   - });
134   - };
135   -
136   - // 开工事件
137   - const handleStartWork = async params => {
138   - const { sModelsId, token, app } = props;
139   - const { name, record, config, tableData, iFlag, pauseValue } = params;
140   - const { sMachineId, sId, sSlaveId } = record;
141   -
142   - // /* 若设置了禁止跳单 选择数据不是第一条时进行提示 */
143   - // const iIndex = app.systemData.findIndex(item => item.sName === "CkxNoSkip");
144   - // if (iIndex > -1) {
145   - // const sValue = app.systemData[iIndex].sValue;
146   - // if (sValue === "1") {
147   - // /* 如果设置了进制跳单 */
148   - // const indexFirst = tableData.findIndex(
149   - // item => sId === item.sId || sSlaveId === item.sSlaveId
150   - // );
151   - // if (indexFirst > 0) {
152   - // message.warn("禁止跳单!");
153   - // return;
154   - // }
155   - // }
156   - // }
157   - // // 验证是否单据是否被使用
158   - // const dataUrl = `${
159   - // commonConfig.server_host
160   - // }bill/billCopyToCheckWork?sModelsId=${sModelsId}`;
161   - // const values = { sMachineId };
162   - // const dataReturn = (await commonServices.postValueService(
163   - // token,
164   - // values,
165   - // dataUrl
166   - // )).data;
167   - // if (dataReturn.code !== 1) {
168   - // props.getServiceError(dataReturn);
169   - // return;
170   - // }
171   -
172   - // 单据可以使用
173   - const { startWorkConfig = {} } = config;
174   - const { sAssignField } = startWorkConfig;
175   - const allTableData = {
176   - [name]: record
177   - };
178   - let rowData = commonFunc.getDefaultData(config, allTableData); // 取默认值
179   - rowData = {
180   - ...rowData,
181   - ...commonFunc.getAssignFieldValue(sAssignField, record, allTableData),
182   - handleType: "add",
183   - sId: commonUtils.createSid(),
184   - sTeamId: app.sTeamNameSId,
185   - sMachineId: app.sMachineNameSId,
186   - sParentId: record.sId,
187   - tCreateDate: new Date()
188   - };
  86 + if (config.sSqlStr === "Sp_OEE_ProductionReport") {
  87 + conditonValues.sMachineId_s_pro = props.app.sMachineNameSId;
  88 + }
189 89  
190   - const valuesNew = {};
191   - valuesNew.data = [];
192   - valuesNew.data.push(
193   - commonBusiness.mergeData(name, "plc_machinedata", [rowData], [])
194   - );
195   -
196   - if ((iFlag || Object.is(iFlag, 0)) && valuesNew.data[0]) {
197   - valuesNew.data[0].iFlag = iFlag;
198   - }
199   -
200   - if (pauseValue) {
201   - valuesNew.data[0].sWorkOrderChangeMemo = pauseValue;
202   - }
203   -
204   - const BtnSave = commonFunc.showMessage(
205   - app.commonConst,
206   - "BtnSave"
207   - ); /* 保存 */
208   - params.optName = BtnSave;
209   - params.sClientType = "1";
210   - const returnData = await commonBusiness.saveData({
211   - token,
212   - value: valuesNew,
213   - sModelsId,
214   - bMachineTask: true
215   - });
216   -
217   - return returnData;
218   - // if (commonUtils.isEmptyObject(returnData)) return;
219   -
220   - // props.onSaveState(
221   - // {
222   - // [`${name}SelectedRowKeys`]: [record.sId]
223   - // },
224   - // () => {
225   - // props.dispatch({
226   - // type: "app/saveGlobalData",
227   - // payload: {
228   - // currentStartWorkMachineTaskDataRow: rowData
229   - // }
230   - // });
231   - // handleRefresh();
232   - // setTimeout(() => {
233   - // props.onChangeRouter({
234   - // type: "name",
235   - // path: ["生产执行", "生产执行"]
236   - // });
237   - // }, 500);
238   - // }
239   - // );
240   - // this.props.onSaveCurrentState(slaveData, true, undefined, undefined, 1);
241   - };
242   -
243   - // 更新工单状态
244   - const handleUpdateStatus = async params => {
245   - const { doWorkState, record } = params;
246   -
247   - const { sModelsId, app } = props;
248   -
249   - const value = {
250   - plcMachinedata: record
251   - };
  90 + // 前期生产或反馈问题表必须有非空过滤条件
  91 + if (
  92 + (i === 1 && Object.values(conditonValues).includes("")) ||
  93 + Object.values(conditonValues).includes(undefined)
  94 + ) {
  95 + continue;
  96 + }
252 97  
253   - const url = `${
254   - commonConfig.server_host
255   - }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${
256   - record.sMachineId
257   - }`;
258   - const returnData = (await commonServices.postValueService(
259   - app.token,
260   - value,
261   - url
262   - )).data;
263   -
264   - if (returnData.code !== 1) {
265   - props.getServiceError(returnData);
266   - return false;
267   - }
268   -
269   - return true;
270   - };
271   -
272   - // 监听机台任务选中行变化
273   - const { slave0SelectedRowKeys = [], slave0Data = [], sModelsId } = props;
274   - useEffect(
275   - () => {
276   - if (!slave0Data.length) return;
277   -
278   - const globalData = commonUtils.convertStrToObj(
279   - localStorage.xlybusinessglobalData
280   - );
281   - const { currentSelectedMachineTaskDataRow = {} } = globalData;
282   -
283   - // 当前选中行sId,默认取缓存数据
284   - let currentSelectedRowKey = slave0SelectedRowKeys[0];
285   - if (
286   - !currentSelectedRowKey &&
287   - sModelsId === currentSelectedMachineTaskDataRow?.sModelsId
288   - ) {
289   - currentSelectedRowKey = currentSelectedMachineTaskDataRow.sId;
290   - }
291   - if (!currentSelectedRowKey) {
292   - currentSelectedRowKey = slave0Data[0].sId;
293   - }
  98 + const bFilter = [];
  99 + if (filter) {
  100 + Object.keys(filter).forEach(key => {
  101 + bFilter.push({
  102 + bFilterName: key,
  103 + bFilterCondition: "like",
  104 + bFilterValue: filter[key]
  105 + });
  106 + });
  107 + }
294 108  
295   - // 默认选中第一行
296   - if (!slave0SelectedRowKeys.length) {
297   - props.onSaveState({
298   - slave0SelectedRowKeys: [currentSelectedRowKey]
  109 + const result =
  110 + (await props.onGetDataSet({
  111 + name: `slave${i}`,
  112 + configData: config,
  113 + condition: {
  114 + bFilter,
  115 + sSqlCondition: { ...conditonValues }
  116 + },
  117 + isWait: true
  118 + })) || {};
  119 + props.setTempRef(result);
  120 + addState = { ...addState, ...result };
  121 + }
  122 + props.setTempRef({}, true);
  123 + if (isWait) {
  124 + return addState;
  125 + } else {
  126 + props.onSaveState(addState);
  127 + }
  128 + };
  129 +
  130 + // 查询
  131 + const handleSearch = sWorkOrderNo => {
  132 + handleGetData([formData[0]], false, {
  133 + sWorkOrderNo
299 134 });
300   - }
  135 + };
301 136  
302   - // 将当前选中行保存到全局
303   - props.dispatch({
304   - type: "app/saveGlobalData",
305   - payload: {
306   - currentSelectedMachineTaskDataRow: {
307   - ...(slave0Data.find(item => item.sId === currentSelectedRowKey) ||
308   - {}),
309   - sModelsId
310   - }
  137 + // 开工事件
  138 + const handleStartWork = async params => {
  139 + const { sModelsId, token, app } = props;
  140 + const { name, record, config, tableData, iFlag, pauseValue } = params;
  141 + const { sMachineId, sId, sSlaveId } = record;
  142 +
  143 + // /* 若设置了禁止跳单 选择数据不是第一条时进行提示 */
  144 + // const iIndex = app.systemData.findIndex(item => item.sName === "CkxNoSkip");
  145 + // if (iIndex > -1) {
  146 + // const sValue = app.systemData[iIndex].sValue;
  147 + // if (sValue === "1") {
  148 + // /* 如果设置了进制跳单 */
  149 + // const indexFirst = tableData.findIndex(
  150 + // item => sId === item.sId || sSlaveId === item.sSlaveId
  151 + // );
  152 + // if (indexFirst > 0) {
  153 + // message.warn("禁止跳单!");
  154 + // return;
  155 + // }
  156 + // }
  157 + // }
  158 + // // 验证是否单据是否被使用
  159 + // const dataUrl = `${
  160 + // commonConfig.server_host
  161 + // }bill/billCopyToCheckWork?sModelsId=${sModelsId}`;
  162 + // const values = { sMachineId };
  163 + // const dataReturn = (await commonServices.postValueService(
  164 + // token,
  165 + // values,
  166 + // dataUrl
  167 + // )).data;
  168 + // if (dataReturn.code !== 1) {
  169 + // props.getServiceError(dataReturn);
  170 + // return;
  171 + // }
  172 +
  173 + // 单据可以使用
  174 + const { startWorkConfig = {} } = config;
  175 + const { sAssignField } = startWorkConfig;
  176 + const allTableData = {
  177 + [name]: record
  178 + };
  179 + let rowData = commonFunc.getDefaultData(config, allTableData); // 取默认值
  180 + rowData = {
  181 + ...rowData,
  182 + ...commonFunc.getAssignFieldValue(sAssignField, record, allTableData),
  183 + handleType: "add",
  184 + sId: commonUtils.createSid(),
  185 + sTeamId: app.sTeamNameSId,
  186 + sMachineId: app.sMachineNameSId,
  187 + sParentId: record.sId,
  188 + tCreateDate: new Date()
  189 + };
  190 +
  191 + const valuesNew = {};
  192 + valuesNew.data = [];
  193 + valuesNew.data.push(
  194 + commonBusiness.mergeData(name, "plc_machinedata", [rowData], [])
  195 + );
  196 +
  197 + if ((iFlag || Object.is(iFlag, 0)) && valuesNew.data[0]) {
  198 + valuesNew.data[0].iFlag = iFlag;
311 199 }
312   - });
313 200  
314   - // 前期生产或反馈问题数据根据机台任务选中行变化
315   - handleGetData(["", formData[1]], false);
316   - },
317   - [slave0SelectedRowKeys[0], slave0Data.length]
318   - );
319   -
320   - // 监听开工任务变化
321   - useEffect(
322   - () => {
323   - if (commonUtils.isEmptyObject(props.slave0Data)) return;
324   - const startRowData = props.slave0Data.find(item => item.iStar === 1);
325   - if (!startRowData) return;
326   - props.dispatch({
327   - type: "app/saveGlobalData",
328   - payload: {
329   - currentStartWorkMachineTaskDataRow: startRowData
  201 + if (pauseValue) {
  202 + valuesNew.data[0].sWorkOrderChangeMemo = pauseValue;
330 203 }
331   - });
332   - },
333   - [JSON.stringify(props.slave0Data)]
334   - );
335   -
336   - // 刷新页面
337   - const handleRefresh = () => {
338   - setRefreshCount(refreshCount + 1);
339   - };
340   -
341   - const itemClickRef = useRef();
342   -
343   - // 开工、暂停事件
344   - const handleTableBtnClick = async item => {
345   - const { tableName, index, record, tableData, config, iFlag } = item;
346   - const { showName } = config;
347   - if (showName === "完工") {
348   - Modal.confirm({
349   - title: "温馨提示:",
350   - content: <div>确认完工?</div>,
351   - okText: "确认",
352   - cancelText: "取消",
353   - onOk() {
354   - handleUpdateProductionplan({ item, iFlag: 4 });
  204 +
  205 + const BtnSave = commonFunc.showMessage(
  206 + app.commonConst,
  207 + "BtnSave"
  208 + ); /* 保存 */
  209 + params.optName = BtnSave;
  210 + params.sClientType = "1";
  211 + const returnData = await commonBusiness.saveData({
  212 + token,
  213 + value: valuesNew,
  214 + sModelsId,
  215 + bMachineTask: true
  216 + });
  217 +
  218 + return returnData;
  219 + // if (commonUtils.isEmptyObject(returnData)) return;
  220 +
  221 + // props.onSaveState(
  222 + // {
  223 + // [`${name}SelectedRowKeys`]: [record.sId]
  224 + // },
  225 + // () => {
  226 + // props.dispatch({
  227 + // type: "app/saveGlobalData",
  228 + // payload: {
  229 + // currentStartWorkMachineTaskDataRow: rowData
  230 + // }
  231 + // });
  232 + // handleRefresh();
  233 + // setTimeout(() => {
  234 + // props.onChangeRouter({
  235 + // type: "name",
  236 + // path: ["生产执行", "生产执行"]
  237 + // });
  238 + // }, 500);
  239 + // }
  240 + // );
  241 + // this.props.onSaveCurrentState(slaveData, true, undefined, undefined, 1);
  242 + };
  243 +
  244 + // 更新工单状态
  245 + const handleUpdateStatus = async params => {
  246 + const { doWorkState, record } = params;
  247 +
  248 + const { sModelsId, app } = props;
  249 +
  250 + const value = {
  251 + plcMachinedata: record
  252 + };
  253 +
  254 + const url = `${
  255 + commonConfig.server_host
  256 + }oee/doUpdateStatus/${doWorkState}?sModelsId=${sModelsId}&sMachineId=${
  257 + record.sMachineId
  258 + }`;
  259 + const returnData = (await commonServices.postValueService(
  260 + app.token,
  261 + value,
  262 + url
  263 + )).data;
  264 +
  265 + if (returnData.code !== 1) {
  266 + props.getServiceError(returnData);
  267 + return false;
355 268 }
356   - });
357   - return;
358   - }
359   - // const iStar = index === 0 ? 1 : 2;
360   - const { iStar } = record;
361   -
362   - if (iStar === 1) {
363   - // 如果只剩一条数据,询问是暂停还是完工
364   - if (tableData.length === 1) {
365   - const result = await new Promise(resolve => {
  269 +
  270 + return true;
  271 + };
  272 +
  273 + // 监听机台任务选中行变化
  274 + const { slave0SelectedRowKeys = [], slave0Data = [], sModelsId } = props;
  275 + useEffect(
  276 + () => {
  277 + if (!slave0Data.length) return;
  278 +
  279 + const globalData = commonUtils.convertStrToObj(
  280 + localStorage.xlybusinessglobalData
  281 + );
  282 + const { currentSelectedMachineTaskDataRow = {} } = globalData;
  283 +
  284 + // 当前选中行sId,默认取缓存数据
  285 + let currentSelectedRowKey = slave0SelectedRowKeys[0];
  286 + if (
  287 + !currentSelectedRowKey &&
  288 + sModelsId === currentSelectedMachineTaskDataRow?.sModelsId
  289 + ) {
  290 + currentSelectedRowKey = currentSelectedMachineTaskDataRow.sId;
  291 + }
  292 + if (!currentSelectedRowKey) {
  293 + currentSelectedRowKey = slave0Data[0].sId;
  294 + }
  295 +
  296 + // 默认选中第一行
  297 + if (!slave0SelectedRowKeys.length) {
  298 + props.onSaveState({
  299 + slave0SelectedRowKeys: [currentSelectedRowKey]
  300 + });
  301 + }
  302 +
  303 + // 将当前选中行保存到全局
  304 + props.dispatch({
  305 + type: "app/saveGlobalData",
  306 + payload: {
  307 + currentSelectedMachineTaskDataRow: {
  308 + ...(slave0Data.find(item => item.sId === currentSelectedRowKey) ||
  309 + {}),
  310 + sModelsId
  311 + }
  312 + }
  313 + });
  314 +
  315 + // 前期生产或反馈问题数据根据机台任务选中行变化
  316 + handleGetData(["", formData[1]], false);
  317 + },
  318 + [slave0SelectedRowKeys[0], slave0Data.length]
  319 + );
  320 +
  321 + // 监听开工任务变化
  322 + useEffect(
  323 + () => {
  324 + if (commonUtils.isEmptyObject(props.slave0Data)) return;
  325 + const startRowData = props.slave0Data.find(item => item.iStar === 1);
  326 + if (!startRowData) return;
  327 + props.dispatch({
  328 + type: "app/saveGlobalData",
  329 + payload: {
  330 + currentStartWorkMachineTaskDataRow: startRowData
  331 + }
  332 + });
  333 + },
  334 + [JSON.stringify(props.slave0Data)]
  335 + );
  336 +
  337 + // 刷新页面
  338 + const handleRefresh = () => {
  339 + setRefreshCount(pre => pre + 1);
  340 + };
  341 +
  342 + const itemClickRef = useRef();
  343 +
  344 + // 开工、暂停事件
  345 + const handleTableBtnClick = async item => {
  346 + const { tableName, index, record, tableData, config, iFlag } = item;
  347 + const { showName } = config;
  348 + if (showName === "完工") {
366 349 Modal.confirm({
367 350 title: "温馨提示:",
368   - content: <div>请选择要变更的状态</div>,
369   - okText: "完工",
370   - cancelText: "暂停",
  351 + content: <div>确认完工?</div>,
  352 + okText: "确认",
  353 + cancelText: "取消",
371 354 onOk() {
372   - resolve(true);
373   - },
374   - onCancel() {
375   - resolve(false);
  355 + handleUpdateProductionplan({ item, iFlag: 4 });
376 356 }
377 357 });
378   - });
379   - if (result) {
380   - // 走完工接口
381   - handleUpdateProductionplan({ item, iFlag: 4 });
382 358 return;
383 359 }
384   - }
  360 + // const iStar = index === 0 ? 1 : 2;
  361 + const { iStar } = record;
  362 +
  363 + if (iStar === 1) {
  364 + // 如果只剩一条数据,询问是暂停还是完工
  365 + if (tableData.length === 1) {
  366 + const result = await new Promise(resolve => {
  367 + Modal.confirm({
  368 + title: "温馨提示:",
  369 + content: <div>请选择要变更的状态</div>,
  370 + okText: "完工",
  371 + cancelText: "暂停",
  372 + onOk() {
  373 + resolve(true);
  374 + },
  375 + onCancel() {
  376 + resolve(false);
  377 + }
  378 + });
  379 + });
  380 + if (result) {
  381 + // 走完工接口
  382 + handleUpdateProductionplan({ item, iFlag: 4 });
  383 + return;
  384 + }
  385 + }
385 386  
386   - // 开工中,走暂停接口
387   - props.onSaveState({
388   - taskConfirmModalVisible: true,
389   - taskConfirmModalMsg: "请填写暂停原因",
390   - tempTaskId: record.sId,
391   - bPauseOnly: true,
392   - pauseCallback: pauseValue => {
  387 + // 开工中,走暂停接口
393 388 props.onSaveState({
394   - taskConfirmModalVisible: false,
395   - taskConfirmModalMsg: "",
396   - tempTaskId: "",
397   - bPauseOnly: false,
398   - pauseCallback: null
  389 + taskConfirmModalVisible: true,
  390 + taskConfirmModalMsg: "请选择暂停原因",
  391 + tempTaskId: record.sId,
  392 + bPauseOnly: true,
  393 + pauseCallback: pauseValue => {
  394 + props.onSaveState({
  395 + taskConfirmModalVisible: false,
  396 + taskConfirmModalMsg: "",
  397 + tempTaskId: "",
  398 + bPauseOnly: false,
  399 + pauseCallback: null
  400 + });
  401 + handleUpdateProductionplan({ item, iFlag: 3, pauseValue });
  402 + }
399 403 });
400   - handleUpdateProductionplan({ item, iFlag: 3, pauseValue });
  404 + } else if (iStar === 2 || iStar === 3) {
  405 + // 暂停中,走开工接口
  406 + const dataReturn = await handleStartWork(item);
  407 + const { code, msg } = dataReturn;
  408 + if (code === 1) {
  409 + // 成功开工
  410 + itemClickRef.current = null;
  411 + message.success(dataReturn.msg);
  412 + if (props.taskConfirmModalVisible) {
  413 + props.onSaveState({
  414 + taskConfirmModalVisible: false,
  415 + taskConfirmModalMsg: "",
  416 + tempTaskId: ""
  417 + });
  418 + }
  419 + props.onChangeRouter({
  420 + type: "name",
  421 + path: ["生产执行", "生产执行"]
  422 + });
  423 + } else if (code === -7) {
  424 + // 如果有开工中的任务,即接口返回-7,弹出确认窗体
  425 + itemClickRef.current = { data: item };
  426 + props.onSaveState({
  427 + taskConfirmModalVisible: true,
  428 + taskConfirmModalMsg: msg,
  429 + tempTaskId: record.sId
  430 + });
  431 + } else {
  432 + // 报错
  433 + message.error(msg);
  434 + }
401 435 }
402   - });
403   - } else if (iStar === 2 || iStar === 3) {
404   - // 暂停中,走开工接口
405   - const dataReturn = await handleStartWork(item);
406   - const { code, msg } = dataReturn;
407   - if (code === 1) {
408   - // 成功开工
409   - itemClickRef.current = null;
410   - message.success(dataReturn.msg);
411   - if (props.taskConfirmModalVisible) {
412   - props.onSaveState({
413   - taskConfirmModalVisible: false,
414   - taskConfirmModalMsg: "",
415   - tempTaskId: ""
416   - });
  436 + };
  437 +
  438 + // 更新机台状态
  439 + const handleUpdateProductionplan = async ({ item, iFlag, pauseValue }) => {
  440 + const { app } = props;
  441 + const { sId } = item.record;
  442 + const { token } = app;
  443 + const url = `${
  444 + commonConfig.server_host
  445 + }oee/updateProductionplan/${sId}/${iFlag}${
  446 + pauseValue
  447 + ? `?sWorkOrderChangeMemo=${encodeURIComponent(pauseValue)}`
  448 + : ""
  449 + }`;
  450 + const dataReturn = (await commonServices.getService(token, url)).data;
  451 + if (dataReturn.code === 1) {
  452 + dataReturn.msg && message.success(dataReturn.msg, 3);
  453 + handleRefresh();
  454 + } else {
  455 + message.error(dataReturn.msg, 3);
417 456 }
418   - props.onChangeRouter({
419   - type: "name",
420   - path: ["生产执行", "生产执行"]
421   - });
422   - } else if (code === -7) {
423   - // 如果有开工中的任务,即接口返回-7,弹出确认窗体
424   - itemClickRef.current = { data: item };
425   - props.onSaveState({
426   - taskConfirmModalVisible: true,
427   - taskConfirmModalMsg: msg,
428   - tempTaskId: record.sId
429   - });
430   - } else {
431   - // 报错
432   - message.error(msg);
433   - }
434   - }
435   - };
436   -
437   - // 更新机台状态
438   - const handleUpdateProductionplan = async ({ item, iFlag, pauseValue }) => {
439   - const { app } = props;
440   - const { sId } = item.record;
441   - const { token } = app;
442   - const url = `${
443   - commonConfig.server_host
444   - }oee/updateProductionplan/${sId}/${iFlag}${
445   - pauseValue
446   - ? `?sWorkOrderChangeMemo=${encodeURIComponent(pauseValue)}`
447   - : ""
448   - }`;
449   - const dataReturn = (await commonServices.getService(token, url)).data;
450   - if (dataReturn.code === 1) {
451   - handleRefresh();
452   - } else {
453   - message.error(dataReturn.msg);
454   - }
455   - };
456   -
457   - return {
458   - ...props,
459   - // 其他对象
460   - itemClickRef,
461   - onSearch: handleSearch,
462   - onStartWork: handleStartWork, // 开工事件
463   - onRefresh: handleRefresh, // 刷新页面
464   - onTableBtnClick: handleTableBtnClick, // 开工、暂停事件
465   - onUpdateProductionplan: handleUpdateProductionplan // 更新机台状态
466   - };
467   -};
468   -
469   -/**
470   - * 暂停按钮
471   - * @param {*} params
472   - */
473   -const handlePause = async params => {
474   - const { item, props } = params;
475   - const { record, config } = item;
476   - await operationFetch(
477   - { ...props, workOrderInfoData: [record] },
478   - config,
479   - config.sName || "fileError"
480   - );
481   - await handleOeeBtnEent({ props, item });
482   -};
483   -
484   -const MachineTasks = baseProps => {
485   - const props = useInfoEvent(useCommonBase({ ...baseProps }));
486   - const {
487   - app,
488   - slave0Config,
489   - slave1Column,
490   - slave1Data = [],
491   - slave2Column,
492   - slave2Data = []
493   - } = props;
494   -
495   - const bStartWork = commonUtils.getAppData("userinfo", "bStartWork");
496   -
497   - const [isTableLoading, setTableLoading] = useState(false);
498   -
499   - // const BtnTableCopyTo.startWork
500   - // 开工按钮配置
501   - const startWorkConfig =
502   - slave0Config?.gdsconfigformslave?.find(
503   - item => item.sControlName === "BtnTableCopyTo.startWork"
504   - ) || {};
505   - const pauseWorkConfig =
506   - slave0Config?.gdsconfigformslave?.find(
507   - item => item.sControlName === "BtnTableCopyTo.pauseWork"
508   - ) || {};
509   -
510   - // 表格业务
511   - const [sSrcNo, setSSrcNo] = useState("");
512   - // 顶部表格配置
513   - const tableProps = {
514   - ...commonBusiness.getTableTypes("slave0", props),
515   - tableProps: {
516   - onChange: () => {},
517   - loading: isTableLoading
518   - },
519   - tableBtnsConfig: params => {
520   - const { record, index } = params;
521   - const { iStar } = record;
522   - // const iStar = index === 0 ? 1 : 2;
523   -
524   - // const bStart = iStar === 1;
525   - // const bPause = iStar === 2;
526   -
527   - // 1 :开工状态(显示暂停) 2: 暂停状态(显示开工) 3: 完工状态(显示完工,灰色)
528   - // 开工:开工接口(现在)1:正常, -7:有开工,要有提示, -1: 错误提示
529   - // -7 :完工: iFlag:3 (完工上一条) 暂停:iFlag:2 (暂停上一条)
530   - // 暂停:新接口
531   -
532   - let showName, btnBgColor, sDefault;
533   - if (iStar === 1) {
534   - showName = "暂1停";
535   - btnBgColor = "#FAAD14";
536   - } else if (iStar === 2 || iStar === 3) {
537   - showName = "开1工";
538   - btnBgColor = "#1890FF";
539   - } else {
540   - showName = "完1工";
541   - btnBgColor = "#AAA";
542   - sDefault = "${false}";
543   - }
  457 + };
544 458  
545   - if (!bStartWork) {
546   - sDefault = "${false}";
547   - }
  459 + return {
  460 + ...props,
  461 + // 其他对象
  462 + itemClickRef,
  463 + onSearch: handleSearch,
  464 + onStartWork: handleStartWork, // 开工事件
  465 + onRefresh: handleRefresh, // 刷新页面
  466 + onTableBtnClick: handleTableBtnClick, // 开工、暂停事件
  467 + onUpdateProductionplan: handleUpdateProductionplan // 更新机台状态
  468 + };
  469 + };
548 470  
549   - return [
550   - { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig },
551   - { showName: "完工", btnBgColor: "#1890FF", sDefault }
552   - ];
553   -
554   - // return [
555   - // {
556   - // ...startWorkConfig,
557   - // showName: "开工",
558   - // btnBgColor: bStart ? "#1890FF" : "#AAA"
559   - // },
560   - // {
561   - // ...pauseWorkConfig,
562   - // showName: "暂停",
563   - // btnBgColor: bPause ? "#FAAD14" : "#AAA"
564   - // }
565   - // ];
566   - },
567   - onTableBtnClick: item => {
568   - props.onTableBtnClick(item);
569   - return;
570   - // 通用按钮操作
571   - // props.onTableBtnClick(item);
572   - const { tableName, index, record, tableData, config } = item;
573   - const { iStar } = record;
574   - const { showName } = config;
575   - if (iStar === 1 && showName === "开工") {
576   - setTableLoading(true);
577   - props.onStartWork(item).finally(() => {
578   - setTableLoading(false);
579   - });
580   - } else if (iStar === 2 && showName === "暂停") {
581   - setTableLoading(true);
582   - handlePause({ item, props }).finally(() => {
583   - setTableLoading(false);
584   - props.onRefresh();
585   - });
586   - }
587   - },
588   - tableBtnsWidth: "190px",
589   - fixedHeight: "335px"
590   - };
591   - // 全部按钮事件
592   - const tableAll = () => {
593   - setSSrcNo("");
594   - props.onSearch();
595   - };
596   - // 查询按钮事件
597   - const tableQuery = () => {
598   - props.onSearch(sSrcNo);
599   - };
600   -
601   - // 前期生产或反馈问题业务
602   - const [issueType, setIssueType] = useState(4);
603   - const issueObj = slave1Column?.reduce((acc, item) => {
604   - const chineseKey = item.title.replace(/[0-9]/g, "");
605   - if (acc[chineseKey]) {
606   - acc[chineseKey].push(item);
607   - } else {
608   - acc[chineseKey] = [item];
609   - }
610   - return acc;
611   - }, {});
612   -
613   - let issue = [];
614   -
615   - if (issueObj) {
616   - issue = Object.keys(issueObj)?.map((key, i) => {
617   - return { name: key, items: issueObj[key], id: i };
618   - });
619   - }
620   -
621   - const component = id => {
622   - if (issue?.length > 0) {
623   - return (
624   - <div className="marginTop componentBox">
625   - {issue[id].items.map(item => (
626   - <p>
627   - <span>{item.title}:</span>
628   - {slave1Data[0] ? (
629   - <Tooltip
630   - placement="topLeft"
631   - title={
632   - <span style={{ fontSize: 20 }}>
633   - {slave1Data[0][item.dataIndex]}
634   - </span>
635   - }
636   - >
637   - <span>{slave1Data[0][item.dataIndex]}</span>
638   - </Tooltip>
639   - ) : (
640   - ""
641   - )}
642   - </p>
643   - ))}
644   - </div>
  471 + /**
  472 + * 暂停按钮
  473 + * @param {*} params
  474 + */
  475 + const handlePause = async params => {
  476 + const { item, props } = params;
  477 + const { record, config } = item;
  478 + await operationFetch(
  479 + { ...props, workOrderInfoData: [record] },
  480 + config,
  481 + config.sName || "fileError"
645 482 );
646   - }
647   - };
648   - const NoAnnouncements = commonFunc.showLocalMessage(props, 'NoAnnouncements', '暂无通告');
649   -
650   - const [carouselData, setCarouselData] = useState([
651   - {
652   - title: NoAnnouncements,
653   - content: NoAnnouncements,
654   - id: 999
655   - }
656   - ]);
657   -
658   - const { slave3Data = [] } = props;
659   -
660   - useEffect(
661   - () => {
662   - if (!slave3Data.length) return;
663   -
664   - const tempData = slave3Data.map((item, index) => ({
665   - title: `车间通告${index + 1}`,
666   - content: item.sNoticeMemo,
667   - id: index
668   - }));
669   -
670   - setCarouselData(tempData);
671   - },
672   - [slave3Data.length]
673   - );
674   -
675   - // 设备信息业务
676   - const slave2OneData = slave2Data[0] || {};
677   - const { countMapJsON } = slave2OneData;
678   - const countMap = commonUtils.convertStrToObj(countMapJsON);
679   -
680   - const taskInfoData = {};
681   - slave2Column?.forEach(obj => {
682   - taskInfoData[`${obj.dataIndex}Title`] = obj.title;
683   - taskInfoData[`${obj.dataIndex}Conent`] = countMap[obj.dataIndex];
684   - });
685   - const feedbackIssues = commonFunc.showLocalMessage(props, 'feedbackIssues', '前期生产或反馈问题');
686   - const btnsearch = commonFunc.showLocalMessage(props, 'BtnSearch', '查询111');
687   - console.log('3333', btnsearch);
688   - const btnAll = commonFunc.showLocalMessage(props, 'btnAll', '全部');
689   - const sWorkOrderNo = commonFunc.showLocalMessage(props, 'sWorkOrderNo', '工单编号');
690   -
691   -
692   - return (
693   - <div className={styles.tasksBox}>
694   - <Row className={`tasksBg tasksTable`}>
695   - <Col span={24}>
696   - <div className="table">
697   - <StaticEditTable {...tableProps} />
698   - </div>
699   - <div className="tableSearch">
700   - <Button type="primary" size="large" onClick={tableAll}>
701   - {" "}
702   - {btnAll}{" "}
703   - </Button>
704   - <Input
705   - allowClear
706   - placeholder={sWorkOrderNo}
707   - value={sSrcNo}
708   - onChange={e => setSSrcNo(e.target.value)}
709   - />
710   - <Button type="primary" size="large" onClick={tableQuery}>
711   - {" "}
712   - {btnsearch}{" "}
713   - </Button>
714   - </div>
715   - </Col>
716   - </Row>
717   - <Row gutter={[15, 0]} className={`marginTop`}>
718   - <Col span={18}>
719   - <div className={`tasksBg taskIssue`}>
720   - <h2>{feedbackIssues}</h2>
721   - {issue?.map(item => (
722   - <Button
723   - className="taskBtn"
724   - key={item.id}
725   - type={issueType === item.id ? "primary" : ""}
726   - ghost={issueType === item.id ? false : true}
727   - onClick={() => setIssueType(item.id)}
728   - >
729   - {item.name}
730   - </Button>
731   - ))}
732   - {component(issueType)}
733   - </div>
734   - </Col>
735   - <Col span={6}>
736   - <div className={`tasksBg taskIssue`} style={{ maxWidth: "434px" }}>
737   - <Carousel autoplay>
738   - {carouselData.map(item => (
739   - <div key={item.id} className={`tasksCarousel`}>
740   - <h2>{item.title}</h2>
741   - <p>{item.content}</p>
742   - </div>
743   - ))}
744   - </Carousel>
745   - </div>
746   - </Col>
747   - </Row>
748   - <Row gutter={[15, 0]} className={`tasksBg marginTop taskInfo`}>
749   - <h2>设备信息</h2>
750   - <Col span={4} className="taskInfoBox">
751   - <div className={"leftBox"}>
752   - <img src={taskInfoIcon} alt={taskInfoData.sMachineNameTitle} />
753   - <div>
754   - <h3>{taskInfoData.sMachineNameTitle}:</h3>
755   - <p>{taskInfoData.sMachineNameConent}</p>
756   - </div>
757   - </div>
758   - </Col>
759   - <Col span={4} className="taskInfoBox">
760   - <div className={"leftBox"}>
761   - <img src={statusIcon} alt={taskInfoData.sStatusNameTitle} />
762   - <div>
763   - <h3>{taskInfoData.sStatusNameTitle}:</h3>
764   - <p>{taskInfoData.sStatusNameConent}</p>
765   - </div>
766   - <StatusBtnComponent />
767   - </div>
768   - </Col>
769   - <Col span={10} className="taskInfoBox">
770   - <div className={"centerBox"}>
771   - <img src={timeIcon} alt={taskInfoData.tStartingUpTimeTitle} />
772   - <div className="timeBox">
773   - <h3>{taskInfoData.tStartingUpTimeTitle}:</h3>
774   - <p>{taskInfoData.tStartingUpTimeConent}</p>
775   - </div>
776   - <div className="timeBox">
777   - <div className="bothEndsAlign">
778   - <p>{taskInfoData.tNorRunTimeTitle}:</p>
779   - <span>{taskInfoData.tNorRunTimeConent}</span>
780   - </div>
781   - <div className="bothEndsAlign">
782   - <p>{taskInfoData.tExeWaitTimeTitle}:</p>
783   - <span>{taskInfoData.tExeWaitTimeConent}</span>
784   - </div>
785   - </div>
786   - <div className="timeBox">
787   - <div className="bothEndsAlign">
788   - <p>{taskInfoData.tNorWaitTimeTitle}:</p>
789   - <span>{taskInfoData.tNorWaitTimeConent}</span>
790   - </div>
791   - <div className="bothEndsAlign">
792   - <p>{taskInfoData.tMaintenceTimeTitle}:</p>
793   - <span>{taskInfoData.tMaintenceTimeConent}</span>
794   - </div>
795   - </div>
796   - </div>
797   - </Col>
798   - <Col span={6} className="taskInfoBox">
799   - <div className={"leftBox"}>
800   - <img src={taskIcon} alt={taskInfoData.tStartingUpTimeTitle} />
801   - <div>
802   - <h3>今日完成任务批次/产量(个):</h3>
803   - <p>
804   - {taskInfoData.iFinishTaskBatchConent} /{" "}
805   - {taskInfoData.iFinishProductionNumConent}
806   - </p>
807   - </div>
808   - </div>
809   - </Col>
810   - </Row>
811   - <TaskConfirmModal {...props} />
812   - </div>
813   - );
814   -};
815   -
816   -const TaskConfirmModal = props => {
817   - const { taskConfirmModalVisible, taskConfirmModalMsg, bPauseOnly } = props;
818   - if (!taskConfirmModalVisible) return "";
819   -
820   - const handleClose = () => {
821   - props.itemClickRef.current = null;
822   - props.onSaveState({
823   - taskConfirmModalVisible: false,
824   - bPauseOnly: false,
825   - pauseCallback: null
826   - });
827   - };
828   -
829   - const [pauseValue, setPauseValue] = useState("");
830   -
831   - return (
832   - <Modal
833   - title={<span style={{ fontSize: 22 }}>提示!</span>}
834   - open={taskConfirmModalVisible}
835   - width={500}
836   - height={370}
837   - className="mesCommonModal"
838   - footer={
839   - <Space>
840   - {bPauseOnly ? (
841   - <Button
842   - size="large"
843   - type="primary"
844   - className={styles.btnZt}
845   - onClick={() => {
846   - if (!pauseValue.trim()) {
847   - message.warning("请先输入暂停原因!");
848   - return;
849   - }
850   - props.pauseCallback(pauseValue.trim());
851   - }}
852   - >
853   - 暂停
854   - </Button>
855   - ) : (
856   - <>
857   - <Button
858   - size="large"
859   - type="primary"
860   - className={styles.btnWg}
861   - onClick={() => {
862   - if (props.itemClickRef.current?.data)
863   - props.onTableBtnClick({
864   - ...(props.itemClickRef.current?.data || {}),
865   - iFlag: 4
866   - });
867   - // handleClose();
868   - }}
869   - >
870   - 完工
871   - </Button>
872   - <Button
873   - size="large"
874   - type="primary"
875   - className={styles.btnZt}
876   - onClick={() => {
877   - if (!pauseValue.trim()) {
878   - message.warning("请先输入暂停原因!");
879   - return;
880   - }
881   - if (props.itemClickRef.current?.data)
882   - props.onTableBtnClick({
883   - ...(props.itemClickRef.current?.data || {}),
884   - iFlag: 3,
885   - pauseValue: pauseValue.trim()
886   - });
887   - // handleClose();
888   - }}
889   - >
890   - 暂停
891   - </Button>
892   - </>
893   - )}
894   - </Space>
895   - }
896   - onCancel={handleClose}
897   - >
898   - <div className={styles.taskConfirmModal}>{taskConfirmModalMsg}</div>
899   - <div className={styles.pauseReason}>
900   - <div className={styles.pauseTitle}>暂停原因</div>
901   - <Input.TextArea
902   - placeholder="请输入暂停原因"
903   - autoSize={{ minRows: 3, maxRows: 3 }}
904   - style={{ width: "100%" }}
905   - value={pauseValue}
906   - onChange={e => setPauseValue(e.target.value)}
907   - />
908   - </div>
909   - </Modal>
910   - );
911   -};
912   -
913   -// 全屏状态
914   -const StatusBtnComponent = () => {
915   - const items = [
916   - {
917   - key: "4",
918   - label: <span className={styles.statusDropdown}>转产</span>,
919   - value: {
920   - conent2: "转产",
921   - backgroundColor: "#752AFE"
922   - }
923   - },
924   - {
925   - key: "1",
926   - label: <span className={styles.statusDropdown}>测试</span>,
927   - value: {
928   - conent2: "转产",
929   - backgroundColor: "#21C9FE"
930   - },
931   - children: [
932   - {
933   - key: "1-1",
934   - label: <span className={styles.statusDropdown}>产品打样</span>,
935   - value: {
936   - conent2: "产品打样",
937   - backgroundColor: "#21C9FE"
938   - }
939   - },
940   - {
941   - key: "1-2",
942   - label: <span className={styles.statusDropdown}>工艺测试</span>,
943   - value: {
944   - conent2: "工艺测试",
945   - backgroundColor: "#21C9FE"
946   - }
947   - }
948   - ]
949   - },
950   - {
951   - key: "2",
952   - label: <span className={styles.statusDropdown}>保养</span>,
953   - value: {
954   - conent2: "保养",
955   - backgroundColor: "#FF6600"
956   - },
957   - children: [
958   - {
959   - key: "2-1",
960   - label: <span className={styles.statusDropdown}>日常保养</span>,
961   - value: {
962   - conent2: "日常保养",
963   - backgroundColor: "#FF6600"
964   - }
  483 + await handleOeeBtnEent({ props, item });
  484 + };
  485 +
  486 + const MachineTasks = baseProps => {
  487 + const props = useInfoEvent(useCommonBase({ ...baseProps }));
  488 + const {
  489 + app,
  490 + slave0Config,
  491 + slave1Column,
  492 + slave1Data = [],
  493 + slave2Column,
  494 + slave2Data = []
  495 + } = props;
  496 +
  497 + const bStartWork = commonUtils.getAppData("userinfo", "bStartWork");
  498 +
  499 + const [isTableLoading, setTableLoading] = useState(false);
  500 +
  501 + // const BtnTableCopyTo.startWork
  502 + // 开工按钮配置
  503 + const startWorkConfig =
  504 + slave0Config?.gdsconfigformslave?.find(
  505 + item => item.sControlName === "BtnTableCopyTo.startWork"
  506 + ) || {};
  507 + const pauseWorkConfig =
  508 + slave0Config?.gdsconfigformslave?.find(
  509 + item => item.sControlName === "BtnTableCopyTo.pauseWork"
  510 + ) || {};
  511 +
  512 + // 表格业务
  513 + const [sSrcNo, setSSrcNo] = useState("");
  514 + // 顶部表格配置
  515 + const tableProps = {
  516 + ...commonBusiness.getTableTypes("slave0", props),
  517 + tableProps: {
  518 + onChange: () => {},
  519 + loading: isTableLoading
965 520 },
966   - {
967   - key: "2-2",
968   - label: <span className={styles.statusDropdown}>一级保养</span>,
969   - value: {
970   - conent2: "一级保养",
971   - backgroundColor: "#FF6600"
  521 + tableBtnsConfig: params => {
  522 + const { record, index } = params;
  523 + 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 +
  534 + let showName, btnBgColor, sDefault;
  535 + if (iStar === 1) {
  536 + showName = "暂停";
  537 + btnBgColor = "#FAAD14";
  538 + } else if (iStar === 2 || iStar === 3) {
  539 + showName = "开工";
  540 + btnBgColor = "#1890FF";
  541 + } else {
  542 + showName = "完工";
  543 + btnBgColor = "#AAA";
  544 + sDefault = "${false}";
972 545 }
973   - },
974   - {
975   - key: "2-3",
976   - label: <span className={styles.statusDropdown}>二级保养</span>,
977   - value: {
978   - conent2: "二级保养",
979   - backgroundColor: "#FF6600"
  546 +
  547 + if (!bStartWork) {
  548 + sDefault = "${false}";
980 549 }
  550 +
  551 + return [
  552 + { showName, btnBgColor, sDefault, startWorkConfig, pauseWorkConfig },
  553 + { showName: "完工", btnBgColor: "#1890FF", sDefault }
  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 + // ];
981 568 },
982   - {
983   - key: "2-4",
984   - label: <span className={styles.statusDropdown}>一级+二级保养</span>,
985   - value: {
986   - conent2: "一级+二级保养",
987   - backgroundColor: "#FF6600",
988   - fontSize: 130
  569 + onTableBtnClick: item => {
  570 + 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 + });
989 588 }
990 589 },
  590 + tableBtnsWidth: "190px",
  591 + fixedHeight: "335px"
  592 + };
  593 + // 全部按钮事件
  594 + const tableAll = () => {
  595 + setSSrcNo("");
  596 + props.onSearch();
  597 + };
  598 + // 查询按钮事件
  599 + const tableQuery = () => {
  600 + props.onSearch(sSrcNo);
  601 + };
  602 +
  603 + // 前期生产或反馈问题业务
  604 + const [issueType, setIssueType] = useState(4);
  605 + const issueObj = slave1Column?.reduce((acc, item) => {
  606 + const chineseKey = item.title.replace(/[0-9]/g, "");
  607 + if (acc[chineseKey]) {
  608 + acc[chineseKey].push(item);
  609 + } else {
  610 + acc[chineseKey] = [item];
  611 + }
  612 + return acc;
  613 + }, {});
  614 +
  615 + let issue = [];
  616 +
  617 + if (issueObj) {
  618 + issue = Object.keys(issueObj)?.map((key, i) => {
  619 + return { name: key, items: issueObj[key], id: i };
  620 + });
  621 + }
  622 +
  623 + const component = id => {
  624 + if (issue?.length > 0) {
  625 + return (
  626 + <div className="marginTop componentBox">
  627 + {issue[id].items.map(item => (
  628 + <p>
  629 + <span>{item.title}:</span>
  630 + {slave1Data[0] ? (
  631 + <Tooltip
  632 + placement="topLeft"
  633 + title={
  634 + <span style={{ fontSize: 20 }}>
  635 + {slave1Data[0][item.dataIndex]}
  636 + </span>
  637 + }
  638 + >
  639 + <span>{slave1Data[0][item.dataIndex]}</span>
  640 + </Tooltip>
  641 + ) : (
  642 + ""
  643 + )}
  644 + </p>
  645 + ))}
  646 + </div>
  647 + );
  648 + }
  649 + };
  650 +
  651 + const NoAnnouncements = commonFunc.showLocalMessage(props, 'NoAnnouncements', '暂无通告');
  652 +
  653 + const [carouselData, setCarouselData] = useState([
991 654 {
992   - key: "2-5",
993   - label: <span className={styles.statusDropdown}>年度保养</span>,
994   - value: {
995   - conent2: "年度保养",
996   - backgroundColor: "#FF6600"
997   - }
  655 + title: NoAnnouncements,
  656 + content: NoAnnouncements,
  657 + id: 999
998 658 }
999   - ]
1000   - }
1001   - ];
1002   -
1003   - const handleMenuClick = e => {
1004   - message.success({
1005   - top: 0,
1006   - duration: 0,
1007   - className: styles.machineStatus,
1008   - content: <MachineMessageComponent e={e} />
1009   - });
1010   - };
1011   -
1012   - return (
1013   - <div className={styles.statusBtn}>
1014   - <Dropdown
1015   - menu={{ items, onClick: handleMenuClick }}
1016   - trigger={["click"]}
1017   - placement="top"
1018   - overlayClassName={styles.statusDropdown}
1019   - >
1020   - <Button type="link" size="large" style={{ fontSize: 26 }}>
1021   - <SettingTwoTone />
1022   - </Button>
1023   - </Dropdown>
1024   - </div>
1025   - );
1026   -};
1027   -
1028   -const MachineMessageComponent = ({ e }) => {
1029   - const value = e.item?.props?.value || {};
1030   - const { current: startTime } = useRef(moment().format("YYYY-MM-DD HH:mm:ss"));
1031   - const { backgroundColor, conent2, fontSize } = value;
1032   -
1033   - const [currentTime, setCurrentTime] = useState("");
1034   - const [diffHours, setDiffHours] = useState(0);
1035   - const [diffMins, setDiffMins] = useState(0);
1036   - const [diffSecs, setDiffSecs] = useState(0);
1037   - const flagRef = useRef(0);
1038   - useEffect(() => {
1039   - const getTime = () => {
1040   - const currentTimeNew = moment().format("YYYY-MM-DD HH:mm:ss");
1041   - setCurrentTime(currentTimeNew);
1042   -
1043   - const duration = moment.duration(
1044   - moment(currentTimeNew).diff(moment(startTime))
  659 + ]);
  660 +
  661 + const { slave3Data = [] } = props;
  662 +
  663 + useEffect(
  664 + () => {
  665 + if (!slave3Data.length) return;
  666 +
  667 + const tempData = slave3Data.map((item, index) => ({
  668 + title: `车间通告${index + 1}`,
  669 + content: item.sNoticeMemo,
  670 + id: index
  671 + }));
  672 +
  673 + setCarouselData(tempData);
  674 + },
  675 + [slave3Data.length]
  676 + );
  677 +
  678 + // 设备信息业务
  679 + const slave2OneData = slave2Data[0] || {};
  680 + const { countMapJsON } = slave2OneData;
  681 + const countMap = commonUtils.convertStrToObj(countMapJsON);
  682 +
  683 + const taskInfoData = {};
  684 + slave2Column?.forEach(obj => {
  685 + taskInfoData[`${obj.dataIndex}Title`] = obj.title;
  686 + taskInfoData[`${obj.dataIndex}Conent`] = countMap[obj.dataIndex];
  687 + });
  688 + const feedbackIssues = commonFunc.showLocalMessage(props, 'feedbackIssues', '前期生产或反馈问题');
  689 + const btnsearch = commonFunc.showLocalMessage(props, 'BtnSearch', '查询');
  690 + const btnAll = commonFunc.showLocalMessage(props, 'btnAll', '全部');
  691 + const sWorkOrderNo = commonFunc.showLocalMessage(props, 'sWorkOrderNo', '工单编号');
  692 + return (
  693 + <div className={styles.tasksBox}>
  694 + <Row className={`tasksBg tasksTable`}>
  695 + <Col span={24}>
  696 + <div className="table">
  697 + <StaticEditTable {...tableProps} />
  698 + </div>
  699 + <div className="tableSearch">
  700 + <Button type="primary" size="large" onClick={tableAll}>
  701 + {" "}
  702 + {btnAll}{" "}
  703 + </Button>
  704 + <Input
  705 + allowClear
  706 + placeholder={sWorkOrderNo}
  707 + value={sSrcNo}
  708 + onChange={e => setSSrcNo(e.target.value)}
  709 + />
  710 + <Button type="primary" size="large" onClick={tableQuery}>
  711 + {" "}
  712 + {btnsearch}{" "}
  713 + </Button>
  714 + </div>
  715 + </Col>
  716 + </Row>
  717 + <Row gutter={[15, 0]} className={`marginTop`}>
  718 + <Col span={18}>
  719 + <div className={`tasksBg taskIssue`}>
  720 + <h2>{feedbackIssues}</h2>
  721 + {issue?.map(item => (
  722 + <Button
  723 + className="taskBtn"
  724 + key={item.id}
  725 + type={issueType === item.id ? "primary" : ""}
  726 + ghost={issueType === item.id ? false : true}
  727 + onClick={() => setIssueType(item.id)}
  728 + >
  729 + {item.name}
  730 + </Button>
  731 + ))}
  732 + {component(issueType)}
  733 + </div>
  734 + </Col>
  735 + <Col span={6}>
  736 + <div className={`tasksBg taskIssue`} style={{ maxWidth: "434px" }}>
  737 + <Carousel autoplay>
  738 + {carouselData.map(item => (
  739 + <div key={item.id} className={`tasksCarousel`}>
  740 + <h2>{item.title}</h2>
  741 + <p>{item.content}</p>
  742 + </div>
  743 + ))}
  744 + </Carousel>
  745 + </div>
  746 + </Col>
  747 + </Row>
  748 + <Row gutter={[15, 0]} className={`tasksBg marginTop taskInfo`}>
  749 + <h2>设备信息</h2>
  750 + <Col span={4} className="taskInfoBox">
  751 + <div className={"leftBox"}>
  752 + <img src={taskInfoIcon} alt={taskInfoData.sMachineNameTitle} />
  753 + <div>
  754 + <h3>{taskInfoData.sMachineNameTitle}:</h3>
  755 + <p>{taskInfoData.sMachineNameConent}</p>
  756 + </div>
  757 + </div>
  758 + </Col>
  759 + <Col span={4} className="taskInfoBox">
  760 + <div className={"leftBox"}>
  761 + <img src={statusIcon} alt={taskInfoData.sStatusNameTitle} />
  762 + <div>
  763 + <h3>{taskInfoData.sStatusNameTitle}:</h3>
  764 + <p>{taskInfoData.sStatusNameConent}</p>
  765 + </div>
  766 + <StatusBtnComponent />
  767 + </div>
  768 + </Col>
  769 + <Col span={10} className="taskInfoBox">
  770 + <div className={"centerBox"}>
  771 + <img src={timeIcon} alt={taskInfoData.tStartingUpTimeTitle} />
  772 + <div className="timeBox">
  773 + <h3>{taskInfoData.tStartingUpTimeTitle}:</h3>
  774 + <p>{taskInfoData.tStartingUpTimeConent}</p>
  775 + </div>
  776 + <div className="timeBox">
  777 + <div className="bothEndsAlign">
  778 + <p>{taskInfoData.tNorRunTimeTitle}:</p>
  779 + <span>{taskInfoData.tNorRunTimeConent}</span>
  780 + </div>
  781 + <div className="bothEndsAlign">
  782 + <p>{taskInfoData.tExeWaitTimeTitle}:</p>
  783 + <span>{taskInfoData.tExeWaitTimeConent}</span>
  784 + </div>
  785 + </div>
  786 + <div className="timeBox">
  787 + <div className="bothEndsAlign">
  788 + <p>{taskInfoData.tNorWaitTimeTitle}:</p>
  789 + <span>{taskInfoData.tNorWaitTimeConent}</span>
  790 + </div>
  791 + <div className="bothEndsAlign">
  792 + <p>{taskInfoData.tMaintenceTimeTitle}:</p>
  793 + <span>{taskInfoData.tMaintenceTimeConent}</span>
  794 + </div>
  795 + </div>
  796 + </div>
  797 + </Col>
  798 + <Col span={6} className="taskInfoBox">
  799 + <div className={"leftBox"}>
  800 + <img src={taskIcon} alt={taskInfoData.tStartingUpTimeTitle} />
  801 + <div>
  802 + <h3>今日完成任务批次/产量(个):</h3>
  803 + <p>
  804 + {taskInfoData.iFinishTaskBatchConent} /{" "}
  805 + {taskInfoData.iFinishProductionNumConent}
  806 + </p>
  807 + </div>
  808 + </div>
  809 + </Col>
  810 + </Row>
  811 + <TaskConfirmModal {...props} />
  812 + </div>
1045 813 );
1046   - const hours = duration
1047   - .asHours()
1048   - .toString()
1049   - .split(".")[0];
1050   - const minutes = (duration.asMinutes() % 60).toString().split(".")[0];
1051   - const seconds = duration.asSeconds() % 60;
1052   -
1053   - setDiffHours(hours);
1054   - setDiffMins(minutes);
1055   - setDiffSecs(seconds);
1056 814 };
1057 815  
1058   - getTime();
1059   - const timer = setInterval(() => {
1060   - getTime();
1061   - }, 1000);
1062   -
1063   - const handleMenuClose = () => {
1064   - if (flagRef.current) return;
1065   - flagRef.current++;
1066   - Modal.confirm({
1067   - title: "温馨提示:",
1068   - content: <div>确认退出该页面?</div>,
1069   - okText: "确认",
1070   - cancelText: "取消",
1071   - zIndex: 2000,
1072   - onOk() {
1073   - message.destroy();
1074   - },
1075   - onCancel() {
1076   - setTimeout(() => {
1077   - flagRef.current = 0;
1078   - }, 500);
  816 + const TaskConfirmModal = props => {
  817 + const {
  818 + taskConfirmModalVisible,
  819 + taskConfirmModalMsg,
  820 + bPauseOnly,
  821 + slave0Config
  822 + } = props;
  823 + if (!taskConfirmModalVisible) return "";
  824 +
  825 + const handleClose = () => {
  826 + props.itemClickRef.current = null;
  827 + props.onSaveState({
  828 + taskConfirmModalVisible: false,
  829 + bPauseOnly: false,
  830 + pauseCallback: null
  831 + });
  832 + };
  833 +
  834 + const [pauseValue, setPauseValue] = useState("");
  835 +
  836 + const viewConfigs = slave0Config?.gdsconfigformslave.filter(
  837 + item => item.sName === "sPausereason"
  838 + );
  839 +
  840 + const sIdRef = useRef(commonUtils.createSid());
  841 +
  842 + const viewProps = {
  843 + ...props,
  844 + viewConfigs,
  845 + tableConfig: { ...slave0Config, gdsconfigformslave: viewConfigs },
  846 + iColValueView: 24,
  847 + viewRow: { sId: sIdRef.current, sPausereason: pauseValue },
  848 + tableName: "slave0",
  849 + enabled: true,
  850 + onDataChange: (...args) => {
  851 + setPauseValue(args[2].sPausereason);
1079 852 }
1080   - });
  853 + };
  854 +
  855 + return (
  856 + <Modal
  857 + title={<span style={{ fontSize: 22 }}>提示!</span>}
  858 + open={taskConfirmModalVisible}
  859 + width={500}
  860 + height={320}
  861 + className="mesCommonModal"
  862 + footer={
  863 + <>
  864 + {bPauseOnly ? (
  865 + <Space>
  866 + <Button
  867 + size="large"
  868 + type="primary"
  869 + className={styles.btnZt}
  870 + onClick={() => {
  871 + if (!pauseValue.trim()) {
  872 + message.warning("请先选择暂停原因!");
  873 + return;
  874 + }
  875 + props.pauseCallback(pauseValue.trim());
  876 + }}
  877 + >
  878 + 暂停
  879 + </Button>
  880 + </Space>
  881 + ) : (
  882 + <Space style={{ width: "100%" , 'justify-content': 'space-between' }}>
  883 + <Button
  884 + size="large"
  885 + type="primary"
  886 + className={styles.btnWg}
  887 + onClick={() => {
  888 + if (props.itemClickRef.current?.data)
  889 + props.onTableBtnClick({
  890 + ...(props.itemClickRef.current?.data || {}),
  891 + iFlag: 4
  892 + });
  893 + // handleClose();
  894 + }}
  895 + >
  896 + 完工
  897 + </Button>
  898 + <Button
  899 + size="large"
  900 + type="primary"
  901 + className={styles.btnZt}
  902 + onClick={() => {
  903 + if (!pauseValue.trim()) {
  904 + message.warning("请先选择暂停原因!");
  905 + return;
  906 + }
  907 + if (props.itemClickRef.current?.data)
  908 + props.onTableBtnClick({
  909 + ...(props.itemClickRef.current?.data || {}),
  910 + iFlag: 3,
  911 + pauseValue: pauseValue.trim()
  912 + });
  913 + // handleClose();
  914 + }}
  915 + >
  916 + 暂停
  917 + </Button>
  918 + </Space>
  919 + )}
  920 + </>
  921 + }
  922 + onCancel={handleClose}
  923 + >
  924 + <div className={styles.taskConfirmModal}>{taskConfirmModalMsg}</div>
  925 + <div className={styles.pauseReason}>
  926 + {/* <div className={styles.pauseTitle}>暂停原因</div> */}
  927 + <CommonViewTable {...viewProps} />
  928 + {/* <Input.TextArea
  929 + placeholder="请输入暂停原因"
  930 + autoSize={{ minRows: 3, maxRows: 3 }}
  931 + style={{ width: "100%" }}
  932 + value={pauseValue}
  933 + onChange={e => setPauseValue(e.target.value)}
  934 + /> */}
  935 + </div>
  936 + </Modal>
  937 + );
1081 938 };
1082 939  
1083   - setInterval(() => {
1084   - document.addEventListener("click", handleMenuClose);
1085   - }, 1000);
  940 + // 全屏状态
  941 + const StatusBtnComponent = () => {
1086 942  
1087   - return () => {
1088   - clearInterval(timer);
1089   - document.removeEventListener("click", handleMenuClose);
  943 + const items = [
  944 + {
  945 + key: "4",
  946 + label: <span className={styles.statusDropdown}>转产</span>,
  947 + value: {
  948 + conent2: "转产",
  949 + backgroundColor: "#752AFE"
  950 + }
  951 + },
  952 + {
  953 + key: "1",
  954 + label: <span className={styles.statusDropdown}>测试</span>,
  955 + value: {
  956 + conent2: "转产",
  957 + backgroundColor: "#21C9FE"
  958 + },
  959 + children: [
  960 + {
  961 + key: "1-1",
  962 + label: <span className={styles.statusDropdown}>产品打样</span>,
  963 + value: {
  964 + conent2: "产品打样",
  965 + backgroundColor: "#21C9FE"
  966 + }
  967 + },
  968 + {
  969 + key: "1-2",
  970 + label: <span className={styles.statusDropdown}>工艺测试</span>,
  971 + value: {
  972 + conent2: "工艺测试",
  973 + backgroundColor: "#21C9FE"
  974 + }
  975 + }
  976 + ]
  977 + },
  978 + {
  979 + key: "2",
  980 + label: <span className={styles.statusDropdown}>保养</span>,
  981 + value: {
  982 + conent2: "保养",
  983 + backgroundColor: "#FF6600"
  984 + },
  985 + children: [
  986 + {
  987 + key: "2-1",
  988 + label: <span className={styles.statusDropdown}>日常保养</span>,
  989 + value: {
  990 + conent2: "日常保养",
  991 + backgroundColor: "#FF6600"
  992 + }
  993 + },
  994 + {
  995 + key: "2-2",
  996 + label: <span className={styles.statusDropdown}>一级保养</span>,
  997 + value: {
  998 + conent2: "一级保养",
  999 + backgroundColor: "#FF6600"
  1000 + }
  1001 + },
  1002 + {
  1003 + key: "2-3",
  1004 + label: <span className={styles.statusDropdown}>二级保养</span>,
  1005 + value: {
  1006 + conent2: "二级保养",
  1007 + backgroundColor: "#FF6600"
  1008 + }
  1009 + },
  1010 + {
  1011 + key: "2-4",
  1012 + label: <span className={styles.statusDropdown}>一级+二级保养</span>,
  1013 + value: {
  1014 + conent2: "一级+二级保养",
  1015 + backgroundColor: "#FF6600",
  1016 + fontSize: 130
  1017 + }
  1018 + },
  1019 + {
  1020 + key: "2-5",
  1021 + label: <span className={styles.statusDropdown}>年度保养</span>,
  1022 + value: {
  1023 + conent2: "年度保养",
  1024 + backgroundColor: "#FF6600"
  1025 + }
  1026 + }
  1027 + ]
  1028 + }
  1029 + ];
  1030 +
  1031 + // 全屏
  1032 + const handleMenuClick = item2 => {
  1033 + const newObj = {
  1034 + ...item2,
  1035 + item: item2.item
  1036 + };
  1037 + window.$wkcFullStatus(newObj , true)
  1038 + };
  1039 +
  1040 +
  1041 + return (
  1042 + <>
  1043 + <div className={styles.statusBtn}>
  1044 + <Dropdown menu={{ items, onClick: handleMenuClick }} trigger={["click"]} placement="top" overlayClassName={styles.statusDropdown} >
  1045 + <Button type="link" size="large" style={{ fontSize: 26 }}>
  1046 + <SettingTwoTone />
  1047 + </Button>
  1048 + </Dropdown>
  1049 + </div>
  1050 + </>
  1051 + );
1090 1052 };
1091   - }, []);
1092   -
1093   - return (
1094   - <div className={styles.machineStatusContent} style={{ backgroundColor }}>
1095   - <div className="conent1">设备停机状态告知</div>
1096   - <div className="conent2" style={fontSize ? { fontSize } : {}}>
1097   - {conent2}
1098   - </div>
1099   - <div className="conent3">
1100   - 停机开始时间:
1101   - {startTime}
1102   - </div>
1103   - <div className="conent4">
1104   - 系统当前时间:
1105   - {currentTime}
1106   - </div>
1107   - <div className="conent5">
1108   - 此次停机耗时:
1109   - <span className="conent6">
1110   - 约:
1111   - {diffHours}时 {diffMins}分 {diffSecs}秒
1112   - </span>
1113   - </div>
1114   - </div>
1115   - );
1116   -};
1117   -
1118   -export default MachineTasks;
  1053 +
  1054 + // const MachineMessageComponent = ({ e , shutDown , minimize}) => {
  1055 + // const value = e.item?.props?.value || {};
  1056 + // const { current: startTime } = useRef(moment().format("YYYY-MM-DD HH:mm:ss"));
  1057 + // const { backgroundColor, conent2, fontSize } = value;
  1058 + // const [currentTime, setCurrentTime] = useState("");
  1059 + // const [diffHours, setDiffHours] = useState(0);
  1060 + // const [diffMins, setDiffMins] = useState(0);
  1061 + // const [diffSecs, setDiffSecs] = useState(0);
  1062 + // const flagRef = useRef(0);
  1063 + // useEffect(() => {
  1064 + // const getTime = () => {
  1065 + // const currentTimeNew = moment().format("YYYY-MM-DD HH:mm:ss");
  1066 + // setCurrentTime(currentTimeNew);
  1067 +
  1068 + // const duration = moment.duration(
  1069 + // moment(currentTimeNew).diff(moment(startTime))
  1070 + // );
  1071 + // const hours = duration
  1072 + // .asHours()
  1073 + // .toString()
  1074 + // .split(".")[0];
  1075 + // const minutes = (duration.asMinutes() % 60).toString().split(".")[0];
  1076 + // const seconds = duration.asSeconds() % 60;
  1077 +
  1078 + // setDiffHours(hours);
  1079 + // setDiffMins(minutes);
  1080 + // setDiffSecs(seconds);
  1081 + // };
  1082 +
  1083 + // getTime();
  1084 + // const timer = setInterval(() => {
  1085 + // getTime();
  1086 + // }, 1000);
  1087 +
  1088 + // // const handleMenuClose = () => {
  1089 + // // if (flagRef.current) return;
  1090 + // // flagRef.current++;
  1091 + // // Modal.confirm({
  1092 + // // title: "温馨提示:",
  1093 + // // content: <div>确认退出该页面?</div>,
  1094 + // // okText: "确认",
  1095 + // // cancelText: "取消",
  1096 + // // zIndex: 2000,
  1097 + // // onOk() {
  1098 + // // message.destroy();
  1099 + // // },
  1100 + // // onCancel() {
  1101 + // // setTimeout(() => {
  1102 + // // flagRef.current = 0;
  1103 + // // }, 500);
  1104 + // // }
  1105 + // // });
  1106 + // // };
  1107 +
  1108 + // // setInterval(() => {
  1109 + // // document.addEventListener("click", handleMenuClose);
  1110 + // // }, 1000);
  1111 +
  1112 + // return () => {
  1113 + // clearInterval(timer);
  1114 + // // document.removeEventListener("click", handleMenuClose);
  1115 + // };
  1116 + // }, []);
  1117 +
  1118 + // const handleMenuClose = () => {
  1119 + // if (flagRef.current) return;
  1120 + // flagRef.current++;
  1121 + // Modal.confirm({
  1122 + // title: "温馨提示:",
  1123 + // content: <div>确认退出该页面?</div>,
  1124 + // okText: "确认",
  1125 + // cancelText: "取消",
  1126 + // zIndex: 2000,
  1127 + // onOk() {
  1128 + // // message.destroy();
  1129 + // shutDown()
  1130 + // },
  1131 + // onCancel() {
  1132 + // setTimeout(() => {
  1133 + // flagRef.current = 0;
  1134 + // }, 500);
  1135 + // }
  1136 + // });
  1137 + // };
  1138 +
  1139 + // return (
  1140 + // <div className={styles.machineStatusContent} style={{ backgroundColor }}>
  1141 + // <div className="conent1">设备停机状态告知</div>
  1142 + // <div className="conent2" style={fontSize ? { fontSize } : {}}>
  1143 + // {conent2}
  1144 + // </div>
  1145 + // <div className="conent3">
  1146 + // 停机开始时间:
  1147 + // {startTime}
  1148 + // </div>
  1149 + // <div className="conent4">
  1150 + // 系统当前时间:
  1151 + // {currentTime}
  1152 + // </div>
  1153 + // <div className="conent5">
  1154 + // 此次停机耗时:
  1155 + // <span className="conent6">
  1156 + // 约:
  1157 + // {diffHours}时 {diffMins}分 {diffSecs}秒
  1158 + // </span>
  1159 + // </div>
  1160 + // <div className="conent7">
  1161 + // <Button size="large" type="primary" className={styles.btnWg} onClick={minimize} > 最小化 </Button>
  1162 + // <Button size="large" type="primary" className={styles.btnWg} onClick={handleMenuClose} > 退出 </Button>
  1163 + // </div>
  1164 + // </div>
  1165 + // );
  1166 + // };
  1167 +
  1168 + export default MachineTasks;
... ...