address-client 3.2.29 → 3.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,422 @@
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-show="false" v-model="pcdmodel.f_province"
15
+ v-validate:f_province='{required: true }'>
16
+ <v-select :value.sync="pcdmodel.f_province" :value-single="true"
17
+ :options='provinceOptions' placeholder='请选择'
18
+ close-on-select search="true" @change="areaChange('province')">
19
+ </v-select>
20
+ </div>
21
+ <div class="col-sm-6 form-group "
22
+ :class="[$v.f_city.required ? 'has-error' : 'has-success']">
23
+ <label class="font_normal_body">城&emsp;&emsp;市</label>
24
+ <input type="text" v-show="false" v-model="pcdmodel.f_city"
25
+ v-validate:f_city='{required: true }'>
26
+ <v-select :value.sync="pcdmodel.f_city" :value-single="true"
27
+ :options='cityOptions' placeholder='请选择'
28
+ close-on-select search="true" @change="areaChange('city')">
29
+ </v-select>
30
+ </div>
31
+ <div class="col-sm-6 form-group "
32
+ :class="[$v.f_district.required ? 'has-error' : 'has-success']">
33
+ <label class="font_normal_body">区&ensp;&ensp;/&ensp;县</label>
34
+ <input type="text" v-show="false" v-model="pcdmodel.f_district"
35
+ v-validate:f_district='{required: true }'>
36
+ <v-select :value.sync="pcdmodel.f_district" :value-single="true"
37
+ :options='districtOptions' placeholder='请选择'
38
+ close-on-select search="true" @change="areaChange('district')">
39
+ </v-select>
40
+ </div>
41
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
42
+ :class="[$v.f_pcd_number.required ? 'has-error' : 'has-success']">
43
+ <label class="font_normal_body">区域编码</label>
44
+ <input type="number" v-model="pcdmodel.f_pcd_number"
45
+ class="input_search" style="width:60%" placeholder="区/县"
46
+ @change="numberyanzheng"
47
+ v-validate:f_pcd_number='{required: true }'>
48
+ </div>
49
+ <div class="col-sm-12 form-group">
50
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
51
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="pcdmodel.f_comments"></textarea>
52
+ </div>
53
+ </div>
54
+ <!-- 街道-->
55
+ <div v-if="areatype=='街道'" class="row">
56
+ <div class="col-sm-6 form-group "
57
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
58
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
59
+ <input type="text" v-show="false" v-model="streetmodel.f_pcd_id"
60
+ v-validate:f_pcd_id='{required: true }'>
61
+ <v-select
62
+ :value.sync="streetmodel.f_pcd_id" :value-single="true"
63
+ :options='pcdslist' placeholder='请选择'
64
+ close-on-select search="true" @change="pcdChange">
65
+ </v-select>
66
+ </div>
67
+ <div class="col-sm-6 form-group "
68
+ :class="[$v.f_street.required ? 'has-error' : 'has-success']">
69
+ <label class="font_normal_body">街道/乡镇</label>
70
+ <input type="text" v-model="streetmodel.f_street"
71
+ class="input_search" style="width:60%" placeholder="街道/乡镇"
72
+ v-validate:f_street='{required: true }'>
73
+ </div>
74
+ <div class="col-sm-6 form-group " v-if="config.hasnumber"
75
+ :class="[$v.f_street_number.required ? 'has-error' : 'has-success']">
76
+ <label class="font_normal_body">街道编号</label>
77
+ <input type="text" v-model="streetmodel.f_street_number"
78
+ @change="streetyanzheng"
79
+ class="input_search" style="width:60%" placeholder="街道编号"
80
+ v-validate:f_street_number='{required: true }'>
81
+ </div>
82
+ <div class="col-sm-6 form-group "
83
+ :class="[$v.f_iscity.required ? 'has-error' : 'has-success']">
84
+ <label class="font_normal_body">地区类型</label>
85
+ <input type="text" v-show="false" v-model="streetmodel.f_iscity"
86
+ v-validate:f_iscity='{required: true }'>
87
+ <v-select
88
+ :value.sync="streetmodel.f_iscity" :value-single="true"
89
+ :options='iscity' placeholder='请选择'
90
+ close-on-select>
91
+ </v-select>
92
+ </div>
93
+ <div class="col-sm-12 form-group">
94
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
95
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="streetmodel.f_comments"></textarea>
96
+ </div>
97
+ </div>
98
+
99
+ <div class="row">
100
+ <div style="margin-top:40px;text-align:right;">
101
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
102
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
103
+ </div>
104
+ <div v-if="areatype=='省市区'" class="row" style="margin-top:40px;height: 580px;">
105
+ <city-list v-ref:addpcd @select-changed="selected" :f_filialeids.sync="f_filialeids"></city-list>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </validator>
110
+ </div>
111
+ </template>
112
+
113
+ <script>
114
+ import {HttpResetClass} from 'vue-client'
115
+
116
+ let getAreaConfig = async function (self) {
117
+ // 获取气价里面的配置
118
+ await self.$getConfig(self, 'UserPcd')
119
+ console.log('原地址配置',self.config)
120
+ console.log('获取地址配置',self.config)
121
+ Object.assign(self.model, self.config)
122
+ }
123
+ export default {
124
+ title: '区域地址添加',
125
+ data () {
126
+ return {
127
+ //初始化省市区数据
128
+ config:{
129
+ hasnumber: false
130
+ },
131
+ pcdslist:[],
132
+ iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'}],
133
+ //省市区
134
+ pcdmodel: {
135
+ f_province:'',
136
+ f_city:'',
137
+ f_district:'',
138
+ f_comments:'',
139
+ f_pcd_number: ''
140
+ },
141
+ //街道
142
+ streetmodel: {
143
+ f_pcd_id:'',
144
+ f_street_id:'',
145
+ slice_area: null,
146
+ f_slice_area: null,
147
+ f_adjustable_id: null,
148
+ f_street:'',
149
+ f_comments:'',
150
+ f_street_number:''
151
+ },
152
+ provinceOptions: []
153
+ }
154
+ },
155
+ props: ['f_filialeids', 'areatype','row','operation'],
156
+ computed: {
157
+ cityOptions(){
158
+ if (this.pcdmodel.f_province){
159
+ for (const province of this.provinceOptions){
160
+ if (province.value == this.pcdmodel.f_province){
161
+ return province.children
162
+ }
163
+ }
164
+ }
165
+ return []
166
+ },
167
+ districtOptions(){
168
+ if (this.pcdmodel.f_city){
169
+ for (const province of this.provinceOptions){
170
+ if (province.value == this.pcdmodel.f_province){
171
+ for (const city of this.cityOptions){
172
+ if (city.value == this.pcdmodel.f_city){
173
+ return city.children
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ return []
180
+ }
181
+ },
182
+ ready(){
183
+ this.initdata()
184
+ getAreaConfig(this)
185
+ },
186
+ methods: {
187
+ areaChange(type){
188
+ if (type == 'province'){
189
+ this.pcdmodel.f_city = ''
190
+ this.pcdmodel.f_district = ''
191
+ } else if (type == 'city'){
192
+ this.pcdmodel.f_district = ''
193
+ }
194
+
195
+ this.$resetValidation()
196
+ },
197
+ /**
198
+ * 构造树型结构数据
199
+ * [label,value,children]
200
+ */
201
+ handleTree (data, id, parentId, children) {
202
+ const config = {
203
+ id: id || 'id',
204
+ parentId: parentId || 'parent_id',
205
+ childrenList: children || 'children'
206
+ }
207
+ const childrenListMap = {}
208
+ const nodeIds = {}
209
+ const tree = []
210
+ for (const d of data) {
211
+ const parentId = d[config.parentId]
212
+ if (childrenListMap[parentId] == null) {
213
+ childrenListMap[parentId] = []
214
+ }
215
+ nodeIds[d[config.id]] = d
216
+ childrenListMap[parentId].push(d)
217
+ }
218
+ for (const d of data) {
219
+ const parentId = d[config.parentId]
220
+ if (nodeIds[parentId] == null) {
221
+ tree.push(d)
222
+ }
223
+ }
224
+ for (const t of tree) {
225
+ adaptToChildrenList(t)
226
+ }
227
+ function adaptToChildrenList (o) {
228
+ o.label = o.name
229
+ o.value = o.name
230
+ if (childrenListMap[o[config.id]] !== null) {
231
+ o[config.childrenList] = childrenListMap[o[config.id]]
232
+ }
233
+ if (o[config.childrenList]) {
234
+ for (const c of o[config.childrenList]) {
235
+ adaptToChildrenList(c)
236
+ }
237
+ }
238
+ }
239
+ return tree
240
+ },
241
+ getChinaArea(){
242
+ this.$resetpost('rs/sql/address_singleTable?pageNo=1&pageSize=9999999', {
243
+ data: {
244
+ items: '*',
245
+ tablename: 'divisions_of_china',
246
+ condition: 'areaCode is null'
247
+ }
248
+ }).then(res => {
249
+ this.provinceOptions = this.handleTree(res.data, 'code', 'parentcode')
250
+ })
251
+ },
252
+ async streetyanzheng(){
253
+ console.log(this.streetmodel.f_street_number.length)
254
+ if (this.streetmodel.f_street_number.length != 2){
255
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
256
+ this.streetmodel.f_street_number = ''
257
+ }else{
258
+ let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
259
+ data: {
260
+ items: '*',
261
+ tablename: 't_street',
262
+ orderitem: 'id',
263
+ condition: `f_street_number = '${this.streetmodel.f_street_number}' and f_orgid = '${this.$login.f.orgid}'`
264
+ }
265
+ }, {resolveMsg: null, rejectMsg: null})
266
+ if (res.data.length>0){
267
+ if (res.data[0].id != this.streetmodel.id) {
268
+ this.$showAlert('当前编号已存在', 'warning', 2000)
269
+ this.streetmodel.f_street_number = ''
270
+ }
271
+ }
272
+ }
273
+ },
274
+ async numberyanzheng(){
275
+ console.log(this.pcdmodel.f_pcd_number.length)
276
+ if (this.pcdmodel.f_pcd_number.length != 3){
277
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
278
+ this.pcdmodel.f_pcd_number = ''
279
+ }else{
280
+ let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
281
+ data: {
282
+ items: '*',
283
+ tablename: 't_pcd',
284
+ orderitem: 'id',
285
+ condition: `f_pcd_number = '${this.pcdmodel.f_pcd_number}' and f_orgid = '${this.$login.f.orgid}'`
286
+ }
287
+ }, {resolveMsg: null, rejectMsg: null})
288
+ if (res.data.length>0){
289
+ if (res.data[0].id != this.pcdmodel.id) {
290
+ this.$showAlert('当前编号已存在', 'warning', 2000)
291
+ this.pcdmodel.f_pcd_number = ''
292
+ }
293
+ }
294
+ }
295
+ },
296
+ //初始化省市区,添加街道
297
+ initpcds(pconditon){
298
+ console.log("省市区准备")
299
+ let HttpReset = new HttpResetClass()
300
+ HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
301
+ data: {
302
+ items: '*',
303
+ tablename: 't_pcd',
304
+ orderitem: 'id',
305
+ condition: pconditon
306
+ }
307
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'}).then((req) => {
308
+ let redata = []
309
+ req.data.forEach((row, n) => {
310
+ redata[n] = {
311
+ label: row.f_pcd,
312
+ value: row.id,
313
+ data:row,
314
+ id:row.id
315
+ }
316
+ })
317
+ this.pcdslist=redata
318
+ })
319
+ },
320
+ //根据名字找数据
321
+ findbyid(list,name){
322
+ var result
323
+ list.forEach((row, n) => {
324
+ if(name==row.id){
325
+ result= row.data
326
+ }
327
+ })
328
+ return result
329
+ },
330
+ //初始化数据
331
+ initdata(){
332
+ if(this.areatype=='街道'){
333
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
334
+ }
335
+ if(this.areatype=='小区'){
336
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
337
+ this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
338
+ }
339
+ this.getChinaArea()
340
+ },
341
+ //省/市/区变化
342
+ pcdChange(val){
343
+ console.log("省/市/区变化",val)
344
+ this.$resetValidation()
345
+ },
346
+ //保存
347
+ async confirm(){
348
+ if(this.areatype=='省市区'){
349
+ await this.savepcd()
350
+ }
351
+ if(this.areatype=='街道'){
352
+ await this.savestreet()
353
+ }
354
+ this.cleardara()
355
+ this.$dispatch('confirm')
356
+ },
357
+ //保存省市区
358
+ async savepcd(){
359
+ this.pcdmodel.f_filialeid = this.f_filialeids
360
+ this.pcdmodel.f_operator = this.$login.f.name
361
+ this.pcdmodel.f_operatorid = this.$login.f.id
362
+ this.pcdmodel.f_orgid = this.$login.f.orgid
363
+ this.pcdmodel.f_orgname = this.$login.f.orgs
364
+ this.pcdmodel.f_depid = this.$login.f.depids
365
+ this.pcdmodel.f_depname = this.$login.f.deps
366
+ this.pcdmodel.f_pcd = this.pcdmodel.f_province+this.pcdmodel.f_city+this.pcdmodel.f_district
367
+ await this.$resetpost('rs/logic/address_updatepcd', this.pcdmodel)
368
+ },
369
+ //保存街道
370
+ async savestreet(){
371
+ this.streetmodel.f_filialeid = this.f_filialeids
372
+ this.streetmodel.f_operator= this.$login.f.name
373
+ this.streetmodel.f_operatorid = this.$login.f.id
374
+ this.streetmodel.f_orgid = this.$login.f.orgid
375
+ this.streetmodel.f_orgname = this.$login.f.orgs
376
+ this.streetmodel.f_depid = this.$login.f.depids
377
+ this.streetmodel.f_depname = this.$login.f.deps
378
+ this.streetmodel.f_pcd=this.findbyid(this.pcdslist,this.streetmodel.f_pcd_id).f_pcd
379
+ console.log('获取街道model', this.streetmodel)
380
+ await this.$resetpost('rs/logic/address_updatestreet', this.streetmodel)
381
+ },
382
+ cancel(){
383
+ this.cleardara()
384
+ this.$dispatch('cancel')
385
+ },
386
+ cleardara () {
387
+ this.pcdmodel = {
388
+ f_province: '',
389
+ f_city: '',
390
+ f_district: '',
391
+ f_comments:''
392
+ }
393
+ this.streetmodel = {
394
+ f_pcd_id: '',
395
+ f_slice_area: '',
396
+ f_adjustable_id: '',
397
+ f_street: '',
398
+ f_comments:''
399
+ }
400
+ }
401
+
402
+ },
403
+ watch: {
404
+ 'areatype'(){
405
+ this.initdata()
406
+ },
407
+ 'f_filialeids'(){
408
+ if (this.streetmodel.f_filialeid) {
409
+ if (this.streetmodel.f_filialeid != this.f_filialeids) {
410
+ this.$dispatch('cancel')
411
+ }
412
+ }
413
+ if (this.pcdmodel.f_filialeid) {
414
+ if (this.pcdmodel.f_filialeid != this.f_filialeids) {
415
+ this.$dispatch('cancel')
416
+ }
417
+ }
418
+ this.initdata()
419
+ }
420
+ }
421
+ }
422
+ </script>
@@ -0,0 +1,7 @@
1
+ // 分公司特殊组件页面注册
2
+
3
+ let specialComp = {
4
+ // 街道区县添加
5
+ 'add-street-pcd': (resolve) => { require(['./AddStreetOrPcd'], resolve) }
6
+ }
7
+ exports.specialComp = specialComp