Browse Source

商铺管理:依据所属板块查询楼栋列表

skym1024 1 year ago
parent
commit
207d328f78
2 changed files with 42 additions and 3 deletions
  1. 8 0
      src/api/community/shop.js
  2. 34 3
      src/views/community/shop/index.vue

+ 8 - 0
src/api/community/shop.js

@@ -9,6 +9,14 @@ export function listShop(query) {
   })
 }
 
+// 依据商业板块
+export function listBuildingByDistrict(district) {
+  return request({
+    url: '/community/shop/listBuildingByDistrict/' + district,
+    method: 'get'
+  })
+}
+
 // 查询shop详细
 export function getShop(shopId) {
   return request({

+ 34 - 3
src/views/community/shop/index.vue

@@ -10,7 +10,7 @@
         />
       </el-form-item>
       <el-form-item label="商业板块" prop="district">
-        <el-select v-model="queryParams.district" placeholder="请选择商业板块" clearable>
+        <el-select v-model="queryParams.district" placeholder="请选择商业板块" @change="handleSelectDistrict" clearable>
           <el-option
             v-for="dict in dict.type.che_district"
             :key="dict.value"
@@ -19,17 +19,29 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="楼栋" prop="building">
+      <!-- <el-form-item label="楼栋" prop="building">
         <el-input
           v-model="queryParams.building"
+          v-bind:disabled="districtNotSelected"
           placeholder="请输入楼栋"
           clearable
           @keyup.enter.native="handleQuery"
         />
+      </el-form-item> -->
+      <el-form-item label="楼栋" prop="building">
+        <el-select v-model="queryParams.building" v-bind:disabled="districtNotSelected" placeholder="请选择楼栋" clearable>
+          <el-option
+            v-for="item in buildingList"
+            :key="item"
+            :label="item"
+            :value="item"
+          ></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item label="楼层" prop="floor">
         <el-input
           v-model="queryParams.floor"
+          v-bind:disabled="districtNotSelected"
           placeholder="请输入楼层"
           clearable
           @keyup.enter.native="handleQuery"
@@ -220,7 +232,7 @@
 </template>
 
 <script>
-import { listShop, getShop, delShop, addShop, updateShop } from "@/api/community/shop";
+import { listShop, listBuildingByDistrict, getShop, delShop, addShop, updateShop } from "@/api/community/shop";
 
 export default {
   name: "Shop",
@@ -241,6 +253,8 @@ export default {
       total: 0,
       // shop表格数据
       shopList: [],
+      // building表格数据
+      buildingList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -268,6 +282,11 @@ export default {
   created() {
     this.getList();
   },
+  computed: {
+    districtNotSelected() {
+      return this.queryParams.district === null;
+    }
+  },
   methods: {
     /** 查询shop列表 */
     getList() {
@@ -320,6 +339,13 @@ export default {
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
+    handleSelectDistrict(data){
+      this.queryParams.building = null;
+      this.queryParams.floor = null;
+      listBuildingByDistrict(data).then(response => {
+        this.buildingList = response.data;
+      });
+    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -371,6 +397,11 @@ export default {
       this.download('community/shop/export', {
         ...this.queryParams
       }, `shop_${new Date().getTime()}.xlsx`)
+    },
+    handleImport() {
+      this.download('community/shop/export', {
+        ...this.queryParams
+      }, `shop_${new Date().getTime()}.xlsx`)
     }
   }
 };