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
@@ -1,997 +1,91 @@
1
- import { regionData, resourceData } from "bri-datas";
1
+ /* -------------------- 表格 -------------- */
2
+ // 转化表单字段属性 to 表格参数, 是否需要过滤tag
3
+ const transformToColumns = function (form) {
4
+ return form
5
+ .filter(col => col._type !== "tag")
6
+ .map(col => {
7
+ const typeData = this.$modFieldMap[col._type] || {};
2
8
 
3
- const transformToColumns = function (form, filterTag = false) {
4
- const themeColor = "#3DB8C5";
5
- // 转换为十进制
6
- const toDecimal = function (x) {
7
- let f = parseFloat(x);
8
- if (isNaN(f)) {
9
- return;
10
- }
11
- f = Math.round(x * 100) / 100;
12
- return f;
13
- };
14
- let columns = [];
15
- form.filter((item) => item._type !== "tag" || filterTag).map((item) => {
16
- let col = {
17
- ...item,
18
- title: item._name,
19
- field: item._key,
20
- width: item._width,
21
- titleAlign: item._align || "left",
22
- columnAlign: item._align || "left",
23
- isResize: true
24
- };
25
- let titleWidth = (col.title ? col.title.length * 16 : 36) + 40;
26
- if (["text", "textarea"].includes(col._type)) {
27
- col.width = col._width || 200;
28
- col.componentName = "dsh-td-render";
29
- col.render = (h, params) => {
30
- if (params.row[col._key]) {
31
- return h(
32
- "div",
33
- {
34
- domProps: {
35
- innerHTML: params.row[col._key]
36
- }
37
- }
38
- );
39
- // return h(
40
- // "Ctooltip",
41
- // {
42
- // props: {
43
- // placement: "top",
44
- // transfer: true,
45
- // maxWidth: "200",
46
- // content: params.row[col._key]
47
- // },
48
- // style: {
49
- // width: "100%"
50
- // }
51
- // },
52
- // [
53
- // h(
54
- // "span",
55
- // {
56
- // class: "dsh-ellipsis",
57
- // domProps: {
58
- // innerHTML: params.row[col._key]
59
- // }
60
- // }
61
- // )
62
- // ]
63
- // );
64
- } else {
65
- return h("span", "暂无数据");
66
- }
67
- };
68
- } else if (["idcard", "email", "phone", "serialNumber"].includes(col._type)) {
69
- // 205, 110, 165
70
- if (["idcard"].includes(col._type)) {
71
- col.width = col._width || 190;
72
- } else if (["serialNumber"].includes(col._type)) {
73
- col.width = col._width || 140;
74
- } else if (["email"].includes(col._type)) {
75
- col.width = col._width || 200;
76
- } else {
77
- col.width = col._width || 130;
78
- }
79
- col.formatter = (row, index) => {
80
- return row[col._key] ? `<i class="dsh-margin-right5"></i>${row[col._key]}` : "暂无数据";
81
- };
82
- } else if (["number"].includes(col._type)) {
83
- col.width = col._width || 120;
84
- col.columnAlign = item._align || "right";
85
- col.titleAlign = item._align || "right";
86
- col.orderBy = "";
87
- col.componentName = "dsh-td-render";
88
-
89
- if (col._numberFormat == "percent") {
90
- col.render = (h, params) => {
91
- let content = params.row[col._key];
92
- content = content || content === 0
93
- ? `${content}%`
94
- : "暂无数据";
95
-
96
- return h(
97
- "Ctooltip",
98
- {
99
- props: {
100
- placement: "top",
101
- transfer: true,
102
- content: String(content)
103
- },
104
- style: {
105
- // width: "100%"
106
- }
107
- },
108
- [
109
- h(
110
- "span",
111
- {
112
- class: "dsh-ellipsis"
113
- },
114
- content
115
- )
116
- ]
117
- );
118
- };
119
- } else {
120
- col.render = (h, params) => {
121
- let content = params.row[col._key];
122
- content = content || content === 0
123
- ? this.$numToStrAndUnit(content, col)
124
- : "暂无数据";
125
-
126
- return h(
127
- "Ctooltip",
128
- {
129
- props: {
130
- placement: "top",
131
- transfer: true,
132
- content
133
- },
134
- style: {
135
- width: "100%"
136
- }
137
- },
138
- [
139
- h(
140
- "span",
141
- {
142
- class: "dsh-ellipsis"
143
- },
144
- content
145
- )
146
- ]
147
- );
148
- };
149
- }
9
+ return {
10
+ title: col._name,
11
+ field: col._key,
12
+ key: col._key,
13
+ align: col._align || typeData.align,
14
+ width: col._width || typeData.width,
15
+ sortBy: col._sortBy || typeData.sortBy,
150
16
 
151
- if (col._showProgress) {
152
- col.render = (h, params) => {
153
- return h("Progress", {
154
- props: {
155
- percent: params.row[col._key] > 100 ? 100 : toDecimal(params.row[col._key]),
156
- textInside: true,
157
- strokeWidth: 20
158
- },
159
- style: {
160
- lineHeight: "20px",
161
- width: "100%",
162
- overflow: "hidden"
163
- }
164
- });
165
- };
166
- }
167
- } else if (["date"].includes(col._type)) {
168
- switch (col._dateType) {
169
- case "date":
170
- col.width = col._width || 120;
171
- break;
172
- case "year":
173
- col.width = col._width || 96;
174
- break;
175
- case "month":
176
- col.width = col._width || 120;
177
- break;
178
- case "time":
179
- col.width = col._width || 120;
180
- break;
181
- case "datetime":
182
- col.width = col._width || 180;
183
- break;
184
- default:
185
- col.width = col._width || 120;
186
- break;
187
- }
188
- col.columnAlign = item._align || "center";
189
- col.titleAlign = item._align || "center";
190
- col.orderBy = "";
191
- col.componentName = "dsh-td-render";
192
- col.render = (h, params) => {
193
- let content = params.row[col._key];
194
- content = col._formate && content ? this.$dateFormat(content, col._formate) : content;
195
- if (params.row[col._key]) {
196
- return h(
197
- "Ctooltip",
198
- {
199
- props: {
200
- content,
201
- transfer: true
202
- }
203
- },
204
- [
205
- h(
206
- "div",
207
- {
208
- class: "dsh-ellipsis"
209
- },
210
- content
211
- )
212
- ]
213
- );
214
- } else {
215
- return h(
216
- "span",
217
- {
218
- style: {}
219
- },
220
- "暂无数据"
221
- );
222
- }
223
-
224
- };
225
- } else if (["switch"].includes(col._type)) {
226
- col.width = col._width || 80;
227
- col.columnAlign = item._align || "center";
228
- col.titleAlign = item._align || "center";
229
- col.formatter = (row, index) => {
230
- return row[col._key] == undefined ? null : row[col._key] === false ? col._closeText : col._openText;
231
- };
232
- col.componentName = "dsh-td-render";
233
- col.render = (h, params) => {
234
- return h("i-switch", {
235
- props: {
236
- size: "small",
237
- disabled: true,
238
- value: params.row[col._key]
239
- },
240
- style: {
241
- textAlign: "center"
242
- }
243
- });
244
- };
245
- } else if (["select"].includes(col._type)) {
246
- col.width = col._width || 120;
247
- col.columnAlign = item._align || "center";
248
- col.titleAlign = item._align || "center";
249
- col.componentName = "dsh-td-render";
250
- let colorMap = col.colorMap || resourceData.colorMap;
251
- col.render = (h, params) => {
252
- let data = col._data.find((item) => item._key === params.row[col._key]) || { name: "暂无数据" };
253
- if (data.name || params.row[col._key]) {
254
- return h(
255
- "Ctooltip",
256
- {
257
- props: {
258
- placement: "top",
259
- transfer: true,
260
- content: data.name || params.row[col._key]
261
- },
262
- style: {
263
- display: "flex",
264
- alignItems: "center",
265
- width: "100%"
266
- }
267
- },
268
- [
269
- h(
270
- "div",
271
- {
272
- style: {
273
- width: "100%"
274
- }
275
- },
276
- [
277
- h(
278
- "span",
279
- {
280
- style: {
281
- backgroundColor: col._useColor ? this.$getColor(colorMap[data.color] || colorMap["color-1"], 0.1) : "",
282
- color: col._useColor ? colorMap[data.color] || colorMap["color-1"] : "#666"
283
- },
284
- class: "table-select-common dsh-ellipsis"
285
- },
286
- data.name || params.row[col._key]
287
- )
288
- ]
289
- )
290
- ]
291
- );
292
- }
293
- };
294
- } else if (["checkbox"].includes(col._type)) {
295
- col.componentName = "dsh-td-render";
296
- col.width = col._width || 180;
297
- let colorMap = col.colorMap || resourceData.colorMap;
298
- col.render = (h, params) => {
299
- if (col._data && col._data.length === 0) {
300
- return h(
301
- "span",
302
- {
303
- style: {}
304
- },
305
- "未配置资源库"
306
- );
307
- } else if (params.row[col._key] && params.row[col._key].length === 0) {
308
- return h(
309
- "span",
310
- {
311
- style: {}
312
- },
313
- "暂无数据"
314
- );
315
- }
316
- else if (col._data && col._data.length > 0 && params.row[col._key] && params.row[col._key].length > 0) {
317
- let colArr = col._data.filter((item) => params.row[col._key].includes(item._key));
318
- return h(
319
- "div",
320
- {
321
- style: {
322
- display: "flex",
323
- overflow: "hidden"
324
- }
325
- },
326
- [
327
- ...colArr.map((item) => {
328
- return h(
329
- "Ctooltip",
330
- {
17
+ ...(
18
+ col._type
19
+ ? col._type === "operation"
20
+ ? {
21
+ renderBodyCell: (params, h) => {
22
+ return h("dsh-buttons", {
331
23
  props: {
332
- placement: "top",
333
- transfer: true,
334
- content: item.name
24
+ list: col._getBtnList ? col._getBtnList.call(this, params.row) : this.$getOperationList(col._list),
25
+ itemClass: "table-operation-btn"
335
26
  },
336
- style: {
337
- minWidth: "35px",
338
- marginLeft: "3px"
27
+ on: {
28
+ click: (operationItem) => {
29
+ this.$dispatchEvent(operationItem, params);
30
+ }
339
31
  }
340
- },
341
- [
342
- h(
343
- "div",
344
- {
345
- style: {
346
- background: col._useColor ? this.$getColor(colorMap[item.color] || colorMap["color-1"], 0.1) : "",
347
- color: col._useColor ? colorMap[item.color] || colorMap["color-1"] : "666"
348
- },
349
- class: "table-select-common dsh-ellipsis"
350
- },
351
- item.name
352
- )
353
- ]
354
- );
355
- })
356
- ]
357
- );
358
- }
359
- };
360
- } else if (["cascader", "region"].includes(col._type)) {
361
- col.width = col._type === "cascader" ? col._width || 150 : col._width || 212;
362
- col.componentName = "dsh-td-render";
363
- col.render = (h, params) => {
364
- if (params.row[col._key] && params.row[col._key].length > 0) {
365
- let content = this.$getTreeLinealDatas(params.row[col._key], col._type === "cascader" ? col._data : regionData, "name").join("/");
366
- return h(
367
- "Ctooltip",
368
- {
369
- props: {
370
- content,
371
- transfer: true
372
- }
373
- },
374
- [
375
- h(
376
- "div",
377
- {
378
- class: "dsh-ellipsis"
379
- },
380
- content
381
- )
382
- ]
383
- );
384
- } else {
385
- if (params.row[col._key] === null) {
386
- console.log(`${col._name}字段${col._type}类型,值却为null,这是数据bug!`);
387
- }
388
- return h("span", "暂无数据");
389
- }
390
- };
391
- } else if (["cascaders", "regions"].includes(col._type)) {
392
- col.width = col._width || 250;
393
- col.componentName = "dsh-td-render";
394
-
395
- const cascaderData = ["regions"].includes(col._type) ? regionData : col._data;
396
- col.render = (h, params) => {
397
- if (params.row[col._key] && params.row[col._key].length > 0) {
398
- let colArr = (params.row[col._key] || []).map((item) => this.$getTreeLinealDatas(item, cascaderData, "name").join("/"));
399
- return h(
400
- "div",
401
- {
402
- style: {
403
- display: "flex",
404
- overflow: "hidden"
32
+ });
33
+ }
405
34
  }
406
- },
407
- [
408
- ...colArr.map((item) => {
409
- return h(
410
- "Ctooltip",
411
- {
35
+ : {
36
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
37
+ return h("dsh-unit", {
412
38
  props: {
413
- placement: "top",
414
- transfer: true,
415
- content: item
416
- },
417
- style: {
418
- minWidth: "35px",
419
- marginLeft: "3px"
39
+ formData: row,
40
+ formItem: col,
41
+ rowIndex: rowIndex,
42
+ canEdit: false,
43
+ isUnit: true
420
44
  }
421
- },
422
- [
423
- h(
424
- "div",
425
- {
426
- style: {
427
- maxWidth: "100%",
428
- background: "#ECF3FD",
429
- color: "#3D84EE"
430
- },
431
- class: "table-select-common dsh-ellipsis"
432
- },
433
- item
434
- )
435
- ]
436
- );
437
- })
438
- ]
439
- );
440
- } else {
441
- if (params.row[col._key] === null) {
442
- console.log(`${col._name}字段${col._type}类型,值却为null,这是数据bug!`);
443
- }
444
- return h("span", "暂无数据");
445
- }
446
- };
447
- } else if (["file", "image"].includes(col._type)) {
448
- col.width = col._width || 150;
449
- col.titleAlign = item._align || "center";
450
- col.columnAlign = item._align || "center";
451
- col.componentName = "dsh-td-render";
452
-
453
- // 缩略图展示模式 和 默认展示模式
454
- col.render = col._listShowMode === "thumbnail"
455
- ? (h, params) => {
456
- return params.row[col._key] && params.row[col._key].length
457
- ? h(
458
- "dsh-file-show",
459
- {
460
- props: {
461
- list: params.row[col._key]
45
+ });
462
46
  }
463
47
  }
464
- )
465
- : h("div", {
466
- style: {
467
- textAlign: "center"
468
- }
469
- }, "--");
470
- }
471
- : (h, params) => {
472
- return h(
473
- "div",
474
- {
475
- style: {
476
- textAlign: "center"
477
- }
478
- },
479
- [
480
- h("Icon", {
481
- props: {
482
- custom: col._fileType == "file" ? "bico-font bico-file" : "bico-font bico-img"
48
+ : {}
49
+ ),
50
+ ...(
51
+ ["select", "checkbox"].includes(col._type)
52
+ ? {
53
+ filter: {
54
+ isMultiple: true,
55
+ maxHeight: 300,
56
+ filterList: col._data.map(item => ({
57
+ ...item,
58
+ value: item._key,
59
+ label: item.name,
60
+ selected: false
61
+ })),
62
+ filterConfirm: (filterList) => {
63
+ let conditionItem = {
64
+ logic: "field",
65
+ fieldKey: col._key,
66
+ fieldType: col._type,
67
+ fieldValue: filterList.filter(dataItem => dataItem.selected).map(dataItem => dataItem._key),
68
+ fieldOperator: "eq"
69
+ };
70
+ this.filterConfirm && this.filterConfirm(conditionItem);
483
71
  },
484
- class: "table-icon-common dsh-margin-right5"
485
- }),
486
- h(
487
- "span",
488
- {
489
- class: "table-text-common"
490
- },
491
- col._fileType == "file"
492
- ? `${params.row[col._key] ? params.row[col._key].length : 0}个`
493
- : `${params.row[col._key] ? params.row[col._key].length : 0}张`
494
- )
495
- ]
496
- );
497
- };
498
- } else if (["flatTable", "cascaderTable"].includes(col._type)) {
499
- col.width = col._width || 100;
500
- col.columnAlign = item._align || "center";
501
- col.titleAlign = item._align || "center";
502
- col.componentName = "dsh-td-render";
503
- col.render = (h, params) => {
504
- return h(
505
- "div",
506
- {
507
- style: {
508
- width: "100%",
509
- overflow: "hidden"
510
- }
511
- },
512
- [
513
- h(
514
- "span",
515
- {
516
- style: {
517
- display: "inline-block",
518
- height: "24px",
519
- lineHeight: "24px",
520
- padding: "0 5px",
521
- margin: "auto",
522
- background: "rgba(96, 144, 237, 0.15)",
523
- borderRadius: "12px",
524
- textAlign: "center",
525
- color: themeColor
72
+ filterReset: () => {
73
+ let conditionItem = {
74
+ logic: "field",
75
+ fieldKey: col._key,
76
+ fieldType: col._type,
77
+ fieldValue: [],
78
+ fieldOperator: "eq"
79
+ };
80
+ this.filterReset && this.filterReset(conditionItem);
526
81
  }
527
- },
528
- [
529
- h("Icon", {
530
- props: {
531
- custom: col._type == "cascaderTable" ? "bico-font bico-Cascadetable" : "bico-font bico-internaltable"
532
- },
533
- class: "table-icon-common dsh-margin-right5"
534
- }),
535
- h(
536
- "span",
537
- {
538
- class: "table-text-common"
539
- },
540
- col._type == "flatTable"
541
- ? `${params.row[col._key] ? params.row[col._key].list.length : 0}行`
542
- : `${params.row[col._key] ? this.$getTreeLeafTotal(params.row[col._key].tree) : 0} 行`
543
- )
544
- ]
545
- )
546
- ]
547
- );
548
- };
549
- } else if (["editor"].includes(col._type)) {
550
- col.width = col._width || 110;
551
- col.componentName = "dsh-td-render";
552
- col.render = (h, params) => {
553
- return h(
554
- "div",
555
- {
556
- style: {
557
- width: "100%",
558
- overflow: "hidden",
559
- textAlign: "center"
560
- }
561
- },
562
- [
563
- h(
564
- "span",
565
- {
566
- style: {
567
- display: "inline-block",
568
- height: "24px",
569
- lineHeight: "24px",
570
- padding: "0 5px",
571
- margin: "auto",
572
- border: `1px solid ${themeColor}`,
573
- textAlign: "center",
574
- color: themeColor
575
- }
576
- },
577
- [
578
- h(
579
- "span",
580
- {
581
- class: "table-text-common"
582
- },
583
- col.title
584
- )
585
- ]
586
- )
587
- ]
588
- );
589
- };
590
- } else if (["departments"].includes(col._type)) {
591
- col.width = col._width || 100;
592
- col.componentName = "dsh-td-render";
593
- col.render = (h, params) => {
594
- let departStr = "";
595
- if (params.row[col._key] && params.row[col._key].length > 0) {
596
- params.row[col._key].forEach((ele) => {
597
- departStr += (ele && (ele.name || ele.realname || ele.mobile || ele)) + ",";
598
- });
599
- departStr = departStr.substring(0, departStr.length - 1);
600
- } else {
601
- departStr = "暂无数据";
602
- }
603
- return departStr
604
- ? h(
605
- "Ctooltip",
606
- {
607
- props: {
608
- content: departStr,
609
- transfer: true
610
- }
611
- },
612
- [
613
- h(
614
- "div",
615
- {
616
- class: "dsh-ellipsis"
617
- },
618
- departStr
619
- )
620
- ]
621
- )
622
- : departStr;
623
- };
624
- } else if (["users"].includes(col._type)) {
625
- col.width = col._width || Math.max(titleWidth, 120);
626
- col.componentName = "dsh-td-render";
627
- col.render = (h, params) => {
628
- // 兼容对对象形势下的处理
629
- if (this.$dataType(params.row[col._key], "object")) {
630
- params.row[col._key] = [params.row[col._key]];
631
- }
632
-
633
- if (params.row[col._key] && params.row[col._key].length > 0) {
634
- return h(
635
- "div",
636
- {
637
- class: "dsh-ellipsis",
638
- style: {
639
- paddingLeft: "5px"
640
82
  }
641
- },
642
- params.row[col._key]
643
- .filter((item) => !!item)
644
- .map((item) => {
645
- return h("img", {
646
- attrs: {
647
- src: item.avatarurl || this.$imageSrcMap.system.boy
648
- },
649
- style: {
650
- width: "18px",
651
- height: "18px",
652
- marginLeft: "-5px",
653
- borderRadius: "50%",
654
- verticalAlign: "middle"
655
- }
656
- });
657
- })
658
- .concat(
659
- h(
660
- "span",
661
- {
662
- style: {
663
- width: "18px",
664
- height: "18px",
665
- verticalAlign: "middle",
666
- marginLeft: "7px"
667
- }
668
- },
669
- params.row[col._key][0] &&
670
- (params.row[col._key][0].name ||
671
- params.row[col._key][0].realname ||
672
- params.row[col._key][0].mobile ||
673
- params.row[col._key][0])
674
- )
675
- )
676
- );
677
- } else {
678
- return h("span", "暂无数据");
679
- }
680
- };
681
- } else if (["reference"].includes(col._type)) {
682
- col.width = col._width || 250;
683
- col.componentName = "dsh-td-render";
684
- col.titleAlign = item._align || "center";
685
- col.columnAlign = item._align || "center";
686
- col.render = (h, params) => {
687
- if (!params.row[col._key]) {
688
- return h("span", "暂无数据");
689
- }
690
- let content = params.row[col._key] && params.row[col._key]._name;
691
- while (content && content._name) {
692
- content = content._name;
693
- }
694
-
695
- if (Array.isArray(content)) {
696
- content = (content[0] && content[0].name) || "";
697
- }
698
- return h(
699
- "Ctooltip",
700
- {
701
- props: {
702
- placement: "top",
703
- transfer: true,
704
- content: String(content) || "单条关联"
705
- }
706
- },
707
- [
708
- h(
709
- "span",
710
- {
711
- style: {
712
- height: "24px",
713
- lineHeight: 1.6,
714
- display: "inline-block",
715
- width: "fit-content",
716
- maxWidth: "100%",
717
- verticalAlign: "middle",
718
- margin: "auto",
719
- background: "#f2f8ff",
720
- border: "1px solid #3DB8C5",
721
- borderRadius: "4px",
722
- color: themeColor,
723
- padding: "0 5px"
724
- },
725
- class: "dsh-ellipsis"
726
- },
727
- [
728
- h("Icon", {
729
- props: {
730
- type: "ios-link"
731
- },
732
- class: "table-reference-icon"
733
- }),
734
- h("span", {}, content || "单条关联")
735
- ]
736
- )
737
- ]
738
- );
739
- };
740
- } else if (["referenceBy"].includes(col._type)) {
741
- col.titleAlign = item._align || "center";
742
- col.columnAlign = item._align || "center";
743
- col.width = col._width || 100;
744
- col.componentName = "dsh-td-render";
745
- col.render = (h, params) => {
746
- let count = (params.row[col._key] && params.row[col._key].count) || 0;
747
- return h(
748
- "span",
749
- {
750
- style: {
751
- display: "inline-block",
752
- width: "54px",
753
- height: "24px",
754
- lineHeight: "24px",
755
- // marginLeft: "50%",
756
- // transform: "translateX(-50%)",
757
- background: "rgba(96, 144, 237, 0.15)",
758
- borderRadius: "12px",
759
- textAlign: "center",
760
- color: themeColor
761
- }
762
- },
763
- [
764
- h("Icon", {
765
- props: {
766
- type: "ios-link"
767
- },
768
- class: "table-icon-common dsh-margin-right5"
769
- }),
770
- h(
771
- "span",
772
- {
773
- class: "table-text-common"
774
- },
775
- `${count}条`
776
- )
777
- ]
778
- );
779
- };
780
- } else if (["link"].includes(col._type)) {
781
- col.width = col._width || Math.max(titleWidth, 100);
782
- col.componentName = "dsh-td-render";
783
- col.render = (h, params) => {
784
- return h(
785
- "div",
786
- {
787
- class: "dsh-ellipsis"
788
- },
789
- [
790
- h("Icon", {
791
- props: {
792
- type: "ios-link"
793
- },
794
- class: "table-icon-common dsh-margin-right5"
795
- }),
796
- h(
797
- "span",
798
- {
799
- class: "table-text-common"
800
- },
801
- params.row[col._key]
802
- )
803
- ]
804
- );
805
- };
806
- } else if (["render"].includes(col._type)) {
807
- col.width = col._width || Math.max(titleWidth, 100);
808
- col.componentName = "dsh-td-render";
809
- col.render = col._render;
810
- } else if (["action"].includes(col._type)) {
811
- col.type = "expane";
812
- // col.isFrozenRight = col._isFrozenRight;
813
- col.componentName = "dsh-td-render";
814
- col.titleAlign = item._align || "center";
815
- col.columnAlign = item._align || "center";
816
- col.render = (h, params) => {
817
- return h("dsh-buttons", {
818
- props: {
819
- list: col._getBtnList ? col._getBtnList.call(this, params.row) : this.$getOperationList(col._list),
820
- itemClass: "table-operation-btn"
821
- },
822
- on: {
823
- click: (operationItem) => {
824
- this.$dispatchEvent(operationItem, params);
825
83
  }
826
- }
827
- });
84
+ : {}
85
+ ),
86
+ ...col
828
87
  };
829
- } else if (["coordinates"].includes(col._type)) {
830
- col.width = col._width || 110;
831
- col.columnAlign = item._align || "center";
832
- col.titleAlign = item._align || "center";
833
- col.componentName = "dsh-td-render";
834
- col.render = (h, params) => {
835
- return h(
836
- "div",
837
- {
838
- style: {
839
- width: "100%",
840
- overflow: "hidden"
841
- }
842
- },
843
- [
844
- h(
845
- "span",
846
- {
847
- style: {
848
- display: "inline-block",
849
- height: "24px",
850
- lineHeight: "24px",
851
- padding: "0 5px",
852
- margin: "auto",
853
- background: "rgba(96, 144, 237, 0.15)",
854
- borderRadius: "12px",
855
- textAlign: "center",
856
- color: themeColor
857
- }
858
- },
859
- [
860
- h("Icon", {
861
- props: {
862
- custom: "bico-font bico-position"
863
- },
864
- style: {
865
- fontSize: "18px",
866
- color: themeColor
867
- }
868
- }),
869
- h(
870
- "span",
871
- {
872
- style: {
873
- fontSize: "14px",
874
- color: themeColor
875
- }
876
- },
877
- params.row[col._key] && params.row[col._key].name || "暂无数据"
878
- )
879
- ]
880
- )
881
- ]
882
- );
883
- };
884
- } else if (["labels"].includes(col._type)) {
885
- col.width = col._width || 250;
886
- col.columnAlign = item._align || "center";
887
- col.titleAlign = item._align || "center";
888
- col.componentName = "dsh-td-render";
889
-
890
- col.render = (h, params) => {
891
- if (params.row[col._key] && params.row[col._key].length > 0) {
892
- return h(
893
- "div",
894
- {
895
- style: {
896
- display: "flex",
897
- overflow: "hidden"
898
- }
899
- },
900
- [
901
- ...params.row[col._key].map((item) => {
902
- return h(
903
- "Ctooltip",
904
- {
905
- props: {
906
- placement: "top",
907
- transfer: true,
908
- content: item.name
909
- },
910
- style: {
911
- minWidth: "35px",
912
- marginLeft: "3px"
913
- }
914
- },
915
- [
916
- h(
917
- "div",
918
- {
919
- style: {
920
- maxWidth: "100%",
921
- background: "#ECF3FD",
922
- color: "#3D84EE"
923
- },
924
- class: "table-select-common dsh-ellipsis"
925
- },
926
- item.name
927
- )
928
- ]
929
- );
930
- })
931
- ]
932
- );
933
- } else {
934
- return h("span", "暂无数据");
935
- }
936
- };
937
- } else if (["package"].includes(col._type)) {
938
- col.width = col._width || 100;
939
- col.columnAlign = item._align || "center";
940
- col.titleAlign = item._align || "center";
941
- col.componentName = "dsh-td-render";
942
- col.render = (h, params) => {
943
- if (params.row[col._key] && params.row[col._key].length > 0) {
944
- return h(
945
- "div",
946
- {
947
- style: {
948
- width: "100%",
949
- overflow: "hidden"
950
- }
951
- },
952
- [
953
- h(
954
- "span",
955
- {
956
- style: {
957
- display: "inline-block",
958
- height: "24px",
959
- lineHeight: "24px",
960
- padding: "0 5px",
961
- margin: "auto",
962
- background: "rgba(96, 144, 237, 0.15)",
963
- borderRadius: "12px",
964
- textAlign: "center",
965
- color: themeColor
966
- }
967
- },
968
- [
969
- h("Icon", {
970
- props: {
971
- custom: "bico-font bico-Cascadetable"
972
- },
973
- class: "table-icon-common dsh-margin-right5"
974
- }),
975
- h(
976
- "span",
977
- {
978
- class: "table-text-common"
979
- },
980
- `${params.row[col._key] ? params.row[col._key].form.length : 0}项`
981
- )
982
- ]
983
- )
984
- ]
985
- );
986
- } else {
987
- return h("span", "暂无数据");
988
- }
989
- };
990
- }
991
-
992
- columns.push(col);
993
88
  });
994
- return columns;
995
89
  };
996
90
 
997
91
  export default {