address-client 4.0.13-kelai → 4.0.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "address-client",
3
- "version": "4.0.13-kelai",
3
+ "version": "4.0.14",
4
4
  "description": "地址管理前台组件",
5
5
  "author": "wanbochao",
6
6
  "license": "ISC",
@@ -107,9 +107,9 @@
107
107
  <div v-if="!usertype" class="col-sm-6 form-group ">
108
108
  <label for="f_address" class="font_normal_body">楼&emsp;&emsp;层</label>
109
109
  <input type="text" style="width:40%" v-model="model.f_floor" class="input_search"
110
- placeholder="楼层" disabled />
110
+ placeholder="楼层" />
111
111
  <input type="text" style="width:20%" v-model="model.f_floor_suffix" class="input_search"
112
- disabled />
112
+ />
113
113
  </div>
114
114
  <div v-if="!usertype" class="col-sm-6 form-group "
115
115
  :class="[$v.f_room.required ? 'has-error' : 'has-success']">
@@ -210,15 +210,15 @@
210
210
  close-on-select search="true">
211
211
  </v-select>
212
212
  </div>
213
- <!-- <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">-->
214
- <!-- <label class="font_normal_body">片&emsp;&emsp;区</label>-->
215
- <!-- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"-->
216
- <!-- >-->
217
- <!-- <v-select :value.sync="model.f_slice_area" v-model="model.f_slice_area" :value-single="true"-->
218
- <!-- :options='sliceArea' placeholder='片区/管理站' filer-key="name"-->
219
- <!-- close-on-select v-ref:slice>-->
220
- <!-- </v-select>-->
221
- <!-- </div>-->
213
+ <!-- <div class="col-sm-6 form-group " :class="[$v.slice.required ? 'has-error' : 'has-success']">-->
214
+ <!-- <label class="font_normal_body">片&emsp;&emsp;区</label>-->
215
+ <!-- <input type="text" style="width:60%" class="input_search" v-show="false" v-model="$refs.slice.selectedItems"-->
216
+ <!-- >-->
217
+ <!-- <v-select :value.sync="model.f_slice_area" v-model="model.f_slice_area" :value-single="true"-->
218
+ <!-- :options='sliceArea' placeholder='片区/管理站' filer-key="name"-->
219
+ <!-- close-on-select v-ref:slice>-->
220
+ <!-- </v-select>-->
221
+ <!-- </div>-->
222
222
 
223
223
  <div class="col-sm-6 form-group "
224
224
  :class="[$v.f_building_start.integernum || $v.f_building_start.dctest ?'has-error' : 'has-success']">
@@ -416,11 +416,10 @@
416
416
 
417
417
  f_orgid: '',
418
418
 
419
- sliceArea: [],
420
- disableFloor: false
419
+ sliceArea: []
421
420
  }
422
421
  },
423
- props: ['f_filialeids', 'row','operation','usertype', 'disableFloor'],
422
+ props: ['f_filialeids', 'row','operation','usertype'],
424
423
  ready(){
425
424
  this.initdata()
426
425
  getAreaConfig(this)
@@ -428,25 +427,6 @@
428
427
  this.model.f_unit_suffix=this.config.f_unit_suffix
429
428
  this.model.f_floor_suffix=this.config.f_floor_suffix
430
429
  this.model.f_room_suffix=this.config.f_room_suffix
431
-
432
- // 处理传入的 row 数据
433
- if(this.row) {
434
- // 复制原有数据到 model
435
- Object.assign(this.model, this.row)
436
-
437
- // 初始化省市区、街道、小区数据
438
- this.initpcds(` f_orgid = '${this.$login.f.orgid}'`)
439
- this.initstreets(` f_orgid = '${this.$login.f.orgid}' `)
440
- this.initareas(` f_orgid = '${this.$login.f.orgid}'`)
441
-
442
- // 设置选中值
443
- this.$nextTick(() => {
444
- this.model.f_pcd_id = this.row.f_pcd_id
445
- this.model.f_street_id = this.row.f_street_id
446
- this.model.f_residential_area_id = this.row.f_residential_area_id
447
- this.model.f_slice_area = this.row.f_slice_area
448
- })
449
- }
450
430
  },
