manage-client 3.2.70-aode → 3.2.71-aode
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/build/dev-server.js +193 -193
- package/build/webpack.base.conf.js +79 -79
- package/client.iml +14 -14
- package/package.json +1 -1
- package/src/Util.js +383 -383
- package/src/components/MeterManage/MeterList.vue +336 -336
- package/src/components/WebReport/UserGasAll.vue +214 -214
- package/src/components/sale/businessquery/ChangeMeterQuery.vue +667 -667
- package/src/components/sale/businessquery/ChargeQuery.vue +663 -663
- package/src/components/sale/businessquery/DeductionGas.vue +149 -149
- package/src/components/sale/businessquery/DisableQuery.vue +315 -315
- package/src/components/sale/businessquery/EnableQuery.vue +315 -315
- package/src/components/sale/businessquery/FillCardQuery.vue +436 -436
- package/src/components/sale/businessquery/FillGasQuery.vue +435 -435
- package/src/components/sale/businessquery/HandplanQuery.vue +705 -705
- package/src/components/sale/businessquery/InspectListGas.vue +456 -456
- package/src/components/sale/businessquery/NewAccountQuery.vue +506 -506
- package/src/components/sale/businessquery/OtherChargeQuery.vue +406 -406
- package/src/components/sale/businessquery/QueryUserState.vue +313 -313
- package/src/components/sale/businessquery/ReverseQuery.vue +347 -347
- package/src/components/sale/businessquery/TransferQuery.vue +363 -363
- package/src/components/sale/businessquery/toolCardMakeQuery.vue +340 -340
- package/src/components/sale/filesquery/DeviceQuery.vue +329 -329
- package/src/components/sale/filesquery/MeterQuery.vue +593 -593
- package/src/components/sale/filesquery/UserQuery.vue +556 -556
- package/src/components/sale/filesquery/filequerydetail/BlackListQueryDetail.vue +219 -219
- package/src/components/sale/filesquery/filequerydetail/DisableQueryDetail.vue +272 -272
- package/src/components/sale/filesquery/filequerydetail/EnableQueryDetail.vue +274 -274
- package/src/components/sale/ncpush/ncUserLoad.vue +176 -176
- package/src/components/sale/ncpush/ncpushmanage/NCpushList.vue +497 -497
- package/src/components/sale/ncpush/ncrecord/pushdaydatalist.vue +298 -298
- package/src/components/sale/ncpush/pushconfirmlist.vue +414 -414
- package/src/components/sale/ncpush/pushconfirmmergelist.vue +480 -480
- package/src/components/sale/report/aode/MonthByChargeType.vue +526 -526
- package/src/components/sale/report/aode/MonthByUserType.vue +562 -562
- package/src/components/sale/report/aode/YearByChargeTpye.vue +254 -254
- package/src/components/sale/report/aode/YearByUserType.vue +342 -342
- package/src/components/sale/report/aode/iot/FarawayQuery.vue +401 -401
- package/src/components/sale/report/aode/iot/ReportQuery.vue +387 -387
- package/src/components/sale/report/aode/userbuyQuery.vue +477 -477
- package/src/components/valueaddinfo/ValueAddinfoQuery.vue +425 -425
- package/src/components/valueaddinfo/renewalvalueAddUserQuery.vue +371 -371
- package/src/components/valueaddinfo/valueAddCountQuery.vue +315 -315
- package/src/components/valueaddinfo/valueAddUserQuery.vue +404 -404
- package/src/components/webmeter/ArreasuserQuery.vue +193 -193
- package/src/components/webmeter/DrillData/LostContactAnalysis.vue +531 -531
- package/src/components/webmeter/DrillData/LostContactAnalysisList.vue +548 -548
- package/src/components/webmeter/DrillData/NewUserGasAll.vue +568 -568
- package/src/components/webmeter/DrillData/UserLostContactAnalysis.vue +507 -507
- package/src/components/webmeter/EasyExcelExportCk.vue +396 -396
- package/src/components/webmeter/IOTArrears/arrears.vue +324 -324
- package/src/components/webmeter/IOTArrears/iotRechargeAudit.vue +377 -377
- package/src/components/webmeter/NewWebmeterHandplanQuery.vue +605 -605
- package/src/components/webmeter/WebmeterHandplanQuery.vue +640 -640
- package/src/components/webmeter/dataCollection/DataCollection.vue +630 -630
- package/src/components/webmeter/gasAnalysis/GasAnalysisManage.vue +303 -303
- package/src/components/webmeter/handplan/NewWebMeterHandPlan.vue +745 -745
- package/src/components/webmeter/newwebmeter/NewException/NewMeterException.vue +449 -449
- package/src/components/webmeter/newwebmeter/NewException/TotalExceptionByMeter.vue +492 -492
- package/src/components/webmeter/newwebmeter/ReportDataQuery.vue +283 -283
- package/src/components/webmeter/newwebmeter/UserGasList.vue +295 -295
- package/src/components/webmeter/newwebmeter/UserInstructList.vue +311 -311
- package/src/components/webmeter/newwebmeter/signAnalysisListMain.vue +386 -386
- package/src/components/webmeter/report/ReportList.vue +211 -211
- package/src/main.js +56 -56
|
@@ -1,396 +1,396 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button class="button_export button_spacing" @click='exportExcel()' :id="'vc-exportexcel-'+attach">{{ btnName }}
|
|
3
|
-
</button>
|
|
4
|
-
<modal :show.sync="show" v-ref:modal backdrop="false">
|
|
5
|
-
<header slot="modal-header" class="modal-header text-center">
|
|
6
|
-
<h4 class="modal-title">导出列选择</h4>
|
|
7
|
-
<input type="checkbox" class="" id="f_operator" v-model="all">
|
|
8
|
-
<label for="f_operator" class="font-size">全选</label>
|
|
9
|
-
</header>
|
|
10
|
-
<article slot="modal-body">
|
|
11
|
-
<div class="auto col-sm-11 col-md-offset-1" style="margin-top: 10px;">
|
|
12
|
-
<div class="col-sm-4" v-for="f in fields">
|
|
13
|
-
<input type="checkbox" class="" :id="'export-col-'+$index" v-model="modelval" :value="$key">
|
|
14
|
-
<label :for="'export-col-'+$index" class="font-size">{{ f }}</label>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</article>
|
|
18
|
-
<footer slot="modal-footer" class="modal-footer">
|
|
19
|
-
<center>
|
|
20
|
-
<button v-show="show" type="button" class="btn btn-default" @click='close()'>取消</button>
|
|
21
|
-
<button v-show="show" type="button" class="btn btn-success" @click='export()'>导出</button>
|
|
22
|
-
</center>
|
|
23
|
-
</footer>
|
|
24
|
-
</modal>
|
|
25
|
-
<modal :show.sync="exportShow" v-ref:modal backdrop="false">
|
|
26
|
-
<header slot="modal-header" class="modal-header text-center">
|
|
27
|
-
<h4 class="modal-title">导出文件下载</h4>
|
|
28
|
-
</header>
|
|
29
|
-
<article slot="modal-body" style="height:70px;">
|
|
30
|
-
<div class="auto col-sm-12" style="margin-top: 10px;">
|
|
31
|
-
<center>
|
|
32
|
-
<p v-show="!downbutton">文件正在导出..</p>
|
|
33
|
-
<button v-show="downbutton" type="button" class="btn btn-default" @click='downFile()'>下载导出文件</button>
|
|
34
|
-
</center>
|
|
35
|
-
|
|
36
|
-
</div>
|
|
37
|
-
</article>
|
|
38
|
-
<footer slot="modal-footer" class="modal-footer">
|
|
39
|
-
<button type="button" class="btn btn-default" @click='closeRequeset()'>取消</button>
|
|
40
|
-
</footer>
|
|
41
|
-
</modal>
|
|
42
|
-
<modal :show.sync="progressShow" v-ref:modal width="50%" style="width:auto;" backdrop="false">
|
|
43
|
-
<header slot="modal-header" class="modal-header">
|
|
44
|
-
导出文件下载
|
|
45
|
-
</header>
|
|
46
|
-
<article slot="modal-body" class="modal-body">
|
|
47
|
-
<div class="progress" style="margin: 20px">
|
|
48
|
-
<div class="progress-bar progress-bar-success progress-bar-striped active" :style="{width: percent+'%'}">
|
|
49
|
-
{{ percent }}%
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div style="width:100%;display: flex">
|
|
53
|
-
<p style="text-align: center;width: 100%;" v-show="!downbutton">文件正在导出..</p>
|
|
54
|
-
<button v-show="downbutton" style="margin: 0 auto" type="button" class="btn btn-default" @click='downFile()'>
|
|
55
|
-
下载导出文件
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
58
|
-
</article>
|
|
59
|
-
<footer slot="modal-footer" class="modal-footer">
|
|
60
|
-
<button type="button" class="btn btn-default" @click='closeRequeset'>关闭</button>
|
|
61
|
-
</footer>
|
|
62
|
-
</modal>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<script>
|
|
66
|
-
import co from 'co'
|
|
67
|
-
|
|
68
|
-
let postGen = function* (self) {
|
|
69
|
-
|
|
70
|
-
let p = {}
|
|
71
|
-
self.getuuid();
|
|
72
|
-
if (self.uuida == '') return;
|
|
73
|
-
// 判断如果有field,说明表头为自动生成,否则为模板导出
|
|
74
|
-
if (self.exporthead) {
|
|
75
|
-
if (self.sqlName) {
|
|
76
|
-
p = self.$resetpost(self.sqlurl, {
|
|
77
|
-
data: {
|
|
78
|
-
uuid: self.uuida,
|
|
79
|
-
body: {
|
|
80
|
-
header: self.header,
|
|
81
|
-
footer: self.footer,
|
|
82
|
-
sumName: self.sumname,
|
|
83
|
-
data: self.data,
|
|
84
|
-
field: self.exporthead,
|
|
85
|
-
templateName: self.templateName,
|
|
86
|
-
sqlName: self.sqlName,
|
|
87
|
-
uuid: self.uuida
|
|
88
|
-
},
|
|
89
|
-
bean: self.bean
|
|
90
|
-
}
|
|
91
|
-
}, {resolveMsg: null, rejectMsg: null}, 1000)
|
|
92
|
-
} else if (self.pathName) {
|
|
93
|
-
p = self.$resetpost(self.sqlurl, {
|
|
94
|
-
data: {
|
|
95
|
-
uuid: self.uuida,
|
|
96
|
-
body: {
|
|
97
|
-
sumName: self.sumname,
|
|
98
|
-
data: self.data,
|
|
99
|
-
field: self.exporthead,
|
|
100
|
-
templateName: self.templateName,
|
|
101
|
-
pathName: self.pathName,
|
|
102
|
-
},
|
|
103
|
-
bean: self.bean
|
|
104
|
-
}
|
|
105
|
-
}, {resolveMsg: null, rejectMsg: null}, 0)
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
p = self.$resetpost(self.sqlurl, {
|
|
109
|
-
data: {
|
|
110
|
-
uuid: self.uuida,
|
|
111
|
-
body: {sumName: self.sumname, data: self.data, total: self.total},
|
|
112
|
-
bean: self.bean
|
|
113
|
-
}
|
|
114
|
-
}, {resolveMsg: null, rejectMsg: null}, 1000)
|
|
115
|
-
}
|
|
116
|
-
if (self.exportprogress) {
|
|
117
|
-
self.progressShow = true;
|
|
118
|
-
} else {
|
|
119
|
-
self.exportShow = true;
|
|
120
|
-
}
|
|
121
|
-
self.percent = 0;
|
|
122
|
-
self.getRequestReturn();
|
|
123
|
-
//var link = document.createElement('a');
|
|
124
|
-
//p.data.forEach((item) => {
|
|
125
|
-
// console.log('导出路径', item.filename)
|
|
126
|
-
// // let path = item.filename.substring(item.filename.indexOf('webapps'), (item.filename.length))
|
|
127
|
-
// // let pathName = path.substring(path.indexOf('/') + 1, path.length)
|
|
128
|
-
// let path = item.filename
|
|
129
|
-
// //webapps这个是在服务器上导出用的
|
|
130
|
-
// let pathName = "http://" + location.host + "/webapps" + path.split('webapps')[1]
|
|
131
|
-
// //excel这个是在本地导出用的
|
|
132
|
-
// // let pathName = "http://" + location.host + "/excel" + path.split('excel')[1]
|
|
133
|
-
// link.href = pathName;
|
|
134
|
-
//link.download = path.split('excel/')[1];
|
|
135
|
-
//link.dispatchEvent(new MouseEvent('click'));
|
|
136
|
-
//})
|
|
137
|
-
//self.modelval = []
|
|
138
|
-
//self.fields = {}
|
|
139
|
-
//self.exporthead = []
|
|
140
|
-
}
|
|
141
|
-
export default {
|
|
142
|
-
// data:sql需要的替换字段
|
|
143
|
-
// sqlurl:导出Excel查询的sql语句
|
|
144
|
-
// field:需要导出Excel的字段名和对应中文名或hbm配置文件名(全名)
|
|
145
|
-
// total:统计字段(统计行)
|
|
146
|
-
// props: ['data', 'sqlurl', 'field', 'total', 'bean', 'chooseCol','sumName'],
|
|
147
|
-
data() {
|
|
148
|
-
return {
|
|
149
|
-
show: false,
|
|
150
|
-
all: false,
|
|
151
|
-
fields: {},
|
|
152
|
-
modelval: [],
|
|
153
|
-
// 表头
|
|
154
|
-
exporthead: [],
|
|
155
|
-
selftotal: [],
|
|
156
|
-
exportShow: false,
|
|
157
|
-
resultData: '',
|
|
158
|
-
downbutton: false,
|
|
159
|
-
uuida: '',
|
|
160
|
-
timer: '',
|
|
161
|
-
uuida: '',
|
|
162
|
-
percent: 0,
|
|
163
|
-
progressShow: false,
|
|
164
|
-
// sumName:[]
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
props: {
|
|
168
|
-
// 表头
|
|
169
|
-
header: {},
|
|
170
|
-
// 表尾
|
|
171
|
-
footer: {},
|
|
172
|
-
sumname: {},
|
|
173
|
-
data: {},
|
|
174
|
-
sqlurl: {
|
|
175
|
-
type: String
|
|
176
|
-
},
|
|
177
|
-
field: {},
|
|
178
|
-
total: {},
|
|
179
|
-
bean: {
|
|
180
|
-
type: String
|
|
181
|
-
},
|
|
182
|
-
btnName: {
|
|
183
|
-
type: String,
|
|
184
|
-
default: '导出Excel'
|
|
185
|
-
},
|
|
186
|
-
templateName: {
|
|
187
|
-
type: String
|
|
188
|
-
},
|
|
189
|
-
sqlName: {
|
|
190
|
-
type: String
|
|
191
|
-
},
|
|
192
|
-
pathName: {
|
|
193
|
-
type: String
|
|
194
|
-
},
|
|
195
|
-
attach: {
|
|
196
|
-
type: String,
|
|
197
|
-
default: 'name'
|
|
198
|
-
},
|
|
199
|
-
chooseCol: {
|
|
200
|
-
type: Boolean,
|
|
201
|
-
default: false
|
|
202
|
-
},
|
|
203
|
-
defaultselect: [],
|
|
204
|
-
exportprogress: {
|
|
205
|
-
type: Boolean,
|
|
206
|
-
default: false
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
methods: {
|
|
210
|
-
progressclose() {
|
|
211
|
-
if (this.timer != null) {
|
|
212
|
-
clearInterval(this.timer);
|
|
213
|
-
}
|
|
214
|
-
this.progressShow = false;
|
|
215
|
-
this.percent = 0;
|
|
216
|
-
},
|
|
217
|
-
closeRequeset() {
|
|
218
|
-
if (this.timer != null) {
|
|
219
|
-
clearInterval(this.timer);
|
|
220
|
-
}
|
|
221
|
-
this.progressclose();
|
|
222
|
-
this.percent = 0;
|
|
223
|
-
this.exportShow = false;
|
|
224
|
-
this.uuida = '';
|
|
225
|
-
this.downbutton = false;
|
|
226
|
-
this.resultData = '';
|
|
227
|
-
},
|
|
228
|
-
async getRequestReturn() {
|
|
229
|
-
let timer = null;
|
|
230
|
-
let self = this;
|
|
231
|
-
let param = {
|
|
232
|
-
uuid: this.uuida
|
|
233
|
-
};
|
|
234
|
-
this.timer = setInterval(function () {
|
|
235
|
-
self.$resetpost('/rs/ckh/easyexcel/getBatchOperaPro', {data: param}, {
|
|
236
|
-
resolveMsg: null,
|
|
237
|
-
rejectMsg: null
|
|
238
|
-
}, 0).then((res) => {
|
|
239
|
-
if (res.data && res.data.percent) {
|
|
240
|
-
if (res.data.percent == 100) {
|
|
241
|
-
clearInterval(self.timer);
|
|
242
|
-
self.percent = 99;
|
|
243
|
-
setTimeout(function () {
|
|
244
|
-
self.percent = 100
|
|
245
|
-
self.resultData =res.data.exportpath;
|
|
246
|
-
self.downbutton = true
|
|
247
|
-
}, 500);
|
|
248
|
-
} else {
|
|
249
|
-
self.percent = res.data.percent
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}, 2000);
|
|
255
|
-
},
|
|
256
|
-
getuuid() {
|
|
257
|
-
let uuidA = '';
|
|
258
|
-
var s = [];
|
|
259
|
-
var hexDigits = '0123456789abcdef';
|
|
260
|
-
for (var i = 0; i < 36; i++) {
|
|
261
|
-
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
262
|
-
}
|
|
263
|
-
s[14] = '4';
|
|
264
|
-
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
265
|
-
s[8] = s[13] = s[18] = s[23] = '-';
|
|
266
|
-
uuidA = s.join('');
|
|
267
|
-
this.uuida = uuidA;
|
|
268
|
-
},
|
|
269
|
-
exportExcel() {
|
|
270
|
-
console.log('选择列,。。', this.chooseCol, this.field)
|
|
271
|
-
if (this.field) {
|
|
272
|
-
if (this.chooseCol === true) {
|
|
273
|
-
this.fields = this.field
|
|
274
|
-
this.show = true;
|
|
275
|
-
if (this.defaultselect != null && this.defaultselect.length > 0) {
|
|
276
|
-
for (var item in this.field) {
|
|
277
|
-
this.modelval.push(item)
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
this.data.items = '*'
|
|
282
|
-
Object.keys(this.field).forEach((key) => {
|
|
283
|
-
this.exporthead.push(key + ':' + this.field[key])
|
|
284
|
-
})
|
|
285
|
-
this.post()
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
this.post()
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
downFile() {
|
|
293
|
-
// console.log('导出')
|
|
294
|
-
// let data = {
|
|
295
|
-
// body: {
|
|
296
|
-
// field: this.exporthead,
|
|
297
|
-
// uuid: this.uuida,
|
|
298
|
-
// sqlName: this.sqlName,
|
|
299
|
-
// data:this.data,
|
|
300
|
-
// templateName:this.templateName,
|
|
301
|
-
// isExport: true
|
|
302
|
-
// },
|
|
303
|
-
// uuid: this.uuida,
|
|
304
|
-
// }
|
|
305
|
-
// axios.post("/rs/easyexcel/export", {data:data}, { responseType: "blob" }).then(res => {
|
|
306
|
-
// const link = document.createElement("a");
|
|
307
|
-
// let blob = new Blob([res.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
308
|
-
// link.style.display = "none";
|
|
309
|
-
// link.href = URL.createObjectURL(blob);
|
|
310
|
-
// link.setAttribute("download", decodeURI(data.body.templateName+'.xlsx'));
|
|
311
|
-
// document.body.appendChild(link);
|
|
312
|
-
// link.click();
|
|
313
|
-
// document.body.removeChild(link);
|
|
314
|
-
// console.log(res);
|
|
315
|
-
// })
|
|
316
|
-
var link = document.createElement('a');
|
|
317
|
-
console.log('导出路径',this.resultData)
|
|
318
|
-
// let path = item.filename.substring(item.filename.indexOf('webapps'), (item.filename.length))
|
|
319
|
-
// let pathName = path.substring(path.indexOf('/') + 1, path.length)
|
|
320
|
-
let path = this.resultData;
|
|
321
|
-
//webapps这个是在服务器上导出用的
|
|
322
|
-
let pathName = "http://" + location.host + "/webapps" + path.split('webapps')[1];
|
|
323
|
-
console.log('服务器导出路径',pathName)
|
|
324
|
-
link.href = pathName;
|
|
325
|
-
link.download = path.split('excel/')[1];
|
|
326
|
-
link.dispatchEvent(new MouseEvent('click'));
|
|
327
|
-
},
|
|
328
|
-
export() {
|
|
329
|
-
// 获取导出选择的表头和列
|
|
330
|
-
let temp = ''
|
|
331
|
-
this.modelval.forEach((item) => {
|
|
332
|
-
temp = temp + item + ','
|
|
333
|
-
this.exporthead.push(item + ':' + this.field[item])
|
|
334
|
-
//this.exporthead[item] = this.field[item]
|
|
335
|
-
})
|
|
336
|
-
temp = temp.slice(0, temp.length - 1)
|
|
337
|
-
console.log('表头,,,,', this.exporthead)
|
|
338
|
-
this.data.items = temp
|
|
339
|
-
this.post()
|
|
340
|
-
this.show = false
|
|
341
|
-
},
|
|
342
|
-
post() {
|
|
343
|
-
// if(this.total) {
|
|
344
|
-
//
|
|
345
|
-
// var temp={"合计":"合计"}
|
|
346
|
-
// for (var a in this.field) {
|
|
347
|
-
// for (var b in this.total) {
|
|
348
|
-
// if(a==b){
|
|
349
|
-
// temp[a]=this.total[a]
|
|
350
|
-
// }
|
|
351
|
-
// }
|
|
352
|
-
// }
|
|
353
|
-
// this.selftotal.push(temp)
|
|
354
|
-
// console.log("========================")
|
|
355
|
-
// console.log(temp)
|
|
356
|
-
//
|
|
357
|
-
// // this.selftotal.push(this.total)
|
|
358
|
-
// // this.selftotal[0].a="合计"
|
|
359
|
-
// }
|
|
360
|
-
let gen = postGen(this)
|
|
361
|
-
co(gen)
|
|
362
|
-
},
|
|
363
|
-
stamp() {
|
|
364
|
-
this.modelval = []
|
|
365
|
-
this.show = true
|
|
366
|
-
},
|
|
367
|
-
sortModelval() {
|
|
368
|
-
let sortModel = []
|
|
369
|
-
Object.keys(this.fields).forEach((key) => {
|
|
370
|
-
if (this.modelval.includes(key)) {
|
|
371
|
-
sortModel.push(key)
|
|
372
|
-
}
|
|
373
|
-
})
|
|
374
|
-
console.log('看看选择的顺序。。。', sortModel)
|
|
375
|
-
this.modelval = sortModel
|
|
376
|
-
},
|
|
377
|
-
close() {
|
|
378
|
-
this.all = false
|
|
379
|
-
this.modelval = []
|
|
380
|
-
this.show = false
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
watch: {
|
|
384
|
-
'all'(val) {
|
|
385
|
-
if (val) {
|
|
386
|
-
this.modelval = Object.keys(this.fields)
|
|
387
|
-
} else {
|
|
388
|
-
this.modelval = []
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
'modelval.length'() {
|
|
392
|
-
this.sortModelval()
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<button class="button_export button_spacing" @click='exportExcel()' :id="'vc-exportexcel-'+attach">{{ btnName }}
|
|
3
|
+
</button>
|
|
4
|
+
<modal :show.sync="show" v-ref:modal backdrop="false">
|
|
5
|
+
<header slot="modal-header" class="modal-header text-center">
|
|
6
|
+
<h4 class="modal-title">导出列选择</h4>
|
|
7
|
+
<input type="checkbox" class="" id="f_operator" v-model="all">
|
|
8
|
+
<label for="f_operator" class="font-size">全选</label>
|
|
9
|
+
</header>
|
|
10
|
+
<article slot="modal-body">
|
|
11
|
+
<div class="auto col-sm-11 col-md-offset-1" style="margin-top: 10px;">
|
|
12
|
+
<div class="col-sm-4" v-for="f in fields">
|
|
13
|
+
<input type="checkbox" class="" :id="'export-col-'+$index" v-model="modelval" :value="$key">
|
|
14
|
+
<label :for="'export-col-'+$index" class="font-size">{{ f }}</label>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</article>
|
|
18
|
+
<footer slot="modal-footer" class="modal-footer">
|
|
19
|
+
<center>
|
|
20
|
+
<button v-show="show" type="button" class="btn btn-default" @click='close()'>取消</button>
|
|
21
|
+
<button v-show="show" type="button" class="btn btn-success" @click='export()'>导出</button>
|
|
22
|
+
</center>
|
|
23
|
+
</footer>
|
|
24
|
+
</modal>
|
|
25
|
+
<modal :show.sync="exportShow" v-ref:modal backdrop="false">
|
|
26
|
+
<header slot="modal-header" class="modal-header text-center">
|
|
27
|
+
<h4 class="modal-title">导出文件下载</h4>
|
|
28
|
+
</header>
|
|
29
|
+
<article slot="modal-body" style="height:70px;">
|
|
30
|
+
<div class="auto col-sm-12" style="margin-top: 10px;">
|
|
31
|
+
<center>
|
|
32
|
+
<p v-show="!downbutton">文件正在导出..</p>
|
|
33
|
+
<button v-show="downbutton" type="button" class="btn btn-default" @click='downFile()'>下载导出文件</button>
|
|
34
|
+
</center>
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
</article>
|
|
38
|
+
<footer slot="modal-footer" class="modal-footer">
|
|
39
|
+
<button type="button" class="btn btn-default" @click='closeRequeset()'>取消</button>
|
|
40
|
+
</footer>
|
|
41
|
+
</modal>
|
|
42
|
+
<modal :show.sync="progressShow" v-ref:modal width="50%" style="width:auto;" backdrop="false">
|
|
43
|
+
<header slot="modal-header" class="modal-header">
|
|
44
|
+
导出文件下载
|
|
45
|
+
</header>
|
|
46
|
+
<article slot="modal-body" class="modal-body">
|
|
47
|
+
<div class="progress" style="margin: 20px">
|
|
48
|
+
<div class="progress-bar progress-bar-success progress-bar-striped active" :style="{width: percent+'%'}">
|
|
49
|
+
{{ percent }}%
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div style="width:100%;display: flex">
|
|
53
|
+
<p style="text-align: center;width: 100%;" v-show="!downbutton">文件正在导出..</p>
|
|
54
|
+
<button v-show="downbutton" style="margin: 0 auto" type="button" class="btn btn-default" @click='downFile()'>
|
|
55
|
+
下载导出文件
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</article>
|
|
59
|
+
<footer slot="modal-footer" class="modal-footer">
|
|
60
|
+
<button type="button" class="btn btn-default" @click='closeRequeset'>关闭</button>
|
|
61
|
+
</footer>
|
|
62
|
+
</modal>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import co from 'co'
|
|
67
|
+
|
|
68
|
+
let postGen = function* (self) {
|
|
69
|
+
|
|
70
|
+
let p = {}
|
|
71
|
+
self.getuuid();
|
|
72
|
+
if (self.uuida == '') return;
|
|
73
|
+
// 判断如果有field,说明表头为自动生成,否则为模板导出
|
|
74
|
+
if (self.exporthead) {
|
|
75
|
+
if (self.sqlName) {
|
|
76
|
+
p = self.$resetpost(self.sqlurl, {
|
|
77
|
+
data: {
|
|
78
|
+
uuid: self.uuida,
|
|
79
|
+
body: {
|
|
80
|
+
header: self.header,
|
|
81
|
+
footer: self.footer,
|
|
82
|
+
sumName: self.sumname,
|
|
83
|
+
data: self.data,
|
|
84
|
+
field: self.exporthead,
|
|
85
|
+
templateName: self.templateName,
|
|
86
|
+
sqlName: self.sqlName,
|
|
87
|
+
uuid: self.uuida
|
|
88
|
+
},
|
|
89
|
+
bean: self.bean
|
|
90
|
+
}
|
|
91
|
+
}, {resolveMsg: null, rejectMsg: null}, 1000)
|
|
92
|
+
} else if (self.pathName) {
|
|
93
|
+
p = self.$resetpost(self.sqlurl, {
|
|
94
|
+
data: {
|
|
95
|
+
uuid: self.uuida,
|
|
96
|
+
body: {
|
|
97
|
+
sumName: self.sumname,
|
|
98
|
+
data: self.data,
|
|
99
|
+
field: self.exporthead,
|
|
100
|
+
templateName: self.templateName,
|
|
101
|
+
pathName: self.pathName,
|
|
102
|
+
},
|
|
103
|
+
bean: self.bean
|
|
104
|
+
}
|
|
105
|
+
}, {resolveMsg: null, rejectMsg: null}, 0)
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
p = self.$resetpost(self.sqlurl, {
|
|
109
|
+
data: {
|
|
110
|
+
uuid: self.uuida,
|
|
111
|
+
body: {sumName: self.sumname, data: self.data, total: self.total},
|
|
112
|
+
bean: self.bean
|
|
113
|
+
}
|
|
114
|
+
}, {resolveMsg: null, rejectMsg: null}, 1000)
|
|
115
|
+
}
|
|
116
|
+
if (self.exportprogress) {
|
|
117
|
+
self.progressShow = true;
|
|
118
|
+
} else {
|
|
119
|
+
self.exportShow = true;
|
|
120
|
+
}
|
|
121
|
+
self.percent = 0;
|
|
122
|
+
self.getRequestReturn();
|
|
123
|
+
//var link = document.createElement('a');
|
|
124
|
+
//p.data.forEach((item) => {
|
|
125
|
+
// console.log('导出路径', item.filename)
|
|
126
|
+
// // let path = item.filename.substring(item.filename.indexOf('webapps'), (item.filename.length))
|
|
127
|
+
// // let pathName = path.substring(path.indexOf('/') + 1, path.length)
|
|
128
|
+
// let path = item.filename
|
|
129
|
+
// //webapps这个是在服务器上导出用的
|
|
130
|
+
// let pathName = "http://" + location.host + "/webapps" + path.split('webapps')[1]
|
|
131
|
+
// //excel这个是在本地导出用的
|
|
132
|
+
// // let pathName = "http://" + location.host + "/excel" + path.split('excel')[1]
|
|
133
|
+
// link.href = pathName;
|
|
134
|
+
//link.download = path.split('excel/')[1];
|
|
135
|
+
//link.dispatchEvent(new MouseEvent('click'));
|
|
136
|
+
//})
|
|
137
|
+
//self.modelval = []
|
|
138
|
+
//self.fields = {}
|
|
139
|
+
//self.exporthead = []
|
|
140
|
+
}
|
|
141
|
+
export default {
|
|
142
|
+
// data:sql需要的替换字段
|
|
143
|
+
// sqlurl:导出Excel查询的sql语句
|
|
144
|
+
// field:需要导出Excel的字段名和对应中文名或hbm配置文件名(全名)
|
|
145
|
+
// total:统计字段(统计行)
|
|
146
|
+
// props: ['data', 'sqlurl', 'field', 'total', 'bean', 'chooseCol','sumName'],
|
|
147
|
+
data() {
|
|
148
|
+
return {
|
|
149
|
+
show: false,
|
|
150
|
+
all: false,
|
|
151
|
+
fields: {},
|
|
152
|
+
modelval: [],
|
|
153
|
+
// 表头
|
|
154
|
+
exporthead: [],
|
|
155
|
+
selftotal: [],
|
|
156
|
+
exportShow: false,
|
|
157
|
+
resultData: '',
|
|
158
|
+
downbutton: false,
|
|
159
|
+
uuida: '',
|
|
160
|
+
timer: '',
|
|
161
|
+
uuida: '',
|
|
162
|
+
percent: 0,
|
|
163
|
+
progressShow: false,
|
|
164
|
+
// sumName:[]
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
props: {
|
|
168
|
+
// 表头
|
|
169
|
+
header: {},
|
|
170
|
+
// 表尾
|
|
171
|
+
footer: {},
|
|
172
|
+
sumname: {},
|
|
173
|
+
data: {},
|
|
174
|
+
sqlurl: {
|
|
175
|
+
type: String
|
|
176
|
+
},
|
|
177
|
+
field: {},
|
|
178
|
+
total: {},
|
|
179
|
+
bean: {
|
|
180
|
+
type: String
|
|
181
|
+
},
|
|
182
|
+
btnName: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: '导出Excel'
|
|
185
|
+
},
|
|
186
|
+
templateName: {
|
|
187
|
+
type: String
|
|
188
|
+
},
|
|
189
|
+
sqlName: {
|
|
190
|
+
type: String
|
|
191
|
+
},
|
|
192
|
+
pathName: {
|
|
193
|
+
type: String
|
|
194
|
+
},
|
|
195
|
+
attach: {
|
|
196
|
+
type: String,
|
|
197
|
+
default: 'name'
|
|
198
|
+
},
|
|
199
|
+
chooseCol: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: false
|
|
202
|
+
},
|
|
203
|
+
defaultselect: [],
|
|
204
|
+
exportprogress: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
methods: {
|
|
210
|
+
progressclose() {
|
|
211
|
+
if (this.timer != null) {
|
|
212
|
+
clearInterval(this.timer);
|
|
213
|
+
}
|
|
214
|
+
this.progressShow = false;
|
|
215
|
+
this.percent = 0;
|
|
216
|
+
},
|
|
217
|
+
closeRequeset() {
|
|
218
|
+
if (this.timer != null) {
|
|
219
|
+
clearInterval(this.timer);
|
|
220
|
+
}
|
|
221
|
+
this.progressclose();
|
|
222
|
+
this.percent = 0;
|
|
223
|
+
this.exportShow = false;
|
|
224
|
+
this.uuida = '';
|
|
225
|
+
this.downbutton = false;
|
|
226
|
+
this.resultData = '';
|
|
227
|
+
},
|
|
228
|
+
async getRequestReturn() {
|
|
229
|
+
let timer = null;
|
|
230
|
+
let self = this;
|
|
231
|
+
let param = {
|
|
232
|
+
uuid: this.uuida
|
|
233
|
+
};
|
|
234
|
+
this.timer = setInterval(function () {
|
|
235
|
+
self.$resetpost('/rs/ckh/easyexcel/getBatchOperaPro', {data: param}, {
|
|
236
|
+
resolveMsg: null,
|
|
237
|
+
rejectMsg: null
|
|
238
|
+
}, 0).then((res) => {
|
|
239
|
+
if (res.data && res.data.percent) {
|
|
240
|
+
if (res.data.percent == 100) {
|
|
241
|
+
clearInterval(self.timer);
|
|
242
|
+
self.percent = 99;
|
|
243
|
+
setTimeout(function () {
|
|
244
|
+
self.percent = 100
|
|
245
|
+
self.resultData =res.data.exportpath;
|
|
246
|
+
self.downbutton = true
|
|
247
|
+
}, 500);
|
|
248
|
+
} else {
|
|
249
|
+
self.percent = res.data.percent
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}, 2000);
|
|
255
|
+
},
|
|
256
|
+
getuuid() {
|
|
257
|
+
let uuidA = '';
|
|
258
|
+
var s = [];
|
|
259
|
+
var hexDigits = '0123456789abcdef';
|
|
260
|
+
for (var i = 0; i < 36; i++) {
|
|
261
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
262
|
+
}
|
|
263
|
+
s[14] = '4';
|
|
264
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
265
|
+
s[8] = s[13] = s[18] = s[23] = '-';
|
|
266
|
+
uuidA = s.join('');
|
|
267
|
+
this.uuida = uuidA;
|
|
268
|
+
},
|
|
269
|
+
exportExcel() {
|
|
270
|
+
console.log('选择列,。。', this.chooseCol, this.field)
|
|
271
|
+
if (this.field) {
|
|
272
|
+
if (this.chooseCol === true) {
|
|
273
|
+
this.fields = this.field
|
|
274
|
+
this.show = true;
|
|
275
|
+
if (this.defaultselect != null && this.defaultselect.length > 0) {
|
|
276
|
+
for (var item in this.field) {
|
|
277
|
+
this.modelval.push(item)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
this.data.items = '*'
|
|
282
|
+
Object.keys(this.field).forEach((key) => {
|
|
283
|
+
this.exporthead.push(key + ':' + this.field[key])
|
|
284
|
+
})
|
|
285
|
+
this.post()
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
this.post()
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
},
|
|
292
|
+
downFile() {
|
|
293
|
+
// console.log('导出')
|
|
294
|
+
// let data = {
|
|
295
|
+
// body: {
|
|
296
|
+
// field: this.exporthead,
|
|
297
|
+
// uuid: this.uuida,
|
|
298
|
+
// sqlName: this.sqlName,
|
|
299
|
+
// data:this.data,
|
|
300
|
+
// templateName:this.templateName,
|
|
301
|
+
// isExport: true
|
|
302
|
+
// },
|
|
303
|
+
// uuid: this.uuida,
|
|
304
|
+
// }
|
|
305
|
+
// axios.post("/rs/easyexcel/export", {data:data}, { responseType: "blob" }).then(res => {
|
|
306
|
+
// const link = document.createElement("a");
|
|
307
|
+
// let blob = new Blob([res.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
308
|
+
// link.style.display = "none";
|
|
309
|
+
// link.href = URL.createObjectURL(blob);
|
|
310
|
+
// link.setAttribute("download", decodeURI(data.body.templateName+'.xlsx'));
|
|
311
|
+
// document.body.appendChild(link);
|
|
312
|
+
// link.click();
|
|
313
|
+
// document.body.removeChild(link);
|
|
314
|
+
// console.log(res);
|
|
315
|
+
// })
|
|
316
|
+
var link = document.createElement('a');
|
|
317
|
+
console.log('导出路径',this.resultData)
|
|
318
|
+
// let path = item.filename.substring(item.filename.indexOf('webapps'), (item.filename.length))
|
|
319
|
+
// let pathName = path.substring(path.indexOf('/') + 1, path.length)
|
|
320
|
+
let path = this.resultData;
|
|
321
|
+
//webapps这个是在服务器上导出用的
|
|
322
|
+
let pathName = "http://" + location.host + "/webapps" + path.split('webapps')[1];
|
|
323
|
+
console.log('服务器导出路径',pathName)
|
|
324
|
+
link.href = pathName;
|
|
325
|
+
link.download = path.split('excel/')[1];
|
|
326
|
+
link.dispatchEvent(new MouseEvent('click'));
|
|
327
|
+
},
|
|
328
|
+
export() {
|
|
329
|
+
// 获取导出选择的表头和列
|
|
330
|
+
let temp = ''
|
|
331
|
+
this.modelval.forEach((item) => {
|
|
332
|
+
temp = temp + item + ','
|
|
333
|
+
this.exporthead.push(item + ':' + this.field[item])
|
|
334
|
+
//this.exporthead[item] = this.field[item]
|
|
335
|
+
})
|
|
336
|
+
temp = temp.slice(0, temp.length - 1)
|
|
337
|
+
console.log('表头,,,,', this.exporthead)
|
|
338
|
+
this.data.items = temp
|
|
339
|
+
this.post()
|
|
340
|
+
this.show = false
|
|
341
|
+
},
|
|
342
|
+
post() {
|
|
343
|
+
// if(this.total) {
|
|
344
|
+
//
|
|
345
|
+
// var temp={"合计":"合计"}
|
|
346
|
+
// for (var a in this.field) {
|
|
347
|
+
// for (var b in this.total) {
|
|
348
|
+
// if(a==b){
|
|
349
|
+
// temp[a]=this.total[a]
|
|
350
|
+
// }
|
|
351
|
+
// }
|
|
352
|
+
// }
|
|
353
|
+
// this.selftotal.push(temp)
|
|
354
|
+
// console.log("========================")
|
|
355
|
+
// console.log(temp)
|
|
356
|
+
//
|
|
357
|
+
// // this.selftotal.push(this.total)
|
|
358
|
+
// // this.selftotal[0].a="合计"
|
|
359
|
+
// }
|
|
360
|
+
let gen = postGen(this)
|
|
361
|
+
co(gen)
|
|
362
|
+
},
|
|
363
|
+
stamp() {
|
|
364
|
+
this.modelval = []
|
|
365
|
+
this.show = true
|
|
366
|
+
},
|
|
367
|
+
sortModelval() {
|
|
368
|
+
let sortModel = []
|
|
369
|
+
Object.keys(this.fields).forEach((key) => {
|
|
370
|
+
if (this.modelval.includes(key)) {
|
|
371
|
+
sortModel.push(key)
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
console.log('看看选择的顺序。。。', sortModel)
|
|
375
|
+
this.modelval = sortModel
|
|
376
|
+
},
|
|
377
|
+
close() {
|
|
378
|
+
this.all = false
|
|
379
|
+
this.modelval = []
|
|
380
|
+
this.show = false
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
watch: {
|
|
384
|
+
'all'(val) {
|
|
385
|
+
if (val) {
|
|
386
|
+
this.modelval = Object.keys(this.fields)
|
|
387
|
+
} else {
|
|
388
|
+
this.modelval = []
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
'modelval.length'() {
|
|
392
|
+
this.sortModelval()
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
</script>
|