bri-components 1.3.83 → 1.3.84

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.3.83",
3
+ "version": "1.3.84",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -109,7 +109,9 @@
109
109
  },
110
110
  computed: {
111
111
  canSearchFormList () {
112
- return this.formList.filter(formItem => this.$formHasAbility(formItem, "canDefaultSearch"));
112
+ return this.formList.filter(formItem =>
113
+ this.$formHasAbility(formItem, "canDefaultSearch") && formItem._displayType !== "hide"
114
+ );
113
115
  },
114
116
 
115
117
  // 总span
@@ -184,7 +184,6 @@
184
184
  formControlClass: String,
185
185
 
186
186
  /* 本组件使用 -不传递子组件的 */
187
- monitorFormList: Array,
188
187
  showRules: {
189
188
  type: Boolean,
190
189
  default: true
@@ -229,7 +228,7 @@
229
228
  },
230
229
  // 初始化监测 -监测所有字段
231
230
  initMonitor () {
232
- (this.monitorFormList || this.formList).forEach(formItem => {
231
+ (this.allFormList || this.formList).forEach(formItem => {
233
232
  this.$set(this.formData, formItem._key, this.formData[formItem._key]);
234
233
  });
235
234
  },
@@ -60,7 +60,10 @@ export default {
60
60
  },
61
61
  computed: {
62
62
  canSearchFormList () {
63
- return this.formList.filter(formItem => this.$formHasAbility(formItem, "canSearch"));
63
+ return this.formList.filter(formItem =>
64
+ this.$formHasAbility(formItem, "canSearch") &&
65
+ (this.mode === "set" ? true : formItem._displayType !== "hide")
66
+ );
64
67
  },
65
68
  dynamicFieldsMap () {
66
69
  return this.$arrToCategoryArr(this.dynamicFormList);
@@ -220,15 +223,15 @@ export default {
220
223
  return {
221
224
  _id: this.$ObjectID().str,
222
225
  logic: "field",
223
- fieldKey: fieldKey,
224
- fieldType: fieldType,
225
- fieldOperator: fieldOperator,
226
+ fieldKey,
227
+ fieldType,
228
+ fieldOperator,
226
229
  fieldValue: [],
227
230
  fieldSearch: {
228
231
  logic: "and",
229
232
  conditions: []
230
233
  },
231
- parameterType: parameterType,
234
+ parameterType,
232
235
  fieldParams: [],
233
236
  chainFieldKey: "",
234
237
  ...initContion,
@@ -236,11 +239,11 @@ export default {
236
239
  // 下面的是前端所用
237
240
  dynamicList: dynamicList,
238
241
  parameterTypeName: parameterTypeName,
239
- operators: operators,
242
+ operators,
240
243
  fieldOperatorName: fieldOperatorName,
241
244
  formItem: this.getFormItem(curFormItem),
242
245
  subFormList: curFormItem._subForm || [],
243
- finished: false // 标记 reference类型请求form数据 是否完成状态
246
+ finished: !operators.some(operator => ["subSearch"].includes(operator._key)) // 子集条件的 请求form数据 是否完成状态
244
247
  };
245
248
  } else {
246
249
  return {
@@ -315,13 +318,12 @@ export default {
315
318
  this.getModData(conditionItem.formItem, data => {
316
319
  conditionItem.finished = true;
317
320
  conditionItem.subFormList = (data.screens.find(screenItem =>
318
- this.mode === "set" ? screenItem.screenType === "all" : screenItem._key === conditionItem.formItem._screen
321
+ this.mode === "set"
322
+ ? screenItem.screenType === "all"
323
+ : screenItem._key === conditionItem.formItem._screen
319
324
  ) || { form: [] }).form;
320
325
  });
321
326
  }
322
- } else if (["subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(conditionItem.fieldOperator)) {
323
- conditionItem.finished = true;
324
- conditionItem.subFormList = conditionItem.formItem._subForm;
325
327
  }
326
328
  },
327
329
  // 加载 reference数据
@@ -187,11 +187,9 @@
187
187
  },
188
188
  mounted () {},
189
189
  methods: {
190
- // hidden columns
191
190
  hideColumnsByKeys (keys = []) {
192
191
  this.$refs.briTable.hideColumnsByKeys(keys);
193
192
  },
194
- // show cloumns
195
193
  showColumnsByKeys (keys = []) {
196
194
  this.$refs.briTable.showColumnsByKeys(keys);
197
195
  }
@@ -23,7 +23,7 @@
23
23
  :canEdit="getRowCanEdit(row)"
24
24
  :formData="row"
25
25
  :formList="getRowFormList(row)"
26
- :allFormList="columns"
26
+ :allFormList="getRowFormList(row)"
27
27
  :inTableType="inTableType"
28
28
  :allListRows="allListData"
29
29
  :rowIndex="rowIndex"
@@ -105,6 +105,7 @@ export default {
105
105
  computed: {
106
106
  selfPropsObj () {
107
107
  return {
108
+ _treeForm: [],
108
109
  ...this.commonPropsObj,
109
110
 
110
111
  _contentHeight: this.propsObj._contentHeight || 400 // 表格最大高度
@@ -113,7 +114,7 @@ export default {
113
114
 
114
115
  allTreeData () {
115
116
  // console.log("allTreeData");
116
- return this.getCalcuedTree(this.data, this.treeColumns, this.columns);
117
+ return this.getCalcuedTree(this.data, this.treeColumns, this.selfColumns);
117
118
  },
118
119
  allListData () {
119
120
  return this.$getTreeFlatArr(this.data, node => !(node.children && node.children.length));
@@ -156,7 +157,7 @@ export default {
156
157
  loop(node.children);
157
158
  } else {
158
159
  // 根节点下所有表格字段加上监测,注入到节点对象中,必须$set,牵扯_rely值再出现并没有检测
159
- this.columns.forEach(subFormItem => {
160
+ this.selfColumns.forEach(subFormItem => {
160
161
  this.$set(node, subFormItem._key, node[subFormItem._key]);
161
162
  });
162
163
  }
@@ -812,7 +813,7 @@ export default {
812
813
  },
813
814
  getSummaryVal (col, row) {
814
815
  if (col._calField && col._operator) {
815
- const calFieldFormItem = this.columns.find(item => item._key === col._calField);
816
+ const calFieldFormItem = this.selfColumns.find(item => item._key === col._calField);
816
817
 
817
818
  if (calFieldFormItem) {
818
819
  let loop = (nodes, arr) => {
@@ -1,3 +1,5 @@
1
+ import { resourceData } from "bri-datas";
2
+
1
3
  export default {
2
4
  mixins: [],
3
5
  components: {},
@@ -11,19 +13,36 @@ export default {
11
13
  };
12
14
  },
13
15
  computed: {
16
+ selfColumns () {
17
+ return this.columns.map(column => {
18
+ // 层级表格类型,level字段的进行特殊处理(_treeForm加工成_data)
19
+ return column._key === "level"
20
+ ? {
21
+ ...column,
22
+ _data: this.selfPropsObj._treeForm.map((treeFormItem, treeFormIndex) => ({
23
+ name: treeFormItem._name,
24
+ _key: (treeFormIndex + 1),
25
+ color: Object.keys(resourceData.colorMap)[treeFormIndex + 1]
26
+ }))
27
+ }
28
+ : column;
29
+ });
30
+ },
14
31
  selfPropsObj () {
15
32
  return {
16
- _maxLevel: 3, // 最大级数
17
- ...this.commonPropsObj
33
+ _treeForm: [],
34
+ ...this.commonPropsObj,
35
+
36
+ _maxLevel: this.commonPropsObj._maxLevel || 3 // 最大级数
18
37
  };
19
38
  },
20
39
  maxLevel () {
21
- return this.selfPropsObj._maxLevel || 3;
40
+ return this.selfPropsObj._maxLevel;
22
41
  },
23
42
 
24
43
  allTreeData () {
25
44
  // console.log("allTreeData");
26
- return this.getCalcuedTree(this.data, this.columns);
45
+ return this.getCalcuedTree(this.data, this.selfColumns);
27
46
  },
28
47
  allListData () {
29
48
  // console.log("allListData");
@@ -322,11 +341,11 @@ export default {
322
341
 
323
342
  /* ------ 工具方法 ------- */
324
343
  // 加工树形数据
325
- getCalcuedTree (treeData = [], columns = []) {
344
+ getCalcuedTree (treeData = [], cols = []) {
326
345
  const loop = (list = [], parentRow) =>
327
346
  list.forEach((row) => {
328
347
  // 递归到叶子节点前 从上往下执行 要处理的
329
- columns.reduce((newRow, column) => {
348
+ cols.reduce((newRow, column) => {
330
349
  if (["number", "date"].includes(column._type)) {
331
350
  if (![undefined, null, "", "no"].includes(column._summaryType)) {
332
351
  // 不做处理,_summaryType和_writeSort互反,更安全的判断
@@ -349,7 +368,7 @@ export default {
349
368
  loop(row.children, row);
350
369
 
351
370
  // 递归到叶子节点后到 从下往上执行 要处理的(非叶子节点)
352
- columns.reduce((newRow, column) => {
371
+ cols.reduce((newRow, column) => {
353
372
  if (["number", "date"].includes(column._type)) {
354
373
  if (![undefined, null, "", "no"].includes(column._summaryType)) {
355
374
  const val = ["number"].includes(column._type)
@@ -383,7 +402,7 @@ export default {
383
402
  row.isLeaf = true;
384
403
 
385
404
  // 递归到叶子节点后到 从下往上执行 要处理的(叶子节点)
386
- columns.reduce((newRow, column) => {
405
+ cols.reduce((newRow, column) => {
387
406
  if (["number", "date"].includes(column._type)) {
388
407
  if (![undefined, null, "", "no"].includes(column._summaryType)) {
389
408
  this.$set(newRow, column._key, newRow[column._key]);
@@ -191,6 +191,13 @@ export default {
191
191
  allScreenKey () {
192
192
  return this.propsObj.allScreenKey;
193
193
  },
194
+ selfColumns () {
195
+ return this.columns;
196
+ },
197
+ filterColumns () {
198
+ // console.log("filterColumns");
199
+ return this.selfColumns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
200
+ },
194
201
 
195
202
  commonPropsObj () {
196
203
  return {
@@ -277,29 +284,10 @@ export default {
277
284
  disabledOldDataRow () {
278
285
  return this.selfPropsObj._disabledOldDataRow;
279
286
  },
280
-
281
- isImport () {
282
- return this.selfPropsObj._isImport;
283
- },
284
- isExport () {
285
- return this.selfPropsObj._isExport;
286
- },
287
- isQuote () {
288
- return this.selfPropsObj._isQuote;
289
- },
290
- quoteDisabledColKeys () {
291
- return this.selfPropsObj._quoteDisabledColKeys;
292
- },
293
- quoteListFields () {
294
- return this.selfPropsObj._quoteListFields;
295
- },
296
- quoteAdvSearch () {
297
- return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.allFormList, this.parentObj);
298
- },
299
-
300
287
  hideColKeys () {
301
288
  return this.selfPropsObj._hideColKeys || [];
302
289
  },
290
+
303
291
  searchLabelWidth () {
304
292
  return this.selfPropsObj._searchLabelWidth;
305
293
  },
@@ -313,13 +301,12 @@ export default {
313
301
  return this.searchList.map(searchItem => searchItem._key);
314
302
  },
315
303
  searchFormList () {
316
- return this.$filterList(this.searchListFields, this.columns).map(formItem => ({
304
+ return this.$filterList(this.searchListFields, this.selfColumns).map(formItem => ({
317
305
  ...formItem,
318
306
  ...this.searchListMap[formItem._key],
319
307
  _name: formItem._name
320
308
  }));
321
309
  },
322
-
323
310
  tableAdvSearch () {
324
311
  return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.allFormList, this.parentObj);
325
312
  },
@@ -383,7 +370,7 @@ export default {
383
370
  return this.parentObj._id;
384
371
  },
385
372
  selfRowDefault () {
386
- return this.columns.reduce((obj, column) => {
373
+ return this.selfColumns.reduce((obj, column) => {
387
374
  const defaultVal = this.rowDefault[column._key];
388
375
  const initDftVal = this.initDftValMap[column._type];
389
376
 
@@ -433,53 +420,6 @@ export default {
433
420
  }
434
421
  };
435
422
  },
436
- modalPropsObj () {
437
- return {
438
- mode: "fullscreen",
439
- title: this.controlName
440
- };
441
- },
442
- quoteParams () {
443
- return {
444
- screenKey: this.allScreenKey,
445
- fields: [
446
- ...this.quoteListFields,
447
- this.controlKey,
448
- "createdAt"
449
- ],
450
- advSearch: {
451
- logic: "and",
452
- conditions: [
453
- {
454
- fieldKey: "_id",
455
- fieldOperator: "ne",
456
- fieldValue: [this.parentDataId]
457
- },
458
- this.quoteAdvSearch
459
- ]
460
- }
461
- };
462
- },
463
- importParams () {
464
- return {
465
- _id: this.parentDataId,
466
- _key: this.controlKey,
467
- importType: this.inTableType
468
- };
469
- },
470
- exportParams () {
471
- return {
472
- screenKey: this.screenKey,
473
- _id: this.parentDataId,
474
- _key: this.controlKey,
475
- advSearch: this.finalTableAdvSearch
476
- };
477
- },
478
-
479
- filterColumns () {
480
- // console.log("filterColumns");
481
- return this.columns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
482
- },
483
423
  contentColumns () {
484
424
  // console.log("contentColumns");
485
425
  return this.filterColumns.map(colItem => ({
@@ -511,7 +451,7 @@ export default {
511
451
  canEdit: unitCanEdit,
512
452
  formData: row,
513
453
  formItem: column,
514
- allFormList: this.columns,
454
+ allFormList: this.selfColumns,
515
455
  inTableType: this.inTableType,
516
456
  allListRows: this.allListData,
517
457
  rowIndex: rowIndex,
@@ -530,7 +470,7 @@ export default {
530
470
  canEdit: unitCanEdit,
531
471
  formData: row,
532
472
  formItem: column,
533
- allFormList: this.columns,
473
+ allFormList: this.selfColumns,
534
474
  inTableType: this.inTableType,
535
475
  allListRows: this.allListData,
536
476
  rowIndex: rowIndex,
@@ -603,6 +543,67 @@ export default {
603
543
  };
604
544
  },
605
545
 
546
+ isImport () {
547
+ return this.selfPropsObj._isImport;
548
+ },
549
+ importParams () {
550
+ return {
551
+ _id: this.parentDataId,
552
+ _key: this.controlKey,
553
+ importType: this.inTableType
554
+ };
555
+ },
556
+ isExport () {
557
+ return this.selfPropsObj._isExport;
558
+ },
559
+ exportParams () {
560
+ return {
561
+ screenKey: this.screenKey,
562
+ _id: this.parentDataId,
563
+ _key: this.controlKey,
564
+ advSearch: this.finalTableAdvSearch
565
+ };
566
+ },
567
+ isQuote () {
568
+ return this.selfPropsObj._isQuote;
569
+ },
570
+ quoteDisabledColKeys () {
571
+ return this.selfPropsObj._quoteDisabledColKeys;
572
+ },
573
+ quoteListFields () {
574
+ return this.selfPropsObj._quoteListFields;
575
+ },
576
+ quoteAdvSearch () {
577
+ return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.allFormList, this.parentObj);
578
+ },
579
+ quoteParams () {
580
+ return {
581
+ screenKey: this.allScreenKey,
582
+ fields: [
583
+ ...this.quoteListFields,
584
+ this.controlKey,
585
+ "createdAt"
586
+ ],
587
+ advSearch: {
588
+ logic: "and",
589
+ conditions: [
590
+ {
591
+ fieldKey: "_id",
592
+ fieldOperator: "ne",
593
+ fieldValue: [this.parentDataId]
594
+ },
595
+ this.quoteAdvSearch
596
+ ]
597
+ }
598
+ };
599
+ },
600
+ modalPropsObj () {
601
+ return {
602
+ mode: "fullscreen",
603
+ title: this.controlName
604
+ };
605
+ },
606
+
606
607
  topOperationBtns () {
607
608
  return Object.keys(this.topOperationMap);
608
609
  },
@@ -1031,7 +1032,7 @@ export default {
1031
1032
  // 校验必填不通过 => 校验对比
1032
1033
  const resultObj = {};
1033
1034
  this.$getFieldRuleResult(col, row, resultObj) &&
1034
- this.$normalComparedFunc(col, row, this.columns, this.parentObj, this.allFormList, this.inTableType, resultObj) &&
1035
+ this.$normalComparedFunc(col, row, this.selfColumns, this.parentObj, this.allFormList, this.inTableType, resultObj) &&
1035
1036
  this.$levelComparedFunc(col, row, this.allListData, this.inTableType, resultObj);
1036
1037
 
1037
1038
  return resultObj;
@@ -1068,6 +1069,7 @@ export default {
1068
1069
  : true
1069
1070
  : true
1070
1071
  ) &&
1072
+ !(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 级联表格类型,固定字段不编辑
1071
1073
  (col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
1072
1074
  (row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
1073
1075
  col._enterType !== "calculate" && // 计算的不可编辑
@@ -1081,7 +1083,7 @@ export default {
1081
1083
  this.$isAdvRelyShow(col, row, this.parentObj, true);
1082
1084
  },
1083
1085
  getRowFormList (row) {
1084
- return this.columns.map(column => {
1086
+ return this.selfColumns.map(column => {
1085
1087
  column = this.$transformDynamicProperty(column, row, this.parentObj);
1086
1088
  const unitCanEdit = this.getColCanEdit(column, row);
1087
1089
 
@@ -161,7 +161,7 @@ const transformToColumns = function (form, {
161
161
 
162
162
  ...col
163
163
  };
164
- });
164
+ });
165
165
  };
166
166
 
167
167
  export default {