address-client 3.0.34-aodeToV4 → 3.0.35-aode

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.gradle/buildOutputCleanup/cache.properties +2 -2
  2. package/AddressClient.iml +12 -12
  3. package/CHANGELOG.md +12 -12
  4. package/build/dev-server.js +128 -128
  5. package/build/webpack.base.conf.js +81 -81
  6. package/examples/showAdd/App.vue +40 -40
  7. package/index.html +40 -40
  8. package/package.json +105 -105
  9. package/src/address.js +58 -58
  10. package/src/components/AddAreaMsg.vue +599 -599
  11. package/src/components/AddStreetOrPcd.vue +231 -231
  12. package/src/components/AddressAddAddress.vue +479 -479
  13. package/src/components/AddressFiles.vue +156 -156
  14. package/src/components/AddressList.vue +323 -323
  15. package/src/components/AddressManage.vue +117 -117
  16. package/src/components/AddressTree.vue +501 -501
  17. package/src/components/AreaFiles.vue +73 -73
  18. package/src/components/AreaList.vue +357 -357
  19. package/src/components/AreaManage.vue +101 -101
  20. package/src/components/AreaTree.vue +508 -508
  21. package/src/components/Basch.vue +72 -72
  22. package/src/components/BatchOrders.vue +328 -328
  23. package/src/components/CityManage.vue +76 -76
  24. package/src/components/NewAddressInfo.vue +432 -432
  25. package/src/components/OneCodeList.vue +251 -251
  26. package/src/components/StreetList.vue +184 -184
  27. package/src/components/UserAddress.vue +781 -780
  28. package/src/components/UserAddressChange.vue +58 -58
  29. package/src/components/addressts/AddressListts.vue +307 -307
  30. package/src/components/addressts/AddressManagets.vue +117 -117
  31. package/src/components/addressts/UserAddressChangets.vue +58 -58
  32. package/src/components/addressts/UserAddressts.vue +740 -739
  33. package/src/components/areauser/AreaUser.vue +233 -233
  34. package/src/components/selectAddress/BatchList.vue +326 -326
  35. package/src/main.js +23 -23
