n20-common-lib 1.3.28 → 1.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -55,8 +55,10 @@ export default {
|
|
|
55
55
|
pgsVal: 0,
|
|
56
56
|
status: undefined, //init progress success error
|
|
57
57
|
timer: undefined,
|
|
58
|
-
|
|
59
|
-
waitPopV: false
|
|
58
|
+
|
|
59
|
+
waitPopV: false,
|
|
60
|
+
waitTimer: undefined,
|
|
61
|
+
waitClass: ''
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
computed: {
|
|
@@ -70,13 +72,17 @@ export default {
|
|
|
70
72
|
},
|
|
71
73
|
methods: {
|
|
72
74
|
export() {
|
|
75
|
+
clearTimeout(this.timer)
|
|
76
|
+
clearTimeout(this.waitTimer)
|
|
77
|
+
|
|
73
78
|
this.pgsVal = 0
|
|
74
79
|
this.status = 'init'
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
this.pgsV = true
|
|
81
|
+
|
|
82
|
+
this.waitClass = 'ex-waitime-' + Date.now()
|
|
77
83
|
this.waitPopV = false
|
|
84
|
+
this.waitPop()
|
|
78
85
|
|
|
79
|
-
this.pgsV = true
|
|
80
86
|
this.exportReq()
|
|
81
87
|
},
|
|
82
88
|
// 导出请求
|
|
@@ -92,6 +98,7 @@ export default {
|
|
|
92
98
|
this.$emit('export-pgs', (pgs, error) => {
|
|
93
99
|
if (error) {
|
|
94
100
|
this.status = 'error'
|
|
101
|
+
this.closeWaitPop()
|
|
95
102
|
console.error('导出失败')
|
|
96
103
|
return
|
|
97
104
|
}
|
|
@@ -101,24 +108,22 @@ export default {
|
|
|
101
108
|
this.status = 'progress'
|
|
102
109
|
|
|
103
110
|
clearTimeout(this.timer)
|
|
104
|
-
this.timer = setTimeout(
|
|
105
|
-
this.elapsedTimeout = this.elapsedTimeout + this.stepTime
|
|
106
|
-
this.exportPgs()
|
|
107
|
-
}, this.stepTime)
|
|
111
|
+
this.timer = setTimeout(this.exportPgs, this.stepTime)
|
|
108
112
|
} else {
|
|
109
113
|
this.pgsVal = parseInt(pgs)
|
|
110
114
|
this.status = 'success'
|
|
111
115
|
|
|
112
116
|
this.exportRes()
|
|
113
117
|
}
|
|
114
|
-
this.waitPop()
|
|
115
118
|
})
|
|
116
119
|
},
|
|
117
120
|
// 导出响应
|
|
118
121
|
exportRes() {
|
|
119
122
|
this.$emit('export-res', (data, error) => {
|
|
123
|
+
clearTimeout(this.waitTimer)
|
|
120
124
|
if (error) {
|
|
121
125
|
this.status = 'error'
|
|
126
|
+
this.closeWaitPop()
|
|
122
127
|
console.error('导出失败')
|
|
123
128
|
return
|
|
124
129
|
}
|
|
@@ -126,12 +131,11 @@ export default {
|
|
|
126
131
|
this.status = 'success'
|
|
127
132
|
this.pgsVal = 100
|
|
128
133
|
|
|
134
|
+
this.closeWaitPop()
|
|
129
135
|
downloadBlob(data, this.fileName)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
-
confirmBtn && confirmBtn.click()
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
this.pgsV = false
|
|
138
|
+
}, 500)
|
|
135
139
|
})
|
|
136
140
|
},
|
|
137
141
|
// 导出取消
|
|
@@ -156,22 +160,31 @@ export default {
|
|
|
156
160
|
},
|
|
157
161
|
// 时间太长提示
|
|
158
162
|
waitPop() {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
clearTimeout(this.waitTimer)
|
|
164
|
+
this.waitTimer = setTimeout(() => {
|
|
165
|
+
if (!this.waitPopV) {
|
|
166
|
+
this.waitPopV = true
|
|
167
|
+
this.$msgboxPor({
|
|
168
|
+
title: '提示',
|
|
169
|
+
message: '您的数据导出时间可能会比较长,是否继续导出?',
|
|
170
|
+
type: 'warning',
|
|
171
|
+
customClass: `question ${this.waitClass}`,
|
|
172
|
+
confirmButtonText: '继续导出',
|
|
173
|
+
cancelButtonText: '取消'
|
|
174
|
+
}).catch(() => {
|
|
175
|
+
clearTimeout(this.timer)
|
|
176
|
+
this.pgsV = false
|
|
177
|
+
this.$emit('export-cancel')
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
}, this.waitTime)
|
|
181
|
+
},
|
|
182
|
+
closeWaitPop() {
|
|
183
|
+
clearTimeout(this.waitTimer)
|
|
184
|
+
let confirmBtn = document.querySelector(
|
|
185
|
+
`.${this.waitClass} .el-button--primary`
|
|
186
|
+
)
|
|
187
|
+
confirmBtn && confirmBtn.click()
|
|
175
188
|
}
|
|
176
189
|
}
|
|
177
190
|
}
|
|
@@ -167,7 +167,11 @@
|
|
|
167
167
|
:disabled="!row[keys.type]"
|
|
168
168
|
:accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
|
|
169
169
|
:size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
|
|
170
|
-
:http-request="
|
|
170
|
+
:http-request="
|
|
171
|
+
uploadHttpRequest
|
|
172
|
+
? (options) => uploadHttpRequest(options, row)
|
|
173
|
+
: undefined
|
|
174
|
+
"
|
|
171
175
|
:before-upload="(file) => beforeUploadFn(file, row)"
|
|
172
176
|
:on-progress="(event) => onProgressFn(event, row)"
|
|
173
177
|
:on-success="
|