address-client 3.2.59 → 3.2.61

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