bri-components 1.3.38 → 1.3.40

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.38",
3
+ "version": "1.3.40",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -38,7 +38,7 @@
38
38
  :style="getThStyle(column, 'th')"
39
39
  @click="$dispatchEvent(operationMap.clickTh, column)"
40
40
  >
41
- <dsh-render :render="getHeaderRender(column)"></dsh-render>
41
+ <dsh-render :render="getThRender(column)"></dsh-render>
42
42
 
43
43
  <!-- 级联表头 的下拉 -->
44
44
  <dsh-dropdown
@@ -84,7 +84,7 @@
84
84
  :key="row._id"
85
85
  class="table-row"
86
86
  >
87
- <template v-for="column in getRowColumns(row, rowIndex)">
87
+ <template v-for="column in rowColumnsArr[rowIndex]">
88
88
  <!-- 树节点单元格、汇总单元格 -->
89
89
  <td
90
90
  v-if="['tree', 'summary'].includes(column.colType)"
@@ -95,9 +95,9 @@
95
95
  'bri-table-td-edit': canEdit,
96
96
  'bri-table-td-show': !canEdit,
97
97
  }"
98
- :style="getTdStyle(column, row)"
99
- :rowspan="geTdRowspan(column, row)"
100
- :colspan="geTdColspan(column, row)"
98
+ :style="getTdStyle(column, row[column.nodeKey])"
99
+ :rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
100
+ :colspan="getTdColSpan(column, row[column.nodeKey])"
101
101
  @click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
102
102
  >
103
103
  <!-- 树节点单元格 -->
@@ -109,7 +109,10 @@
109
109
  v-model="row[column._key].name"
110
110
  class="textarea"
111
111
  type="textarea"
112
- :autosize="{ minRows: geTdRowspan(column, row) * 3 - 1, maxRows: 100 }"
112
+ :autosize="{
113
+ minRows: getTdRowSpan(column, row[column.nodeKey || column._key]) * 3 - 1,
114
+ maxRows: 100
115
+ }"
113
116
  @on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
114
117
  @on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
115
118
  />
@@ -145,45 +148,16 @@
145
148
 
146
149
  <!-- 汇总单元格 -->
147
150
  <template v-else-if="column.colType === 'summary'">
148
- <span>{{ getSummaryVal(column, row) }}</span>
151
+ <span>{{ getSummaryVal(column, row[column.nodeKey]) }}</span>
149
152
  </template>
150
153
  </td>
151
154
 
152
155
  <!-- 普通单元格 -->
153
- <td
156
+ <dsh-render
154
157
  v-else
155
158
  :key="column._key + 'data'"
