Commit f8cea7e4bf6d3159f7ddae7c56bebe33ce61b3c2
1 parent
2ee4f101
投放点区域,改为动态获取
Showing
1 changed file
with
33 additions
and
7 deletions
trash-ui/src/views/unit/dropPointInfo/index.vue
| ... | ... | @@ -81,8 +81,18 @@ |
| 81 | 81 | <el-table v-loading="loading" :data="dropPointInfoList" @selection-change="handleSelectionChange"> |
| 82 | 82 | <el-table-column type="selection" width="55" align="center"/> |
| 83 | 83 | <el-table-column label="投放点名称" align="center" prop="dropPointName"/> |
| 84 | - <el-table-column label="所属区域" align="center" prop="district"/> | |
| 85 | - <el-table-column label="所属街道" align="center" prop="street"/> | |
| 84 | + <el-table-column label="所属区域" align="center" prop="district"> | |
| 85 | + <template slot-scope="scope"> | |
| 86 | + <span>{{ dict(scope.row.district) }}</span> | |
| 87 | + </template> | |
| 88 | + </el-table-column> | |
| 89 | + <el-table-column label="所属街道" align="center" prop="street"> | |
| 90 | + <template slot-scope="scope"> | |
| 91 | + <span>{{ | |
| 92 | + dictInfo(scope.row.street) | |
| 93 | + }}</span> | |
| 94 | + </template> | |
| 95 | + </el-table-column> | |
| 86 | 96 | <el-table-column label="社区" align="center" prop="community"/> |
| 87 | 97 | <el-table-column label="详细地址" align="center" prop="address"/> |
| 88 | 98 | <el-table-column label="投放点形式" align="center" prop="type"/> |
| ... | ... | @@ -149,14 +159,14 @@ |
| 149 | 159 | <el-col :span="12"> |
| 150 | 160 | <el-form-item label="所属区域" prop="street"> |
| 151 | 161 | <el-select v-model="form.district" placeholder="请输入所属区域" style="width: 100%" clearable @change="getStreets"> |
| 152 | - <el-option v-for="(area,index) in areas" :label="area.name" :value="area.name" :key="index"/> | |
| 162 | + <el-option v-for="(area,index) in areas" :label="area.name" :value="area.code" :key="index"/> | |
| 153 | 163 | </el-select> |
| 154 | 164 | </el-form-item> |
| 155 | 165 | </el-col> |
| 156 | 166 | <el-col :span="12"> |
| 157 | 167 | <el-form-item label="所属街道" prop="street"> |
| 158 | 168 | <el-select v-model="form.street" placeholder="请输入所属街道" style="width: 100%" clearable> |
| 159 | - <el-option v-for="(area,index) in streets" :label="area.name" :value="area.name" :key="area.code" @click.native="createDropPointNo(area)"/> | |
| 169 | + <el-option v-for="(area,index) in streets" :label="area.name" :value="area.code" :key="area.code" @click.native="createDropPointNo(area)"/> | |
| 160 | 170 | </el-select> |
| 161 | 171 | </el-form-item> |
| 162 | 172 | |
| ... | ... | @@ -421,12 +431,12 @@ export default { |
| 421 | 431 | const data = response; |
| 422 | 432 | for (let dataKey in data) { |
| 423 | 433 | if(data[dataKey].level === '3'){ |
| 424 | - this.areas.push({name:data[dataKey].name,id:data[dataKey].id, streets:[]}) | |
| 434 | + this.areas.push({name:data[dataKey].name,code:data[dataKey].id, streets:[]}) | |
| 425 | 435 | } |
| 426 | 436 | } |
| 427 | 437 | for(let dataKey in data){ |
| 428 | 438 | for(let areas1Key in this.areas){ |
| 429 | - if(data[dataKey].pid === this.areas[areas1Key].id){ | |
| 439 | + if(data[dataKey].pid === this.areas[areas1Key].code){ | |
| 430 | 440 | this.areas[areas1Key].streets.push({code:data[dataKey].id, name:data[dataKey].name}) |
| 431 | 441 | } |
| 432 | 442 | } |
| ... | ... | @@ -437,6 +447,22 @@ export default { |
| 437 | 447 | // this.initAMap(); |
| 438 | 448 | }, |
| 439 | 449 | methods: { |
| 450 | + dict(code){ | |
| 451 | + for(let key in this.areas){ | |
| 452 | + if(this.areas[key].code === code){ | |
| 453 | + return this.areas[key].name; | |
| 454 | + } | |
| 455 | + } | |
| 456 | + }, | |
| 457 | + dictInfo(code){ | |
| 458 | + for(let key in this.areas){ | |
| 459 | + for(let keyInfo in this.areas[key].streets){ | |
| 460 | + if(this.areas[key].streets[keyInfo].code === code){ | |
| 461 | + return this.areas[key].streets[keyInfo].name; | |
| 462 | + } | |
| 463 | + } | |
| 464 | + } | |
| 465 | + }, | |
| 440 | 466 | clearCoordinatePoint(){ |
| 441 | 467 | this.center = null; |
| 442 | 468 | this.form.coordinatePoint = null; |
| ... | ... | @@ -584,7 +610,7 @@ export default { |
| 584 | 610 | this.streets = []; |
| 585 | 611 | this.form.dropPointNo = null; |
| 586 | 612 | this.form.street = null; |
| 587 | - const region = this.areas.find(region => region.name === regionName); | |
| 613 | + const region = this.areas.find(region => region.code === regionName); | |
| 588 | 614 | this.streets = region.streets; |
| 589 | 615 | }, |
| 590 | 616 | /** 下载文件 */ | ... | ... |