apply-clients 3.3.59 → 3.3.63

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,596 +1,596 @@
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_position': '安装位置'
306
- },
307
- showWork: false
308
- }
309
- },
310
- ready () {
311
- this.search()
312
- this.getMeterbrands()
313
- if (this.selectdata.f_apply_type === '团购报建') {
314
- this.notInstalled()
315
- }
316
- },
317
- methods: {
318
- // 删除未保存的表具
319
- async deleteUserFile (index) {
320
- this.userinfo.userfiles.splice(index, 1)
321
- },
322
- // 追加表具
323
- addUserFile() {
324
- this.userinfo.userfiles.push({})
325
- },
326
- // 保存档案
327
- async saveUserFile() {
328
- // 检查必填项
329
- for (let i = 0; i < this.userinfo.userfiles.length; i++) {
330
- let userfile = this.userinfo.userfiles[i]
331
- if (userfile.f_gasbrand_id === null || userfile.f_gasbrand_id === '') {
332
- this.$showMessage(`表具${i+1}气表品牌没有选择!!!`)
333
- return
334
- }
335
- if (userfile.f_gasmodel_id === null || userfile.f_gasmodel_id === '') {
336
- this.$showMessage(`表具${i+1}气表型号没有选择!!!`)
337
- return
338
- }
339
- if (userfile.f_meternumber === null || userfile.f_meternumber === '') {
340
- this.$showMessage(`表具${i+1}表号没有填写!!!`)
341
- return
342
- }
343
- }
344
- let data = {
345
- user: this.$login.f,
346
- useradders: this.useradders,
347
- userinfo: this.userinfo,
348
- selectdata: this.selectdata
349
- }
350
- let res = await this.$resetpost('rs/logic/addInstallationDetails', {data:data}, {
351
- resolveMsg: null,
352
- rejectMsg: '表具添加失败!!!'
353
- })
354
- this.$dispatch('breakControl', this.selectdata)
355
- },
356
- // 检查表号是否存在
357
- async meternumberValidate(i) {
358
- if (!this.userinfo.userfiles[i].f_gasbrand_id) {
359
- this.userinfo.userfiles[i].f_meternumber = ''
360
- this.$showAlert('请先选择气表品牌!!!', 'warning', 3000)
361
- return
362
- }
363
- if (this.userinfo.userfiles[i].f_gasbrand_id && this.userinfo.userfiles[i].f_meternumber) {
364
- let data = {
365
- f_meternumber: this.userinfo.userfiles[i].f_meternumber,
366
- f_gasbrand_id: this.userinfo.userfiles[i].f_gasbrand_id
367
- }
368
- if (this.userinfo.userfiles[i].f_userfiles_id) {
369
- data.f_userfiles_id = this.userinfo.userfiles[i].f_userfiles_id
370
- }
371
- let res = await this.$resetpost('rs/logic/meterbrandsNumberValidate', {data:data}, {
372
- resolveMsg: null,
373
- rejectMsg: '表号验证失败!!'
374
- })
375
- if (res.data) {
376
- this.userinfo.userfiles[i].f_meternumber = ''
377
- this.$showAlert('表号已存在!!', 'warning', 3000)
378
- }
379
- }
380
- },
381
- // 选择气表型号
382
- gasmodelChange(i) {
383
- if (this.userinfo.userfiles[i].gasmodel) {
384
- this.userinfo.userfiles[i].f_gasmodel_id = this.userinfo.userfiles[i].gasmodel.id
385
- }
386
- },
387
- // 选择气表品牌
388
- gasbrandChange(i) {
389
- // 清空已保存的气表型号
390
- this.userinfo.userfiles[i].f_gasmodel_id = null
391
- this.userinfo.userfiles[i].gasmodel = null
392
-
393
- if (this.userinfo.userfiles[i].gasbrand) {
394
- // 气表品牌id
395
- this.userinfo.userfiles[i].f_gasbrand_id = this.userinfo.userfiles[i].gasbrand.id
396
- // 气表分类
397
- this.userinfo.userfiles[i].f_meter_classify = this.userinfo.userfiles[i].gasbrand.f_meter_type
398
- }
399
- },
400
- // 打开安装明细
401
- async showUserFileModal (row) {
402
- this.useradders = row
403
-
404
- let http = new HttpResetClass()
405
- let data = {
406
- condition: `f_userinfo_id = '${row.f_userinfo_id}'`
407
- }
408
- let res = await http.load('POST', 'rs/logic/getUserinfoAndUserfiles', {data:data}, {
409
- resolveMsg: null,
410
- rejectMsg: null
411
- })
412
-
413
- this.userinfo = res.data
414
-
415
- // 已有表具的 气表信息补充
416
- for (let i = 0; i < this.userinfo.userfiles.length; i++) {
417
- for (const item of this.meterbrands) {
418
- if (item.value.id === this.userinfo.userfiles[i].f_gasbrand_id) {
419
- // this.userinfo.userfiles[i].gasbrand = item.value // 防止双向绑定失败
420
- Vue.set(this.userinfo.userfiles[i], 'gasbrand', item.value)
421
- }
422
- }
423
- if (this.userinfo.userfiles[i].gasbrand) {
424
- for (const item of this.userinfo.userfiles[i].gasbrand.gasmodel) {
425
- if (item.value.id === this.userinfo.userfiles[i].f_gasmodel_id) {
426
- // this.userinfo.userfiles[i].gasmodel = item.value
427
- Vue.set(this.userinfo.userfiles[i], 'gasmodel', item.value)
428
- }
429
- }
430
- }
431
- }
432
-
433
- this.showUserFile = true
434
- },
435
- // 获取气表品牌
436
- async getMeterbrands() {
437
- let http = new HttpResetClass()
438
- let data = {
439
- f_orgid: this.$login.f.orgid
440
- }
441
- let res = await http.load('POST', 'rs/logic/getMeterbrands', {data:data}, {
442
- resolveMsg: null,
443
- rejectMsg: null
444
- })
445
- this.meterbrands = res.data
446
- },
447
- async notInstalled () {
448
- let http = new HttpResetClass()
449
- let data = {
450
- condition: `ui.f_process_id = '${this.selectdata.f_process_id}' and uf.f_table_state = '待开通'`
451
- }
452
- let res = await http.load(
453
- 'POST',
454
- 'rs/sql/countApplyUserinfo',
455
- {data: data},
456
- {
457
- resolveMsg: null,
458
- rejectMsg: '安装数量查询失败!!!'
459
- })
460
-
461
- for (const item of this.selectdata.fields) {
462
- if (item.label === '已安装户数') {
463
- item.value = this.selectdata.f_apply_count - res.data[0].num
464
- }
465
- if (item.label === '未安装户数') {
466
- item.value = res.data[0].num
467
- }
468
- }
469
- },
470
- searchCondition (args) {
471
-
472
- if (this.selectdata.f_apply_type === '团购转散户' || this.selectdata.f_apply_type === '改管报建' || this.selectdata.f_apply_type === '增容报建') {
473
- args.condition = args.condition + `and ui.f_userinfo_id = '${this.selectdata.f_userinfo_id}'`
474
- } else {
475
- args.condition = args.condition + `and ua.f_process_id = '${this.selectdata.f_process_id}'`
476
- }
477
-
478
- this.model.search(args.condition, args.model)
479
- },
480
- // 查询
481
- async search () {
482
- this.$refs.cp.$refs.cri.search()
483
- },
484
- // 关闭安装明细
485
- closeUserFile() {
486
- this.showUserFile = false
487
- this.useradders = null
488
- this.userinfo = {}
489
- this.search()
490
- },
491
- // 关闭文件上传对话框
492
- closeFile() {
493
- this.showWork = false
494
- this.showFile = false
495
- // 将选的文件清空
496
- this.$refs.file.$el.querySelector('input').value = ''
497
- this.search()
498
- }
499
- },
500
- events: {
501
- 'beforeFileUpload' (file) {
502
- this.showWork = true
503
- },
504
- async 'onFileUpload'(file, result) {
505
- let data = {
506
- selectdata: this.selectdata,
507
- filepath: result.f_downloadpath,
508
- user: this.$login.f
509
- }
510
- try {
511
- let res = await this.$resetpost(`rs/logic/importAddInstallationDetails`, {data: data}, {
512
- resolveMsg: null,
513
- rejectMsg: '导入失败!!!',
514
- silent: true
515
- }, 0)
516
- } catch (e) {
517
- this.closeFile()
518
- }
519
- this.$dispatch('breakControl', this.selectdata)
520
- }
521
- },
522
- computed: {
523
- pager () {
524
- return this.selectdata.f_apply_type === '团购报建'
525
- },
526
- getCondition () {
527
- let condition = `ua.f_process_id = '${this.selectdata.f_process_id}' and nvl(uf.quantity, 0) < 1`
528
-
529
- return {
530
- condition: condition
531
- }
532
- },
533
- // 安装人
534
- installperson() {
535
- return function (f_install_person) {
536
- if (isEmpty(f_install_person)) {
537
- return this.$login.f.name
538
- }
539
- return f_install_person
540
- }
541
- },
542
- installdate() {
543
- return function (f_install_date) {
544
- if (isEmpty(f_install_date)) {
545
- return new Date().Format('yyyy-MM-dd HH:mm:ss')
546
- }
547
- return f_install_date
548
- }
549
- },
550
- // 表向
551
- aroundmeters() {
552
- return this.$appdata.getParam('左右表')
553
- },
554
- // 安装位置
555
- positions() {
556
- return this.$appdata.getParam('安装位置')
557
- }
558
- },
559
- watch: {
560
- }
561
- }
562
- </script>
563
- <style scoped>
564
- .head-but{
565
- margin-left: 5px;
566
- height: 34px;
567
- /*background-color: #6aa6e2;*/
568
- border-radius: 4px;
569
- font-family: PingFang;
570
- color: #ffffff;
571
- }
572
- /*清除model中的浮动*/
573
- .clearfix:after,.clearfix:before{
574
- display: table;
575
- }
576
- .clearfix:after{
577
- clear: both;
578
- }
579
- .input_view{
580
- padding: 8px;
581
- background-color: #ffffff;
582
- border-radius: 2px;
583
- border: solid 1px #c7c7c7!important;
584
- color: #333333!important;
585
- font-size: 15px!important;
586
- }
587
-
588
- .input_view[readonly]{
589
- border: 1px solid #DDD!important;
590
- color:#ACA899!important;
591
- }
592
- .input_view:disabled{
593
- border: 1px solid #DDD!important;
594
- color:#ACA899!important;
595
- }
596
- </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
+ 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_position': '安装位置'
306
+ },
307
+ showWork: false
308
+ }
309
+ },
310
+ ready () {
311
+ this.search()
312
+ this.getMeterbrands()
313
+ if (this.selectdata.f_apply_type === '团购报建') {
314
+ this.notInstalled()
315
+ }
316
+ },
317
+ methods: {
318
+ // 删除未保存的表具
319
+ async deleteUserFile (index) {
320
+ this.userinfo.userfiles.splice(index, 1)
321
+ },
322
+ // 追加表具
323
+ addUserFile() {
324
+ this.userinfo.userfiles.push({})
325
+ },
326
+ // 保存档案
327
+ async saveUserFile() {
328
+ // 检查必填项
329
+ for (let i = 0; i < this.userinfo.userfiles.length; i++) {
330
+ let userfile = this.userinfo.userfiles[i]
331
+ if (userfile.f_gasbrand_id === null || userfile.f_gasbrand_id === '') {
332
+ this.$showMessage(`表具${i+1}气表品牌没有选择!!!`)
333
+ return
334
+ }
335
+ if (userfile.f_gasmodel_id === null || userfile.f_gasmodel_id === '') {
336
+ this.$showMessage(`表具${i+1}气表型号没有选择!!!`)
337
+ return
338
+ }
339
+ if (userfile.f_meternumber === null || userfile.f_meternumber === '') {
340
+ this.$showMessage(`表具${i+1}表号没有填写!!!`)
341
+ return
342
+ }
343
+ }
344
+ let data = {
345
+ user: this.$login.f,
346
+ useradders: this.useradders,
347
+ userinfo: this.userinfo,
348
+ selectdata: this.selectdata
349
+ }
350
+ let res = await this.$resetpost('rs/logic/addInstallationDetails', {data:data}, {
351
+ resolveMsg: null,
352
+ rejectMsg: '表具添加失败!!!'
353
+ })
354
+ this.$dispatch('breakControl', this.selectdata)
355
+ },
356
+ // 检查表号是否存在
357
+ async meternumberValidate(i) {
358
+ if (!this.userinfo.userfiles[i].f_gasbrand_id) {
359
+ this.userinfo.userfiles[i].f_meternumber = ''
360
+ this.$showAlert('请先选择气表品牌!!!', 'warning', 3000)
361
+ return
362
+ }
363
+ if (this.userinfo.userfiles[i].f_gasbrand_id && this.userinfo.userfiles[i].f_meternumber) {
364
+ let data = {
365
+ f_meternumber: this.userinfo.userfiles[i].f_meternumber,
366
+ f_gasbrand_id: this.userinfo.userfiles[i].f_gasbrand_id
367
+ }
368
+ if (this.userinfo.userfiles[i].f_userfiles_id) {
369
+ data.f_userfiles_id = this.userinfo.userfiles[i].f_userfiles_id
370
+ }
371
+ let res = await this.$resetpost('rs/logic/meterbrandsNumberValidate', {data:data}, {
372
+ resolveMsg: null,
373
+ rejectMsg: '表号验证失败!!'
374
+ })
375
+ if (res.data) {
376
+ this.userinfo.userfiles[i].f_meternumber = ''
377
+ this.$showAlert('表号已存在!!', 'warning', 3000)
378
+ }
379
+ }
380
+ },
381
+ // 选择气表型号
382
+ gasmodelChange(i) {
383
+ if (this.userinfo.userfiles[i].gasmodel) {
384
+ this.userinfo.userfiles[i].f_gasmodel_id = this.userinfo.userfiles[i].gasmodel.id
385
+ }
386
+ },
387
+ // 选择气表品牌
388
+ gasbrandChange(i) {
389
+ // 清空已保存的气表型号
390
+ this.userinfo.userfiles[i].f_gasmodel_id = null
391
+ this.userinfo.userfiles[i].gasmodel = null
392
+
393
+ if (this.userinfo.userfiles[i].gasbrand) {
394
+ // 气表品牌id
395
+ this.userinfo.userfiles[i].f_gasbrand_id = this.userinfo.userfiles[i].gasbrand.id
396
+ // 气表分类
397
+ this.userinfo.userfiles[i].f_meter_classify = this.userinfo.userfiles[i].gasbrand.f_meter_type
398
+ }
399
+ },
400
+ // 打开安装明细
401
+ async showUserFileModal (row) {
402
+ this.useradders = row
403
+
404
+ let http = new HttpResetClass()
405
+ let data = {
406
+ condition: `f_userinfo_id = '${row.f_userinfo_id}'`
407
+ }
408
+ let res = await http.load('POST', 'rs/logic/getUserinfoAndUserfiles', {data:data}, {
409
+ resolveMsg: null,
410
+ rejectMsg: null
411
+ })
412
+
413
+ this.userinfo = res.data
414
+
415
+ // 已有表具的 气表信息补充
416
+ for (let i = 0; i < this.userinfo.userfiles.length; i++) {
417
+ for (const item of this.meterbrands) {
418
+ if (item.value.id === this.userinfo.userfiles[i].f_gasbrand_id) {
419
+ // this.userinfo.userfiles[i].gasbrand = item.value // 防止双向绑定失败
420
+ Vue.set(this.userinfo.userfiles[i], 'gasbrand', item.value)
421
+ }
422
+ }
423
+ if (this.userinfo.userfiles[i].gasbrand) {
424
+ for (const item of this.userinfo.userfiles[i].gasbrand.gasmodel) {
425
+ if (item.value.id === this.userinfo.userfiles[i].f_gasmodel_id) {
426
+ // this.userinfo.userfiles[i].gasmodel = item.value
427
+ Vue.set(this.userinfo.userfiles[i], 'gasmodel', item.value)
428
+ }
429
+ }
430
+ }
431
+ }
432
+
433
+ this.showUserFile = true
434
+ },
435
+ // 获取气表品牌
436
+ async getMeterbrands() {
437
+ let http = new HttpResetClass()
438
+ let data = {
439
+ f_orgid: this.$login.f.orgid
440
+ }
441
+ let res = await http.load('POST', 'rs/logic/getMeterbrands', {data:data}, {
442
+ resolveMsg: null,
443
+ rejectMsg: null
444
+ })
445
+ this.meterbrands = res.data
446
+ },
447
+ async notInstalled () {
448
+ let http = new HttpResetClass()
449
+ let data = {
450
+ condition: `ui.f_process_id = '${this.selectdata.f_process_id}' and uf.f_table_state = '待开通'`
451
+ }
452
+ let res = await http.load(
453
+ 'POST',
454
+ 'rs/sql/countApplyUserinfo',
455
+ {data: data},
456
+ {
457
+ resolveMsg: null,
458
+ rejectMsg: '安装数量查询失败!!!'
459
+ })
460
+
461
+ for (const item of this.selectdata.fields) {
462
+ if (item.label === '已安装户数') {
463
+ item.value = this.selectdata.f_apply_count - res.data[0].num
464
+ }
465
+ if (item.label === '未安装户数') {
466
+ item.value = res.data[0].num
467
+ }
468
+ }
469
+ },
470
+ searchCondition (args) {
471
+
472
+ if (this.selectdata.f_apply_type === '团购转散户' || this.selectdata.f_apply_type === '改管报建' || this.selectdata.f_apply_type === '增容报建') {
473
+ args.condition = args.condition + `and ui.f_userinfo_id = '${this.selectdata.f_userinfo_id}'`
474
+ } else {
475
+ args.condition = args.condition + `and ua.f_process_id = '${this.selectdata.f_process_id}'`
476
+ }
477
+
478
+ this.model.search(args.condition, args.model)
479
+ },
480
+ // 查询
481
+ async search () {
482
+ this.$refs.cp.$refs.cri.search()
483
+ },
484
+ // 关闭安装明细
485
+ closeUserFile() {
486
+ this.showUserFile = false
487
+ this.useradders = null
488
+ this.userinfo = {}
489
+ this.search()
490
+ },
491
+ // 关闭文件上传对话框
492
+ closeFile() {
493
+ this.showWork = false
494
+ this.showFile = false
495
+ // 将选的文件清空
496
+ this.$refs.file.$el.querySelector('input').value = ''
497
+ this.search()
498
+ }
499
+ },
500
+ events: {
501
+ 'beforeFileUpload' (file) {
502
+ this.showWork = true
503
+ },
504
+ async 'onFileUpload'(file, result) {
505
+ let data = {
506
+ selectdata: this.selectdata,
507
+ filepath: result.f_downloadpath,
508
+ user: this.$login.f
509
+ }
510
+ try {
511
+ let res = await this.$resetpost(`rs/logic/importAddInstallationDetails`, {data: data}, {
512
+ resolveMsg: null,
513
+ rejectMsg: '导入失败!!!',
514
+ silent: true
515
+ }, 0)
516
+ } catch (e) {
517
+ this.closeFile()
518
+ }
519
+ this.$dispatch('breakControl', this.selectdata)
520
+ }
521
+ },
522
+ computed: {
523
+ pager () {
524
+ return this.selectdata.f_apply_type === '团购报建'
525
+ },
526
+ getCondition () {
527
+ let condition = `ua.f_process_id = '${this.selectdata.f_process_id}' and nvl(uf.quantity, 0) < 1`
528
+
529
+ return {
530
+ condition: condition
531
+ }
532
+ },
533
+ // 安装人
534
+ installperson() {
535
+ return function (f_install_person) {
536
+ if (isEmpty(f_install_person)) {
537
+ return this.$login.f.name
538
+ }
539
+ return f_install_person
540
+ }
541
+ },
542
+ installdate() {
543
+ return function (f_install_date) {
544
+ if (isEmpty(f_install_date)) {
545
+ return new Date().Format('yyyy-MM-dd HH:mm:ss')
546
+ }
547
+ return f_install_date
548
+ }
549
+ },
550
+ // 表向
551
+ aroundmeters() {
552
+ return this.$appdata.getParam('左右表')
553
+ },
554
+ // 安装位置
555
+ positions() {
556
+ return this.$appdata.getParam('安装位置')
557
+ }
558
+ },
559
+ watch: {
560
+ }
561
+ }
562
+ </script>
563
+ <style scoped>
564
+ .head-but{
565
+ margin-left: 5px;
566
+ height: 34px;
567
+ /*background-color: #6aa6e2;*/
568
+ border-radius: 4px;
569
+ font-family: PingFang;
570
+ color: #ffffff;
571
+ }
572
+ /*清除model中的浮动*/
573
+ .clearfix:after,.clearfix:before{
574
+ display: table;
575
+ }
576
+ .clearfix:after{
577
+ clear: both;
578
+ }
579
+ .input_view{
580
+ padding: 8px;
581
+ background-color: #ffffff;
582
+ border-radius: 2px;
583
+ border: solid 1px #c7c7c7!important;
584
+ color: #333333!important;
585
+ font-size: 15px!important;
586
+ }
587
+
588
+ .input_view[readonly]{
589
+ border: 1px solid #DDD!important;
590
+ color:#ACA899!important;
591
+ }
592
+ .input_view:disabled{
593
+ border: 1px solid #DDD!important;
594
+ color:#ACA899!important;
595
+ }
596
+ </style>