ztxkui 2.4.5 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  export declare const getTableLayoutFullData: (columns: any, tableLayout: any) => any;
3
+ /**
4
+ * 详情拿到的数据,一般是这个样子的
5
+ * {
6
+ * cpcc: '1',
7
+ * pm: 'pm1',
8
+ * cz: 'cz1',
9
+ * gg: 'gg1',
10
+ * cd: 'cd1',
11
+ * }
12
+ */
3
13
  declare const TableDemo: () => JSX.Element;
4
14
  export default TableDemo;
@@ -17,7 +17,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
17
17
  import React, { useEffect, useState, useCallback, useRef } from 'react';
18
18
  import Table from 'components/Table';
19
19
  import EnhanceSelect from 'components/EnhanceSelect';
20
- import TestCom from './TestCom';
20
+ import TestCom, { clearData } from './TestCom';
21
21
  import { DatePicker } from 'index';
22
22
  import dayjs from 'dayjs';
23
23
  import update from 'immutability-helper';
@@ -30,6 +30,14 @@ function useGetTableRecords() {
30
30
  test1: index + 1 + "-test1",
31
31
  test2: index + 1 + "-test2",
32
32
  test3: index + 1 + "-test3",
33
+ materialId: 1,
34
+ brand: '123',
35
+ texture: 'HRB400E',
36
+ textureId: 1,
37
+ specification: 'Φ24mm*9m',
38
+ specificationId: 1,
39
+ placesteel: '萍钢',
40
+ placesteelId: 1,
33
41
  };
34
42
  })), records = _a[0], setRecords = _a[1];
