address-client 3.0.34-aode → 3.0.34-aodeToV4

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 +1 -1
  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 -307
  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 +28 -5
  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 +780 -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 +739 -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,501 +1,501 @@
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
- <button class="btn btn-info" @click="query">查询</button>
11
- <button class="btn btn-info" @click="addRoot">添加区(县)</button>
12
- <button class="btn btn-success" @click="importAddress">导入地址</button>
13
- </div>
14
- <div v-if="isquery" class="form-group row" style="height: auto;position: relative;">
15
- <div class="col-sm-2 paddingLeft">
16
- <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
17
- </div>
18
- <div class="col-sm-2 paddingLeft">
19
- <input type="text" class="form-control" v-model="name_x"
20
- condition="f_name='{}'" :placeholder='config.querys[0]'>
21
- </div>
22
- <div class="col-sm-2 paddingLeft">
23
- <input type="text" class="form-control" v-model="name_l"
24
- condition="f_name='{}'" :placeholder='config.querys[1]'>
25
- </div>
26
- <div class="col-sm-2 paddingLeft">
27
- <input type="text" class="form-control" v-model="name_d"
28
- condition="f_name='{}'" :placeholder='config.querys[2]'>
29
- </div>
30
- <!--<div class="col-sm-2 paddingLeft">-->
31
- <!--<input type="text" class="form-control" v-model="name_c" @keyup.enter="search(name_c, config.querys[3])"-->
32
- <!--condition="f_name='{}'" :placeholder='config.querys[3]'>-->
33
- <!--</div>-->
34
- <!--<div class="col-sm-2 paddingLeft">-->
35
- <!--<input type="text" class="form-control" v-model="name_m" @keyup.enter="search(name_m, config.querys[4])"-->
36
- <!--condition="f_name='{}'" :placeholder='config.querys[4]'>-->
37
- <!--</div>-->
38
- <button class="btn btn-info" @click="search">查询</button>
39
- <button class="btn btn-info" @click="clear">清空</button>
40
- <button class="btn btn-info" @click="addRoot">添加区(县)</button>
41
- <button v-if="isbasch" class="btn btn-success" @click="importAddress">导入地址</button>
42
- </div>
43
- <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">
44
- <template partial='head'>
45
- <tr>
46
- <th>类型</th>
47
- <th>内容</th>
48
- </tr>
49
- </template>
50
- <template partial='body'>
51
- <td>{{row.data.f_type=='区'?'区/县':row.data.f_type}}</td>
52
- <td>
53
- <tree-grid-item :row="row" iconsize="18px">
54
- <span partial>
55
- <span v-if="$parent.$parent.isinspect">
56
- <span v-if="row.data.f_type=='门牌号' && (!row.data.idstr || row.data.idstr<=0)" style="color: green">{{row.data.f_name}}</span>
57
- <span v-else>{{row.data.f_type=='门牌号'?row.data.f_name+'(此地址已有档案)':row.data.f_name}}</span>
58
- </span>
59
- <span v-if="!$parent.$parent.isinspect">
60
- <span>{{row.data.f_name}}</span>
61
- </span>
62
- <span>({{row.size>0?row.size:0}})</span>
63
- <span v-if="$parent.isSelected(row)">
64
- <!--添加地址-->
65
- <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)">
66
- <span class="glyphicon glyphicon-plus-sign">{{type}}</span>
67
- </button>
68
- <!--修改地址-->
69
- <button class="btn btn-success btn-sm" @click="$parent.$parent.updateType(row, 1)">修改名称</button>
70
- <!--修改默认表具-->
71
- <button v-if="row.data.f_type=='小区'" class="btn btn-success btn-sm"
72
- @click="$parent.$parent.updateType(row, 2)">修改默认表具</button>
73
- <!--删除地址-->
74
- <button v-if="row.size<=0" class="btn btn-success btn-sm" @click="$parent.$parent.deleteType(row)">删除</button>
75
- </span>
76
- </span>
77
- </tree-grid-item>
78
- </td>
79
- </template>
80
- </tree-grid>
81
- </div>
82
- <div class="rightDiv" v-show="showAddress" >
83
- <address-add style="flex: 1.5;width: 85%" :isbasch="isbasch" :row="item" :f_parentid="parentid" :type="type" :f_location="location" :isarea="isarea"
84
- @add-child-node="addChildNode" @updata-child-node="updataChildNode" v-ref:addressadd ></address-add>
85
- </div>
86
- <modal :show.sync="showFile" v-ref:modal backdrop="true">
87
- <header slot="modal-header" class="modal-header">
88
- <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
89
- <h4 class="modal-title">文件导入</h4>
90
- </header>
91
- <article slot="modal-body" class="modal-body">
92
- <div class="form-group">
93
- <file-upload class="my-file-uploader" name="addressUploadFile" action="rs/file/uploadFile" tagname="文件导入" :headers="headers" multiple v-ref:file></file-upload>
94
- </div>
95
- </article>
96
- <footer slot="modal-footer" class="modal-footer"></footer>
97
- </modal>
98
- </div>
99
- </template>
100
-
101
- <script>
102
- import addressAdd from '../components/AddressAddAddress'
103
- import * as ldapHelper from '../util/LdapHelper'
104
- import Vue from 'vue'
105
-
106
- export default {
107
- name: "AddressTreeManage",
108
- components: {
109
- addressAdd,
110
- },
111
- title: '地址管理',
112
- props: {
113
- //位置
114
- f_location: {
115
- default: {
116
- f_locationId: '1535',
117
- f_locationType: 't_organization',
118
- },
119
- type: Object,
120
- },
121
- // 查询格式
122
- isquery: {
123
- type: Boolean,
124
- default : false,
125
- },
126
- // 是否显示小区信息
127
- isarea: {
128
- type: Boolean,
129
- default: false,
130
- },
131
- // 是否显示批量添加
132
- isbasch: {
133
- type: Boolean,
134
- default: true,
135
- },
136
- // 是否检查用户建档
137
- isinspect: {
138
- type: Boolean,
139
- default: false,
140
- }
141
- },
142
-
143
- data () {
144
- return {
145
- config: {
146
- // 类型定义
147
- types: {
148
- '区': ['街道'],
149
- '街道': ['小区','门牌号'],
150
- '小区': ['楼号', '单元'],
151
- '楼号': ['单元', '楼层', '门牌号'],
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
- addRoot() {
232
- this.type = '区'
233
- this.item = null
234
- this.location = Object.assign({}, this.location, this.f_location)
235
- this.parentid = null
236
- this.treeRow = null
237
- this.isarea = false
238
- this.showAddress = true
239
- },
240
- //添加子地址
241
- addType(row, type) {
242
- this.type = type
243
- this.item = null
244
- this.location = Object.assign({}, this.location, this.f_location)
245
- this.parentid = row.data.id
246
- this.treeRow = row
247
- this.isarea = false
248
- this.showAddress = true
249
- },
250
- //修改地址
251
- updateType(row, type) {
252
- console.log('xiugai ......', row, type)
253
- if(type == 1){
254
- this.isarea = false
255
- } else {
256
- this.isarea = true
257
- }
258
- this.type = row.data.f_type
259
- this.parentid = null
260
- this.location = null
261
- this.item = Object.assign({}, this.item, row.data)
262
- this.treeRow = row
263
- this.showAddress = true
264
- },
265
- //删除地址
266
- deleteType(row) {
267
- console.log(row)
268
- let self = this
269
- let id = row.data.id
270
- return asyncDelete(this, row, row.data.f_type).then((res) => {
271
- console.log(res.data.status + " " + res.data.msg)
272
- if(res.data.status == 200) {
273
- console.log(row.parent)
274
- if(row.parent) {
275
- // 父节点刷新
276
- this.$refs.tree.refreshChild(row.parent)
277
- } else {
278
- this.init()
279
- }
280
- } else {
281
- alert(res.data.msg)
282
- }
283
- this.showAddress = false
284
- })
285
- },
286
- //导入地址
287
- importAddress() {
288
- this.showFile = true
289
- },
290
- // 关闭文件上传对话框
291
- closeFile() {
292
- this.showFile = false
293
- // 将选的文件清空
294
- // this.$showMessage(this.$refs.file.$el.querySelector('input').value)
295
- this.$refs.file.$el.querySelector('input').value = ''
296
- },
297
- // 父组件更新子组件属性 , 传入登陆信息
298
- updateData(val) {
299
- if(val.headers){
300
- this.headers = val.headers
301
- }
302
- if(val.login){
303
- this.login = val.login
304
- }
305
- },
306
- // 添加子节点
307
- addChildNode(data) {
308
- if(this.treeRow) {
309
- // 刷新当前节点
310
- this.$refs.tree.refreshChild(this.treeRow)
311
- } else {
312
- this.init()
313
- }
314
- },
315
- // 修改
316
- updataChildNode(data) {
317
- if(this.treeRow.parent){
318
- this.$refs.tree.refreshChild(this.treeRow.parent)
319
- } else {
320
- this.init()
321
- }
322
- },
323
- filterParams (param,filialeCodeStr) {
324
- this.selectItem = null
325
- if(param){
326
- this.model.rows = this.allParams.filter((item) => {
327
- return filialeCodeStr==(item.f_orgstr) && item.name.includes(param)
328
- })
329
- }else{
330
- this.model.rows = this.allParams.filter((item) => {
331
- return filialeCodeStr==(item.f_orgstr)
332
- })
333
- }
334
- },
335
- async query() {
336
- if(this.f_name==="") {
337
- await this.init()
338
- } else if(this.f_type.length <= 0) {
339
- alert("请输入地址类型");
340
- } else {
341
- let condition ={
342
- name: this.f_name,
343
- type: this.f_type[0]
344
- }
345
- let login = {
346
- id: this.f_location.f_locationId+"",
347
- type: this.f_location.f_locationType
348
- }
349
- let res = await asyncQuery(this, condition, login)
350
- this.model = res.data
351
- await new Promise(resolve => {
352
- this.$nextTick(() => {
353
- resolve()
354
- })
355
- })
356
- // 展开所有子
357
- this.$refs.tree.openAll()
358
- this.$emit('ready')
359
- }
360
- },
361
- // 地址搜索
362
- async search() {
363
- let condition ={
364
- f_area: this.name_x,
365
- f_building: this.name_l,
366
- f_unit: this.name_d
367
- }
368
- let login = {
369
- id: this.f_location.f_locationId+"",
370
- type: this.f_location.f_locationType
371
- }
372
- let res = await this.$resetpost(`rs/logic/address_search`, {data: {condition: condition, login: login}},{resolveMsg: null})
373
- this.model = res.data
374
- //刷新dom
375
- await new Promise(resolve => {
376
- this.$nextTick(() => {
377
- resolve()
378
- })
379
- })
380
- // 展开所有子
381
- this.$refs.tree.openAll()
382
- },
383
- // 清空
384
- clear() {
385
- this.name_x = ''
386
- this.name_l = ''
387
- this.name_d = ''
388
- this.name_c = ''
389
- this.name_m = ''
390
- this.init()
391
- },
392
- selectclick (obj) {
393
- let row = obj.val
394
- if(this.isinspect){
395
- //如果选择地址已有档案则不返回事件,并把选中状态改为未选中
396
- if(row.data.idstr > 0) {
397
- this.$refs.tree.selectStore.selected = null
398
- return
399
- }
400
- }
401
- console.log('看看row',row)
402
- let newobj={
403
- "rows": ldapHelper.getFullNameType(row, 'f_name', 'f_type'),
404
- "id": ldapHelper.getFullName(row, 'id')+''
405
- }
406
- let address = ''
407
- newobj.rows.forEach((item)=>{
408
- address += item.name
409
- })
410
- this.textContent = address
411
- this.contentId = row.id
412
- this.treeRow = row
413
- //返回, 需要修改
414
- console.log('返回数据',newobj,address)
415
- this.$dispatch('re-ref', newobj,address)
416
- },
417
- getRes (obj) {
418
- let loc = obj.resids.split('.');
419
- this.f_location.f_locationId = loc[loc.length-2];
420
- }
421
- },
422
- events: {
423
- onFileUpload: function (file, res) {
424
- console.log("上传完毕"+JSON.stringify(res))
425
- let data = {
426
- filepath: res.f_downloadpath,
427
- login: this.login
428
- }
429
- console.log("filepath="+JSON.stringify(data))
430
- return asyncImport(this, data).then(() => {
431
- this.closeFile()
432
- this.init()
433
- }).catch((error) => {
434
- this.$emit('error', error)
435
- })
436
- },
437
- 'onFileError'(error) {
438
- this.$showAlert(error, 'warning', 2000)
439
- }
440
- },
441
- }
442
- // 导入地址
443
- let asyncImport = async function (self, data) {
444
- let result = await self.$resetpost(`rs/logic/address_import`,data, {resolveMsg: '导入成功', rejectMsg: '导入失败', silent: true}, 0)
445
- return result
446
- }
447
- // 获取根地址
448
- let asyncGetRoot = async function(self) {
449
- let condition = ""
450
- if(self.f_location) {
451
- condition = `f_locationId=${self.f_location.f_locationId} and f_locationType='${self.f_location.f_locationType}'`
452
- } else {
453
- condition = " 1=1 "
454
- }
455
- let that = self
456
- // console.log(`condition=${condition}`)
457
- let result = await self.$resetpost('rs/path/address_getRoot',{data: {f_parentId: null, condition: condition}},{resolveMsg: null})
458
- // console.log(JSON.stringify(result.data))
459
- self.model = result.data
460
- return result
461
- }
462
- // 删除地址
463
- let asyncDelete = async function(self, row, type) {
464
- let result = await self.$resetpost(`rs/logic/address_deleteAddress`, {childId: `${row.data.id}`}, {resolveMsg: null})
465
- if(type == '小区') {
466
- await self.$resetpost(`rs/logic/address_deleteArea`,{areaId: `${row.data.id}`}, {resolveMsg: null})
467
- }
468
- return result
469
- }
470
- //查询地址
471
- let asyncQuery = async function(self, condition, login) {
472
- let result = await self.$resetpost(`rs/logic/address_query`, {data: {condition: condition, login: login}},{resolveMsg: null})
473
- return result
474
- }
475
-
476
- </script>
477
-
478
- <style lang="less" scoped>
479
- .btn{
480
- margin-left: 7px;
481
- border-radius: 4px;
482
- }
483
- .border{
484
- max-width: 50%;
485
- /*overflow-y: auto;*/
486
- float: left;
487
- }
488
- .rightDiv{
489
- width: 50%;
490
- /*margin-left: 200px;*/
491
- float: left;
492
- }
493
- .treeList {
494
- overflow-y: auto;
495
- max-height: 90%;
496
- }
497
- .paddingLeft {
498
- padding-left: 10px;
499
- width: 15%;
500
- }
501
- </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
+ <button class="btn btn-info" @click="query">查询</button>
11
+ <button class="btn btn-info" @click="addRoot">添加区(县)</button>
12
+ <button class="btn btn-success" @click="importAddress">导入地址</button>
13
+ </div>
14
+ <div v-if="isquery" class="form-group row" style="height: auto;position: relative;">
15
+ <div class="col-sm-2 paddingLeft">
16
+ <right-tree :userid.sync='userid' :source.sync='source' @re-res="getRes" > </right-tree>
17
+ </div>
18
+ <div class="col-sm-2 paddingLeft">
19
+ <input type="text" class="form-control" v-model="name_x"
20
+ condition="f_name='{}'" :placeholder='config.querys[0]'>
21
+ </div>
22
+ <div class="col-sm-2 paddingLeft">
23
+ <input type="text" class="form-control" v-model="name_l"
24
+ condition="f_name='{}'" :placeholder='config.querys[1]'>
25
+ </div>
26
+ <div class="col-sm-2 paddingLeft">
27
+ <input type="text" class="form-control" v-model="name_d"
28
+ condition="f_name='{}'" :placeholder='config.querys[2]'>
29
+ </div>
30
+ <!--<div class="col-sm-2 paddingLeft">-->
31
+ <!--<input type="text" class="form-control" v-model="name_c" @keyup.enter="search(name_c, config.querys[3])"-->
32
+ <!--condition="f_name='{}'" :placeholder='config.querys[3]'>-->
33
+ <!--</div>-->
34
+ <!--<div class="col-sm-2 paddingLeft">-->
35
+ <!--<input type="text" class="form-control" v-model="name_m" @keyup.enter="search(name_m, config.querys[4])"-->
36
+ <!--condition="f_name='{}'" :placeholder='config.querys[4]'>-->
37
+ <!--</div>-->
38
+ <button class="btn btn-info" @click="search">查询</button>
39
+ <button class="btn btn-info" @click="clear">清空</button>
40
+ <button class="btn btn-info" @click="addRoot">添加区(县)</button>
41
+ <button v-if="isbasch" class="btn btn-success" @click="importAddress">导入地址</button>
42
+ </div>
43
+ <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">
44
+ <template partial='head'>
45
+ <tr>
46
+ <th>类型</th>
47
+ <th>内容</th>
48
+ </tr>
49
+ </template>
50
+ <template partial='body'>
51
+ <td>{{row.data.f_type=='区'?'区/县':row.data.f_type}}</td>
52
+ <td>
53
+ <tree-grid-item :row="row" iconsize="18px">
54
+ <span partial>
55
+ <span v-if="$parent.$parent.isinspect">
56
+ <span v-if="row.data.f_type=='门牌号' && (!row.data.idstr || row.data.idstr<=0)" style="color: green">{{row.data.f_name}}</span>
57
+ <span v-else>{{row.data.f_type=='门牌号'?row.data.f_name+'(此地址已有档案)':row.data.f_name}}</span>
58
+ </span>
59
+ <span v-if="!$parent.$parent.isinspect">
60
+ <span>{{row.data.f_name}}</span>
61
+ </span>
62
+ <span>({{row.size>0?row.size:0}})</span>
63
+ <span v-if="$parent.isSelected(row)">
64
+ <!--添加地址-->
65
+ <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)">
66
+ <span class="glyphicon glyphicon-plus-sign">{{type}}</span>
67
+ </button>
68
+ <!--修改地址-->
69
+ <button class="btn btn-success btn-sm" @click="$parent.$parent.updateType(row, 1)">修改名称</button>
70
+ <!--修改默认表具-->
71
+ <button v-if="row.data.f_type=='小区'" class="btn btn-success btn-sm"
72
+ @click="$parent.$parent.updateType(row, 2)">修改默认表具</button>
73
+ <!--删除地址-->
74
+ <button v-if="row.size<=0" class="btn btn-success btn-sm" @click="$parent.$parent.deleteType(row)">删除</button>
75
+ </span>
76
+ </span>
77
+ </tree-grid-item>
78
+ </td>
79
+ </template>
80
+ </tree-grid>
81
+ </div>
82
+ <div class="rightDiv" v-show="showAddress" >
83
+ <address-add style="flex: 1.5;width: 85%" :isbasch="isbasch" :row="item" :f_parentid="parentid" :type="type" :f_location="location" :isarea="isarea"
84
+ @add-child-node="addChildNode" @updata-child-node="updataChildNode" v-ref:addressadd ></address-add>
85
+ </div>
86
+ <modal :show.sync="showFile" v-ref:modal backdrop="true">
87
+ <header slot="modal-header" class="modal-header">
88
+ <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
89
+ <h4 class="modal-title">文件导入</h4>
90
+ </header>
91
+ <article slot="modal-body" class="modal-body">
92
+ <div class="form-group">
93
+ <file-upload class="my-file-uploader" name="addressUploadFile" action="api/af-revenue/file/uploadFile" tagname="文件导入" :headers="headers" multiple v-ref:file></file-upload>
94
+ </div>
95
+ </article>
96
+ <footer slot="modal-footer" class="modal-footer"></footer>
97
+ </modal>
98
+ </div>
99
+ </template>
100
+
101
+ <script>
102
+ import addressAdd from '../components/AddressAddAddress'
103
+ import * as ldapHelper from '../util/LdapHelper'
104
+ import Vue from 'vue'
105
+
106
+ export default {
107
+ name: "AddressTreeManage",
108
+ components: {
109
+ addressAdd,
110
+ },
111
+ title: '地址管理',
112
+ props: {
113
+ //位置
114
+ f_location: {
115
+ default: {
116
+ f_locationId: '1535',
117
+ f_locationType: 't_organization',
118
+ },
119
+ type: Object,
120
+ },
121
+ // 查询格式
122
+ isquery: {
123
+ type: Boolean,
124
+ default : false,
125
+ },
126
+ // 是否显示小区信息
127
+ isarea: {
128
+ type: Boolean,
129
+ default: false,
130
+ },
131
+ // 是否显示批量添加
132
+ isbasch: {
133
+ type: Boolean,
134
+ default: true,
135
+ },
136
+ // 是否检查用户建档
137
+ isinspect: {
138
+ type: Boolean,
139
+ default: false,
140
+ }
141
+ },
142
+
143
+ data () {
144
+ return {
145
+ config: {
146
+ // 类型定义
147
+ types: {
148
+ '区': ['街道'],
149
+ '街道': ['小区','门牌号'],
150
+ '小区': ['楼号', '单元'],
151
+ '楼号': ['单元', '楼层', '门牌号'],
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
+ addRoot() {
232
+ this.type = '区'
233
+ this.item = null
234
+ this.location = Object.assign({}, this.location, this.f_location)
235
+ this.parentid = null
236
+ this.treeRow = null
237
+ this.isarea = false
238
+ this.showAddress = true
239
+ },
240
+ //添加子地址
241
+ addType(row, type) {
242
+ this.type = type
243
+ this.item = null
244
+ this.location = Object.assign({}, this.location, this.f_location)
245
+ this.parentid = row.data.id
246
+ this.treeRow = row
247
+ this.isarea = false
248
+ this.showAddress = true
249
+ },
250
+ //修改地址
251
+ updateType(row, type) {
252
+ console.log('xiugai ......', row, type)
253
+ if(type == 1){
254
+ this.isarea = false
255
+ } else {
256
+ this.isarea = true
257
+ }
258
+ this.type = row.data.f_type
259
+ this.parentid = null
260
+ this.location = null
261
+ this.item = Object.assign({}, this.item, row.data)
262
+ this.treeRow = row
263
+ this.showAddress = true
264
+ },
265
+ //删除地址
266
+ deleteType(row) {
267
+ console.log(row)
268
+ let self = this
269
+ let id = row.data.id
270
+ return asyncDelete(this, row, row.data.f_type).then((res) => {
271
+ console.log(res.data.status + " " + res.data.msg)
272
+ if(res.data.status == 200) {
273
+ console.log(row.parent)
274
+ if(row.parent) {
275
+ // 父节点刷新
276
+ this.$refs.tree.refreshChild(row.parent)
277
+ } else {
278
+ this.init()
279
+ }
280
+ } else {
281
+ alert(res.data.msg)
282
+ }
283
+ this.showAddress = false
284
+ })
285
+ },
286
+ //导入地址
287
+ importAddress() {
288
+ this.showFile = true
289
+ },
290
+ // 关闭文件上传对话框
291
+ closeFile() {
292
+ this.showFile = false
293
+ // 将选的文件清空
294
+ // this.$showMessage(this.$refs.file.$el.querySelector('input').value)
295
+ this.$refs.file.$el.querySelector('input').value = ''
296
+ },
297
+ // 父组件更新子组件属性 , 传入登陆信息
298
+ updateData(val) {
299
+ if(val.headers){
300
+ this.headers = val.headers
301
+ }
302
+ if(val.login){
303
+ this.login = val.login
304
+ }
305
+ },
306
+ // 添加子节点
307
+ addChildNode(data) {
308
+ if(this.treeRow) {
309
+ // 刷新当前节点
310
+ this.$refs.tree.refreshChild(this.treeRow)
311
+ } else {
312
+ this.init()
313
+ }
314
+ },
315
+ // 修改
316
+ updataChildNode(data) {
317
+ if(this.treeRow.parent){
318
+ this.$refs.tree.refreshChild(this.treeRow.parent)
319
+ } else {
320
+ this.init()
321
+ }
322
+ },
323
+ filterParams (param,filialeCodeStr) {
324
+ this.selectItem = null
325
+ if(param){
326
+ this.model.rows = this.allParams.filter((item) => {
327
+ return filialeCodeStr==(item.f_orgstr) && item.name.includes(param)
328
+ })
329
+ }else{
330
+ this.model.rows = this.allParams.filter((item) => {
331
+ return filialeCodeStr==(item.f_orgstr)
332
+ })
333
+ }
334
+ },
335
+ async query() {
336
+ if(this.f_name==="") {
337
+ await this.init()
338
+ } else if(this.f_type.length <= 0) {
339
+ alert("请输入地址类型");
340
+ } else {
341
+ let condition ={
342
+ name: this.f_name,
343
+ type: this.f_type[0]
344
+ }
345
+ let login = {
346
+ id: this.f_location.f_locationId+"",
347
+ type: this.f_location.f_locationType
348
+ }
349
+ let res = await asyncQuery(this, condition, login)
350
+ this.model = res.data
351
+ await new Promise(resolve => {
352
+ this.$nextTick(() => {
353
+ resolve()
354
+ })
355
+ })
356
+ // 展开所有子
357
+ this.$refs.tree.openAll()
358
+ this.$emit('ready')
359
+ }
360
+ },
361
+ // 地址搜索
362
+ async search() {
363
+ let condition ={
364
+ f_area: this.name_x,
365
+ f_building: this.name_l,
366
+ f_unit: this.name_d
367
+ }
368
+ let login = {
369
+ id: this.f_location.f_locationId+"",
370
+ type: this.f_location.f_locationType
371
+ }
372
+ let res = await this.$resetpost(`api/af-revenue/logic/address_search`, {data: {condition: condition, login: login}},{resolveMsg: null})
373
+ this.model = res.data
374
+ //刷新dom
375
+ await new Promise(resolve => {
376
+ this.$nextTick(() => {
377
+ resolve()
378
+ })
379
+ })
380
+ // 展开所有子
381
+ this.$refs.tree.openAll()
382
+ },
383
+ // 清空
384
+ clear() {
385
+ this.name_x = ''
386
+ this.name_l = ''
387
+ this.name_d = ''
388
+ this.name_c = ''
389
+ this.name_m = ''
390
+ this.init()
391
+ },
392
+ selectclick (obj) {
393
+ let row = obj.val
394
+ if(this.isinspect){
395
+ //如果选择地址已有档案则不返回事件,并把选中状态改为未选中
396
+ if(row.data.idstr > 0) {
397
+ this.$refs.tree.selectStore.selected = null
398
+ return
399
+ }
400
+ }
401
+ console.log('看看row',row)
402
+ let newobj={
403
+ "rows": ldapHelper.getFullNameType(row, 'f_name', 'f_type'),
404
+ "id": ldapHelper.getFullName(row, 'id')+''
405
+ }
406
+ let address = ''
407
+ newobj.rows.forEach((item)=>{
408
+ address += item.name
409
+ })
410
+ this.textContent = address
411
+ this.contentId = row.id
412
+ this.treeRow = row
413
+ //返回, 需要修改
414
+ console.log('返回数据',newobj,address)
415
+ this.$dispatch('re-ref', newobj,address)
416
+ },
417
+ getRes (obj) {
418
+ let loc = obj.resids.split('.');
419
+ this.f_location.f_locationId = loc[loc.length-2];
420
+ }
421
+ },
422
+ events: {
423
+ onFileUpload: function (file, res) {
424
+ console.log("上传完毕"+JSON.stringify(res))
425
+ let data = {
426
+ filepath: res.f_downloadpath,
427
+ login: this.login
428
+ }
429
+ console.log("filepath="+JSON.stringify(data))
430
+ return asyncImport(this, data).then(() => {
431
+ this.closeFile()
432
+ this.init()
433
+ }).catch((error) => {
434
+ this.$emit('error', error)
435
+ })
436
+ },
437
+ 'onFileError'(error) {
438
+ this.$showAlert(error, 'warning', 2000)
439
+ }
440
+ },
441
+ }
442
+ // 导入地址
443
+ let asyncImport = async function (self, data) {
444
+ let result = await self.$resetpost(`api/af-revenue/logic/address_import`,data, {resolveMsg: '导入成功', rejectMsg: '导入失败', silent: true}, 0)
445
+ return result
446
+ }
447
+ // 获取根地址
448
+ let asyncGetRoot = async function(self) {
449
+ let condition = ""
450
+ if(self.f_location) {
451
+ condition = `f_locationId=${self.f_location.f_locationId} and f_locationType='${self.f_location.f_locationType}'`
452
+ } else {
453
+ condition = " 1=1 "
454
+ }
455
+ let that = self
456
+ // console.log(`condition=${condition}`)
457
+ let result = await self.$resetpost('rs/path/address_getRoot',{data: {f_parentId: null, condition: condition}},{resolveMsg: null})
458
+ // console.log(JSON.stringify(result.data))
459
+ self.model = result.data
460
+ return result
461
+ }
462
+ // 删除地址
463
+ let asyncDelete = async function(self, row, type) {
464
+ let result = await self.$resetpost(`api/af-revenue/logic/address_deleteAddress`, {childId: `${row.data.id}`}, {resolveMsg: null})
465
+ if(type == '小区') {
466
+ await self.$resetpost(`api/af-revenue/logic/address_deleteArea`,{areaId: `${row.data.id}`}, {resolveMsg: null})
467
+ }
468
+ return result
469
+ }
470
+ //查询地址
471
+ let asyncQuery = async function(self, condition, login) {
472
+ let result = await self.$resetpost(`api/af-revenue/logic/address_query`, {data: {condition: condition, login: login}},{resolveMsg: null})
473
+ return result
474
+ }
475
+
476
+ </script>
477
+
478
+ <style lang="less" scoped>
479
+ .btn{
480
+ margin-left: 7px;
481
+ border-radius: 4px;
482
+ }
483
+ .border{
484
+ max-width: 50%;
485
+ /*overflow-y: auto;*/
486
+ float: left;
487
+ }
488
+ .rightDiv{
489
+ width: 50%;
490
+ /*margin-left: 200px;*/
491
+ float: left;
492
+ }
493
+ .treeList {
494
+ overflow-y: auto;
495
+ max-height: 90%;
496
+ }
497
+ .paddingLeft {
498
+ padding-left: 10px;
499
+ width: 15%;
500
+ }
501
+ </style>