index.js
7.99 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
import React, { useEffect } from "react";
import * as commonUtils from "@/utils/utils";
import useCommonBase from "@/components/Common/CommonHooks/useCommonBase";
import ShowType from "@/components/Common/CommonComponent";
import styles from "./index.less";
const usePrenatalReminderInfoEvent = props => {
const { formData } = props;
useEffect(
async () => {
if (commonUtils.isNotEmptyArr(formData)) {
const result = await handleGetData(formData[0]);
const result1 = await handleGetData(formData[1], 1);
const result2 = await handleGetData(formData[2], 2);
props.onSaveState({
...result,
...result1,
...result2,
slaveConfig: formData[0],
slave1Config: formData[1],
slave2Config: formData[2],
bFinish: true
});
}
},
[formData]
);
// 获取数据集
const handleGetData = async (config, index = "") => {
const { app } = props;
const { userinfo = {} } = app;
const globalData = commonUtils.convertStrToObj(
localStorage.xlybusinessglobalData
);
const { sWorkshopId } = userinfo;
const { currentSelectedMachineTaskDataRow = {} } = globalData;
const { sOrderId } = currentSelectedMachineTaskDataRow;
const conditonValues = props.onGetSqlConditionValues(config);
const addState =
(await props.onGetDataSet({
name: `slave${index}`,
configData: config,
condition: {
sSqlCondition: {
...conditonValues,
sWorkshopId,
sOrderId
}
},
isWait: true
})) || {};
return addState;
};
return {
...props
};
};
const PrenatalReminderInfo = baseProps => {
const props = usePrenatalReminderInfoEvent(useCommonBase(baseProps));
const { bFinish } = props;
if (!bFinish) return "";
const { app, slaveData, slave1Data, slave2Data, slave2Config } = props;
const viewRow1 = commonUtils.isNotEmptyArr(slaveData) ? slaveData[0] : {};
const viewRow2 = commonUtils.isNotEmptyArr(slave1Data) ? slave1Data[0] : {};
const viewRow3 = commonUtils.isNotEmptyArr(slave2Data) ? slave2Data[0] : {};
const viewRow = { ...viewRow1, ...viewRow2, ...viewRow3 };
const tableName = "slave";
const memoListFilter =
slave2Config?.gdsconfigformslave
.filter(item => item.bVisible)
.map(({ sName, showName }) => ({ sName, showName })) || [];
const leftSize = Math.ceil(memoListFilter.length / 2);
const rightSize = memoListFilter.length - leftSize;
const leftMemoList = memoListFilter.slice(0, leftSize);
const rightMemoList = memoListFilter.slice(leftSize, memoListFilter.length);
return (
<div className={styles.prenatalReminderInfo}>
{[
"技术评审汇签",
"客户投诉",
"本批生产注意事项",
"不合格报告",
"车间产前提醒(品管)",
"制程异常",
"质检反馈",
"二维码提醒",
"车间产前提醒"
].map((title, index) => {
let dataValueNew = "";
const child = {
sId: commonUtils.createSid(),
sName: `sTempMemo${index}`,
sControlName: "",
bVisible: true,
showName: title
};
const memoList = new Array(20)
.fill("")
.map((_, i) => viewRow[`sNoteMemo${i + 1}`]);
const getMemoValue = (from, to) => {
const tempList = memoList
.slice(from, to)
.filter(item => item !== undefined)
.map((item, i) => `${i + 1}) ${item}`);
return tempList.join("\n");
};
if (title === "客户投诉") {
dataValueNew = getMemoValue(0, 4);
} else if (title === "不合格报告") {
dataValueNew = getMemoValue(4, 8);
} else if (title === "制程异常") {
dataValueNew = getMemoValue(8, 12);
} else if (title === "质检反馈") {
dataValueNew = getMemoValue(12, 16);
} else if (title === "车间产前提醒(品管)") {
dataValueNew = viewRow.sMemo;
} else if (title === "本批生产注意事项") {
dataValueNew = getMemoValue(16, 20);
} else if (title === "技术评审汇签") {
const dataValue1 = leftMemoList
.map(
({ sName, showName }) => `${showName}:${viewRow[sName] || ""}`
)
.join("\n");
const dataValue2 = rightMemoList
.map(
({ sName, showName }) => `${showName}:${viewRow[sName] || ""}`
)
.join("\n");
const showTypeProps1 = {
app,
className: styles.showType,
iColValue: 24,
name: tableName,
record: viewRow,
sId: commonUtils.createSid(),
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
onChange: props.onDataChange,
showConfig: { ...child, costomStyle: styles.hideRightBorder },
slaveConfig: props[`${tableName}Config`],
formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } },
textArea: true,
enabled: false,
dataValue: dataValue1,
bTable: true,
bViewTable: true,
formRoute: props.formRoute,
getDateFormat: props.getDateFormat
};
const showTypeProps2 = {
app,
className: styles.showType,
iColValue: 24,
name: tableName,
record: viewRow,
sId: commonUtils.createSid(),
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
onChange: props.onDataChange,
showConfig: { ...child, costomStyle: styles.hideLeftBorder },
slaveConfig: props[`${tableName}Config`],
formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } },
textArea: true,
enabled: false,
dataValue: dataValue2,
bTable: true,
bViewTable: true,
formRoute: props.formRoute,
getDateFormat: props.getDateFormat
};
return (
<div>
<div className={styles.title}>{title}</div>
<div className={styles.content1}>
<ShowType {...showTypeProps1} />
<ShowType {...showTypeProps2} />
</div>
</div>
);
}else if(title === '车间产前提醒'){
dataValueNew = viewRow?.sCjMemo
}else if(title === '二维码提醒'){
dataValueNew = viewRow?.sBarcodeMemo
}
const showTypeProps = {
app,
className: styles.showType,
iColValue: 24,
name: tableName,
record: viewRow,
sId: commonUtils.createSid(),
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
onChange: props.onDataChange,
showConfig: child,
slaveConfig: props[`${tableName}Config`],
formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } },
textArea: true,
enabled: false,
dataValue: dataValueNew,
bTable: true,
bViewTable: true,
formRoute: props.formRoute,
getDateFormat: props.getDateFormat
};
return (
<div>
<div className={styles.title}>{title}</div>
<div className={styles.content}>
<ShowType {...showTypeProps} />
</div>
</div>
);
})}
</div>
);
};
export default PrenatalReminderInfo;