shijiplus-web-plugin 0.1.13 → 0.1.14
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
|
@@ -8,7 +8,8 @@ export default {
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
methods: {
|
|
11
|
-
invokeExportExcel(searchForm, apiFunction) {
|
|
11
|
+
invokeExportExcel(searchForm, apiFunction, options = {}) {
|
|
12
|
+
const { exportDesc } = this.$merge({}, options)
|
|
12
13
|
const checkExportDataTotal = (searchForm) => {
|
|
13
14
|
return apiFunction({
|
|
14
15
|
...searchForm,
|
|
@@ -34,6 +35,8 @@ export default {
|
|
|
34
35
|
}).then((res) => {
|
|
35
36
|
if (res && res.data) {
|
|
36
37
|
exportData.push(...res.data)
|
|
38
|
+
} else {
|
|
39
|
+
throw Error('导出失败')
|
|
37
40
|
}
|
|
38
41
|
this.orderExportModalPercent = (exportData.length / (this.totalCount || 1) * 100).toFixed(2)
|
|
39
42
|
if (processUpdate) {
|
|
@@ -56,23 +59,77 @@ export default {
|
|
|
56
59
|
}, 0)
|
|
57
60
|
return
|
|
58
61
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
62
|
+
const processInstance = this.$getComponentInstance(PlusCircleProgressModal)
|
|
63
|
+
processInstance.$on('on-close', (e) => {
|
|
61
64
|
setTimeout(() => {
|
|
62
|
-
this.$removeVComp(
|
|
65
|
+
this.$removeVComp(processInstance)
|
|
63
66
|
}, 500)
|
|
64
67
|
})
|
|
65
|
-
|
|
68
|
+
processInstance.show({ exportDesc })
|
|
66
69
|
return excelExportFun(1, this.orderExportPageSize, (process) => {
|
|
67
|
-
|
|
70
|
+
processInstance.updatePercent(process)
|
|
68
71
|
}).catch(() => {
|
|
69
72
|
// 宏任务最后执行
|
|
70
73
|
setTimeout(() => {
|
|
71
74
|
this.$Message.error('导出失败', 3)
|
|
72
|
-
this.$removeVComp(
|
|
75
|
+
this.$removeVComp(processInstance)
|
|
73
76
|
}, 0)
|
|
74
77
|
})
|
|
75
78
|
})
|
|
79
|
+
},
|
|
80
|
+
exportAllData(searchForm, options = {}) {
|
|
81
|
+
let exportData = []
|
|
82
|
+
let totalCount = 0
|
|
83
|
+
const { apiFunction, exportDesc } = this.$merge({}, options)
|
|
84
|
+
const excelExportFun = (processUpdate) => {
|
|
85
|
+
return apiFunction({
|
|
86
|
+
...searchForm
|
|
87
|
+
}).then((res) => {
|
|
88
|
+
if (res && res.data) {
|
|
89
|
+
totalCount = res.data.length
|
|
90
|
+
exportData.push(...res.data)
|
|
91
|
+
} else {
|
|
92
|
+
throw Error('导出失败')
|
|
93
|
+
}
|
|
94
|
+
let orderExportModalPercent = (exportData.length / (totalCount || 1) * 100).toFixed(2)
|
|
95
|
+
if (processUpdate) {
|
|
96
|
+
processUpdate(orderExportModalPercent)
|
|
97
|
+
}
|
|
98
|
+
if (exportData.length < totalCount) {
|
|
99
|
+
return excelExportFun(processUpdate)
|
|
100
|
+
}
|
|
101
|
+
return exportData
|
|
102
|
+
}).catch((error) => {
|
|
103
|
+
console.log('--------error---------', error)
|
|
104
|
+
throw Error('导出失败')
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
excelExportFun((process) => {
|
|
109
|
+
console.log('-------excelExport-----process--------', process)
|
|
110
|
+
}).then(data => {
|
|
111
|
+
resolve(data)
|
|
112
|
+
}).catch(() => {
|
|
113
|
+
// 宏任务最后执行
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
this.$Message.error('导出失败', 3)
|
|
116
|
+
}, 0)
|
|
117
|
+
reject(new Error('导出失败'))
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
},
|
|
121
|
+
createProcessInstance() {
|
|
122
|
+
const processInstance = this.$getComponentInstance(PlusCircleProgressModal)
|
|
123
|
+
processInstance.$on('on-close', (e) => {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
this.$removeVComp(processInstance)
|
|
126
|
+
}, 500)
|
|
127
|
+
})
|
|
128
|
+
processInstance.show()
|
|
129
|
+
return processInstance
|
|
130
|
+
},
|
|
131
|
+
destroyProcessInstance(processInstance) {
|
|
132
|
+
processInstance.handlerClose()
|
|
76
133
|
}
|
|
77
134
|
}
|
|
78
135
|
}
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
|
-
<
|
|
27
|
+
<div ref="headerRef">
|
|
28
|
+
<slot name="header"></slot>
|
|
29
|
+
</div>
|
|
30
|
+
<slot name="table" :pageData="pageData" :height="height">
|
|
28
31
|
<Table
|
|
29
32
|
:style="tableStyle"
|
|
30
33
|
:columns="showColumns"
|
|
@@ -209,6 +212,9 @@ export default {
|
|
|
209
212
|
if (this.$refs.searchAreaRef) {
|
|
210
213
|
tHeight -= this.$refs.searchAreaRef.clientHeight
|
|
211
214
|
}
|
|
215
|
+
if (this.$refs.headerRef) {
|
|
216
|
+
tHeight -= this.$refs.headerRef.clientHeight
|
|
217
|
+
}
|
|
212
218
|
if (this.$refs.footerRef) {
|
|
213
219
|
tHeight -= this.$refs.footerRef.clientHeight
|
|
214
220
|
}
|