eoss-mobiles 0.3.95 → 0.3.97
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/CHANGELOG.md +95 -0
- package/lib/action-sheet.js +4 -4
- package/lib/button-group.js +4 -4
- package/lib/button.js +4 -4
- package/lib/calendar.js +4 -4
- package/lib/cascader.js +4 -4
- package/lib/cell.js +4 -4
- package/lib/checkbox.js +200 -173
- package/lib/circle.js +4 -4
- package/lib/config/api.js +16 -2
- package/lib/count-down.js +4 -4
- package/lib/date.js +108 -108
- package/lib/empty.js +4 -4
- package/lib/eoss-mobile.common.js +651 -83
- package/lib/esign.js +4 -4
- package/lib/field.js +4 -4
- package/lib/flow-btn.js +194 -167
- package/lib/flow-list.js +196 -167
- package/lib/flow.js +241 -212
- package/lib/form.js +93 -6
- package/lib/grid-item.js +4 -4
- package/lib/grid.js +12 -12
- package/lib/image-preview.js +15 -7
- package/lib/image.js +4 -4
- package/lib/index.js +1 -1
- package/lib/list.js +4 -4
- package/lib/loading.js +86 -86
- package/lib/nav-bar.js +4 -4
- package/lib/notice-bar.js +4 -4
- package/lib/pagination.js +4 -4
- package/lib/picker.js +200 -171
- package/lib/popover.js +4 -4
- package/lib/popup.js +4 -4
- package/lib/pull-refresh.js +4 -4
- package/lib/radio.js +199 -170
- package/lib/rate.js +4 -4
- package/lib/retrial-auth.js +194 -167
- package/lib/search.js +4 -4
- package/lib/selector.js +240 -211
- package/lib/skeleton.js +4 -4
- package/lib/stepper.js +4 -4
- package/lib/swipe.js +4 -4
- package/lib/switch.js +4 -4
- package/lib/tab.js +4 -4
- package/lib/table-column.js +194 -165
- package/lib/table.js +16 -16
- package/lib/tabs.js +4 -4
- package/lib/tag.js +4 -4
- package/lib/theme-chalk/fonts/iconfont.scss +98 -98
- package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
- package/lib/uploader.js +2472 -13
- package/package.json +3 -1
- package/packages/action-sheet/index.js +5 -5
- package/packages/action-sheet/src/main.vue +32 -32
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +15 -15
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +80 -80
- package/packages/calendar/index.js +5 -5
- package/packages/calendar/src/main.vue +34 -34
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +39 -39
- package/packages/cell/index.js +5 -5
- package/packages/cell/src/main.vue +77 -77
- package/packages/checkbox/index.js +5 -5
- package/packages/checkbox/src/main.vue +232 -232
- package/packages/circle/index.js +5 -5
- package/packages/circle/src/main.vue +27 -27
- package/packages/count-down/index.js +5 -5
- package/packages/count-down/src/main.vue +27 -27
- package/packages/date/index.js +5 -5
- package/packages/date/src/date-time.vue +290 -290
- package/packages/date/src/main.vue +401 -401
- package/packages/empty/index.js +5 -5
- package/packages/empty/src/main.vue +16 -16
- package/packages/esign/index.js +5 -5
- package/packages/esign/src/main.vue +144 -144
- package/packages/field/index.js +5 -5
- package/packages/field/src/main.vue +235 -235
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/components/Circulate.vue +595 -595
- package/packages/flow/src/components/Handle.vue +2404 -2404
- package/packages/flow/src/components/Message.vue +208 -208
- package/packages/flow/src/components/ProcessSettings.vue +342 -342
- package/packages/flow/src/components/supervise.vue +139 -139
- package/packages/flow/src/flowMix.js +288 -288
- package/packages/flow/src/main.vue +116 -116
- package/packages/flow-btn/index.js +5 -5
- package/packages/flow-btn/src/main.vue +494 -494
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +248 -248
- package/packages/form/index.js +5 -5
- package/packages/form/src/main.vue +548 -523
- package/packages/grid/index.js +5 -5
- package/packages/grid/src/main.vue +486 -486
- package/packages/grid-item/index.js +5 -5
- package/packages/grid-item/src/main.vue +16 -16
- package/packages/image/index.js +5 -5
- package/packages/image/src/main.vue +12 -12
- package/packages/image-preview/index.js +5 -5
- package/packages/image-preview/src/main.vue +41 -34
- package/packages/list/index.js +5 -5
- package/packages/list/src/main.vue +32 -32
- package/packages/loading/index.js +5 -5
- package/packages/loading/src/main.vue +19 -19
- package/packages/nav-bar/index.js +5 -5
- package/packages/nav-bar/src/main.vue +24 -24
- package/packages/notice-bar/index.js +5 -5
- package/packages/notice-bar/src/main.vue +15 -15
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +73 -73
- package/packages/picker/index.js +5 -5
- package/packages/picker/src/main.vue +604 -604
- package/packages/popover/index.js +5 -5
- package/packages/popover/src/main.vue +32 -32
- package/packages/popup/index.js +5 -5
- package/packages/popup/src/main.vue +27 -27
- package/packages/pull-refresh/index.js +5 -5
- package/packages/pull-refresh/src/main.vue +31 -31
- package/packages/radio/index.js +5 -5
- package/packages/radio/src/main.vue +179 -179
- package/packages/rate/index.js +5 -5
- package/packages/rate/src/main.vue +26 -26
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +257 -257
- package/packages/search/index.js +5 -5
- package/packages/search/src/main.vue +39 -39
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +186 -186
- package/packages/selector/src/selector-tree.vue +1117 -1117
- package/packages/selector/src/tree.vue +405 -405
- package/packages/skeleton/index.js +5 -5
- package/packages/skeleton/src/main.vue +17 -17
- package/packages/stepper/index.js +5 -5
- package/packages/stepper/src/main.vue +25 -25
- package/packages/swipe/index.js +5 -5
- package/packages/swipe/src/main.vue +42 -42
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +38 -38
- package/packages/tab/index.js +5 -5
- package/packages/tab/src/main.vue +16 -16
- package/packages/table/index.js +5 -5
- package/packages/table/src/main.vue +1006 -1006
- package/packages/table-column/index.js +5 -5
- package/packages/table-column/src/main.vue +931 -931
- package/packages/table-column/src/mixins/table.js +12 -12
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +34 -34
- package/packages/tag/index.js +5 -5
- package/packages/tag/src/main.vue +16 -16
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +1 -0
- package/packages/theme-chalk/lib/calendar.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +1 -0
- package/packages/theme-chalk/lib/cell.css +1 -0
- package/packages/theme-chalk/lib/checkbox.css +1 -0
- package/packages/theme-chalk/lib/circle.css +1 -0
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/esign.css +1 -0
- package/packages/theme-chalk/lib/field.css +1 -0
- package/packages/theme-chalk/lib/flow-btn.css +1 -0
- package/packages/theme-chalk/lib/flow-list-task-read.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.scss +98 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont1.scss +90 -0
- package/packages/theme-chalk/lib/form.css +1 -0
- package/packages/theme-chalk/lib/grid-item.css +1 -0
- package/packages/theme-chalk/lib/grid.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/image.css +0 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +1 -0
- package/packages/theme-chalk/lib/notice-bar.css +0 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/picker.css +1 -0
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/pull-refresh.css +0 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/retrial-auth.css +1 -0
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +1 -0
- package/packages/theme-chalk/lib/swipe.css +0 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +1 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tag.css +1 -0
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/uploader.css +0 -0
- package/packages/theme-chalk/src/base.scss +195 -195
- package/packages/theme-chalk/src/button-group.scss +25 -25
- package/packages/theme-chalk/src/button.scss +2 -2
- package/packages/theme-chalk/src/calendar.scss +11 -11
- package/packages/theme-chalk/src/cascader.scss +11 -11
- package/packages/theme-chalk/src/cell.scss +14 -14
- package/packages/theme-chalk/src/checkbox.scss +9 -9
- package/packages/theme-chalk/src/circle.scss +6 -6
- package/packages/theme-chalk/src/common/var.scss +1525 -1525
- package/packages/theme-chalk/src/esign.scss +51 -51
- package/packages/theme-chalk/src/field.scss +98 -98
- package/packages/theme-chalk/src/flow-btn.scss +99 -99
- package/packages/theme-chalk/src/flow-list.scss +122 -122
- package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
- package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
- package/packages/theme-chalk/src/form.scss +33 -33
- package/packages/theme-chalk/src/grid-item.scss +16 -16
- package/packages/theme-chalk/src/grid.scss +46 -46
- package/packages/theme-chalk/src/icon.scss +1661 -1661
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/navbar.scss +5 -5
- package/packages/theme-chalk/src/pagination.scss +12 -12
- package/packages/theme-chalk/src/picker.scss +31 -31
- package/packages/theme-chalk/src/radio.scss +6 -6
- package/packages/theme-chalk/src/retrial-auth.scss +28 -28
- package/packages/theme-chalk/src/selector.scss +247 -247
- package/packages/theme-chalk/src/stepper.scss +9 -9
- package/packages/theme-chalk/src/switch.scss +5 -5
- package/packages/theme-chalk/src/table.scss +86 -86
- package/packages/theme-chalk/src/tabs.scss +31 -31
- package/packages/theme-chalk/src/tag.scss +12 -12
- package/packages/theme-chalk/src/theme.scss +1 -1
- package/packages/theme-chalk/src/tree.scss +127 -127
- package/packages/uploader/index.js +5 -5
- package/packages/uploader/src/main.vue +586 -31
- package/src/config/api.js +18 -0
- package/src/index.js +1 -1
- package/src/utils/axios.js +217 -217
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +106 -106
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/packages/theme-chalk/gulpfile.js +0 -25
|
@@ -1,1006 +1,1006 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { Table } from 'element-ui';
|
|
3
|
-
import 'element-ui/lib/theme-chalk/table.css';
|
|
4
|
-
import request from 'eoss-mobile/src/utils/http';
|
|
5
|
-
import util from 'eoss-mobile/src/utils/util';
|
|
6
|
-
export default {
|
|
7
|
-
name: 'EmTable',
|
|
8
|
-
components: { Table },
|
|
9
|
-
inheritAttrs: false,
|
|
10
|
-
props: {
|
|
11
|
-
navHeight: {
|
|
12
|
-
type: [String, Number],
|
|
13
|
-
default: 20
|
|
14
|
-
},
|
|
15
|
-
thead: {
|
|
16
|
-
type: Array,
|
|
17
|
-
default: () => []
|
|
18
|
-
},
|
|
19
|
-
openEnlarge: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false
|
|
22
|
-
},
|
|
23
|
-
enlargeColor: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: '#fff'
|
|
26
|
-
},
|
|
27
|
-
enlargeSize: {
|
|
28
|
-
type: [String, Number],
|
|
29
|
-
default: 18
|
|
30
|
-
},
|
|
31
|
-
data: {
|
|
32
|
-
type: Array,
|
|
33
|
-
default: () => []
|
|
34
|
-
},
|
|
35
|
-
checkbox: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false
|
|
38
|
-
},
|
|
39
|
-
// 开启分页
|
|
40
|
-
page: {
|
|
41
|
-
type: [Boolean, Object],
|
|
42
|
-
default() {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
numbers: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
selectable: Function,
|
|
51
|
-
reserveSelection: Boolean,
|
|
52
|
-
full: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: true
|
|
55
|
-
},
|
|
56
|
-
height: [Number, String],
|
|
57
|
-
maxHeight: [Number, String],
|
|
58
|
-
form: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false
|
|
61
|
-
},
|
|
62
|
-
optionData: Object,
|
|
63
|
-
//本地数据总条数差值
|
|
64
|
-
lose: {
|
|
65
|
-
type: Number,
|
|
66
|
-
default: 0
|
|
67
|
-
},
|
|
68
|
-
param: {
|
|
69
|
-
type: Object,
|
|
70
|
-
default() {
|
|
71
|
-
return {};
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
method: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: 'get'
|
|
77
|
-
},
|
|
78
|
-
format: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: true
|
|
81
|
-
},
|
|
82
|
-
url: {
|
|
83
|
-
type: String,
|
|
84
|
-
default: ''
|
|
85
|
-
},
|
|
86
|
-
labelKey: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: 'title'
|
|
89
|
-
},
|
|
90
|
-
valueKey: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: 'field'
|
|
93
|
-
},
|
|
94
|
-
// 默认选中,类型为Boolean时默认全(不)选
|
|
95
|
-
checked: {
|
|
96
|
-
type: [Boolean, Array],
|
|
97
|
-
default: false
|
|
98
|
-
},
|
|
99
|
-
isForm: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
data() {
|
|
105
|
-
return {
|
|
106
|
-
selected: null,
|
|
107
|
-
pageChange: false,
|
|
108
|
-
tableHeight: 'auto',
|
|
109
|
-
tableClientHeight: undefined,
|
|
110
|
-
validateSuccess: true,
|
|
111
|
-
options: {},
|
|
112
|
-
theadData: [],
|
|
113
|
-
errForm: [],
|
|
114
|
-
isEnlarge: false,
|
|
115
|
-
clientWidth: document.documentElement.clientWidth,
|
|
116
|
-
list: null,
|
|
117
|
-
wheres: {},
|
|
118
|
-
config: {
|
|
119
|
-
pageNum: 1,
|
|
120
|
-
pageSize: 20,
|
|
121
|
-
totalCount: 0
|
|
122
|
-
},
|
|
123
|
-
isFirsetCheck: false
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
watch: {
|
|
127
|
-
checked(newVal) {
|
|
128
|
-
this.checkSelect(newVal);
|
|
129
|
-
},
|
|
130
|
-
page: {
|
|
131
|
-
immediate: true,
|
|
132
|
-
deep: true,
|
|
133
|
-
handler(val) {
|
|
134
|
-
this.config = util.extend({}, this.config, this.page);
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
thead: {
|
|
138
|
-
immediate: true,
|
|
139
|
-
handler(val) {
|
|
140
|
-
if (typeof val === 'string') {
|
|
141
|
-
this.getTheads();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
height: {
|
|
146
|
-
immediate: true,
|
|
147
|
-
handler(val) {
|
|
148
|
-
if (val) {
|
|
149
|
-
this.tableHeight = val;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
maxHeight: {
|
|
154
|
-
immediate: true,
|
|
155
|
-
handler(val) {
|
|
156
|
-
if (val && this.height === undefined) {
|
|
157
|
-
this.tableHeight = val;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
param:{
|
|
162
|
-
immediate:true,
|
|
163
|
-
deep:true,
|
|
164
|
-
handler(val){
|
|
165
|
-
|
|
166
|
-
this.getTableData({ where: this.wheres, first: true })
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
mounted() {
|
|
171
|
-
// this.resetHeight();
|
|
172
|
-
this.getTableData();
|
|
173
|
-
this.checkSelect(this.checked);
|
|
174
|
-
if (!this.isForm) {
|
|
175
|
-
this.$nextTick(() => {
|
|
176
|
-
this.tableClientHeight = this.$refs.emTable.clientHeight - 40;
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
if (this.full && !this.height) {
|
|
180
|
-
this.$nextTick(() => {
|
|
181
|
-
this.tableClientHeight = this.page?this.$refs.emTable.clientHeight - 40 : this.$refs.emTable.clientHeight;
|
|
182
|
-
// this. = this.$refs.emTable.clientHeight - 40;
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
computed: {
|
|
187
|
-
theads() {
|
|
188
|
-
return typeof this.thead === 'string' ? this.theadData : this.thead;
|
|
189
|
-
},
|
|
190
|
-
optionDatas() {
|
|
191
|
-
return this.optionData ? this.optionData : this.options;
|
|
192
|
-
},
|
|
193
|
-
datas: {
|
|
194
|
-
get() {
|
|
195
|
-
if (this.list) {
|
|
196
|
-
return this.list;
|
|
197
|
-
}
|
|
198
|
-
if (
|
|
199
|
-
this.page &&
|
|
200
|
-
this.data &&
|
|
201
|
-
this.data.length &&
|
|
202
|
-
this.config.totalCount < this.data.length + 1
|
|
203
|
-
) {
|
|
204
|
-
this.config.totalCount = this.data.length - this.lose;
|
|
205
|
-
return this.data.filter((item, index) => {
|
|
206
|
-
return (
|
|
207
|
-
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
208
|
-
index < this.config.pageNum * this.config.pageSize
|
|
209
|
-
);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return this.data;
|
|
214
|
-
},
|
|
215
|
-
set(val) {
|
|
216
|
-
return val;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
methods: {
|
|
221
|
-
validValue(val) {
|
|
222
|
-
val && this.$toast(val);
|
|
223
|
-
this.validateSuccess = !val;
|
|
224
|
-
},
|
|
225
|
-
validate() {
|
|
226
|
-
let success = true;
|
|
227
|
-
const _that = this;
|
|
228
|
-
if (_that.form) {
|
|
229
|
-
_that.theads.map(item => {
|
|
230
|
-
if (item.rules && item.rules.required) {
|
|
231
|
-
this.datas.map(x => {
|
|
232
|
-
if (!x[item.field] && !item.rules.validator) {
|
|
233
|
-
_that.$toast(item.rules.message);
|
|
234
|
-
success = false;
|
|
235
|
-
} else if (item.rules.validator) {
|
|
236
|
-
item.rules.validator(x[item.field], _that.validValue);
|
|
237
|
-
success = _that.validateSuccess;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
return success;
|
|
244
|
-
},
|
|
245
|
-
toggleAllSelection() {
|
|
246
|
-
this.$refs.oaTable.toggleAllSelection();
|
|
247
|
-
},
|
|
248
|
-
toggleRowSelection(newVal) {
|
|
249
|
-
newVal.forEach(row => {
|
|
250
|
-
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
251
|
-
});
|
|
252
|
-
},
|
|
253
|
-
checkSelect(newVal) {
|
|
254
|
-
if (!this.isFirsetCheck && newVal) {
|
|
255
|
-
if (util.getObjectType(newVal) === 'array') {
|
|
256
|
-
newVal.forEach(row => {
|
|
257
|
-
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
258
|
-
});
|
|
259
|
-
} else if (newVal === true) {
|
|
260
|
-
this.toggleAllSelection();
|
|
261
|
-
}
|
|
262
|
-
this.isFirsetCheck = true;
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
getTableData(res) {
|
|
266
|
-
let where;
|
|
267
|
-
let first;
|
|
268
|
-
if (res) {
|
|
269
|
-
where = res.where;
|
|
270
|
-
first = res.first;
|
|
271
|
-
}
|
|
272
|
-
if (!this.url) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (first !== false) {
|
|
276
|
-
this.config.pageNum = 1;
|
|
277
|
-
}
|
|
278
|
-
this.$toast.loading({
|
|
279
|
-
message: '加载中...',
|
|
280
|
-
forbidClick: true,
|
|
281
|
-
loadingType: 'spinner',
|
|
282
|
-
overlay: true,
|
|
283
|
-
duration: 0
|
|
284
|
-
});
|
|
285
|
-
let reqData = util.extend({}, this.param, {
|
|
286
|
-
pageNum: this.config.pageNum,
|
|
287
|
-
pageSize: this.config.pageSize
|
|
288
|
-
});
|
|
289
|
-
if (where) {
|
|
290
|
-
reqData = util.extend({}, reqData, where);
|
|
291
|
-
}
|
|
292
|
-
request({
|
|
293
|
-
url: this.url,
|
|
294
|
-
method: this.method,
|
|
295
|
-
format: this.format,
|
|
296
|
-
params: reqData,
|
|
297
|
-
data: reqData
|
|
298
|
-
})
|
|
299
|
-
.then(res => {
|
|
300
|
-
if (res.rCode === 0 || res.status === 'success') {
|
|
301
|
-
let results =
|
|
302
|
-
this.parseData !== undefined
|
|
303
|
-
? this.parseData(res.results || res.data || res)
|
|
304
|
-
: res.results || res.data;
|
|
305
|
-
this.list = results.data || results.records || results.list || [];
|
|
306
|
-
this.config.totalCount =
|
|
307
|
-
results.count || results.total || results.totalCount;
|
|
308
|
-
} else {
|
|
309
|
-
this.list = [];
|
|
310
|
-
}
|
|
311
|
-
this.$toast.clear();
|
|
312
|
-
this.$emit('success', res);
|
|
313
|
-
})
|
|
314
|
-
.catch(err => {
|
|
315
|
-
this.$toast.clear();
|
|
316
|
-
if (err && err.code && [64, 65, 67].indexOf(err.code) > -1) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (util.getObjectType(err) === 'string') {
|
|
320
|
-
this.$toast(err);
|
|
321
|
-
} else {
|
|
322
|
-
this.$toast(err.message || '数据加载失败,请联系管理员!');
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
clickOpenEnlarge(){
|
|
327
|
-
this.isEnlarge = true;
|
|
328
|
-
this.$emit('enlarge-change',true);
|
|
329
|
-
},
|
|
330
|
-
currentChange(res) {
|
|
331
|
-
this.pageChange = true;
|
|
332
|
-
setTimeout(() => {
|
|
333
|
-
this.pageChange = false;
|
|
334
|
-
}, 10);
|
|
335
|
-
this.config.pageNum = res;
|
|
336
|
-
this.$emit('page-current-change', res);
|
|
337
|
-
if (this.url) {
|
|
338
|
-
this.getTableData({ where: this.wheres, first: false });
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
getTheads() {
|
|
342
|
-
request({
|
|
343
|
-
url: this.thead,
|
|
344
|
-
method: this.method,
|
|
345
|
-
format: this.format,
|
|
346
|
-
params: this.param,
|
|
347
|
-
data: this.param
|
|
348
|
-
})
|
|
349
|
-
.then(res => {
|
|
350
|
-
if (res.rCode === 0) {
|
|
351
|
-
let results = res.results;
|
|
352
|
-
if (Array.isArray(results)) {
|
|
353
|
-
this.theadData = results;
|
|
354
|
-
} else {
|
|
355
|
-
this.theadData = results.theadData || [];
|
|
356
|
-
this.list = results.data || results.records || [];
|
|
357
|
-
this.config.totalCount =
|
|
358
|
-
results.count || results.total || results.totalCount;
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
this.theadData = [];
|
|
362
|
-
}
|
|
363
|
-
this.$emit('success', res);
|
|
364
|
-
})
|
|
365
|
-
.catch(err => {
|
|
366
|
-
if (err && err.code && [64, 65, 67].indexOf(err.code) > -1) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (util.getObjectType(err) === 'string') {
|
|
370
|
-
this.$message.error(err);
|
|
371
|
-
} else {
|
|
372
|
-
this.$message.error(err.message || '数据加载失败,请联系管理员!');
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
},
|
|
376
|
-
getTableColumns(data, name) {
|
|
377
|
-
this.optionDatas[name] = data;
|
|
378
|
-
},
|
|
379
|
-
formBlur(data) {
|
|
380
|
-
this.$emit('blur', data, this.datas);
|
|
381
|
-
},
|
|
382
|
-
formFocus(data) {
|
|
383
|
-
this.$emit('focus', data, this.datas);
|
|
384
|
-
},
|
|
385
|
-
formChange(data) {
|
|
386
|
-
if (this.pageChange) return;
|
|
387
|
-
if (data.type) {
|
|
388
|
-
this.pageChange = true;
|
|
389
|
-
setTimeout(() => {
|
|
390
|
-
this.pageChange = false;
|
|
391
|
-
}, 20);
|
|
392
|
-
}
|
|
393
|
-
this.$emit('edit', data, this.datas);
|
|
394
|
-
},
|
|
395
|
-
resetHeight() {
|
|
396
|
-
this.$nextTick(() => {
|
|
397
|
-
if (this.full && !this.height && !this.maxHeight) {
|
|
398
|
-
let height =
|
|
399
|
-
this.$el.parentNode.offsetHeight -
|
|
400
|
-
parseInt(util.getStyle(this.$el.parentNode, 'paddingTop'), 10) -
|
|
401
|
-
parseInt(util.getStyle(this.$el.parentNode, 'paddingBottom'), 10);
|
|
402
|
-
for (let i = 0; i < this.$el.parentNode.childNodes.length; i++) {
|
|
403
|
-
let ele = this.$el.parentNode.childNodes[i];
|
|
404
|
-
if (ele !== this.$el) {
|
|
405
|
-
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
for (let i = 0; i < this.$el.childNodes.length; i++) {
|
|
409
|
-
let ele = this.$el.childNodes[i];
|
|
410
|
-
if (ele !== this.$refs.esTableContent) {
|
|
411
|
-
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
this.styles = { height: height + 'px' };
|
|
415
|
-
const loadingDom = this.$refs.esTableContent.querySelector(
|
|
416
|
-
'.el-loading-mask'
|
|
417
|
-
);
|
|
418
|
-
for (
|
|
419
|
-
let i = 0;
|
|
420
|
-
i < this.$refs.esTableContent.childNodes.length;
|
|
421
|
-
i++
|
|
422
|
-
) {
|
|
423
|
-
let ele = this.$refs.esTableContent.childNodes[i];
|
|
424
|
-
if (
|
|
425
|
-
ele !== this.$refs.oaTable.$el &&
|
|
426
|
-
(!loadingDom || ele !== loadingDom)
|
|
427
|
-
) {
|
|
428
|
-
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
let pt = parseInt(
|
|
432
|
-
util.getStyle(this.$refs.esTableContent, 'paddingTop'),
|
|
433
|
-
10
|
|
434
|
-
);
|
|
435
|
-
let pb = parseInt(
|
|
436
|
-
util.getStyle(this.$refs.esTableContent, 'paddingBottom'),
|
|
437
|
-
10
|
|
438
|
-
);
|
|
439
|
-
this.tableHeight = height - pt - pb + (this.page ? 2 : 1) + 'px';
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
},
|
|
443
|
-
handleAjax(handle, row) {
|
|
444
|
-
this.$toast.loading({
|
|
445
|
-
message: '加载中...',
|
|
446
|
-
forbidClick: true,
|
|
447
|
-
loadingType: 'spinner',
|
|
448
|
-
overlay: true,
|
|
449
|
-
duration: 0
|
|
450
|
-
});
|
|
451
|
-
let params = handle.param || {};
|
|
452
|
-
if (handle.syncKeys) {
|
|
453
|
-
if (typeof handle.syncKeys === 'string') {
|
|
454
|
-
params[handle.syncKeys] = row[handle.syncKeys];
|
|
455
|
-
} else if (Array.isArray(handle.syncKeys)) {
|
|
456
|
-
for (let i in handle.syncKeys) {
|
|
457
|
-
if (Array.isArray(row)) {
|
|
458
|
-
let param = row.map(item => {
|
|
459
|
-
return item[handle.syncKeys[i]];
|
|
460
|
-
});
|
|
461
|
-
params[handle.syncKeys[i]] = param.join(',');
|
|
462
|
-
} else {
|
|
463
|
-
params[handle.syncKeys[i]] = row[handle.syncKeys[i]];
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
} else {
|
|
467
|
-
for (let i in handle.syncKeys) {
|
|
468
|
-
if (Array.isArray(row)) {
|
|
469
|
-
let param = row.map(item => {
|
|
470
|
-
return item[handle.syncKeys[i]];
|
|
471
|
-
});
|
|
472
|
-
params[i] = param.join(',');
|
|
473
|
-
} else {
|
|
474
|
-
params[i] = row[handle.syncKeys[i]];
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
if (Array.isArray(row)) {
|
|
480
|
-
let param = row.map(item => {
|
|
481
|
-
return item.id;
|
|
482
|
-
});
|
|
483
|
-
params.id = param.join(',');
|
|
484
|
-
} else {
|
|
485
|
-
params.id = row.id;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
let keys = Object.keys(params);
|
|
489
|
-
request({
|
|
490
|
-
url: handle.action,
|
|
491
|
-
data:
|
|
492
|
-
keys.length == 1 && handle.format === false
|
|
493
|
-
? params[keys[0]].split(',')
|
|
494
|
-
: params,
|
|
495
|
-
params:
|
|
496
|
-
keys.length == 1 && handle.format === false
|
|
497
|
-
? params[keys[0]].split(',')
|
|
498
|
-
: params,
|
|
499
|
-
method: handle.method,
|
|
500
|
-
format: handle.format
|
|
501
|
-
})
|
|
502
|
-
.then(res => {
|
|
503
|
-
this.$toast.clear();
|
|
504
|
-
if (res.rCode === 0) {
|
|
505
|
-
this.$message({
|
|
506
|
-
message: `${handle.text}成功`,
|
|
507
|
-
duration: 2000,
|
|
508
|
-
type: 'success',
|
|
509
|
-
onClose: () => {
|
|
510
|
-
let first = Object.prototype.hasOwnProperty.call(
|
|
511
|
-
handle,
|
|
512
|
-
'first'
|
|
513
|
-
)
|
|
514
|
-
? handle.first
|
|
515
|
-
: false;
|
|
516
|
-
let reload = handle.reload || true;
|
|
517
|
-
if (reload) {
|
|
518
|
-
this.reload({}, first);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
} else {
|
|
523
|
-
this.$toast(res.msg || `${handle.text}失败,请联系管理员!`);
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
.catch(() => {});
|
|
527
|
-
},
|
|
528
|
-
handleClick(res) {
|
|
529
|
-
let { row, handle } = res;
|
|
530
|
-
let rows;
|
|
531
|
-
if (handle.checkbox) {
|
|
532
|
-
if (!this.selected || !this.selected.length) {
|
|
533
|
-
this.$alert('请选择数据', '提示', { type: 'warning' });
|
|
534
|
-
return;
|
|
535
|
-
} else {
|
|
536
|
-
row = this.selected;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
if (this.checkboxParseData) {
|
|
540
|
-
rows = this.checkboxParseData(JSON.parse(JSON.stringify(row)));
|
|
541
|
-
} else if (this.checkboxParse) {
|
|
542
|
-
rows = this.checkParse(row, this.checkboxParse);
|
|
543
|
-
} else if (handle.checkboxParse) {
|
|
544
|
-
rows = this.checkParse(row, handle.checkboxParse);
|
|
545
|
-
} else if (row) {
|
|
546
|
-
rows = JSON.parse(JSON.stringify(row));
|
|
547
|
-
}
|
|
548
|
-
let thead = this.thead;
|
|
549
|
-
if (this.$refs.oaTable) {
|
|
550
|
-
thead = this.$refs.oaTable.getThead();
|
|
551
|
-
}
|
|
552
|
-
if (handle.action) {
|
|
553
|
-
let isConfirm = handle.confirm || true;
|
|
554
|
-
if (isConfirm) {
|
|
555
|
-
let msg = handle[this.valueKey] ? row[handle[this.valueKey]] : '';
|
|
556
|
-
this.$dialog
|
|
557
|
-
.confirm({
|
|
558
|
-
message: `确定要${handle.text}${msg}吗`,
|
|
559
|
-
title: '提示',
|
|
560
|
-
confirmButtonText: '确定',
|
|
561
|
-
cancelButtonText: '取消',
|
|
562
|
-
type: 'warning'
|
|
563
|
-
})
|
|
564
|
-
.then(() => {
|
|
565
|
-
this.handleAjax(handle, rows);
|
|
566
|
-
})
|
|
567
|
-
.catch(() => {});
|
|
568
|
-
} else {
|
|
569
|
-
this.handleAjax(handle, rows);
|
|
570
|
-
}
|
|
571
|
-
} else if (handle.event) {
|
|
572
|
-
if (typeof handle.event === 'function') {
|
|
573
|
-
handle.event({
|
|
574
|
-
ele: this,
|
|
575
|
-
thead: thead,
|
|
576
|
-
data: this.datas,
|
|
577
|
-
...res
|
|
578
|
-
});
|
|
579
|
-
} else if (
|
|
580
|
-
handle.event === 'add' ||
|
|
581
|
-
handle.event === 'edit' ||
|
|
582
|
-
handle.event === 'look'
|
|
583
|
-
) {
|
|
584
|
-
let changes = {
|
|
585
|
-
event: handle.event,
|
|
586
|
-
title: handle[this.labelKey] || handle.text,
|
|
587
|
-
values: handle.event === 'add' ? {} : rows,
|
|
588
|
-
readonly: handle.event === 'look',
|
|
589
|
-
actionType: handle.actionType
|
|
590
|
-
? handle.actionType
|
|
591
|
-
: handle.event === 'add'
|
|
592
|
-
? 'save'
|
|
593
|
-
: 'update'
|
|
594
|
-
};
|
|
595
|
-
if (handle.dialog && this.$parent.$attrs[handle.dialog]) {
|
|
596
|
-
this.$parent.$attrs[handle.dialog].handleShow();
|
|
597
|
-
} else {
|
|
598
|
-
changes['visible'] = true;
|
|
599
|
-
}
|
|
600
|
-
if (handle.tabs) {
|
|
601
|
-
this.esTabs && this.esTabs.handleChangeData(changes);
|
|
602
|
-
} else if (handle.flowGroup) {
|
|
603
|
-
this.esFlowGroup && this.esFlowGroup.handleChangeData(changes);
|
|
604
|
-
} else {
|
|
605
|
-
this.esPage && this.esPage.handleChangeData(changes);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
} else if (handle.changeData) {
|
|
609
|
-
let changeData = {};
|
|
610
|
-
if (Array.isArray(handle.changeData)) {
|
|
611
|
-
handle.changeData.forEach(item => {
|
|
612
|
-
if (util.isObject(item)) {
|
|
613
|
-
for (let i in item) {
|
|
614
|
-
if (typeof item[i] === 'boolean') {
|
|
615
|
-
changeData[i] = item[i];
|
|
616
|
-
} else {
|
|
617
|
-
changeData[i] = handle[item[i]] || item[i];
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
} else {
|
|
621
|
-
changeData[item] =
|
|
622
|
-
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
} else {
|
|
626
|
-
for (let i in handle.changeData) {
|
|
627
|
-
let item = handle.changeData[i];
|
|
628
|
-
if (util.isObject(item)) {
|
|
629
|
-
let obj = {};
|
|
630
|
-
for (let e in item) {
|
|
631
|
-
obj[e] =
|
|
632
|
-
handle[item[e]] ||
|
|
633
|
-
(Array.isArray(rows) ? rows : rows[item[e]]);
|
|
634
|
-
}
|
|
635
|
-
changeData[i] = obj;
|
|
636
|
-
} else {
|
|
637
|
-
if (typeof item === 'boolean') {
|
|
638
|
-
changeData[i] = item;
|
|
639
|
-
} else {
|
|
640
|
-
changeData[i] =
|
|
641
|
-
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
if (handle.actionType) {
|
|
647
|
-
changeData['actionType'] = handle.actionType;
|
|
648
|
-
}
|
|
649
|
-
if (handle.tabs) {
|
|
650
|
-
this.esTabs && this.esTabs.handleChangeData(changeData);
|
|
651
|
-
} else if (handle.flowGroup) {
|
|
652
|
-
this.esFlowGroup && this.esFlowGroup.handleChangeData(changeData);
|
|
653
|
-
} else {
|
|
654
|
-
this.esPage && this.esPage.handleChangeData(changeData);
|
|
655
|
-
}
|
|
656
|
-
} else {
|
|
657
|
-
if (handle.exportXls) {
|
|
658
|
-
let text = '操作';
|
|
659
|
-
if (
|
|
660
|
-
this.thead[this.thead.length - 1] &&
|
|
661
|
-
this.thead[this.thead.length - 1].type === 'handle'
|
|
662
|
-
) {
|
|
663
|
-
text = this.thead[this.thead.length - 1][this.labelKey];
|
|
664
|
-
}
|
|
665
|
-
thead = thead.map(item => {
|
|
666
|
-
return item.filter(ele => {
|
|
667
|
-
return ele.label !== text && ele.label;
|
|
668
|
-
});
|
|
669
|
-
});
|
|
670
|
-
util.exportXls({
|
|
671
|
-
thead: thead,
|
|
672
|
-
data: this.datas,
|
|
673
|
-
name: this.fileName
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
this.$emit('btnClick', res, this.datas, thead);
|
|
677
|
-
this.$emit('btn-click', res, this.datas, thead);
|
|
678
|
-
}
|
|
679
|
-
},
|
|
680
|
-
selectionChange(data) {
|
|
681
|
-
this.selected = JSON.parse(JSON.stringify(data));
|
|
682
|
-
this.$emit('selection-change', data);
|
|
683
|
-
},
|
|
684
|
-
rowClick(row, column, event) {
|
|
685
|
-
this.$emit('click', row, column, event);
|
|
686
|
-
this.$emit('row-click', row, column, event);
|
|
687
|
-
},
|
|
688
|
-
getChildrens(h, items) {
|
|
689
|
-
let doms = [];
|
|
690
|
-
items.childHead.forEach((item, index) => {
|
|
691
|
-
if (!item.hide) {
|
|
692
|
-
let childs = [];
|
|
693
|
-
if (item.childHead && item.childHead.length) {
|
|
694
|
-
childs = this.getChildrens(h, item);
|
|
695
|
-
}
|
|
696
|
-
doms.push(
|
|
697
|
-
h(
|
|
698
|
-
'em-table-column',
|
|
699
|
-
{
|
|
700
|
-
ref: 'emTableColum',
|
|
701
|
-
props: {
|
|
702
|
-
name: this.name,
|
|
703
|
-
item: item,
|
|
704
|
-
prop: item[this.valueKey],
|
|
705
|
-
label: item[this.labelKey],
|
|
706
|
-
width: item.width,
|
|
707
|
-
index: index + 1000,
|
|
708
|
-
readonly: this.readonly,
|
|
709
|
-
optionData: this.optionDatas,
|
|
710
|
-
form: this.form,
|
|
711
|
-
minWidth: this.minWidth
|
|
712
|
-
},
|
|
713
|
-
on: {
|
|
714
|
-
handleClick: this.handleClick,
|
|
715
|
-
formBlur: this.formBlur,
|
|
716
|
-
formFocus: this.formFocus,
|
|
717
|
-
tableColumns: this.getTableColumns,
|
|
718
|
-
formChange: this.formChange
|
|
719
|
-
}
|
|
720
|
-
},
|
|
721
|
-
childs
|
|
722
|
-
)
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
return doms;
|
|
727
|
-
},
|
|
728
|
-
tableRowClassName({ row, rowIndex }) {
|
|
729
|
-
if (rowIndex % 2 === 0) {
|
|
730
|
-
return 'em-row';
|
|
731
|
-
}
|
|
732
|
-
return '';
|
|
733
|
-
},
|
|
734
|
-
tableHeader() {
|
|
735
|
-
return 'em-table-header';
|
|
736
|
-
}
|
|
737
|
-
},
|
|
738
|
-
render(h) {
|
|
739
|
-
let tag = 'div';
|
|
740
|
-
let dom = [];
|
|
741
|
-
if (this.$slots.prepend) {
|
|
742
|
-
dom.push(this.$slots.prepend);
|
|
743
|
-
}
|
|
744
|
-
if (this.$slots.default) {
|
|
745
|
-
dom.push(this.$slots.default);
|
|
746
|
-
}
|
|
747
|
-
// 开启多选
|
|
748
|
-
if (this.checkbox) {
|
|
749
|
-
dom.push(
|
|
750
|
-
h('el-table-column', {
|
|
751
|
-
props: {
|
|
752
|
-
type: 'selection',
|
|
753
|
-
width: '55',
|
|
754
|
-
align: 'center',
|
|
755
|
-
fixed: 'left',
|
|
756
|
-
selectable: this.selectable,
|
|
757
|
-
reserveSelection: this.reserveSelection
|
|
758
|
-
}
|
|
759
|
-
})
|
|
760
|
-
);
|
|
761
|
-
}
|
|
762
|
-
// 开启索引
|
|
763
|
-
if (this.numbers) {
|
|
764
|
-
dom.push(
|
|
765
|
-
h('el-table-column', {
|
|
766
|
-
props: {
|
|
767
|
-
type: 'index',
|
|
768
|
-
label: '序号',
|
|
769
|
-
width: '60',
|
|
770
|
-
align: 'center',
|
|
771
|
-
fixed: 'left'
|
|
772
|
-
}
|
|
773
|
-
})
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
this.theads.forEach((items, indexs) => {
|
|
777
|
-
if (
|
|
778
|
-
items.type &&
|
|
779
|
-
(items.type === 'selection' || items.type === 'index')
|
|
780
|
-
) {
|
|
781
|
-
if (items.type === 'index') {
|
|
782
|
-
dom.push(
|
|
783
|
-
h('em-table-column', {
|
|
784
|
-
ref: 'emTableColum',
|
|
785
|
-
props: util.extend(
|
|
786
|
-
{},
|
|
787
|
-
{
|
|
788
|
-
type: 'index',
|
|
789
|
-
label: '序号',
|
|
790
|
-
width: '60',
|
|
791
|
-
align: 'center',
|
|
792
|
-
fixed: 'left'
|
|
793
|
-
},
|
|
794
|
-
items
|
|
795
|
-
),
|
|
796
|
-
|
|
797
|
-
key: indexs
|
|
798
|
-
})
|
|
799
|
-
);
|
|
800
|
-
} else {
|
|
801
|
-
dom.push(
|
|
802
|
-
h('em-table-column', {
|
|
803
|
-
ref: 'emTableColum',
|
|
804
|
-
props: util.extend(
|
|
805
|
-
{},
|
|
806
|
-
{
|
|
807
|
-
type: 'selection',
|
|
808
|
-
width: '55',
|
|
809
|
-
align: 'center',
|
|
810
|
-
fixed: 'left'
|
|
811
|
-
},
|
|
812
|
-
items
|
|
813
|
-
),
|
|
814
|
-
|
|
815
|
-
key: indexs
|
|
816
|
-
})
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
} else if (!items.hide) {
|
|
820
|
-
let tds = [];
|
|
821
|
-
if (items.childHead && items.childHead.length) {
|
|
822
|
-
tds = this.getChildrens(h, items);
|
|
823
|
-
}
|
|
824
|
-
dom.push(
|
|
825
|
-
h(
|
|
826
|
-
'em-table-column',
|
|
827
|
-
{
|
|
828
|
-
ref: 'emTableColum',
|
|
829
|
-
props: {
|
|
830
|
-
name: this.name,
|
|
831
|
-
prop: items[this.valueKey],
|
|
832
|
-
label: items[this.labelKey],
|
|
833
|
-
item: items,
|
|
834
|
-
width: items.width,
|
|
835
|
-
index: indexs,
|
|
836
|
-
readonly: this.readonly,
|
|
837
|
-
optionData: this.optionDatas,
|
|
838
|
-
form: this.form,
|
|
839
|
-
minWidth: this.minWidth
|
|
840
|
-
},
|
|
841
|
-
on: {
|
|
842
|
-
handleClick: this.handleClick,
|
|
843
|
-
formBlur: this.formBlur,
|
|
844
|
-
formFocus: this.formFocus,
|
|
845
|
-
tableColumns: this.getTableColumns,
|
|
846
|
-
formChange: this.formChange
|
|
847
|
-
},
|
|
848
|
-
key: indexs
|
|
849
|
-
},
|
|
850
|
-
tds
|
|
851
|
-
)
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
let tableContents = [];
|
|
856
|
-
if (!this.isEnlarge) {
|
|
857
|
-
tableContents.push(
|
|
858
|
-
h(
|
|
859
|
-
'el-table',
|
|
860
|
-
{
|
|
861
|
-
// ref: ref,
|
|
862
|
-
class: `em-table`,
|
|
863
|
-
attrs: {
|
|
864
|
-
'row-class-name': this.tableRowClassName,
|
|
865
|
-
'header-row-class-name': this.tableHeader,
|
|
866
|
-
data: this.datas,
|
|
867
|
-
...this.$attrs,
|
|
868
|
-
'max-height': this.maxHeight,
|
|
869
|
-
height:
|
|
870
|
-
this.tableHeight !== 'auto'
|
|
871
|
-
? this.tableHeight
|
|
872
|
-
: this.tableClientHeight
|
|
873
|
-
},
|
|
874
|
-
on: {
|
|
875
|
-
...this.$listeners,
|
|
876
|
-
'row-click': this.rowClick,
|
|
877
|
-
'selection-change': this.selectionChange
|
|
878
|
-
},
|
|
879
|
-
ref: 'oaTable'
|
|
880
|
-
},
|
|
881
|
-
dom
|
|
882
|
-
)
|
|
883
|
-
);
|
|
884
|
-
if (this.openEnlarge) {
|
|
885
|
-
tableContents.push(
|
|
886
|
-
h('i', {
|
|
887
|
-
class: 'iconfont em-fangda em-table-icon',
|
|
888
|
-
style: {
|
|
889
|
-
fontSize: this.enlargeSize + 'px',
|
|
890
|
-
color: this.enlargeColor
|
|
891
|
-
},
|
|
892
|
-
on: {
|
|
893
|
-
click: () => {
|
|
894
|
-
this.clickOpenEnlarge()
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
})
|
|
898
|
-
);
|
|
899
|
-
}
|
|
900
|
-
} else {
|
|
901
|
-
tableContents.push(
|
|
902
|
-
h(
|
|
903
|
-
'div',
|
|
904
|
-
{
|
|
905
|
-
class: 'em-table-isEnlarge',
|
|
906
|
-
style: {
|
|
907
|
-
'transform-origin':
|
|
908
|
-
this.clientWidth / 2 + 'px ' + this.clientWidth / 2 + 'px'
|
|
909
|
-
}
|
|
910
|
-
},
|
|
911
|
-
[
|
|
912
|
-
h(
|
|
913
|
-
'el-table',
|
|
914
|
-
{
|
|
915
|
-
// ref: ref,
|
|
916
|
-
class: `em-table`,
|
|
917
|
-
attrs: {
|
|
918
|
-
'row-class-name': this.tableRowClassName,
|
|
919
|
-
'header-row-class-name': this.tableHeader,
|
|
920
|
-
data: this.datas,
|
|
921
|
-
...this.$attrs,
|
|
922
|
-
'max-height': this.maxHeight,
|
|
923
|
-
height: this.page ? '90vw' : '100vw'
|
|
924
|
-
},
|
|
925
|
-
style: {
|
|
926
|
-
overflow: 'auto',
|
|
927
|
-
marginLeft: this.navHeight + 'px',
|
|
928
|
-
width: `calc(100% - ${this.navHeight}px)`
|
|
929
|
-
},
|
|
930
|
-
on: {
|
|
931
|
-
...this.$listeners,
|
|
932
|
-
'row-click': this.rowClick,
|
|
933
|
-
'selection-change': this.selectionChange
|
|
934
|
-
},
|
|
935
|
-
ref: 'oaTable'
|
|
936
|
-
},
|
|
937
|
-
dom
|
|
938
|
-
),
|
|
939
|
-
this.page
|
|
940
|
-
? h('em-pagination', {
|
|
941
|
-
attrs: {
|
|
942
|
-
...this.config
|
|
943
|
-
// pageNum: this.config.pageNum,
|
|
944
|
-
// pageSize: this.config.pageSize,
|
|
945
|
-
// totalCount: this.config.totalCount
|
|
946
|
-
},
|
|
947
|
-
class: 'em-table-page',
|
|
948
|
-
style: {
|
|
949
|
-
'text-align': this.page.position || 'center',
|
|
950
|
-
background: '#fff'
|
|
951
|
-
},
|
|
952
|
-
on: {
|
|
953
|
-
change: this.currentChange
|
|
954
|
-
}
|
|
955
|
-
})
|
|
956
|
-
: '',
|
|
957
|
-
h('i', {
|
|
958
|
-
class: 'iconfont em-guanbi em-table-icon',
|
|
959
|
-
style: {
|
|
960
|
-
fontSize: this.enlargeSize + 'px',
|
|
961
|
-
color: this.enlargeColor
|
|
962
|
-
},
|
|
963
|
-
on: {
|
|
964
|
-
click: () => {
|
|
965
|
-
this.isEnlarge = false;
|
|
966
|
-
this.$emit('enlarge-change',false);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
})
|
|
970
|
-
]
|
|
971
|
-
)
|
|
972
|
-
);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
if (this.page && !this.isEnlarge) {
|
|
976
|
-
tableContents.push(
|
|
977
|
-
h('em-pagination', {
|
|
978
|
-
attrs: {
|
|
979
|
-
...this.config
|
|
980
|
-
// pageNum: this.config.pageNum,
|
|
981
|
-
// pageSize: this.config.pageSize,
|
|
982
|
-
// totalCount: this.config.totalCount
|
|
983
|
-
},
|
|
984
|
-
class: 'em-table-page',
|
|
985
|
-
style: { 'text-align': this.page.position || 'center' },
|
|
986
|
-
on: {
|
|
987
|
-
change: this.currentChange
|
|
988
|
-
}
|
|
989
|
-
})
|
|
990
|
-
);
|
|
991
|
-
}
|
|
992
|
-
return h(
|
|
993
|
-
'div',
|
|
994
|
-
{
|
|
995
|
-
ref: 'emTable',
|
|
996
|
-
class: 'em-table-box',
|
|
997
|
-
style: {
|
|
998
|
-
height: '100%',
|
|
999
|
-
position: 'relative'
|
|
1000
|
-
}
|
|
1001
|
-
},
|
|
1002
|
-
tableContents
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
1006
|
-
</script>
|
|
1
|
+
<script>
|
|
2
|
+
import { Table } from 'element-ui';
|
|
3
|
+
import 'element-ui/lib/theme-chalk/table.css';
|
|
4
|
+
import request from 'eoss-mobile/src/utils/http';
|
|
5
|
+
import util from 'eoss-mobile/src/utils/util';
|
|
6
|
+
export default {
|
|
7
|
+
name: 'EmTable',
|
|
8
|
+
components: { Table },
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
navHeight: {
|
|
12
|
+
type: [String, Number],
|
|
13
|
+
default: 20
|
|
14
|
+
},
|
|
15
|
+
thead: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
openEnlarge: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
enlargeColor: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '#fff'
|
|
26
|
+
},
|
|
27
|
+
enlargeSize: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: 18
|
|
30
|
+
},
|
|
31
|
+
data: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => []
|
|
34
|
+
},
|
|
35
|
+
checkbox: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
// 开启分页
|
|
40
|
+
page: {
|
|
41
|
+
type: [Boolean, Object],
|
|
42
|
+
default() {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
numbers: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
selectable: Function,
|
|
51
|
+
reserveSelection: Boolean,
|
|
52
|
+
full: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
56
|
+
height: [Number, String],
|
|
57
|
+
maxHeight: [Number, String],
|
|
58
|
+
form: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
optionData: Object,
|
|
63
|
+
//本地数据总条数差值
|
|
64
|
+
lose: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: 0
|
|
67
|
+
},
|
|
68
|
+
param: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default() {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
method: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: 'get'
|
|
77
|
+
},
|
|
78
|
+
format: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
url: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ''
|
|
85
|
+
},
|
|
86
|
+
labelKey: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'title'
|
|
89
|
+
},
|
|
90
|
+
valueKey: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: 'field'
|
|
93
|
+
},
|
|
94
|
+
// 默认选中,类型为Boolean时默认全(不)选
|
|
95
|
+
checked: {
|
|
96
|
+
type: [Boolean, Array],
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
isForm: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
data() {
|
|
105
|
+
return {
|
|
106
|
+
selected: null,
|
|
107
|
+
pageChange: false,
|
|
108
|
+
tableHeight: 'auto',
|
|
109
|
+
tableClientHeight: undefined,
|
|
110
|
+
validateSuccess: true,
|
|
111
|
+
options: {},
|
|
112
|
+
theadData: [],
|
|
113
|
+
errForm: [],
|
|
114
|
+
isEnlarge: false,
|
|
115
|
+
clientWidth: document.documentElement.clientWidth,
|
|
116
|
+
list: null,
|
|
117
|
+
wheres: {},
|
|
118
|
+
config: {
|
|
119
|
+
pageNum: 1,
|
|
120
|
+
pageSize: 20,
|
|
121
|
+
totalCount: 0
|
|
122
|
+
},
|
|
123
|
+
isFirsetCheck: false
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
watch: {
|
|
127
|
+
checked(newVal) {
|
|
128
|
+
this.checkSelect(newVal);
|
|
129
|
+
},
|
|
130
|
+
page: {
|
|
131
|
+
immediate: true,
|
|
132
|
+
deep: true,
|
|
133
|
+
handler(val) {
|
|
134
|
+
this.config = util.extend({}, this.config, this.page);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
thead: {
|
|
138
|
+
immediate: true,
|
|
139
|
+
handler(val) {
|
|
140
|
+
if (typeof val === 'string') {
|
|
141
|
+
this.getTheads();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
height: {
|
|
146
|
+
immediate: true,
|
|
147
|
+
handler(val) {
|
|
148
|
+
if (val) {
|
|
149
|
+
this.tableHeight = val;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
maxHeight: {
|
|
154
|
+
immediate: true,
|
|
155
|
+
handler(val) {
|
|
156
|
+
if (val && this.height === undefined) {
|
|
157
|
+
this.tableHeight = val;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
param:{
|
|
162
|
+
immediate:true,
|
|
163
|
+
deep:true,
|
|
164
|
+
handler(val){
|
|
165
|
+
|
|
166
|
+
this.getTableData({ where: this.wheres, first: true })
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
mounted() {
|
|
171
|
+
// this.resetHeight();
|
|
172
|
+
this.getTableData();
|
|
173
|
+
this.checkSelect(this.checked);
|
|
174
|
+
if (!this.isForm) {
|
|
175
|
+
this.$nextTick(() => {
|
|
176
|
+
this.tableClientHeight = this.$refs.emTable.clientHeight - 40;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (this.full && !this.height) {
|
|
180
|
+
this.$nextTick(() => {
|
|
181
|
+
this.tableClientHeight = this.page?this.$refs.emTable.clientHeight - 40 : this.$refs.emTable.clientHeight;
|
|
182
|
+
// this. = this.$refs.emTable.clientHeight - 40;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
computed: {
|
|
187
|
+
theads() {
|
|
188
|
+
return typeof this.thead === 'string' ? this.theadData : this.thead;
|
|
189
|
+
},
|
|
190
|
+
optionDatas() {
|
|
191
|
+
return this.optionData ? this.optionData : this.options;
|
|
192
|
+
},
|
|
193
|
+
datas: {
|
|
194
|
+
get() {
|
|
195
|
+
if (this.list) {
|
|
196
|
+
return this.list;
|
|
197
|
+
}
|
|
198
|
+
if (
|
|
199
|
+
this.page &&
|
|
200
|
+
this.data &&
|
|
201
|
+
this.data.length &&
|
|
202
|
+
this.config.totalCount < this.data.length + 1
|
|
203
|
+
) {
|
|
204
|
+
this.config.totalCount = this.data.length - this.lose;
|
|
205
|
+
return this.data.filter((item, index) => {
|
|
206
|
+
return (
|
|
207
|
+
index > (this.config.pageNum - 1) * this.config.pageSize - 1 &&
|
|
208
|
+
index < this.config.pageNum * this.config.pageSize
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return this.data;
|
|
214
|
+
},
|
|
215
|
+
set(val) {
|
|
216
|
+
return val;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
methods: {
|
|
221
|
+
validValue(val) {
|
|
222
|
+
val && this.$toast(val);
|
|
223
|
+
this.validateSuccess = !val;
|
|
224
|
+
},
|
|
225
|
+
validate() {
|
|
226
|
+
let success = true;
|
|
227
|
+
const _that = this;
|
|
228
|
+
if (_that.form) {
|
|
229
|
+
_that.theads.map(item => {
|
|
230
|
+
if (item.rules && item.rules.required) {
|
|
231
|
+
this.datas.map(x => {
|
|
232
|
+
if (!x[item.field] && !item.rules.validator) {
|
|
233
|
+
_that.$toast(item.rules.message);
|
|
234
|
+
success = false;
|
|
235
|
+
} else if (item.rules.validator) {
|
|
236
|
+
item.rules.validator(x[item.field], _that.validValue);
|
|
237
|
+
success = _that.validateSuccess;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return success;
|
|
244
|
+
},
|
|
245
|
+
toggleAllSelection() {
|
|
246
|
+
this.$refs.oaTable.toggleAllSelection();
|
|
247
|
+
},
|
|
248
|
+
toggleRowSelection(newVal) {
|
|
249
|
+
newVal.forEach(row => {
|
|
250
|
+
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
checkSelect(newVal) {
|
|
254
|
+
if (!this.isFirsetCheck && newVal) {
|
|
255
|
+
if (util.getObjectType(newVal) === 'array') {
|
|
256
|
+
newVal.forEach(row => {
|
|
257
|
+
this.$refs.oaTable.toggleRowSelection(row, true);
|
|
258
|
+
});
|
|
259
|
+
} else if (newVal === true) {
|
|
260
|
+
this.toggleAllSelection();
|
|
261
|
+
}
|
|
262
|
+
this.isFirsetCheck = true;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
getTableData(res) {
|
|
266
|
+
let where;
|
|
267
|
+
let first;
|
|
268
|
+
if (res) {
|
|
269
|
+
where = res.where;
|
|
270
|
+
first = res.first;
|
|
271
|
+
}
|
|
272
|
+
if (!this.url) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (first !== false) {
|
|
276
|
+
this.config.pageNum = 1;
|
|
277
|
+
}
|
|
278
|
+
this.$toast.loading({
|
|
279
|
+
message: '加载中...',
|
|
280
|
+
forbidClick: true,
|
|
281
|
+
loadingType: 'spinner',
|
|
282
|
+
overlay: true,
|
|
283
|
+
duration: 0
|
|
284
|
+
});
|
|
285
|
+
let reqData = util.extend({}, this.param, {
|
|
286
|
+
pageNum: this.config.pageNum,
|
|
287
|
+
pageSize: this.config.pageSize
|
|
288
|
+
});
|
|
289
|
+
if (where) {
|
|
290
|
+
reqData = util.extend({}, reqData, where);
|
|
291
|
+
}
|
|
292
|
+
request({
|
|
293
|
+
url: this.url,
|
|
294
|
+
method: this.method,
|
|
295
|
+
format: this.format,
|
|
296
|
+
params: reqData,
|
|
297
|
+
data: reqData
|
|
298
|
+
})
|
|
299
|
+
.then(res => {
|
|
300
|
+
if (res.rCode === 0 || res.status === 'success') {
|
|
301
|
+
let results =
|
|
302
|
+
this.parseData !== undefined
|
|
303
|
+
? this.parseData(res.results || res.data || res)
|
|
304
|
+
: res.results || res.data;
|
|
305
|
+
this.list = results.data || results.records || results.list || [];
|
|
306
|
+
this.config.totalCount =
|
|
307
|
+
results.count || results.total || results.totalCount;
|
|
308
|
+
} else {
|
|
309
|
+
this.list = [];
|
|
310
|
+
}
|
|
311
|
+
this.$toast.clear();
|
|
312
|
+
this.$emit('success', res);
|
|
313
|
+
})
|
|
314
|
+
.catch(err => {
|
|
315
|
+
this.$toast.clear();
|
|
316
|
+
if (err && err.code && [64, 65, 67].indexOf(err.code) > -1) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (util.getObjectType(err) === 'string') {
|
|
320
|
+
this.$toast(err);
|
|
321
|
+
} else {
|
|
322
|
+
this.$toast(err.message || '数据加载失败,请联系管理员!');
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
clickOpenEnlarge(){
|
|
327
|
+
this.isEnlarge = true;
|
|
328
|
+
this.$emit('enlarge-change',true);
|
|
329
|
+
},
|
|
330
|
+
currentChange(res) {
|
|
331
|
+
this.pageChange = true;
|
|
332
|
+
setTimeout(() => {
|
|
333
|
+
this.pageChange = false;
|
|
334
|
+
}, 10);
|
|
335
|
+
this.config.pageNum = res;
|
|
336
|
+
this.$emit('page-current-change', res);
|
|
337
|
+
if (this.url) {
|
|
338
|
+
this.getTableData({ where: this.wheres, first: false });
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
getTheads() {
|
|
342
|
+
request({
|
|
343
|
+
url: this.thead,
|
|
344
|
+
method: this.method,
|
|
345
|
+
format: this.format,
|
|
346
|
+
params: this.param,
|
|
347
|
+
data: this.param
|
|
348
|
+
})
|
|
349
|
+
.then(res => {
|
|
350
|
+
if (res.rCode === 0) {
|
|
351
|
+
let results = res.results;
|
|
352
|
+
if (Array.isArray(results)) {
|
|
353
|
+
this.theadData = results;
|
|
354
|
+
} else {
|
|
355
|
+
this.theadData = results.theadData || [];
|
|
356
|
+
this.list = results.data || results.records || [];
|
|
357
|
+
this.config.totalCount =
|
|
358
|
+
results.count || results.total || results.totalCount;
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
this.theadData = [];
|
|
362
|
+
}
|
|
363
|
+
this.$emit('success', res);
|
|
364
|
+
})
|
|
365
|
+
.catch(err => {
|
|
366
|
+
if (err && err.code && [64, 65, 67].indexOf(err.code) > -1) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (util.getObjectType(err) === 'string') {
|
|
370
|
+
this.$message.error(err);
|
|
371
|
+
} else {
|
|
372
|
+
this.$message.error(err.message || '数据加载失败,请联系管理员!');
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
getTableColumns(data, name) {
|
|
377
|
+
this.optionDatas[name] = data;
|
|
378
|
+
},
|
|
379
|
+
formBlur(data) {
|
|
380
|
+
this.$emit('blur', data, this.datas);
|
|
381
|
+
},
|
|
382
|
+
formFocus(data) {
|
|
383
|
+
this.$emit('focus', data, this.datas);
|
|
384
|
+
},
|
|
385
|
+
formChange(data) {
|
|
386
|
+
if (this.pageChange) return;
|
|
387
|
+
if (data.type) {
|
|
388
|
+
this.pageChange = true;
|
|
389
|
+
setTimeout(() => {
|
|
390
|
+
this.pageChange = false;
|
|
391
|
+
}, 20);
|
|
392
|
+
}
|
|
393
|
+
this.$emit('edit', data, this.datas);
|
|
394
|
+
},
|
|
395
|
+
resetHeight() {
|
|
396
|
+
this.$nextTick(() => {
|
|
397
|
+
if (this.full && !this.height && !this.maxHeight) {
|
|
398
|
+
let height =
|
|
399
|
+
this.$el.parentNode.offsetHeight -
|
|
400
|
+
parseInt(util.getStyle(this.$el.parentNode, 'paddingTop'), 10) -
|
|
401
|
+
parseInt(util.getStyle(this.$el.parentNode, 'paddingBottom'), 10);
|
|
402
|
+
for (let i = 0; i < this.$el.parentNode.childNodes.length; i++) {
|
|
403
|
+
let ele = this.$el.parentNode.childNodes[i];
|
|
404
|
+
if (ele !== this.$el) {
|
|
405
|
+
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
for (let i = 0; i < this.$el.childNodes.length; i++) {
|
|
409
|
+
let ele = this.$el.childNodes[i];
|
|
410
|
+
if (ele !== this.$refs.esTableContent) {
|
|
411
|
+
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
this.styles = { height: height + 'px' };
|
|
415
|
+
const loadingDom = this.$refs.esTableContent.querySelector(
|
|
416
|
+
'.el-loading-mask'
|
|
417
|
+
);
|
|
418
|
+
for (
|
|
419
|
+
let i = 0;
|
|
420
|
+
i < this.$refs.esTableContent.childNodes.length;
|
|
421
|
+
i++
|
|
422
|
+
) {
|
|
423
|
+
let ele = this.$refs.esTableContent.childNodes[i];
|
|
424
|
+
if (
|
|
425
|
+
ele !== this.$refs.oaTable.$el &&
|
|
426
|
+
(!loadingDom || ele !== loadingDom)
|
|
427
|
+
) {
|
|
428
|
+
height -= ele.offsetHeight === undefined ? 0 : ele.offsetHeight;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
let pt = parseInt(
|
|
432
|
+
util.getStyle(this.$refs.esTableContent, 'paddingTop'),
|
|
433
|
+
10
|
|
434
|
+
);
|
|
435
|
+
let pb = parseInt(
|
|
436
|
+
util.getStyle(this.$refs.esTableContent, 'paddingBottom'),
|
|
437
|
+
10
|
|
438
|
+
);
|
|
439
|
+
this.tableHeight = height - pt - pb + (this.page ? 2 : 1) + 'px';
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
handleAjax(handle, row) {
|
|
444
|
+
this.$toast.loading({
|
|
445
|
+
message: '加载中...',
|
|
446
|
+
forbidClick: true,
|
|
447
|
+
loadingType: 'spinner',
|
|
448
|
+
overlay: true,
|
|
449
|
+
duration: 0
|
|
450
|
+
});
|
|
451
|
+
let params = handle.param || {};
|
|
452
|
+
if (handle.syncKeys) {
|
|
453
|
+
if (typeof handle.syncKeys === 'string') {
|
|
454
|
+
params[handle.syncKeys] = row[handle.syncKeys];
|
|
455
|
+
} else if (Array.isArray(handle.syncKeys)) {
|
|
456
|
+
for (let i in handle.syncKeys) {
|
|
457
|
+
if (Array.isArray(row)) {
|
|
458
|
+
let param = row.map(item => {
|
|
459
|
+
return item[handle.syncKeys[i]];
|
|
460
|
+
});
|
|
461
|
+
params[handle.syncKeys[i]] = param.join(',');
|
|
462
|
+
} else {
|
|
463
|
+
params[handle.syncKeys[i]] = row[handle.syncKeys[i]];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
} else {
|
|
467
|
+
for (let i in handle.syncKeys) {
|
|
468
|
+
if (Array.isArray(row)) {
|
|
469
|
+
let param = row.map(item => {
|
|
470
|
+
return item[handle.syncKeys[i]];
|
|
471
|
+
});
|
|
472
|
+
params[i] = param.join(',');
|
|
473
|
+
} else {
|
|
474
|
+
params[i] = row[handle.syncKeys[i]];
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
if (Array.isArray(row)) {
|
|
480
|
+
let param = row.map(item => {
|
|
481
|
+
return item.id;
|
|
482
|
+
});
|
|
483
|
+
params.id = param.join(',');
|
|
484
|
+
} else {
|
|
485
|
+
params.id = row.id;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
let keys = Object.keys(params);
|
|
489
|
+
request({
|
|
490
|
+
url: handle.action,
|
|
491
|
+
data:
|
|
492
|
+
keys.length == 1 && handle.format === false
|
|
493
|
+
? params[keys[0]].split(',')
|
|
494
|
+
: params,
|
|
495
|
+
params:
|
|
496
|
+
keys.length == 1 && handle.format === false
|
|
497
|
+
? params[keys[0]].split(',')
|
|
498
|
+
: params,
|
|
499
|
+
method: handle.method,
|
|
500
|
+
format: handle.format
|
|
501
|
+
})
|
|
502
|
+
.then(res => {
|
|
503
|
+
this.$toast.clear();
|
|
504
|
+
if (res.rCode === 0) {
|
|
505
|
+
this.$message({
|
|
506
|
+
message: `${handle.text}成功`,
|
|
507
|
+
duration: 2000,
|
|
508
|
+
type: 'success',
|
|
509
|
+
onClose: () => {
|
|
510
|
+
let first = Object.prototype.hasOwnProperty.call(
|
|
511
|
+
handle,
|
|
512
|
+
'first'
|
|
513
|
+
)
|
|
514
|
+
? handle.first
|
|
515
|
+
: false;
|
|
516
|
+
let reload = handle.reload || true;
|
|
517
|
+
if (reload) {
|
|
518
|
+
this.reload({}, first);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
} else {
|
|
523
|
+
this.$toast(res.msg || `${handle.text}失败,请联系管理员!`);
|
|
524
|
+
}
|
|
525
|
+
})
|
|
526
|
+
.catch(() => {});
|
|
527
|
+
},
|
|
528
|
+
handleClick(res) {
|
|
529
|
+
let { row, handle } = res;
|
|
530
|
+
let rows;
|
|
531
|
+
if (handle.checkbox) {
|
|
532
|
+
if (!this.selected || !this.selected.length) {
|
|
533
|
+
this.$alert('请选择数据', '提示', { type: 'warning' });
|
|
534
|
+
return;
|
|
535
|
+
} else {
|
|
536
|
+
row = this.selected;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (this.checkboxParseData) {
|
|
540
|
+
rows = this.checkboxParseData(JSON.parse(JSON.stringify(row)));
|
|
541
|
+
} else if (this.checkboxParse) {
|
|
542
|
+
rows = this.checkParse(row, this.checkboxParse);
|
|
543
|
+
} else if (handle.checkboxParse) {
|
|
544
|
+
rows = this.checkParse(row, handle.checkboxParse);
|
|
545
|
+
} else if (row) {
|
|
546
|
+
rows = JSON.parse(JSON.stringify(row));
|
|
547
|
+
}
|
|
548
|
+
let thead = this.thead;
|
|
549
|
+
if (this.$refs.oaTable) {
|
|
550
|
+
thead = this.$refs.oaTable.getThead();
|
|
551
|
+
}
|
|
552
|
+
if (handle.action) {
|
|
553
|
+
let isConfirm = handle.confirm || true;
|
|
554
|
+
if (isConfirm) {
|
|
555
|
+
let msg = handle[this.valueKey] ? row[handle[this.valueKey]] : '';
|
|
556
|
+
this.$dialog
|
|
557
|
+
.confirm({
|
|
558
|
+
message: `确定要${handle.text}${msg}吗`,
|
|
559
|
+
title: '提示',
|
|
560
|
+
confirmButtonText: '确定',
|
|
561
|
+
cancelButtonText: '取消',
|
|
562
|
+
type: 'warning'
|
|
563
|
+
})
|
|
564
|
+
.then(() => {
|
|
565
|
+
this.handleAjax(handle, rows);
|
|
566
|
+
})
|
|
567
|
+
.catch(() => {});
|
|
568
|
+
} else {
|
|
569
|
+
this.handleAjax(handle, rows);
|
|
570
|
+
}
|
|
571
|
+
} else if (handle.event) {
|
|
572
|
+
if (typeof handle.event === 'function') {
|
|
573
|
+
handle.event({
|
|
574
|
+
ele: this,
|
|
575
|
+
thead: thead,
|
|
576
|
+
data: this.datas,
|
|
577
|
+
...res
|
|
578
|
+
});
|
|
579
|
+
} else if (
|
|
580
|
+
handle.event === 'add' ||
|
|
581
|
+
handle.event === 'edit' ||
|
|
582
|
+
handle.event === 'look'
|
|
583
|
+
) {
|
|
584
|
+
let changes = {
|
|
585
|
+
event: handle.event,
|
|
586
|
+
title: handle[this.labelKey] || handle.text,
|
|
587
|
+
values: handle.event === 'add' ? {} : rows,
|
|
588
|
+
readonly: handle.event === 'look',
|
|
589
|
+
actionType: handle.actionType
|
|
590
|
+
? handle.actionType
|
|
591
|
+
: handle.event === 'add'
|
|
592
|
+
? 'save'
|
|
593
|
+
: 'update'
|
|
594
|
+
};
|
|
595
|
+
if (handle.dialog && this.$parent.$attrs[handle.dialog]) {
|
|
596
|
+
this.$parent.$attrs[handle.dialog].handleShow();
|
|
597
|
+
} else {
|
|
598
|
+
changes['visible'] = true;
|
|
599
|
+
}
|
|
600
|
+
if (handle.tabs) {
|
|
601
|
+
this.esTabs && this.esTabs.handleChangeData(changes);
|
|
602
|
+
} else if (handle.flowGroup) {
|
|
603
|
+
this.esFlowGroup && this.esFlowGroup.handleChangeData(changes);
|
|
604
|
+
} else {
|
|
605
|
+
this.esPage && this.esPage.handleChangeData(changes);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
} else if (handle.changeData) {
|
|
609
|
+
let changeData = {};
|
|
610
|
+
if (Array.isArray(handle.changeData)) {
|
|
611
|
+
handle.changeData.forEach(item => {
|
|
612
|
+
if (util.isObject(item)) {
|
|
613
|
+
for (let i in item) {
|
|
614
|
+
if (typeof item[i] === 'boolean') {
|
|
615
|
+
changeData[i] = item[i];
|
|
616
|
+
} else {
|
|
617
|
+
changeData[i] = handle[item[i]] || item[i];
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
} else {
|
|
621
|
+
changeData[item] =
|
|
622
|
+
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
} else {
|
|
626
|
+
for (let i in handle.changeData) {
|
|
627
|
+
let item = handle.changeData[i];
|
|
628
|
+
if (util.isObject(item)) {
|
|
629
|
+
let obj = {};
|
|
630
|
+
for (let e in item) {
|
|
631
|
+
obj[e] =
|
|
632
|
+
handle[item[e]] ||
|
|
633
|
+
(Array.isArray(rows) ? rows : rows[item[e]]);
|
|
634
|
+
}
|
|
635
|
+
changeData[i] = obj;
|
|
636
|
+
} else {
|
|
637
|
+
if (typeof item === 'boolean') {
|
|
638
|
+
changeData[i] = item;
|
|
639
|
+
} else {
|
|
640
|
+
changeData[i] =
|
|
641
|
+
handle[item] || (Array.isArray(rows) ? rows : rows[item]);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (handle.actionType) {
|
|
647
|
+
changeData['actionType'] = handle.actionType;
|
|
648
|
+
}
|
|
649
|
+
if (handle.tabs) {
|
|
650
|
+
this.esTabs && this.esTabs.handleChangeData(changeData);
|
|
651
|
+
} else if (handle.flowGroup) {
|
|
652
|
+
this.esFlowGroup && this.esFlowGroup.handleChangeData(changeData);
|
|
653
|
+
} else {
|
|
654
|
+
this.esPage && this.esPage.handleChangeData(changeData);
|
|
655
|
+
}
|
|
656
|
+
} else {
|
|
657
|
+
if (handle.exportXls) {
|
|
658
|
+
let text = '操作';
|
|
659
|
+
if (
|
|
660
|
+
this.thead[this.thead.length - 1] &&
|
|
661
|
+
this.thead[this.thead.length - 1].type === 'handle'
|
|
662
|
+
) {
|
|
663
|
+
text = this.thead[this.thead.length - 1][this.labelKey];
|
|
664
|
+
}
|
|
665
|
+
thead = thead.map(item => {
|
|
666
|
+
return item.filter(ele => {
|
|
667
|
+
return ele.label !== text && ele.label;
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
util.exportXls({
|
|
671
|
+
thead: thead,
|
|
672
|
+
data: this.datas,
|
|
673
|
+
name: this.fileName
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
this.$emit('btnClick', res, this.datas, thead);
|
|
677
|
+
this.$emit('btn-click', res, this.datas, thead);
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
selectionChange(data) {
|
|
681
|
+
this.selected = JSON.parse(JSON.stringify(data));
|
|
682
|
+
this.$emit('selection-change', data);
|
|
683
|
+
},
|
|
684
|
+
rowClick(row, column, event) {
|
|
685
|
+
this.$emit('click', row, column, event);
|
|
686
|
+
this.$emit('row-click', row, column, event);
|
|
687
|
+
},
|
|
688
|
+
getChildrens(h, items) {
|
|
689
|
+
let doms = [];
|
|
690
|
+
items.childHead.forEach((item, index) => {
|
|
691
|
+
if (!item.hide) {
|
|
692
|
+
let childs = [];
|
|
693
|
+
if (item.childHead && item.childHead.length) {
|
|
694
|
+
childs = this.getChildrens(h, item);
|
|
695
|
+
}
|
|
696
|
+
doms.push(
|
|
697
|
+
h(
|
|
698
|
+
'em-table-column',
|
|
699
|
+
{
|
|
700
|
+
ref: 'emTableColum',
|
|
701
|
+
props: {
|
|
702
|
+
name: this.name,
|
|
703
|
+
item: item,
|
|
704
|
+
prop: item[this.valueKey],
|
|
705
|
+
label: item[this.labelKey],
|
|
706
|
+
width: item.width,
|
|
707
|
+
index: index + 1000,
|
|
708
|
+
readonly: this.readonly,
|
|
709
|
+
optionData: this.optionDatas,
|
|
710
|
+
form: this.form,
|
|
711
|
+
minWidth: this.minWidth
|
|
712
|
+
},
|
|
713
|
+
on: {
|
|
714
|
+
handleClick: this.handleClick,
|
|
715
|
+
formBlur: this.formBlur,
|
|
716
|
+
formFocus: this.formFocus,
|
|
717
|
+
tableColumns: this.getTableColumns,
|
|
718
|
+
formChange: this.formChange
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
childs
|
|
722
|
+
)
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
return doms;
|
|
727
|
+
},
|
|
728
|
+
tableRowClassName({ row, rowIndex }) {
|
|
729
|
+
if (rowIndex % 2 === 0) {
|
|
730
|
+
return 'em-row';
|
|
731
|
+
}
|
|
732
|
+
return '';
|
|
733
|
+
},
|
|
734
|
+
tableHeader() {
|
|
735
|
+
return 'em-table-header';
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
render(h) {
|
|
739
|
+
let tag = 'div';
|
|
740
|
+
let dom = [];
|
|
741
|
+
if (this.$slots.prepend) {
|
|
742
|
+
dom.push(this.$slots.prepend);
|
|
743
|
+
}
|
|
744
|
+
if (this.$slots.default) {
|
|
745
|
+
dom.push(this.$slots.default);
|
|
746
|
+
}
|
|
747
|
+
// 开启多选
|
|
748
|
+
if (this.checkbox) {
|
|
749
|
+
dom.push(
|
|
750
|
+
h('el-table-column', {
|
|
751
|
+
props: {
|
|
752
|
+
type: 'selection',
|
|
753
|
+
width: '55',
|
|
754
|
+
align: 'center',
|
|
755
|
+
fixed: 'left',
|
|
756
|
+
selectable: this.selectable,
|
|
757
|
+
reserveSelection: this.reserveSelection
|
|
758
|
+
}
|
|
759
|
+
})
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
// 开启索引
|
|
763
|
+
if (this.numbers) {
|
|
764
|
+
dom.push(
|
|
765
|
+
h('el-table-column', {
|
|
766
|
+
props: {
|
|
767
|
+
type: 'index',
|
|
768
|
+
label: '序号',
|
|
769
|
+
width: '60',
|
|
770
|
+
align: 'center',
|
|
771
|
+
fixed: 'left'
|
|
772
|
+
}
|
|
773
|
+
})
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
this.theads.forEach((items, indexs) => {
|
|
777
|
+
if (
|
|
778
|
+
items.type &&
|
|
779
|
+
(items.type === 'selection' || items.type === 'index')
|
|
780
|
+
) {
|
|
781
|
+
if (items.type === 'index') {
|
|
782
|
+
dom.push(
|
|
783
|
+
h('em-table-column', {
|
|
784
|
+
ref: 'emTableColum',
|
|
785
|
+
props: util.extend(
|
|
786
|
+
{},
|
|
787
|
+
{
|
|
788
|
+
type: 'index',
|
|
789
|
+
label: '序号',
|
|
790
|
+
width: '60',
|
|
791
|
+
align: 'center',
|
|
792
|
+
fixed: 'left'
|
|
793
|
+
},
|
|
794
|
+
items
|
|
795
|
+
),
|
|
796
|
+
|
|
797
|
+
key: indexs
|
|
798
|
+
})
|
|
799
|
+
);
|
|
800
|
+
} else {
|
|
801
|
+
dom.push(
|
|
802
|
+
h('em-table-column', {
|
|
803
|
+
ref: 'emTableColum',
|
|
804
|
+
props: util.extend(
|
|
805
|
+
{},
|
|
806
|
+
{
|
|
807
|
+
type: 'selection',
|
|
808
|
+
width: '55',
|
|
809
|
+
align: 'center',
|
|
810
|
+
fixed: 'left'
|
|
811
|
+
},
|
|
812
|
+
items
|
|
813
|
+
),
|
|
814
|
+
|
|
815
|
+
key: indexs
|
|
816
|
+
})
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
} else if (!items.hide) {
|
|
820
|
+
let tds = [];
|
|
821
|
+
if (items.childHead && items.childHead.length) {
|
|
822
|
+
tds = this.getChildrens(h, items);
|
|
823
|
+
}
|
|
824
|
+
dom.push(
|
|
825
|
+
h(
|
|
826
|
+
'em-table-column',
|
|
827
|
+
{
|
|
828
|
+
ref: 'emTableColum',
|
|
829
|
+
props: {
|
|
830
|
+
name: this.name,
|
|
831
|
+
prop: items[this.valueKey],
|
|
832
|
+
label: items[this.labelKey],
|
|
833
|
+
item: items,
|
|
834
|
+
width: items.width,
|
|
835
|
+
index: indexs,
|
|
836
|
+
readonly: this.readonly,
|
|
837
|
+
optionData: this.optionDatas,
|
|
838
|
+
form: this.form,
|
|
839
|
+
minWidth: this.minWidth
|
|
840
|
+
},
|
|
841
|
+
on: {
|
|
842
|
+
handleClick: this.handleClick,
|
|
843
|
+
formBlur: this.formBlur,
|
|
844
|
+
formFocus: this.formFocus,
|
|
845
|
+
tableColumns: this.getTableColumns,
|
|
846
|
+
formChange: this.formChange
|
|
847
|
+
},
|
|
848
|
+
key: indexs
|
|
849
|
+
},
|
|
850
|
+
tds
|
|
851
|
+
)
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
let tableContents = [];
|
|
856
|
+
if (!this.isEnlarge) {
|
|
857
|
+
tableContents.push(
|
|
858
|
+
h(
|
|
859
|
+
'el-table',
|
|
860
|
+
{
|
|
861
|
+
// ref: ref,
|
|
862
|
+
class: `em-table`,
|
|
863
|
+
attrs: {
|
|
864
|
+
'row-class-name': this.tableRowClassName,
|
|
865
|
+
'header-row-class-name': this.tableHeader,
|
|
866
|
+
data: this.datas,
|
|
867
|
+
...this.$attrs,
|
|
868
|
+
'max-height': this.maxHeight,
|
|
869
|
+
height:
|
|
870
|
+
this.tableHeight !== 'auto'
|
|
871
|
+
? this.tableHeight
|
|
872
|
+
: this.tableClientHeight
|
|
873
|
+
},
|
|
874
|
+
on: {
|
|
875
|
+
...this.$listeners,
|
|
876
|
+
'row-click': this.rowClick,
|
|
877
|
+
'selection-change': this.selectionChange
|
|
878
|
+
},
|
|
879
|
+
ref: 'oaTable'
|
|
880
|
+
},
|
|
881
|
+
dom
|
|
882
|
+
)
|
|
883
|
+
);
|
|
884
|
+
if (this.openEnlarge) {
|
|
885
|
+
tableContents.push(
|
|
886
|
+
h('i', {
|
|
887
|
+
class: 'iconfont em-fangda em-table-icon',
|
|
888
|
+
style: {
|
|
889
|
+
fontSize: this.enlargeSize + 'px',
|
|
890
|
+
color: this.enlargeColor
|
|
891
|
+
},
|
|
892
|
+
on: {
|
|
893
|
+
click: () => {
|
|
894
|
+
this.clickOpenEnlarge()
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
})
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
} else {
|
|
901
|
+
tableContents.push(
|
|
902
|
+
h(
|
|
903
|
+
'div',
|
|
904
|
+
{
|
|
905
|
+
class: 'em-table-isEnlarge',
|
|
906
|
+
style: {
|
|
907
|
+
'transform-origin':
|
|
908
|
+
this.clientWidth / 2 + 'px ' + this.clientWidth / 2 + 'px'
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
[
|
|
912
|
+
h(
|
|
913
|
+
'el-table',
|
|
914
|
+
{
|
|
915
|
+
// ref: ref,
|
|
916
|
+
class: `em-table`,
|
|
917
|
+
attrs: {
|
|
918
|
+
'row-class-name': this.tableRowClassName,
|
|
919
|
+
'header-row-class-name': this.tableHeader,
|
|
920
|
+
data: this.datas,
|
|
921
|
+
...this.$attrs,
|
|
922
|
+
'max-height': this.maxHeight,
|
|
923
|
+
height: this.page ? '90vw' : '100vw'
|
|
924
|
+
},
|
|
925
|
+
style: {
|
|
926
|
+
overflow: 'auto',
|
|
927
|
+
marginLeft: this.navHeight + 'px',
|
|
928
|
+
width: `calc(100% - ${this.navHeight}px)`
|
|
929
|
+
},
|
|
930
|
+
on: {
|
|
931
|
+
...this.$listeners,
|
|
932
|
+
'row-click': this.rowClick,
|
|
933
|
+
'selection-change': this.selectionChange
|
|
934
|
+
},
|
|
935
|
+
ref: 'oaTable'
|
|
936
|
+
},
|
|
937
|
+
dom
|
|
938
|
+
),
|
|
939
|
+
this.page
|
|
940
|
+
? h('em-pagination', {
|
|
941
|
+
attrs: {
|
|
942
|
+
...this.config
|
|
943
|
+
// pageNum: this.config.pageNum,
|
|
944
|
+
// pageSize: this.config.pageSize,
|
|
945
|
+
// totalCount: this.config.totalCount
|
|
946
|
+
},
|
|
947
|
+
class: 'em-table-page',
|
|
948
|
+
style: {
|
|
949
|
+
'text-align': this.page.position || 'center',
|
|
950
|
+
background: '#fff'
|
|
951
|
+
},
|
|
952
|
+
on: {
|
|
953
|
+
change: this.currentChange
|
|
954
|
+
}
|
|
955
|
+
})
|
|
956
|
+
: '',
|
|
957
|
+
h('i', {
|
|
958
|
+
class: 'iconfont em-guanbi em-table-icon',
|
|
959
|
+
style: {
|
|
960
|
+
fontSize: this.enlargeSize + 'px',
|
|
961
|
+
color: this.enlargeColor
|
|
962
|
+
},
|
|
963
|
+
on: {
|
|
964
|
+
click: () => {
|
|
965
|
+
this.isEnlarge = false;
|
|
966
|
+
this.$emit('enlarge-change',false);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
})
|
|
970
|
+
]
|
|
971
|
+
)
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
if (this.page && !this.isEnlarge) {
|
|
976
|
+
tableContents.push(
|
|
977
|
+
h('em-pagination', {
|
|
978
|
+
attrs: {
|
|
979
|
+
...this.config
|
|
980
|
+
// pageNum: this.config.pageNum,
|
|
981
|
+
// pageSize: this.config.pageSize,
|
|
982
|
+
// totalCount: this.config.totalCount
|
|
983
|
+
},
|
|
984
|
+
class: 'em-table-page',
|
|
985
|
+
style: { 'text-align': this.page.position || 'center' },
|
|
986
|
+
on: {
|
|
987
|
+
change: this.currentChange
|
|
988
|
+
}
|
|
989
|
+
})
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
return h(
|
|
993
|
+
'div',
|
|
994
|
+
{
|
|
995
|
+
ref: 'emTable',
|
|
996
|
+
class: 'em-table-box',
|
|
997
|
+
style: {
|
|
998
|
+
height: '100%',
|
|
999
|
+
position: 'relative'
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
tableContents
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
</script>
|