bri-components 1.0.5 → 1.1.1

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.
Files changed (119) hide show
  1. package/lib/0.bri-components.min.js +1 -1
  2. package/lib/1.bri-components.min.js +1 -1
  3. package/lib/2.bri-components.min.js +1 -1
  4. package/lib/3.bri-components.min.js +1 -1
  5. package/lib/4.bri-components.min.js +1 -1
  6. package/lib/5.bri-components.min.js +1 -1
  7. package/lib/6.bri-components.min.js +1 -1
  8. package/lib/7.bri-components.min.js +1 -0
  9. package/lib/8.bri-components.min.js +1 -0
  10. package/lib/9.bri-components.min.js +1 -0
  11. package/lib/bri-components.min.js +13 -5
  12. package/lib/styles/bundle.css +0 -2
  13. package/package.json +2 -1
  14. package/src/components/controls/base/BriLabels.vue +223 -0
  15. package/src/components/controls/base/DshCascader.vue +24 -43
  16. package/src/components/controls/base/DshCascaderMultiple.vue +1 -1
  17. package/src/components/controls/base/DshCheckbox.vue +14 -4
  18. package/src/components/controls/base/DshCoordinates.vue +88 -87
  19. package/src/components/controls/base/DshDate.vue +10 -34
  20. package/src/components/controls/base/DshDivider.vue +1 -1
  21. package/src/components/controls/base/DshEditor.vue +57 -44
  22. package/src/components/controls/base/DshInput.vue +18 -45
  23. package/src/components/controls/base/DshLabels.vue +8 -4
  24. package/src/components/controls/base/DshNumber/DshNumber.vue +6 -20
  25. package/src/components/controls/base/DshNumberange.vue +1 -1
  26. package/src/components/controls/base/DshPackage.vue +7 -1
  27. package/src/components/controls/base/DshSelect.vue +15 -5
  28. package/src/components/controls/base/DshSwitch.vue +2 -6
  29. package/src/components/controls/base/YSerialNumber.vue +0 -1
  30. package/src/components/controls/base/ZUpload/index.vue +16 -10
  31. package/src/components/controls/base/ZUpload/upload-list.vue +17 -12
  32. package/src/components/controls/base/ZUpload/uploadMixin.js +1 -5
  33. package/src/components/controls/base/controlShow.vue +52 -0
  34. package/src/components/controls/base/textMultiple/DshTextMultiple.vue +1 -1
  35. package/src/components/controls/controlMap.js +4 -0
  36. package/src/components/controls/controlMixin.js +18 -12
  37. package/src/components/controls/senior/cascaderTable.vue +188 -0
  38. package/src/components/controls/senior/flatTable.vue +136 -0
  39. package/src/components/form/DshForm.vue +4 -3
  40. package/src/components/list/BriFlatTable.vue +435 -0
  41. package/src/components/list/BriTable.vue +184 -0
  42. package/src/components/list/DshBox/DshBox.vue +1 -1
  43. package/src/components/list/DshBox/DshCard.vue +1 -1
  44. package/src/components/list/DshBox/DshCrossTable.vue +1 -1
  45. package/src/components/list/DshBox/DshList.vue +3 -3
  46. package/src/components/list/DshBox/DshPanel.vue +5 -10
  47. package/src/components/list/DshBox/DshSingleData.vue +1 -1
  48. package/src/components/list/DshBox/DshTable.vue +29 -39
  49. package/src/components/list/DshCascaderTable.vue +8 -12
  50. package/src/components/list/DshFlatTable.vue +1 -1
  51. package/src/components/list/easyTable/v-table/src/table.vue +3 -3
  52. package/src/components/list/evTable/EvTable.vue +1 -1
  53. package/src/components/other/BriTransfer.vue +71 -0
  54. package/src/components/other/ZGantt.vue +2 -2
  55. package/src/components/small/BriButton.vue +65 -0
  56. package/src/components/small/BriTree.vue +42 -0
  57. package/src/components/small/Ctooltip.vue +1 -1
  58. package/src/components/small/DshButtons.vue +12 -42
  59. package/src/components/small/DshControlDefine.vue +2 -1
  60. package/src/components/small/DshDropdown.vue +1 -1
  61. package/src/components/small/DshTdRender.js +1 -1
  62. package/src/components/unit/DshFormItem.vue +0 -2
  63. package/src/components/unit/DshUnit.vue +1 -1
  64. package/src/components/unit/unitMixin.js +4 -1
  65. package/src/index.js +24 -4
  66. package/src/styles/bundle.css +0 -2
  67. package/src/styles/common/common.less +2 -2
  68. package/src/styles/common/control.less +54 -0
  69. package/src/styles/common/index.less +1 -0
  70. package/src/styles/components/controls/BriLabels.less +119 -0
  71. package/src/styles/components/controls/DshCascader.less +3 -3
  72. package/src/styles/components/controls/DshCheckbox.less +1 -1
  73. package/src/styles/components/controls/DshCoordinates.less +8 -3
  74. package/src/styles/components/controls/DshDate.less +54 -0
  75. package/src/styles/components/controls/DshDaterange.less +1 -1
  76. package/src/styles/components/controls/DshEditor.less +27 -9
  77. package/src/styles/components/controls/DshInput.less +11 -5
  78. package/src/styles/components/controls/DshLabels.less +1 -1
  79. package/src/styles/components/controls/DshSelect.less +46 -30
  80. package/src/styles/components/controls/ZUpload.less +82 -91
  81. package/src/styles/components/controls/cascaderTable.less +33 -0
  82. package/src/styles/components/controls/controlShow.less +10 -0
  83. package/src/styles/components/controls/flatTable.less +33 -0
  84. package/src/styles/components/form/DshAdvSearchForm.less +6 -6
  85. package/src/styles/components/index.less +11 -1
  86. package/src/styles/components/list/BriFlatTable.less +8 -0
  87. package/src/styles/components/list/BriTable.less +155 -0
  88. package/src/styles/components/list/DshFlatTable.less +3 -8
  89. package/src/styles/components/list/evTable.less +1 -1
  90. package/src/styles/components/other/BriTransfer.less +65 -0
  91. package/src/styles/components/other/DshEditPanel.less +2 -2
  92. package/src/styles/components/other/DshMenuNav.less +5 -5
  93. package/src/styles/components/other/ZGantt.less +5 -5
  94. package/src/styles/components/small/BriButton.less +259 -0
  95. package/src/styles/components/small/BriTree.less +57 -0
  96. package/src/styles/components/small/Ctooltip.less +14 -0
  97. package/src/styles/components/small/DshButtons.less +1 -1
  98. package/src/styles/components/small/DshControlDefine.less +13 -35
  99. package/src/styles/components/small/DshDropdown.less +1 -1
  100. package/src/styles/components/small/DshPage.less +1 -1
  101. package/src/styles/components/small/DshTabs.less +2 -2
  102. package/src/styles/components/small/DshTitle.less +0 -3
  103. package/src/styles/components/unit/DshFormItem.less +6 -7
  104. package/src/styles/iconfont/iconfont.css +254 -0
  105. package/src/styles/iconfont/iconfont.eot +0 -0
  106. package/src/styles/iconfont/iconfont.js +1 -0
  107. package/src/styles/iconfont/iconfont.json +422 -0
  108. package/src/styles/iconfont/iconfont.svg +137 -0
  109. package/src/styles/iconfont/iconfont.ttf +0 -0
  110. package/src/styles/iconfont/iconfont.woff +0 -0
  111. package/src/styles/iconfont/iconfont.woff2 +0 -0
  112. package/src/styles/index.less +2 -5
  113. package/src/styles/plugin/easytable.less +22 -0
  114. package/src/styles/plugin/index.less +2 -0
  115. package/src/styles/plugin/iview.less +34 -0
  116. package/src/styles/variables.less +71 -88
  117. package/src/utils/table.js +72 -978
  118. package/src/styles/define.less +0 -374
  119. package/src/styles/view_reset.less +0 -452