451
431
  methods: {
452
432
  async changecity(){
@@ -792,10 +772,7 @@
792
772
  this.model.f_pcd=this.findbyid(this.pcdslist,this.model.f_pcd_id).f_pcd
793
773
  this.model.f_street=this.findbyid(this.streetslist,this.model.f_street_id).f_street
794
774
  this.model.f_residential_area=this.findbyid(this.areaslist,this.model.f_residential_area_id).f_residential_area
795
- // 确保楼层值为空
796
- this.model.f_floor = ''
797
- this.model.f_floor_suffix = ''
798
- this.model.f_address = this.model.f_street + this.model.f_residential_area + (this.model.f_building?this.model.f_building +this.model.f_building_suffix:'') + (this.model.f_unit?this.model.f_unit +this.model.f_unit_suffix:'') + this.model.f_room + this.model.f_room_suffix
775
+ this.model.f_address = this.model.f_street + this.model.f_residential_area + (this.model.f_building?this.model.f_building +this.model.f_building_suffix:'') + (this.model.f_unit?this.model.f_unit +this.model.f_unit_suffix:'') + (this.model.f_floor?this.model.f_floor +this.model.f_floor_suffix:'') + this.model.f_room + this.model.f_room_suffix
799
776
  }
800
777
  await this.$resetpost('api/af-revenue/logic/address_updateuseraddress', this.model)
801
778
  },
@@ -413,7 +413,7 @@ export default {
413
413
  }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
414
414
  this.sliceArea = []
415
415
  req.data.forEach((row) => {
416
- this.sliceArea.push({label: row.name, value: {name: row.name, code:row.number}})
416
+ this.sliceArea.push({label: row.name, value: {name: row.name, code:row.id}})
417
417
  })
418
418
  },
419
419
  //初始化小区添加小区