@@ -1,508 +1,508 @@
1
- <template>
2
- <div>
3
- <div class="border">
4
- <div v-if="!isquery" class="form-group" style="height: auto;position: relative;">
5
- <div class="col-sm-2">
6
- <input type="text" class="form-control col-sm-2" v-model="f_name" condition="f_name='{}'" placeholder='地址名称' >
7
- </div>
8
- <v-select class="col-sm-2" style="margin-left: 5px" :value.sync="f_type" :options='address_type' placeholder='地址类型'
9
- close-on-select v-model='f_type' v-ref:f_adjustable></v-select>
10
- <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
11
- <button class="btn btn-info" @click="query">查询</button>
12
- <button class="btn btn-info" @click="addRoot">添加区(县)</button>
13
- <!--<button class="btn btn-success" @click="importAddress">导入地址</button>-->
14
- </div>
15
- <div v-if="isquery" class="form-group row" style="height: auto;position: relative;">
16
- <div class="col-sm-2 paddingLeft">
17
- <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
18
- </div>
19
- <div class="col-sm-2 paddingLeft">
20
- <input type="text" class="form-control" v-model="name_x"
21
- condition="f_name='{}'" :placeholder='config.querys[0]'>
22
- </div>
23
- <div class="col-sm-2 paddingLeft">
24
- <input type="text" class="form-control" v-model="name_l"
25
- condition="f_name='{}'" :placeholder='config.querys[1]'>
26
- </div>
27
- <div class="col-sm-2 paddingLeft">
28
- <input type="text" class="form-control" v-model="name_d"
29
- condition="f_name='{}'" :placeholder='config.querys[2]'>
30
- </div>
31
- <!--<div class="col-sm-2 paddingLeft">-->
32
- <!--<input type="text" class="form-control" v-model="name_c" @keyup.enter="search(name_c, config.querys[3])"-->
33
- <!--condition="f_name='{}'" :placeholder='config.querys[3]'>-->
34
- <!--</div>-->
35
- <!--<div class="col-sm-2 paddingLeft">-->
36
- <!--<input type="text" class="form-control" v-model="name_m" @keyup.enter="search(name_m, config.querys[4])"-->
37
- <!--condition="f_name='{}'" :placeholder='config.querys[4]'>-->
38
- <!--</div>-->
39
- <button class="btn btn-info" @click="search">查询</button>
40
- <button class="btn btn-info" @click="clear">清空</button>
41
- <button class="btn btn-info" @click="addRoot">添加区(县)</button>
42
- <!--<button v-if="isbasch" class="btn btn-success" @click="importAddress">导入地址</button>-->
43
- </div>
44
- <tree-grid class="treeList" :model="model" v-ref:tree :is-Click="true" isEdit="true" @select-changed='selectclick' url='rs/path/address_getChild' id="vc-chooser">
45
- <template partial='head'>
46
- <tr>
47
- <th>类型</th>
48
- <th>内容</th>
49
- </tr>
50
- </template>
51
- <template partial='body'>
52
- <td>{{row.data.f_type=='区'?'区/县':row.data.f_type}}</td>
53
- <td>
54
- <tree-grid-item :row="row" iconsize="18px">
55
- <span partial>
56
- <!--<span v-if="$parent.$parent.isinspect">-->
57
- <!--<span v-if="row.data.f_type=='门牌号' && (!row.data.idstr || row.data.idstr<=0)" style="color: green">{{row.data.f_name}}</span>-->
58
- <!--<span v-else>{{row.data.f_type=='门牌号'?row.data.f_name+'(此地址已有档案)':row.data.f_name}}</span>-->
59
- <!--</span>-->
60
- <!--<span v-if="!$parent.$parent.isinspect">-->
61
- <!--<span>{{row.data.f_name}}</span>-->
62
- <!--</span>-->
63
- <span v-if="$parent.$parent.according(row.data.f_type)?1:row.size=0">{{row.data.f_name}}</span>
64
- <span v-if="row.data.f_type=='小区'">{{row.data.f_name}}</span>
65
-
66
- <span>({{row.size>0?row.size:0}})</span>
67
- <span v-if="$parent.isSelected(row)">
68
- <!--添加地址-->
69
- <button class="btn btn-info btn-sm" v-for="type in $parent.$parent.config.types[row.data.f_type]" @click="$parent.$parent.$parent.addType(row, type)">
70
- <span class="glyphicon glyphicon-plus-sign">{{type}}</span>
71
- </button>
72
- <!--修改地址-->
73
- <button class="btn btn-success btn-sm" @click="$parent.$parent.updateType(row, 1)">修改名称</button>
74
- <!--修改默认表具-->
75
- <button v-if="row.data.f_type=='小区'" class="btn btn-success btn-sm"
76
- @click="$parent.$parent.updateType(row, 2)">修改默认表具</button>
77
- <!--删除地址-->
78
- <button v-if="row.size<=0" class="btn btn-success btn-sm" @click="$parent.$parent.deleteType(row)">删除</button>
79
- </span>
80
- </span>
81
- </tree-grid-item>
82
- </td>
83
- </template>
84
- </tree-grid>
85
- </div>
86
- <div class="rightDiv" v-show="showAddress" >
87
- <address-add style="flex: 1.5;width: 85%" :isbasch="isbasch" :row="item" :f_parentid="parentid" :type="type" :f_location="location" :isarea="isarea"
88
- @add-child-node="addChildNode" @updata-child-node="updataChildNode" v-ref:addressadd ></address-add>
89
- </div>
90
- <modal :show.sync="showFile" v-ref:modal backdrop="true">
91
- <header slot="modal-header" class="modal-header">
92
- <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
93
- <h4 class="modal-title">文件导入</h4>
94
- </header>
95
- <article slot="modal-body" class="modal-body">
96
- <div class="form-group">
97
- <file-upload class="my-file-uploader" name="addressUploadFile" action="api/af-revenue/file/uploadFile" tagname="文件导入" :headers="headers" multiple v-ref:file></file-upload>
98
- </div>
99
- </article>
100
- <footer slot="modal-footer" class="modal-footer"></footer>
101
- </modal>
102
- </div>
103
- </template>
104
-
105
- <script>
106
- import addressAdd from '../components/AddressAddAddress'
107
- import * as ldapHelper from '../util/LdapHelper'
108
- import Vue from 'vue'
109
-
110
- export default {
111
- name: "AddressTreeManage",
112
- components: {
113
- addressAdd,
114
- },
115
- title: '小区管理',
116
- props: {
117
- //位置
118
- f_location: {
119
- default: {
120
- f_locationId: '1535',
121
- f_locationType: 't_organization',
122
- },
123
- type: Object,
124
- },
125
- // 查询格式
126
- isquery: {
127
- type: Boolean,
128
- default : false,
129
- },
130
- // 是否显示小区信息
131
- isarea: {
132
- type: Boolean,
133
- default: false,
134
- },
135
- // 是否显示批量添加
136
- isbasch: {
137
- type: Boolean,
138
- default: true,
139
- },
140
- // 是否检查用户建档
141
- isinspect: {
142
- type: Boolean,
143
- default: false,
144
- }
145
- },
146
-
147
- data () {
148
- return {
149
- config: {
150
- // 类型定义
151
- types: {
152
- '区': ['街道'],
153
- '街道': ['小区']
154
- },
155
- // 查询类型
156
- querys: ['小区', '楼号', '单元', '楼层', '门牌号'],
157
- },
158
- model: [],
159
- showAddress: false,
160
- //当前更改
161
- item: null,
162
- parentid: null,
163
- location: null,
164
- showFile: false,
165
- headers: {'username': '', 'blodid': '','f_usetype':'','f_remarks':''},
166
- login: {id: '1535',type: 't_organization'},
167
- type: '',
168
- // 参数类, 用于修改tree组件的类
169
- category: {
170
- child: {
171
- add: [], // ''
172
- remove: []
173
- },
174
- span: {
175
- add: ['glyphicon glyphicon-minus-sign','glyphicon glyphicon-plus-sign'],
176
- remove: ['glyphicon glyphicon-chevron-down','glyphicon glyphicon-chevron-right']
177
- }
178
- },
179
- // 选中的节点
180
- treeRow: null,
181
- selectItem: null, // 选择的参数
182
- userid: this.$login.f.id,
183
- source:`tool.getFullTree(this.getRights().where(row.getType() == $organization$))`,
184
- f_type: ['小区'],
185
- f_name: '',
186
- name_x: '',
187
- name_l: '',
188
- name_d: '',
189
- name_c: '',
190
- name_m: '',
191
- }
192
- },
193
- ready() {
194
- if(Vue.$login.f.parent && Vue.$login.f.parent.parentid) {
195
- this.f_location.f_locationId = Vue.$login.f.parent.parentid
196
- this.login.id = Vue.$login.f.parent.parentid+""
197
- }
198
- if(this.f_location.f_locationId && this.f_location.f_locationType) {
199
- this.init()
200
- }
201
- },
202
- watch: {
203
- 'f_location' (val) {
204
- this.showAddress = false
205
- if(val.f_locationId && val.f_locationType) {
206
- this.init()
207
- }
208
- },
209
- 'f_location.f_locationId' () {
210
- this.showAddress = false
211
- if(this.f_location.f_locationId && this.f_location.f_locationType) {
212
- this.init()
213
- }
214
- }
215
- },
216
- computed : {
217
- address_type() {
218
- return this.$appdata.getParam('地址类型')
219
- }
220
- },
221
- methods: {
222
- // 参数初始化
223
- init() {
224
- return asyncGetRoot(this).then(() => {
225
- this.$emit('ready')
226
- }).catch((error) => {
227
- this.$emit('error', error)
228
- })
229
- },
230
- //只显示区/县,街道
231
- according(type){
232
- if(type == '区' || type == '街道'){
233
- return true
234
- }
235
- return false
236
- },
237
- //添加根地址
238
- addRoot() {
239
- this.type = '区'
240
- this.item = null
241
- this.location = Object.assign({}, this.location, this.f_location)
242
- this.parentid = null
243
- this.treeRow = null
244
- this.isarea = false
245
- this.showAddress = true
246
- },
247
- //添加子地址
248
- addType(row, type) {
249
- this.type = type
250
- this.item = null
251
- this.location = Object.assign({}, this.location, this.f_location)
252
- this.parentid = row.data.id
253
- this.treeRow = row
254
- this.isarea = false
255
- this.showAddress = true
256
- },
257
- //修改地址
258
- updateType(row, type) {
259
- console.log('xiugai ......', row, type)
260
- if(type == 1){
261
- this.isarea = false
262
- } else {
263
- this.isarea = true
264
- }
265
- this.type = row.data.f_type
266
- this.parentid = null
267
- this.location = null
268
- this.item = Object.assign({}, this.item, row.data)
269
- this.treeRow = row
270
- this.showAddress = true
271
- },
272
- //删除地址
273
- deleteType(row) {
274
- console.log(row)
275
- let self = this
276
- let id = row.data.id
277
- return asyncDelete(this, row, row.data.f_type).then((res) => {
278
- console.log(res.data.status + " " + res.data.msg)
279
- if(res.data.status == 200) {
280
- console.log(row.parent)
281
- if(row.parent) {
282
- // 父节点刷新
283
- this.$refs.tree.refreshChild(row.parent)
284
- } else {
285
- this.init()
286
- }
287
- } else {
288
- alert(res.data.msg)
289
- }
290
- this.showAddress = false
291
- })
292
- },
293
- //导入地址
294
- importAddress() {
295
- this.showFile = true
296
- },
297
- // 关闭文件上传对话框
298
- closeFile() {
299
- this.showFile = false
300
- // 将选的文件清空
301
- // this.$showMessage(this.$refs.file.$el.querySelector('input').value)
302
- this.$refs.file.$el.querySelector('input').value = ''
303
- },
304
- // 父组件更新子组件属性 , 传入登陆信息
305
- updateData(val) {
306
- if(val.headers){
307
- this.headers = val.headers
308
- }
309
- if(val.login){
310
- this.login = val.login
311
- }
312
- },
313
- // 添加子节点
314
- addChildNode(data) {
315
- if(this.treeRow) {
316
- // 刷新当前节点
317
- this.$refs.tree.refreshChild(this.treeRow)
318
- } else {
319
- this.init()
320
- }
321
- },
322
- // 修改
323
- updataChildNode(data) {
324
- if(this.treeRow.parent){
325
- this.$refs.tree.refreshChild(this.treeRow.parent)
326
- } else {
327
- this.init()
328
- }
329
- },
330
- filterParams (param,filialeCodeStr) {
331
- this.selectItem = null
332
- if(param){
333
- this.model.rows = this.allParams.filter((item) => {
334
- return filialeCodeStr==(item.f_orgstr) && item.name.includes(param)
335
- })
336
- }else{
337
- this.model.rows = this.allParams.filter((item) => {
338
- return filialeCodeStr==(item.f_orgstr)
339
- })
340
- }
341
- },
342
- async query() {
343
- if(this.f_name==="") {
344
- await this.init()
345
- } else if(this.f_type.length <= 0) {
346
- alert("请输入地址类型");
347
- } else {
348
- let condition ={
349
- name: this.f_name,
350
- type: this.f_type[0]
351
- }
352
- let login = {
353
- id: this.f_location.f_locationId+"",
354
- type: this.f_location.f_locationType
355
- }
356
- let res = await asyncQuery(this, condition, login)
357
- this.model = res.data
358
- await new Promise(resolve => {
359
- this.$nextTick(() => {
360
- resolve()
361
- })
362
- })
363
- // 展开所有子
364
- this.$refs.tree.openAll()
365
- this.$emit('ready')
366
- }
367
- },
368
- // 地址搜索
369
- async search() {
370
- let condition ={
371
- f_area: this.name_x,
372
- f_building: this.name_l,
373
- f_unit: this.name_d
374
- }
375
- let login = {
376
- id: this.f_location.f_locationId+"",
377
- type: this.f_location.f_locationType
378
- }
379
- let res = await this.$resetpost(`api/af-revenue/logic/address_search`, {data: {condition: condition, login: login}},{resolveMsg: null})
380
- this.model = res.data
381
- //刷新dom
382
- await new Promise(resolve => {
383
- this.$nextTick(() => {
384
- resolve()
385
- })
386
- })
387
- // 展开所有子
388
- this.$refs.tree.openAll()
389
- },
390
- // 清空
391
- clear() {
392
- this.name_x = ''
393
- this.name_l = ''
394
- this.name_d = ''
395
- this.name_c = ''
396
- this.name_m = ''
397
- this.init()
398
- },
399
- selectclick (obj) {
400
- let row = obj.val
401
- if(this.isinspect){
402
- //如果选择地址已有档案则不返回事件,并把选中状态改为未选中
403
- if(row.data.idstr > 0) {
404
- this.$refs.tree.selectStore.selected = null
405
- return
406
- }
407
- }
408
- console.log('看看row',row)
409
- let newobj={
410
- "rows": ldapHelper.getFullNameType(row, 'f_name', 'f_type'),
411
- "id": ldapHelper.getFullName(row, 'id')+''
412
- }
413
- let address = ''
414
- newobj.rows.forEach((item)=>{
415
- address += item.name
416
- })
417
- this.textContent = address
418
- this.contentId = row.id
419
- this.treeRow = row
420
- //返回, 需要修改
421
- console.log('返回数据',newobj,address)
422
- this.$dispatch('re-ref', newobj,address)
423
- },
424
- getRes (obj) {
425
- let loc = obj.resids.split('.');
426
- this.f_location.f_locationId = loc[loc.length-2];
427
- }
428
- },
429
- events: {
430
- onFileUpload: function (file, res) {
431
- console.log("上传完毕"+JSON.stringify(res))
432
- let data = {
433
- filepath: res.f_downloadpath,
434
- login: this.login
435
- }
436
- console.log("filepath="+JSON.stringify(data))
437
- return asyncImport(this, data).then(() => {
438
- this.closeFile()
439
- this.init()
440
- }).catch((error) => {
441
- this.$emit('error', error)
442
- })
443
- },
444
- 'onFileError'(error) {
445
- this.$showAlert(error, 'warning', 2000)
446
- }
447
- },
448
- }
449
- // 导入地址
450
- let asyncImport = async function (self, data) {
451
- let result = await self.$resetpost(`api/af-revenue/logic/address_import`,data, {resolveMsg: '导入成功', rejectMsg: '导入失败', silent: true}, 0)
452
- return result
453
- }
454
- // 获取根地址
455
- let asyncGetRoot = async function(self) {
456
- let condition = ""
457
- if(self.f_location) {
458
- condition = `f_locationId=${self.f_location.f_locationId} and f_locationType='${self.f_location.f_locationType}'`
459
- } else {
460
- condition = " 1=1 "
461
- }
462
- let that = self
463
- // console.log(`condition=${condition}`)
464
- let result = await self.$resetpost('rs/path/address_getRoot',{data: {f_parentId: null, condition: condition}},{resolveMsg: null})
465
- // console.log(JSON.stringify(result.data))
466
- self.model = result.data
467
- return result
468
- }
469
- // 删除地址
470
- let asyncDelete = async function(self, row, type) {
471
- let result = await self.$resetpost(`api/af-revenue/logic/address_deleteAddress`, {childId: `${row.data.id}`}, {resolveMsg: null})
472
- if(type == '小区') {
473
- await self.$resetpost(`api/af-revenue/logic/address_deleteArea`,{areaId: `${row.data.id}`}, {resolveMsg: null})
474
- }
475
- return result
476
- }
477
- //查询地址
478
- let asyncQuery = async function(self, condition, login) {
479
- let result = await self.$resetpost(`api/af-revenue/logic/address_query`, {data: {condition: condition, login: login}},{resolveMsg: null})
480
- return result
481
- }
482
-
483
- </script>
484
-
485
- <style lang="less" scoped>
486
- .btn{
487
- margin-left: 7px;
488
- border-radius: 4px;
489
- }
490
- .border{
491
- max-width: 50%;
492
- /*overflow-y: auto;*/
493
- float: left;
494
- }
495
- .rightDiv{
496
- width: 50%;
497
- /*margin-left: 200px;*/
498
- float: left;
499
- }
500
- .treeList {
501
- overflow-y: auto;
502
- max-height: 90%;
503
- }
504
- .paddingLeft {
505
- padding-left: 10px;
506
- width: 15%;
507
- }
508
- </style>
1
+ <template>
2
+ <div>
3
+ <div class="border">
4
+ <div v-if="!isquery" class="form-group" style="height: auto;position: relative;">
5
+ <div class="col-sm-2">
6
+ <input type="text" class="form-control col-sm-2" v-model="f_name" condition="f_name='{}'" placeholder='地址名称' >
7
+ </div>
8
+ <v-select class="col-sm-2" style="margin-left: 5px" :value.sync="f_type" :options='address_type' placeholder='地址类型'
9
+ close-on-select v-model='f_type' v-ref:f_adjustable></v-select>
10
+ <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
11
+ <button class="btn btn-info" @click="query">查询</button>
12
+ <button class="btn btn-info" @click="addRoot">添加区(县)</button>
13
+ <!--<button class="btn btn-success" @click="importAddress">导入地址</button>-->
14
+ </div>
15
+ <div v-if="isquery" class="form-group row" style="height: auto;position: relative;">
16
+ <div class="col-sm-2 paddingLeft">
17
+ <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
18
+ </div>
19
+ <div class="col-sm-2 paddingLeft">
20
+ <input type="text" class="form-control" v-model="name_x"
21
+ condition="f_name='{}'" :placeholder='config.querys[0]'>
22
+ </div>
23
+ <div class="col-sm-2 paddingLeft">
24
+ <input type="text" class="form-control" v-model="name_l"
25
+ condition="f_name='{}'" :placeholder='config.querys[1]'>
26
+ </div>
27
+ <div class="col-sm-2 paddingLeft">
28
+ <input type="text" class="form-control" v-model="name_d"
29
+ condition="f_name='{}'" :placeholder='config.querys[2]'>
30
+ </div>
31
+ <!--<div class="col-sm-2 paddingLeft">-->
32
+ <!--<input type="text" class="form-control" v-model="name_c" @keyup.enter="search(name_c, config.querys[3])"-->
33
+ <!--condition="f_name='{}'" :placeholder='config.querys[3]'>-->
34
+ <!--</div>-->
35
+ <!--<div class="col-sm-2 paddingLeft">-->
36
+ <!--<input type="text" class="form-control" v-model="name_m" @keyup.enter="search(name_m, config.querys[4])"-->
37
+ <!--condition="f_name='{}'" :placeholder='config.querys[4]'>-->
38
+ <!--</div>-->
39
+ <button class="btn btn-info" @click="search">查询</button>
40
+ <button class="btn btn-info" @click="clear">清空</button>
41
+ <button class="btn btn-info" @click="addRoot">添加区(县)</button>
42
+ <!--<button v-if="isbasch" class="btn btn-success" @click="importAddress">导入地址</button>-->
43
+ </div>
44
+ <tree-grid class="treeList" :model="model" v-ref:tree :is-Click="true" isEdit="true" @select-changed='selectclick' url='rs/path/address_getChild' id="vc-chooser">
45
+ <template partial='head'>
46
+ <tr>
47
+ <th>类型</th>
48
+ <th>内容</th>
49
+ </tr>
50
+ </template>
51
+ <template partial='body'>
52
+ <td>{{row.data.f_type=='区'?'区/县':row.data.f_type}}</td>
53
+ <td>
54
+ <tree-grid-item :row="row" iconsize="18px">
55
+ <span partial>
56
+ <!--<span v-if="$parent.$parent.isinspect">-->
57
+ <!--<span v-if="row.data.f_type=='门牌号' && (!row.data.idstr || row.data.idstr<=0)" style="color: green">{{row.data.f_name}}</span>-->
58
+ <!--<span v-else>{{row.data.f_type=='门牌号'?row.data.f_name+'(此地址已有档案)':row.data.f_name}}</span>-->
59
+ <!--</span>-->
60
+ <!--<span v-if="!$parent.$parent.isinspect">-->
61
+ <!--<span>{{row.data.f_name}}</span>-->
62
+ <!--</span>-->
63
+ <span v-if="$parent.$parent.according(row.data.f_type)?1:row.size=0">{{row.data.f_name}}</span>
64
+ <span v-if="row.data.f_type=='小区'">{{row.data.f_name}}</span>
65
+
66
+ <span>({{row.size>0?row.size:0}})</span>
67
+ <span v-if="$parent.isSelected(row)">
68
+ <!--添加地址-->
69
+ <button class="btn btn-info btn-sm" v-for="type in $parent.$parent.config.types[row.data.f_type]" @click="$parent.$parent.$parent.addType(row, type)">
70
+ <span class="glyphicon glyphicon-plus-sign">{{type}}</span>
71
+ </button>
72
+ <!--修改地址-->
73
+ <button class="btn btn-success btn-sm" @click="$parent.$parent.updateType(row, 1)">修改名称</button>
74
+ <!--修改默认表具-->
75
+ <button v-if="row.data.f_type=='小区'" class="btn btn-success btn-sm"
76
+ @click="$parent.$parent.updateType(row, 2)">修改默认表具</button>
77
+ <!--删除地址-->
78
+ <button v-if="row.size<=0" class="btn btn-success btn-sm" @click="$parent.$parent.deleteType(row)">删除</button>
79
+ </span>
80
+ </span>
81
+ </tree-grid-item>
82
+ </td>
83
+ </template>
84
+ </tree-grid>
85
+ </div>
86
+ <div class="rightDiv" v-show="showAddress" >
87
+ <address-add style="flex: 1.5;width: 85%" :isbasch="isbasch" :row="item" :f_parentid="parentid" :type="type" :f_location="location" :isarea="isarea"
88
+ @add-child-node="addChildNode" @updata-child-node="updataChildNode" v-ref:addressadd ></address-add>
89
+ </div>
90
+ <modal :show.sync="showFile" v-ref:modal backdrop="true">
91
+ <header slot="modal-header" class="modal-header">
92
+ <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
93
+ <h4 class="modal-title">文件导入</h4>
94
+ </header>
95
+ <article slot="modal-body" class="modal-body">
96
+ <div class="form-group">
97
+ <file-upload class="my-file-uploader" name="addressUploadFile" action="rs/file/uploadFile" tagname="文件导入" :headers="headers" multiple v-ref:file></file-upload>
98
+ </div>
99
+ </article>
100
+ <footer slot="modal-footer" class="modal-footer"></footer>
101
+ </modal>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import addressAdd from '../components/AddressAddAddress'
107
+ import * as ldapHelper from '../util/LdapHelper'
108
+ import Vue from 'vue'
109
+
110
+ export default {
111
+ name: "AddressTreeManage",
112
+ components: {
113
+ addressAdd,
114
+ },
115
+ title: '小区管理',
116
+ props: {
117
+ //位置
118
+ f_location: {
119
+ default: {
120
+ f_locationId: '1535',
121
+ f_locationType: 't_organization',
122
+ },
123
+ type: Object,
124
+ },
125
+ // 查询格式
126
+ isquery: {
127
+ type: Boolean,
128
+ default : false,
129
+ },
130
+ // 是否显示小区信息
131
+ isarea: {
132
+ type: Boolean,
133
+ default: false,
134
+ },
135
+ // 是否显示批量添加
136
+ isbasch: {
137
+ type: Boolean,
138
+ default: true,
139
+ },
140
+ // 是否检查用户建档
141
+ isinspect: {
142
+ type: Boolean,
143
+ default: false,
144
+ }
145
+ },
146
+
147
+ data () {
148
+ return {
149
+ config: {
150
+ // 类型定义
151
+ types: {
152
+ '区': ['街道'],
153
+ '街道': ['小区']
154
+ },
155
+ // 查询类型
156
+ querys: ['小区', '楼号', '单元', '楼层', '门牌号'],
157
+ },
158
+ model: [],
159
+ showAddress: false,
160
+ //当前更改
161
+ item: null,
162
+ parentid: null,
163
+ location: null,
164
+ showFile: false,
165
+ headers: {'username': '', 'blodid': '','f_usetype':'','f_remarks':''},
166
+ login: {id: '1535',type: 't_organization'},
167
+ type: '',
168
+ // 参数类, 用于修改tree组件的类
169
+ category: {
170
+ child: {
171
+ add: [], // ''
172
+ remove: []
173
+ },
174
+ span: {
175
+ add: ['glyphicon glyphicon-minus-sign','glyphicon glyphicon-plus-sign'],
176
+ remove: ['glyphicon glyphicon-chevron-down','glyphicon glyphicon-chevron-right']
177
+ }
178
+ },
179
+ // 选中的节点
180
+ treeRow: null,
181
+ selectItem: null, // 选择的参数
182
+ userid: this.$login.f.id,
183
+ source:`tool.getFullTree(this.getRights().where(row.getType() == $organization$))`,
184
+ f_type: ['小区'],
185
+ f_name: '',
186
+ name_x: '',
187
+ name_l: '',
188
+ name_d: '',
189
+ name_c: '',
190
+ name_m: '',
191
+ }
192
+ },
193
+ ready() {
194
+ if(Vue.$login.f.parent && Vue.$login.f.parent.parentid) {
195
+ this.f_location.f_locationId = Vue.$login.f.parent.parentid
196
+ this.login.id = Vue.$login.f.parent.parentid+""
197
+ }
198
+ if(this.f_location.f_locationId && this.f_location.f_locationType) {
199
+ this.init()
200
+ }
201
+ },
202
+ watch: {
203
+ 'f_location' (val) {
204
+ this.showAddress = false
205
+ if(val.f_locationId && val.f_locationType) {
206
+ this.init()
207
+ }
208
+ },
209
+ 'f_location.f_locationId' () {
210
+ this.showAddress = false
211
+ if(this.f_location.f_locationId && this.f_location.f_locationType) {
212
+ this.init()
213
+ }
214
+ }
215
+ },
216
+ computed : {
217
+ address_type() {
218
+ return this.$appdata.getParam('地址类型')
219
+ }
220
+ },
221
+ methods: {
222
+ // 参数初始化
223
+ init() {
224
+ return asyncGetRoot(this).then(() => {
225
+ this.$emit('ready')
226
+ }).catch((error) => {
227
+ this.$emit('error', error)
228
+ })
229
+ },
230
+ //只显示区/县,街道
231
+ according(type){
232
+ if(type == '区' || type == '街道'){
233
+ return true
234
+ }
235
+ return false
236
+ },
237
+ //添加根地址
238
+ addRoot() {
239
+ this.type = '区'
240
+ this.item = null
241
+ this.location = Object.assign({}, this.location, this.f_location)
242
+ this.parentid = null
243
+ this.treeRow = null
244
+ this.isarea = false
245
+ this.showAddress = true
246
+ },
247
+ //添加子地址
248
+ addType(row, type) {
249
+ this.type = type
250
+ this.item = null
251
+ this.location = Object.assign({}, this.location, this.f_location)
252
+ this.parentid = row.data.id
253
+ this.treeRow = row
254
+ this.isarea = false
255
+ this.showAddress = true
256
+ },
257
+ //修改地址
258
+ updateType(row, type) {
259
+ console.log('xiugai ......', row, type)
260
+ if(type == 1){
261
+ this.isarea = false
262
+ } else {
263
+ this.isarea = true
264
+ }
265
+ this.type = row.data.f_type
266
+ this.parentid = null
267
+ this.location = null
268
+ this.item = Object.assign({}, this.item, row.data)
269
+ this.treeRow = row
270
+ this.showAddress = true
271
+ },
272
+ //删除地址
273
+ deleteType(row) {
274
+ console.log(row)
275
+ let self = this
276
+ let id = row.data.id
277
+ return asyncDelete(this, row, row.data.f_type).then((res) => {
278
+ console.log(res.data.status + " " + res.data.msg)
279
+ if(res.data.status == 200) {
280
+ console.log(row.parent)
281
+ if(row.parent) {
282
+ // 父节点刷新
283
+ this.$refs.tree.refreshChild(row.parent)
284
+ } else {
285
+ this.init()
286
+ }
287
+ } else {
288
+ alert(res.data.msg)
289
+ }
290
+ this.showAddress = false
291
+ })
292
+ },
293
+ //导入地址
294
+ importAddress() {
295
+ this.showFile = true
296
+ },
297
+ // 关闭文件上传对话框
298
+ closeFile() {
299
+ this.showFile = false
300
+ // 将选的文件清空
301
+ // this.$showMessage(this.$refs.file.$el.querySelector('input').value)
302
+ this.$refs.file.$el.querySelector('input').value = ''
303
+ },
304
+ // 父组件更新子组件属性 , 传入登陆信息
305
+ updateData(val) {
306
+ if(val.headers){
307
+ this.headers = val.headers
308
+ }
309
+ if(val.login){
310
+ this.login = val.login
311
+ }
312
+ },
313
+ // 添加子节点
314
+ addChildNode(data) {
315
+ if(this.treeRow) {
316
+ // 刷新当前节点
317
+ this.$refs.tree.refreshChild(this.treeRow)
318
+ } else {
319
+ this.init()
320
+ }
321
+ },
322
+ // 修改
323
+ updataChildNode(data) {
324
+ if(this.treeRow.parent){
325
+ this.$refs.tree.refreshChild(this.treeRow.parent)
326
+ } else {
327
+ this.init()
328
+ }
329
+ },
330
+ filterParams (param,filialeCodeStr) {
331
+ this.selectItem = null
332
+ if(param){
333
+ this.model.rows = this.allParams.filter((item) => {
334
+ return filialeCodeStr==(item.f_orgstr) && item.name.includes(param)
335
+ })
336
+ }else{
337
+ this.model.rows = this.allParams.filter((item) => {
338
+ return filialeCodeStr==(item.f_orgstr)
339
+ })
340
+ }
341
+ },
342
+ async query() {
343
+ if(this.f_name==="") {
344
+ await this.init()
345
+ } else if(this.f_type.length <= 0) {
346
+ alert("请输入地址类型");
347
+ } else {
348
+ let condition ={
349
+ name: this.f_name,
350
+ type: this.f_type[0]
351
+ }
352
+ let login = {
353
+ id: this.f_location.f_locationId+"",
354
+ type: this.f_location.f_locationType
355
+ }
356
+ let res = await asyncQuery(this, condition, login)
357
+ this.model = res.data
358
+ await new Promise(resolve => {
359
+ this.$nextTick(() => {
360
+ resolve()
361
+ })
362
+ })
363
+ // 展开所有子
364
+ this.$refs.tree.openAll()
365
+ this.$emit('ready')
366
+ }
367
+ },
368
+ // 地址搜索
369
+ async search() {
370
+ let condition ={
371
+ f_area: this.name_x,
372
+ f_building: this.name_l,
373
+ f_unit: this.name_d
374
+ }
375
+ let login = {
376
+ id: this.f_location.f_locationId+"",
377
+ type: this.f_location.f_locationType
378
+ }
379
+ let res = await this.$resetpost(`rs/logic/address_search`, {data: {condition: condition, login: login}},{resolveMsg: null})
380
+ this.model = res.data
381
+ //刷新dom
382
+ await new Promise(resolve => {
383
+ this.$nextTick(() => {
384
+ resolve()
385
+ })
386
+ })
387
+ // 展开所有子
388
+ this.$refs.tree.openAll()
389
+ },
390
+ // 清空
391
+ clear() {
392
+ this.name_x = ''
393
+ this.name_l = ''
394
+ this.name_d = ''
395
+ this.name_c = ''
396
+ this.name_m = ''
397
+ this.init()
398
+ },
399
+ selectclick (obj) {
400
+ let row = obj.val
401
+ if(this.isinspect){
402
+ //如果选择地址已有档案则不返回事件,并把选中状态改为未选中
403
+ if(row.data.idstr > 0) {
404
+ this.$refs.tree.selectStore.selected = null
405
+ return
406
+ }
407
+ }
408
+ console.log('看看row',row)
409
+ let newobj={
410
+ "rows": ldapHelper.getFullNameType(row, 'f_name', 'f_type'),
411
+ "id": ldapHelper.getFullName(row, 'id')+''
412
+ }
413
+ let address = ''
414
+ newobj.rows.forEach((item)=>{
415
+ address += item.name
416
+ })
417
+ this.textContent = address
418
+ this.contentId = row.id
419
+ this.treeRow = row
420
+ //返回, 需要修改
421
+ console.log('返回数据',newobj,address)
422
+ this.$dispatch('re-ref', newobj,address)
423
+ },
424
+ getRes (obj) {
425
+ let loc = obj.resids.split('.');
426
+ this.f_location.f_locationId = loc[loc.length-2];
427
+ }
428
+ },
429
+ events: {
430
+ onFileUpload: function (file, res) {
431
+ console.log("上传完毕"+JSON.stringify(res))
432
+ let data = {
433
+ filepath: res.f_downloadpath,
434
+ login: this.login
435
+ }
436
+ console.log("filepath="+JSON.stringify(data))
437
+ return asyncImport(this, data).then(() => {
438
+ this.closeFile()
439
+ this.init()
440
+ }).catch((error) => {
441
+ this.$emit('error', error)
442
+ })
443
+ },
444
+ 'onFileError'(error) {
445
+ this.$showAlert(error, 'warning', 2000)
446
+ }
447
+ },
448
+ }
449
+ // 导入地址
450
+ let asyncImport = async function (self, data) {
451
+ let result = await self.$resetpost(`rs/logic/address_import`,data, {resolveMsg: '导入成功', rejectMsg: '导入失败', silent: true}, 0)
452
+ return result
453
+ }
454
+ // 获取根地址
455
+ let asyncGetRoot = async function(self) {
456
+ let condition = ""
457
+ if(self.f_location) {
458
+ condition = `f_locationId=${self.f_location.f_locationId} and f_locationType='${self.f_location.f_locationType}'`
459
+ } else {
460
+ condition = " 1=1 "
461
+ }
462
+ let that = self
463
+ // console.log(`condition=${condition}`)
464
+ let result = await self.$resetpost('rs/path/address_getRoot',{data: {f_parentId: null, condition: condition}},{resolveMsg: null})
465
+ // console.log(JSON.stringify(result.data))
466
+ self.model = result.data
467
+ return result
468
+ }
469
+ // 删除地址
470
+ let asyncDelete = async function(self, row, type) {
471
+ let result = await self.$resetpost(`rs/logic/address_deleteAddress`, {childId: `${row.data.id}`}, {resolveMsg: null})
472
+ if(type == '小区') {
473
+ await self.$resetpost(`rs/logic/address_deleteArea`,{areaId: `${row.data.id}`}, {resolveMsg: null})
474
+ }
475
+ return result
476
+ }
477
+ //查询地址
478
+ let asyncQuery = async function(self, condition, login) {
479
+ let result = await self.$resetpost(`rs/logic/address_query`, {data: {condition: condition, login: login}},{resolveMsg: null})
480
+ return result
481
+ }
482
+
483
+ </script>
484
+
485
+ <style lang="less" scoped>
486
+ .btn{
487
+ margin-left: 7px;
488
+ border-radius: 4px;
489
+ }
490
+ .border{
491
+ max-width: 50%;
492
+ /*overflow-y: auto;*/
493
+ float: left;
494
+ }
495
+ .rightDiv{
496
+ width: 50%;
497
+ /*margin-left: 200px;*/
498
+ float: left;
499
+ }
500
+ .treeList {
501
+ overflow-y: auto;
502
+ max-height: 90%;
503
+ }
504
+ .paddingLeft {
505
+ padding-left: 10px;
506
+ width: 15%;
507
+ }
508
+ </style>