@@ -0,0 +1,435 @@
1
+ <template>
2
+ <div class="BriFlatTable">
3
+ <bri-table
4
+ class="BriFlatTable-main"
5
+ :propsObj="tablePropsObj"
6
+ :columns="showColumns"
7
+ :data="listData"
8
+ :footer-data="footerData"
9
+ @selectChange="changeSelect"
10
+ @selectAll="changeSelect"
11
+ ></bri-table>
12
+
13
+ <!-- 添加行 -->
14
+ <dsh-buttons
15
+ class="BriFlatTable-create"
16
+ :list="$getOperationList(['create'])"
17
+ @click="$dispatchEvent($event, null, null, listData)"
18
+ ></dsh-buttons>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: "BriFlatTable",
25
+ props: {
26
+ canEdit: {
27
+ type: Boolean,
28
+ default: true
29
+ },
30
+ columns: {
31
+ type: Array,
32
+ default () {
33
+ return [];
34
+ }
35
+ },
36
+ data: {
37
+ type: Array,
38
+ default () {
39
+ return [];
40
+ }
41
+ },
42
+ oldData: {
43
+ type: Array,
44
+ default () {
45
+ return [];
46
+ }
47
+ },
48
+ rowDefault: {
49
+ type: Object,
50
+ default () {
51
+ return {};
52
+ }
53
+ },
54
+
55
+ outObj: {
56
+ type: Object,
57
+ default () {
58
+ return {};
59
+ }
60
+ },
61
+ propsObj: {
62
+ type: Object,
63
+ default () {
64
+ return {};
65
+ }
66
+ }
67
+ },
68
+ model: {
69
+ prop: "data",
70
+ event: "change"
71
+ },
72
+ data () {
73
+ return {
74
+ showRuleMessage: false, // 显示校验文字
75
+ ruleRecordMap: {}
76
+ };
77
+ },
78
+ computed: {
79
+ tablePropsObj () {
80
+ return {
81
+ maxHeight: this.contentHeight
82
+ };
83
+ },
84
+ listData () {
85
+ this.data.forEach(item => {
86
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
87
+ });
88
+ return this.data;
89
+ },
90
+ footerData () {
91
+ let row = { _id: this.$ObjectID().str, custome: "汇总" };
92
+ this.filterColumns.map(col => {
93
+ if (col._type === "number") {
94
+ row[col._key] = this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 });
95
+ }
96
+ });
97
+ return this.useSummary && this.listData.length ? [row] : [];
98
+ },
99
+ oldListData () {
100
+ this.oldData.forEach(item => {
101
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
102
+ });
103
+ return this.oldData;
104
+ },
105
+
106
+ selfPropsObj () {
107
+ return {
108
+ isShare: false, // 是否是分享页在用
109
+
110
+ _contentHeight: 500,
111
+ _useSelection: false, // 使用选择列
112
+ _useIndex: true, // 使用序号列
113
+ _useSummary: false, // 使用汇总行
114
+ _disabledBtns: false, // 禁用增删按钮
115
+ _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
116
+ _disabledOldDataRow: false, // 置灰老数据行包含删除
117
+
118
+ ...this.propsObj
119
+ };
120
+ },
121
+ isShare () {
122
+ return this.selfPropsObj.isShare;
123
+ },
124
+ contentHeight () {
125
+ return this.selfPropsObj._contentHeight;
126
+ },
127
+ useSelection () {
128
+ return this.selfPropsObj._useSelection;
129
+ },
130
+ useIndex () {
131
+ return this.selfPropsObj._useIndex;
132
+ },
133
+ useSummary () {
134
+ return this.selfPropsObj._useSummary;
135
+ },
136
+ disabledBtns () {
137
+ return this.selfPropsObj._disabledBtns;
138
+ },
139
+ disabledCreateBtn () {
140
+ return this.selfPropsObj._disabledCreateBtn;
141
+ },
142
+ disabledOldDataRow () {
143
+ return this.selfPropsObj._disabledOldDataRow;
144
+ },
145
+ useCampare () {
146
+ return !!this.oldListData.length;
147
+ },
148
+ filterColumns () {
149
+ return this.columns.filter(colItem => colItem._displayType !== "hide" && this.$isAdvRelyShow(colItem, this.outObj));
150
+ },
151
+ showColumns () {
152
+ const operationList = this.$getOperationList(["delete"]);
153
+ const showColumns = [
154
+ ...(
155
+ this.useSelection === true
156
+ ? [
157
+ {
158
+ field: "selection",
159
+ key: "selection",
160
+ type: "checkbox",
161
+ width: 66,
162
+ align: "center",
163
+ fixed: "left"
164
+ }
165
+ ]
166
+ : []
167
+ ),
168
+
169
+ ...(
170
+ this.useIndex === true
171
+ ? [
172
+ {
173
+ title: "序号",
174
+ field: "custome",
175
+ key: "customes",
176
+ width: 76,
177
+ align: "center",
178
+ fixed: "left",
179
+ renderBodyCell: ({ rowIndex }) => ++rowIndex
180
+ }
181
+ ]
182
+ : []
183
+ ),
184
+
185
+ ...this.$transformToColumns(this.filterColumns.map(item => ({
186
+ filter: undefined,
187
+ sortBy: undefined,
188
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
189
+ return [
190
+ this.isShowCompare(column, row, this.oldListData[rowIndex])
191
+ ? h("Tooltip", {
192
+ class: "td-inner-compare",
193
+ props: {
194
+ content: this.$isEmptyData(this.oldListData[rowIndex][column._key]) ? "" : this.oldListData[rowIndex][column._key],
195
+ transfer: true,
196
+ maxWidth: 200,
197
+ placement: "top"
198
+ },
199
+ scopedSlots: {
200
+ default: props => h("dsh-unit", {
201
+ props: {
202
+ canEdit: this.getUnitCanEdit(column, row),
203
+ parentData: this.listData,
204
+ formData: row,
205
+ formItem: this.resetCol(item),
206
+ rowIndex: rowIndex,
207
+ isUnit: !this.canEdit
208
+ },
209
+ on: {
210
+ blur: () => this.controlBlur(null, column, row, arguments),
211
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
212
+ }
213
+ })
214
+ }
215
+ })
216
+ : h("dsh-unit", {
217
+ props: {
218
+ canEdit: this.getUnitCanEdit(column, row),
219
+ parentData: this.listData,
220
+ formData: row,
221
+ formItem: this.resetCol(item),
222
+ rowIndex: rowIndex,
223
+ isUnit: !this.canEdit
224
+ },
225
+ on: {
226
+ blur: () => this.controlBlur(null, column, row, arguments),
227
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
228
+ }
229
+ }),
230
+ !this.getRuleResult(column, row).bool &&
231
+ h("span", { class: "table-row-td-tip" }, this.getRuleResult(column, row).message)
232
+ ];
233
+ },
234
+ renderHeaderCell: ({ column }, h) => {
235
+ return h("span", [
236
+ column._required && h("i", { style: { color: "#ed4014" } }, "*"),
237
+ h("span", column.title),
238
+ column._description &&
239
+ h("Tooltip", {
240
+ style: { display: "inline-block" },
241
+ props: {
242
+ content: column._description,
243
+ transfer: true,
244
+ maxWidth: 200
245
+ },
246
+ scopedSlots: {
247
+ default: props => h("i", { class: "table-head-description ivu-icon bico-font bico-explain" })
248
+ }
249
+ })
250
+ ]);
251
+ },
252
+ ...item
253
+ }))),
254
+
255
+ ...(
256
+ this.canEdit && operationList.length
257
+ ? [
258
+ {
259
+ title: "操作",
260
+ field: "operation",
261
+ key: "operation",
262
+ align: "center",
263
+ fixed: "right",
264
+ width: 100,
265
+ renderBodyCell: (params, h) => {
266
+ return h("dsh-buttons", {
267
+ props: {
268
+ list: operationList.map(btnItem => ({ ...btnItem, disabled: this.disabledOldDataRow && !params.row.__isCreate__ }))
269
+ },
270
+ on: {
271
+ click: (operationItem) => {
272
+ this.$dispatchEvent(operationItem, params.row, params.index, this.listData);
273
+ }
274
+ }
275
+ });
276
+ }
277
+ }
278
+ ]
279
+ : []
280
+ )
281
+ ];
282
+ return showColumns;
283
+ },
284
+ selfRowDefault () {
285
+ return this.$filterObj(this.columns, this.rowDefault);
286
+ },
287
+ operationMap () {
288
+ const allOperationMap = {
289
+ create: {
290
+ name: "添加一行",
291
+ type: "create",
292
+ size: "default",
293
+ long: true,
294
+ disabled: !!this.disabledCreateBtn,
295
+ event: "clickCreate",
296
+ btnType: "default"
297
+ },
298
+ delete: {
299
+ name: "删除",
300
+ type: "delete",
301
+ btnType: "errorText",
302
+ icon: "ios-trash-outline",
303
+ size: "small",
304
+ disabled: false,
305
+ event: "clickDelete"
306
+ },
307
+ // expand: {
308
+ // name: "展开",
309
+ // type: "expand",
310
+ // event: "clickExpand"
311
+ // },
312
+ changeVal: {
313
+ name: "改变输入框值",
314
+ type: "changeVal",
315
+ event: "changeVal"
316
+ }
317
+ };
318
+
319
+ return this.canEdit
320
+ ? this.$categoryMapToMap(
321
+ allOperationMap,
322
+ null,
323
+ this.disabledBtns ? ["create", "delete"] : []
324
+ )
325
+ : {};
326
+ }
327
+ },
328
+ created () {
329
+ },
330
+ methods: {
331
+ // 共外部使用
332
+ validate () {
333
+ this.showRuleMessage = true;
334
+
335
+ return this.listData.every(dataItem =>
336
+ this.filterColumns.every(col => this.getRuleResult(col, dataItem, true).bool)
337
+ );
338
+ },
339
+ // 点击 -添加行
340
+ clickCreate (operationItem, row, index, list) {
341
+ const newRow = {
342
+ ...this.$deepCopy(this.selfRowDefault),
343
+ __isCreate__: true,
344
+ _id: this.$ObjectID().str
345
+ };
346
+ const newRowIndex = index == null ? list.length : index + 1;
347
+ list.splice(newRowIndex, 0, newRow);
348
+ this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
349
+
350
+ this.change("createRow", null, newRow, newRowIndex);
351
+ },
352
+ // 点击 -删除行
353
+ clickDelete (operationItem, row, rowIndex, list) {
354
+ this.$Modal.confirm({
355
+ title: "警告",
356
+ content: "确定删除吗?",
357
+ onOk: () => {
358
+ list.splice(rowIndex, 1);
359
+
360
+ this.change("deleteRow", null, row, rowIndex);
361
+ }
362
+ });
363
+ },
364
+ changeSelect (list) {
365
+ this.$emit("selectChange", list);
366
+ },
367
+ // 表单控件值改变
368
+ changeVal (operationItem, col, row, rowIndex, params) {
369
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
370
+
371
+ this.change("changeVal", col, row, rowIndex, ...params);
372
+ },
373
+ // 表单控件失去焦点
374
+ controlBlur (operationItem, col, row, params) {
375
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
376
+ },
377
+ change (...params) {
378
+ this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
379
+ },
380
+
381
+ /* --------------- 工具方法 ------------- */
382
+ resetCol (col) {
383
+ let obj = {
384
+ select: {
385
+ _optionKind: "dropdown"
386
+ },
387
+ checkbox: {
388
+ _optionKind: "dropdown"
389
+ }
390
+ };
391
+ return {
392
+ ...col,
393
+ ...(obj[col._type] || {}),
394
+ isShare: this.isShare
395
+ };
396
+ },
397
+ getUnitCanEdit (col, row) {
398
+ return this.canEdit && // 是否是编辑状态
399
+ // (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
400
+ (!this.disabledOldDataRow || !!row.__isCreate__) && // 是否让老数据行置灰
401
+ (!col.dependRowCanEdit || row.canEdit !== false); // 在老数据行里某些列不可编辑
402
+ },
403
+ isShowCompare (col, row, oldRow = {}) {
404
+ return this.useCampare && ["number"].includes(col._type) &&
405
+ !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
406
+ row[col._key] !== oldRow[col._key];
407
+ },
408
+ // 是否显示 单元格校验提示文字
409
+ getRuleResult (col, row, showRuleMessage = this.showRuleMessage) {
410
+ if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || showRuleMessage) {
411
+ const val = row[col._key];
412
+ const ruleConfig = this.$getFormTypeRuleConfig(col);
413
+ // 为空 校验必填;不为空 格式校验 (不是必填也要校验格式)
414
+ return this.$isEmptyData(val)
415
+ ? {
416
+ bool: !col._required,
417
+ message: `${col._name}为必填项`
418
+ }
419
+ : ruleConfig.regs && ruleConfig.regs.length
420
+ ? {
421
+ bool: ruleConfig.regs.every(regItem => regItem.test(val)),
422
+ message: col.regMessage || `${col._name}格式不正确`
423
+ }
424
+ : {
425
+ bool: true
426
+ };
427
+ } else {
428
+ return {
429
+ bool: true
430
+ };
431
+ }
432
+ }
433
+ }
434
+ };
435
+ </script>
@@ -0,0 +1,184 @@
1
+ <template>
2
+ <div class="bri-table">
3
+ <ve-table
4
+ class="bri-table-content"
5
+ :class="[selfClassName, selfPropsObj.className]"
6
+ :table-data="data"
7
+ :footer-data="footerData"
8
+ :columns="columnsList"
9
+ :show-header="selfPropsObj.showHeader"
10
+ :fixed-header="selfPropsObj.fixedHeader"
11
+ :fixed-footer="selfPropsObj.fixedFooter"
12
+ :scroll-width="selfPropsObj.scrollWidth"
13
+ :max-height="selfPropsObj.maxHeight"
14
+ :row-key-field-name="selfPropsObj.rowKeyFieldName"
15
+ :border-around="selfPropsObj.borderAround"
16
+ :border-x="selfPropsObj.borderX"
17
+ :border-y="selfPropsObj.borderY"
18
+ :cellSpanOption="selfPropsObj.cellSpanOption"
19
+ :columnHiddenOption="selfPropsObj.columnHiddenOption"
20
+ :cellStyleOption="cellStyleOption"
21
+ :rowStyleOption="rowStyleOption"
22
+ :expandOption="selfPropsObj.expandOption"
23
+ :checkbox-option="checkboxOption"
24
+ :radioOption="selfPropsObj.radioOption"
25
+ :sortOption="sortOption"
26
+ :cellSelectionOption="selfPropsObj.cellSelectionOption"
27
+ :editOption="selfPropsObj.editOption"
28
+ :contextmenuHeaderOption="selfPropsObj.contextmenuHeaderOption"
29
+ :contextmenuBodyOption="selfPropsObj.contextmenuBodyOption"
30
+ :event-custom-option="eventCustomOption"
31
+ :cellAutofillOption="selfPropsObj.cellAutofillOption"
32
+ :clipboardOption="selfPropsObj.clipboardOption"
33
+ :columnWidthResizeOption="columnWidthResizeOption"
34
+ ></ve-table>
35
+ <!-- loading -->
36
+ <div v-if="isLoading" class="bri-table-empty bri-table-loading">
37
+ <slot name="loading">正在加载中,请稍后...</slot>
38
+ </div>
39
+ <!-- empty -->
40
+ <div v-else-if="!data.length" class="bri-table-empty">
41
+ <slot name="empty">{{ noDataText }}</slot>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ export default {
48
+ name: "BriTable",
49
+ props: {
50
+ propsObj: {
51
+ type: Object,
52
+ default () {
53
+ return {};
54
+ }
55
+ },
56
+ isLoading: Boolean,
57
+ noDataText: {
58
+ type: String,
59
+ default: "暂无内容"
60
+ },
61
+ columns: Array,
62
+ data: Array,
63
+ footerData: Array
64
+ },
65
+ data () {
66
+ // 中文文档https://happy-coding-clans.github.io/vue-easytable/#/zh/doc/table/api
67
+ return {
68
+ };
69
+ },
70
+ computed: {
71
+ selfPropsObj () {
72
+ return {
73
+ rowKeyFieldName: "_id",
74
+ scrollWidth: "0",
75
+ borderY: true,
76
+ cellSelectionOption: {
77
+ enable: false
78
+ },
79
+ ...this.propsObj
80
+ };
81
+ },
82
+ columnsList () {
83
+ return this.columns;
84
+ },
85
+
86
+ // 当前表格状态
87
+ currentState () {
88
+ return this.propsObj.state || this.state;
89
+ },
90
+ selfClassName () {
91
+ if (this.loading || !this.data.length) {
92
+ return "bri-table-onlyhead";
93
+ } else {
94
+ return "";
95
+ }
96
+ },
97
+
98
+ rowStyleOption () {
99
+ return {
100
+ clickHighlight: false,
101
+ ...(this.propsObj.rowStyleOption || {})
102
+ };
103
+ },
104
+
105
+ cellStyleOption () {
106
+ return {
107
+ headerCellClass: () => {
108
+ return "bri-table-th";
109
+ },
110
+ bodyCellClass: ({rowIndex}) => {
111
+ return "bri-table-td";
112
+ },
113
+ ...(this.propsObj.cellStyleOption || {})
114
+ };
115
+ },
116
+ // 自定义表格事件,也可配置鼠标事件
117
+ eventCustomOption () {
118
+ return {
119
+ bodyRowEvents: ({ row, rowIndex }) => {
120
+ return {
121
+ click: (event) => {
122
+ this.$emit("click-row", row, rowIndex, event);
123
+ },
124
+ dblclick: (event) => {
125
+ this.$emit("db-click-row", row, rowIndex, event);
126
+ }
127
+ };
128
+ },
129
+ ...(this.propsObj.eventCustomOption || {})
130
+ };
131
+ },
132
+ // 全选配置项
133
+ checkboxOption () {
134
+ return {
135
+ // 行选择改变事件
136
+ selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
137
+ this.$emit(
138
+ "selectChange",
139
+ this.data.filter(dataItem => selectedRowKeys.includes(dataItem[this.selfPropsObj.rowKeyFieldName])),
140
+ { row, isSelected, selectedRowKeys }
141
+ );
142
+ },
143
+ // 全选改变事件
144
+ selectedAllChange: ({ isSelected, selectedRowKeys }) => {
145
+ this.$emit(
146
+ "selectAll",
147
+ this.data.filter(dataItem => selectedRowKeys.includes(dataItem[this.selfPropsObj.rowKeyFieldName])),
148
+ { isSelected, selectedRowKeys }
149
+ );
150
+ },
151
+ ...(this.propsObj.checkboxOption || {})
152
+ };
153
+ },
154
+ // 列宽改变设置项
155
+ columnWidthResizeOption () {
156
+ return {
157
+ enable: true,
158
+ minWidth: 80,
159
+ sizeChange: ({ column, differWidth, columnWidth }) => {
160
+ this.$emit("size-change", column, differWidth, columnWidth);
161
+ },
162
+ ...(this.propsObj.columnWidthResizeOption || {})
163
+ };
164
+ },
165
+ sortOption () {
166
+ return {
167
+ sortChange: (params) => {
168
+ let sortObj =
169
+ Object.keys(params)
170
+ .filter(attr => !!params[attr])
171
+ .reduce((obj, attr) => {
172
+ return { sortType: params[attr], field: attr };
173
+ }, {});
174
+ this.$emit("sort-change", sortObj);
175
+ },
176
+ ...(this.propsObj.sortOption || {})
177
+ };
178
+ }
179
+ },
180
+ mounted () {
181
+ },
182
+ methods: {}
183
+ };
184
+ </script>
@@ -13,7 +13,7 @@
13
13
  :propsObj="listPropsObj"