35
43
  useEffect(function () {
@@ -109,173 +117,305 @@ export var getTableLayoutFullData = function (columns, tableLayout) {
109
117
  }
110
118
  return columns;
111
119
  };
120
+ // const list1 = [
121
+ // {
122
+ // id: '010101',
123
+ // name: '重轨',
124
+ // aboutField: {
125
+ // // 品名
126
+ // brand: {
127
+ // isRequired: 1, // 是否必填
128
+ // addonBefore: null, // 前置符
129
+ // addonAfter: null, // 后置符
130
+ // unit: null, // 单位
131
+ // connector: ' ', // 连接符
132
+ // },
133
+ // // 材质
134
+ // texture: {
135
+ // isRequired: 1, // 是否必填
136
+ // addonBefore: null, // 前置符
137
+ // addonAfter: null, // 后置符
138
+ // unit: null, // 单位
139
+ // connector: ' ', // 连接符
140
+ // },
141
+ // // 规格,一个产品层次可能对应多个规格
142
+ // specification: [
143
+ // {
144
+ // title: '单位重量',
145
+ // isRequired: 1, // 是否必填
146
+ // addonBefore: '$', // 前置符
147
+ // addonAfter: null, // 后置符
148
+ // unit: 'kg/m', // 单位
149
+ // connector: '*', // 连接符
150
+ // },
151
+ // {
152
+ // title: '长度',
153
+ // isRequired: 1, // 是否必填
154
+ // addonBefore: null, // 前置符
155
+ // addonAfter: null, // 后置符
156
+ // unit: 'm', // 单位
157
+ // connector: null, // 连接符
158
+ // },
159
+ // ],
160
+ // // 产地
161
+ // placesteel: {
162
+ // isRequired: 1, // 是否必填
163
+ // addonBefore: null, // 前置符
164
+ // addonAfter: null, // 后置符
165
+ // unit: null, // 单位
166
+ // connector: null, // 连接符
167
+ // },
168
+ // // 型号
169
+ // model: null,
170
+ // },
171
+ // },
172
+ // {
173
+ // id: '010102',
174
+ // name: '轻轨',
175
+ // aboutField: {
176
+ // // 品名
177
+ // brand: {
178
+ // isRequired: 1, // 是否必填
179
+ // addonBefore: null, // 前置符
180
+ // addonAfter: null, // 后置符
181
+ // unit: null, // 单位
182
+ // connector: ' ', // 连接符
183
+ // },
184
+ // // 材质
185
+ // texture: null,
186
+ // // 规格,一个产品层次可能对应多个规格
187
+ // specification: [
188
+ // {
189
+ // title: '单位重量',
190
+ // isRequired: 1, // 是否必填
191
+ // addonBefore: null, // 前置符
192
+ // addonAfter: null, // 后置符
193
+ // unit: 'kg/m', // 单位
194
+ // connector: '*', // 连接符
195
+ // },
196
+ // {
197
+ // title: '长度',
198
+ // isRequired: 1, // 是否必填
199
+ // addonBefore: null, // 前置符
200
+ // addonAfter: null, // 后置符
201
+ // unit: 'm', // 单位
202
+ // connector: null, // 连接符
203
+ // },
204
+ // ],
205
+ // // 产地
206
+ // placesteel: {
207
+ // isRequired: 1, // 是否必填
208
+ // addonBefore: null, // 前置符
209
+ // addonAfter: null, // 后置符
210
+ // unit: null, // 单位
211
+ // connector: null, // 连接符
212
+ // },
213
+ // // 型号
214
+ // model: null,
215
+ // },
216
+ // },
217
+ // {
218
+ // id: '010203',
219
+ // name: '角钢',
220
+ // aboutField: {
221
+ // // 品名
222
+ // brand: {
223
+ // isRequired: 1, // 是否必填
224
+ // addonBefore: null, // 前置符
225
+ // addonAfter: null, // 后置符
226
+ // unit: null, // 单位
227
+ // connector: ' ', // 连接符
228
+ // },
229
+ // // 材质
230
+ // texture: {
231
+ // isRequired: 1, // 是否必填
232
+ // addonBefore: null, // 前置符
233
+ // addonAfter: null, // 后置符
234
+ // unit: null, // 单位
235
+ // connector: null, // 连接符
236
+ // },
237
+ // // 规格,一个产品层次可能对应多个规格
238
+ // specification: [
239
+ // {
240
+ // title: '边宽度1',
241
+ // isRequired: 1, // 是否必填
242
+ // addonBefore: null, // 前置符
243
+ // addonAfter: null, // 后置符
244
+ // unit: null, // 单位
245
+ // connector: '*', // 连接符
246
+ // valueType: 'select',
247
+ // source: '/api/test/111',
248
+ // },
249
+ // {
250
+ // title: '边宽度2',
251
+ // isRequired: 1, // 是否必填
252
+ // addonBefore: null, // 前置符
253
+ // addonAfter: null, // 后置符
254
+ // unit: null, // 单位
255
+ // connector: '*', // 连接符
256
+ // },
257
+ // {
258
+ // title: '边厚度',
259
+ // isRequired: 1, // 是否必填
260
+ // addonBefore: null, // 前置符
261
+ // addonAfter: null, // 后置符
262
+ // unit: 'mm', // 单位
263
+ // connector: ' ', // 连接符
264
+ // },
265
+ // {
266
+ // title: '长度',
267
+ // isRequired: 1, // 是否必填
268
+ // addonBefore: null, // 前置符
269
+ // addonAfter: null, // 后置符
270
+ // unit: 'm', // 单位
271
+ // connector: '', // 连接符
272
+ // },
273
+ // ],
274
+ // // 产地
275
+ // placesteel: {
276
+ // isRequired: 1, // 是否必填
277
+ // addonBefore: null, // 前置符
278
+ // addonAfter: null, // 后置符
279
+ // unit: null, // 单位
280
+ // connector: ' ', // 连接符
281
+ // },
282
+ // // 型号
283
+ // model: null,
284
+ // },
285
+ // },
286
+ // ];
112
287
  var list1 = [
113
288
  {
114
- id: '010101',
115
- name: '重轨',
116
- aboutField: {
117
- // 品名
118
- brand: {
119
- isRequired: 1,
120
- addonBefore: null,
121
- addonAfter: null,
122
- unit: null,
123
- connector: ' ', // 连接符
124
- },
125
- // 材质
126
- texture: {
127
- isRequired: 1,
128
- addonBefore: null,
129
- addonAfter: null,
130
- unit: null,
131
- connector: ' ', // 连接符
132
- },
133
- // 规格,一个产品层次可能对应多个规格
134
- specifications: [
135
- {
136
- title: '单位重量',
137
- isRequired: 1,
138
- addonBefore: null,
139
- addonAfter: null,
140
- unit: 'kg/m',
141
- connector: '*', // 连接符
142
- },
143
- {
144
- title: '长度',
145
- isRequired: 1,
146
- addonBefore: null,
147
- addonAfter: null,
148
- unit: 'm',
149
- connector: null, // 连接符
150
- },
151
- ],
152
- // 产地
153
- placesteel: {
154
- isRequired: 1,
155
- addonBefore: null,
156
- addonAfter: null,
157
- unit: null,
158
- connector: null, // 连接符
159
- },
160
- // 型号
161
- model: null,
162
- },
289
+ id: 1,
290
+ createUser: null,
291
+ createDept: null,
292
+ createTime: null,
293
+ updateUser: null,
294
+ updateTime: null,
295
+ status: 50,
296
+ isDeleted: 0,
297
+ xid: null,
298
+ materialCode: '010301060000000001',
299
+ materialDesc: '螺纹钢 HRB400E',
300
+ productLevelId: 4,
301
+ productLevelCode: '010207',
302
+ productLevelName: '带肋钢筋',
303
+ brandId: 1,
304
+ brandName: '螺纹钢',
305
+ textureId: 1,
306
+ textureName: 'HRB400E',
307
+ specificationId: null,
308
+ specificationName: null,
309
+ productModel: null,
310
+ placesteelId: null,
311
+ placesteelName: null,
312
+ workmanship: null,
313
+ workmanshipId: null,
314
+ packingMethodId: null,
315
+ packingMethodName: null,
316
+ variety: null,
317
+ unitCode: 'T',
318
+ unitName: '吨',
319
+ trademarkId: null,
320
+ trademarkName: null,
321
+ strengthGrade: null,
322
+ purpose: null,
323
+ materialType: '1',
324
+ foreignTradeFlag: '1',
325
+ poUnitCode: 'T',
326
+ poUnitName: '吨',
163
327
  },
164
328
  {
165
- id: '010102',
166
- name: '轻轨',
167
- aboutField: {
168
- // 品名
169
- brand: {
170
- isRequired: 1,
171
- addonBefore: null,
172
- addonAfter: null,
173
- unit: null,
174
- connector: ' ', // 连接符
175
- },
176
- // 材质
177
- texture: null,
178
- // 规格,一个产品层次可能对应多个规格
179
- specifications: [
180
- {
181
- title: '单位重量',
182
- isRequired: 1,
183
- addonBefore: null,
184
- addonAfter: null,
185
- unit: 'kg/m',
186
- connector: '*', // 连接符
187
- },
188
- {
189
- title: '长度',
190
- isRequired: 1,
191
- addonBefore: null,
192
- addonAfter: null,
193
- unit: 'm',
194
- connector: null, // 连接符
195
- },
196
- ],
197
- // 产地
198
- placesteel: {
199
- isRequired: 1,
200
- addonBefore: null,
201
- addonAfter: null,
202
- unit: null,
203
- connector: null, // 连接符
204
- },
205
- // 型号
206
- model: null,
207
- },
329
+ id: 2,
330
+ createUser: null,
331
+ createDept: null,
332
+ createTime: '2022-03-16 16:00:39',
333
+ updateUser: null,
334
+ updateTime: '2022-03-16 16:00:43',
335
+ status: 50,
336
+ isDeleted: 0,
337
+ xid: null,
338
+ materialCode: '010301060000000002',
339
+ materialDesc: '螺纹钢 HRB300E',
340
+ productLevelId: 4,
341
+ productLevelCode: '010207',
342
+ productLevelName: '带肋钢筋',
343
+ brandId: 1,
344
+ brandName: '螺纹钢',
345
+ textureId: 2,
346
+ textureName: 'HRB300E',
347
+ specificationId: null,
348
+ specificationName: '',
349
+ productModel: '',
350
+ placesteelId: null,
351
+ placesteelName: '',
352
+ workmanship: '',
353
+ workmanshipId: null,
354
+ packingMethodId: null,
355
+ packingMethodName: '',
356
+ variety: '',
357
+ unitCode: 'T',
358
+ unitName: '吨',
359
+ trademarkId: null,
360
+ trademarkName: '',
361
+ strengthGrade: '',
362
+ purpose: '',
363
+ materialType: '1',
364
+ foreignTradeFlag: '1',
365
+ poUnitCode: 'T',
366
+ poUnitName: '吨',
208
367
  },
209
368
  {
210
- id: '010203',
211
- name: '角钢',
212
- aboutField: {
213
- // 品名
214
- brand: {
215
- isRequired: 1,
216
- addonBefore: null,
217
- addonAfter: null,
218
- unit: null,
219
- connector: ' ', // 连接符
220
- },
221
- // 材质
222
- texture: {
223
- isRequired: 1,
224
- addonBefore: null,
225
- addonAfter: null,
226
- unit: null,
227
- connector: null, // 连接符
228
- },
229
- // 规格,一个产品层次可能对应多个规格
230
- specifications: [
231
- {
232
- title: '边宽度1',
233
- isRequired: 1,
234
- addonBefore: null,
235
- addonAfter: null,
236
- unit: null,
237
- connector: '*',
238
- valueType: 'select',
239
- source: '/api/test/111',
240
- },
241
- {
242
- title: '边宽度2',
243
- isRequired: 1,
244
- addonBefore: null,
245
- addonAfter: null,
246
- unit: null,
247
- connector: '*', // 连接符
248
- },
249
- {
250
- title: '边厚度',
251
- isRequired: 1,
252
- addonBefore: null,
253
- addonAfter: null,
254
- unit: 'mm',
255
- connector: ' ', // 连接符
256
- },
257
- {
258
- title: '长度',
259
- isRequired: 1,
260
- addonBefore: null,
261
- addonAfter: null,
262
- unit: 'm',
263
- connector: '', // 连接符
264
- },
265
- ],
266
- // 产地
267
- placesteel: {
268
- isRequired: 1,
269
- addonBefore: null,
270
- addonAfter: null,
271
- unit: null,
272
- connector: ' ', // 连接符
273
- },
274
- // 型号
275
- model: null,
276
- },
369
+ id: 3,
370
+ createUser: null,
371
+ createDept: null,
372
+ createTime: '2022-03-16 16:00:39',
373
+ updateUser: null,
374
+ updateTime: '2022-03-16 16:00:43',
375
+ status: 50,
376
+ isDeleted: 0,
377
+ xid: null,
378
+ materialCode: '010301060000000003',
379
+ materialDesc: '方钢品名1 HRB300E',
380
+ productLevelId: 5,
381
+ productLevelCode: '010208',
382
+ productLevelName: '方钢',
383
+ brandId: 3,
384
+ brandName: '方钢品名1',
385
+ textureId: 4,
386
+ textureName: 'HRB300E',
387
+ specificationId: null,
388
+ specificationName: '',
389
+ productModel: '',
390
+ placesteelId: null,
391
+ placesteelName: '',
392
+ workmanship: '',
393
+ workmanshipId: null,
394
+ packingMethodId: null,
395
+ packingMethodName: '',
396
+ variety: '',
397
+ unitCode: 'T',
398
+ unitName: '',
399
+ trademarkId: null,
400
+ trademarkName: '',
401
+ strengthGrade: '',
402
+ purpose: '',
403
+ materialType: '1',
404
+ foreignTradeFlag: '1',
405
+ poUnitCode: 'T',
406
+ poUnitName: '',
277
407
  },
278
408
  ];
409
+ /**
410
+ * 详情拿到的数据,一般是这个样子的
411
+ * {
412
+ * cpcc: '1',
413
+ * pm: 'pm1',
414
+ * cz: 'cz1',
415
+ * gg: 'gg1',
416
+ * cd: 'cd1',
417
+ * }
418
+ */
279
419
  var TableDemo = function () {
280
420
  var _a = useGetTableRecords(), records = _a.records, setRecords = _a.setRecords;
281
421
  var _b = useGetSelectList(), list = _b.list, loading = _b.loading, setLoading = _b.setLoading;
@@ -305,12 +445,11 @@ var TableDemo = function () {
305
445
  render: function (_text, _record, index) { return "" + (index + 1); },
306
446
  },
307
447
  {
308
- title: '产品层次',
448
+ title: '物料信息列表',
309
449
  width: 100,
310
- dataIndex: 'key2',
311
- key: 'key2',
450
+ dataIndex: 'materialId',
451
+ key: 'materialId',
312
452
  shouldCellUpdate: function (record, preRecord) {
313
- console.log('key2render');
314
453
  if (lengthChange) {
315
454
  setLengthChange(false);
316
455
  return true;
@@ -319,22 +458,19 @@ var TableDemo = function () {
319
458
  setMoveChange(false);
320
459
  return true;
321
460
  }
322
- return record.key2 !== preRecord.key2;
461
+ return record.materialId !== preRecord.materialId;
323
462
  },
324
463
  render: function (text, record, index) {
325
- return (React.createElement(EnhanceSelect, { value: text, list: list1, dataKey: "id", titleKey: "name", onChange: function (value, option, fullData) {
326
- var newRecord = {
327
- key2: value,
328
- key2Name: fullData === null || fullData === void 0 ? void 0 : fullData.name,
329
- aboutField: fullData === null || fullData === void 0 ? void 0 : fullData.aboutField,
330
- };
464
+ return (React.createElement(EnhanceSelect, { value: text, list: list1, dataKey: "id", titleKey: "materialDesc", dropdownMatchSelectWidth: 130, onChange: function (value, option, fullData) {
465
+ var newRecord = __assign({ materialId: value, materialDesc: fullData === null || fullData === void 0 ? void 0 : fullData.materialDesc }, clearData);
466
+ console.log(newRecord);
331
467
  onEditableSaveHandle(newRecord, index);
332
468
  } }));
333
469
  },
334
470
  },
335
471
  {
336
472
  title: '物料选择相关',
337
- width: 700,
473
+ width: 400,
338
474
  dataIndex: 'key1',
339
475
  key: 'key1',
340
476
  shouldCellUpdate: function (record, preRecord) {
@@ -346,17 +482,15 @@ var TableDemo = function () {
346
482
  setMoveChange(false);
347
483
  return true;
348
484
  }
349
- return record.key1 !== preRecord.key1 || record.key2 !== preRecord.key2;
485
+ return (record.key1 !== preRecord.key1 ||
486
+ record.materialId !== preRecord.materialId);
350
487
  },
351
488
  render: function (text, record, index) {
352
- var aboutField;
353
- try {
354
- aboutField = JSON.stringify(record === null || record === void 0 ? void 0 : record.aboutField);
355
- }
356
- catch (err) {
357
- console.log(err);
358
- }
359
- return React.createElement(TestCom, { aboutField: aboutField, controleType: "hide" });
489
+ return (React.createElement(TestCom, { value: record, onlyDetail: true, materialId: record.materialId, onChange: function (value) {
490
+ console.log(value);
491
+ var newRecord = __assign({}, value);
492
+ onEditableSaveHandle(newRecord, index);
493
+ } }));
360
494
  },
361
495
  },
362
496
  {
@@ -1,18 +1,34 @@
1
1
  import React from 'react';
2
2
  import './style.scss';
3
- export interface IAboutField {
4
- isRequired: any;
5
- addonBefore: any;
6
- addonAfter: any;
7
- unit: any;
8
- connector: any;
9
- title?: string;
10
- }
3
+ /**
4
+ * @description 清空数据
5
+ */
6
+ export declare const clearData: {
7
+ brand: string;
8
+ brandId: string;
9
+ texture: string;
10
+ textureId: string;
11
+ specification: string;
12
+ specificationId: string;
13
+ placesteel: string;
14
+ placesteelId: string;
15
+ productModel: string;
16
+ workmanship: string;
17
+ workmanshipId: string;
18
+ packingMethod: string;
19
+ packingMethodId: string;
20
+ variety: string;
21
+ trademark: string;
22
+ strengthGrade: string;
23
+ purpose: string;
24
+ };
11
25
  interface IProps {
12
26
  value?: any;
13
27
  onChange?: any;
14
- aboutField?: any;
28
+ materialRef?: any;
15
29
  controleType?: 'disabled' | 'hide';
30
+ materialId?: any;
31
+ onlyDetail?: boolean;
16
32
  }
17
- declare const MaterialComp: React.FC<IProps>;
18
- export default MaterialComp;
33
+ declare const _default: React.NamedExoticComponent<IProps>;
34
+ export default _default;
@@ -9,64 +9,192 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import React, { useMemo, useEffect, useState } from 'react';
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import React, { useMemo, useEffect, useState, useImperativeHandle, useCallback, memo, } from 'react';
13
49
  import Form from '../components/Form';
14
50
  import SearchContainer from '../components/business/SearchContainer';
15
51
  import Input from '../components/Input';
16
52
  import Modal from '../components/Modal';
53
+ import { message, Row, Col } from 'index';
17
54
  import EnhanceSelect from 'components/EnhanceSelect';
18
55
  import './style.scss';
19
56
  import Button from 'components/Button';
57
+ import { stringify } from 'qs';
20
58
  var SearchItem = SearchContainer.SearchItem, SearchLeft = SearchContainer.SearchLeft;
21
59
  /**
22
- * 品名:brand
23
- * 材质:texture
24
- * 规格:specifications
25
- * 产地:placesteel
26
- * 型号:model
60
+ * @description 获取当前物料对应的配置信息
27
61
  */
28
- var width = '120px';
29
- var initConfigInfo = {
62
+ function getAttributeList(params) {
63
+ return fetch("http://192.168.0.83:8000/api/zmdms-mdm-data/newmaterialproductlevel/get-attribute-list?" + stringify(params), {
64
+ headers: {
65
+ 'Zmdms-Au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bGVfaHJfbmFtZSI6bnVsbCwiYWNjb3VudCI6ImNoZW55eCIsInJlc3VtZV9pZCI6bnVsbH0.oSoQWjOM_MBeo8trmJUaCcf9a2Dq7wgpCsD6_Ss5cyc',
66
+ },
67
+ method: 'get',
68
+ }).then(function (response) { return response.json(); });
69
+ }
70
+ function request(options) {
71
+ return fetch("http://192.168.0.83:8000" + options.url + "?" + stringify(options.params), {
72
+ headers: {
73
+ 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOiLpmYjkuprpm4QiLCJlbXBfbnVtYmVyIjoiWUcyMTA3MDA4IiwiaW10X2lkIjpudWxsLCJyZWFsX25hbWUiOiLpmYjkuprpm4QiLCJjbGllbnRfdHlwZSI6IndlYiIsImRhdGFfcm9sZV9pZCI6IjEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQxMjYxNDExMDY0NzM4NjExNCwxNDEyNjE1Njc3MTE5MjY2ODE3LDE0NDgxMjEwODY1MDQzMDA1NDYsMTQ1MjgyMDI5MzgwMjcxMzA5MCwxNDUzOTI1MDAxNTMxNDc4MDE3LDE0NTg3MTIwODIwODIzNTcyNTAsMTQ1ODgyNjIzODE4NTg4OTc5NCwxNDU4ODI3NzAxMDEyMzI0MzUzLDE0NTg4MjgzNjA4MDE1MDkzNzcsMTQ2MDA4OTI2MjAxMjAzMDk3NywxNDYxMTM3Nzg4NjQ1MTI2MTQ2LDE0NjgwMzUzNTE2MjUyODU2MzQsMTQ4MDgzMjc1MTgxMzE4MTQ0MiIsImNsaWVudF9pZCI6InN3b3JkIiwidXNlcl90eXBlIjoid2ViIiwicm9sZV9pZCI6IjE0MTI2MDg3NDI5NTMyODc2ODI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joiMTQxMjk1MzgwNDMzMzU1NTcxNCIsIm9yZ19pZCI6MTQ1NzUyNzc2NTkxODUxNTUzNSwibmlja19uYW1lIjoi6ZmI5Lqa6ZuEIiwiY29tcGFueV9uYW1lIjoi5rWZ5ZWG5Lit5ouT6ZuG5Zui54mp5rWB56eR5oqA5pyJ6ZmQ5YWs5Y-4IiwiZGVwdF9pZCI6IjEzOTcwODE5MzAzMjg0MjQ0NDkiLCJoYW5kbGVfaHJfbmFtZSI6bnVsbCwiYWNjb3VudCI6ImNoZW55eCIsInJlc3VtZV9pZCI6bnVsbH0.oSoQWjOM_MBeo8trmJUaCcf9a2Dq7wgpCsD6_Ss5cyc',
74
+ },
75
+ method: options.method,
76
+ }).then(function (response) {
77
+ return response.json();
78
+ });
79
+ }
80
+ /**
81
+ * @description 清空数据
82
+ */
83
+ export var clearData = {
84
+ brand: '',
85
+ brandId: '',
86
+ texture: '',
87
+ textureId: '',
88
+ specification: '',
89
+ specificationId: '',
90
+ placesteel: '',
91
+ placesteelId: '',
92
+ productModel: '',
93
+ workmanship: '',
94
+ workmanshipId: '',
95
+ packingMethod: '',
96
+ packingMethodId: '',
97
+ variety: '',
98
+ trademark: '',
99
+ strengthGrade: '',
100
+ purpose: '',
101
+ };
102
+ /**
103
+ * 品名:brand /zmdms-mdm-data/material-meta-info/brand-list
104
+ * 材质:texture /zmdms-mdm-data/material-meta-info/texture-list
105
+ * 规格:specification /zmdms-mdm-data/material-meta-info/specification-list
106
+ * 产地:placesteel /zmdms-mdm-data/material-meta-info/placesteel-list
107
+ * 型号:productModel 输入框
108
+ * 工艺:workmanship /zmdms-mdm-data/material-meta-info/workmanship-list
109
+ * 包装方式:packingMethod /zmdms-mdm-data/material-meta-info/packingMethod-list
110
+ * 品牌:variety 输入框
111
+ * 牌号:trademark 输入框
112
+ * 强度等级:strength_grade 输入框
113
+ * 用途:purpose 输入框
114
+ */
115
+ var width = '140px';
116
+ var initConfigInfo = {};
117
+ var listDataAbout = {
30
118
  brand: {
31
- isChangeable: 0,
32
- isDisplay: 1,
119
+ url: "/api/zmdms-mdm-data/material-meta-info/brand-list",
33
120
  },
34
121
  texture: {
35
- isChangeable: 0,
36
- isDisplay: 1,
122
+ url: "/api/zmdms-mdm-data/material-meta-info/texture-list",
37
123
  },
38
- specifications: {
39
- isChangeable: 0,
40
- isDisplay: 1,
124
+ specification: {
125
+ url: "/api/zmdms-mdm-data/material-meta-info/specification-list",
41
126
  },
42
127
  placesteel: {
43
- isChangeable: 0,
44
- isDisplay: 1,
45
- },
46
- model: {
47
- isChangeable: 0,
48
- isDisplay: 1,
49
- },
50
- };
51
- var list = [
52
- {
53
- id: '1',
54
- name: '&11kg*8',
128
+ url: "/api/zmdms-mdm-data/material-meta-info/placesteel-list",
55
129
  },
56
- {
57
- id: '2',
58
- name: '33m*44mm',
130
+ workmanship: {
131
+ url: "/api/zmdms-mdm-data/material-meta-info/workmanship-list",
59
132
  },
60
- {
61
- id: '3',
62
- name: '@17$22*22 22&',
133
+ packingMethod: {
134
+ url: "/api/zmdms-mdm-data/material-meta-info/packingMethod-list",
63
135
  },
64
- ];
136
+ };
65
137
  var MaterialComp = function (_a) {
66
- var value = _a.value, onChange = _a.onChange, aboutField = _a.aboutField, controleType = _a.controleType;
138
+ var value = _a.value, onChange = _a.onChange, _b = _a.controleType, controleType = _b === void 0 ? 'hide' : _b, materialRef = _a.materialRef, materialId = _a.materialId, onlyDetail = _a.onlyDetail;
67
139
  var form = Form.useForm()[0];
68
- var _b = useState(initConfigInfo), configInfo = _b[0], setConfigInfo = _b[1];
140
+ var _c = useState(initConfigInfo), configInfo = _c[0], setConfigInfo = _c[1];
141
+ var _d = useState({}), aboutFieldObj = _d[0], setAboutFieldObj = _d[1];
142
+ var _e = useState(), allValue = _e[0], setAllValue = _e[1];
69
143
  console.log('test render');
144
+ var newParams = useMemo(function () { return ({
145
+ materialId: materialId,
146
+ }); }, [materialId]);
147
+ /**
148
+ * 受控组件相关控制
149
+ */
150
+ useEffect(function () {
151
+ if (!onlyDetail) {
152
+ form.setFieldsValue(value);
153
+ }
154
+ }, [value, form, onlyDetail]);
155
+ useEffect(function () {
156
+ if (!onlyDetail && allValue) {
157
+ onChange && onChange(allValue);
158
+ }
159
+ }, [allValue, onChange, onlyDetail]);
160
+ /**
161
+ * @description 提供给外部调用的一些方法
162
+ */
163
+ useImperativeHandle(materialRef, function () { return ({
164
+ validate: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0: return [4 /*yield*/, form.validateFields()];
167
+ case 1: return [2 /*return*/, _a.sent()];
168
+ }
169
+ }); }); },
170
+ getData: function () { },
171
+ }); });
172
+ /**
173
+ * @description 获取当前物料相关的配置信息
174
+ */
175
+ useEffect(function () {
176
+ if (onlyDetail) {
177
+ return;
178
+ }
179
+ if (materialId) {
180
+ getAttributeList({ materialId: materialId })
181
+ .then(function (res) {
182
+ if (res.code === 200) {
183
+ // 数据转换
184
+ setAboutFieldObj((res === null || res === void 0 ? void 0 : res.data) || {});
185
+ }
186
+ })
187
+ .catch(function (err) {
188
+ message.error("\u6839\u636E\u7269\u6599\u53D6\u914D\u7F6E\u4FE1\u606F\u5931\u8D25\uFF0C\u8BF7\u5207\u6362\u91CD\u8BD5!");
189
+ });
190
+ }
191
+ else {
192
+ setAboutFieldObj({});
193
+ }
194
+ }, [materialId, onlyDetail]);
195
+ /**
196
+ * @description 看给组件配置的是隐藏下拉框 还是禁用下拉框 对应不同的控制器
197
+ */
70
198
  var controlConfigInfo = useMemo(function () {
71
199
  return controleType === 'hide'
72
200
  ? {
@@ -78,36 +206,23 @@ var MaterialComp = function (_a) {
78
206
  isChangeable: 0,
79
207
  };
80
208
  }, [controleType]);
81
- var aboutFieldObj = useMemo(function () {
82
- if (!aboutField) {
83
- return {};
84
- }
85
- var _aboutFieldObj;
86
- try {
87
- _aboutFieldObj = JSON.parse(aboutField);
88
- return _aboutFieldObj;
89
- }
90
- catch (err) {
91
- console.log(err);
92
- return {};
93
- }
94
- }, [aboutField]);
95
209
  /**
96
210
  * 根据外部参数变更内部内容
97
211
  */
98
212
  useEffect(function () {
213
+ if (onlyDetail) {
214
+ return;
215
+ }
99
216
  var _configInfo = {};
100
217
  Object.keys(aboutFieldObj).forEach(function (key) {
101
218
  var _a;
102
- if (key === 'specifications') {
219
+ if (key === 'specification') {
103
220
  // 规格需要做不同的处理
104
221
  if (!aboutFieldObj[key]) {
105
222
  _configInfo[key] = __assign({}, controlConfigInfo);
106
223
  }
107
224
  else {
108
- var isRequired = (_a = aboutFieldObj[key]) === null || _a === void 0 ? void 0 : _a.some(function (item) {
109
- return item.isRequired ? true : false;
110
- });
225
+ var isRequired = (_a = aboutFieldObj[key]) === null || _a === void 0 ? void 0 : _a.isRequired;
111
226
  _configInfo[key] = {
112
227
  isDisplay: 1,
113
228
  isChangeable: 1,
@@ -135,29 +250,94 @@ var MaterialComp = function (_a) {
135
250
  else {
136
251
  setConfigInfo(initConfigInfo);
137
252
  }
138
- }, [controlConfigInfo, aboutFieldObj]);
139
- return (React.createElement(Form, { name: "test-list", form: form, className: "table-form" },
253
+ }, [controlConfigInfo, aboutFieldObj, onlyDetail]);
254
+ /**
255
+ * @description 下拉框改变触发事件
256
+ */
257
+ var onSpecificationHandle = useCallback(function (value, option, fullData) {
258
+ setAllValue(function (preAllValue) { return (__assign(__assign({}, preAllValue), { specificationId: value, specification: fullData === null || fullData === void 0 ? void 0 : fullData.specificationName })); });
259
+ }, []);
260
+ var onAboutChangeHandle = useCallback(function (value, option, fullData, key) {
261
+ setAllValue(function (preAllValue) {
262
+ var _a;
263
+ return (__assign(__assign({}, preAllValue), (_a = {}, _a[key + "Id"] = value, _a[key] = fullData[key + "Name"], _a)));
264
+ });
265
+ }, []);
266
+ var onInputChangeHandle = useCallback(function (e, key) {
267
+ setAllValue(function (preAllValue) {
268
+ var _a;
269
+ return (__assign(__assign({}, preAllValue), (_a = {}, _a[key] = e.target.value, _a)));
270
+ });
271
+ }, []);
272
+ return onlyDetail ? (React.createElement(Row, null,
273
+ (value === null || value === void 0 ? void 0 : value.brand) ? React.createElement(Col, { span: 8 },
274
+ "\u54C1\u540D\uFF1A",
275
+ (value === null || value === void 0 ? void 0 : value.brand) || '') : '',
276
+ (value === null || value === void 0 ? void 0 : value.texture) ? React.createElement(Col, { span: 8 },
277
+ "\u6750\u8D28\uFF1A",
278
+ (value === null || value === void 0 ? void 0 : value.texture) || '') : '',
279
+ (value === null || value === void 0 ? void 0 : value.specification) ? (React.createElement(Col, { span: 8 },
280
+ "\u89C4\u683C\uFF1A",
281
+ (value === null || value === void 0 ? void 0 : value.specification) || '')) : (''),
282
+ (value === null || value === void 0 ? void 0 : value.placesteel) ? (React.createElement(Col, { span: 8 },
283
+ "\u4EA7\u5730\uFF1A",
284
+ (value === null || value === void 0 ? void 0 : value.placesteel) || '')) : (''),
285
+ (value === null || value === void 0 ? void 0 : value.productModel) ? (React.createElement(Col, { span: 8 },
286
+ "\u578B\u53F7\uFF1A",
287
+ (value === null || value === void 0 ? void 0 : value.productModel) || '')) : (''),
288
+ (value === null || value === void 0 ? void 0 : value.workmanship) ? (React.createElement(Col, { span: 8 },
289
+ "\u5DE5\u827A\uFF1A",
290
+ (value === null || value === void 0 ? void 0 : value.workmanship) || '')) : (''),
291
+ (value === null || value === void 0 ? void 0 : value.packingMethod) ? (React.createElement(Col, { span: 8 },
292
+ "\u5305\u88C5\u65B9\u5F0F\uFF1A",
293
+ (value === null || value === void 0 ? void 0 : value.packingMethod) || '')) : (''),
294
+ (value === null || value === void 0 ? void 0 : value.variety) ? React.createElement(Col, { span: 8 },
295
+ "\u54C1\u724C\uFF1A",
296
+ (value === null || value === void 0 ? void 0 : value.variety) || '') : '',
297
+ (value === null || value === void 0 ? void 0 : value.trademark) ? (React.createElement(Col, { span: 8 },
298
+ "\u724C\u53F7\uFF1A",
299
+ (value === null || value === void 0 ? void 0 : value.trademark) || '')) : (''),
300
+ (value === null || value === void 0 ? void 0 : value.strengthGrade) ? (React.createElement(Col, { span: 8 },
301
+ "\u5F3A\u5EA6\u7B49\u7EA7\uFF1A",
302
+ (value === null || value === void 0 ? void 0 : value.strengthGrade) || '')) : (''),
303
+ (value === null || value === void 0 ? void 0 : value.purpose) ? React.createElement(Col, { span: 8 },
304
+ "\u7528\u9014\uFF1A",
305
+ (value === null || value === void 0 ? void 0 : value.purpose) || '') : '')) : (React.createElement(Form, { name: "test-list", form: form, className: "table-form" },
140
306
  React.createElement(SearchContainer, null,
141
- React.createElement(SearchLeft, { configInfo: configInfo },
142
- React.createElement(SearchItem, { style: { width: width }, label: "\u54C1\u540D", name: "brand" },
143
- React.createElement(Input, null)),
144
- React.createElement(SearchItem, { style: { width: width }, label: "\u6750\u8D28", name: "texture" },
145
- React.createElement(Input, null)),
146
- React.createElement(SearchItem, { style: { width: '162px' }, label: "\u89C4\u683C", name: "specifications" },
147
- React.createElement(SpecificationsComp, { config: aboutFieldObj === null || aboutFieldObj === void 0 ? void 0 : aboutFieldObj.specifications })),
148
- React.createElement(SearchItem, { style: { width: width }, label: "\u4EA7\u5730", name: "placesteel" },
149
- React.createElement(Input, null)),
150
- React.createElement(SearchItem, { style: { width: width }, label: "\u578B\u53F7", name: "model" },
151
- React.createElement(Input, null))))));
307
+ React.createElement(SearchLeft, { configInfo: configInfo }, Object.keys(aboutFieldObj).map(function (key) {
308
+ var _a = aboutFieldObj[key] || {}, fieldName = _a.fieldName, children = _a.children;
309
+ if (key === 'specification') {
310
+ return (React.createElement(SearchItem, { style: { width: '202px' }, label: fieldName, name: key + "Id", configname: key, key: key },
311
+ React.createElement(SpecificationsComp, { config: children, objKey: key, materialId: materialId, onChange: onSpecificationHandle })));
312
+ }
313
+ else {
314
+ return (React.createElement(SearchItem, { style: { width: width }, label: fieldName, name: listDataAbout[key] ? key + "Id" : key, key: key, configname: key }, listDataAbout[key] ? (React.createElement(EnhanceSelect, { params: newParams, mustHasParams: "materialId", url: listDataAbout[key].url, dataKey: "id", titleKey: key + "Name", method: "GET", request: request, isCatch: true, dropdownMatchSelectWidth: 130, onChange: function (value, option, fullData) {
315
+ onAboutChangeHandle(value, option, fullData, key);
316
+ } })) : (React.createElement(Input, { onChange: function (e) { return onInputChangeHandle(e, key); } }))));
317
+ }
318
+ })))));
152
319
  };
153
320
  var SpecificationsComp = function (_a) {
154
- var value = _a.value, onChange = _a.onChange, config = _a.config, disabled = _a.disabled;
321
+ var value = _a.value, onChange = _a.onChange, config = _a.config, disabled = _a.disabled, objKey = _a.objKey, materialId = _a.materialId;
322
+ var form = Form.useForm()[0];
155
323
  var _b = useState(false), visible = _b[0], setVisible = _b[1];
324
+ var _c = useState({}), formValue = _c[0], setFormValue = _c[1];
325
+ var _d = useState([]), defaultList = _d[0], setDefaultList = _d[1]; // 新添加的规格
326
+ var newParams = useMemo(function () { return ({
327
+ materialId: materialId,
328
+ }); }, [materialId]);
329
+ var resultStr = useMemo(function () {
330
+ return Array.isArray(config) &&
331
+ config.map(function (item) {
332
+ var _a, _b, _c, _d, _e;
333
+ return "" + ((_a = item === null || item === void 0 ? void 0 : item.prefix) !== null && _a !== void 0 ? _a : '') + ((_b = formValue[item === null || item === void 0 ? void 0 : item.fieldName]) !== null && _b !== void 0 ? _b : '') + ((_c = item === null || item === void 0 ? void 0 : item.postfix) !== null && _c !== void 0 ? _c : '') + ((_d = item === null || item === void 0 ? void 0 : item.unit) !== null && _d !== void 0 ? _d : '') + ((_e = item === null || item === void 0 ? void 0 : item.connectorChar) !== null && _e !== void 0 ? _e : '');
334
+ });
335
+ }, [config, formValue]);
156
336
  /**
157
337
  * @description 模态框设置
158
338
  */
159
339
  var dataConfig = function () {
160
- console.log(config);
340
+ console.log('当前产品层次对应的规格配置', config);
161
341
  };
162
342
  /**
163
343
  * @description 模态框关闭隐藏
@@ -168,11 +348,64 @@ var SpecificationsComp = function (_a) {
168
348
  };
169
349
  var closeModal = function () {
170
350
  setVisible(false);
351
+ setFormValue({});
352
+ form.resetFields();
353
+ };
354
+ /**
355
+ * @description 添加规格
356
+ */
357
+ var onSureHandle = function () { return __awaiter(void 0, void 0, void 0, function () {
358
+ var id, item, err_1, errorFields;
359
+ return __generator(this, function (_a) {
360
+ switch (_a.label) {
361
+ case 0:
362
+ _a.trys.push([0, 2, , 3]);
363
+ return [4 /*yield*/, form.validateFields()];
364
+ case 1:
365
+ _a.sent();
366
+ if (resultStr) {
367
+ id = Date.now();
368
+ item = { specificationName: resultStr === null || resultStr === void 0 ? void 0 : resultStr.join(''), id: id };
369
+ setDefaultList([item]);
370
+ onChange && onChange(id, item, item);
371
+ closeModal();
372
+ }
373
+ else {
374
+ message.info('请填写相关信息!');
375
+ }
376
+ return [3 /*break*/, 3];
377
+ case 2:
378
+ err_1 = _a.sent();
379
+ errorFields = err_1.errorFields;
380
+ if (errorFields) {
381
+ message.error(errorFields[0].errors + '');
382
+ }
383
+ return [3 /*break*/, 3];
384
+ case 3: return [2 /*return*/];
385
+ }
386
+ });
387
+ }); };
388
+ var onValuesChangeHandle = function (changedValues, allValues) {
389
+ setFormValue(allValues);
171
390
  };
172
391
  return (React.createElement(React.Fragment, null,
173
- React.createElement(EnhanceSelect, { defaultList: list, disabled: disabled, value: value, onChange: onChange, dropdownMatchSelectWidth: 130 }),
392
+ React.createElement(EnhanceSelect, { url: listDataAbout[objKey].url, params: newParams, defaultList: defaultList, dataKey: "id", titleKey: "specificationName", mustHasParams: "materialId", disabled: disabled, value: value, onChange: onChange, dropdownMatchSelectWidth: 130, isCatch: true, method: "GET", request: request }),
174
393
  React.createElement(Button, { type: "primary", size: "small", disabled: disabled, onClick: openModal }, "\u65B0\u5EFA"),
175
- React.createElement(Modal, { visible: visible, loading: false, onCancel: closeModal, maskClosable: false, title: "\u9009\u62E9\u89C4\u683C", width: "60%" },
176
- React.createElement("div", null, "\u9009\u62E9\u89C4\u683C"))));
394
+ React.createElement(Modal, { visible: visible, loading: false, onCancel: closeModal, maskClosable: false, title: "\u9009\u62E9\u89C4\u683C", width: "60%", footer: React.createElement(React.Fragment, null,
395
+ React.createElement(Button, { type: "default", onClick: closeModal }, "\u53D6\u6D88"),
396
+ React.createElement(Button, { type: "primary", onClick: onSureHandle }, "\u6DFB\u52A0")) },
397
+ React.createElement(Form, { form: form, name: "specifications-form", onValuesChange: onValuesChangeHandle },
398
+ React.createElement(SearchContainer, null,
399
+ React.createElement(SearchLeft, null, Array.isArray(config) &&
400
+ config.map(function (item, index) { return (React.createElement(React.Fragment, { key: index },
401
+ React.createElement(SearchItem, { label: item.fieldName, name: item.fieldName, rules: [
402
+ {
403
+ required: item.isRequired === '1',
404
+ message: item.fieldName + "\u672A\u586B!",
405
+ },
406
+ ] },
407
+ React.createElement(Input, { prefix: item.prefix, suffix: item.postfix && item.unit ? (React.createElement("span", null, item.postfix + " " + item.unit)) : item.postfix ? (item.postfix) : (item.unit) })),
408
+ item.connectorChar && (React.createElement("span", { className: "connectorChar-label" }, item.connectorChar)))); })))),
409
+ React.createElement("div", null, resultStr))));
177
410
  };
178
- export default MaterialComp;
411
+ export default memo(MaterialComp);
@@ -98,17 +98,17 @@ function EnhanceSelect(_a) {
98
98
  var getDataHandle = useCallback(function (request, options, appointObj) {
99
99
  var _a;
100
100
  if (mustHasParams) {
101
- var _params_1;
101
+ var _params_1 = options.params || {};
102
102
  if (typeof options.params === 'string') {
103
103
  try {
104
- _params_1 = JSON.parse(options.params);
104
+ _params_1 = JSON.parse(options.params) || {};
105
105
  }
106
106
  catch (err) {
107
107
  console.log(err);
108
108
  }
109
109
  }
110
110
  if (((_a = options === null || options === void 0 ? void 0 : options.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'POST') {
111
- _params_1 = options.params;
111
+ _params_1 = options.params || {};
112
112
  }
113
113
  // 如果必传参数不存在
114
114
  if (typeof mustHasParams === 'string' &&
@@ -252,7 +252,7 @@ function EnhanceSelect(_a) {
252
252
  ? enhanceSelectCatchObj[url]
253
253
  : {};
254
254
  var catchData = enhanceSelectCatchObj[url];
255
- var catchDataKey = params ? params : 'single';
255
+ var catchDataKey = params ? JSON.stringify(params) : 'single';
256
256
  if (catchData[catchDataKey]) {
257
257
  // 读取缓存数据
258
258
  setSelectList(catchData[catchDataKey]);
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface IContainer {
3
3
  loading?: boolean;
4
4
  className?: string;
5
+ containerRef?: any;
5
6
  }
6
7
  declare const Container: React.FC<IContainer>;
7
8
  export default Container;
@@ -20,15 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import React, { forwardRef } from 'react';
23
+ import React from 'react';
24
24
  import { Spin } from 'antd';
25
25
  import classNames from 'classnames';
26
- var Container = forwardRef(function (_a, ref) {
27
- var loading = _a.loading, children = _a.children, className = _a.className, restProps = __rest(_a, ["loading", "children", "className"]);
26
+ var Container = function (_a) {
27
+ var loading = _a.loading, children = _a.children, className = _a.className, containerRef = _a.containerRef, restProps = __rest(_a, ["loading", "children", "className", "containerRef"]);
28
28
  var classes = classNames('zt-container', className);
29
- return (React.createElement("div", __assign({ className: classes }, restProps, { ref: ref }),
29
+ return (React.createElement("div", __assign({ className: classes }, restProps, { ref: containerRef }),
30
30
  loading && (React.createElement("div", { className: "zt-container__loading" },
31
31
  React.createElement(Spin, { size: "large", spinning: loading }))),
32
32
  children));
33
- });
33
+ };
34
34
  export default Container;
@@ -24,6 +24,7 @@ export interface IFooterDom extends Partial<IPagination & IBtn & IDropdown> {
24
24
  interface IProps {
25
25
  footerDom?: IFooterDom[] | null;
26
26
  style?: React.CSSProperties;
27
+ className?: string;
27
28
  }
28
29
  declare const _default: React.NamedExoticComponent<IProps>;
29
30
  export default _default;
@@ -3,8 +3,8 @@ import { Pagination, Button, Layout, Dropdown } from '../../../index';
3
3
  var pageSizeOptions = ['10', '20', '30', '100'];
4
4
  var ZtFooter = Layout.Footer;
5
5
  var Footer = function (_a) {
6
- var footerDom = _a.footerDom, style = _a.style;
7
- return (React.createElement(ZtFooter, { className: "footer", style: style }, footerDom ? (React.createElement("div", { className: "footer__btn-group" }, footerDom.map(function (item, index) {
6
+ var footerDom = _a.footerDom, style = _a.style, className = _a.className;
7
+ return (React.createElement(ZtFooter, { className: className ? "footer " + className : 'footer', style: style }, footerDom ? (React.createElement("div", { className: "footer__btn-group" }, footerDom.map(function (item, index) {
8
8
  if (item.DOMType === 'button') {
9
9
  var type = item.type, loading = item.loading, disabled = item.disabled, onClick = item.onClick;
10
10
  return (React.createElement(Button, { key: index, type: type, loading: loading, disabled: disabled, onClick: onClick }, item.text));
package/dist/index.d.ts CHANGED
@@ -36,6 +36,6 @@ export { default as GridList } from './components/business/GridList';
36
36
  export { default as Timeline } from './components/Timeline';
37
37
  export { default as Tag } from './components/Tag';
38
38
  export { UserInfo, UserPassword } from './components/business/Common';
39
- export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Empty, Tooltip, Descriptions, Image, Popover, Breadcrumb, Transfer, } from 'antd';
39
+ export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Empty, Tooltip, Descriptions, Image, Popover, Breadcrumb, Transfer, Row, Col, } from 'antd';
40
40
  export { default as zhCN } from 'antd/lib/locale/zh_CN';
41
41
  export { default as Icon, createFromIconfontCN } from '@ant-design/icons';
package/dist/index.js CHANGED
@@ -115,6 +115,6 @@ export { default as GridList } from './components/business/GridList';
115
115
  export { default as Timeline } from './components/Timeline';
116
116
  export { default as Tag } from './components/Tag';
117
117
  export { UserInfo, UserPassword } from './components/business/Common';
118
- export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Empty, Tooltip, Descriptions, Image, Popover, Breadcrumb, Transfer, } from 'antd';
118
+ export { ConfigProvider, Drawer, message, Space, Grid, Divider, Dropdown, Badge, List, Result, Spin, Popconfirm, TreeSelect, Tree, Progress, Cascader, Empty, Tooltip, Descriptions, Image, Popover, Breadcrumb, Transfer, Row, Col, } from 'antd';
119
119
  export { default as zhCN } from 'antd/lib/locale/zh_CN';
120
120
  export { default as Icon, createFromIconfontCN } from '@ant-design/icons';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "2.4.5",
3
+ "version": "2.4.8",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",