n20-common-lib 1.3.2 → 1.3.5
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/g6.js +197 -0
- package/package.json +3 -2
- package/src/components/ECharts/mixins/resize.js +1 -1
- package/src/components/FileImport/index.vue +1 -1
- package/src/components/LoginTemporary/index.vue +3 -3
- package/src/components/NstcG6Components/Form/DatepickerCustom/index.vue +32 -32
- package/src/components/NstcG6Components/NstcBranchLazyLoad/NstcBranchLazyLoad.vue +37 -33
- package/src/components/NstcG6Components/NstcCharts/mixins/resize.js +1 -1
- package/src/components/NstcG6Components/NstcDropdownTree/NstcDropdownTree.vue +141 -137
- package/src/components/NstcG6Components/NstcExcelExport/NstcExcelExport.vue +47 -47
- package/src/components/NstcG6Components/NstcExcelImport/NstcExcelImport.vue +1 -1
- package/src/components/NstcG6Components/NstcExcelImportN/NstcExcelImportN.vue +186 -188
- package/src/components/NstcG6Components/NstcFileUpload/NstcFileUpload.vue +429 -451
- package/src/components/NstcG6Components/NstcForm/BusinessSpecific/InputMultiple.vue +66 -68
- package/src/components/NstcG6Components/NstcForm/CascaderCustom/index.vue +7 -7
- package/src/components/NstcG6Components/NstcForm/DatepickerCustom/index.vue +32 -32
- package/src/components/NstcG6Components/NstcForm/InputAndDialog/NstcInputAndDialog.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/InputCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectAccount/NstcSelectAccount.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectAndDialog/NstcSelectAndDialog.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/SelectindialogCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcForm/UploadCustom/index.vue +1 -1
- package/src/components/NstcG6Components/NstcSelectTree/NstcSelectTree.vue +172 -172
- package/src/components/NstcG6Components/NstcSelectTreeList/NstcSelectTreeList.vue +1 -1
- package/src/components/NstcG6Components/NstcSvgIcon/NstcSvgIcon.vue +7 -12
- package/src/components/NstcG6Components/NstcTable/NstcTable.vue +145 -145
- package/src/components/NstcG6Components/NstcTableSet/NstcTableSet.vue +4 -4
- package/src/components/NstcG6Components/NstcWorkBench/NstcWorkBench.vue +45 -36
- package/src/components/NstcG6Components/Search/NstcSearch.vue +6 -6
- package/src/components/NstcG6Components/approvelTwo/main.vue +1 -1
- package/src/components/NstcG6Components/approvelTwo/progress.vue +1 -1
- package/src/components/Search/index.vue +8 -8
- package/src/index.js +3 -3
- package/style/css/normalize.scss +726 -0
- package/style/pageDemo/demo-1.vue +131 -0
- package/style/pageDemo/demo-2.vue +35 -0
- package/style/pageDemo/demo-3.vue +22 -0
- package/style/pageDemo/seeCode.js +20 -0
- package/style/server-config.jsonc +723 -0
|
@@ -6,33 +6,37 @@
|
|
|
6
6
|
|
|
7
7
|
<template>
|
|
8
8
|
<div class="form-create-dropdown-tree">
|
|
9
|
-
<el-popover
|
|
9
|
+
<el-popover
|
|
10
|
+
placement="bottom-start"
|
|
11
|
+
trigger="click"
|
|
12
|
+
v-model="showPopoverFlag"
|
|
13
|
+
>
|
|
10
14
|
<el-input
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
:ref="inputRefName"
|
|
16
|
+
v-model="filterText"
|
|
17
|
+
suffix-icon="el-icon-search"
|
|
18
|
+
:placeholder="placeholder || placeholderTemp"
|
|
19
|
+
:style="{ width: inputWidth }"
|
|
20
|
+
@input="inputChange"
|
|
21
|
+
@blur="clearFilterText"
|
|
22
|
+
@focus="inputFocus"
|
|
23
|
+
@change="inputChangeAction"
|
|
24
|
+
clearable
|
|
25
|
+
/>
|
|
26
|
+
<el-tree
|
|
27
|
+
:ref="treeRefName"
|
|
28
|
+
class="filter-tree"
|
|
29
|
+
:data="treeData"
|
|
30
|
+
:props="defaultProps"
|
|
31
|
+
:node-key="nodeKey"
|
|
32
|
+
default-expand-all
|
|
33
|
+
:show-checkbox="showCheckbox"
|
|
34
|
+
:check-strictly="showCheckbox"
|
|
35
|
+
v-bind="$attrs"
|
|
36
|
+
v-on="$listeners"
|
|
37
|
+
@node-click="treeNodeClick"
|
|
38
|
+
@check="handleCheckChange"
|
|
39
|
+
/>
|
|
36
40
|
<span class="el-dropdown-link" slot="reference">
|
|
37
41
|
{{ unitNameText }}
|
|
38
42
|
<i class="el-icon-arrow-down el-icon--right" />
|
|
@@ -42,180 +46,180 @@
|
|
|
42
46
|
</template>
|
|
43
47
|
|
|
44
48
|
<script>
|
|
45
|
-
import axios from
|
|
49
|
+
import axios from '../../../utils/axios'
|
|
46
50
|
export default {
|
|
47
|
-
name:
|
|
51
|
+
name: 'NstcDropdownTree', // 单位按树模块查询
|
|
48
52
|
props: {
|
|
49
53
|
value: {
|
|
50
54
|
type: [String, Number, Array, Object],
|
|
51
55
|
default: () => {
|
|
52
|
-
return
|
|
53
|
-
}
|
|
56
|
+
return ''
|
|
57
|
+
}
|
|
54
58
|
},
|
|
55
59
|
|
|
56
60
|
lazy: {
|
|
57
61
|
type: Boolean,
|
|
58
|
-
default: false
|
|
62
|
+
default: false
|
|
59
63
|
},
|
|
60
64
|
|
|
61
65
|
inputWidth: {
|
|
62
66
|
type: String,
|
|
63
|
-
default:
|
|
67
|
+
default: ''
|
|
64
68
|
},
|
|
65
69
|
|
|
66
70
|
showCheckbox: {
|
|
67
71
|
type: Boolean,
|
|
68
|
-
default: false
|
|
72
|
+
default: false
|
|
69
73
|
},
|
|
70
74
|
|
|
71
75
|
url: {
|
|
72
76
|
type: String,
|
|
73
|
-
default:
|
|
77
|
+
default: ''
|
|
74
78
|
},
|
|
75
79
|
|
|
76
80
|
nodeKey: {
|
|
77
81
|
type: String,
|
|
78
|
-
default:
|
|
82
|
+
default: 'id'
|
|
79
83
|
},
|
|
80
84
|
|
|
81
85
|
defaultProps: {
|
|
82
86
|
type: Object,
|
|
83
87
|
default: () => {
|
|
84
88
|
return {
|
|
85
|
-
children:
|
|
86
|
-
label:
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
+
children: 'children',
|
|
90
|
+
label: 'label'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
89
93
|
},
|
|
90
94
|
|
|
91
95
|
params: {
|
|
92
96
|
type: Object,
|
|
93
97
|
default: () => {
|
|
94
|
-
return {}
|
|
95
|
-
}
|
|
98
|
+
return {}
|
|
99
|
+
}
|
|
96
100
|
},
|
|
97
101
|
|
|
98
102
|
queryKey: {
|
|
99
103
|
type: String,
|
|
100
|
-
default:
|
|
104
|
+
default: 'query'
|
|
101
105
|
},
|
|
102
106
|
|
|
103
107
|
label: {
|
|
104
108
|
type: [String, Number],
|
|
105
|
-
default:
|
|
109
|
+
default: ''
|
|
106
110
|
},
|
|
107
111
|
|
|
108
112
|
// 额外的查询参数
|
|
109
113
|
query: {
|
|
110
114
|
type: Object,
|
|
111
115
|
default: () => {
|
|
112
|
-
return {}
|
|
113
|
-
}
|
|
116
|
+
return {}
|
|
117
|
+
}
|
|
114
118
|
},
|
|
115
119
|
|
|
116
120
|
// 组件的大小
|
|
117
121
|
size: {
|
|
118
122
|
type: String,
|
|
119
123
|
default: () => {
|
|
120
|
-
return
|
|
121
|
-
}
|
|
124
|
+
return 'normal'
|
|
125
|
+
}
|
|
122
126
|
},
|
|
123
127
|
//是否添加 无
|
|
124
128
|
showNull: {
|
|
125
129
|
type: Boolean,
|
|
126
|
-
default: false
|
|
130
|
+
default: false
|
|
127
131
|
},
|
|
128
132
|
dropUnitName: {
|
|
129
133
|
type: String,
|
|
130
|
-
default:
|
|
134
|
+
default: '全部单位'
|
|
131
135
|
},
|
|
132
136
|
placeholderTemp: {
|
|
133
137
|
type: String,
|
|
134
|
-
default:
|
|
135
|
-
}
|
|
138
|
+
default: '请输入关键字进行过滤'
|
|
139
|
+
}
|
|
136
140
|
},
|
|
137
141
|
data() {
|
|
138
142
|
return {
|
|
139
143
|
showPopoverFlag: false,
|
|
140
144
|
filterText: null,
|
|
141
145
|
treeData: [],
|
|
142
|
-
treeRefName:
|
|
146
|
+
treeRefName: '',
|
|
143
147
|
inputRefName: this.getRefName(),
|
|
144
148
|
queryFlag: true,
|
|
145
|
-
placeholder:
|
|
149
|
+
placeholder: '',
|
|
146
150
|
windowEventFlag: false,
|
|
147
151
|
timeTemp: null,
|
|
148
|
-
unitNameText:
|
|
149
|
-
}
|
|
152
|
+
unitNameText: '全部单位'
|
|
153
|
+
}
|
|
150
154
|
},
|
|
151
155
|
computed: {
|
|
152
156
|
_value: {
|
|
153
157
|
get() {
|
|
154
|
-
return this.value
|
|
158
|
+
return this.value
|
|
155
159
|
},
|
|
156
160
|
set(val) {
|
|
157
|
-
this.$emit(
|
|
158
|
-
}
|
|
159
|
-
}
|
|
161
|
+
this.$emit('input', val)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
160
164
|
},
|
|
161
165
|
watch: {
|
|
162
166
|
label(val) {
|
|
163
|
-
this.filterText = val
|
|
167
|
+
this.filterText = val
|
|
164
168
|
},
|
|
165
169
|
value(val) {
|
|
166
|
-
if ([
|
|
167
|
-
this.filterText = null
|
|
168
|
-
this.placeholder = null
|
|
170
|
+
if (['', null].includes(val)) {
|
|
171
|
+
this.filterText = null
|
|
172
|
+
this.placeholder = null
|
|
169
173
|
}
|
|
170
174
|
},
|
|
171
175
|
dropUnitName: {
|
|
172
176
|
handler(val) {
|
|
173
|
-
this.unitNameText = val
|
|
177
|
+
this.unitNameText = val
|
|
174
178
|
},
|
|
175
|
-
deep: true
|
|
176
|
-
}
|
|
179
|
+
deep: true
|
|
180
|
+
}
|
|
177
181
|
},
|
|
178
182
|
|
|
179
183
|
created() {
|
|
180
184
|
//
|
|
181
|
-
this.treeRefName = this.getRefName()
|
|
182
|
-
this.unitNameText = this.dropUnitName
|
|
185
|
+
this.treeRefName = this.getRefName()
|
|
186
|
+
this.unitNameText = this.dropUnitName
|
|
183
187
|
// 默认加载一次
|
|
184
|
-
this.remoteMethod()
|
|
188
|
+
this.remoteMethod()
|
|
185
189
|
|
|
186
|
-
this.filterText = this.label
|
|
190
|
+
this.filterText = this.label
|
|
187
191
|
|
|
188
192
|
// 点击其他地方关闭关闭下拉
|
|
189
|
-
const that = this
|
|
193
|
+
const that = this
|
|
190
194
|
document.documentElement.onclick = function () {
|
|
191
|
-
that.windowEventFlag && that.clearFilterText()
|
|
192
|
-
}
|
|
195
|
+
that.windowEventFlag && that.clearFilterText()
|
|
196
|
+
}
|
|
193
197
|
},
|
|
194
198
|
methods: {
|
|
195
199
|
/**
|
|
196
200
|
* input 输入框变化事件
|
|
197
201
|
*/
|
|
198
202
|
inputChange() {
|
|
199
|
-
const that = this
|
|
200
|
-
this.timeTemp && clearTimeout(that.timeTemp)
|
|
203
|
+
const that = this
|
|
204
|
+
this.timeTemp && clearTimeout(that.timeTemp)
|
|
201
205
|
this.timeTemp = setTimeout(() => {
|
|
202
|
-
console.log(
|
|
203
|
-
this.queryFlag && this.remoteMethod()
|
|
204
|
-
this.queryFlag = true
|
|
205
|
-
}, 300)
|
|
206
|
+
console.log('input change', this.filterText)
|
|
207
|
+
this.queryFlag && this.remoteMethod()
|
|
208
|
+
this.queryFlag = true
|
|
209
|
+
}, 300)
|
|
206
210
|
},
|
|
207
211
|
|
|
208
212
|
inputChangeAction(val) {
|
|
209
|
-
console.log(
|
|
210
|
-
this.$emit(
|
|
213
|
+
console.log('change')
|
|
214
|
+
this.$emit('inputChangeAction', val)
|
|
211
215
|
},
|
|
212
216
|
|
|
213
217
|
/**
|
|
214
218
|
* 本地模糊查询
|
|
215
219
|
*/
|
|
216
220
|
filterNode(value, data) {
|
|
217
|
-
if (!value) return true
|
|
218
|
-
return data.label.indexOf(value) !== -1
|
|
221
|
+
if (!value) return true
|
|
222
|
+
return data.label.indexOf(value) !== -1
|
|
219
223
|
},
|
|
220
224
|
|
|
221
225
|
/**
|
|
@@ -224,47 +228,47 @@ export default {
|
|
|
224
228
|
getRefName() {
|
|
225
229
|
return `ref_${new Date().getTime()}_${Math.random()
|
|
226
230
|
.toString()
|
|
227
|
-
.slice(5, 13)}
|
|
231
|
+
.slice(5, 13)}`
|
|
228
232
|
},
|
|
229
233
|
|
|
230
234
|
/**
|
|
231
235
|
* 远程查询
|
|
232
236
|
*/
|
|
233
237
|
remoteMethod() {
|
|
234
|
-
const that = this
|
|
238
|
+
const that = this
|
|
235
239
|
//担保的需求化,默认是树,搜索时为列表
|
|
236
240
|
// if(this.filterText){
|
|
237
241
|
// this.params.resultType = 0
|
|
238
242
|
// }else{
|
|
239
243
|
// this.params.resultType = 1
|
|
240
244
|
// }
|
|
241
|
-
console.log(this.params,
|
|
245
|
+
console.log(this.params, 'this.params')
|
|
242
246
|
axios({
|
|
243
247
|
url: that.url,
|
|
244
|
-
method:
|
|
248
|
+
method: 'get',
|
|
245
249
|
loading: false,
|
|
246
250
|
params: {
|
|
247
251
|
[that.queryKey]: that.filterText,
|
|
248
|
-
...that.params
|
|
249
|
-
}
|
|
252
|
+
...that.params
|
|
253
|
+
}
|
|
250
254
|
})
|
|
251
255
|
.then((data) => {
|
|
252
|
-
that.treeData = data.list ? data.list : data
|
|
256
|
+
that.treeData = data.list ? data.list : data
|
|
253
257
|
if (that.showNull) {
|
|
254
258
|
let map = {
|
|
255
|
-
treeNo:
|
|
256
|
-
unitName:
|
|
257
|
-
unitNo:
|
|
258
|
-
}
|
|
259
|
+
treeNo: '',
|
|
260
|
+
unitName: '全部单位',
|
|
261
|
+
unitNo: ''
|
|
262
|
+
}
|
|
259
263
|
// eslint-disable-next-line no-debugger
|
|
260
264
|
// debugger;
|
|
261
|
-
that.treeData.unshift(map)
|
|
265
|
+
that.treeData.unshift(map)
|
|
262
266
|
}
|
|
263
267
|
that.$nextTick(() => {
|
|
264
|
-
that.$forceUpdate()
|
|
265
|
-
})
|
|
268
|
+
that.$forceUpdate()
|
|
269
|
+
})
|
|
266
270
|
})
|
|
267
|
-
.catch(() => {})
|
|
271
|
+
.catch(() => {})
|
|
268
272
|
},
|
|
269
273
|
|
|
270
274
|
/**
|
|
@@ -273,20 +277,20 @@ export default {
|
|
|
273
277
|
*/
|
|
274
278
|
treeNodeClick(data) {
|
|
275
279
|
if (!this.showCheckbox) {
|
|
276
|
-
this.queryFlag = false
|
|
280
|
+
this.queryFlag = false
|
|
277
281
|
|
|
278
|
-
const k = this.defaultProps.label ||
|
|
282
|
+
const k = this.defaultProps.label || 'label'
|
|
279
283
|
|
|
280
|
-
this.filterText = data[k]
|
|
281
|
-
this.unitNameText = data[k]
|
|
282
|
-
this.placeholder = this.filterText
|
|
284
|
+
this.filterText = data[k]
|
|
285
|
+
this.unitNameText = data[k]
|
|
286
|
+
this.placeholder = this.filterText
|
|
283
287
|
|
|
284
|
-
this._value = data[this.nodeKey]
|
|
288
|
+
this._value = data[this.nodeKey]
|
|
285
289
|
|
|
286
290
|
// 主动让input框失去交单
|
|
287
|
-
this.$refs[this.inputRefName].blur()
|
|
288
|
-
this.showPopoverFlag = false
|
|
289
|
-
this.$emit(
|
|
291
|
+
this.$refs[this.inputRefName].blur()
|
|
292
|
+
this.showPopoverFlag = false
|
|
293
|
+
this.$emit('treeNodeClick', data)
|
|
290
294
|
}
|
|
291
295
|
},
|
|
292
296
|
|
|
@@ -295,28 +299,28 @@ export default {
|
|
|
295
299
|
* 回调参数: data, node, tree
|
|
296
300
|
*/
|
|
297
301
|
handleCheckChange(checkedNodes, checkedKeys) {
|
|
298
|
-
console.log(checkedNodes, checkedKeys)
|
|
302
|
+
console.log(checkedNodes, checkedKeys)
|
|
299
303
|
|
|
300
|
-
this.queryFlag = false
|
|
304
|
+
this.queryFlag = false
|
|
301
305
|
|
|
302
306
|
// const k = this.defaultProps.label || "label";
|
|
303
307
|
// this.filterText = checkedKeys[k];
|
|
304
|
-
let newText = []
|
|
305
|
-
checkedKeys[
|
|
306
|
-
checkedKeys[
|
|
308
|
+
let newText = []
|
|
309
|
+
checkedKeys['checkedNodes'].forEach((item) => {
|
|
310
|
+
checkedKeys['checkedKeys'].forEach((el) => {
|
|
307
311
|
if (item.unitNo === el) {
|
|
308
|
-
newText.push(item.unitName)
|
|
312
|
+
newText.push(item.unitName)
|
|
309
313
|
}
|
|
310
|
-
})
|
|
311
|
-
})
|
|
314
|
+
})
|
|
315
|
+
})
|
|
312
316
|
|
|
313
|
-
this.filterText = newText.toString()
|
|
317
|
+
this.filterText = newText.toString()
|
|
314
318
|
|
|
315
|
-
this.placeholder = this.filterText
|
|
319
|
+
this.placeholder = this.filterText
|
|
316
320
|
|
|
317
|
-
this._value = checkedKeys[
|
|
321
|
+
this._value = checkedKeys['checkedKeys']
|
|
318
322
|
|
|
319
|
-
this.$emit(
|
|
323
|
+
this.$emit('checkedClick', checkedKeys)
|
|
320
324
|
},
|
|
321
325
|
|
|
322
326
|
/**
|
|
@@ -324,18 +328,18 @@ export default {
|
|
|
324
328
|
*/
|
|
325
329
|
clearFilterText() {
|
|
326
330
|
if (!this.showCheckbox) {
|
|
327
|
-
this.filterText = this.placeholder
|
|
328
|
-
this.placeholder = null
|
|
329
|
-
this.showPopoverFlag = false
|
|
331
|
+
this.filterText = this.placeholder
|
|
332
|
+
this.placeholder = null
|
|
333
|
+
this.showPopoverFlag = false
|
|
330
334
|
this.$nextTick(() => {
|
|
331
|
-
this.$forceUpdate()
|
|
332
|
-
})
|
|
333
|
-
this.$emit(
|
|
335
|
+
this.$forceUpdate()
|
|
336
|
+
})
|
|
337
|
+
this.$emit('filterText', this.filterText)
|
|
334
338
|
console.log(
|
|
335
|
-
|
|
339
|
+
'TreeSelect关闭弹框...',
|
|
336
340
|
this.showPopoverFlag,
|
|
337
341
|
this.filterText
|
|
338
|
-
)
|
|
342
|
+
)
|
|
339
343
|
}
|
|
340
344
|
},
|
|
341
345
|
|
|
@@ -344,17 +348,17 @@ export default {
|
|
|
344
348
|
*/
|
|
345
349
|
inputFocus() {
|
|
346
350
|
if (!this.showCheckbox) {
|
|
347
|
-
this.timeTemp && clearTimeout(this.timeTemp)
|
|
348
|
-
this.windowEventFlag = false
|
|
349
|
-
this.placeholder = this.filterText
|
|
350
|
-
this.filterText =
|
|
351
|
-
this.queryFlag = true
|
|
352
|
-
console.log(
|
|
353
|
-
this.remoteMethod()
|
|
351
|
+
this.timeTemp && clearTimeout(this.timeTemp)
|
|
352
|
+
this.windowEventFlag = false
|
|
353
|
+
this.placeholder = this.filterText
|
|
354
|
+
this.filterText = ''
|
|
355
|
+
this.queryFlag = true
|
|
356
|
+
console.log('input focus...')
|
|
357
|
+
this.remoteMethod()
|
|
354
358
|
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
358
362
|
</script>
|
|
359
363
|
|
|
360
364
|
<style lang="scss">
|
|
@@ -5,51 +5,51 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import * as Export2Excel from
|
|
8
|
+
import * as Export2Excel from '../../../utils/vendor/Export2Excel'
|
|
9
9
|
export default {
|
|
10
|
-
name:
|
|
10
|
+
name: 'NstcExcelExport',
|
|
11
11
|
props: {
|
|
12
12
|
data: {
|
|
13
13
|
type: Object,
|
|
14
14
|
default: function () {
|
|
15
15
|
return {
|
|
16
|
-
childKey:
|
|
16
|
+
childKey: '', //指定childKey时,会更具childKey递归取数据
|
|
17
17
|
head: [], //表头数据,未指定childKey时,必须传字符串数组,指定childKey时,表头为对象数组,{key:'key',value:'value'},方便表格行取对应数据
|
|
18
18
|
data: [], //行数据,未指定childKey时,必须传与表头对应的字符串数组,指定childKey时,传与表头对应的对象数组
|
|
19
|
-
fileName:
|
|
20
|
-
}
|
|
21
|
-
}
|
|
19
|
+
fileName: '列表'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
22
|
},
|
|
23
23
|
// 导入执行动作
|
|
24
24
|
executeExportFlag: {
|
|
25
25
|
type: [Number, String],
|
|
26
26
|
default: () => {
|
|
27
|
-
return
|
|
28
|
-
}
|
|
27
|
+
return ''
|
|
28
|
+
}
|
|
29
29
|
},
|
|
30
30
|
// 单元格样式
|
|
31
31
|
cellStyle: {
|
|
32
32
|
type: Object,
|
|
33
33
|
default: () => {
|
|
34
|
-
return {}
|
|
35
|
-
}
|
|
34
|
+
return {}
|
|
35
|
+
}
|
|
36
36
|
},
|
|
37
37
|
merges: {
|
|
38
38
|
type: Array,
|
|
39
39
|
default: () => {
|
|
40
|
-
return []
|
|
41
|
-
}
|
|
42
|
-
}
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
43
|
},
|
|
44
44
|
watch: {
|
|
45
45
|
executeExportFlag(newValue) {
|
|
46
46
|
if (newValue) {
|
|
47
|
-
this.excelExportAction()
|
|
47
|
+
this.excelExportAction()
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
},
|
|
51
51
|
data() {
|
|
52
|
-
return {}
|
|
52
|
+
return {}
|
|
53
53
|
},
|
|
54
54
|
methods: {
|
|
55
55
|
/**
|
|
@@ -61,32 +61,32 @@ export default {
|
|
|
61
61
|
* @param childKey 子节点的key
|
|
62
62
|
*/
|
|
63
63
|
flatChild(item, dataTemp, level, str, childKey) {
|
|
64
|
-
let subStr =
|
|
64
|
+
let subStr = ''
|
|
65
65
|
for (var i = 0; i < level; i++) {
|
|
66
|
-
subStr += str
|
|
66
|
+
subStr += str
|
|
67
67
|
}
|
|
68
|
-
item[this.data.head[0].key] = subStr + item[this.data.head[0].key]
|
|
69
|
-
dataTemp.push(item)
|
|
70
|
-
level
|
|
68
|
+
item[this.data.head[0].key] = subStr + item[this.data.head[0].key]
|
|
69
|
+
dataTemp.push(item)
|
|
70
|
+
level++
|
|
71
71
|
// eslint-disable-next-line no-debugger
|
|
72
72
|
if (item[childKey] && item[childKey].length > 0) {
|
|
73
73
|
item[childKey].forEach((child) => {
|
|
74
|
-
this.flatChild(child, dataTemp, level, str, childKey)
|
|
75
|
-
})
|
|
74
|
+
this.flatChild(child, dataTemp, level, str, childKey)
|
|
75
|
+
})
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
/**
|
|
79
79
|
* 导出动作
|
|
80
80
|
*/
|
|
81
81
|
excelExportAction() {
|
|
82
|
-
this.excelDownloadLoading = true
|
|
83
|
-
let that = this
|
|
82
|
+
this.excelDownloadLoading = true
|
|
83
|
+
let that = this
|
|
84
84
|
if (this.data.head.length < 1 || this.data.data.length < 1) {
|
|
85
85
|
this.$message({
|
|
86
|
-
type:
|
|
87
|
-
message:
|
|
88
|
-
})
|
|
89
|
-
return
|
|
86
|
+
type: 'warning',
|
|
87
|
+
message: '表格数据不足!'
|
|
88
|
+
})
|
|
89
|
+
return
|
|
90
90
|
}
|
|
91
91
|
// console.log('Export2Excel', import('@/utils/vendor/Export2Excel'))
|
|
92
92
|
// import('@/utils/vendor/Export2Excel').then(excel => {
|
|
@@ -98,29 +98,29 @@ export default {
|
|
|
98
98
|
// })
|
|
99
99
|
// that.excelDownloadLoading = false
|
|
100
100
|
// })
|
|
101
|
-
let str =
|
|
102
|
-
let level = 0
|
|
103
|
-
let dataTemp = []
|
|
101
|
+
let str = ' ' //子节点添加的符号
|
|
102
|
+
let level = 0 //当前行的等级
|
|
103
|
+
let dataTemp = [] //暂存扁平化数据
|
|
104
104
|
if (this.data.childKey) {
|
|
105
105
|
this.data.data.forEach((item) => {
|
|
106
|
-
level = 0
|
|
107
|
-
this.flatChild(item, dataTemp, level, str, this.data.childKey)
|
|
108
|
-
})
|
|
106
|
+
level = 0
|
|
107
|
+
this.flatChild(item, dataTemp, level, str, this.data.childKey)
|
|
108
|
+
})
|
|
109
109
|
|
|
110
110
|
//扁平化数据转化为表数据
|
|
111
111
|
dataTemp = dataTemp.map((d) => {
|
|
112
|
-
let temp = []
|
|
112
|
+
let temp = []
|
|
113
113
|
this.data.head.forEach((h) => {
|
|
114
|
-
temp.push(d[h.key])
|
|
115
|
-
})
|
|
116
|
-
return temp
|
|
117
|
-
})
|
|
114
|
+
temp.push(d[h.key])
|
|
115
|
+
})
|
|
116
|
+
return temp
|
|
117
|
+
})
|
|
118
118
|
// eslint-disable-next-line no-debugger
|
|
119
119
|
// debugger;
|
|
120
120
|
|
|
121
121
|
//重置表数据为转化后的数据
|
|
122
|
-
this.data.head = this.data.head.map((item) => item.value)
|
|
123
|
-
this.data.data = dataTemp
|
|
122
|
+
this.data.head = this.data.head.map((item) => item.value)
|
|
123
|
+
this.data.data = dataTemp
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
Export2Excel.export_json_to_excel(
|
|
@@ -131,11 +131,11 @@ export default {
|
|
|
131
131
|
merges: this.merges
|
|
132
132
|
},
|
|
133
133
|
this.cellStyle
|
|
134
|
-
)
|
|
135
|
-
that.excelDownloadLoading = false
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
134
|
+
)
|
|
135
|
+
that.excelDownloadLoading = false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
139
|
</script>
|
|
140
140
|
|
|
141
141
|
<style lang="scss">
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
import NstcUploadExcel from '../NstcUploadExcel/NstcUploadExcel'
|
|
110
110
|
import NstcDialog from '../NstcDialog/NstcDialog'
|
|
111
111
|
import uploadImg from './img/upload@2x.png'
|
|
112
|
-
import axios from '
|
|
112
|
+
import axios from '../../../utils/axios';
|
|
113
113
|
export default {
|
|
114
114
|
name: 'NstcExcelImport',
|
|
115
115
|
components: {
|