n20-common-lib 1.3.28 → 1.3.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/assets/css/el-button.scss +1 -4
- package/src/assets/css/el-table.scss +0 -9
- package/src/components/ChildRange/index.vue +40 -37
- package/src/components/ChildRange/style.scss +28 -28
- package/src/components/FileExportAsync/index.vue +44 -31
- package/src/components/FileUploadTable/index.vue +5 -1
- package/src/components/Filters/form-item-input.vue +133 -0
- package/src/components/Filters/index.vue +95 -246
- package/src/components/InputNumber/index.vue +10 -0
- package/src/components/ShowColumn/index.vue +54 -15
- package/src/components/Table/ThSelectHeader.vue +5 -5
- package/src/components/Table/filters.js +60 -0
- package/src/components/Table/index.vue +12 -137
- package/src/components/TableOperateColumn/OperateBtns.vue +73 -0
- package/src/components/TableOperateColumn/index.vue +26 -0
- package/src/index.js +3 -0
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
- package/theme/blue.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
|
@@ -5,13 +5,8 @@
|
|
|
5
5
|
:width="width"
|
|
6
6
|
title="筛选"
|
|
7
7
|
placement="bottom-end"
|
|
8
|
-
@show="
|
|
9
|
-
@after-leave="
|
|
10
|
-
() => {
|
|
11
|
-
showPopC = false
|
|
12
|
-
showMore = false
|
|
13
|
-
}
|
|
14
|
-
"
|
|
8
|
+
@show="show"
|
|
9
|
+
@after-leave="leave"
|
|
15
10
|
>
|
|
16
11
|
<template slot="reference">
|
|
17
12
|
<el-button
|
|
@@ -30,240 +25,75 @@
|
|
|
30
25
|
:label-width="labelWidth"
|
|
31
26
|
@submit.native.prevent
|
|
32
27
|
>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<slot v-if="item.slotName" :name="item.slotName"></slot>
|
|
40
|
-
<el-input
|
|
41
|
-
v-else-if="item.type === 'text' || item.type === undefined"
|
|
42
|
-
v-model="form[item.value]"
|
|
43
|
-
:clearable="item | clearableF"
|
|
44
|
-
style="width: 100%"
|
|
45
|
-
v-bind="item.props"
|
|
46
|
-
v-on="item.on"
|
|
47
|
-
/>
|
|
48
|
-
<el-select
|
|
49
|
-
v-else-if="item.type === 'select'"
|
|
50
|
-
v-model="form[item.value]"
|
|
51
|
-
:clearable="item | clearableF"
|
|
52
|
-
:multiple="item.multiple"
|
|
53
|
-
style="width: 100%"
|
|
54
|
-
v-bind="item.props"
|
|
55
|
-
v-on="item.on"
|
|
56
|
-
>
|
|
57
|
-
<template
|
|
58
|
-
v-if="item.props && item.props.labelKey && item.props.valueKey"
|
|
59
|
-
>
|
|
60
|
-
<el-option
|
|
61
|
-
v-for="(c, i) in item.options"
|
|
62
|
-
:key="i"
|
|
63
|
-
:label="c[item.props.labelKey]"
|
|
64
|
-
:value="c[item.props.valueKey]"
|
|
65
|
-
:disabled="c.disabled"
|
|
66
|
-
/>
|
|
67
|
-
</template>
|
|
68
|
-
<template v-else>
|
|
69
|
-
<el-option
|
|
70
|
-
v-for="c in item.options"
|
|
71
|
-
:key="c.value + '_' + c.label"
|
|
72
|
-
:label="c.label"
|
|
73
|
-
:value="c.value"
|
|
74
|
-
:disabled="c.disabled"
|
|
75
|
-
/>
|
|
76
|
-
</template>
|
|
77
|
-
</el-select>
|
|
78
|
-
<inputNumber
|
|
79
|
-
v-else-if="item.type === 'number'"
|
|
80
|
-
v-model="form[item.value]"
|
|
81
|
-
style="width: 100%"
|
|
82
|
-
v-bind="item.props"
|
|
83
|
-
v-on="item.on"
|
|
84
|
-
/>
|
|
85
|
-
<inputNumberRange
|
|
86
|
-
v-else-if="item.type === 'numberrange'"
|
|
87
|
-
:start-value.sync="form[item.startValue]"
|
|
88
|
-
:end-value.sync="form[item.endValue]"
|
|
89
|
-
style="width: 100%"
|
|
90
|
-
v-bind="item.props"
|
|
91
|
-
v-on="item.on"
|
|
92
|
-
/>
|
|
93
|
-
<datePickerPor
|
|
94
|
-
v-else-if="item.type === 'date'"
|
|
95
|
-
v-model="form[item.value]"
|
|
96
|
-
type="date"
|
|
97
|
-
:clearable="item | clearableF"
|
|
98
|
-
style="width: 100%"
|
|
99
|
-
v-bind="item.props"
|
|
100
|
-
v-on="item.on"
|
|
101
|
-
/>
|
|
102
|
-
<datePickerPor
|
|
103
|
-
v-else-if="item.type === 'daterange'"
|
|
104
|
-
type="daterange"
|
|
105
|
-
:start-date.sync="form[item.startDate]"
|
|
106
|
-
:end-date.sync="form[item.endDate]"
|
|
107
|
-
:clearable="item | clearableF"
|
|
108
|
-
style="width: 100%"
|
|
109
|
-
v-bind="item.props"
|
|
110
|
-
v-on="item.on"
|
|
111
|
-
/>
|
|
112
|
-
<el-checkbox-group
|
|
113
|
-
v-else-if="item.type === 'checkbox'"
|
|
114
|
-
v-model="form[item.value]"
|
|
115
|
-
v-bind="item.props"
|
|
116
|
-
v-on="item.on"
|
|
28
|
+
<template v-if="!type">
|
|
29
|
+
<el-form-item
|
|
30
|
+
v-for="(item, i) in minList"
|
|
31
|
+
:key="i"
|
|
32
|
+
class="m-b"
|
|
33
|
+
:label="item.label"
|
|
117
34
|
>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
35
|
+
<slot v-if="item.slotName" :name="item.slotName"></slot>
|
|
36
|
+
<form-item-input v-else :form="form" :item="item" />
|
|
37
|
+
</el-form-item>
|
|
38
|
+
<template v-if="filterList.length > defaultShow">
|
|
39
|
+
<div :style="{ paddingLeft: labelWidth }">
|
|
40
|
+
<el-button
|
|
41
|
+
class="p-t-0 m-b-s color-primary"
|
|
42
|
+
type="text"
|
|
43
|
+
@click="showMore = !showMore"
|
|
44
|
+
><span>更多条件</span
|
|
45
|
+
><i
|
|
46
|
+
:class="showMore ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
|
47
|
+
></i
|
|
48
|
+
></el-button>
|
|
49
|
+
</div>
|
|
50
|
+
<el-collapse-transition>
|
|
51
|
+
<div v-if="showMore">
|
|
52
|
+
<el-form-item
|
|
53
|
+
v-for="(item, i) in moreList"
|
|
54
|
+
:key="i"
|
|
55
|
+
class="m-b"
|
|
56
|
+
:label="item.label"
|
|
57
|
+
>
|
|
58
|
+
<slot v-if="item.slotName" :name="item.slotName"></slot>
|
|
59
|
+
<form-item-input v-else :form="form" :item="item" />
|
|
60
|
+
</el-form-item>
|
|
61
|
+
</div>
|
|
62
|
+
</el-collapse-transition>
|
|
63
|
+
</template>
|
|
64
|
+
</template>
|
|
65
|
+
<template v-else-if="type === 'remote'">
|
|
66
|
+
<!-- 服务端保存筛选条件组 -->
|
|
67
|
+
<el-form-item
|
|
68
|
+
v-for="(item, i) in remoteList"
|
|
69
|
+
:key="i"
|
|
70
|
+
class="m-b"
|
|
71
|
+
:label="item.label"
|
|
131
72
|
>
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
:label="c.value"
|
|
136
|
-
:disabled="c.disabled"
|
|
137
|
-
>{{ c.label }}</el-radio
|
|
138
|
-
>
|
|
139
|
-
</el-radio-group>
|
|
140
|
-
</el-form-item>
|
|
141
|
-
<template v-if="filterList.length > defaultShow">
|
|
73
|
+
<slot v-if="item.slotName" :name="item.slotName"></slot>
|
|
74
|
+
<form-item-input v-else :form="form" :item="item" />
|
|
75
|
+
</el-form-item>
|
|
142
76
|
<div :style="{ paddingLeft: labelWidth }">
|
|
143
77
|
<el-button
|
|
144
78
|
class="p-t-0 m-b-s color-primary"
|
|
145
79
|
type="text"
|
|
146
|
-
@click="
|
|
80
|
+
@click="setRemoteV = true"
|
|
147
81
|
><span>更多条件</span
|
|
148
82
|
><i
|
|
149
83
|
:class="showMore ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
|
150
84
|
></i
|
|
151
85
|
></el-button>
|
|
152
86
|
</div>
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
v-else-if="item.type === 'text' || item.type === undefined"
|
|
164
|
-
v-model="form[item.value]"
|
|
165
|
-
:clearable="item | clearableF"
|
|
166
|
-
style="width: 100%"
|
|
167
|
-
v-bind="item.props"
|
|
168
|
-
v-on="item.on"
|
|
169
|
-
/>
|
|
170
|
-
<el-select
|
|
171
|
-
v-else-if="item.type === 'select'"
|
|
172
|
-
v-model="form[item.value]"
|
|
173
|
-
:clearable="item | clearableF"
|
|
174
|
-
:multiple="item.multiple"
|
|
175
|
-
style="width: 100%"
|
|
176
|
-
v-bind="item.props"
|
|
177
|
-
v-on="item.on"
|
|
178
|
-
>
|
|
179
|
-
<template
|
|
180
|
-
v-if="
|
|
181
|
-
item.props && item.props.labelKey && item.props.valueKey
|
|
182
|
-
"
|
|
183
|
-
>
|
|
184
|
-
<el-option
|
|
185
|
-
v-for="(c, i) in item.options"
|
|
186
|
-
:key="i"
|
|
187
|
-
:label="c[item.props.labelKey]"
|
|
188
|
-
:value="c[item.props.valueKey]"
|
|
189
|
-
:disabled="c.disabled"
|
|
190
|
-
/>
|
|
191
|
-
</template>
|
|
192
|
-
<template v-else>
|
|
193
|
-
<el-option
|
|
194
|
-
v-for="c in item.options"
|
|
195
|
-
:key="c.value + '_' + c.label"
|
|
196
|
-
:label="c.label"
|
|
197
|
-
:value="c.value"
|
|
198
|
-
:disabled="c.disabled"
|
|
199
|
-
/>
|
|
200
|
-
</template>
|
|
201
|
-
</el-select>
|
|
202
|
-
<inputNumber
|
|
203
|
-
v-else-if="item.type === 'number'"
|
|
204
|
-
v-model="form[item.value]"
|
|
205
|
-
style="width: 100%"
|
|
206
|
-
v-bind="item.props"
|
|
207
|
-
v-on="item.on"
|
|
208
|
-
/>
|
|
209
|
-
<inputNumberRange
|
|
210
|
-
v-else-if="item.type === 'numberrange'"
|
|
211
|
-
:start-value.sync="form[item.startValue]"
|
|
212
|
-
:end-value.sync="form[item.endValue]"
|
|
213
|
-
style="width: 100%"
|
|
214
|
-
v-bind="item.props"
|
|
215
|
-
v-on="item.on"
|
|
216
|
-
/>
|
|
217
|
-
<datePickerPor
|
|
218
|
-
v-else-if="item.type === 'date'"
|
|
219
|
-
v-model="form[item.value]"
|
|
220
|
-
type="date"
|
|
221
|
-
:clearable="item | clearableF"
|
|
222
|
-
style="width: 100%"
|
|
223
|
-
v-bind="item.props"
|
|
224
|
-
v-on="item.on"
|
|
225
|
-
/>
|
|
226
|
-
<datePickerPor
|
|
227
|
-
v-else-if="item.type === 'daterange'"
|
|
228
|
-
type="daterange"
|
|
229
|
-
:start-date.sync="form[item.startDate]"
|
|
230
|
-
:end-date.sync="form[item.endDate]"
|
|
231
|
-
:clearable="item | clearableF"
|
|
232
|
-
style="width: 100%"
|
|
233
|
-
v-bind="item.props"
|
|
234
|
-
v-on="item.on"
|
|
235
|
-
/>
|
|
236
|
-
<el-checkbox-group
|
|
237
|
-
v-else-if="item.type === 'checkbox'"
|
|
238
|
-
v-model="form[item.value]"
|
|
239
|
-
v-bind="item.props"
|
|
240
|
-
v-on="item.on"
|
|
241
|
-
>
|
|
242
|
-
<el-checkbox
|
|
243
|
-
v-for="c in item.options"
|
|
244
|
-
:key="c.value"
|
|
245
|
-
:label="c.value"
|
|
246
|
-
:disabled="c.disabled"
|
|
247
|
-
>{{ c.label }}</el-checkbox
|
|
248
|
-
>
|
|
249
|
-
</el-checkbox-group>
|
|
250
|
-
<el-radio-group
|
|
251
|
-
v-else-if="item.type === 'radio'"
|
|
252
|
-
v-model="form[item.value]"
|
|
253
|
-
v-bind="item.props"
|
|
254
|
-
v-on="item.on"
|
|
255
|
-
>
|
|
256
|
-
<el-radio
|
|
257
|
-
v-for="c in item.options"
|
|
258
|
-
:key="c.value"
|
|
259
|
-
:label="c.value"
|
|
260
|
-
:disabled="c.disabled"
|
|
261
|
-
>{{ c.label }}</el-radio
|
|
262
|
-
>
|
|
263
|
-
</el-radio-group>
|
|
264
|
-
</el-form-item>
|
|
265
|
-
</div>
|
|
266
|
-
</el-collapse-transition>
|
|
87
|
+
<showColumn
|
|
88
|
+
ref="setRemote"
|
|
89
|
+
:dialog-visible.sync="setRemoteV"
|
|
90
|
+
:check-columns="remoteList"
|
|
91
|
+
:columns="filterList"
|
|
92
|
+
:is-filter="true"
|
|
93
|
+
:auto-save="true"
|
|
94
|
+
page-id="filterId"
|
|
95
|
+
@setColumns="setRemoteChange"
|
|
96
|
+
/>
|
|
267
97
|
</template>
|
|
268
98
|
<footerBox class="text-c">
|
|
269
99
|
<el-button type="primary" @click="filter">确认</el-button>
|
|
@@ -274,26 +104,15 @@
|
|
|
274
104
|
</template>
|
|
275
105
|
|
|
276
106
|
<script>
|
|
277
|
-
import
|
|
278
|
-
import inputNumberRange from '../InputNumber/numberRange.vue'
|
|
279
|
-
import datePickerPor from '../DatePicker/por.vue'
|
|
107
|
+
import formItemInput from './form-item-input.vue'
|
|
280
108
|
import footerBox from '../FooterBox/index.vue'
|
|
109
|
+
import showColumn from '../ShowColumn/index.vue'
|
|
281
110
|
export default {
|
|
282
111
|
name: 'Filters',
|
|
283
112
|
components: {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
footerBox
|
|
288
|
-
},
|
|
289
|
-
filters: {
|
|
290
|
-
clearableF(item) {
|
|
291
|
-
if (item.props && item.props.clearable === false) {
|
|
292
|
-
return false
|
|
293
|
-
} else {
|
|
294
|
-
return true
|
|
295
|
-
}
|
|
296
|
-
}
|
|
113
|
+
formItemInput,
|
|
114
|
+
footerBox,
|
|
115
|
+
showColumn
|
|
297
116
|
},
|
|
298
117
|
props: {
|
|
299
118
|
width: {
|
|
@@ -315,13 +134,23 @@ export default {
|
|
|
315
134
|
labelWidth: {
|
|
316
135
|
type: [String, Number],
|
|
317
136
|
default: '5em'
|
|
137
|
+
},
|
|
138
|
+
type: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: undefined
|
|
141
|
+
},
|
|
142
|
+
filterId: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: undefined
|
|
318
145
|
}
|
|
319
146
|
},
|
|
320
147
|
data() {
|
|
321
148
|
return {
|
|
322
149
|
showPop: false,
|
|
323
150
|
showPopC: false,
|
|
324
|
-
showMore: false
|
|
151
|
+
showMore: false,
|
|
152
|
+
remoteList: [],
|
|
153
|
+
setRemoteV: false
|
|
325
154
|
}
|
|
326
155
|
},
|
|
327
156
|
computed: {
|
|
@@ -333,6 +162,18 @@ export default {
|
|
|
333
162
|
}
|
|
334
163
|
},
|
|
335
164
|
methods: {
|
|
165
|
+
show() {
|
|
166
|
+
this.showPopC = true
|
|
167
|
+
this.$nextTick(() => {
|
|
168
|
+
if (this.type === 'remote' && !this.remoteList.length) {
|
|
169
|
+
this.getRemote()
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
},
|
|
173
|
+
leave() {
|
|
174
|
+
this.showPopC = false
|
|
175
|
+
this.showMore = false
|
|
176
|
+
},
|
|
336
177
|
clear() {
|
|
337
178
|
this.$emit('clear')
|
|
338
179
|
},
|
|
@@ -366,6 +207,14 @@ export default {
|
|
|
366
207
|
if (item) {
|
|
367
208
|
item.options = opts || []
|
|
368
209
|
}
|
|
210
|
+
},
|
|
211
|
+
getRemote() {
|
|
212
|
+
this.$refs['setRemote'].getColumns().then((list) => {
|
|
213
|
+
this.remoteList = list || this.filterList
|
|
214
|
+
})
|
|
215
|
+
},
|
|
216
|
+
setRemoteChange(list) {
|
|
217
|
+
this.remoteList = list
|
|
369
218
|
}
|
|
370
219
|
}
|
|
371
220
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
:disabled="disabled"
|
|
9
9
|
:placeholder="phd"
|
|
10
10
|
@focus="focusFn"
|
|
11
|
+
@blur.native.capture.stop
|
|
11
12
|
/>
|
|
12
13
|
<el-input-number
|
|
13
14
|
v-else
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
:value="valueNum"
|
|
20
21
|
:placeholder="phd"
|
|
21
22
|
v-on="listeners"
|
|
23
|
+
@input.native="inputFn"
|
|
22
24
|
@blur="blurFn"
|
|
23
25
|
@change="changeFn"
|
|
24
26
|
/>
|
|
@@ -96,6 +98,7 @@ export default {
|
|
|
96
98
|
if (val && typeof val === 'string' && val.includes(',')) {
|
|
97
99
|
return this.$emit('input', Number(val.replace(/,/g, '')))
|
|
98
100
|
}
|
|
101
|
+
this.preValue = val
|
|
99
102
|
this.valueStr = this.num2str(val)
|
|
100
103
|
},
|
|
101
104
|
immediate: true
|
|
@@ -163,6 +166,13 @@ export default {
|
|
|
163
166
|
}
|
|
164
167
|
break
|
|
165
168
|
}
|
|
169
|
+
},
|
|
170
|
+
inputFn({ target }) {
|
|
171
|
+
if (isNaN(target.value)) {
|
|
172
|
+
target.value = this.preValue
|
|
173
|
+
} else {
|
|
174
|
+
this.preValue = target.value
|
|
175
|
+
}
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
178
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
:visible.sync="visible"
|
|
7
7
|
:width="width"
|
|
8
|
-
:title="
|
|
8
|
+
:title="title"
|
|
9
9
|
@open="popOpen"
|
|
10
10
|
>
|
|
11
11
|
<div class="dialog-view">
|
|
12
12
|
<div class="flex-box">
|
|
13
13
|
<div class="left-c flex-column p-t-m bd-r">
|
|
14
14
|
<div class="flex-box flex-v p-r m-b">
|
|
15
|
-
<span>{{
|
|
15
|
+
<span>{{ header }}</span>
|
|
16
16
|
<span class="m-l-m color-999">
|
|
17
17
|
已选
|
|
18
18
|
<span class="color-main">{{ dragList.length }}</span>
|
|
@@ -87,6 +87,10 @@ export default {
|
|
|
87
87
|
type: Boolean,
|
|
88
88
|
default: false
|
|
89
89
|
},
|
|
90
|
+
isFilter: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
90
94
|
labelKey: {
|
|
91
95
|
type: String,
|
|
92
96
|
default: 'label'
|
|
@@ -111,6 +115,24 @@ export default {
|
|
|
111
115
|
}
|
|
112
116
|
},
|
|
113
117
|
computed: {
|
|
118
|
+
title() {
|
|
119
|
+
if (this.isExport) {
|
|
120
|
+
return '导出'
|
|
121
|
+
} else if (this.isFilter) {
|
|
122
|
+
return '筛选'
|
|
123
|
+
} else {
|
|
124
|
+
return '设置显示列'
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
header() {
|
|
128
|
+
if (this.isExport) {
|
|
129
|
+
return '导出'
|
|
130
|
+
} else if (this.isFilter) {
|
|
131
|
+
return '筛选'
|
|
132
|
+
} else {
|
|
133
|
+
return '显示列'
|
|
134
|
+
}
|
|
135
|
+
},
|
|
114
136
|
visible: {
|
|
115
137
|
get() {
|
|
116
138
|
return this.dialogVisible
|
|
@@ -154,32 +176,37 @@ export default {
|
|
|
154
176
|
},
|
|
155
177
|
setChange() {
|
|
156
178
|
if (this.dragList.length < 1) {
|
|
157
|
-
this.$message.error(
|
|
179
|
+
this.$message.error(
|
|
180
|
+
`至少设置${
|
|
181
|
+
this.isExport
|
|
182
|
+
? '一列导出数据'
|
|
183
|
+
: this.isFilter
|
|
184
|
+
? '一个筛选条件'
|
|
185
|
+
: '一列显示列'
|
|
186
|
+
}!`
|
|
187
|
+
)
|
|
158
188
|
return
|
|
159
189
|
}
|
|
160
|
-
// 自动保存设置的显示列
|
|
161
|
-
!this.isExport && this.autoSave && this.saveColumns()
|
|
162
190
|
|
|
163
191
|
let list = []
|
|
164
192
|
let preCols = this.columns.filter((col) => col.static === 'pre')
|
|
165
193
|
let nextCols = this.columns.filter((col) => col.static === 'next')
|
|
166
194
|
list.push(...preCols, ...this.dragList, ...nextCols)
|
|
167
195
|
|
|
196
|
+
// 自动保存设置的显示列
|
|
197
|
+
!this.isExport && this.autoSave && this.saveColumns(list)
|
|
198
|
+
|
|
168
199
|
this.$emit('setColumns', list)
|
|
169
200
|
this.visible = false
|
|
170
201
|
},
|
|
171
|
-
saveColumns() {
|
|
172
|
-
let
|
|
173
|
-
let preCols = this.columns.filter((col) => col.static === 'pre')
|
|
174
|
-
let nextCols = this.columns.filter((col) => col.static === 'next')
|
|
175
|
-
list.push(...preCols, ...this.dragList, ...nextCols)
|
|
176
|
-
|
|
202
|
+
saveColumns(list) {
|
|
203
|
+
let labels = list.map((c) => c[this.labelKey] || c)
|
|
177
204
|
axios.post(
|
|
178
205
|
'/bems/prod_1.0/user/pageHabit',
|
|
179
206
|
{
|
|
180
207
|
userNo: this.userNo,
|
|
181
208
|
pageId: this.pageId,
|
|
182
|
-
showStructure: JSON.stringify(
|
|
209
|
+
showStructure: JSON.stringify(labels)
|
|
183
210
|
},
|
|
184
211
|
{ loading: false }
|
|
185
212
|
)
|
|
@@ -198,10 +225,22 @@ export default {
|
|
|
198
225
|
.then(({ data }) => {
|
|
199
226
|
if (data) {
|
|
200
227
|
let _data = JSON.parse(data)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
228
|
+
if (_data && _data.length > 0) {
|
|
229
|
+
let columns = []
|
|
230
|
+
_data.forEach((d) => {
|
|
231
|
+
if (typeof d === 'string') {
|
|
232
|
+
let column = this.columns.find(
|
|
233
|
+
(c) => c[this.labelKey] === d
|
|
234
|
+
)
|
|
235
|
+
column && columns.push(column)
|
|
236
|
+
} else if (typeof d === 'object') {
|
|
237
|
+
columns.push(d)
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
return resolve(columns)
|
|
241
|
+
}
|
|
204
242
|
}
|
|
243
|
+
return resolve(undefined)
|
|
205
244
|
})
|
|
206
245
|
.catch((err) => {
|
|
207
246
|
reject(err)
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
v-model="checkbox"
|
|
24
24
|
:indeterminate="isIndeterminate"
|
|
25
25
|
@change="checkboxChange"
|
|
26
|
-
>{{ '全部' + '(' +
|
|
26
|
+
>{{ '全部' + '(' + dataList.length + ')' }}</el-checkbox
|
|
27
27
|
>
|
|
28
28
|
<el-checkbox-group
|
|
29
29
|
v-model="checkLists"
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
return {}
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
dataList: {
|
|
67
67
|
type: Array,
|
|
68
68
|
default: () => {
|
|
69
69
|
return []
|
|
@@ -108,8 +108,8 @@ export default {
|
|
|
108
108
|
})
|
|
109
109
|
},
|
|
110
110
|
countNum(res) {
|
|
111
|
-
var newArrays = this.
|
|
112
|
-
return item[this.property]
|
|
111
|
+
var newArrays = this.dataList.filter((item) => {
|
|
112
|
+
return item[this.property] === res
|
|
113
113
|
})
|
|
114
114
|
return newArrays.length
|
|
115
115
|
},
|
|
@@ -125,4 +125,4 @@ export default {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
</script>
|
|
128
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import numerify from 'numerify'
|
|
2
|
+
import dayjs from 'dayjs'
|
|
3
|
+
|
|
4
|
+
function tplFn(row, sc, mck, map = {}) {
|
|
5
|
+
let str = ''
|
|
6
|
+
sc.forEach((s, i) => {
|
|
7
|
+
str += s
|
|
8
|
+
let kA = mck[i]
|
|
9
|
+
if (kA && kA.length) {
|
|
10
|
+
let key = kA[0]
|
|
11
|
+
if (kA.length === 1) {
|
|
12
|
+
str += row[key]
|
|
13
|
+
} else {
|
|
14
|
+
let type = kA[1]
|
|
15
|
+
switch (type) {
|
|
16
|
+
case 'money':
|
|
17
|
+
str += numerify(row[key], '0,0.00')
|
|
18
|
+
break
|
|
19
|
+
case 'rate':
|
|
20
|
+
str += numerify(row[key], '0.000000')
|
|
21
|
+
break
|
|
22
|
+
case 'map':
|
|
23
|
+
str += map[row[key]]
|
|
24
|
+
break
|
|
25
|
+
case 'date':
|
|
26
|
+
str += dayjs(row[key]).format('YYYY-MM-DD')
|
|
27
|
+
break
|
|
28
|
+
case 'datetime':
|
|
29
|
+
str += dayjs(row[key]).format('YYYY-MM-DD HH:mm:ss')
|
|
30
|
+
break
|
|
31
|
+
case 'time':
|
|
32
|
+
str += dayjs(row[key]).format('HH:mm:ss')
|
|
33
|
+
break
|
|
34
|
+
default:
|
|
35
|
+
str += row[key]
|
|
36
|
+
break
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
return str
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function colfF(colf, map) {
|
|
45
|
+
if (typeof colf !== 'string') return colf
|
|
46
|
+
let sc = colf.split(/{.+?}/g) || []
|
|
47
|
+
let mc = colf.match(/{.+?}/g) || []
|
|
48
|
+
let mck = []
|
|
49
|
+
mc.forEach((t) => {
|
|
50
|
+
t = t.replace(/^{|\s+|}$/g, '').split('|')
|
|
51
|
+
mck.push(t)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
return (row) => tplFn(row, sc, mck, map)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function colftF(colft, fMap) {
|
|
58
|
+
if (typeof colft !== 'string') return colft
|
|
59
|
+
return fMap[colft]
|
|
60
|
+
}
|