156
- :class="{
157
- // [`table-td-${column.colType}`]: true,
158
- 'bri-table-td': true , // 可以不要,为了position: relative,上面有
159
- 'bri-table-td-edit': canEdit,
160
- 'bri-table-td-show': !canEdit,
161
- }"
162
- :style="getTdStyle(column, row)"
163
- >
164
- <dsh-list-unit
165
- :canEdit="canEdit"
166
- :formData="row[column.nodeKey]"
167
- :formItem="{
168
- ...column,
169
- _heightAuto: heightAuto
170
- }"
171
- :allFormList="subColumns"
172
- :rowIndex="rowIndex"
173
- :parentListData="rows"
174
- :parentFormList="parentFormList"
175
- :parentObj="parentObj"
176
- @blur="controlBlur(null, column, row[column.nodeKey], arguments)"
177
- @change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
178
- ></dsh-list-unit>
179
-
180
- <span
181
- v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
182
- class="bri-table-td-tip"
183
- >
184
- {{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
185
- </span>
186
- </td>
159
+ :render="getTdRender(column, row, rowIndex)"
160
+ ></dsh-render>
187
161
  </template>
188
162
  </tr>
189
163
  </template>
@@ -205,7 +179,7 @@
205
179
  <!-- 全屏查看 -->
206
180
  <dsh-modal
207
181
  v-model="isEnlarge"
208
- mode="custom"
182
+ :mode="modalPropsObj.mode"
209
183
  :propsObj="modalPropsObj"
210
184
  >
211
185
  <div
@@ -237,7 +211,7 @@
237
211
  :style="getThStyle(column, 'th')"
238
212
  @click="$dispatchEvent(operationMap.clickTh, column)"
239
213
  >
240
- <dsh-render :render="getHeaderRender(column)"></dsh-render>
214
+ <dsh-render :render="getThRender(column)"></dsh-render>
241
215
 
242
216
  <!-- 级联表头 的下拉 -->
243
217
  <dsh-dropdown
@@ -283,7 +257,7 @@
283
257
  :key="row._id"
284
258
  class="table-row"
285
259
  >
286
- <template v-for="column in getRowColumns(row, rowIndex)">
260
+ <template v-for="column in rowColumnsArr[rowIndex]">
287
261
  <!-- 树节点单元格、汇总单元格 -->
288
262
  <td
289
263
  v-if="['tree', 'summary'].includes(column.colType)"
@@ -294,9 +268,9 @@
294
268
  'bri-table-td-edit': canEdit,
295
269
  'bri-table-td-show': !canEdit,
296
270
  }"
297
- :style="getTdStyle(column, row)"
298
- :rowspan="geTdRowspan(column, row)"
299
- :colspan="geTdColspan(column, row)"
271
+ :style="getTdStyle(column, row[column.nodeKey])"
272
+ :rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
273
+ :colspan="getTdColSpan(column, row[column.nodeKey])"
300
274
  @click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
301
275
  >
302
276
  <!-- 树节点单元格 -->
@@ -308,7 +282,10 @@
308
282
  v-model="row[column._key].name"
309
283
  class="textarea"
310
284
  type="textarea"
311
- :autosize="{ minRows: geTdRowspan(column, row) * 3 - 1, maxRows: 100 }"
285
+ :autosize="{
286
+ minRows: getTdRowSpan(column, row[column.nodeKey || column._key]) * 3 - 1,
287
+ maxRows: 100
288
+ }"
312
289
  @on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
313
290
  @on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
314
291
  />
@@ -344,45 +321,16 @@
344
321
 
345
322
  <!-- 汇总单元格 -->
346
323
  <template v-else-if="column.colType === 'summary'">
347
- <span>{{ getSummaryVal(column, row) }}</span>
324
+ <span>{{ getSummaryVal(column, row[column.nodeKey]) }}</span>
348
325
  </template>
349
326
  </td>
350
327
 
351
328
  <!-- 普通单元格 -->
352
- <td
329
+ <dsh-render
353
330
  v-else
354
331
  :key="column._key + 'data'"
355
- :class="{
356
- // [`table-td-${column.colType}`]: true,
357
- 'bri-table-td': true , // 可以不要,为了position: relative,上面有
358
- 'bri-table-td-edit': canEdit,
359
- 'bri-table-td-show': !canEdit,
360
- }"
361
- :style="getTdStyle(column, row)"
362
- >
363
- <dsh-list-unit
364
- :canEdit="canEdit"
365
- :formData="row[column.nodeKey]"
366
- :formItem="{
367
- ...column,
368
- _heightAuto: heightAuto
369
- }"
370
- :allFormList="subColumns"
371
- :rowIndex="rowIndex"
372
- :parentListData="rows"
373
- :parentFormList="parentFormList"
374
- :parentObj="parentObj"
375
- @blur="controlBlur(null, column, row[column.nodeKey], arguments)"
376
- @change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
377
- ></dsh-list-unit>
378
-
379
- <span
380
- v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
381
- class="bri-table-td-tip"
382
- >
383
- {{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
384
- </span>
385
- </td>
332
+ :render="getTdRender(column, row, rowIndex)"
333
+ ></dsh-render>
386
334
  </template>
387
335
  </tr>
388
336
  </template>
@@ -587,32 +535,7 @@
587
535
  };
588
536
  loop(this.data.tree);
589
537
  },