@@ -0,0 +1,316 @@
1
+ <template>
2
+ <div class="span">
3
+ <validator name='v'>
4
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='add'">添加{{areatype}}</p>
5
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='街道'">修改【{{streetmodel.f_street}}】街道</p>
6
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='省市区'">修改【{{pcdmodel.f_pcd}}】</p>
7
+ <div class="auto select-overspread form-horizontal">
8
+ <div style="text-align:right;margin-top:6px;" class="col-sm-12">
9
+ <!-- 省市区-->
10
+ <div v-if="areatype=='省市区'" class="row">
11
+ <div class="col-sm-6 form-group "
12
+ :class="[$v.f_province.required ? 'has-error' : 'has-success']">
13
+ <label class="font_normal_body">省&emsp;&emsp;份</label>
14
+ <input type="text" v-model="pcdmodel.f_province"
15
+ class="input_search" style="width:60%" placeholder="省份"
16
+ v-validate:f_province='{required: true }'>
17
+ </div>
18
+ <div class="col-sm-6 form-group "
19
+ :class="[$v.f_city.required ? 'has-error' : 'has-success']">
20
+ <label class="font_normal_body">城&emsp;&emsp;市</label>
21
+ <input type="text" v-model="pcdmodel.f_city"
22
+ class="input_search" style="width:60%" placeholder="城市"
23
+ v-validate:f_city='{required: true }'>
24
+ </div>
25
+ <div class="col-sm-6 form-group "
26
+ :class="[$v.f_district.required ? 'has-error' : 'has-success']">
27
+ <label class="font_normal_body">区&ensp;&ensp;/&ensp;县</label>
28
+ <input type="text" v-model="pcdmodel.f_district"
29
+ class="input_search" style="width:60%" placeholder="区/县"
30
+ v-validate:f_district='{required: true }'>
31
+ </div>
32
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
33
+ :class="[$v.f_pcd_number.required ? 'has-error' : 'has-success']">
34
+ <label class="font_normal_body">区域编码</label>
35
+ <input type="number" v-model="pcdmodel.f_pcd_number"
36
+ class="input_search" style="width:60%" placeholder="区/县"
37
+ @change="numberyanzheng"
38
+ v-validate:f_pcd_number='{required: true }'>
39
+ </div>
40
+ <div class="col-sm-12 form-group">
41
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
42
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="pcdmodel.f_comments"></textarea>
43
+ </div>
44
+ </div>
45
+ <!-- 街道-->
46
+ <div v-if="areatype=='街道'" class="row">
47
+ <div class="col-sm-6 form-group "
48
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
49
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
50
+ <input type="text" v-show="false" v-model="streetmodel.f_pcd_id"
51
+ v-validate:f_pcd_id='{required: true }'>
52
+ <v-select
53
+ :value.sync="streetmodel.f_pcd_id" :value-single="true"
54
+ :options='pcdslist' placeholder='请选择'
55
+ close-on-select search="true" @change="pcdChange">
56
+ </v-select>
57
+ </div>
58
+ <div class="col-sm-6 form-group "
59
+ :class="[$v.f_street.required ? 'has-error' : 'has-success']">
60
+ <label class="font_normal_body">街道/乡镇</label>
61
+ <input type="text" v-model="streetmodel.f_street"
62
+ class="input_search" style="width:60%" placeholder="街道/乡镇"
63
+ v-validate:f_street='{required: true }'>
64
+ </div>
65
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
66
+ :class="[$v.f_street_number.required ? 'has-error' : 'has-success']">
67
+ <label class="font_normal_body">街道编号</label>
68
+ <input type="text" v-model="streetmodel.f_street_number"
69
+ @change="streetyanzheng"
70
+ class="input_search" style="width:60%" placeholder="街道编号"
71
+ v-validate:f_street_number='{required: true }'>
72
+ </div>
73
+ <div class="col-sm-6 form-group "
74
+ :class="[$v.f_iscity.required ? 'has-error' : 'has-success']">
75
+ <label class="font_normal_body">地区类型</label>
76
+ <input type="text" v-show="false" v-model="streetmodel.f_iscity"
77
+ v-validate:f_iscity='{required: true }'>
78
+ <v-select
79
+ :value.sync="streetmodel.f_iscity" :value-single="true"
80
+ :options='iscity' placeholder='请选择'
81
+ close-on-select>
82
+ </v-select>
83
+ </div>
84
+ <div class="col-sm-12 form-group">
85
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
86
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="streetmodel.f_comments"></textarea>
87
+ </div>
88
+ </div>
89
+
90
+ <div class="row">
91
+ <div style="margin-top:40px;text-align:right;">
92
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid' v-if="this.$login.r.includes('街道修改保存')">保存</button>
93
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
94
+ </div>
95
+ <div v-if="areatype=='省市区'" class="row" style="margin-top:40px;height: 580px;">
96
+ <city-list v-ref:addpcd @select-changed="selected" :f_filialeids.sync="f_filialeids"></city-list>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </validator>
101
+ </div>
102
+ </template>
103
+
104
+ <script>
105
+ import {HttpResetClass} from 'vue-client'
106
+
107
+ let getAreaConfig = async function (self) {
108
+ // 获取气价里面的配置
109
+ await self.$getConfig(self, 'UserPcd')
110
+ console.log('原地址配置',self.config)
111
+ console.log('获取地址配置',self.config)
112
+ Object.assign(self.model, self.config)
113
+ }
114
+ export default {
115
+ title: '区域地址添加',
116
+ data () {
117
+ return {
118
+ //初始化省市区数据
119
+ config:{
120
+ hasnumber: false
121
+ },
122
+ pcdslist:[],
123
+ iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'}],
124
+ //省市区
125
+ pcdmodel: {
126
+ f_province:'',
127
+ f_city:'',
128
+ f_district:'',
129
+ f_comments:'',
130
+ f_pcd_number: ''
131
+ },
132
+ //街道
133
+ streetmodel: {
134
+ f_pcd_id:'',
135
+ f_street_id:'',
136
+ slice_area: null,
137
+ f_slice_area: null,
138
+ f_adjustable_id: null,
139
+ f_street:'',
140
+ f_comments:'',
141
+ f_street_number:''
142
+ }
143
+ }
144
+ },
145
+ props: ['f_filialeids', 'areatype','row','operation'],
146
+ ready(){
147
+ this.initdata()
148
+ getAreaConfig(this)
149
+ },
150
+ methods: {
151
+ async streetyanzheng(){
152
+ console.log(this.streetmodel.f_street_number.length)
153
+ let res =await this.$resetpost('api/af-revenue/sql/address_singleTableOrderBy', {
154
+ data: {
155
+ items: '*',
156
+ tablename: 't_street',
157
+ orderitem: 'id',
158
+ condition: `f_street_number = '${this.streetmodel.f_street_number}' and f_orgid = '${this.$login.f.orgid}'`
159
+ }
160
+ }, {resolveMsg: null, rejectMsg: null})
161
+ if (res.data.length>0){
162
+ if (res.data[0].id != this.streetmodel.id) {
163
+ this.$showAlert('当前编号已存在', 'warning', 2000)
164
+ this.streetmodel.f_street_number = ''
165
+ }
166
+ }
167
+ },
168
+ async numberyanzheng(){
169
+ console.log(this.pcdmodel.f_pcd_number.length)
170
+ if (this.pcdmodel.f_pcd_number.length != 3){
171
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
172
+ this.pcdmodel.f_pcd_number = ''
173
+ }else{
174
+ let res =await this.$resetpost('api/af-revenue/sql/address_singleTableOrderBy', {
175
+ data: {
176
+ items: '*',
177
+ tablename: 't_pcd',
178
+ orderitem: 'id',
179
+ condition: `f_pcd_number = '${this.pcdmodel.f_pcd_number}' and f_orgid = '${this.$login.f.orgid}'`
180
+ }
181
+ }, {resolveMsg: null, rejectMsg: null})
182
+ if (res.data.length>0){
183
+ if (res.data[0].id != this.pcdmodel.id) {
184
+ this.$showAlert('当前编号已存在', 'warning', 2000)
185
+ this.pcdmodel.f_pcd_number = ''
186
+ }
187
+ }
188
+ }
189
+ },
190
+ //初始化省市区,添加街道
191
+ initpcds(pconditon){
192
+ console.log("省市区准备")
193
+ let HttpReset = new HttpResetClass()
194
+ HttpReset.load('POST', 'api/af-revenue/sql/address_singleTableOrderBy', {
195
+ data: {
196
+ items: '*',
197
+ tablename: 't_pcd',
198
+ orderitem: 'id',
199
+ condition: pconditon
200
+ }
201
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'}).then((req) => {
202
+ let redata = []
203
+ req.data.forEach((row, n) => {
204
+ redata[n] = {
205
+ label: row.f_pcd,
206
+ value: row.id,
207
+ data:row,
208
+ id:row.id
209
+ }
210
+ })
211
+ this.pcdslist=redata
212
+ })
213
+ },
214
+ //根据名字找数据
215
+ findbyid(list,name){
216
+ var result
217
+ list.forEach((row, n) => {
218
+ if(name==row.id){
219
+ result= row.data
220
+ }
221
+ })
222
+ return result
223
+ },
224
+ //初始化数据
225
+ initdata(){
226
+ if(this.areatype=='街道'){
227
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
228
+ }
229
+ if(this.areatype=='小区'){
230
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
231
+ this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
232
+ }
233
+ },
234
+ //省/市/区变化
235
+ pcdChange(val){
236
+ console.log("省/市/区变化",val)
237
+ this.$resetValidation()
238
+ },
239
+ //保存
240
+ async confirm(){
241
+ if(this.areatype=='省市区'){
242
+ await this.savepcd()
243
+ this.$refs.addpcd.search()
244
+ }
245
+ if(this.areatype=='街道'){
246
+ await this.savestreet()
247
+ }
248
+ this.cleardara()
249
+ this.$dispatch('confirm')
250
+ },
251
+ //保存省市区
252
+ async savepcd(){
253
+ this.pcdmodel.f_filialeid = this.f_filialeids
254
+ this.pcdmodel.f_operator = this.$login.f.name
255
+ this.pcdmodel.f_operatorid = this.$login.f.id
256
+ this.pcdmodel.f_orgid = this.$login.f.orgid
257
+ this.pcdmodel.f_orgname = this.$login.f.orgs
258
+ this.pcdmodel.f_depid = this.$login.f.depids
259
+ this.pcdmodel.f_depname = this.$login.f.deps
260
+ this.pcdmodel.f_pcd = this.pcdmodel.f_province+this.pcdmodel.f_city+this.pcdmodel.f_district
261
+ await this.$resetpost('api/af-revenue/logic/address_updatepcd', this.pcdmodel)
262
+ },
263
+ //保存街道
264
+ async savestreet(){
265
+ this.streetmodel.f_filialeid = this.f_filialeids
266
+ this.streetmodel.f_operator= this.$login.f.name
267
+ this.streetmodel.f_operatorid = this.$login.f.id
268
+ this.streetmodel.f_orgid = this.$login.f.orgid
269
+ this.streetmodel.f_orgname = this.$login.f.orgs
270
+ this.streetmodel.f_depid = this.$login.f.depids
271
+ this.streetmodel.f_depname = this.$login.f.deps
272
+ this.streetmodel.f_pcd=this.findbyid(this.pcdslist,this.streetmodel.f_pcd_id).f_pcd
273
+ console.log('获取街道model', this.streetmodel)
274
+ await this.$resetpost('api/af-revenue/logic/address_updatestreet', this.streetmodel)
275
+ },
276
+ cancel(){
277
+ this.cleardara()
278
+ this.$dispatch('cancel')
279
+ },
280
+ cleardara () {
281
+ this.pcdmodel = {
282
+ f_province: '',
283
+ f_city: '',
284
+ f_district: '',
285
+ f_comments:''
286
+ }
287
+ this.streetmodel = {
288
+ f_pcd_id: '',
289
+ f_slice_area: '',
290
+ f_adjustable_id: '',
291
+ f_street: '',
292
+ f_comments:''
293
+ }
294
+ }
295
+
296
+ },
297
+ watch: {
298
+ 'areatype'(){
299
+ this.initdata()
300
+ },
301
+ 'f_filialeids'(){
302
+ if (this.streetmodel.f_filialeid) {
303
+ if (this.streetmodel.f_filialeid != this.f_filialeids) {
304
+ this.$dispatch('cancel')
305
+ }
306
+ }
307
+ if (this.pcdmodel.f_filialeid) {
308
+ if (this.pcdmodel.f_filialeid != this.f_filialeids) {
309
+ this.$dispatch('cancel')
310
+ }
311
+ }
312
+ this.initdata()
313
+ }
314
+ }
315
+ }
316
+ </script>