tab.js
18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
import React from 'react';
import { connect } from 'dva';
import { Icon as LegacyIcon } from '@ant-design/compatible';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { Tabs, Modal } from 'antd';
import CommonList from '@/routes/commonList/commonList';/* 公共列表 */
import CommonListA from '@/routes/commonList/commonListA'; /* 无需注册模块验证的公共列表 */
import CommonListEdit from '@/routes/commonList/commonListEdit'; /* 可编辑公共列表 */
import CommonListTab from '@/routes/commonList/commonListTab'; /* 多个列表 */
import CommonListLeft from '@/routes/commonList/commonListLeft';/* 左侧树形 */
import CommonColumnList from '@/routes/commonColumnList/commonColumnList';/* 公共自定义标题列表 */
import CommonListTree from '@/routes/commonListTree/commonListTree';/* 两层通用结构commonListTree,功能如物料需求计划 */
import CommonGatte from '@/routes/commonGatte/commonGatte';/* 甘特图列表 */
import MaterialRequirementsPlanning from '@/routes/materialRequirementsPlanning/materialRequirementsPlanning';/* 物料需求计划 */
import CommonClassify from '@/routes/commonClassify/commonClassify';/* 公共分类 */
import CustomerInfo from '@/routes/basicInfoSetting/customerInfo/customerInfo';/* 客户信息 */
import KnifemouldInfo from '@/routes/basicInfoSetting/knifemouldInfo/knifemouldInfo';/* 刀模信息 */
import TestStandInfo from '@/routes/basicInfoSetting/teststandInfo/teststandInfo';/* 刀模信息 */
import Materiel from '@/routes/basicInfoSetting/materiel/materiel';/* 物料信息 */
import Employee from '@/routes/basicInfoSetting/employee/employee';/* 职员信息 */
import PrintInfo from '@/routes/basicInfoSetting/printInfo/printInfo';/* 印件信息 */
import SystemSetting from '@/routes/basicInfoSetting/systemSetting/systemSetting';/* 印件信息 */
import SupplyInfo from '@/routes/basicInfoSetting/supplyInfo/supplyInfo';/* 权限分配 */
import ProcessInfo from '@/routes/basicInfoSetting/processInfo/processInfo';/* 工序信息 */
import SftLoginInfo from '@/routes/basicInfoSetting/sftLoginInfo/sftLoginInfo';/* 用户管理 */
import Commonstyle from '@/routes/basicInfoSetting/commonStyle/commonStyle';/* 常用规格 */
import CheckModel from '@/routes/basicInfoSetting/checkModel/checkModel';/* 审核模板 */
import CheckPhase from '@/routes/basicInfoSetting/checkPhase/checkPhase';/* 审核阶段 */
import WorkOrderNew from '@/routes/manufacture/workOrder/workOrder';/* 生产施工单 */
import WorkOrderPack from '@/routes/manufacture/workOrderPack/workOrderPack';/* 包装施工单 */
import WorkOrderPackTableTree from '@/routes/manufacture/workOrderPackTableTree/workOrderPackTableTree';/* 包装施工单 */
import WorkOrderResearchTableTree from '@/routes/manufacture/workOrderResearchTableTree/workOrderResearchTableTree';/* 研发工单 */
import ProductClassify from '@/routes/basicInfoSetting/productClassify/productClassify';/* 印件分类信息 */
import IndexCenter from '@/routes/indexCenter/indexCenter';/* 首页 */
import TabComponent from '@/components/Tab/TabComponent';
import styles from '@/index.less';
import CommonBill from '@/routes/common/commonBill';/* 通用单据页 */
import CommonCheckBill from '@/routes/common/commonCheckBill';/* 通用预览单据页 */
import CommonChar from '@/routes/commonChar/commonChar';/* 通用图表页 */
import CommonAuto from '@/routes/commonAuto/commonAuto';/* 通用自定义界面 */
import ProductionPlan from '@/routes/productionPlan/productionPlan';/* 生产排程 */
import EleteamInfo from '@/routes/common/eleteamInfo';/* 班组信息页 新 */
import SisFormulaInfo from '@/routes/basicInfoSetting/sisFormula/sisFormulaInfo';
import EleMachineInfo from '@/routes/basicInfoSetting/machineInfo/eleMachineInfo';/* 设备信息 */
import SystemPermissionInfo from '@/routes/basicInfoSetting/systemPermission/systemPermissionInfo';/* 设备信息 */
import ImportDataInfo from '@/routes/importData/importData';/* 设备信息 */
import PaymentTermsInfo from '@/routes/basicInfoSetting/paymentInfo/paymentInfoTerms';
import ProductionReport from '@/routes/basicInfoSetting/productReport/productReport';/* 产量上报 */
import ProductionMainPlan from '@/routes/productionMainPlan/productionMainPlan';/* 新生产主计划 */
import ProductionPlanInfo from '@/routes/productionPlan/productionPlanInfo';/* 新生产排程 */
import ProductionPlanOutside from '@/routes/productionPlan/productionPlanOutside';/* 发外排程 */
import ProductionSchedule from '@/routes/productionSchedule/productionScheduleInfo';/* 生产排程甘特图 */
import ProductionScheduleTree from '@/routes/productionScheduleTree/productionScheduleTree';/* 生产排程tree(金宣发) */
import ProductionPlanChangeMachine from '@/routes/productionPlan/productionPlanChangeMachineInfo';/* 新生产排程 更换班组机台 */
import AuditInformation from '@/routes/basicInfoSetting/auditInformation/auditInformation';/* 审核信息 */
import Quotation from '@/routes/quoQuotation/quotation/quotation';/* 审核信息 */
import QuotationPackTableTree from '@/routes/quoQuotation/quotationPackTableTree/quotationPackTableTree';/* 报价单(包装) */
import QuotationPack from '@/routes/quoQuotation/quotationPack/quotationPack';/* 报价单(套装) */
// import QuotationPack from '@/routes/quoQuotation/quotationPackTableTree/quotationPackTableTree';/* 报价单(包装)s */
// import QuotationPackTableTree from '@/routes/quoQuotation/quoQuotation/quoQuotation';/* 报价单(包装) */
import ProductionUnifiedPlanning from '@/routes/productionMainPlan/productionUnifiedPlanning';/* 主计划统一规划 */
import CommonNewBill from '@/routes/common/commonNewBill';/* 通用单据页 */
import CommonNewTabBill from '@/routes/common/commonNewTabBill';/* 通用单据页 */
import CommonCostomTabBill from '@/routes/common/commonCostomTabBill';
import CommonNewListBill from '@/routes/common/commonNewListBill';/* 通用单据页 */
import CommonGroupBill from '@/routes/common/commonGroupBill';/* 通用单据页 */
import CommonBillDeliver from '@/routes/common/commonBillDeliver'; /* 送货单个性化 */
import CommonSubBill from '@/routes/common/commonSubBill'; /* 通用嵌套子表单据 */
import ProcessCardInfo from '@/routes/manufacture/processCard/processCardInfo';
import ProcessCardInfoPack from '@/routes/manufacture/processCardPack/processCardInfoPack';
import ProcessCardPackTableTree from '@/routes/manufacture/processCardPackTableTree/processCardPackTableTree';
import ProcessCardPackTableTreeNew from '@/routes/manufacture/processCardPackTableTreeNew/processCardPackTableTreeNew';
import WorkOrderPackTableTreeNew from '@/routes/manufacture/workOrderPackTableTreeNew/workOrderPackTableTreeNew';
import SysMsgInfo from '@/routes/basicInfoSetting/mailMsg/sysMsgInfo';
import PrintLabel from '@/routes/basicInfoSetting/printLabel/printLabel';
import MonthEndingClosing from '@/routes/basicInfoSetting/closeAccounts/monthEndingClosing';
import { sendWebSocketMessage } from '@/components/Common/commonFunc';
import { isNotEmptyObject, isNotEmptyArr } from '@/utils/utils'; /* 通用方法 */
import PrintPdf from '../printPdf/printPdf'; /* 单预览 */
import Feedback from '../feedback/feedback';
/* 计算方案s */
const { confirm } = Modal;
const { TabPane } = Tabs;
function Tab({ dispatch, app }) {
const { panes } = app;
let paneType = '';
const tagArr = panes.filter(item => item.newRecordFlag !== undefined);
const tagLastKey = tagArr !== undefined && tagArr.length > 0 ? tagArr[tagArr.length - 1].key : '';
const tabpanes = panes.map((pane) => {
const bRecordFlagDisabled = (tagArr.length > 0 && pane.key !== tagLastKey);
let content = '';
if (pane.route === '/indexPage/commonList') {
content = <CommonList />;
} else if (pane.route === '/indexPage/commonListA') {
content = <CommonListA />;
} else if (pane.route === '/indexPage/commonListEdit') {
content = <CommonListEdit />;
} else if (pane.route === '/indexPage/commonListTab') {
content = <CommonListTab />;
} else if (pane.route === '/indexPage/commonColumnList') {
content = <CommonColumnList />;
} else if (pane.route === '/indexPage/commonListTree') {
content = <CommonListTree />;
} else if (pane.route === '/indexPage/commonListLeft') {
content = <CommonListLeft />;
} else if (pane.route === '/indexPage/commonGatte') {
content = <CommonGatte />;
} else if (pane.route === '/indexPage/materialRequirementsPlanning') {
content = <MaterialRequirementsPlanning />;
} else if (pane.route === '/indexPage/commonClassify') {
content = <CommonClassify />;
} else if (pane.route === '/indexPage/elecustomer') {
content = <CustomerInfo />;
} else if (pane.route === '/indexPage/eleknifemould') {
content = <KnifemouldInfo />;
} else if (pane.route === '/indexPage/eleteststand') {
content = <TestStandInfo />;
} else if (pane.route === '/indexPage/eleemployee') {
content = <Employee />;
} else if (pane.route === '/indexPage/elematerials') {
content = <Materiel />;
} else if (pane.route === '/indexPage/eleproduct') {
content = <PrintInfo />;
} else if (pane.route === '/indexPage/syssystemsettings') {
content = <SystemSetting />;
} else if (pane.route === '/indexPage/elesupply') {
content = <SupplyInfo />;
} else if (pane.route === '/indexPage/eleprocess') {
content = <ProcessInfo />;
} else if (pane.route === '/indexPage/elecheckmodel') {
content = <CheckModel />;
} else if (pane.route === '/indexPage/sischeckphase') {
content = <CheckPhase />;
} else if (pane.route === '/indexPage/sftlogininfo') {
content = <SftLoginInfo />;
} else if (pane.route === '/indexPage/siscommonstyle') {
content = <Commonstyle />;
} else if (pane.route === '/indexPage/sisproductclassify') {
content = <ProductClassify />;
} else if (pane.route === '/indexPage/commonBill') {
content = <CommonBill />;
} else if (pane.route === '/indexPage/commonCheckBill') {
content = <CommonCheckBill />;
} else if (pane.route === '/indexPage/workOrderNew') {
content = <WorkOrderNew />;
} else if (pane.route === '/indexPage/workOrderPack') {
content = <WorkOrderPack />;
} else if (pane.route === '/indexPage/workOrderPackTableTree') {
content = <WorkOrderPackTableTree />;
} else if (pane.route === '/indexPage/workOrderResearchTableTree') {
content = <WorkOrderResearchTableTree />;
} else if (pane.route === '/indexPage/processCard') {
content = <ProcessCardInfo />;
} else if (pane.route === '/indexPage/processCardPack') {
content = <ProcessCardInfoPack />;
} else if (pane.route === '/indexPage/processCardPackTableTree') {
content = <ProcessCardPackTableTree />;
} else if (pane.route === '/indexPage/processCardPackTableTreeNew') {
content = <ProcessCardPackTableTreeNew />;
} else if (pane.route === '/indexPage/workOrderPackTableTreeNew') {
content = <WorkOrderPackTableTreeNew />;
} else if (pane.route === '/indexPage/productionPlan') {
content = <ProductionPlan />;
} else if (pane.route === '/indexPage/commonChar') {
content = <CommonChar />;
} else if (pane.route === '/indexPage/commonAuto') {
content = <CommonAuto />;
} else if (pane.route === '/indexPage/eleteamInfo') {
content = <EleteamInfo />;
} else if (pane.route === '/indexPage/sisformulaInfo') {
content = <SisFormulaInfo />;
} else if (pane.route === '/indexPage/elemachineInfo') {
content = <EleMachineInfo />;
} else if (pane.route === '/indexPage/systemPermission') {
content = <SystemPermissionInfo />;
} else if (pane.route === '/indexPage/importData') {
content = <ImportDataInfo />;
} else if (pane.route === '/indexPage/sispaymentTerms') {
content = <PaymentTermsInfo />;
} else if (pane.route === '/indexPage/productionReport') {
content = <ProductionReport />;
} else if (pane.route === '/indexPage/productionMainPlan') {
content = <ProductionMainPlan />;
} else if (pane.route === '/indexPage/productionPlanInfo') {
content = <ProductionPlanInfo />;
} else if (pane.route === '/indexPage/productionPlanOutside') {
content = <ProductionPlanOutside />;
} else if (pane.route === '/indexPage/productionSchedule') {
content = <ProductionSchedule />;
} else if (pane.route === '/indexPage/productionScheduleTree') {
content = <ProductionScheduleTree />;
} else if (pane.route === '/indexPage/auditInformation') {
content = <AuditInformation />;
} else if (pane.route === '/indexPage/mailMsg') {
content = <SysMsgInfo />;
} else if (pane.route === '/indexPage/printlabel') {
content = <PrintLabel />;
} else if (pane.route === '/indexPage/monthEndingClosing') {
content = <MonthEndingClosing />;
} else if (pane.route === '/indexPage/quotation') {
content = <Quotation />;
} else if (pane.route === '/indexPage/quotationPack') {
content = <QuotationPack />;
} else if (pane.route === '/indexPage/quotationPackTableTree') {
content = <QuotationPackTableTree />;
} else if (pane.route === '/indexPage/unifiedPlanning') {
content = <ProductionUnifiedPlanning />;
} else if (pane.route === '/indexPage/productionPlanChangeMachine') {
content = <ProductionPlanChangeMachine />;
} else if (pane.route === '/indexPage/commonBillDeliver') {
content = <CommonBillDeliver />;
} else if (pane.route === '/indexPage/commonSubBill') {
content = <CommonSubBill />;
} else if (pane.route === '/indexPage/commonNewBill') {
content = <CommonNewBill />;
} else if (pane.route === '/indexPage/commonNewTabBill') {
content = <CommonNewTabBill />;
} else if (pane.route === '/indexPage/commonCostomTabBill') {
content = <CommonCostomTabBill />;
} else if (pane.route === '/indexPage/commonNewListBill') {
content = <CommonNewListBill />;
} else if (pane.route === '/indexPage/commonGroupBill') {
content = <CommonGroupBill />;
} else if (pane.route === '/indexPage/printPdf') {
content = <PrintPdf />;
} else if (pane.route === '/indexPage/feedback') {
content = <Feedback />;
} else {
content = <IndexCenter />;
}
if (pane.paneType) {
paneType = <span><LegacyIcon type={pane.paneType} />{pane.title}</span>;
} else {
paneType = <span>{pane.title}</span>;
}
return (
<TabPane tab={paneType} closable={pane.paneType !== 'home'} disabled={bRecordFlagDisabled} key={pane.key} className={styles.tabPane}>
{content}
</TabPane>
);
});
const totalProps = {
tabpanes,
app,
onSaveCurrentPane: saveCurrentPane,
onRemove: removePane,
};
const handleSendSocketMessage = (flag, showType, sId, sendTo, msgInfo, param) => {
const { token } = app;
const sendws = handleSendWebSocketMsg;
if (isNotEmptyObject(token)) {
if (app.webSocket !== null && app.webSocket.readyState === WebSocket.OPEN) {
sendws(flag, showType, msgInfo, sId, sendTo, param);
} else {
dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });
setTimeout(() => {
sendws(flag, showType, msgInfo, sId, sendTo, param);
}, 30000);
}
}
};
const handleSendWebSocketMsg = (flag, showType, msgInfo, sId, sendTo, param) => {
const { webSocket, userinfo, currentPane } = app;
const { key } = currentPane;
sendWebSocketMessage(webSocket, key, flag, showType, userinfo.sId, msgInfo, sId, sendTo, param);
};
function saveCurrentPane(currentPane) {
dispatch({ type: 'app/saveCurrentPane', payload: { currentPane } });
}
const clearWebSocketMsg = (i) => {
const { userinfo } = app;
const { copyTo } = i;
if (isNotEmptyObject(copyTo)) {
const {
slaveData, srcFormRoute, copyOtherData, masterData, copyToDataSid,
} = copyTo;
const sIdArray = [...copyToDataSid || []];
if (!i?.checkedId) {
if (isNotEmptyObject(srcFormRoute) && srcFormRoute.includes('materialRequirementsPlanning')) { /* 物料需求计划用sWorkOrderMaterialId作为唯一键 */
if (isNotEmptyArr(copyOtherData) && copyOtherData[0]?.name === 'detail' && isNotEmptyArr(copyOtherData[0]?.data)) {
const slaveDetailData = copyOtherData[0].data;
slaveDetailData.forEach((item) => {
const redisKey = item.sWorkOrderMaterialId;
sIdArray.push(redisKey);
});
} else { /* 变更单、采购申请单 */
slaveData.forEach((item) => {
const redisKey = item.sWorkOrderMaterialId;
sIdArray.push(redisKey);
});
}
}
}
if (isNotEmptyObject(masterData) &&
isNotEmptyObject(masterData.sSrcSlaveId)) {
sIdArray.push(masterData.sSrcSlaveId);
}
if (Array.isArray(slaveData)) {
slaveData.forEach((item) => {
const redisKey = item.sSlaveId;
sIdArray.push(redisKey);
});
}
const sId = [...new Set(sIdArray)].filter(Boolean).toString();
handleSendSocketMessage('copyfinish', 'noAction', sId, userinfo.sId, null, null);
}
handleSendSocketMessage('release', 'noAction', i?.checkedId || '', userinfo.sId, null, null);
handleSendSocketMessage('release', 'noAction', i?.formId || '', userinfo.sId, null, null);
};
function removePane(changePanes, currentPane, removePane) {
const removeData = Array.isArray(removePane) ? removePane.filter(Boolean) : [];
if (removePane && removePane.length === 1 && removePane[0] && removePane[0].fromKey) {
const currentPaneNew = changePanes.find(item => item.key === removePane[0].fromKey);
if (currentPaneNew) {
currentPane = currentPaneNew;
}
}
if (removePane && removePane[0]) {
const isProductionScheduleTree = removePane[0].route.indexOf('systemPermission') > -1 ||
(removePane[0].route.indexOf('production') > -1);
if (isProductionScheduleTree) {
removeData.forEach((i) => {
clearWebSocketMsg(i);
});
dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
return;
}
}
if (app.diffMap && removePane[0] && app.diffMap.get(removePane[0].key)) {
confirm({
icon: <ExclamationCircleOutlined />,
content: '内容未保存,是否离开?',
onOk() {
removeData.forEach((i) => {
clearWebSocketMsg(i);
});
dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
},
onCancel() {
console.log('取消关闭');
},
});
} else {
removeData.forEach((i) => {
clearWebSocketMsg(i);
});
dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
}
}
return (
<div style={{ height: '100%' }}>
<TabComponent {...totalProps} />
</div>
);
}
export default connect(({ app }) => ({ app }))(Tab);