bri-components 1.3.27 → 1.3.29
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 +1 -1
- package/src/components/controls/base/BriUpload/BriUpload.vue +10 -10
- package/src/components/controls/base/BriUpload/uploadList.vue +3 -3
- package/src/components/controls/base/DshCascader/DshCascader.vue +2 -2
- package/src/components/controls/base/DshCascader/components/cascaderModal.vue +3 -3
- package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +4 -4
- package/src/components/controls/base/DshCoordinates.vue +10 -9
- package/src/components/controls/base/DshNumber/DshNumber.vue +2 -2
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +1 -1
- package/src/components/controls/base/DshSelect/DshSelect.vue +2 -2
- package/src/components/controls/mixins/cascaderMixin.js +1 -1
- package/src/components/controls/mixins/cascaderPickerMixin.js +2 -2
- package/src/components/controls/mixins/controlMixin.js +1 -1
- package/src/components/controls/mixins/selectMixin.js +1 -1
- package/src/components/controls/senior/cascaderTable.vue +1 -4
- package/src/components/controls/senior/selectDepartments.vue +18 -1
- package/src/components/controls/senior/selectUsers/selectUsers.vue +19 -4
- package/src/components/list/DshBox/DshCrossTable.vue +11 -2
- package/src/components/list/DshCascaderTable.vue +120 -118
- package/src/components/list/DshTreeTable.vue +57 -49
- package/src/components/list/mixins/tableBaseMixin.js +2 -2
- package/src/styles/components/list/BriTable.less +41 -31
- package/src/styles/global/text.less +0 -3
- package/src/utils/table.js +6 -5
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
'BriUpload-disabled': canEdit && !finalCanEdit,
|
|
16
16
|
'BriUpload-readonly': !canEdit,
|
|
17
17
|
'BriUpload-unit': !canEdit && isInTable,
|
|
18
|
-
[`BriUpload-${
|
|
18
|
+
[`BriUpload-${showMode}`]: true,
|
|
19
19
|
}"
|
|
20
20
|
>
|
|
21
21
|
<!-- 编辑 -->
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
>
|
|
41
41
|
|
|
42
42
|
<slot>
|
|
43
|
-
<div :class="`BriUpload-${
|
|
43
|
+
<div :class="`BriUpload-${showMode}-add`">
|
|
44
44
|
<!-- 上传 -->
|
|
45
45
|
<i-circle
|
|
46
46
|
v-if="percent"
|
|
47
|
-
:class="`BriUpload-${
|
|
47
|
+
:class="`BriUpload-${showMode}-circle`"
|
|
48
48
|
:percent="percent"
|
|
49
49
|
:stroke-color="percentColor"
|
|
50
50
|
>
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
type="ios-checkmark"
|
|
55
55
|
></Icon>
|
|
56
56
|
<!-- 上传中 -->
|
|
57
|
-
<span v-else-if="
|
|
57
|
+
<span v-else-if="showMode === 'old'">
|
|
58
58
|
{{ percent }}%
|
|
59
59
|
</span>
|
|
60
60
|
</i-circle>
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
@click="clickUpload"
|
|
67
67
|
></dsh-icons>
|
|
68
68
|
|
|
69
|
-
<span v-if="
|
|
69
|
+
<span v-if="showMode !== 'inline'">
|
|
70
70
|
点击上传{{ subType === 'image' ? "图片" : "文件" }}
|
|
71
71
|
</span>
|
|
72
72
|
</template>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
:canEdit="finalCanEdit"
|
|
81
81
|
:files="curValList"
|
|
82
82
|
:emptyShowVal="emptyShowVal"
|
|
83
|
-
:
|
|
83
|
+
:showMode="showMode"
|
|
84
84
|
:propsObj="propsObj"
|
|
85
85
|
@deleteItem="clickDeteItem"
|
|
86
86
|
></upload-list>
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
selfPropsObj () {
|
|
139
139
|
return {
|
|
140
140
|
_fileType: "file",
|
|
141
|
-
|
|
141
|
+
_showMode: this.isHeightAuto ? "old" : "inline", // 宽度为100%、且不在级联表格或内部表格里的 显示老版
|
|
142
142
|
// _multiple: true,
|
|
143
143
|
_useType: "drag",
|
|
144
144
|
_maxSize: 1024 * 1024,
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
subType () {
|
|
154
154
|
return this.selfPropsObj._fileType;
|
|
155
155
|
},
|
|
156
|
-
|
|
157
|
-
return this.isInTable ? "inline" : this.selfPropsObj.
|
|
156
|
+
showMode () {
|
|
157
|
+
return this.isInTable ? "inline" : this.selfPropsObj._showMode;
|
|
158
158
|
},
|
|
159
159
|
useType () {
|
|
160
160
|
return this.selfPropsObj._useType;
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
[`${prefixCls}-select`]: this.useType === "select",
|
|
179
179
|
[`${prefixCls}-drag`]: this.useType === "drag",
|
|
180
180
|
[`${prefixCls}-dragOver`]: this.useType === "drag" && this.dragOver,
|
|
181
|
-
[`BriUpload-${this.
|
|
181
|
+
[`BriUpload-${this.showMode}-wrapper`]: true
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="uploadList"
|
|
4
|
-
:class="`uploadList-${
|
|
4
|
+
:class="`uploadList-${showMode}`"
|
|
5
5
|
>
|
|
6
6
|
<!-- 普通文本模式 -->
|
|
7
|
-
<template v-if="
|
|
7
|
+
<template v-if="showMode ==='old'">
|
|
8
8
|
<!-- 有值 -->
|
|
9
9
|
<div
|
|
10
10
|
v-if="files.length"
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
return [];
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
showMode: {
|
|
120
120
|
type: String,
|
|
121
121
|
default: "old" // inline, old, normal
|
|
122
122
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
class="DshCascader"
|
|
6
6
|
>
|
|
7
7
|
<component
|
|
8
|
-
:is="showTypeMap[
|
|
8
|
+
:is="showTypeMap[showMode]"
|
|
9
9
|
v-model="showModal"
|
|
10
10
|
:activeValue="curValList"
|
|
11
11
|
:data="cascaderData"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
class="DshCascaders"
|
|
78
78
|
>
|
|
79
79
|
<component
|
|
80
|
-
:is="showTypeMap[
|
|
80
|
+
:is="showTypeMap[showMode]"
|
|
81
81
|
v-model="showModal"
|
|
82
82
|
:multipleMode="multipleMode"
|
|
83
83
|
:data="cascaderData"
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
<div
|
|
41
41
|
v-if="canUseModeSwitch"
|
|
42
42
|
class="mode"
|
|
43
|
-
@click="
|
|
43
|
+
@click="searchMode = searchMode === 'default' ? 'flat' : 'default'"
|
|
44
44
|
>
|
|
45
45
|
<dsh-icons :list="[{ icon: 'md-swap' }]" />
|
|
46
46
|
<span class="mode-name">
|
|
47
|
-
{{
|
|
47
|
+
{{ searchMode === "default" ? "按层级" : "按平级" }}
|
|
48
48
|
</span>
|
|
49
49
|
</div>
|
|
50
50
|
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
|
|
207
207
|
search () {
|
|
208
208
|
this.selectedValue = [];
|
|
209
|
-
this.
|
|
209
|
+
this.searchMode = "default";
|
|
210
210
|
},
|
|
211
211
|
clickItem (node) {
|
|
212
212
|
// 避免重复点击
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
<div
|
|
52
52
|
v-if="canUseModeSwitch"
|
|
53
53
|
class="mode"
|
|
54
|
-
@click="
|
|
54
|
+
@click="searchMode = searchMode === 'default' ? 'flat' : 'default'"
|
|
55
55
|
>
|
|
56
56
|
<dsh-icons :list="[{ icon: 'md-swap' }]" />
|
|
57
57
|
<span class="mode-name">
|
|
58
|
-
{{
|
|
58
|
+
{{ searchMode === "default" ? "按层级" : "按平级" }}
|
|
59
59
|
</span>
|
|
60
60
|
</div>
|
|
61
61
|
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
|
|
244
244
|
search () {
|
|
245
245
|
this.selectedValue = [];
|
|
246
|
-
this.
|
|
246
|
+
this.searchMode = "default";
|
|
247
247
|
this.curTabIndex = 0;
|
|
248
248
|
},
|
|
249
249
|
clickItem (node) {
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
// 区分展示方式
|
|
264
|
-
if (this.
|
|
264
|
+
if (this.searchMode === "default" && node.children.length) {
|
|
265
265
|
this.curTabIndex = this.curTabIndex + 1;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -191,13 +191,14 @@
|
|
|
191
191
|
computed: {
|
|
192
192
|
selfPropsObj () {
|
|
193
193
|
return {
|
|
194
|
+
_showType: "marker", // "marker", "multipleMarker", "polyline", "polygon", "rectangle"
|
|
194
195
|
_icon: "ios-map-outline",
|
|
195
196
|
|
|
196
197
|
...this.propsObj,
|
|
197
198
|
...this.commonDealPropsObj
|
|
198
199
|
};
|
|
199
200
|
},
|
|
200
|
-
|
|
201
|
+
showMode () {
|
|
201
202
|
return this.selfPropsObj._showType;
|
|
202
203
|
},
|
|
203
204
|
|
|
@@ -323,7 +324,7 @@
|
|
|
323
324
|
if (!this.$isEmptyData(this.newVal)) {
|
|
324
325
|
this.handleAddMarker(this.newVal.lnglat, true);
|
|
325
326
|
|
|
326
|
-
if (this.
|
|
327
|
+
if (this.showMode === "multipleMarker") { // 多选打开绘图功能
|
|
327
328
|
this.finalCanEdit && this.handleOpenDraw();
|
|
328
329
|
}
|
|
329
330
|
} else {
|
|
@@ -332,10 +333,10 @@
|
|
|
332
333
|
},
|
|
333
334
|
handleMouseToolCallback (e) {
|
|
334
335
|
if (e.obj.CLASS_NAME === "AMap.Marker") {
|
|
335
|
-
if (this.
|
|
336
|
+
if (this.showMode === "marker") {
|
|
336
337
|
this.plot = e.obj;
|
|
337
338
|
this.handleCloseDraw();
|
|
338
|
-
} else if (this.
|
|
339
|
+
} else if (this.showMode === "multipleMarker") {
|
|
339
340
|
if (this.plot) {
|
|
340
341
|
this.plot.push(e.obj);
|
|
341
342
|
} else {
|
|
@@ -369,7 +370,7 @@
|
|
|
369
370
|
}
|
|
370
371
|
},
|
|
371
372
|
// 打开绘图
|
|
372
|
-
handleOpenDraw (type = this.
|
|
373
|
+
handleOpenDraw (type = this.showMode) {
|
|
373
374
|
switch (type) {
|
|
374
375
|
case "marker": {
|
|
375
376
|
this.mouseTool.marker(markerOpt);
|
|
@@ -402,7 +403,7 @@
|
|
|
402
403
|
this.mouseTool.close();
|
|
403
404
|
},
|
|
404
405
|
// 添加图形
|
|
405
|
-
handleAddMarker (location, centerView = true, type = this.
|
|
406
|
+
handleAddMarker (location, centerView = true, type = this.showMode) {
|
|
406
407
|
location = JSON.parse(JSON.stringify(location));
|
|
407
408
|
// 分类型添加
|
|
408
409
|
if (["polygon", "rectangle", "circle"].includes(type)) {
|
|
@@ -417,12 +418,12 @@
|
|
|
417
418
|
!this.marker && (this.marker = new AMap.Marker());
|
|
418
419
|
this.marker.setPosition(location);
|
|
419
420
|
this.marker.setMap(this.map);
|
|
420
|
-
if (this.
|
|
421
|
+
if (this.showMode === "marker") {
|
|
421
422
|
this.handleRmoveMarker();
|
|
422
423
|
this.handleCloseDraw();
|
|
423
424
|
this.newVal.lnglat = [location];
|
|
424
425
|
this.getRegeoCode();
|
|
425
|
-
} else if (this.
|
|
426
|
+
} else if (this.showMode === "multipleMarker") {
|
|
426
427
|
this.newVal.lnglat.push(location);
|
|
427
428
|
this.getRegeoCode();
|
|
428
429
|
}
|
|
@@ -445,7 +446,7 @@
|
|
|
445
446
|
}
|
|
446
447
|
},
|
|
447
448
|
// 移除图形
|
|
448
|
-
handleRmoveMarker (type = this.
|
|
449
|
+
handleRmoveMarker (type = this.showMode) {
|
|
449
450
|
if (["default"].includes(type)) {
|
|
450
451
|
this.marker && this.map.remove(this.marker);
|
|
451
452
|
this.plot && this.map.remove(this.plot);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
class="DshSelect"
|
|
6
6
|
>
|
|
7
7
|
<!-- flat方式 -->
|
|
8
|
-
<template v-if="['flat', 'button'].includes(
|
|
8
|
+
<template v-if="['flat', 'button'].includes(showMode)">
|
|
9
9
|
<!-- 有选项 -->
|
|
10
10
|
<template v-if="listData.length">
|
|
11
11
|
<RadioGroup
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
};
|
|
162
162
|
},
|
|
163
163
|
radioGroupType () {
|
|
164
|
-
return this.
|
|
164
|
+
return this.showMode === "button" ? "button" : undefined;
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
created () {},
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
33
33
|
data () {
|
|
34
34
|
return {
|
|
35
35
|
searchName: "",
|
|
36
|
-
|
|
36
|
+
searchMode: "default", // "flat", "default"
|
|
37
37
|
maxFlatModeSearchNum: 80,
|
|
38
38
|
|
|
39
39
|
inputStr: "",
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
useFlatMode () {
|
|
103
103
|
return this.filterable &&
|
|
104
104
|
this.canUseModeSwitch &&
|
|
105
|
-
this.
|
|
105
|
+
this.searchMode === "flat";
|
|
106
106
|
},
|
|
107
107
|
modeTip () {
|
|
108
108
|
return `在搜索时,会出现层级和平级切换开关,但搜索出的结果超${this.maxFlatModeSearchNum}个时,\
|
|
@@ -132,7 +132,7 @@ export default {
|
|
|
132
132
|
return {
|
|
133
133
|
// TODO: 此处的请输入可能还有请选择之类的,待处理
|
|
134
134
|
_placeholder: this.canEdit && this.propsObj._enterType !== "calculate"
|
|
135
|
-
? (this.propsObj._placeholder ||
|
|
135
|
+
? (this.propsObj._placeholder || `${selectControlTypes.includes(this.controlType) ? "选择" : "输入"}${this.propsObj._name}`)
|
|
136
136
|
: undefined,
|
|
137
137
|
_clearable: this.finalCanEdit && (this.propsObj._clearable === undefined ? true : this.propsObj._clearable),
|
|
138
138
|
_disabled: this.propsObj._disabled || ["serialNumber"].includes(this.controlType) || !this.finalCanEdit
|
|
@@ -172,11 +172,21 @@
|
|
|
172
172
|
_highSearch: false,
|
|
173
173
|
_changeOnSelect: true,
|
|
174
174
|
_searchString: "",
|
|
175
|
+
_reverseFilter: false,
|
|
176
|
+
_userDepartFilterVals: [],
|
|
175
177
|
|
|
176
178
|
...this.propsObj,
|
|
177
179
|
...this.commonDealPropsObj
|
|
178
180
|
};
|
|
179
181
|
},
|
|
182
|
+
// 反向过滤
|
|
183
|
+
reverseFilter () {
|
|
184
|
+
return this.selfPropsObj._reverseFilter;
|
|
185
|
+
},
|
|
186
|
+
// 禁止显示的部门以及部门下人员
|
|
187
|
+
listFilterVals () {
|
|
188
|
+
return this.selfPropsObj._userDepartFilterVals || [];
|
|
189
|
+
},
|
|
180
190
|
highSearch () {
|
|
181
191
|
return this.isOnSearch ? true : this.selfPropsObj._highSearch;
|
|
182
192
|
},
|
|
@@ -295,7 +305,14 @@
|
|
|
295
305
|
},
|
|
296
306
|
callback: data => {
|
|
297
307
|
this.loading = false;
|
|
298
|
-
this.departmentList =
|
|
308
|
+
this.departmentList = this.listFilterVals.length
|
|
309
|
+
? data.list.filter(
|
|
310
|
+
item =>
|
|
311
|
+
this.reverseFilter
|
|
312
|
+
? !this.listFilterVals.includes(item._key)
|
|
313
|
+
: this.listFilterVals.includes(item._key)
|
|
314
|
+
)
|
|
315
|
+
: data.list;
|
|
299
316
|
}
|
|
300
317
|
});
|
|
301
318
|
}
|
|
@@ -337,7 +337,6 @@
|
|
|
337
337
|
};
|
|
338
338
|
this.curDepartment = {};
|
|
339
339
|
this.pagePropsObj.page = 1;
|
|
340
|
-
this.getUserListData();
|
|
341
340
|
this.getDepartmentListData();
|
|
342
341
|
},
|
|
343
342
|
search () {
|
|
@@ -421,11 +420,11 @@
|
|
|
421
420
|
},
|
|
422
421
|
loadingName: "loading",
|
|
423
422
|
callback: data => {
|
|
424
|
-
this.userList = this.
|
|
423
|
+
this.userList = this.allListFilterVals.length
|
|
425
424
|
? data.list.filter(item =>
|
|
426
425
|
this.reverseFilter
|
|
427
|
-
? !this.
|
|
428
|
-
: this.
|
|
426
|
+
? !this.allListFilterVals.includes(item.departmentKey)
|
|
427
|
+
: this.allListFilterVals.includes(item.departmentKey)
|
|
429
428
|
)
|
|
430
429
|
: data.list;
|
|
431
430
|
this.total = data.total;
|
|
@@ -471,6 +470,10 @@
|
|
|
471
470
|
searchString: this.propsObj.searchString
|
|
472
471
|
},
|
|
473
472
|
callback: data => {
|
|
473
|
+
// 当前部门被过滤,所有子级部门同样过滤
|
|
474
|
+
const depts = data.list.filter(item => this.listFilterVals.includes(item._key));
|
|
475
|
+
this.allListFilterVals = this.getAllListFilterVals(depts).map(item => item._key);
|
|
476
|
+
|
|
474
477
|
this.departmentList = [
|
|
475
478
|
...(
|
|
476
479
|
this.highSearch
|
|
@@ -512,8 +515,20 @@
|
|
|
512
515
|
: data.list
|
|
513
516
|
)
|
|
514
517
|
];
|
|
518
|
+
|
|
519
|
+
this.getUserListData();
|
|
515
520
|
}
|
|
516
521
|
});
|
|
522
|
+
},
|
|
523
|
+
|
|
524
|
+
getAllListFilterVals (list) {
|
|
525
|
+
if (list.length) {
|
|
526
|
+
let stack = [...list];
|
|
527
|
+
return stack.reduce((prev, item) => {
|
|
528
|
+
return prev.concat(item.children && item.children.length ? this.getAllListFilterVals(item.children) : []);
|
|
529
|
+
}, stack);
|
|
530
|
+
}
|
|
531
|
+
return [];
|
|
517
532
|
}
|
|
518
533
|
},
|
|
519
534
|
filters: {
|
|
@@ -196,6 +196,7 @@
|
|
|
196
196
|
:key="dataItem._id"
|
|
197
197
|
class="DshCrossTable-td-checkbox"
|
|
198
198
|
:style="{
|
|
199
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
199
200
|
background: '#f4f4f4',
|
|
200
201
|
textAlign: 'center'
|
|
201
202
|
}"
|
|
@@ -217,6 +218,7 @@
|
|
|
217
218
|
:key="dataItem._id"
|
|
218
219
|
class="DshCrossTable-td-index"
|
|
219
220
|
:style="{
|
|
221
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
220
222
|
background: '#f4f4f4',
|
|
221
223
|
textAlign: 'center'
|
|
222
224
|
}"
|
|
@@ -232,6 +234,9 @@
|
|
|
232
234
|
<div
|
|
233
235
|
v-if="showTable"
|
|
234
236
|
class="DshCrossTable-right-body"
|
|
237
|
+
:style="showScrollX === false ? {
|
|
238
|
+
overflowX: 'hidden'
|
|
239
|
+
} : {}"
|
|
235
240
|
@scroll="tableScroll($event)"
|
|
236
241
|
>
|
|
237
242
|
<!-- 无数据 -->
|
|
@@ -333,6 +338,7 @@
|
|
|
333
338
|
:key="dataItem._id"
|
|
334
339
|
class="DshCrossTable-td-operation"
|
|
335
340
|
:style="{
|
|
341
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
336
342
|
background: '#f4f4f4',
|
|
337
343
|
}"
|
|
338
344
|
>
|
|
@@ -403,6 +409,7 @@
|
|
|
403
409
|
rowWidth: 0,
|
|
404
410
|
colWidth: 0,
|
|
405
411
|
titleWidth: 200,
|
|
412
|
+
showScrollX: false,
|
|
406
413
|
showTable: false,
|
|
407
414
|
currentPage: 1,
|
|
408
415
|
pagesize: 10,
|
|
@@ -557,14 +564,16 @@
|
|
|
557
564
|
let that = this;
|
|
558
565
|
erd.listenTo(document.getElementById("DshCrossTable-right"), function (element) {
|
|
559
566
|
// 计算宽度
|
|
560
|
-
let tableWidth = that.$refs["DshCrossTable-right"].clientWidth;
|
|
567
|
+
let tableWidth = that.$refs["DshCrossTable-right"].clientWidth - 10;
|
|
561
568
|
let nums = tableWidth / 200;
|
|
562
569
|
let dataTotal = that.data.length;
|
|
563
570
|
if (nums >= dataTotal) {
|
|
564
571
|
that.rowWidth = tableWidth;
|
|
565
|
-
that.colWidth =
|
|
572
|
+
that.colWidth = tableWidth / dataTotal;
|
|
573
|
+
that.showScrollX = false;
|
|
566
574
|
} else {
|
|
567
575
|
that.rowWidth = dataTotal * 200;
|
|
576
|
+
that.showScrollX = true;
|
|
568
577
|
}
|
|
569
578
|
|
|
570
579
|
// that.rowWidth = 200 * that.data.length;
|
|
@@ -23,27 +23,26 @@
|
|
|
23
23
|
<tbody>
|
|
24
24
|
<tr>
|
|
25
25
|
<th
|
|
26
|
-
v-for="(
|
|
27
|
-
:key="
|
|
26
|
+
v-for="(column, colIndex) in columns"
|
|
27
|
+
:key="column._id"
|
|
28
28
|
class="table-th bri-table-th"
|
|
29
|
-
:style="getThStyle(
|
|
30
|
-
@click="$dispatchEvent(operationMap.clickTh,
|
|
29
|
+
:style="getThStyle(column, 'th')"
|
|
30
|
+
@click="$dispatchEvent(operationMap.clickTh, column)"
|
|
31
31
|
>
|
|
32
|
-
<dsh-render :render="getHeaderRender(
|
|
32
|
+
<dsh-render :render="getHeaderRender(column)"></dsh-render>
|
|
33
33
|
|
|
34
34
|
<!-- 级联表头 的下拉 -->
|
|
35
35
|
<dsh-dropdown
|
|
36
36
|
v-if="
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$getOperationList(getColOperationNames(col)).length
|
|
37
|
+
column.colType === 'tree' &&
|
|
38
|
+
column.level === treeColumns.length &&
|
|
39
|
+
$getOperationList(getTreeThBtns(column)).length
|
|
41
40
|
"
|
|
42
41
|
class="table-th-dropdown"
|
|
43
42
|
menuClass="table-th-dropdown-list"
|
|
44
43
|
trigger="hover"
|
|
45
|
-
:list="$getOperationList(
|
|
46
|
-
@click="$dispatchEvent($event,
|
|
44
|
+
:list="$getOperationList(getTreeThBtns(column))"
|
|
45
|
+
@click="$dispatchEvent($event, column, colIndex, columns)"
|
|
47
46
|
@click.native.stop="0"
|
|
48
47
|
>
|
|
49
48
|
<a href="javascript:void(0)">
|
|
@@ -76,53 +75,53 @@
|
|
|
76
75
|
:key="row._id"
|
|
77
76
|
class="table-row"
|
|
78
77
|
>
|
|
79
|
-
<template v-for="
|
|
78
|
+
<template v-for="column in getRowColumns(row, rowIndex)">
|
|
80
79
|
<!-- 树节点单元格、汇总单元格 -->
|
|
81
80
|
<td
|
|
82
|
-
v-if="['tree', 'summary'].includes(
|
|
83
|
-
:key="
|
|
81
|
+
v-if="['tree', 'summary'].includes(column.colType)"
|
|
82
|
+
:key="column._key"
|
|
84
83
|
:class="{
|
|
85
|
-
[`table-td-${
|
|
84
|
+
[`table-td-${column.colType}`]: true,
|
|
86
85
|
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
87
86
|
'bri-table-td-edit': canEdit,
|
|
88
87
|
'bri-table-td-show': !canEdit,
|
|
89
88
|
}"
|
|
90
|
-
:style="getTdStyle(
|
|
91
|
-
:rowspan="geTdRowspan(
|
|
92
|
-
:colspan="geTdColspan(
|
|
93
|
-
@click="$dispatchEvent(operationMap.clickNode,
|
|
89
|
+
:style="getTdStyle(column, row)"
|
|
90
|
+
:rowspan="geTdRowspan(column, row)"
|
|
91
|
+
:colspan="geTdColspan(column, row)"
|
|
92
|
+
@click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
|
|
94
93
|
>
|
|
95
94
|
<!-- 树节点单元格 -->
|
|
96
|
-
<template v-if="
|
|
95
|
+
<template v-if="column.colType === 'tree'">
|
|
97
96
|
<!-- 编辑状态 -->
|
|
98
97
|
<Input
|
|
99
|
-
v-if="row[
|
|
100
|
-
:ref="`${
|
|
101
|
-
v-model="row[
|
|
98
|
+
v-if="row[column._key].isEdit"
|
|
99
|
+
:ref="`${column._id}${row._id}`"
|
|
100
|
+
v-model="row[column._key].name"
|
|
102
101
|
class="textarea"
|
|
103
102
|
type="textarea"
|
|
104
|
-
:autosize="{ minRows: geTdRowspan(
|
|
105
|
-
@on-blur="$dispatchEvent(operationMap.blurNode,
|
|
106
|
-
@on-change="$dispatchEvent(operationMap.changeNode,
|
|
103
|
+
:autosize="{ minRows: geTdRowspan(column, row) * 3 - 1, maxRows: 100 }"
|
|
104
|
+
@on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
|
|
105
|
+
@on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
|
|
107
106
|
/>
|
|
108
107
|
|
|
109
108
|
<!-- 查看状态 -->
|
|
110
109
|
<template v-else>
|
|
111
110
|
<bri-tooltip
|
|
112
|
-
:content="enterText(row[
|
|
111
|
+
:content="enterText(row[column._key].name)"
|
|
113
112
|
:transfer="true"
|
|
114
113
|
>
|
|
115
|
-
<span v-html="enterText(row[
|
|
114
|
+
<span v-html="enterText(row[column._key].name)"></span>
|
|
116
115
|
</bri-tooltip>
|
|
117
116
|
|
|
118
117
|
<!-- 操作下拉 -->
|
|
119
118
|
<dsh-dropdown
|
|
120
|
-
v-if="$getOperationList(
|
|
119
|
+
v-if="$getOperationList(getTreeTdBtns(column, row, row[column._key])).length"
|
|
121
120
|
class="table-td-tree-dropdown"
|
|
122
121
|
menuClass="table-td-tree-dropdown-list"
|
|
123
122
|
trigger="hover"
|
|
124
|
-
:list="$getOperationList(
|
|
125
|
-
@click="$dispatchEvent($event, row, rowIndex,
|
|
123
|
+
:list="$getOperationList(getTreeTdBtns(column, row, row[column._key]))"
|
|
124
|
+
@click="$dispatchEvent($event, row, rowIndex, column)"
|
|
126
125
|
@click.native.stop="0"
|
|
127
126
|
>
|
|
128
127
|
<a href="javascript:void(0)">
|
|
@@ -136,28 +135,28 @@
|
|
|
136
135
|
</template>
|
|
137
136
|
|
|
138
137
|
<!-- 汇总单元格 -->
|
|
139
|
-
<template v-else-if="
|
|
140
|
-
<span>{{ getSummaryVal(
|
|
138
|
+
<template v-else-if="column.colType === 'summary'">
|
|
139
|
+
<span>{{ getSummaryVal(column, row) }}</span>
|
|
141
140
|
</template>
|
|
142
141
|
</td>
|
|
143
142
|
|
|
144
143
|
<!-- 普通单元格 -->
|
|
145
144
|
<td
|
|
146
145
|
v-else
|
|
147
|
-
:key="
|
|
146
|
+
:key="column._key + 'data'"
|
|
148
147
|
:class="{
|
|
149
|
-
// [`table-td-${
|
|
148
|
+
// [`table-td-${column.colType}`]: true,
|
|
150
149
|
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
151
150
|
'bri-table-td-edit': canEdit,
|
|
152
151
|
'bri-table-td-show': !canEdit,
|
|
153
152
|
}"
|
|
154
|
-
:style="getTdStyle(
|
|
153
|
+
:style="getTdStyle(column, row)"
|
|
155
154
|
>
|
|
156
155
|
<dsh-list-unit
|
|
157
156
|
:canEdit="canEdit"
|
|
158
|
-
:formData="row[
|
|
157
|
+
:formData="row[column.nodeKey]"
|
|
159
158
|
:formItem="{
|
|
160
|
-
...
|
|
159
|
+
...column,
|
|
161
160
|
_heightAuto: heightAuto
|
|
162
161
|
}"
|
|
163
162
|
:allFormList="subColumns"
|
|
@@ -165,15 +164,15 @@
|
|
|
165
164
|
:parentListData="rows"
|
|
166
165
|
:parentFormList="parentFormList"
|
|
167
166
|
:parentObj="parentObj"
|
|
168
|
-
@blur="controlBlur(null,
|
|
169
|
-
@change="$dispatchEvent(operationMap.changeVal,
|
|
167
|
+
@blur="controlBlur(null, column, row[column.nodeKey], arguments)"
|
|
168
|
+
@change="$dispatchEvent(operationMap.changeVal, column, row[column.nodeKey], arguments)"
|
|
170
169
|
></dsh-list-unit>
|
|
171
170
|
|
|
172
171
|
<span
|
|
173
|
-
v-if="!getColRuleResult(
|
|
172
|
+
v-if="!getColRuleResult(column, row[column.nodeKey], rowIndex).bool"
|
|
174
173
|
class="bri-table-td-tip"
|
|
175
174
|
>
|
|
176
|
-
{{ getColRuleResult(
|
|
175
|
+
{{ getColRuleResult(column, row[column.nodeKey], rowIndex).message }}
|
|
177
176
|
</span>
|
|
178
177
|
</td>
|
|
179
178
|
</template>
|
|
@@ -234,16 +233,6 @@
|
|
|
234
233
|
return {
|
|
235
234
|
widthMap: this.$getModFieldPropertyMap("width"),
|
|
236
235
|
boxWidth: 0,
|
|
237
|
-
getColOperationNames (col) {
|
|
238
|
-
return [
|
|
239
|
-
"createCol",
|
|
240
|
-
...(
|
|
241
|
-
col.level > 1 && col.canDelete === true
|
|
242
|
-
? ["deleteCol"]
|
|
243
|
-
: []
|
|
244
|
-
)
|
|
245
|
-
];
|
|
246
|
-
},
|
|
247
236
|
|
|
248
237
|
allOperationMap: {
|
|
249
238
|
clickTh: {
|
|
@@ -331,38 +320,36 @@
|
|
|
331
320
|
};
|
|
332
321
|
},
|
|
333
322
|
computed: {
|
|
323
|
+
treeData () {
|
|
324
|
+
return this.transforBriTreeData();
|
|
325
|
+
},
|
|
326
|
+
rows () {
|
|
327
|
+
return this.transformRows();
|
|
328
|
+
},
|
|
329
|
+
listData () {
|
|
330
|
+
return this.rows;
|
|
331
|
+
},
|
|
332
|
+
|
|
334
333
|
selfPropsObj () {
|
|
335
334
|
return {
|
|
336
|
-
_useCol: true,
|
|
337
335
|
...this.commonPropsObj,
|
|
338
336
|
|
|
339
337
|
_contentHeight: this.propsObj._contentHeight || 400 // 表格最大高度
|
|
340
338
|
};
|
|
341
339
|
},
|
|
342
|
-
useCol () {
|
|
343
|
-
return this.selfPropsObj._useCol;
|
|
344
|
-
},
|
|
345
340
|
|
|
346
|
-
columns () {
|
|
347
|
-
return this.transformColumns(this.treeColumns);
|
|
348
|
-
},
|
|
349
341
|
filterColumns () {
|
|
350
|
-
return this.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return this.transforBriTreeData();
|
|
354
|
-
},
|
|
355
|
-
listData () {
|
|
356
|
-
return this.rows;
|
|
342
|
+
return this.subColumns
|
|
343
|
+
.filter(col => col.colType === "data")
|
|
344
|
+
.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
|
|
357
345
|
},
|
|
358
|
-
|
|
359
|
-
return this.
|
|
346
|
+
columns () {
|
|
347
|
+
return this.transformColumns(this.treeColumns);
|
|
360
348
|
},
|
|
361
349
|
// 供表格渲染行使用的columns的数组集合, 每一行columns不一样,组成二重数组
|
|
362
350
|
rowColumnsArr () {
|
|
363
351
|
return this.transformRowColumnsArr();
|
|
364
352
|
},
|
|
365
|
-
|
|
366
353
|
operationMap () {
|
|
367
354
|
return this.canEdit
|
|
368
355
|
? this.$categoryMapToMap(
|
|
@@ -410,10 +397,11 @@
|
|
|
410
397
|
},
|
|
411
398
|
// 整行校验结果
|
|
412
399
|
getRowRuleResult (row, rowIndex) {
|
|
413
|
-
this.filterColumns.every(
|
|
400
|
+
return this.filterColumns.every(column => this.getColRuleResult(column, row[column.nodeKey], rowIndex).bool);
|
|
414
401
|
},
|
|
415
402
|
// 单元格校验结果
|
|
416
403
|
getColRuleResult (col, row, rowIndex) {
|
|
404
|
+
col = this.$transformFieldProperty(col, row, this.parentObj);
|
|
417
405
|
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
418
406
|
return this.$getFieldRuleResult({
|
|
419
407
|
...col,
|
|
@@ -556,10 +544,14 @@
|
|
|
556
544
|
controlBlur (operationItem, col, row, params) {
|
|
557
545
|
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
558
546
|
},
|
|
547
|
+
// 发生变动
|
|
548
|
+
change (...params) {
|
|
549
|
+
this.$emit("change", this.data, ...params);
|
|
550
|
+
},
|
|
559
551
|
|
|
560
552
|
/* ---- 工具方法 ---- */
|
|
561
553
|
// 合并表头
|
|
562
|
-
transformColumns (treeForm = this.treeColumns, subForm = this.
|
|
554
|
+
transformColumns (treeForm = this.treeColumns, subForm = this.filterColumns) {
|
|
563
555
|
return treeForm
|
|
564
556
|
.reduce((arr, treeFormItem, treeFormIndex) => {
|
|
565
557
|
return arr.concat(
|
|
@@ -754,44 +746,6 @@
|
|
|
754
746
|
},
|
|
755
747
|
|
|
756
748
|
/* ----- 模板获值方法 ---- */
|
|
757
|
-
getHeaderRender (column) {
|
|
758
|
-
return (h) => {
|
|
759
|
-
return this.$getHeadRender(h, column, {
|
|
760
|
-
showRequired: this.showRequired,
|
|
761
|
-
showDescription: this.showDescription,
|
|
762
|
-
headHeightAuto: this.headHeightAuto
|
|
763
|
-
});
|
|
764
|
-
};
|
|
765
|
-
},
|
|
766
|
-
getSummaryVal (col, row) {
|
|
767
|
-
if (col._calField && col._operator) {
|
|
768
|
-
const calFieldFormItem = this.subColumns.find(item => item._key === col._calField);
|
|
769
|
-
|
|
770
|
-
if (calFieldFormItem) {
|
|
771
|
-
let loop = (nodes, arr) => {
|
|
772
|
-
return nodes.reduce((arr, node) => {
|
|
773
|
-
if (node.children.length) {
|
|
774
|
-
return loop(node.children, arr);
|
|
775
|
-
} else {
|
|
776
|
-
arr.push(node[col._calField] || 0);
|
|
777
|
-
return arr;
|
|
778
|
-
}
|
|
779
|
-
}, arr);
|
|
780
|
-
};
|
|
781
|
-
let list = loop(row[col.nodeKey].children, []);
|
|
782
|
-
|
|
783
|
-
return this.$calNumList(list, col._operator, calFieldFormItem);
|
|
784
|
-
} else {
|
|
785
|
-
return `来源列${col._calField}被删除`;
|
|
786
|
-
}
|
|
787
|
-
} else {
|
|
788
|
-
return !col._calField && !col._operator
|
|
789
|
-
? "未选择来源列和算法"
|
|
790
|
-
: !col._calField
|
|
791
|
-
? "未选择来源列"
|
|
792
|
-
: "未选择算法";
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
749
|
getThStyle (col, position) {
|
|
796
750
|
const boxColWidth = this.boxWidth / this.columns.length;
|
|
797
751
|
const defaultWidth = Math.max(boxColWidth, this.widthMap[col._type], (col._name ? col._name.length * 14 : 36) + (col._type === "reference" ? 200 : 26));
|
|
@@ -834,22 +788,70 @@
|
|
|
834
788
|
geTdColspan (col, row) {
|
|
835
789
|
return 1;
|
|
836
790
|
},
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
791
|
+
getHeaderRender (column) {
|
|
792
|
+
return (h) => this.$getHeadRender(h, column, {
|
|
793
|
+
showRequired: this.showRequired,
|
|
794
|
+
showDescription: this.showDescription,
|
|
795
|
+
headHeightAuto: this.headHeightAuto
|
|
796
|
+
});
|
|
797
|
+
},
|
|
798
|
+
getRowColumns (row, rowIndex) {
|
|
799
|
+
const columns = this.rowColumnsArr[rowIndex];
|
|
800
|
+
return columns.map(column =>
|
|
801
|
+
["tree", "summary"].includes(column.colType)
|
|
802
|
+
? column
|
|
803
|
+
: this.$transformFieldProperty(column, row, this.parentObj)
|
|
804
|
+
);
|
|
805
|
+
},
|
|
806
|
+
getSummaryVal (col, row) {
|
|
807
|
+
if (col._calField && col._operator) {
|
|
808
|
+
const calFieldFormItem = this.subColumns.find(item => item._key === col._calField);
|
|
809
|
+
|
|
810
|
+
if (calFieldFormItem) {
|
|
811
|
+
let loop = (nodes, arr) => {
|
|
812
|
+
return nodes.reduce((arr, node) => {
|
|
813
|
+
if (node.children.length) {
|
|
814
|
+
return loop(node.children, arr);
|
|
815
|
+
} else {
|
|
816
|
+
arr.push(node[col._calField] || 0);
|
|
817
|
+
return arr;
|
|
818
|
+
}
|
|
819
|
+
}, arr);
|
|
820
|
+
};
|
|
821
|
+
let list = loop(row[col.nodeKey].children, []);
|
|
822
|
+
|
|
823
|
+
return this.$calNumList(list, col._operator, calFieldFormItem);
|
|
824
|
+
} else {
|
|
825
|
+
return `来源列${col._calField}被删除`;
|
|
826
|
+
}
|
|
841
827
|
} else {
|
|
842
|
-
return
|
|
828
|
+
return !col._calField && !col._operator
|
|
829
|
+
? "未选择来源列和算法"
|
|
830
|
+
: !col._calField
|
|
831
|
+
? "未选择来源列"
|
|
832
|
+
: "未选择算法";
|
|
843
833
|
}
|
|
844
834
|
},
|
|
835
|
+
getTreeThBtns (col) {
|
|
836
|
+
return [
|
|
837
|
+
"createCol",
|
|
838
|
+
...(
|
|
839
|
+
col.level > 1 && col.canDelete === true
|
|
840
|
+
? ["deleteCol"]
|
|
841
|
+
: []
|
|
842
|
+
)
|
|
843
|
+
];
|
|
844
|
+
},
|
|
845
|
+
// 获得节点的 操作下拉列表
|
|
846
|
+
getTreeTdBtns (col, row, nodeData) {
|
|
847
|
+
return nodeData.children.length === 0
|
|
848
|
+
? ["createBrotherNode", "deleteSelfAndChildNodes", "clearNode"]
|
|
849
|
+
: ["createBrotherNode", "createChildNode", "deleteSelfAndChildNodes", "deleteChildNodes", "clearNode", "clearChildNodes"];
|
|
850
|
+
},
|
|
845
851
|
// 回车换行
|
|
846
852
|
enterText (val) {
|
|
847
853
|
let reg = new RegExp(/\n/g);
|
|
848
854
|
return val.replace(reg, "<br/>");
|
|
849
|
-
},
|
|
850
|
-
// 发生变动
|
|
851
|
-
change (...params) {
|
|
852
|
-
this.$emit("change", this.data, ...params);
|
|
853
855
|
}
|
|
854
856
|
}
|
|
855
857
|
};
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
const treeData = this.getCalcuTree(this.data, this.filterColumns);
|
|
53
53
|
return this.$getTreeFlatArr(treeData, node =>
|
|
54
54
|
(this.searchFormList.length ? this.$isAdvRelyAccord(this.advSearchObj, node) : true) &&
|
|
55
|
-
(node.level === 1 || node.
|
|
55
|
+
(node.level === 1 || node.__isRendered__)
|
|
56
56
|
);
|
|
57
57
|
},
|
|
58
58
|
footerData () {
|
|
@@ -120,14 +120,11 @@
|
|
|
120
120
|
cellStyleOption: {
|
|
121
121
|
bodyCellClass: ({ row, column, rowIndex }) => {
|
|
122
122
|
return "bri-table-td" +
|
|
123
|
-
`${
|
|
124
|
-
|
|
125
|
-
? " bri-table-td-edit"
|
|
126
|
-
: " bri-table-td-show"
|
|
127
|
-
}` +
|
|
123
|
+
`${this.canEdit ? " bri-table-td-edit" : " bri-table-td-show"}` +
|
|
124
|
+
`${row.__isShow__ === false ? " bri-table-td-hide" : ""}` +
|
|
128
125
|
`${
|
|
129
126
|
["__isExpand__"].includes(column._key)
|
|
130
|
-
? " bri-table-td-
|
|
127
|
+
? " bri-table-td-expand"
|
|
131
128
|
: ["__index__"].includes(column._key)
|
|
132
129
|
? " bri-table-td-index"
|
|
133
130
|
: ""
|
|
@@ -158,22 +155,22 @@
|
|
|
158
155
|
_key: "__isExpand__",
|
|
159
156
|
key: "__isExpand__",
|
|
160
157
|
field: "__isExpand__",
|
|
161
|
-
width:
|
|
158
|
+
width: 48,
|
|
162
159
|
align: "center",
|
|
163
160
|
fixed: "left",
|
|
164
161
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
165
162
|
return row.children && row.children.length
|
|
166
163
|
? h("Icon", {
|
|
167
164
|
style: {
|
|
168
|
-
width: "
|
|
169
|
-
height: "
|
|
165
|
+
width: "16px",
|
|
166
|
+
height: "16px",
|
|
170
167
|
cursor: "pointer",
|
|
171
168
|
transform: row.__isExpand__ ? "rotate(90deg)" : "rotate(0deg)",
|
|
172
169
|
transition: "transform 0.4s"
|
|
173
170
|
},
|
|
174
171
|
props: {
|
|
175
172
|
type: "ios-arrow-forward",
|
|
176
|
-
size: "
|
|
173
|
+
size: "18"
|
|
177
174
|
},
|
|
178
175
|
on: {
|
|
179
176
|
click: () => {
|
|
@@ -252,12 +249,10 @@
|
|
|
252
249
|
};
|
|
253
250
|
},
|
|
254
251
|
toggleExpand (row, bool = true) {
|
|
255
|
-
this.$set(row, "__isRendered__", true)
|
|
256
|
-
|
|
252
|
+
this.$set(row, "__isRendered__", true);// 作用不大 可有可无
|
|
257
253
|
this.$set(row, "__isExpand__", bool);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
254
|
+
|
|
255
|
+
this.toggleDescendantsShow(row, bool);
|
|
261
256
|
},
|
|
262
257
|
// 点击 -添加一行
|
|
263
258
|
clickCreate (operationItem, row, rowIndex) {
|
|
@@ -273,48 +268,38 @@
|
|
|
273
268
|
},
|
|
274
269
|
// 点击 -删除行
|
|
275
270
|
clickDelete (operationItem, row, rowIndex) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
// });
|
|
271
|
+
this.$Modal.confirm({
|
|
272
|
+
title: "警告",
|
|
273
|
+
content: "确定删除吗?",
|
|
274
|
+
onOk: () => {
|
|
275
|
+
const parentNode = this.getParentNode(this.data, row);
|
|
276
|
+
const index = parentNode.children.findIndex(childNode => childNode._id === row._id);
|
|
277
|
+
parentNode.children.splice(index, 1);
|
|
278
|
+
console.log(index);
|
|
279
|
+
console.log(parentNode);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
288
282
|
},
|
|
289
283
|
|
|
284
|
+
/* ------ 工具方法 ------- */
|
|
290
285
|
getCalcuTree (tree = [], columns) {
|
|
291
286
|
const loop = (list = []) =>
|
|
292
287
|
list.reduce((newList, node) => {
|
|
293
288
|
if (node.children && node.children.length) {
|
|
294
289
|
node.isLeaf = false;
|
|
295
|
-
|
|
296
290
|
node.children = loop(node.children);
|
|
291
|
+
|
|
297
292
|
columns.reduce((newNode, col) => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
// col._key,
|
|
309
|
-
// col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
|
|
310
|
-
// ? this.$calNumList(
|
|
311
|
-
// node.children.map(subNode => subNode[col._key]),
|
|
312
|
-
// col._summaryType,
|
|
313
|
-
// { ...col, _defaultDigit: 2 },
|
|
314
|
-
// false
|
|
315
|
-
// )
|
|
316
|
-
// : newNode[col._key]
|
|
317
|
-
// );
|
|
293
|
+
if (col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)) {
|
|
294
|
+
newNode[col._key] = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
|
|
295
|
+
? this.$calNumList(
|
|
296
|
+
node.children.map(subNode => subNode[col._key]),
|
|
297
|
+
col._summaryType,
|
|
298
|
+
{ ...col, _defaultDigit: 2 },
|
|
299
|
+
false
|
|
300
|
+
)
|
|
301
|
+
: newNode[col._key];
|
|
302
|
+
}
|
|
318
303
|
|
|
319
304
|
return newNode;
|
|
320
305
|
}, node);
|
|
@@ -353,6 +338,29 @@
|
|
|
353
338
|
loop(tree);
|
|
354
339
|
return parentNode;
|
|
355
340
|
}
|
|
341
|
+
},
|
|
342
|
+
toggleDescendantsShow (node, bool) {
|
|
343
|
+
const loop = (node, isFirstSon) => {
|
|
344
|
+
if (node.children && node.children.length) {
|
|
345
|
+
node.children.forEach(subNode => {
|
|
346
|
+
if (isFirstSon) {
|
|
347
|
+
this.$set(subNode, "__isRendered__", true);
|
|
348
|
+
this.$set(subNode, "__isShow__", bool);
|
|
349
|
+
} else {
|
|
350
|
+
if (bool) {
|
|
351
|
+
this.$set(subNode, "__isShow__", subNode.__isTmpShow__);
|
|
352
|
+
} else {
|
|
353
|
+
this.$set(subNode, "__isTmpShow__", subNode.__isShow__);
|
|
354
|
+
this.$set(subNode, "__isShow__", false);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
loop(subNode);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
loop(node, true);
|
|
356
364
|
}
|
|
357
365
|
}
|
|
358
366
|
};
|
|
@@ -51,9 +51,9 @@ export default {
|
|
|
51
51
|
_showDescription: true, // 表头显示提示
|
|
52
52
|
_headHeightAuto: false, // 表头高度自适应
|
|
53
53
|
_heightAuto: false, // 单元格高度自适应
|
|
54
|
-
_useSelection: false, // 使用选择列
|
|
54
|
+
_useSelection: false, // 使用选择列 -配置端暂时用不到
|
|
55
55
|
_useIndex: true, // 使用序号列
|
|
56
|
-
_useSummary:
|
|
56
|
+
_useSummary: false, // 使用汇总行
|
|
57
57
|
_disabledBtns: false, // 禁用增删按钮
|
|
58
58
|
_disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
|
|
59
59
|
_disabledOldDataRow: false, // 置灰老数据行包含删除
|
|
@@ -37,34 +37,43 @@
|
|
|
37
37
|
height: 100% !important;
|
|
38
38
|
|
|
39
39
|
.ve-table-content-wrapper table.ve-table-content {
|
|
40
|
-
thead.ve-table-header
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
thead.ve-table-header {
|
|
41
|
+
tr.ve-table-header-tr th.ve-table-header-th {
|
|
42
|
+
padding: 4px 8px;
|
|
43
|
+
|
|
44
|
+
.ve-table-filter .ve-table-filter-icon {
|
|
45
|
+
&:hover {
|
|
46
|
+
color: @themeColor;
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
|
|
50
|
+
// 排序
|
|
51
|
+
.ve-table-sort {
|
|
52
|
+
position: absolute !important;
|
|
53
|
+
top: 5px;
|
|
54
|
+
right: 4px;
|
|
55
|
+
|
|
56
|
+
.icon-vet-sort-top-arrow:before {
|
|
57
|
+
content: "\e6347";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.icon-vet-sort-bottom-arrow:before {
|
|
61
|
+
content: "\e6349";
|
|
62
|
+
}
|
|
57
63
|
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
tbody.ve-table-body {
|
|
68
|
+
tr.ve-table-body-tr,
|
|
69
|
+
tr.ve-table-expand-tr {
|
|
70
|
+
height: auto;
|
|
58
71
|
|
|
59
|
-
.
|
|
60
|
-
|
|
72
|
+
td.ve-table-body-td {
|
|
73
|
+
padding: 4px 16px;
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
|
-
|
|
65
|
-
// tbody.ve-table-body tr.ve-table-body-tr td.ve-table-body-td {
|
|
66
|
-
// padding: 4px 12px;
|
|
67
|
-
// }
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
|
|
@@ -91,7 +100,7 @@
|
|
|
91
100
|
&-empty {
|
|
92
101
|
width: 100%;
|
|
93
102
|
height: 100%;
|
|
94
|
-
padding: 9px
|
|
103
|
+
padding: 9px 16px;
|
|
95
104
|
border: 1px solid @borderColor;
|
|
96
105
|
border-top: none;
|
|
97
106
|
// border-bottom-left-radius: @borderRadius;
|
|
@@ -115,12 +124,12 @@
|
|
|
115
124
|
position: relative;
|
|
116
125
|
|
|
117
126
|
&-tip {
|
|
118
|
-
padding: 0px 0px 0px
|
|
127
|
+
padding: 0px 0px 0px 16px;
|
|
119
128
|
font-size: 12px;
|
|
120
129
|
line-height: 1;
|
|
121
130
|
color: #ed4014;
|
|
122
131
|
position: absolute;
|
|
123
|
-
top: calc(100% -
|
|
132
|
+
top: calc(100% - 12px);
|
|
124
133
|
left: 0px;
|
|
125
134
|
}
|
|
126
135
|
|
|
@@ -142,19 +151,20 @@
|
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
&-edit {
|
|
145
|
-
padding: 4px
|
|
154
|
+
padding: 4px 16px 12px 16px!important;
|
|
146
155
|
}
|
|
147
156
|
&-show {
|
|
148
|
-
|
|
149
|
-
// padding: 4px 12px!important;
|
|
157
|
+
|
|
150
158
|
}
|
|
151
|
-
&-
|
|
152
|
-
|
|
153
|
-
// padding: 4px 12px!important;
|
|
159
|
+
&-hide {
|
|
160
|
+
display: none!important;
|
|
154
161
|
}
|
|
155
162
|
&-index {
|
|
156
163
|
padding: 4px 16px 4px 12px!important;
|
|
157
164
|
}
|
|
165
|
+
&-expand {
|
|
166
|
+
|
|
167
|
+
}
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
170
|
|
package/src/utils/table.js
CHANGED
|
@@ -9,8 +9,8 @@ const getHeadRender = function (h, column, {
|
|
|
9
9
|
style: {
|
|
10
10
|
display: "inline-block",
|
|
11
11
|
maxWidth: "100%",
|
|
12
|
-
paddingLeft: "
|
|
13
|
-
paddingRight: column._description ? "
|
|
12
|
+
paddingLeft: "8px",
|
|
13
|
+
paddingRight: column._description ? "26px" : "8px",
|
|
14
14
|
verticalAlign: "middle",
|
|
15
15
|
position: "relative"
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ const getHeadRender = function (h, column, {
|
|
|
19
19
|
style: {
|
|
20
20
|
position: "absolute",
|
|
21
21
|
top: "0px",
|
|
22
|
-
left: "
|
|
22
|
+
left: "-2px",
|
|
23
23
|
color: "#ed4014"
|
|
24
24
|
}
|
|
25
25
|
}, "*"),
|
|
@@ -41,7 +41,7 @@ const getHeadRender = function (h, column, {
|
|
|
41
41
|
style: {
|
|
42
42
|
position: "absolute",
|
|
43
43
|
bottom: "1px",
|
|
44
|
-
right: "
|
|
44
|
+
right: "8px",
|
|
45
45
|
cursor: "pointer"
|
|
46
46
|
},
|
|
47
47
|
props: {
|
|
@@ -68,6 +68,7 @@ const transformToColumns = function (form, {
|
|
|
68
68
|
return form
|
|
69
69
|
.map(col => {
|
|
70
70
|
const typeData = this.$modFieldMap[col._type] || {};
|
|
71
|
+
const typeWidth = typeData.width + (col._type === "number" && col._unit ? col._unit.length * 16 : 0);
|
|
71
72
|
|
|
72
73
|
return {
|
|
73
74
|
title: col._name,
|
|
@@ -75,7 +76,7 @@ const transformToColumns = function (form, {
|
|
|
75
76
|
key: col._key,
|
|
76
77
|
align: col._align || typeData.align,
|
|
77
78
|
fixed: col._fixed,
|
|
78
|
-
width: col._width ||
|
|
79
|
+
width: col._width || typeWidth,
|
|
79
80
|
sortBy: showHeadFilter
|
|
80
81
|
? col._sortBy || typeData.sortBy
|
|
81
82
|
: undefined,
|