|
@@ -16,15 +16,47 @@
|
16
|
16
|
>{{ item.regionName }}</Option
|
17
|
17
|
>
|
18
|
18
|
</Select>
|
|
19
|
+ <Select
|
|
20
|
+ :transfer="true"
|
|
21
|
+ v-model="searchForm.provinceid"
|
|
22
|
+ style="width: 120px; margin: 0 10px"
|
|
23
|
+ placeholder="请选择省份"
|
|
24
|
+ @on-change="provinceChange(searchForm.provinceid, 1)"
|
|
25
|
+ >
|
|
26
|
+ <Option
|
|
27
|
+ v-for="item in areaList"
|
|
28
|
+ :value="item.areaCode"
|
|
29
|
+ :key="item.areaCode"
|
|
30
|
+ >{{ item.areaName }}</Option
|
|
31
|
+ >
|
|
32
|
+ </Select>
|
|
33
|
+ <Select
|
|
34
|
+ :transfer="true"
|
|
35
|
+ v-model="searchForm.marketid"
|
|
36
|
+ @on-change="marketChange(searchForm.marketid, 1)"
|
|
37
|
+ style="width: 120px"
|
|
38
|
+ placeholder="请选择市"
|
|
39
|
+ >
|
|
40
|
+ <Option
|
|
41
|
+ v-for="item in searchForm.marketList"
|
|
42
|
+ :value="item.areaCode"
|
|
43
|
+ :key="item.areaCode"
|
|
44
|
+ >{{ item.areaName }}</Option
|
|
45
|
+ >
|
|
46
|
+ </Select>
|
19
|
47
|
<Select
|
20
|
48
|
:transfer="true"
|
21
|
49
|
v-model="searchForm.areaCode"
|
22
|
|
- @on-change="searchList()"
|
23
|
|
- style="margin-right: 10px; width: 150px"
|
|
50
|
+ @on-change="regionChange(1)"
|
|
51
|
+ style="width: 120px; margin: 0 10px"
|
|
52
|
+ placeholder="请选择区"
|
24
|
53
|
>
|
25
|
|
- <Option :value="0">所有状态</Option>
|
26
|
|
- <Option :value="1">启用</Option>
|
27
|
|
- <Option :value="2">禁用</Option>
|
|
54
|
+ <Option
|
|
55
|
+ v-for="item in searchForm.regionList"
|
|
56
|
+ :value="item.areaCode"
|
|
57
|
+ :key="item.areaCode"
|
|
58
|
+ >{{ item.areaName }}</Option
|
|
59
|
+ >
|
28
|
60
|
</Select>
|
29
|
61
|
<Input
|
30
|
62
|
v-model="searchForm.schoolName"
|
|
@@ -101,45 +133,44 @@
|
101
|
133
|
</FormItem>
|
102
|
134
|
<FormItem label="省市区" class="require" style="width: 100%">
|
103
|
135
|
<Select
|
104
|
|
- :transfer="true"
|
105
|
|
- v-model="adminInfo.provinceid"
|
106
|
|
- style="width: 120px"
|
107
|
|
- placeholder="请选择省份"
|
108
|
|
- @on-change="provinceChange"
|
|
136
|
+ :transfer="true"
|
|
137
|
+ v-model="adminInfo.provinceid"
|
|
138
|
+ style="width: 120px"
|
|
139
|
+ placeholder="请选择省份"
|
|
140
|
+ @on-change="provinceChange(adminInfo.provinceid, null)"
|
109
|
141
|
>
|
110
|
142
|
<Option
|
111
|
|
- v-for="item in areaList"
|
112
|
|
- :value="item.areaCode"
|
113
|
|
- :key="item.areaCode"
|
114
|
|
- >{{ item.areaName }}</Option
|
|
143
|
+ v-for="item in areaList"
|
|
144
|
+ :value="item.areaCode"
|
|
145
|
+ :key="item.areaCode"
|
|
146
|
+ >{{ item.areaName }}</Option
|
115
|
147
|
>
|
116
|
148
|
</Select>
|
117
|
149
|
<Select
|
118
|
|
- :transfer="true"
|
119
|
|
- v-model="adminInfo.marketid"
|
120
|
|
- @on-change="marketChange"
|
121
|
|
- style="width: 120px;margin: 0 10px"
|
122
|
|
- placeholder="请选择市"
|
|
150
|
+ :transfer="true"
|
|
151
|
+ v-model="adminInfo.marketid"
|
|
152
|
+ @on-change="marketChange(adminInfo.marketid, null)"
|
|
153
|
+ style="width: 120px; margin: 0 10px"
|
|
154
|
+ placeholder="请选择市"
|
123
|
155
|
>
|
124
|
156
|
<Option
|
125
|
|
- v-for="item in marketList"
|
126
|
|
- :value="item.areaCode"
|
127
|
|
- :key="item.areaCode"
|
128
|
|
- >{{ item.areaName }}</Option
|
|
157
|
+ v-for="item in marketList"
|
|
158
|
+ :value="item.areaCode"
|
|
159
|
+ :key="item.areaCode"
|
|
160
|
+ >{{ item.areaName }}</Option
|
129
|
161
|
>
|
130
|
162
|
</Select>
|
131
|
163
|
<Select
|
132
|
|
- :transfer="true"
|
133
|
|
- v-model="adminInfo.areaCode"
|
134
|
|
- @on-change="regionChange"
|
135
|
|
- style="width: 120px"
|
136
|
|
- placeholder="请选择区"
|
|
164
|
+ :transfer="true"
|
|
165
|
+ v-model="adminInfo.areaCode"
|
|
166
|
+ style="width: 120px"
|
|
167
|
+ placeholder="请选择区"
|
137
|
168
|
>
|
138
|
169
|
<Option
|
139
|
|
- v-for="item in regionList"
|
140
|
|
- :value="item.areaCode"
|
141
|
|
- :key="item.areaCode"
|
142
|
|
- >{{ item.areaName }}</Option
|
|
170
|
+ v-for="item in regionList"
|
|
171
|
+ :value="item.areaCode"
|
|
172
|
+ :key="item.areaCode"
|
|
173
|
+ >{{ item.areaName }}</Option
|
143
|
174
|
>
|
144
|
175
|
</Select>
|
145
|
176
|
</FormItem>
|
|
@@ -322,10 +353,12 @@ export default {
|
322
|
353
|
return {
|
323
|
354
|
searchForm: {
|
324
|
355
|
dropList: [],
|
|
356
|
+ marketList: [],
|
|
357
|
+ regionList: [],
|
|
358
|
+ provinceid: "",
|
|
359
|
+ marketid: "",
|
325
|
360
|
areaCode: "",
|
326
|
|
- // 0所有区域
|
327
|
|
- regionid: 0,
|
328
|
|
- // 是否启用0所有 1启用 2禁用
|
|
361
|
+ regionid: 0, // 0所有区域
|
329
|
362
|
schoolName: "",
|
330
|
363
|
page: 1,
|
331
|
364
|
size: 10,
|
|
@@ -432,7 +465,7 @@ export default {
|
432
|
465
|
},
|
433
|
466
|
{
|
434
|
467
|
title: "省市区",
|
435
|
|
- key: "regionName",
|
|
468
|
+ key: "areaName",
|
436
|
469
|
align: "center"
|
437
|
470
|
},
|
438
|
471
|
{
|
|
@@ -471,40 +504,62 @@ export default {
|
471
|
504
|
localStorage.getItem("xh_control_userInfo")
|
472
|
505
|
).content;
|
473
|
506
|
this.getSearchRegionList();
|
474
|
|
- this.getAreaList()
|
|
507
|
+ this.getAreaList();
|
475
|
508
|
this.searchList();
|
476
|
509
|
},
|
477
|
510
|
mounted() {},
|
478
|
511
|
methods: {
|
479
|
512
|
//选择省份
|
480
|
|
- provinceChange(){
|
481
|
|
- let arr = this.areaList.filter(v=>v.areaCode === this.adminInfo.provinceid);
|
482
|
|
- this.marketList = arr[0].childList;
|
483
|
|
- this.adminInfo.marketid = "";
|
484
|
|
- this.regionList = [];
|
485
|
|
- this.adminInfo.areaCode = "";
|
|
513
|
+ provinceChange(id, type) {
|
|
514
|
+ let arr = this.areaList.filter((v) => v.areaCode === id);
|
|
515
|
+ if (type) {
|
|
516
|
+ this.searchForm.marketList = arr[0].childList;
|
|
517
|
+ this.searchForm.marketid = "";
|
|
518
|
+ this.searchForm.regionList = [];
|
|
519
|
+ this.searchForm.areaCode = "";
|
|
520
|
+ } else {
|
|
521
|
+ this.marketList = arr[0].childList;
|
|
522
|
+ this.adminInfo.marketid = "";
|
|
523
|
+ this.regionList = [];
|
|
524
|
+ this.adminInfo.areaCode = "";
|
|
525
|
+ }
|
486
|
526
|
},
|
487
|
527
|
//选择市
|
488
|
|
- marketChange(){
|
489
|
|
- let arr = this.marketList.filter(v=>v.areaCode === this.adminInfo.marketid);
|
490
|
|
- this.regionList = arr[0].childList;
|
491
|
|
- this.adminInfo.areaCode = "";
|
|
528
|
+ marketChange(id, type) {
|
|
529
|
+ if (!id) {
|
|
530
|
+ return;
|
|
531
|
+ }
|
|
532
|
+ if (type) {
|
|
533
|
+ let arr = this.searchForm.marketList.filter((v) => v.areaCode === id);
|
|
534
|
+ this.searchForm.regionList = arr[0].childList;
|
|
535
|
+ this.searchForm.areaCode = "";
|
|
536
|
+ } else {
|
|
537
|
+ let arr = this.marketList.filter((v) => v.areaCode === id);
|
|
538
|
+ this.regionList = arr[0].childList;
|
|
539
|
+ this.adminInfo.areaCode = "";
|
|
540
|
+ }
|
492
|
541
|
},
|
493
|
542
|
//选中区
|
494
|
|
- regionChange(){
|
495
|
|
- let arr = this.regionList.filter(v=>v.areaCode === this.adminInfo.areaCode)[0];
|
496
|
|
- console.log(arr)
|
497
|
|
- this.adminInfo.areaName = arr.areaName;
|
|
543
|
+ regionChange() {
|
|
544
|
+ if (!this.searchForm.areaCode) {
|
|
545
|
+ return;
|
|
546
|
+ }
|
|
547
|
+ let obj = this.searchForm.regionList.filter(
|
|
548
|
+ (v) => v.areaCode === this.searchForm.areaCode
|
|
549
|
+ )[0];
|
|
550
|
+ console.log(obj);
|
|
551
|
+ this.searchForm.areaName = obj.areaAll;
|
|
552
|
+ this.searchList();
|
498
|
553
|
},
|
499
|
|
- getAreaList(){
|
500
|
|
- area_list_sel({}).then(res=>{
|
501
|
|
- if(res.code === 0){
|
502
|
|
- console.log(res.obj)
|
|
554
|
+ getAreaList() {
|
|
555
|
+ area_list_sel({}).then((res) => {
|
|
556
|
+ if (res.code === 0) {
|
|
557
|
+ console.log(res.obj);
|
503
|
558
|
this.areaList = res.obj;
|
504
|
|
- }else {
|
505
|
|
- this.$Message.error(res.msg)
|
|
559
|
+ } else {
|
|
560
|
+ this.$Message.error(res.msg);
|
506
|
561
|
}
|
507
|
|
- })
|
|
562
|
+ });
|
508
|
563
|
},
|
509
|
564
|
// 获取搜索区域列表
|
510
|
565
|
getSearchRegionList() {
|
|
@@ -641,6 +696,10 @@ export default {
|
641
|
696
|
this.adminInfo.timer = null;
|
642
|
697
|
}
|
643
|
698
|
}
|
|
699
|
+ let areaObj = this.regionList.filter(
|
|
700
|
+ (v) => v.areaCode === this.adminInfo.areaCode
|
|
701
|
+ )[0];
|
|
702
|
+ this.adminInfo.areaName = areaObj.areaAll;
|
644
|
703
|
this.adminInfo.show = false;
|
645
|
704
|
let api = this.adminInfo.schoolid ? school_edit : school_add;
|
646
|
705
|
let form = {
|
|
@@ -685,14 +744,24 @@ export default {
|
685
|
744
|
toEdit(row) {
|
686
|
745
|
school_detail({ schoolid: row.schoolid }).then((res) => {
|
687
|
746
|
if (res.code === 0) {
|
|
747
|
+ let str = res.obj.areaCode;
|
|
748
|
+ //获取省市区
|
|
749
|
+ let obj1 = this.areaList.filter((v) =>
|
|
750
|
+ v.areaCode.includes(str.substring(0, 2))
|
|
751
|
+ )[0];
|
|
752
|
+ this.marketList = obj1.childList;
|
|
753
|
+ let obj2 = obj1.childList.filter((v) =>
|
|
754
|
+ v.areaCode.includes(str.substring(0, 4))
|
|
755
|
+ )[0];
|
|
756
|
+ this.regionList = obj2.childList;
|
688
|
757
|
this.adminInfo = {
|
689
|
758
|
show: true,
|
690
|
759
|
timer: null,
|
691
|
760
|
second: 0,
|
692
|
761
|
schoolid: res.obj.schoolid,
|
693
|
762
|
schoolName: res.obj.schoolName,
|
694
|
|
- provinceid: "",
|
695
|
|
- marketid: "",
|
|
763
|
+ provinceid: obj1.areaCode,
|
|
764
|
+ marketid: obj2.areaCode,
|
696
|
765
|
areaCode: res.obj.areaCode,
|
697
|
766
|
areaName: res.obj.areaName,
|
698
|
767
|
address: res.obj.address,
|
|
@@ -702,6 +771,7 @@ export default {
|
702
|
771
|
createAdmin: false,
|
703
|
772
|
admin: {}
|
704
|
773
|
};
|
|
774
|
+ console.log(this.adminInfo);
|
705
|
775
|
} else {
|
706
|
776
|
this.$Message.error(res.msg);
|
707
|
777
|
}
|