590
- // 单元格校验结果
591
- getColRuleResult (col, row, rowIndex) {
592
- col = this.$transformFieldProperty(col, row, this.parentObj);
593
-
594
- if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
595
- return this.$getFieldRuleResult({
596
- ...col,
597
- _regStr: col._regStr && [";", ";"].some(symbol => col._regStr.includes(symbol))
598
- ? col._regStr
599
- .replace(/\n/g, "")
600
- .split(";")
601
- .reduce((arr, item) => arr.concat(item.split(";")), [])[rowIndex]
602
- : col._regStr,
603
- _regMessage: col._regMessage && [";", ";"].some(symbol => col._regMessage.includes(symbol))
604
- ? col._regMessage
605
- .replace(/\n/g, "")
606
- .split(";")
607
- .reduce((arr, item) => arr.concat(item.split(";")), [])[rowIndex]
608
- : col._regMessage
609
- }, row);
610
- } else {
611
- return {
612
- bool: true
613
- };
614
- }
615
- },
538
+
616
539
  // 点击表头
617
540
  clickTh (operationItem, col) {
618
541
  this.$emit("clickTh", col);
@@ -724,15 +647,6 @@
724
647
 
725
648
  this.change("clearChildNodes", col, row, nodeData);
726
649
  },
727
- // 输入框值改变
728
- changeVal (operationItem, col, row, params) {
729
- this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
730
- this.change("changeVal", col, row, params);
731
- },
732
- // 表单控件失去焦点
733
- controlBlur (operationItem, col, row, params) {
734
- this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
735
- },
736
650
  // 发生变动
