eoss-ui 0.5.84 → 0.5.85
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/lib/button-group.js +17 -16
- package/lib/button.js +17 -16
- package/lib/checkbox-group.js +17 -16
- package/lib/config/api.js +3 -2
- package/lib/data-table-form.js +17 -16
- package/lib/data-table.js +417 -262
- package/lib/date-picker.js +17 -16
- package/lib/dialog.js +17 -16
- package/lib/eoss-ui.common.js +6189 -13674
- package/lib/flow-group.js +17 -16
- package/lib/flow-list.js +17 -16
- package/lib/flow.js +17 -16
- package/lib/form.js +5647 -13458
- package/lib/handle-user.js +17 -16
- package/lib/handler.js +23 -18
- package/lib/icon.js +17 -16
- package/lib/index.js +1 -1
- package/lib/input-number.js +17 -16
- package/lib/input.js +17 -16
- package/lib/login.js +28 -19
- package/lib/main.js +579 -418
- package/lib/nav.js +17 -16
- package/lib/notify.js +3 -2
- package/lib/page.js +17 -16
- package/lib/pagination.js +17 -16
- package/lib/player.js +17 -16
- package/lib/qr-code.js +17 -16
- package/lib/radio-group.js +17 -16
- package/lib/retrial-auth.js +17 -16
- package/lib/select-ganged.js +17 -16
- package/lib/select.js +18 -17
- package/lib/selector-panel.js +17 -16
- package/lib/selector.js +17 -16
- package/lib/sizer.js +17 -16
- package/lib/steps.js +17 -16
- package/lib/switch.js +17 -16
- package/lib/table-form.js +17 -16
- package/lib/tabs.js +17 -16
- package/lib/theme-chalk/calendar.css +1 -1
- package/lib/theme-chalk/data-table.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/simplicity.css +1 -1
- package/lib/tips.js +17 -16
- package/lib/tree-group.js +17 -16
- package/lib/tree.js +17 -16
- package/lib/upload.js +30 -29
- package/lib/utils/util.js +14 -14
- package/lib/wujie.js +17 -16
- package/lib/wxlogin.js +17 -16
- package/package.json +2 -2
- package/packages/data-table/src/children.vue +3 -2
- package/packages/data-table/src/column.vue +2 -4
- package/packages/data-table/src/main.vue +150 -66
- package/packages/data-table/src/sizer.vue +51 -22
- package/packages/form/src/main.vue +119 -2103
- package/packages/handler/src/main.vue +5 -0
- package/packages/login/src/main.vue +12 -1
- package/packages/main/src/default/index.vue +35 -54
- package/packages/main/src/public/search.vue +138 -31
- package/packages/main/src/simplicity/apps.vue +12 -0
- package/packages/main/src/simplicity/handler.vue +0 -2
- package/packages/main/src/simplicity/index.vue +68 -32
- package/packages/select/src/main.vue +1 -1
- package/packages/theme-chalk/lib/calendar.css +1 -1
- package/packages/theme-chalk/lib/data-table.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/main.css +1 -1
- package/packages/theme-chalk/lib/simplicity.css +1 -1
- package/packages/theme-chalk/src/calendar.scss +3 -3
- package/packages/theme-chalk/src/data-table.scss +12 -0
- package/packages/theme-chalk/src/main.scss +2 -1
- package/packages/theme-chalk/src/simplicity.scss +15 -2
- package/packages/upload/src/main.vue +16 -12
- package/src/config/api.js +3 -2
- package/src/index.js +1 -1
- package/src/utils/util.js +2 -2
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
></es-toolbar>
|
|
37
37
|
<p v-if="title" ref="title" class="es-table-title" v-html="title"></p>
|
|
38
38
|
<div
|
|
39
|
-
|
|
39
|
+
v-if="show"
|
|
40
|
+
:style="styles"
|
|
40
41
|
class="es-data-table-content"
|
|
41
42
|
:class="{
|
|
42
43
|
'es-table-border-none': border == 'none',
|
|
43
44
|
'es-table-plus': mode == 'plus'
|
|
44
45
|
}"
|
|
45
46
|
ref="esTableContent"
|
|
46
|
-
v-if="show"
|
|
47
47
|
>
|
|
48
48
|
<el-table
|
|
49
49
|
ref="oaTable"
|
|
@@ -85,39 +85,44 @@
|
|
|
85
85
|
v-if="item.type === 'sort'"
|
|
86
86
|
width="32"
|
|
87
87
|
prop="id"
|
|
88
|
-
:key="item.key || index"
|
|
88
|
+
:key="item.key || item.label || item.title || index"
|
|
89
89
|
label=" "
|
|
90
90
|
>
|
|
91
91
|
<template slot-scope="scope">
|
|
92
|
-
<es-icon
|
|
92
|
+
<es-icon
|
|
93
|
+
v-if="!scope.row.fixed"
|
|
94
|
+
class="es-move"
|
|
95
|
+
:contents="dragSortIcon"
|
|
96
|
+
></es-icon>
|
|
93
97
|
</template>
|
|
94
98
|
</el-table-column>
|
|
95
99
|
<el-table-column
|
|
96
100
|
v-else-if="item.type === 'index' || item.type === 'selection'"
|
|
97
|
-
:key="item.key || index"
|
|
101
|
+
:key="item.key || item.label || item.title || index"
|
|
98
102
|
v-bind="dragSort ? { ...item, fixed: false } : item"
|
|
99
103
|
></el-table-column>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
104
|
+
<template v-else>
|
|
105
|
+
<children
|
|
106
|
+
:tag="item.tag"
|
|
107
|
+
v-bind="{
|
|
108
|
+
mode: mode,
|
|
109
|
+
name: name,
|
|
110
|
+
indexs: index,
|
|
111
|
+
form: form,
|
|
112
|
+
readonly: readonly,
|
|
113
|
+
optionData: optionDatas,
|
|
114
|
+
dragSort: dragSort,
|
|
115
|
+
key: item.key || item.label || item.title || index,
|
|
116
|
+
...(dragSort ? { ...item, fixed: false } : { ...item })
|
|
117
|
+
}"
|
|
118
|
+
v-on="{
|
|
119
|
+
handleClick: handleClick,
|
|
120
|
+
formBlur: formBlur,
|
|
121
|
+
formFocus: formFocus,
|
|
122
|
+
formChange: formChange
|
|
123
|
+
}"
|
|
124
|
+
></children>
|
|
125
|
+
</template>
|
|
121
126
|
</template>
|
|
122
127
|
</template>
|
|
123
128
|
<slot name="prefix"></slot>
|
|
@@ -172,11 +177,22 @@
|
|
|
172
177
|
<slot name="dialog"></slot>
|
|
173
178
|
<slot name="other"></slot>
|
|
174
179
|
</div>
|
|
175
|
-
<
|
|
180
|
+
<es-dialog v-if="theads.length" title="列表设置" :visible.sync="showSizer">
|
|
181
|
+
<sizer
|
|
182
|
+
v-if="showSizer"
|
|
183
|
+
:data="theads"
|
|
184
|
+
:mode="mode"
|
|
185
|
+
@confirm="mergeThead"
|
|
186
|
+
></sizer>
|
|
187
|
+
</es-dialog>
|
|
176
188
|
</component>
|
|
177
189
|
</template>
|
|
178
190
|
<script>
|
|
179
|
-
import {
|
|
191
|
+
import {
|
|
192
|
+
findSysCode,
|
|
193
|
+
getDictList,
|
|
194
|
+
formContents
|
|
195
|
+
} from 'eoss-ui/src/config/api.js';
|
|
180
196
|
import { debounce } from 'throttle-debounce';
|
|
181
197
|
import children from './children.vue';
|
|
182
198
|
import sizer from './sizer.vue';
|
|
@@ -184,12 +200,13 @@ import util from 'eoss-ui/src/utils/util';
|
|
|
184
200
|
import bus from 'eoss-ui/src/utils/bus';
|
|
185
201
|
import qs from 'qs';
|
|
186
202
|
const systemMode = util.win.top.systemMode || util.win.systemMode || 'default';
|
|
203
|
+
const pageView = util.getParams('pageView');
|
|
187
204
|
export default {
|
|
188
205
|
name: 'EsDataTable',
|
|
189
206
|
inheritAttrs: false,
|
|
190
207
|
components: {
|
|
191
|
-
|
|
192
|
-
|
|
208
|
+
children,
|
|
209
|
+
sizer
|
|
193
210
|
},
|
|
194
211
|
provide() {
|
|
195
212
|
return {
|
|
@@ -209,6 +226,14 @@ export default {
|
|
|
209
226
|
}
|
|
210
227
|
},
|
|
211
228
|
props: {
|
|
229
|
+
viewCode: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: pageView
|
|
232
|
+
},
|
|
233
|
+
contentsUrl: {
|
|
234
|
+
type: String,
|
|
235
|
+
default: formContents
|
|
236
|
+
},
|
|
212
237
|
mode: {
|
|
213
238
|
type: String,
|
|
214
239
|
default: systemMode
|
|
@@ -443,12 +468,14 @@ export default {
|
|
|
443
468
|
type: String,
|
|
444
469
|
default: 'es-icon-caidan'
|
|
445
470
|
},
|
|
446
|
-
|
|
471
|
+
isFieldsEncryption: Boolean
|
|
447
472
|
},
|
|
448
473
|
data() {
|
|
449
474
|
return {
|
|
475
|
+
isEncryption: this.isFieldsEncryption,
|
|
450
476
|
requests: [],
|
|
451
477
|
toolbars: [],
|
|
478
|
+
hasThead: false,
|
|
452
479
|
theadData: [],
|
|
453
480
|
list: [],
|
|
454
481
|
tableLoading: this.loading,
|
|
@@ -474,10 +501,12 @@ export default {
|
|
|
474
501
|
selected: null,
|
|
475
502
|
options: {},
|
|
476
503
|
icon: true,
|
|
477
|
-
show: true,
|
|
478
504
|
sysCodes: [],
|
|
479
505
|
infiniteDisabled: this.infiniteScroll,
|
|
480
|
-
isReload: false
|
|
506
|
+
isReload: false,
|
|
507
|
+
pageView: null,
|
|
508
|
+
showSizer: false,
|
|
509
|
+
show: true
|
|
481
510
|
};
|
|
482
511
|
},
|
|
483
512
|
computed: {
|
|
@@ -499,9 +528,8 @@ export default {
|
|
|
499
528
|
},
|
|
500
529
|
theads: {
|
|
501
530
|
get() {
|
|
502
|
-
let
|
|
503
|
-
|
|
504
|
-
let types = this.theadData
|
|
531
|
+
let types;
|
|
532
|
+
types = this.theadData
|
|
505
533
|
.filter((item) => {
|
|
506
534
|
return (
|
|
507
535
|
item.type == 'selection' ||
|
|
@@ -512,6 +540,8 @@ export default {
|
|
|
512
540
|
.map((item) => {
|
|
513
541
|
return item.type;
|
|
514
542
|
});
|
|
543
|
+
let thead = [];
|
|
544
|
+
let addfilter = false;
|
|
515
545
|
if (this.dragSort && !types.includes('sort')) {
|
|
516
546
|
addfilter = true;
|
|
517
547
|
thead.push({
|
|
@@ -564,7 +594,7 @@ export default {
|
|
|
564
594
|
}
|
|
565
595
|
if (this.theadData.length) {
|
|
566
596
|
thead = [...thead, ...this.theadData];
|
|
567
|
-
} else {
|
|
597
|
+
} else if (this.show) {
|
|
568
598
|
thead = [...thead, ...this.thead];
|
|
569
599
|
}
|
|
570
600
|
return thead;
|
|
@@ -663,6 +693,15 @@ export default {
|
|
|
663
693
|
}
|
|
664
694
|
},
|
|
665
695
|
watch: {
|
|
696
|
+
viewCode: {
|
|
697
|
+
immediate: true,
|
|
698
|
+
handler(val) {
|
|
699
|
+
if (val) {
|
|
700
|
+
this.hasThead = true;
|
|
701
|
+
this.getContents();
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
},
|
|
666
705
|
showToolbar() {
|
|
667
706
|
this.resetHeight();
|
|
668
707
|
this.doLayout();
|
|
@@ -705,13 +744,8 @@ export default {
|
|
|
705
744
|
deep: true,
|
|
706
745
|
handler(val) {
|
|
707
746
|
this.getOptions(val);
|
|
708
|
-
|
|
709
|
-
if (
|
|
710
|
-
Array.isArray(val) &&
|
|
711
|
-
val.length &&
|
|
712
|
-
this.fields &&
|
|
713
|
-
this.datas.length == 0
|
|
714
|
-
) {
|
|
747
|
+
this.chekOpenTotalArea();
|
|
748
|
+
if (Array.isArray(val) && val.length && this.datas.length == 0) {
|
|
715
749
|
this.getTableData();
|
|
716
750
|
}
|
|
717
751
|
}
|
|
@@ -779,15 +813,9 @@ export default {
|
|
|
779
813
|
created() {
|
|
780
814
|
if (Array.isArray(this.thead) && this.thead.length) {
|
|
781
815
|
this.getOptions(this.thead);
|
|
782
|
-
if (this.fields) {
|
|
783
|
-
this.immediate && this.getTableData();
|
|
784
|
-
this.chekOpenTotalArea();
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
if (!this.fields) {
|
|
788
816
|
this.immediate && this.getTableData();
|
|
789
|
-
this.chekOpenTotalArea();
|
|
790
817
|
}
|
|
818
|
+
this.chekOpenTotalArea();
|
|
791
819
|
},
|
|
792
820
|
mounted() {
|
|
793
821
|
if (this.data.length) {
|
|
@@ -824,6 +852,30 @@ export default {
|
|
|
824
852
|
const { method, url, params, data } = config;
|
|
825
853
|
return [method, url, qs.stringify(params), qs.stringify(data)].join('&');
|
|
826
854
|
},
|
|
855
|
+
getContents() {
|
|
856
|
+
util
|
|
857
|
+
.ajax({
|
|
858
|
+
url: this.contentsUrl,
|
|
859
|
+
params: {
|
|
860
|
+
formId: this.viewCode
|
|
861
|
+
}
|
|
862
|
+
})
|
|
863
|
+
.then((res) => {
|
|
864
|
+
if (res.rCode == 0) {
|
|
865
|
+
let {
|
|
866
|
+
results: { eossFormJson }
|
|
867
|
+
} = res;
|
|
868
|
+
eossFormJson = JSON.parse(eossFormJson);
|
|
869
|
+
if (eossFormJson && eossFormJson.table) {
|
|
870
|
+
this.isEncryption = true;
|
|
871
|
+
this.theadData = eossFormJson.table;
|
|
872
|
+
} else {
|
|
873
|
+
this.hasThead = false;
|
|
874
|
+
}
|
|
875
|
+
this.$emit('init-contents', res.results);
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
},
|
|
827
879
|
getOptions(res) {
|
|
828
880
|
let sysCodes = [];
|
|
829
881
|
res.forEach((item) => {
|
|
@@ -910,12 +962,20 @@ export default {
|
|
|
910
962
|
this.showTotal = true;
|
|
911
963
|
return;
|
|
912
964
|
}
|
|
965
|
+
if (!this.theads) {
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
913
968
|
const arr = JSON.parse(JSON.stringify(this.theads));
|
|
969
|
+
let flag = false;
|
|
914
970
|
arr.forEach((item) => {
|
|
915
971
|
if (item.total) {
|
|
972
|
+
flag = true;
|
|
916
973
|
this.showTotal = true;
|
|
917
974
|
}
|
|
918
975
|
});
|
|
976
|
+
if (this.showTotal !== flag) {
|
|
977
|
+
this.showTotal = flag;
|
|
978
|
+
}
|
|
919
979
|
},
|
|
920
980
|
rowClick(row, column, event) {
|
|
921
981
|
this.$emit('click', row, column, event);
|
|
@@ -996,19 +1056,26 @@ export default {
|
|
|
996
1056
|
newVal.forEach((row) => {
|
|
997
1057
|
if (util.isObject(row)) {
|
|
998
1058
|
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
999
|
-
} else
|
|
1000
|
-
this.list
|
|
1001
|
-
|
|
1002
|
-
this.$refs.oaTable.toggleRowSelection(item, true);
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1059
|
+
} else {
|
|
1060
|
+
this.setChecked(this.list, row);
|
|
1061
|
+
}
|
|
1006
1062
|
});
|
|
1007
1063
|
} else if (newVal === true) {
|
|
1008
1064
|
this.toggleAllSelection();
|
|
1009
1065
|
}
|
|
1010
1066
|
});
|
|
1011
1067
|
},
|
|
1068
|
+
setChecked(list, row) {
|
|
1069
|
+
list.forEach((item) => {
|
|
1070
|
+
if (item.children && item.children.length) {
|
|
1071
|
+
this.setChecked(item.children, row);
|
|
1072
|
+
}
|
|
1073
|
+
if (item[this.checkedKey] === row) {
|
|
1074
|
+
this.$refs.oaTable.toggleRowSelection(item, true);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
},
|
|
1012
1079
|
getTableDatas(res) {
|
|
1013
1080
|
let where;
|
|
1014
1081
|
let first;
|
|
@@ -1036,6 +1103,7 @@ export default {
|
|
|
1036
1103
|
if (where) {
|
|
1037
1104
|
reqData = util.extend({}, reqData, where);
|
|
1038
1105
|
}
|
|
1106
|
+
//if (this.fields)
|
|
1039
1107
|
if (this.retainSearh || first === false) {
|
|
1040
1108
|
reqData = util.extend({}, reqData, this.wheres);
|
|
1041
1109
|
}
|
|
@@ -1046,9 +1114,9 @@ export default {
|
|
|
1046
1114
|
}
|
|
1047
1115
|
}
|
|
1048
1116
|
}
|
|
1049
|
-
if (this.
|
|
1117
|
+
if (this.isEncryption) {
|
|
1050
1118
|
let fields = [];
|
|
1051
|
-
this.
|
|
1119
|
+
this.theads.forEach((item) => {
|
|
1052
1120
|
if (item.field || item.prop) {
|
|
1053
1121
|
fields.push(item.field || item.prop);
|
|
1054
1122
|
}
|
|
@@ -1534,7 +1602,7 @@ export default {
|
|
|
1534
1602
|
);
|
|
1535
1603
|
for (let i = 0; i < this.$el.parentNode.childNodes.length; i++) {
|
|
1536
1604
|
let ele = this.$el.parentNode.childNodes[i];
|
|
1537
|
-
if (ele
|
|
1605
|
+
if (ele.offsetHeight !== undefined) {
|
|
1538
1606
|
height =
|
|
1539
1607
|
height -
|
|
1540
1608
|
ele.offsetHeight -
|
|
@@ -1559,6 +1627,9 @@ export default {
|
|
|
1559
1627
|
let emptyText = this.$refs.esTableContent.querySelector(
|
|
1560
1628
|
'.el-table__empty-text'
|
|
1561
1629
|
);
|
|
1630
|
+
if (this.total) {
|
|
1631
|
+
height -= 1;
|
|
1632
|
+
}
|
|
1562
1633
|
let eht = 0;
|
|
1563
1634
|
if (emptyText) {
|
|
1564
1635
|
eht = emptyText.offsetHeight;
|
|
@@ -1594,7 +1665,7 @@ export default {
|
|
|
1594
1665
|
}
|
|
1595
1666
|
},
|
|
1596
1667
|
handleFilterColumn() {
|
|
1597
|
-
this
|
|
1668
|
+
this.showSizer = true;
|
|
1598
1669
|
},
|
|
1599
1670
|
handleSortChange(res) {
|
|
1600
1671
|
if (res.data && res.data.length) {
|
|
@@ -1606,11 +1677,24 @@ export default {
|
|
|
1606
1677
|
this.$emit('update-drag-sort', data, event);
|
|
1607
1678
|
},
|
|
1608
1679
|
mergeThead(res) {
|
|
1609
|
-
this.
|
|
1680
|
+
this.show = false;
|
|
1681
|
+
this.theadData = [];
|
|
1610
1682
|
this.icon = true;
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1683
|
+
this.showSizer = false;
|
|
1684
|
+
// if (!this.showTotal) {
|
|
1685
|
+
// for (let i = 0; i < res.length; i++) {
|
|
1686
|
+
// if (res[i].total) {
|
|
1687
|
+
// this.showTotal = true;
|
|
1688
|
+
// break;
|
|
1689
|
+
// }
|
|
1690
|
+
// }
|
|
1691
|
+
// }
|
|
1692
|
+
this.$nextTick(() => {
|
|
1693
|
+
this.theadData = res;
|
|
1694
|
+
setTimeout(() => {
|
|
1695
|
+
this.show = true;
|
|
1696
|
+
}, 500);
|
|
1697
|
+
});
|
|
1614
1698
|
},
|
|
1615
1699
|
setOptions(val, sysCode) {
|
|
1616
1700
|
this.$set(this.options, sysCode, val);
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<es-
|
|
2
|
+
<div class="es-table-sizer">
|
|
3
|
+
<div class="es-table-sizer-tips">
|
|
4
|
+
提示:锁定的列排序无效,列的内容是数字才能合计
|
|
5
|
+
</div>
|
|
3
6
|
<es-data-table
|
|
4
|
-
|
|
7
|
+
dragSort
|
|
5
8
|
numbers
|
|
6
9
|
form
|
|
7
10
|
row-key="id"
|
|
8
11
|
default-expand-all
|
|
9
|
-
height="
|
|
12
|
+
height="480px"
|
|
10
13
|
:mode="mode"
|
|
11
14
|
:data="theads"
|
|
12
15
|
:thead="thead"
|
|
13
16
|
:tree-props="{ children: 'childHead' }"
|
|
14
17
|
@change="handleChange"
|
|
18
|
+
@update-drag-sort="handleDrag"
|
|
15
19
|
>
|
|
16
20
|
</es-data-table>
|
|
17
21
|
<div class="sizer-btn-box">
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
>确定</el-button
|
|
20
24
|
>
|
|
21
25
|
</div>
|
|
22
|
-
</
|
|
26
|
+
</div>
|
|
23
27
|
</template>
|
|
24
28
|
|
|
25
29
|
<script type="text/babel">
|
|
@@ -34,9 +38,9 @@ export default {
|
|
|
34
38
|
theads: {
|
|
35
39
|
get() {
|
|
36
40
|
if (this.data && this.data.length) {
|
|
37
|
-
let
|
|
38
|
-
this.getThead(this.data,
|
|
39
|
-
return
|
|
41
|
+
let newData = [];
|
|
42
|
+
this.getThead(this.data, newData);
|
|
43
|
+
return newData;
|
|
40
44
|
}
|
|
41
45
|
return [];
|
|
42
46
|
}
|
|
@@ -47,11 +51,11 @@ export default {
|
|
|
47
51
|
visible: false,
|
|
48
52
|
thead: [
|
|
49
53
|
{
|
|
50
|
-
title: '
|
|
54
|
+
title: '名称',
|
|
51
55
|
field: 'title'
|
|
52
56
|
},
|
|
53
57
|
{
|
|
54
|
-
title: '
|
|
58
|
+
title: '锁定列位置',
|
|
55
59
|
field: 'fixed',
|
|
56
60
|
type: 'select',
|
|
57
61
|
clearable: true,
|
|
@@ -68,7 +72,7 @@ export default {
|
|
|
68
72
|
]
|
|
69
73
|
},
|
|
70
74
|
{
|
|
71
|
-
title: '
|
|
75
|
+
title: '列是否显示',
|
|
72
76
|
field: 'hide',
|
|
73
77
|
type: 'switch',
|
|
74
78
|
width: 160,
|
|
@@ -83,10 +87,27 @@ export default {
|
|
|
83
87
|
name: '显示'
|
|
84
88
|
}
|
|
85
89
|
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: '是否开启合计',
|
|
93
|
+
field: 'total',
|
|
94
|
+
type: 'switch',
|
|
95
|
+
width: 160,
|
|
96
|
+
align: 'center',
|
|
97
|
+
data: [
|
|
98
|
+
{
|
|
99
|
+
value: false,
|
|
100
|
+
name: '关闭'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: true,
|
|
104
|
+
name: '开启'
|
|
105
|
+
}
|
|
106
|
+
]
|
|
86
107
|
}
|
|
87
108
|
],
|
|
88
|
-
|
|
89
|
-
|
|
109
|
+
newThead: [],
|
|
110
|
+
nid: 0
|
|
90
111
|
};
|
|
91
112
|
},
|
|
92
113
|
mounted() {
|
|
@@ -97,12 +118,8 @@ export default {
|
|
|
97
118
|
this.visible = true;
|
|
98
119
|
},
|
|
99
120
|
getThead(res, data) {
|
|
100
|
-
res.forEach((item) => {
|
|
101
|
-
if (
|
|
102
|
-
item.type !== 'index' &&
|
|
103
|
-
item.type !== 'selection' &&
|
|
104
|
-
item.type !== 'handle'
|
|
105
|
-
) {
|
|
121
|
+
res.forEach((item, index) => {
|
|
122
|
+
if (item.type !== 'index' && item.type !== 'selection') {
|
|
106
123
|
let { fixed, hide, childHead, children, title, ...other } = item;
|
|
107
124
|
let items = {
|
|
108
125
|
title: title ? title : item.label,
|
|
@@ -113,10 +130,9 @@ export default {
|
|
|
113
130
|
? ''
|
|
114
131
|
: fixed,
|
|
115
132
|
hide: hide ? false : true,
|
|
116
|
-
id:
|
|
133
|
+
id: index,
|
|
117
134
|
...other
|
|
118
135
|
};
|
|
119
|
-
this.id++;
|
|
120
136
|
if (childHead && childHead.length) {
|
|
121
137
|
let childHeads = [];
|
|
122
138
|
this.getThead(childHead, childHeads);
|
|
@@ -128,6 +144,8 @@ export default {
|
|
|
128
144
|
items.children = childHeads;
|
|
129
145
|
}
|
|
130
146
|
data.push(items);
|
|
147
|
+
} else {
|
|
148
|
+
this.nid++;
|
|
131
149
|
}
|
|
132
150
|
});
|
|
133
151
|
},
|
|
@@ -152,10 +170,21 @@ export default {
|
|
|
152
170
|
handleChange(res) {
|
|
153
171
|
this.setThead(res, this.newThead);
|
|
154
172
|
},
|
|
173
|
+
handleDrag(res, evt) {
|
|
174
|
+
let { oldIndex, newIndex } = evt;
|
|
175
|
+
oldIndex += this.nid;
|
|
176
|
+
newIndex += this.nid;
|
|
177
|
+
if (oldIndex > newIndex) {
|
|
178
|
+
this.newThead.splice(newIndex, 0, this.newThead[oldIndex]);
|
|
179
|
+
this.newThead.splice(oldIndex + 1, 1);
|
|
180
|
+
} else {
|
|
181
|
+
this.newThead.splice(newIndex + 1, 0, this.newThead[oldIndex]);
|
|
182
|
+
this.newThead.splice(oldIndex, 1);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
155
185
|
handleConfirm() {
|
|
156
186
|
this.visible = false;
|
|
157
|
-
this.$
|
|
158
|
-
this.$parent.mergeThead(this.newThead);
|
|
187
|
+
this.$emit('confirm', this.newThead);
|
|
159
188
|
}
|
|
160
189
|
}
|
|
161
190
|
};
|