14
14
  :changedFields="changedFields"
15
15
  :isLoading="listPropsObj && listPropsObj.isLoading"
16
- :noDataText="listPropsObj && listPropsObj.noDataText || '暂无数据...'"
16
+ :noDataText="listPropsObj && listPropsObj.noDataText || '暂无内容...'"
17
17
  @clickRow="clickRow"
18
18
  @sortChange="changeSort"
19
19
  @selectChange="changeSelect"
@@ -113,7 +113,7 @@
113
113
  },
114
114
  noDataText: {
115
115
  type: String,
116
- default: "暂无数据..."
116
+ default: "暂无内容..."
117
117
  }
118
118
  },
119
119
  data () {
@@ -367,7 +367,7 @@
367
367
 
368
368
  noDataText: {
369
369
  type: String,
370
- default: "暂无数据..."
370
+ default: "暂无内容..."
371
371
  },
372
372
  changedFields: {
373
373
  type: Array,
@@ -133,12 +133,12 @@
133
133
  >
134
134
  <div class="row-item-inner dsh-ellipsis">
135
135
  <dsh-td-render
136
- v-if="col.render"
136
+ v-if="col.renderBodyCell"
137
137
  class="ms-ellipsis"
138
138
  :row="row"
139
139
  :column="col"
140
140
  :index="index"
141
- :render="col.render"
141
+ :render="col.renderBodyCell"
142
142
  ></dsh-td-render>
143
143
  <template v-else-if="col.formatter">
144
144
  <div v-html="col.formatter(row, index)"></div>
@@ -225,7 +225,7 @@
225
225
  },
226
226
  noDataText: {
227
227
  type: String,
228
- default: "暂无数据..."
228
+ default: "暂无内容..."
229
229
  }
230
230
  },
231
231
  data () {