737
651
  change (...params) {
738
652
  this.$emit("change", this.data, ...params);
@@ -740,7 +654,7 @@
740
654
 
741
655
  /* ---- 工具方法 ---- */
742
656
  // 合并表头
743
- transformColumns (treeForm = this.treeColumns, subForm = this.filterColumns) {
657
+ transformColumns (treeForm = this.treeColumns, subForm = this.contentColumns) {
744
658
  return treeForm
745
659
  .reduce((arr, treeFormItem, treeFormIndex) => {
746
660
  return arr.concat(
@@ -966,29 +880,36 @@
966
880
  getTdStyle (col, row) {
967
881
  return {
968
882
  ...this.getThStyle(col),
969
- backgroundColor: row && row[col.nodeKey] ? "" : "#fff"
883
+ backgroundColor: row ? "" : "#fff"
970
884
  };
971
885
  },
972
- geTdRowspan (col, row) {
973
- return row[col.nodeKey || col._key] && row[col.nodeKey || col._key].total || 1;
886
+ getTdRowSpan (col, row) {
887
+ return row.total || 1;
974
888
  },
975
- geTdColspan (col, row) {
889
+ getTdColSpan (col, row) {
976
890
  return 1;
977
891
  },
978
- getHeaderRender (column) {
979
- return (h) => this.$getHeadRender(h, column, {
892
+ getThRender (col) {
893
+ return (h) => this.$getHeadRender(h, col, {
980
894
  showRequired: this.showRequired,
981
895
  showDescription: this.showDescription,
982
896
  headHeightAuto: this.headHeightAuto
983
897
  });
984
898
  },
985
- getRowColumns (row, rowIndex) {
986
- const columns = this.rowColumnsArr[rowIndex];
987
- return columns.map(column =>
988
- ["tree", "summary"].includes(column.colType)
989
- ? column
990
- : this.$transformFieldProperty(column, row, this.parentObj)
991
- );
899
+ getTdRender (col, row, rowIndex) {
900
+ return (h) => {
901
+ row = row[col.nodeKey];
902
+ console.log(row);
903
+
904
+ return h(
905
+ "td",
906
+ {
907
+ class: this.tablePropsObj.cellStyleOption.bodyCellClass({ column: col, row, rowIndex }),
908
+ style: this.getTdStyle(col, row)
909
+ },
910
+ col ? col.renderBodyCell({ column: col, row, rowIndex }, h) : undefined
911
+ );
912
+ };
992
913
  },
993
914
  getSummaryVal (col, row) {
994
915
  if (col._calField && col._operator) {
@@ -1005,7 +926,7 @@
1005
926
  }
1006
927
  }, arr);
1007
928
  };
1008
- let list = loop(row[col.nodeKey].children, []);
929
+ let list = loop(row.children, []);
1009
930
 
1010
931
  return this.$calNumList(list, col._operator, calFieldFormItem);
1011
932
  } else {
@@ -29,7 +29,7 @@
29
29
  <!-- 全屏查看 -->
30
30
  <dsh-modal
31
31
  v-model="isEnlarge"
32
- mode="custom"
32
+ :mode="modalPropsObj.mode"
33
33
  :propsObj="modalPropsObj"
34
34
  >
35
35
  <template v-if="isEnlargeFlag">
@@ -42,7 +42,7 @@
42
42
  <!-- 全屏模式 -->
43
43
  <dsh-modal
44
44
  v-model="isEnlarge"
45
- mode="custom"
45
+ :mode="modalPropsObj.mode"
46
46
  :propsObj="modalPropsObj"
47
47
  >
48
48
  <template v-if="isEnlargeFlag">
@@ -95,7 +95,7 @@
95
95
  props: {},
96
96
  data () {
97
97
  return {
98
- deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchingShow__"], // 除了__old__
98
+ deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchingShow__"], // 除了__readonly__和__isQuote__不处理
99
99
  isExpandAction: false,
100
100
 
101
101
  searchMode: "flat", // "flat", "tree"
@@ -194,7 +194,7 @@
194
194
  return this.selfPropsObj._searchLabelWidth;
195
195
  },
196
196
  searchFormList () {
197
- return this.selfPropsObj._searchFields
197
+ return (this.selfPropsObj._searchFields || []) // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
198
198
  .map(fieldKey => this.columns.find(column => column._key === fieldKey))
199
199
  .filter(column => !!column)
200
200
  .map(column => {
@@ -13,12 +13,6 @@ export default {
13
13
  default () {
14
14
  return [];
15
15
  }
16
- },
17
- oldData: {
18
- type: Array,
19
- default () {
20
- return [];
21
- }
22
16
  }
23
17
  },
24
18
  model: {
@@ -41,15 +35,6 @@ export default {
41
35
  this.initFlag = true;
42
36
  return this.data;
43
37
  },
44
- oldListData () {
45
- this.oldData.forEach(item => {
46
- !item._id && this.$set(item, "_id", this.$ObjectID().str);
47
- });
48
- return this.oldData;
49
- },
50
- useCampare () {
51
- return !!this.oldListData.length;
52
- },
53
38
  footerData () {
54
39
  return this.useSummary && this.listData.length
55
40
  ? [
@@ -78,20 +63,6 @@ export default {
78
63
  ...this.commonPropsObj
79
64
  };
80
65
  },
81
- tablePropsObj () {
82
- return {
83
- maxHeight: this.contentHeight,
84
- cellStyleOption: {
85
- bodyCellClass: ({ row, column, rowIndex }) => {
86
- return "bri-table-td" +
87
- `${this.getRowCanEdit(row)
88
- ? " bri-table-td-edit"
89
- : " bri-table-td-show"
90
- }`;
91
- }
92
- }
93
- };
94
- },
95
66
 
96
67
  filterColumns () {
97
68
  return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
@@ -124,7 +95,7 @@ export default {
124
95
  width: 76,
125
96
  align: "center",
126
97
  fixed: "left",
127
- renderBodyCell: ({ row, column, rowIndex }) => ++rowIndex
98
+ renderBodyCell: ({ column, row, rowIndex }) => ++rowIndex
128
99
  };
129
100
  },
130
101
  operationColumn () {
@@ -136,14 +107,14 @@ export default {
136
107
  align: "center",
137
108
  fixed: "right",
138
109
  width: 100,
139
- renderBodyCell: ({ row, column, rowIndex }, h) => {
110
+ renderBodyCell: ({ column, row, rowIndex }, h) => {
140
111
  const operationList = this.$getOperationList(["canDelete"]);
141
112
 
142
113
  return h("dsh-buttons", {
143
114
  props: {
144
115
  list: operationList.map(btnItem => ({
145
116
  ...btnItem,
146
- disabled: !this.getRowCanEdit(row)
117
+ disabled: !this.getRowBtnCanEdit(row)
147
118
  }))
148
119
  },
149
120
  on: {
@@ -154,84 +125,6 @@ export default {
154
125
  });
155
126
  }
156
127
  };
157
- },
158
- contentColumns () {
159
- return this.filterColumns.map(colItem => ({
160
- filter: undefined,
161
- sortBy: undefined,
162
- renderBodyCell: ({ row, column, rowIndex }, h) => {
163
- column = this.$transformFieldProperty(column, row, this.parentObj);
164
- column = this.resetCol(column, row);
165
- const unitCanEdit = this.getUnitCanEdit(column, row);
166
-
167
- return [
168
- this.isShowCompare(column, row, this.oldListData[rowIndex])
169
- ? h("Tooltip", {
170
- style: {
171
- width: "100%"
172
- },
173
- props: {
174
- content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
175
- ? ""
176
- : this.oldListData[rowIndex][column._key],
177
- transfer: true,
178
- maxWidth: 200,
179
- placement: "top"
180
- },
181
- scopedSlots: {
182
- default: props => h("dsh-list-unit", {
183
- props: {
184
- canEdit: unitCanEdit,
185
- formData: row,
186
- formItem: column,
187
- rowIndex: rowIndex,
188
- allFormList: this.columns,
189
- parentListData: this.listData,
190
- parentFormList: this.parentFormList,
191
- parentObj: this.parentObj
192
- },
193
- on: {
194
- blur: () => this.controlBlur(null, column, row, arguments),
195
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
196
- }
197
- })
198
- }
199
- })
200
- : h("dsh-list-unit", {
201
- props: {
202
- canEdit: unitCanEdit,
203
- formData: row,
204
- formItem: column,
205
- rowIndex: rowIndex,
206
- allFormList: this.columns,
207
- parentListData: this.listData,
208
- parentFormList: this.parentFormList,
209
- parentObj: this.parentObj
210
- },
211
- on: {
212
- blur: () => this.controlBlur(null, column, row, arguments),
213
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
214
- }
215
- }),
216
-
217
- !this.getColRuleResult(column, row).bool
218
- ? h("span", {
219
- class: "bri-table-td-tip"
220
- }, this.getColRuleResult(column, row).message)
221
- : undefined
222
- ];
223
- },
224
- renderHeaderCell: ({ column }, h) => {
225
- column = this.$transformFieldProperty(column, undefined, this.parentObj);
226
-
227
- return this.$getHeadRender(h, column, {
228
- showRequired: this.showRequired,
229
- showDescription: this.showDescription,
230
- headHeightAuto: this.headHeightAuto
231
- });
232
- },
233
- ...colItem
234
- }));
235
128
  }
236
129
  },
237
130
  created () { },
@@ -263,39 +156,8 @@ export default {
263
156
  changeSelect (list) {
264
157
  this.$emit("changeSelect", list);
265
158
  },
266
- // 表单控件值改变
267
- changeVal (operationItem, col, row, rowIndex, params) {
268
- this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
269
- this.change("changeVal", col, row, rowIndex, ...params);
270
- },
271
- // 表单控件失去焦点
272
- controlBlur (operationItem, col, row, params) {
273
- this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
274
- },
275
159
  change (...params) {
276
160
  this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
277
- },
278
-
279
- resetCol (col, row) {
280
- let resetMap = {
281
- select: {
282
- _optionKind: "dropdown"
283
- },
284
- checkbox: {
285
- _optionKind: "dropdown"
286
- }
287
- };
288
- return {
289
- ...col,
290
- ...(resetMap[col._type] || {}),
291
- // isShare: this.isShare,
292
- _heightAuto: this.heightAuto
293
- };
294
- },
295
- isShowCompare (col, row, oldRow = {}) {
296
- return this.useCampare && ["number"].includes(col._type) &&
297
- !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
298
- row[col._key] !== oldRow[col._key];
299
161
  }
300
162
  }
301
163
  };
@@ -24,6 +24,12 @@ export default {
24
24
  return {};
25
25
  }
26
26
  },
27
+ oldData: {
28
+ type: Array,
29
+ default () {
30
+ return [];
31
+ }
32
+ },
27
33
 
28
34
  parentFormList: {
29
35
  type: Array,
@@ -122,6 +128,15 @@ export default {
122
128
  selfRowDefault () {
123
129
  return this.$filterObj(this.filterColumns, this.rowDefault);
124
130
  },
131
+ oldListData () {
132
+ this.oldData.forEach(item => {
133
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
134
+ });
135
+ return this.oldData;
136
+ },
137
+ useCampare () {
138
+ return !!this.oldListData.length;
139
+ },
125
140
 
126
141
  controlKey () {
127
142
  return this.propsObj._key;
@@ -220,12 +235,24 @@ export default {
220
235
  return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
221
236
  },
222
237
 
238
+ tablePropsObj () {
239
+ return {
240
+ maxHeight: this.contentHeight,
241
+ cellStyleOption: {
242
+ bodyCellClass: ({ column, row, rowIndex }) => {
243
+ return "bri-table-td" +
244
+ `${this.getRowCanEdit(row)
245
+ ? " bri-table-td-edit"
246
+ : " bri-table-td-show"
247
+ }`;
248
+ }
249
+ }
250
+ };
251
+ },
223
252
  modalPropsObj () {
224
253
  return {
225
- title: this.controlName,
226
- fullscreen: true,
227
- showSlotClose: false,
228
- closable: true
254
+ mode: "fullscreen",
255
+ title: this.controlName
229
256
  };
230
257
  },
231
258
  quoteParams () {
@@ -251,6 +278,85 @@ export default {
251
278
  _key: this.controlKey
252
279
  };
253
280
  },
281
+ contentColumns () {
282
+ return this.filterColumns.map(colItem => ({
283
+ filter: undefined,
284
+ sortBy: undefined,
285
+ renderBodyCell: ({ column, row, rowIndex }, h) => {
286
+ column = this.$transformFieldProperty(column, row, this.parentObj);
287
+ column = this.resetCol(column, row);
288
+ const unitCanEdit = this.getUnitCanEdit(column, row);
289
+
290
+ return [
291
+ this.isShowCompare(column, row, this.oldListData[rowIndex])
292
+ ? h("Tooltip", {
293
+ style: {
294
+ width: "100%"
295
+ },
296
+ props: {
297
+ content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
298
+ ? ""
299
+ : this.oldListData[rowIndex][column._key],
300
+ transfer: true,
301
+ maxWidth: 200,
302
+ placement: "top"
303
+ },
304
+ scopedSlots: {
305
+ default: props => h("dsh-list-unit", {
306
+ props: {
307
+ canEdit: unitCanEdit,
308
+ formData: row,
309
+ formItem: column,
310
+ rowIndex: rowIndex,
311
+ allFormList: this.columns,
312
+ parentListData: this.listData,
313
+ parentFormList: this.parentFormList,
314
+ parentObj: this.parentObj
315
+ },
316
+ on: {
317
+ blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
318
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
319
+ }
320
+ })
321
+ }
322
+ })
323
+ : h("dsh-list-unit", {
324
+ props: {
325
+ canEdit: unitCanEdit,
326
+ formData: row,
327
+ formItem: column,
328
+ rowIndex: rowIndex,
329
+ allFormList: this.columns,
330
+ parentListData: this.listData,
331
+ parentFormList: this.parentFormList,
332
+ parentObj: this.parentObj
333
+ },
334
+ on: {
335
+ blur: () => this.controlBlur(null, column, row, rowIndex, arguments),
336
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
337
+ }
338
+ }),
339
+
340
+ // 校验文字
341
+ !this.getColRuleResult(column, row, rowIndex).bool
342
+ ? h("span", {
343
+ class: "bri-table-td-tip"
344
+ }, this.getColRuleResult(column, row, rowIndex).message)
345
+ : undefined
346
+ ];
347
+ },
348
+ renderHeaderCell: ({ column }, h) => {
349
+ column = this.$transformFieldProperty(column, undefined, this.parentObj);
350
+
351
+ return this.$getHeadRender(h, column, {
352
+ showRequired: this.showRequired,
353
+ showDescription: this.showDescription,
354
+ headHeightAuto: this.headHeightAuto
355
+ });
356
+ },
357
+ ...colItem
358
+ }));
359
+ },
254
360
 
255
361
  topOperationBtns () {
256
362
  return Object.keys(this.topOperationMap);
@@ -311,6 +417,15 @@ export default {
311
417
  this.ruleRecordMap = {};
312
418
  },
313
419
 
420
+ // 表单控件失去焦点
421
+ controlBlur (operationItem, col, row, rowIndex, params) {
422
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
423
+ },
424
+ // 输入框值改变
425
+ changeVal (operationItem, col, row, rowIndex, params) {
426
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
427
+ this.change("changeVal", col, row, rowIndex, ...params);
428
+ },
314
429
  // 点击引用
315
430
  clickQuote () {
316
431
  this.dshRenderName = "quoteModalRender";
@@ -360,7 +475,7 @@ export default {
360
475
  ...dataObj[this.controlKey],
361
476
  list: dataObj[this.controlKey].list.map(item => ({
362
477
  ...item,
363
- __readonly__: true
478
+ __isQuote__: true
364
479
  }))
365
480
  };
366
481
  } else if (["cascaderTable"].includes(this.controlType)) {
@@ -369,7 +484,7 @@ export default {
369
484
  list.map(item => ({
370
485
  ...item,
371
486
  children: item.children && item.children.length ? loop(item.children) : item.children,
372
- __readonly__: true
487
+ __isQuote__: true
373
488
  }));
374
489
 
375
490
  return loop(data);
@@ -460,6 +575,27 @@ export default {
460
575
  },
461
576
 
462
577
  /* --------------- 工具方法 ------------- */
578
+ resetCol (col, row) {
579
+ let resetMap = {
580
+ select: {
581
+ _optionKind: "dropdown"
582
+ },
583
+ checkbox: {
584
+ _optionKind: "dropdown"
585
+ }
586
+ };
587
+ return {
588
+ ...col,
589
+ ...(resetMap[col._type] || {}),
590
+ // isShare: this.isShare,
591
+ _heightAuto: this.heightAuto
592
+ };
593
+ },
594
+ isShowCompare (col, row, oldRow = {}) {
595
+ return this.useCampare && ["number"].includes(col._type) &&
596
+ !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
597
+ row[col._key] !== oldRow[col._key];
598
+ },
463
599
  // 整行校验结果
464
600
  getRowRuleResult (row, rowIndex) {
465
601
  return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
@@ -467,6 +603,7 @@ export default {
467
603
  // 单元格校验结果
468
604
  getColRuleResult (col, row, rowIndex) {
469
605
  col = this.$transformFieldProperty(col, row, this.parentObj);
606
+
470
607
  if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
471
608
  return this.$getFieldRuleResult(col, row);
472
609
  } else {
@@ -475,17 +612,25 @@ export default {
475
612
  };
476
613
  }
477
614
  },
478
- getRowCanEdit (row) {
615
+ // 行按钮是否可编辑(删除按钮可编辑 不代表行内容是可编辑的)
616
+ getRowBtnCanEdit (row) {
479
617
  return this.canEdit && // 是编辑状态
480
618
  (this.disabledOldDataRow ? !row.__old__ : true) && // 老数据行不置灰/置灰时是新增数据
481
619
  !row.__readonly__; // 不能为只读数据
482
620
  },
621
+ // 行内容是否可编辑
622
+ getRowCanEdit (row) {
623
+ return this.getRowBtnCanEdit(row) &&
624
+ !row.__isQuote__; // 不能为引用过来的数据,引用的可以
625
+ },
626
+ // 列本身是否可编辑
483
627
  getColCanEdit (col, row) {
484
628
  return (col._oldReadonly ? !row.__old__ : true) && // 老数据行里某些列不可编辑
485
629
  (["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType) ? row.isLeaf !== false : true) && // 级联表格 -“需要计的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
486
630
  col._enterType !== "calculate" && // 计算的不可编辑
487
631
  col._readonly !== true; // 不能为只读
488
632
  },
633
+ // 单元格最终编辑状态
489
634
  getUnitCanEdit (col, row) {
490
635
  return this.getRowCanEdit(row) &&
491
636
  this.getColCanEdit(col, row) &&
@@ -29,17 +29,26 @@
29
29
  class="DshModal-header"
30
30
  >
31
31
  <slot name="header">
32
- <div class="ivu-modal-header-inner ">
32
+ <div class="ivu-modal-header-inner">
33
33
  {{ selfPropsObj.title }}
34
34
  </div>
35
35
  </slot>
36
36
 
37
37
  <slot name="header-right"></slot>
38
+
39
+ <!-- 关闭按图标 -这是定位上去的 -->
40
+ <Icon
41
+ v-if="mode === 'fullscreen'"
42
+ class="DshModal-close"
43
+ type="md-close"
44
+ size="20"
45
+ @click.native.stop="visibleChange(false)"
46
+ />
38
47
  </div>
39
48
 
40
- <!-- 关闭按图标 -->
49
+ <!-- 关闭按图标 -这是定位上去的 -->
41
50
  <Icon
42
- v-if="selfPropsObj.showSlotClose"
51
+ v-if="mode !== 'fullscreen' && selfPropsObj.showSlotClose"
43
52
  class="DshModal-close"
44
53
  type="md-close"
45
54
  size="20"
@@ -59,7 +68,10 @@
59
68
  export default {
60
69
  name: "DshModal",
61
70
  props: {
62
- value: Boolean,
71
+ value: {
72
+ type: Boolean,
73
+ default: false
74
+ },
63
75
  mode: {
64
76
  type: String,
65
77
  default: "default",
@@ -98,8 +110,9 @@
98
110
  // resetDragPosition: false, // Modal 再次打开时,是否重置拖拽的位置
99
111
  transfer: true,
100
112
  showSlotClose: true, // 显示删除
101
-
113
+ fullscreen: this.mode === "fullscreen",
102
114
  ...this.propsObj,
115
+
103
116
  class: [
104
117
  "DshModal",
105
118
  `DshModal-${this.mode}`,
@@ -12,6 +12,7 @@
12
12
  background-clip: border-box;
13
13
  }
14
14
  }
15
+
15
16
  // 宽度为6
16
17
  .bri-scrollbar6 {
17
18
  &::-webkit-scrollbar {
@@ -34,4 +35,12 @@
34
35
  background-color: #f75252;
35
36
  font-size: 12px;
36
37
  color: #ffffff;
38
+ }
39
+
40
+ .bri-badge-small {
41
+ height: 16px;
42
+ line-height: 14px;
43
+ border-radius: 8px;
44
+ min-width: 16px;
45
+ padding: 0 4px;
37
46
  }
@@ -12,7 +12,8 @@ const getHeadRender = function (h, column, {
12
12
  paddingLeft: "8px",
13
13
  paddingRight: column._description ? "26px" : "8px",
14
14
  verticalAlign: "middle",
15
- position: "relative"
15
+ position: "relative",
16
+ marginRight: ["number", "date"].includes(column._type) && column.align === "right" ? "10px" : 0
16
17
  }
17
18
  }, [
18
19
  showRequired && column._required && h("i", {