address-client 4.0.12 → 4.0.13

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.
@@ -0,0 +1,639 @@
1
+ <template>
2
+ <div class="flex" @keyup.enter="search">
3
+ <criteria-paged :model="model" v-ref:paged>
4
+ <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
5
+ <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
6
+ <div class="row">
7
+ <div :class="$parent.$parent.style">
8
+ <label class="font_normal_body">组织机构</label>
9
+ <res-select
10
+ restype='organization'
11
+ @res-select="$parent.$parent.getorg"
12
+ is-mul="false"
13
+ :initresid='$parent.$parent.curorgid'
14
+ >
15
+ </res-select>
16
+ </div>
17
+ <div :class="$parent.$parent.style" v-if="$parent.$parent.showrightchange">
18
+ <label class="font_normal_body">客户编号</label>
19
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_userinfo_code" style="width:60%"
20
+ condition="f_userinfo_code = '{}'" placeholder="用户编号"/>
21
+ </div>
22
+ <div v-if="$parent.$parent.showrightchange" :class="$parent.$parent.style">
23
+ <label class="font_normal_body">小&emsp;&emsp;区</label>
24
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_residential_arearea" style="width:60%"
25
+ condition="a.f_residential_area like '%{}%'" placeholder="小区"
26
+ :size="model.f_residential_arearea ? model.f_residential_arearea.length*2 : 8"/>
27
+ </div>
28
+ <!--<div v-if="$parent.$parent.showrightchange" :class="$parent.$parent.style" v-if="!$parent.$parent.$parent.useraddressShow">-->
29
+ <div :class="$parent.$parent.style" v-if="$parent.$parent.$parent.showrightchange">
30
+ <label class="font_normal_body">楼&emsp;&emsp;号</label>
31
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_building" style="width:60%"
32
+ condition="a.f_building like '%{}%'" placeholder="楼号"
33
+ :size="model.f_building ? model.f_building.length*2 : 6"/>
34
+ </div>
35
+ <div class="col-sm-4 form-group button-range" >
36
+ <button class="button_search button_spacing" @click="search()" >查询</button>
37
+ <button class="button_new button_spacing" style="width: max-content" @click="$parent.$parent.add('民用')" v-if="this.$login.r.includes('添加民用')">添加民用</button>
38
+ <button class="button_new button_spacing" style="width: max-content" @click="$parent.$parent.add('非民用')" v-if="this.$login.r.includes('添加特殊地址')">添加特殊地址</button>
39
+ <button class="button_new button_spacing" style="width: max-content" v-show="this.$login.r.includes('批量修改')" @click="$parent.$parent.modifyBatch()">批量修改</button>
40
+ <button class="button_clear button_spacing" @click="$parent.$parent.clear()">清空</button>
41
+ <button class="button_export button_spacing" @click="$parent.$parent.importAddress('导入')" v-if="this.$login.r.includes('地址模板导入')">模板导入</button>
42
+ <button class="button_export button_spacing"
43
+ v-show="this.$login.r.includes('完善地址')"
44
+ @click="$parent.$parent.importAddress('完善')">完善地址</button>
45
+ <export-excel :data="$parent.$parent.getCondition"
46
+ :field="$parent.$parent.getfield"
47
+ sqlurl="api/af-revenue/logic/exportfile"
48
+ sql-name="addressGetAddress"
49
+ template-name='地址管理查询导出'
50
+ :choose-col="true"
51
+ v-if="this.$login.r.includes('地址管理查询导出')"
52
+ ></export-excel>
53
+ <div style="float: right" class="button_spacing" :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}" @click="$parent.$parent.hidden()"></div>
54
+ </div>
55
+ </div>
56
+ <div class="row" v-show="$parent.$parent.criteriaShow">
57
+ <div :class="$parent.$parent.style" v-if="!$parent.$parent.showrightchange">
58
+ <label class="font_normal_body">用户编号</label>
59
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_userinfo_code" style="width:60%"
60
+ condition="f_userinfo_code = '{}'" placeholder="用户编号"/>
61
+ </div>
62
+ <div v-if="!$parent.$parent.showrightchange" :class="$parent.$parent.style">
63
+ <label class="font_normal_body">小&emsp;&emsp;区</label>
64
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_residential_arearea" style="width:60%"
65
+ condition="a.f_residential_area like '%{}%'" placeholder="小区"
66
+ :size="model.f_residential_arearea ? model.f_residential_arearea.length*2 : 8"/>
67
+ </div>
68
+ <div :class="$parent.$parent.style" v-if="!$parent.$parent.$parent.showrightchange">
69
+ <label class="font_normal_body">楼&emsp;&emsp;号</label>
70
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_building" style="width:60%"
71
+ condition="a.f_building like '%{}%'" placeholder="楼号"
72
+ :size="model.f_building ? model.f_building.length*2 : 6"/>
73
+ </div>
74
+ <div :class="$parent.$parent.style" >
75
+ <label class="font_normal_body">单&emsp;&emsp;元</label>
76
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_unit" style="width:60%"
77
+ condition="a.f_unit like '%{}%'" placeholder="单元"
78
+ :size="model.f_unit ? model.f_unit.length*2 : 6"/>
79
+ </div>
80
+ <div :class="$parent.$parent.style">
81
+ <label class="font_normal_body">楼&emsp;&emsp;层</label>
82
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_floor" style="width:60%"
83
+ condition="a.f_floor like '%{}%'" placeholder="楼层"
84
+ :size="model.f_floor ? model.f_floor.length*2 : 6"/>
85
+ </div>
86
+ <div :class="$parent.$parent.style">
87
+ <label class="font_normal_body">门&ensp;牌&ensp;号</label>
88
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_room" style="width:60%"
89
+ condition="a.f_room like '%{}%'" placeholder="门牌号"
90
+ :size="model.f_room ? model.f_room.length*2 : 6"/>
91
+ </div>
92
+ <!-- <div :class="$parent.$parent.style">-->
93
+ <!-- <label class="font_normal_body">小&emsp;&emsp;区</label>-->
94
+ <!-- <input type="text" class="input_search" style="width:60%" v-model="model.f_residential_arearea" style="width:60%"-->
95
+ <!-- condition="a.f_residential_area like '%{}%'" placeholder="小区"-->
96
+ <!-- :size="model.f_residential_arearea ? model.f_residential_arearea.length*2 : 8"/>-->
97
+ <!-- </div>-->
98
+
99
+ <div :class="$parent.$parent.style">
100
+ <label class="font_normal_body">地址&emsp;ID</label>
101
+ <input type="text" class="input_search" style="width:60%" v-model="model.id" style="width:60%"
102
+ condition="a.id = '{}'" placeholder="地址ID"
103
+ />
104
+ </div>
105
+ <div :class="$parent.$parent.style" >
106
+ <label class="font_normal_body">客户地址</label>
107
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_address" style="width:60%"
108
+ condition="a.f_address like '%{}%'" placeholder="详细地址"
109
+ :size="model.f_address ? model.f_address.length*2 : 8"/>
110
+ </div>
111
+ <div :class="$parent.$parent.style" v-if="!$parent.$parent.$parent.showrightchange">
112
+ <label class="font_normal_body">街道/乡镇</label>
113
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_street"
114
+ condition="f_street like '%{}%'" placeholder="街道/乡镇"
115
+ :size="model.f_street ? model.f_street.length*2 : 6"/>
116
+ </div>
117
+ <div :class="$parent.$parent.style" >
118
+ <label class="font_normal_body">地址状态</label>
119
+ <v-select :value.sync="model.f_address_state"
120
+ class="select_list select"
121
+ v-model="model.f_address_state"
122
+ condition="a.f_address_state = '{}'"
123
+ :options='$parent.$parent.getaddresstate' placeholder='地址状态'
124
+ close-on-select>
125
+ </v-select>
126
+ </div>
127
+ <div :class="$parent.$parent.style" >
128
+ <label class="font_normal_body">状&emsp;&emsp;态</label>
129
+ <v-select :value.sync="model.f_state"
130
+ class="select_list select"
131
+ v-model="model.f_state"
132
+ condition="(a.f_state {} )"
133
+ :options='$parent.$parent.getstate' placeholder='地址状态'
134
+ close-on-select>
135
+ </v-select>
136
+ </div>
137
+ <div :class="$parent.$parent.style">
138
+ <label class="font_normal_body">用户名称</label>
139
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_user_name" style="width:60%"
140
+ condition="f_user_name = '{}'" placeholder="用户名称"/>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </criteria>
145
+ <data-grid :model="model" partial='list' style="overflow: auto" class="list_area table_sy" :optional="true" v-ref:grid>
146
+ <template partial='head'>
147
+ <th><nobr>序号</nobr></th>
148
+ <th><nobr>客户编号</nobr></th>
149
+ <th><nobr>客户名称</nobr></th>
150
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>区/县</nobr></th>
151
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>片区/管理站</nobr></th>
152
+ <th><nobr>街道/乡镇</nobr></th>
153
+ <th><nobr>小区(单位)</nobr></th>
154
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>楼号</nobr></th>
155
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>单元</nobr></th>
156
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>楼层</nobr></th>
157
+ <th v-show="!$parent.$parent.$parent.$parent.useraddressShow"><nobr>门牌号</nobr></th>
158
+ <th><nobr>客户地址</nobr></th>
159
+ <th><nobr>地址状态</nobr></th>
160
+ <th><nobr>状态</nobr></th>
161
+ <th><nobr>时间</nobr></th>
162
+ <th><nobr>备注</nobr></th>
163
+ <th><nobr>操作</nobr></th>
164
+ </template>
165
+ <template partial='body'>
166
+ <td style="text-align:center"><nobr>{{$index + 1}}</nobr></td>
167
+ <td style="text-align:center"><nobr>{{row.f_userinfo_code}}</nobr></td>
168
+ <td style="text-align:center"><nobr>{{row.f_user_name}}</nobr></td>
169
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_pcd}}</nobr></td>
170
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_slice_area}}</nobr></td>
171
+ <td style="text-align:center"><nobr>{{row.f_street}}</nobr></td>
172
+ <td style="text-align:center"><nobr>{{row.f_residential_area}}</nobr></td>
173
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_building}}{{row.f_building_suffix}}</nobr></td>
174
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_unit}}{{row.f_unit_suffix}}</nobr></td>
175
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_floor}}{{row.f_floor_suffix}}</nobr></td>
176
+ <td v-show="!$parent.$parent.$parent.$parent.useraddressShow" style="text-align:center"><nobr>{{row.f_room}}{{row.f_room_suffix}}</nobr></td>
177
+ <td style="text-align:center"><nobr>{{row.f_address}}</nobr></td>
178
+ <td style="text-align:center"><nobr>{{row.f_address_state}}</nobr></td>
179
+ <td style="text-align:center"><nobr>{{row.f_state ==='作废'?'作废':'有效'}}</nobr></td>
180
+ <td style="text-align:center"><nobr>{{row.f_create_date}}</nobr></td>
181
+ <td style="text-align:center"><nobr>{{row.f_comments}}</nobr></td>
182
+ <td style="text-align:center">
183
+ <!-- <button type="button" name="button" class="btn btn-link"
184
+ @click.stop="$parent.$parent.$parent.modify(row)">修改</button>-->
185
+ <button v-if="!row.f_useraddress_id" type="button" name="button" class="btn btn-danger"
186
+ style="padding: 5px 12px"
187
+ @click.stop="$parent.$parent.$parent.delete(row)">删除</button>
188
+ </td>
189
+ </template>
190
+ <template partial='foot'></template>
191
+ </data-grid>
192
+ </criteria-paged>
193
+ </div>
194
+ <work-busy :is-busy='isbusy'></work-busy>
195
+ <modal :show.sync="showFile" width="600px" v-ref:modal backdrop="true">
196
+ <header slot="modal-header" class="modal-header">
197
+ <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
198
+ <h4 class="modal-title">选择文件</h4>
199
+ </header>
200
+ <article slot="modal-body" class="modal-body">
201
+ <div class="form-group">
202
+ <file-upload class="my-file-uploader col-sm-9" name="useraddressUploadFile" action="rs/file/uploadFile" tagname="确定" multiple v-ref:file></file-upload>
203
+ <button class="button_clear btn-gn" style="margin-top: 10px;background-color: #6aa6e2;" @click="downloadFiles()">模板下载
204
+ </button>
205
+ </div>
206
+ </article>
207
+ <footer slot="modal-footer" class="modal-footer" style="display: none"></footer>
208
+ </modal>
209
+
210
+ <modal :show.sync="showModify" large backdrop="false" :width="900">
211
+ <header slot="modal-header" class="modal-header">
212
+ </header>
213
+ <article slot="modal-body" class="modal-body">
214
+
215
+ <validator name='v'>
216
+ <div class="auto select-overspread form-horizontal">
217
+ <div class="col-sm-6 form-group">
218
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
219
+ <input type="text" class="input_search" class="input_search" style="width:60%" v-show="false" v-model="areamodel.f_pcd_id">
220
+ <v-select
221
+ :value.sync="areamodel.f_pcd_id" :value-single="true"
222
+ :options='pcdslist' placeholder='请选择'
223
+ close-on-select search="true" @change="pcdChange">
224
+ </v-select>
225
+ </div>
226
+ <div class="col-sm-6 form-group"
227
+ :class="[$v.f_street_id.required ? 'has-error' : 'has-success']">
228
+ <label class="font_normal_body">街道名称</label>
229
+ <input type="text" style="width:60%" class="input_search" v-show="false" v-model="areamodel.f_street_id"
230
+ v-validate:f_street_id='{required: true }'>
231
+ <v-select
232
+ :value.sync="areamodel.f_street_id" :value-single="true"
233
+ :options='streetslist' placeholder='请选择'
234
+ close-on-select search="true" @change="streetChange">
235
+ </v-select>
236
+ </div>
237
+ <div class="col-sm-6 form-group " v-if="showModify"
238
+ :class="[$v.f_residential_area_id.required ? 'has-error' : 'has-success']">
239
+ <label class="font_normal_body">小区名称</label>
240
+ <input type="text" style="width:41%" v-show="false" v-model="areamodel.f_residential_area_id"
241
+ v-validate:f_area_id='{required: true }'>
242
+ <v-select :value.sync="areamodel.f_residential_area_id" :value-single="true"
243
+ :options='areaslist' placeholder='请选择'
244
+ @change=""
245
+ close-on-select search="true">
246
+ </v-select>
247
+ </div>
248
+ </div>
249
+ </validator>
250
+
251
+ </article>
252
+ <footer slot="modal-footer" class="modal-footer">
253
+ <button v-show="showModify" type="button" class="button_search button_spacing" @click='confirmModify()' :disabled='!$v.valid'>确认</button>
254
+ <button v-show="showModify" type="button" class="button_clear button_spacing" @click='cancelModify()'>取消</button>
255
+ </footer>
256
+ </modal>
257
+ </template>
258
+
259
+ <script>
260
+ import {HttpResetClass} from 'vue-client'
261
+ import { PagedList } from 'vue-client'
262
+ let readyGen = async function (self) {
263
+ self.getfield = self.config.excelHeaders
264
+ }
265
+ export default {
266
+ data () {
267
+ return {
268
+ criteriaShow: false,
269
+ model: new PagedList('api/af-revenue/sql/address_getAddress',20,{tablename: `'t_user_address'`,items: `'*'`,orderitem: `'id desc'`}),
270
+ config: {
271
+ // 导出列要和查询列相同
272
+ excelHeaders: {
273
+ 'f_user_name':'用户姓名',
274
+ 'f_userinfo_code':'用户编号',
275
+ 'id':'地址ID',
276
+ 'f_pcd':'区/县',
277
+ 'f_slice_area':'片区',
278
+ 'f_street':'街道',
279
+ 'f_residential_area':'小区',
280
+ 'f_building':'楼号',
281
+ 'f_unit':'单元',
282
+ 'f_floor':'楼层',
283
+ 'f_room':'门牌号',
284
+ 'f_address':'详细地址',
285
+ 'f_address_state':'地址状态',
286
+ 'f_create_date':'时间',
287
+ 'f_state':'状态'
288
+ },
289
+ },
290
+ isbusy:false,
291
+ addflag: false,
292
+ addtitle:'',
293
+ other: [],
294
+ footer: [],
295
+ getfield: {},
296
+ imptype:'',
297
+ // 公司下拉
298
+ curorgid: [this.$login.f.orgid],
299
+ f_orgid: '',
300
+ getstate:[{label:'全部',value:''},{label:'有效',value:" = '有效' or a.f_state is null"},{label:'作废',value:" = '作废'"}],
301
+ //文件上传弹框
302
+ showFile: false,
303
+ showrightchange:true,
304
+ showModify: false,
305
+ //小区
306
+ areamodel: {
307
+ f_area_id: '',
308
+ f_pcd_id:'',
309
+ f_street_id:'',
310
+ f_residential_area:'',
311
+ f_residential_area_id:''
312
+ },
313
+ //初始化省市区数据
314
+ pcdslist:[],
315
+ //初始化街道数据
316
+ streetslist:[],
317
+ //初始化街道数据
318
+ areaslist:[],
319
+ // 要修改的用户信息
320
+ userInfos: []
321
+ }
322
+ },
323
+ title: '地址列表',
324
+ props:{
325
+ f_filialeids:{
326
+ type: String
327
+ },
328
+ style: {
329
+ type: String,
330
+ default: 'col-sm-2 '
331
+ }
332
+ },
333
+ ready(){
334
+ readyGen(this)
335
+ this.search()
336
+ this.initpcds(`f_filialeid = '${this.f_filialeids}'`)
337
+ this.initareas(`f_filialeid = '${this.f_filialeids}'`)
338
+ //this.$refs.paged.$refs.grid.selectInit()
339
+ },
340
+ methods: {
341
+ downloadFiles(){
342
+ let downurl='rs/downloadfile/file?filename=地址导入Excel模板';
343
+ this.$resetget(downurl,{}).then(res=>{
344
+ var link = document.createElement('a');
345
+ link.target="_blank"
346
+ link.href =downurl ;
347
+ link.setAttribute("download", "地址导入Excel模板.xlsx"); //指定下载后的文件名,防跳转
348
+ document.body.appendChild(link);
349
+ link.click();
350
+ })
351
+
352
+
353
+ },
354
+ getotherfooter() {
355
+ // this.$refs.paged.$refs.cri.$refs.exports.otherData=[];
356
+ // this.$refs.paged.$refs.cri.$refs.exports.footerData=[];
357
+ this.other = [];
358
+ this.footer = [];
359
+ // let exportdata = this.getCondition;
360
+ let otherInData = [];
361
+ otherInData.push(`导出时间: ${this.$login.toStandardTimeString()}`);
362
+ let footerData = [], exportfield = this.getfield;
363
+ footerData.push("合计");
364
+ let self = this;
365
+ for (var field in self.sumsmodel) {
366
+ footerData.push(`${exportfield[field]}合计:${self.sumsmodel[field]}`);
367
+ }
368
+ this.footer.push(footerData);
369
+ this.other.push(otherInData);
370
+ },
371
+ hidden() {
372
+ this.criteriaShow = !this.criteriaShow
373
+ },
374
+ //添加方法
375
+ add(val){
376
+ if (this.f_filialeids) {
377
+ this.$refs.paged.$refs.grid.selectStore.selected = null
378
+ this.$dispatch('add',val)
379
+ this.showrightchange = false;
380
+ } else {
381
+ this.$showAlert('请先选择左上角的所在分公司', 'warning', 2000)
382
+ }
383
+ },
384
+ importAddress(val){
385
+ this.imptype = val
386
+ this.showFile = true
387
+ },
388
+ // 关闭文件上传对话框
389
+ closeFile() {
390
+ this.showFile = false
391
+ // 将选的文件清空
392
+ this.$refs.file.$el.querySelector('input').value = ''
393
+ },
394
+ //修改
395
+ modify(val){
396
+ this.$refs.paged.$refs.grid.selectStore.selected = null
397
+ this.$dispatch('modify',val)
398
+ },
399
+ async delete(row){
400
+ if(row.id >= 0){
401
+ var id = row.id
402
+ let userfiles = await this.$resetpost('api/af-revenue/sql/address_singleTable', {data: {items: 'f_useraddress_id',tablename: 't_userfiles',condition: `f_useraddress_id='${id}' and f_table_state = '正常'`}},{resolveMsg: null, rejectMsg: null})
403
+ if(userfiles.data.length){
404
+ this.$showAlert('该地址下已有正常表具档案,无法删除!','warning',1000)
405
+ }else{
406
+ this.$resetdelete('api/af-revenue/entity/t_user_address', {id: id}, {resolveMsg: '删除成功', rejectMsg: '删除失败'}).then((res) => {
407
+ this.$dispatch('cancel')
408
+ })
409
+ }
410
+ }
411
+ },
412
+ search () {
413
+ this.$refs.paged.$refs.cri.search()
414
+ },
415
+ selfSearch (args) {
416
+ if (!this.f_orgid) {
417
+ this.getorg([this.$login.f.orgid])
418
+ }
419
+ args.condition = `${args.condition} and a.f_filialeid = '${this.f_filialeids}'`
420
+ this.model.search(args.condition, args.model)
421
+ },
422
+
423
+ //清空
424
+ clear(){
425
+ this.$refs.paged.$refs.cri.model = {}
426
+ this.$refs.paged.$refs.grid.selectInit()
427
+ },
428
+ getorg (val) {
429
+ this.f_orgid = this.$login.convertToIn(val)
430
+ this.f_filialeids = val[0]
431
+ },
432
+ async modifyBatch () {
433
+ if (this.f_filialeids) {
434
+ if (this.$refs.paged.$refs.grid.getRowData().length != 0) {
435
+ this.areamodel.f_pcd_id = this.$refs.paged.$refs.grid.getRowData()[0].f_pcd_id
436
+ this.showModify = true
437
+ } else {
438
+ this.$showAlert('请至少选择一项!', 'warning', 2000)
439
+ }
440
+ }else {
441
+ this.$showAlert('请先选择左上角的所在分公司', 'warning', 2000)
442
+ }
443
+ },
444
+ confirmModify () {
445
+ this.userInfos = []
446
+ this.$refs.paged.$refs.grid.getRowData().forEach((row,n) => {
447
+ this.userInfos[n] = {
448
+ addressid: row.id,
449
+ f_residential_area: row.f_residential_area,
450
+ f_street: row.f_street,
451
+ f_address: row.f_address,
452
+ f_address_rest: (row.f_building?row.f_building+row.f_building_suffix:'') + (row.f_unit?row.f_unit+row.f_unit_suffix:'') + (row.f_floor?row.f_floor+row.f_floor_suffix:'') + (row.f_room?row.f_room+row.f_room_suffix:'')
453
+ }
454
+ })
455
+ let modifyBatchData = {
456
+ userInfos: this.userInfos,
457
+ f_pcd_id: this.areamodel.f_pcd_id,
458
+ f_residential_area_id: this.areamodel.f_residential_area_id,
459
+ f_street_id: this.areamodel.f_street_id,
460
+ f_operator: this.$login.f.name,
461
+ f_operatorid: this.$login.f.id,
462
+ f_orgid: this.$login.f.orgid,
463
+ f_orgname: this.$login.f.orgs,
464
+ f_depid: this.$login.f.depids,
465
+ f_depname: this.$login.f.deps,
466
+ f_filialeid: this.f_filialeids
467
+ }
468
+ this.$resetpost('api/af-revenue/logic/modifyBatch',modifyBatchData)
469
+ this.initpcds(`f_filialeid = '${this.f_filialeids}'`)
470
+ this.showModify = false
471
+ this.$refs.paged.$refs.grid.selectInit()
472
+ this.$refs.paged.$refs.cri.search()
473
+ },
474
+ cancelModify() {
475
+ this.initpcds(`f_filialeid = '${this.f_filialeids}'`)
476
+ this.showModify = false
477
+ this.$refs.paged.$refs.grid.selectInit()
478
+ },
479
+
480
+ //初始化省市区,添加街道
481
+ async initpcds(pconditon){
482
+ this.pcdslist = []
483
+ let HttpReset = new HttpResetClass()
484
+ let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
485
+ data: {
486
+ items: '*',
487
+ tablename: 't_pcd',
488
+ orderitem: 'id',
489
+ condition: pconditon
490
+ }
491
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
492
+ let redata = []
493
+ req.data.forEach((row, n) => {
494
+ redata[n] = {
495
+ label: row.f_pcd,
496
+ value: row.id,
497
+ data:row,
498
+ id:row.id
499
+ }
500
+ })
501
+ this.pcdslist=redata
502
+ },
503
+
504
+ //初始化街道
505
+ async initstreets(pconditon){
506
+ this.streetslist = []
507
+ let HttpReset = new HttpResetClass()
508
+ let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
509
+ data: {
510
+ items: '*',
511
+ tablename: 't_street',
512
+ orderitem: 'id',
513
+ condition: pconditon
514
+ }
515
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
516
+ let redata = []
517
+ req.data.forEach((row, n) => {
518
+ redata[n] = {
519
+ label: row.f_street,
520
+ value: row.id,
521
+ data:row,
522
+ id:row.id
523
+ }
524
+ })
525
+ this.streetslist=redata
526
+ },
527
+ //初始化小区
528
+ async initareas(pconditon){
529
+ this.areaslist = []
530
+ let HttpReset = new HttpResetClass()
531
+ let req = await HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
532
+ data: {
533
+ items: '*',
534
+ tablename: 't_area',
535
+ orderitem: 'id',
536
+ condition: pconditon
537
+ }
538
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
539
+ let redata = []
540
+ req.data.forEach((row) => {
541
+ redata.push({
542
+ label: row.f_residential_area,
543
+ value: row.id,
544
+ data: row,
545
+ id: row.id
546
+ })
547
+ })
548
+ this.areaslist=redata
549
+ },
550
+
551
+
552
+ //省/市/区变化
553
+ async pcdChange(val){
554
+ if(val){
555
+ //那就把街道数据重新组织一下
556
+ await this.initstreets(` f_filialeid = '${this.f_filialeids}' and f_pcd_id ='${val}' `)
557
+ if(this.areamodel.f_street_id){
558
+ if (this.findbyid(this.streetslist,this.areamodel.f_street_id)) {
559
+ let pcd_id=this.findbyid(this.streetslist,this.areamodel.f_street_id).f_pcd_id
560
+ if(pcd_id!=val){
561
+ this.areamodel.f_street_id=''
562
+ }
563
+ } else {
564
+ this.areamodel.f_street_id=''
565
+ }
566
+ }
567
+ }
568
+ this.$resetValidation()
569
+ },
570
+ //街道变化
571
+ async streetChange(val){
572
+ if(val){
573
+ await this.initareas(` f_filialeid = '${this.f_filialeids}' and f_street_id ='${val}' `)
574
+ if(this.areamodel.f_area_id){
575
+ if (this.findbyid(this.areaslist,this.areamodel.f_area_id)) {
576
+ let street_id=this.findbyid(this.areaslist,this.areamodel.f_area_id).f_street_id
577
+ if(street_id!=val){
578
+ this.areamodel.f_area_id=''
579
+ }
580
+ } else {
581
+ this.areamodel.f_area_id=''
582
+ }
583
+ }
584
+ }
585
+ this.$resetValidation()
586
+ },
587
+ //根据名字找数据
588
+ findbyid(list,name){
589
+ var result
590
+ list.forEach((row, n) => {
591
+ if(name==row.id){
592
+ result= row.data
593
+ }
594
+ })
595
+ return result
596
+ },
597
+ },
598
+ events: {
599
+ onFileUpload: async function (file, res) {
600
+ this.isbusy = true
601
+ console.log("上传完毕"+JSON.stringify(res))
602
+ let data = {
603
+ filepath: res.f_downloadpath,
604
+ user:this.$login.f,
605
+ type :this.imptype
606
+ }
607
+ console.log("filepath="+JSON.stringify(data))
608
+ await this.$resetpost(`api/af-revenue/logic/address_useraddressimport`,data, {resolveMsg: null, rejectMsg: '导入失败', silent: true}, 0).then((res)=>{
609
+ this.isbusy = false
610
+ if(res.data.type=="success"){
611
+ this.$showAlert("导入信息:"+res.data.msg, res.data.type, 2000);
612
+ }else{
613
+ this.$showMessage(res.data.msg);
614
+ }
615
+ //关闭上传框
616
+ this.closeFile()
617
+ //重新查询
618
+ this.init()
619
+ }).catch(error=>{
620
+ this.isbusy = false
621
+ })
622
+ },
623
+ 'onFileError'(error) {
624
+ this.$showAlert(error, 'warning', 2000)
625
+ }
626
+ },
627
+ computed: {
628
+ //地址状态下拉框
629
+ getaddresstate() {
630
+ return [{label: '全部', value: ''}, ...this.$appdata.getParam('地址状态')]
631
+ },
632
+ getCondition() {
633
+ return {
634
+ condition: `${this.$refs.paged.$refs.cri.condition}` + `and a.f_filialeid = '${this.f_filialeids}'`}
635
+ }
636
+ }
637
+
638
+ }
639
+ </script>