1 <template>
2 <div class="div">
3 <div class="top">
4 <el-page-header @back="goBack" content="修改地区"></el-page-header>
5 </div>
6 <div class="tianchun"></div>
7 <div class="fill"></div>
8 <div class="select">
9 <el-form ref="form" label-width="80px">
10 <el-form-item label="省:">
11 <el-select v-model="sheng" placeholder="请选择省份" @change="loadShi">
12 <el-option 13 v-for="item in province"
14 :key="item.REGION_CODE"
15 :label="item.REGION_NAME"
16 :value="item.REGION_ID"
17 ></el-option>
18 </el-select>
19 </el-form-item>
20
21 <el-form-item label="市:">
22 <el-select v-model="shi" placeholder="请选择市区" @change="loadQu">
23 <el-option 24 v-for="item in cities"
25 :key="item.REGION_CODE"
26 :label="item.REGION_NAME"
27 :value="item.REGION_ID"
28 ></el-option>
29 </el-select>
30 </el-form-item>
31
32 <el-form-item label="县:">
33 <el-select v-model="qu" placeholder="请选择区县">
34 <el-option 35 v-for="item in district"
36 :key="item.REGION_CODE"
37 :label="item.REGION_NAME"
38 :value="item.REGION_ID"
39 ></el-option>
40 </el-select>
41 </el-form-item>
42 </el-form>
43 </div>
44 <div class="button">
45 <el-button type="warning" style="background-color: #3D7EFF;border-color: #3D7EFF;" @click="gomodify"> 保
46 存
47 </el-button>
48
49 <el-button type="success" style="background-color: #3D7EFF;border-color: #3D7EFF;" @click="goBack"> 取
50 消
51 </el-button>
52 </div>
53 </div>
54 </template>
55
56 <style scoped>
57 .div {
58 background-color: #f2f2f2;
59 width: 100%;
60 height: auto;
61 }
62
63 .tianchun {
64 width: 100%;
65 height: 6px;
66 }
67
68 .top {
69 width: 100%;
70 height: 45px;
71 padding-left: 10px;
72 padding-top: 20px;
73 background-color: #ffffff;
74 }
75
76 .fill {
77 width: 100%;
78 height: 5px;
79 background-color: #ffffff;
80 padding-top: 15px;
81 }
82
83 .select {
84 background-color: #ffffff;
85 }
86
87 .button {
88 float: right;
89 margin-top: 30px;
90 margin-right: 40px;
91 }
92 </style>
93
94 <script>
95 export default { 96 data() { 97 return { 98 province: [], 99 cities: [], 100 district: [], 101 options: [], 102 sheng: "", 103 shi: "", 104 qu: "", 105 value: ""
106 } 107 },
108 created() { 109 var that = this; 110 this.$axios.get("/getaddresslist").then(function (response) { 111 that.province = response.data; 112 }); 113 this.loadRegion(1, "sheng"); 114 }, 115 methods: { 116 loadRegion(parent_id, flag) { 117 var that = this; 118 that.$axios 119 .get("/getaddresslist", {params: {parent_id: parent_id}}) 120 .then(function (response) { 121 if ("sheng" == flag) { 122 that.province = response.data; 123 } 124 if ("shi" == flag) { 125 that.cities = response.data; 126 } 127 if ("qu" == flag) { 128 that.district = response.data; 129 } 130 }); 131 }, 132 loadShi(e) { 133 this.loadRegion(e, "shi"); 134 }, 135 loadQu(e) { 136 this.loadRegion(e, "qu"); 137 }, 138 } 146 }; 147 </script>