apply-clients 3.3.102 → 3.3.105

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.
@@ -1,598 +1,600 @@
1
- <template>
2
- <work-busy :is-busy="showWork" v-show="showWork"></work-busy>
3
-
4
- <div class="col-sm-12" style="margin: 20px 0px;">
5
- <criteria-paged :model="model" v-ref:cp :pager="pager">
6
- <criteria partial='criteria' @condition-changed='$parent.searchCondition' v-ref:cri>
7
- <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
8
- </div>
9
- </criteria>
10
- <data-grid :model="model" v-ref:grid partial='list' class="list_area table_sy" style="padding: 0px">
11
- <template partial='head'>
12
- <tr>
13
- <th>序号</th>
14
- <th>客户编号</th>
15
- <th>客户名称</th>
16
- <th>客户电话</th>
17
- <th>地址信息</th>
18
- <th v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">备注</th>
19
- <th>表具数量</th>
20
- <th>
21
- <template v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">
22
- <button type="button" class="btn btn-info head-but" v-if="$parent.$parent.$parent.mark === 0"
23
- @click="$parent.$parent.$parent.showFile = !$parent.$parent.$parent.showFile">导入</button>
24
- <a type="button" class="btn btn-info head-but" v-if="$parent.$parent.$parent.mark === 0"
25
- href="/apply/download/excel/安装明细.xlsx" download>模板下载</a>
26
- <export-excel :data="$parent.$parent.$parent.getCondition"
27
- :field="$parent.$parent.$parent.getfield"
28
- sqlurl="rs/logic/applyExportfile"
29
- sql-name="getInstallableAddress"
30
- template-name='可安装地址'
31
- btn-name="导出可安装"
32
- :choose-col="true"></export-excel>
33
- </template>
34
- </th>
35
- </tr>
36
- </template>
37
- <template partial='body'>
38
- <tr>
39
- <td style="text-align: center;">
40
- <nobr>{{$index+1}}</nobr>
41
- </td>
42
- <td style="text-align: center;">
43
- <nobr>{{row.f_userinfo_code}}</nobr>
44
- </td>
45
- <td style="text-align: center;">
46
- <nobr>{{row.f_user_name}}</nobr>
47
- </td>
48
- <td style="text-align: center;">
49
- <nobr>{{row.f_user_phone}}</nobr>
50
- </td>
51
- <td style="text-align: center;">
52
- <nobr>{{row.f_address}}</nobr>
53
- </td>
54
- <th v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">
55
- <nobr>{{row.f_userinfo_comments}}</nobr>
56
- </th>
57
- <td style="text-align: center;">
58
- <nobr>{{row.f_userfiles_num === null ? 0 : row.f_userfiles_num}}</nobr>
59
- </td>
60
- <td style="text-align: center;">
61
- <nobr>
62
- <button
63
- type="button" name="button" class="btn btn-link"
64
- :disabled="row.f_cumulative_payment_money < $parent.$parent.$parent.selectdata.f_price && $parent.$parent.$parent.selectdata.f_apply_type !== '开发商集体报建'"
65
- @click="$parent.$parent.$parent.showUserFileModal(row)">
66
- {{$parent.$parent.$parent.mark === 1 ? '查看' : row.f_userfiles_num > 0 ? '修正' : '添加'}}
67
- </button>
68
- </nobr>
69
- </td>
70
- </tr>
71
- </template>
72
- </data-grid>
73
- </criteria-paged>
74
- </div>
75
- <modal v-if="showFile" :show.sync="showFile" v-ref:modal :backdrop="false" title="选择文件">
76
- <header slot="modal-header" class="modal-header">
77
- <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
78
- <h4 class="modal-title">选择文件</h4>
79
- </header>
80
- <article slot="modal-body" class="modal-body">
81
- <div class="form-group">
82
- <file-upload class="my-file-uploader" name="useraddressUploadFile" action="rs/file/uploadFile" tagname="确定" v-ref:file></file-upload>
83
- </div>
84
- </article>
85
- <footer slot="modal-footer" class="modal-footer"></footer>
86
- </modal>
87
-
88
- <modal v-if="showUserFile" :show.sync="showUserFile" v-ref:modal :large="true" :backdrop="false" title="安装明细">
89
- <header slot="modal-header" class="modal-header">
90
- <button type="button" class="close" @click="closeUserFile"><span>&times;</span></button>
91
- <h4 class="modal-title">安装明细</h4>
92
- </header>
93
- <article slot="modal-body" class="modal-body clearfix">
94
- <div class="form-group col-sm-12">
95
- <label class="col-sm-2 control-label">地址信息:</label>
96
- <div class="col-sm-10">
97
- <input class="form-control input_view" style=""
98
- v-model="useradders.f_address"
99
- :value="useradders.f_address"
100
- :readonly="true"/>
101
- </div>
102
- </div>
103
-
104
- <div v-for="(i, item) in userinfo.userfiles" class="form-group col-sm-12 panel panel-info">
105
- <div class="panel-heading head col-sm-12" style="background-color: #e8f4ff;margin-bottom: 10px">
106
- <div class="col-sm-6 text-left">表具{{$index+1}}信息</div>
107
- <div class="col-sm-6 text-right"><button
108
- class="button_delete button_spacing"
109
- v-if="!item.f_userfiles_id"
110
- @click.prevent="deleteUserFile(i)"
111
- >删除</button></div>
112
- </div>
113
- <div class="form-group col-sm-6" :class="[item.gasbrand ? '' : 'has-error']">
114
- <label class="col-sm-4 control-label">气表品牌:</label>
115
- <div class="col-sm-8">
116
- <input-select
117
- class="select select_list"
118
- :value.sync="item.gasbrand"
119
- v-model="item.gasbrand"
120
- :options="meterbrands"
121
- @change="gasbrandChange(i)"
122
- :disable="mark === 1"
123
- :valueSingle="true"></input-select>
124
- </div>
125
- </div>
126
- <div class="form-group col-sm-6" :class="[item.gasmodel ? '' : 'has-error']">
127
- <label class="col-sm-4 control-label">气表型号:</label>
128
- <div class="col-sm-8">
129
- <input-select
130
- class="select select_list"
131
- :value.sync="item.gasmodel"
132
- v-model="item.gasmodel"
133
- :options.sync="item.gasbrand.gasmodel"
134
- @change="gasmodelChange(i)"
135
- :disable="mark === 1"
136
- :valueSingle="true"></input-select>
137
- </div>
138
- </div>
139
- <div class="form-group col-sm-6" :class="[item.f_meternumber ? '' : 'has-error']">
140
- <label class="col-sm-4 control-label">表&emsp;&emsp;号:</label>
141
- <div class="col-sm-8">
142
- <input class="form-control input_view" style=""
143
- placeholder="表号"
144
- v-model="item.f_meternumber"
145
- :value="item.f_meternumber"
146
- @change="meternumberValidate(i)"
147
- :readonly="mark === 1"/>
148
- </div>
149
- </div>
150
- <div class="form-group col-sm-6">
151
- <label class="col-sm-4 control-label">表&ensp;封&ensp;号:</label>
152
- <div class="col-sm-8">
153
- <input class="form-control input_view" style=""
154
- placeholder="表封号"
155
- v-model="item.f_metertitles"
156
- :value="item.f_metertitles"
157
- :readonly="mark === 1"/>
158
- </div>
159
- </div>
160
- <div class="form-group col-sm-6">
161
- <label class="col-sm-4 control-label">表&ensp;读&ensp;数:</label>
162
- <div class="col-sm-8">
163
- <input class="form-control input_view" style=""
164
- type="number"
165
- placeholder="表读数"
166
- v-model="item.f_meter_base"
167
- :value="item.f_meter_base"
168
- :readonly="mark === 1"/>
169
- </div>
170
- </div>
171
- <div class="form-group col-sm-6">
172
- <label class="col-sm-4 control-label">初始底数:</label>
173
- <div class="col-sm-8">
174
- <input class="form-control input_view" style=""
175
- type="number"
176
- v-model="item.f_initial_base"
177
- :value="item.f_initial_base"
178
- placeholder="初始底数"
179
- :readonly="mark === 1"/>
180
- </div>
181
- </div>
182
- <div class="form-group col-sm-6">
183
- <label class="col-sm-4 control-label">表&emsp;&emsp;向:</label>
184
- <div class="col-sm-8">
185
- <input-select
186
- class="select select_list"
187
- :value.sync="item.f_aroundmeter"
188
- v-model="item.f_aroundmeter"
189
- :options="aroundmeters"
190
- :disable="mark === 1"
191
- :valueSingle="true"></input-select>
192
- </div>
193
- </div>
194
- <div class="form-group col-sm-6">
195
- <label class="col-sm-4 control-label">安装位置:</label>
196
- <div class="col-sm-8">
197
- <input-select
198
- class="select select_list"
199
- :value.sync="item.f_position"
200
- v-model="item.f_position"
201
- :options="positions"
202
- :disable="mark === 1"
203
- :valueSingle="true"></input-select>
204
- </div>
205
- </div>
206
- <div class="form-group col-sm-6">
207
- <label class="col-sm-4 control-label">安&ensp;装&ensp;人:</label>
208
- <div class="col-sm-8">
209
- <input class="form-control input_view" style=""
210
- v-model="item.f_install_person"
211
- :value.sync="installperson(item.f_install_person)"
212
- placeholder="安装人"
213
- readonly/>
214
- <!-- <input-select-->
215
- <!-- class="select select_list"-->
216
- <!-- :value.sync="item.f_install_person"-->
217
- <!-- v-model="item.f_install_person"-->
218
- <!-- :options="installperson"-->
219
- <!-- :disable="mark === 1"-->
220
- <!-- :valueSingle="true"></input-select>-->
221
- </div>
222
- </div>
223
- <div class="form-group col-sm-6">
224
- <label class="col-sm-4 control-label">安装日期:</label>
225
- <div class="col-sm-8">
226
- <input class="form-control input_view" style=""
227
- v-model="item.f_install_date"
228
- :value.sync="installdate(item.f_install_date)"
229
- placeholder="安装日期"
230
- readonly/>
231
- <!-- <datepicker-->
232
- <!-- placeholder="安装日期"-->
233
- <!-- :value.sync="item.f_install_date"-->
234
- <!-- v-model="item.f_install_date"-->
235
- <!-- format="yyyy-MM-dd HH:mm:ss"-->
236
- <!-- :disabled="mark === 1"-->
237
- <!-- :show-reset-button="reset">-->
238
- <!-- </datepicker>-->
239
- </div>
240
- </div>
241
- </div>
242
-
243
- </article>
244
- <footer slot="modal-footer" class="modal-footer">
245
- <template v-if="mark !== 1">
246
- <!-- 去除一户多表 -->
247
- <button type="button" class="btn btn-primary" @click="addUserFile" v-if="false">添加表具</button>
248
- <button type="button" class="btn btn-primary" @click="saveUserFile" :disabled="!$v.valid">确认</button>
249
- </template>
250
- </footer>
251
- </modal>
252
- </template>
253
- <script>
254
- import Vue from 'vue'
255
- import {PagedList} from 'vue-client'
256
- import {HttpResetClass} from 'vue-client'
257
- import {isEmpty} from '../../../Util'
258
- // Date格式化
259
- Date.prototype.Format = function (fmt) {
260
- var o = {
261
- 'M+': this.getMonth() + 1, // 月份
262
- 'd+': this.getDate(), //
263
- 'H+': this.getHours(), // 小时
264
- 'm+': this.getMinutes(), //
265
- 's+': this.getSeconds(), //
266
- 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
267
- 'S': this.getMilliseconds() // 毫秒
268
- }
269
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
270
- for (var k in o) {
271
- if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
272
- }
273
- return fmt
274
- }
275
-
276
- export default {
277
- title: '安装明细',
278
- props: {
279
- selectdata: {
280
- type: Object
281
- },
282
- mark: {
283
- type: Number,
284
- default: 0
285
- }
286
- },
287
- data () {
288
- return {
289
- showFile: false,
290
- showUserFile: false,
291
- model: new PagedList('rs/sql/getAddresAndUserinfoAndUserfilesAmount', 20, null),
292
- meterbrands: [], // 气表品牌
293
- useradders: null,
294
- userinfo: {},
295
- getfield: {
296
- 'f_address': '地址',
297
- 'f_user_name': '用户姓名/单位名称',
298
- 'f_meternumber': '表号',
299
- 'f_gasbrand': '气表品牌',
300
- 'f_gasmodel': '气表型号',
301
- 'f_metertitles': '表封号',
302
- 'f_meter_base': '表读数',
303
- 'f_initial_base': '初始底数',
304
- 'f_aroundmeter': '表向',
305
- 'f_user_phone': '电话',
306
- 'f_userinfo_comments': '备注',
307
- 'f_position': '安装位置'
308
- },
309
- showWork: false
310
- }
311
- },
312
- ready () {
313
- this.search()
314
- this.getMeterbrands()
315
- if (this.selectdata.f_apply_type === '团购报建') {
316
- this.notInstalled()
317
- }
318
- },
319
- methods: {
320
- // 删除未保存的表具
321
- async deleteUserFile (index) {
322
- this.userinfo.userfiles.splice(index, 1)
323
- },
324
- // 追加表具
325
- addUserFile() {
326
- this.userinfo.userfiles.push({})
327
- },
328
- // 保存档案
329
- async saveUserFile() {
330
- // 检查必填项
331
- for (let i = 0; i < this.userinfo.userfiles.length; i++) {
332
- let userfile = this.userinfo.userfiles[i]
333
- if (userfile.f_gasbrand_id === null || userfile.f_gasbrand_id === '') {
334
- this.$showMessage(`表具${i+1}气表品牌没有选择!!!`)
335
- return
336
- }
337
- if (userfile.f_gasmodel_id === null || userfile.f_gasmodel_id === '') {
338
- this.$showMessage(`表具${i+1}气表型号没有选择!!!`)
339
- return
340
- }
341
- if (userfile.f_meternumber === null || userfile.f_meternumber === '') {
342
- this.$showMessage(`表具${i+1}表号没有填写!!!`)
343
- return
344
- }
345
- }
346
- let data = {
347
- user: this.$login.f,
348
- useradders: this.useradders,
349
- userinfo: this.userinfo,
350
- selectdata: this.selectdata
351
- }
352
- let res = await this.$resetpost('rs/logic/addInstallationDetails', {data:data}, {
353
- resolveMsg: null,
354
- rejectMsg: '表具添加失败!!!'
355
- })
356
- this.$dispatch('breakControl', this.selectdata)
357
- },
358
- // 检查表号是否存在
359
- async meternumberValidate(i) {
360
- if (!this.userinfo.userfiles[i].f_gasbrand_id) {
361
- this.userinfo.userfiles[i].f_meternumber = ''
362
- this.$showAlert('请先选择气表品牌!!!', 'warning', 3000)
363
- return
364
- }
365
- if (this.userinfo.userfiles[i].f_gasbrand_id && this.userinfo.userfiles[i].f_meternumber) {
366
- let data = {
367
- f_meternumber: this.userinfo.userfiles[i].f_meternumber,
368
- f_gasbrand_id: this.userinfo.userfiles[i].f_gasbrand_id
369
- }
370
- if (this.userinfo.userfiles[i].f_userfiles_id) {
371
- data.f_userfiles_id = this.userinfo.userfiles[i].f_userfiles_id
372
- }
373
- let res = await this.$resetpost('rs/logic/meterbrandsNumberValidate', {data:data}, {
374
- resolveMsg: null,
375
- rejectMsg: '表号验证失败!!'
376
- })
377
- if (res.data) {
378
- this.userinfo.userfiles[i].f_meternumber = ''
379
- this.$showAlert('表号已存在!!', 'warning', 3000)
380
- }
381
- }
382
- },
383
- // 选择气表型号
384
- gasmodelChange(i) {
385
- if (this.userinfo.userfiles[i].gasmodel) {
386
- this.userinfo.userfiles[i].f_gasmodel_id = this.userinfo.userfiles[i].gasmodel.id
387
- }
388
- },
389
- // 选择气表品牌
390
- gasbrandChange(i) {
391
- // 清空已保存的气表型号
392
- this.userinfo.userfiles[i].f_gasmodel_id = null
393
- this.userinfo.userfiles[i].gasmodel = null
394
-
395
- if (this.userinfo.userfiles[i].gasbrand) {
396
- // 气表品牌id
397
- this.userinfo.userfiles[i].f_gasbrand_id = this.userinfo.userfiles[i].gasbrand.id
398
- // 气表分类
399
- this.userinfo.userfiles[i].f_meter_classify = this.userinfo.userfiles[i].gasbrand.f_meter_type
400
- }
401
- },
402
- // 打开安装明细
403
- async showUserFileModal (row) {
404
- this.useradders = row
405
-
406
- let http = new HttpResetClass()
407
- let data = {
408
- condition: `f_userinfo_id = '${row.f_userinfo_id}'`
409
- }
410
- let res = await http.load('POST', 'rs/logic/getUserinfoAndUserfiles', {data:data}, {
411
- resolveMsg: null,
412
- rejectMsg: null
413
- })
414
-
415
- this.userinfo = res.data
416
-
417
- // 已有表具的 气表信息补充
418
- for (let i = 0; i < this.userinfo.userfiles.length; i++) {
419
- for (const item of this.meterbrands) {
420
- if (item.value.id === this.userinfo.userfiles[i].f_gasbrand_id) {
421
- // this.userinfo.userfiles[i].gasbrand = item.value // 防止双向绑定失败
422
- Vue.set(this.userinfo.userfiles[i], 'gasbrand', item.value)
423
- }
424
- }
425
- if (this.userinfo.userfiles[i].gasbrand) {
426
- for (const item of this.userinfo.userfiles[i].gasbrand.gasmodel) {
427
- if (item.value.id === this.userinfo.userfiles[i].f_gasmodel_id) {
428
- // this.userinfo.userfiles[i].gasmodel = item.value
429
- Vue.set(this.userinfo.userfiles[i], 'gasmodel', item.value)
430
- }
431
- }
432
- }
433
- }
434
-
435
- this.showUserFile = true
436
- },
437
- // 获取气表品牌
438
- async getMeterbrands() {
439
- let http = new HttpResetClass()
440
- let data = {
441
- f_orgid: this.$login.f.orgid
442
- }
443
- let res = await http.load('POST', 'rs/logic/getMeterbrands', {data:data}, {
444
- resolveMsg: null,
445
- rejectMsg: null
446
- })
447
- this.meterbrands = res.data
448
- },
449
- async notInstalled () {
450
- let http = new HttpResetClass()
451
- let data = {
452
- condition: `ui.f_process_id = '${this.selectdata.f_process_id}' and uf.f_table_state = '待开通'`
453
- }
454
- let res = await http.load(
455
- 'POST',
456
- 'rs/sql/countApplyUserinfo',
457
- {data: data},
458
- {
459
- resolveMsg: null,
460
- rejectMsg: '安装数量查询失败!!!'
461
- })
462
-
463
- for (const item of this.selectdata.fields) {
464
- if (item.label === '已安装户数') {
465
- item.value = this.selectdata.f_apply_count - res.data[0].num
466
- }
467
- if (item.label === '未安装户数') {
468
- item.value = res.data[0].num
469
- }
470
- }
471
- },
472
- searchCondition (args) {
473
-
474
- if (this.selectdata.f_apply_type === '团购转散户' || this.selectdata.f_apply_type === '改管报建' || this.selectdata.f_apply_type === '增容报建' || this.selectdata.f_apply_type === '报警器报建') {
475
- args.condition = args.condition + `and ui.f_userinfo_id = '${this.selectdata.f_userinfo_id}'`
476
- } else {
477
- args.condition = args.condition + `and ua.f_process_id = '${this.selectdata.f_process_id}'`
478
- }
479
-
480
- this.model.search(args.condition, args.model)
481
- },
482
- // 查询
483
- async search () {
484
- this.$refs.cp.$refs.cri.search()
485
- },
486
- // 关闭安装明细
487
- closeUserFile() {
488
- this.showUserFile = false
489
- this.useradders = null
490
- this.userinfo = {}
491
- this.search()
492
- },
493
- // 关闭文件上传对话框
494
- closeFile() {
495
- this.showWork = false
496
- this.showFile = false
497
- // 将选的文件清空
498
- this.$refs.file.$el.querySelector('input').value = ''
499
- this.search()
500
- }
501
- },
502
- events: {
503
- 'beforeFileUpload' (file) {
504
- this.showWork = true
505
- },
506
- async 'onFileUpload'(file, result) {
507
- let data = {
508
- selectdata: this.selectdata,
509
- filepath: result.f_downloadpath,
510
- user: this.$login.f
511
- }
512
- try {
513
- let res = await this.$resetpost(`rs/logic/importAddInstallationDetails`, {data: data}, {
514
- resolveMsg: null,
515
- rejectMsg: '导入失败!!!',
516
- silent: true
517
- }, 0)
518
- } catch (e) {
519
- this.closeFile()
520
- }
521
- this.$dispatch('breakControl', this.selectdata)
522
- }
523
- },
524
- computed: {
525
- pager () {
526
- return this.selectdata.f_apply_type === '团购报建'
527
- },
528
- getCondition () {
529
- let condition = `ua.f_process_id = '${this.selectdata.f_process_id}' and nvl(uf.quantity, 0) < 1`
530
-
531
- return {
532
- condition: condition
533
- }
534
- },
535
- // 安装人
536
- installperson() {
537
- return function (f_install_person) {
538
- if (isEmpty(f_install_person)) {
539
- return this.$login.f.name
540
- }
541
- return f_install_person
542
- }
543
- },
544
- installdate() {
545
- return function (f_install_date) {
546
- if (isEmpty(f_install_date)) {
547
- return new Date().Format('yyyy-MM-dd HH:mm:ss')
548
- }
549
- return f_install_date
550
- }
551
- },
552
- // 表向
553
- aroundmeters() {
554
- return this.$appdata.getParam('左右表')
555
- },
556
- // 安装位置
557
- positions() {
558
- return this.$appdata.getParam('安装位置')
559
- }
560
- },
561
- watch: {
562
- }
563
- }
564
- </script>
565
- <style scoped>
566
- .head-but{
567
- margin-left: 5px;
568
- height: 34px;
569
- /*background-color: #6aa6e2;*/
570
- border-radius: 4px;
571
- font-family: PingFang;
572
- color: #ffffff;
573
- }
574
- /*清除model中的浮动*/
575
- .clearfix:after,.clearfix:before{
576
- display: table;
577
- }
578
- .clearfix:after{
579
- clear: both;
580
- }
581
- .input_view{
582
- padding: 8px;
583
- background-color: #ffffff;
584
- border-radius: 2px;
585
- border: solid 1px #c7c7c7!important;
586
- color: #333333!important;
587
- font-size: 15px!important;
588
- }
589
-
590
- .input_view[readonly]{
591
- border: 1px solid #DDD!important;
592
- color:#ACA899!important;
593
- }
594
- .input_view:disabled{
595
- border: 1px solid #DDD!important;
596
- color:#ACA899!important;
597
- }
598
- </style>
1
+ <template>
2
+ <work-busy :is-busy="showWork" v-show="showWork"></work-busy>
3
+
4
+ <div class="col-sm-12" style="margin: 20px 0px;">
5
+ <criteria-paged :model="model" v-ref:cp :pager="pager">
6
+ <criteria partial='criteria' @condition-changed='$parent.searchCondition' v-ref:cri>
7
+ <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
8
+ </div>
9
+ </criteria>
10
+ <data-grid :model="model" v-ref:grid partial='list' class="list_area table_sy" style="padding: 0px">
11
+ <template partial='head'>
12
+ <tr>
13
+ <th>序号</th>
14
+ <th>客户编号</th>
15
+ <th>客户名称</th>
16
+ <th>客户电话</th>
17
+ <th>地址信息</th>
18
+ <th v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">备注</th>
19
+ <th>表具数量</th>
20
+ <th>
21
+ <template v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">
22
+ <button type="button" class="btn btn-info head-but" v-if="$parent.$parent.$parent.mark === 0"
23
+ @click="$parent.$parent.$parent.showFile = !$parent.$parent.$parent.showFile">导入</button>
24
+ <a type="button" class="btn btn-info head-but" v-if="$parent.$parent.$parent.mark === 0"
25
+ href="/apply/download/excel/安装明细.xlsx" download>模板下载</a>
26
+ <export-excel :data="$parent.$parent.$parent.getCondition"
27
+ :field="$parent.$parent.$parent.getfield"
28
+ sqlurl="rs/logic/applyExportfile"
29
+ sql-name="getInstallableAddress"
30
+ template-name='可安装地址'
31
+ btn-name="导出可安装"
32
+ :choose-col="true"></export-excel>
33
+ </template>
34
+ </th>
35
+ </tr>
36
+ </template>
37
+ <template partial='body'>
38
+ <tr>
39
+ <td style="text-align: center;">
40
+ <nobr>{{$index+1}}</nobr>
41
+ </td>
42
+ <td style="text-align: center;">
43
+ <nobr>{{row.f_userinfo_code}}</nobr>
44
+ </td>
45
+ <td style="text-align: center;">
46
+ <nobr>{{row.f_user_name}}</nobr>
47
+ </td>
48
+ <td style="text-align: center;">
49
+ <nobr>{{row.f_user_phone}}</nobr>
50
+ </td>
51
+ <td style="text-align: center;">
52
+ <nobr>{{row.f_address}}</nobr>
53
+ </td>
54
+ <th v-if="$parent.$parent.$parent.selectdata.f_apply_type === '团购报建'">
55
+ <nobr>{{row.f_userinfo_comments}}</nobr>
56
+ </th>
57
+ <td style="text-align: center;">
58
+ <nobr>{{row.f_userfiles_num === null ? 0 : row.f_userfiles_num}}</nobr>
59
+ </td>
60
+ <td style="text-align: center;">
61
+ <nobr>
62
+ <button
63
+ type="button" name="button" class="btn btn-link"
64
+ :disabled="row.f_cumulative_payment_money < $parent.$parent.$parent.selectdata.f_price && $parent.$parent.$parent.selectdata.f_apply_type !== '开发商集体报建'"
65
+ @click="$parent.$parent.$parent.showUserFileModal(row)">
66
+ {{$parent.$parent.$parent.mark === 1 ? '查看' : row.f_userfiles_num > 0 ? '修正' : '添加'}}
67
+ </button>
68
+ </nobr>
69
+ </td>
70
+ </tr>
71
+ </template>
72
+ </data-grid>
73
+ </criteria-paged>
74
+ </div>
75
+ <modal v-if="showFile" :show.sync="showFile" v-ref:modal :backdrop="false" title="选择文件">
76
+ <header slot="modal-header" class="modal-header">
77
+ <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
78
+ <h4 class="modal-title">选择文件</h4>
79
+ </header>
80
+ <article slot="modal-body" class="modal-body">
81
+ <div class="form-group">
82
+ <file-upload class="my-file-uploader" name="useraddressUploadFile" action="rs/file/uploadFile" tagname="确定" v-ref:file></file-upload>
83
+ </div>
84
+ </article>
85
+ <footer slot="modal-footer" class="modal-footer"></footer>
86
+ </modal>
87
+
88
+ <modal v-if="showUserFile" :show.sync="showUserFile" v-ref:modal :large="true" :backdrop="false" title="安装明细">
89
+ <header slot="modal-header" class="modal-header">
90
+ <button type="button" class="close" @click="closeUserFile"><span>&times;</span></button>
91
+ <h4 class="modal-title">安装明细</h4>
92
+ </header>
93
+ <article slot="modal-body" class="modal-body clearfix">
94
+ <div class="form-group col-sm-12">
95
+ <label class="col-sm-2 control-label">地址信息:</label>
96
+ <div class="col-sm-10">
97
+ <input class="form-control input_view" style=""
98
+ v-model="useradders.f_address"
99
+ :value="useradders.f_address"
100
+ :readonly="true"/>
101
+ </div>
102
+ </div>
103
+
104
+ <div v-for="(i, item) in userinfo.userfiles" class="form-group col-sm-12 panel panel-info">
105
+ <div class="panel-heading head col-sm-12" style="background-color: #e8f4ff;margin-bottom: 10px">
106
+ <div class="col-sm-6 text-left">表具{{$index+1}}信息</div>
107
+ <div class="col-sm-6 text-right"><button
108
+ class="button_delete button_spacing"
109
+ v-if="!item.f_userfiles_id"
110
+ @click.prevent="deleteUserFile(i)"
111
+ >删除</button></div>
112
+ </div>
113
+ <div class="form-group col-sm-6" :class="[item.gasbrand ? '' : 'has-error']">
114
+ <label class="col-sm-4 control-label">气表品牌:</label>
115
+ <div class="col-sm-8">
116
+ <input-select
117
+ class="select select_list"
118
+ :value.sync="item.gasbrand"
119
+ v-model="item.gasbrand"
120
+ :options="meterbrands"
121
+ @change="gasbrandChange(i)"
122
+ :disable="mark === 1"
123
+ :valueSingle="true"></input-select>
124
+ </div>
125
+ </div>
126
+ <div class="form-group col-sm-6" :class="[item.gasmodel ? '' : 'has-error']">
127
+ <label class="col-sm-4 control-label">气表型号:</label>
128
+ <div class="col-sm-8">
129
+ <input-select
130
+ class="select select_list"
131
+ :value.sync="item.gasmodel"
132
+ v-model="item.gasmodel"
133
+ :options.sync="item.gasbrand.gasmodel"
134
+ @change="gasmodelChange(i)"
135
+ :disable="mark === 1"
136
+ :valueSingle="true"></input-select>
137
+ </div>
138
+ </div>
139
+ <div class="form-group col-sm-6" :class="[item.f_meternumber ? '' : 'has-error']">
140
+ <label class="col-sm-4 control-label">表&emsp;&emsp;号:</label>
141
+ <div class="col-sm-8">
142
+ <input class="form-control input_view" style=""
143
+ placeholder="表号"
144
+ type="number"
145
+ οnkeyup="this.value=this.value.replace(/\s+/g,'')"
146
+ v-model="item.f_meternumber"
147
+ :value="item.f_meternumber"
148
+ @change="meternumberValidate(i)"
149
+ :readonly="mark === 1"/>
150
+ </div>
151
+ </div>
152
+ <div class="form-group col-sm-6">
153
+ <label class="col-sm-4 control-label">表&ensp;封&ensp;号:</label>
154
+ <div class="col-sm-8">
155
+ <input class="form-control input_view" style=""
156
+ placeholder="表封号"
157
+ v-model="item.f_metertitles"
158
+ :value="item.f_metertitles"
159
+ :readonly="mark === 1"/>
160
+ </div>
161
+ </div>
162
+ <div class="form-group col-sm-6">
163
+ <label class="col-sm-4 control-label">表&ensp;读&ensp;数:</label>
164
+ <div class="col-sm-8">
165
+ <input class="form-control input_view" style=""
166
+ type="number"
167
+ placeholder="表读数"
168
+ v-model="item.f_meter_base"
169
+ :value="item.f_meter_base"
170
+ :readonly="mark === 1"/>
171
+ </div>
172
+ </div>
173
+ <div class="form-group col-sm-6">
174
+ <label class="col-sm-4 control-label">初始底数:</label>
175
+ <div class="col-sm-8">
176
+ <input class="form-control input_view" style=""
177
+ type="number"
178
+ v-model="item.f_initial_base"
179
+ :value="item.f_initial_base"
180
+ placeholder="初始底数"
181
+ :readonly="mark === 1"/>
182
+ </div>
183
+ </div>
184
+ <div class="form-group col-sm-6">
185
+ <label class="col-sm-4 control-label">表&emsp;&emsp;向:</label>
186
+ <div class="col-sm-8">
187
+ <input-select
188
+ class="select select_list"
189
+ :value.sync="item.f_aroundmeter"
190
+ v-model="item.f_aroundmeter"
191
+ :options="aroundmeters"
192
+ :disable="mark === 1"
193
+ :valueSingle="true"></input-select>
194
+ </div>
195
+ </div>
196
+ <div class="form-group col-sm-6">
197
+ <label class="col-sm-4 control-label">安装位置:</label>
198
+ <div class="col-sm-8">
199
+ <input-select
200
+ class="select select_list"
201
+ :value.sync="item.f_position"
202
+ v-model="item.f_position"
203
+ :options="positions"
204
+ :disable="mark === 1"
205
+ :valueSingle="true"></input-select>
206
+ </div>
207
+ </div>
208
+ <div class="form-group col-sm-6">
209
+ <label class="col-sm-4 control-label">安&ensp;装&ensp;人:</label>
210
+ <div class="col-sm-8">
211
+ <input class="form-control input_view" style=""
212
+ v-model="item.f_install_person"
213
+ :value.sync="installperson(item.f_install_person)"
214
+ placeholder="安装人"
215
+ readonly/>
216
+ <!-- <input-select-->
217
+ <!-- class="select select_list"-->
218
+ <!-- :value.sync="item.f_install_person"-->
219
+ <!-- v-model="item.f_install_person"-->
220
+ <!-- :options="installperson"-->
221
+ <!-- :disable="mark === 1"-->
222
+ <!-- :valueSingle="true"></input-select>-->
223
+ </div>
224
+ </div>
225
+ <div class="form-group col-sm-6">
226
+ <label class="col-sm-4 control-label">安装日期:</label>
227
+ <div class="col-sm-8">
228
+ <input class="form-control input_view" style=""
229
+ v-model="item.f_install_date"
230
+ :value.sync="installdate(item.f_install_date)"
231
+ placeholder="安装日期"
232
+ readonly/>
233
+ <!-- <datepicker-->
234
+ <!-- placeholder="安装日期"-->
235
+ <!-- :value.sync="item.f_install_date"-->
236
+ <!-- v-model="item.f_install_date"-->
237
+ <!-- format="yyyy-MM-dd HH:mm:ss"-->
238
+ <!-- :disabled="mark === 1"-->
239
+ <!-- :show-reset-button="reset">-->
240
+ <!-- </datepicker>-->
241
+ </div>
242
+ </div>
243
+ </div>
244
+
245
+ </article>
246
+ <footer slot="modal-footer" class="modal-footer">
247
+ <template v-if="mark !== 1">
248
+ <!-- 去除一户多表 -->
249
+ <button type="button" class="btn btn-primary" @click="addUserFile" v-if="false">添加表具</button>
250
+ <button type="button" class="btn btn-primary" @click="saveUserFile" :disabled="!$v.valid">确认</button>
251
+ </template>
252
+ </footer>
253
+ </modal>
254
+ </template>
255
+ <script>
256
+ import Vue from 'vue'
257
+ import {PagedList} from 'vue-client'
258
+ import {HttpResetClass} from 'vue-client'
259
+ import {isEmpty} from '../../../Util'
260
+ // Date格式化
261
+ Date.prototype.Format = function (fmt) {
262
+ var o = {
263
+ 'M+': this.getMonth() + 1, // 月份
264
+ 'd+': this.getDate(), //
265
+ 'H+': this.getHours(), // 小时
266
+ 'm+': this.getMinutes(), //
267
+ 's+': this.getSeconds(), //
268
+ 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
269
+ 'S': this.getMilliseconds() // 毫秒
270
+ }
271
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
272
+ for (var k in o) {
273
+ if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
274
+ }
275
+ return fmt
276
+ }
277
+
278
+ export default {
279
+ title: '安装明细',
280
+ props: {
281
+ selectdata: {
282
+ type: Object
283
+ },
284
+ mark: {
285
+ type: Number,
286
+ default: 0
287
+ }
288
+ },
289
+ data () {
290
+ return {
291
+ showFile: false,
292
+ showUserFile: false,
293
+ model: new PagedList('rs/sql/getAddresAndUserinfoAndUserfilesAmount', 20, null),
294
+ meterbrands: [], // 气表品牌
295
+ useradders: null,
296
+ userinfo: {},
297
+ getfield: {
298
+ 'f_address': '地址',
299
+ 'f_user_name': '用户姓名/单位名称',
300
+ 'f_meternumber': '表号',
301
+ 'f_gasbrand': '气表品牌',
302
+ 'f_gasmodel': '气表型号',
303
+ 'f_metertitles': '表封号',
304
+ 'f_meter_base': '表读数',
305
+ 'f_initial_base': '初始底数',
306
+ 'f_aroundmeter': '表向',
307
+ 'f_user_phone': '电话',
308
+ 'f_userinfo_comments': '备注',
309
+ 'f_position': '安装位置'
310
+ },
311
+ showWork: false
312
+ }
313
+ },
314
+ ready () {
315
+ this.search()
316
+ this.getMeterbrands()
317
+ if (this.selectdata.f_apply_type === '团购报建') {
318
+ this.notInstalled()
319
+ }
320
+ },
321
+ methods: {
322
+ // 删除未保存的表具
323
+ async deleteUserFile (index) {
324
+ this.userinfo.userfiles.splice(index, 1)
325
+ },
326
+ // 追加表具
327
+ addUserFile() {
328
+ this.userinfo.userfiles.push({})
329
+ },
330
+ // 保存档案
331
+ async saveUserFile() {
332
+ // 检查必填项
333
+ for (let i = 0; i < this.userinfo.userfiles.length; i++) {
334
+ let userfile = this.userinfo.userfiles[i]
335
+ if (userfile.f_gasbrand_id === null || userfile.f_gasbrand_id === '') {
336
+ this.$showMessage(`表具${i+1}气表品牌没有选择!!!`)
337
+ return
338
+ }
339
+ if (userfile.f_gasmodel_id === null || userfile.f_gasmodel_id === '') {
340
+ this.$showMessage(`表具${i+1}气表型号没有选择!!!`)
341
+ return
342
+ }
343
+ if (userfile.f_meternumber === null || userfile.f_meternumber === '') {
344
+ this.$showMessage(`表具${i+1}表号没有填写!!!`)
345
+ return
346
+ }
347
+ }
348
+ let data = {
349
+ user: this.$login.f,
350
+ useradders: this.useradders,
351
+ userinfo: this.userinfo,
352
+ selectdata: this.selectdata
353
+ }
354
+ let res = await this.$resetpost('rs/logic/addInstallationDetails', {data:data}, {
355
+ resolveMsg: null,
356
+ rejectMsg: '表具添加失败!!!'
357
+ })
358
+ this.$dispatch('breakControl', this.selectdata)
359
+ },
360
+ // 检查表号是否存在
361
+ async meternumberValidate(i) {
362
+ if (!this.userinfo.userfiles[i].f_gasbrand_id) {
363
+ this.userinfo.userfiles[i].f_meternumber = ''
364
+ this.$showAlert('请先选择气表品牌!!!', 'warning', 3000)
365
+ return
366
+ }
367
+ if (this.userinfo.userfiles[i].f_gasbrand_id && this.userinfo.userfiles[i].f_meternumber) {
368
+ let data = {
369
+ f_meternumber: this.userinfo.userfiles[i].f_meternumber,
370
+ f_gasbrand_id: this.userinfo.userfiles[i].f_gasbrand_id
371
+ }
372
+ if (this.userinfo.userfiles[i].f_userfiles_id) {
373
+ data.f_userfiles_id = this.userinfo.userfiles[i].f_userfiles_id
374
+ }
375
+ let res = await this.$resetpost('rs/logic/meterbrandsNumberValidate', {data:data}, {
376
+ resolveMsg: null,
377
+ rejectMsg: '表号验证失败!!'
378
+ })
379
+ if (res.data) {
380
+ this.userinfo.userfiles[i].f_meternumber = ''
381
+ this.$showAlert('表号已存在!!', 'warning', 3000)
382
+ }
383
+ }
384
+ },
385
+ // 选择气表型号
386
+ gasmodelChange(i) {
387
+ if (this.userinfo.userfiles[i].gasmodel) {
388
+ this.userinfo.userfiles[i].f_gasmodel_id = this.userinfo.userfiles[i].gasmodel.id
389
+ }
390
+ },
391
+ // 选择气表品牌
392
+ gasbrandChange(i) {
393
+ // 清空已保存的气表型号
394
+ this.userinfo.userfiles[i].f_gasmodel_id = null
395
+ this.userinfo.userfiles[i].gasmodel = null
396
+
397
+ if (this.userinfo.userfiles[i].gasbrand) {
398
+ // 气表品牌id
399
+ this.userinfo.userfiles[i].f_gasbrand_id = this.userinfo.userfiles[i].gasbrand.id
400
+ // 气表分类
401
+ this.userinfo.userfiles[i].f_meter_classify = this.userinfo.userfiles[i].gasbrand.f_meter_type
402
+ }
403
+ },
404
+ // 打开安装明细
405
+ async showUserFileModal (row) {
406
+ this.useradders = row
407
+
408
+ let http = new HttpResetClass()
409
+ let data = {
410
+ condition: `f_userinfo_id = '${row.f_userinfo_id}'`
411
+ }
412
+ let res = await http.load('POST', 'rs/logic/getUserinfoAndUserfiles', {data:data}, {
413
+ resolveMsg: null,
414
+ rejectMsg: null
415
+ })
416
+
417
+ this.userinfo = res.data
418
+
419
+ // 已有表具的 气表信息补充
420
+ for (let i = 0; i < this.userinfo.userfiles.length; i++) {
421
+ for (const item of this.meterbrands) {
422
+ if (item.value.id === this.userinfo.userfiles[i].f_gasbrand_id) {
423
+ // this.userinfo.userfiles[i].gasbrand = item.value // 防止双向绑定失败
424
+ Vue.set(this.userinfo.userfiles[i], 'gasbrand', item.value)
425
+ }
426
+ }
427
+ if (this.userinfo.userfiles[i].gasbrand) {
428
+ for (const item of this.userinfo.userfiles[i].gasbrand.gasmodel) {
429
+ if (item.value.id === this.userinfo.userfiles[i].f_gasmodel_id) {
430
+ // this.userinfo.userfiles[i].gasmodel = item.value
431
+ Vue.set(this.userinfo.userfiles[i], 'gasmodel', item.value)
432
+ }
433
+ }
434
+ }
435
+ }
436
+
437
+ this.showUserFile = true
438
+ },
439
+ // 获取气表品牌
440
+ async getMeterbrands() {
441
+ let http = new HttpResetClass()
442
+ let data = {
443
+ f_orgid: this.$login.f.orgid
444
+ }
445
+ let res = await http.load('POST', 'rs/logic/getMeterbrands', {data:data}, {
446
+ resolveMsg: null,
447
+ rejectMsg: null
448
+ })
449
+ this.meterbrands = res.data
450
+ },
451
+ async notInstalled () {
452
+ let http = new HttpResetClass()
453
+ let data = {
454
+ condition: `ui.f_process_id = '${this.selectdata.f_process_id}' and uf.f_table_state = '待开通'`
455
+ }
456
+ let res = await http.load(
457
+ 'POST',
458
+ 'rs/sql/countApplyUserinfo',
459
+ {data: data},
460
+ {
461
+ resolveMsg: null,
462
+ rejectMsg: '安装数量查询失败!!!'
463
+ })
464
+
465
+ for (const item of this.selectdata.fields) {
466
+ if (item.label === '已安装户数') {
467
+ item.value = this.selectdata.f_apply_count - res.data[0].num
468
+ }
469
+ if (item.label === '未安装户数') {
470
+ item.value = res.data[0].num
471
+ }
472
+ }
473
+ },
474
+ searchCondition (args) {
475
+
476
+ if (this.selectdata.f_apply_type === '团购转散户' || this.selectdata.f_apply_type === '改管报建' || this.selectdata.f_apply_type === '增容报建' || this.selectdata.f_apply_type === '报警器报建') {
477
+ args.condition = args.condition + `and ui.f_userinfo_id = '${this.selectdata.f_userinfo_id}'`
478
+ } else {
479
+ args.condition = args.condition + `and ua.f_process_id = '${this.selectdata.f_process_id}'`
480
+ }
481
+
482
+ this.model.search(args.condition, args.model)
483
+ },
484
+ // 查询
485
+ async search () {
486
+ this.$refs.cp.$refs.cri.search()
487
+ },
488
+ // 关闭安装明细
489
+ closeUserFile() {
490
+ this.showUserFile = false
491
+ this.useradders = null
492
+ this.userinfo = {}
493
+ this.search()
494
+ },
495
+ // 关闭文件上传对话框
496
+ closeFile() {
497
+ this.showWork = false
498
+ this.showFile = false
499
+ // 将选的文件清空
500
+ this.$refs.file.$el.querySelector('input').value = ''
501
+ this.search()
502
+ }
503
+ },
504
+ events: {
505
+ 'beforeFileUpload' (file) {
506
+ this.showWork = true
507
+ },
508
+ async 'onFileUpload'(file, result) {
509
+ let data = {
510
+ selectdata: this.selectdata,
511
+ filepath: result.f_downloadpath,
512
+ user: this.$login.f
513
+ }
514
+ try {
515
+ let res = await this.$resetpost(`rs/logic/importAddInstallationDetails`, {data: data}, {
516
+ resolveMsg: null,
517
+ rejectMsg: '导入失败!!!',
518
+ silent: true
519
+ }, 0)
520
+ } catch (e) {
521
+ this.closeFile()
522
+ }
523
+ this.$dispatch('breakControl', this.selectdata)
524
+ }
525
+ },
526
+ computed: {
527
+ pager () {
528
+ return this.selectdata.f_apply_type === '团购报建'
529
+ },
530
+ getCondition () {
531
+ let condition = `ua.f_process_id = '${this.selectdata.f_process_id}' and nvl(uf.quantity, 0) < 1`
532
+
533
+ return {
534
+ condition: condition
535
+ }
536
+ },
537
+ // 安装人
538
+ installperson() {
539
+ return function (f_install_person) {
540
+ if (isEmpty(f_install_person)) {
541
+ return this.$login.f.name
542
+ }
543
+ return f_install_person
544
+ }
545
+ },
546
+ installdate() {
547
+ return function (f_install_date) {
548
+ if (isEmpty(f_install_date)) {
549
+ return new Date().Format('yyyy-MM-dd HH:mm:ss')
550
+ }
551
+ return f_install_date
552
+ }
553
+ },
554
+ // 表向
555
+ aroundmeters() {
556
+ return this.$appdata.getParam('左右表')
557
+ },
558
+ // 安装位置
559
+ positions() {
560
+ return this.$appdata.getParam('安装位置')
561
+ }
562
+ },
563
+ watch: {
564
+ }
565
+ }
566
+ </script>
567
+ <style scoped>
568
+ .head-but{
569
+ margin-left: 5px;
570
+ height: 34px;
571
+ /*background-color: #6aa6e2;*/
572
+ border-radius: 4px;
573
+ font-family: PingFang;
574
+ color: #ffffff;
575
+ }
576
+ /*清除model中的浮动*/
577
+ .clearfix:after,.clearfix:before{
578
+ display: table;
579
+ }
580
+ .clearfix:after{
581
+ clear: both;
582
+ }
583
+ .input_view{
584
+ padding: 8px;
585
+ background-color: #ffffff;
586
+ border-radius: 2px;
587
+ border: solid 1px #c7c7c7!important;
588
+ color: #333333!important;
589
+ font-size: 15px!important;
590
+ }
591
+
592
+ .input_view[readonly]{
593
+ border: 1px solid #DDD!important;
594
+ color:#ACA899!important;
595
+ }
596
+ .input_view:disabled{
597
+ border: 1px solid #DDD!important;
598
+ color:#ACA899!important;
599
+ }
600
+ </style>