Browse Source

商铺管理:去掉building, floor,改为tag

skym1024 1 year ago
parent
commit
e07ecc0553
2 changed files with 43 additions and 60 deletions
  1. 2 10
      src/api/community/shop.js
  2. 41 50
      src/views/community/shop/index.vue

+ 2 - 10
src/api/community/shop.js

@@ -10,17 +10,9 @@ export function listShop(query) {
 }
 
 // 依据商业板块
-export function listBuildingByDistrict(district) {
+export function listTagByDistrict(district) {
   return request({
-    url: '/community/shop/listBuildingByDistrict/' + district,
-    method: 'get'
-  })
-}
-
-// 依据商业板块
-export function getDistrictBuildingFloor() {
-  return request({
-    url: '/community/shop/districtBuildingFloor',
+    url: '/community/shop/listTagByDistrict/' + district,
     method: 'get'
   })
 }

+ 41 - 50
src/views/community/shop/index.vue

@@ -9,13 +9,25 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="商业板块" prop="address">
-        <el-cascader
-              v-model="addressSelected"
-              :options="addressOptions"
-              :props="{ checkStrictly: true }"
-              clearable
-              @change="handleChange"></el-cascader>
+      <el-form-item label="商业板块" prop="district">
+        <el-select v-model="queryParams.district" placeholder="请选择商业板块" @change="handleSelectDistrict" clearable>
+          <el-option
+            v-for="dict in dict.type.che_district"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="标签" prop="tag">
+        <el-select v-model="queryParams.tag"  v-bind:disabled="districtNotSelected" placeholder="请选择标签" clearable>
+          <el-option
+            v-for="item in tagList"
+            :key="item"
+            :label="item"
+            :value="item"
+          ></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item label="使用状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="请选择使用状态" clearable>
@@ -62,7 +74,7 @@
           icon="el-icon-upload"
           size="mini"
           @click="handleImport"
-          v-hasPermi="['community:shop:export']"
+          v-hasPermi="['community:shop:import']"
         >导入</el-button>
       </el-col>
       <el-col :span="1.5">
@@ -85,8 +97,7 @@
           <dict-tag :options="dict.type.che_district" :value="scope.row.district"/>
         </template>
       </el-table-column>
-      <el-table-column label="楼栋" align="center" prop="building" />
-      <el-table-column label="楼层" align="center" prop="floor" />
+      <el-table-column label="标签" align="center" prop="tag" />
       <el-table-column label="店铺号" align="center" prop="number" />
       <el-table-column label="使用状态" align="center" prop="status">
         <template slot-scope="scope">
@@ -149,11 +160,8 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="楼栋" prop="building">
-          <el-input v-model="form.building" placeholder="请输入楼栋" />
-        </el-form-item>
-        <el-form-item label="楼层" prop="floor">
-          <el-input v-model="form.floor" placeholder="请输入楼层" />
+        <el-form-item label="标签" prop="tag">
+          <el-input v-model="form.tag" placeholder="请输入标签" />
         </el-form-item>
         <el-form-item label="店铺号" prop="number">
           <el-input v-model="form.number" placeholder="请输入店铺号" />
@@ -244,7 +252,7 @@
 </template>
 
 <script>
-import { listShop, listBuildingByDistrict, getDistrictBuildingFloor, getShop, delShop, addShop, updateShop } from "@/api/community/shop";
+import { listShop, listTagByDistrict, getShop, delShop, addShop, updateShop } from "@/api/community/shop";
 import { getToken } from "@/utils/auth";
 
 export default {
@@ -252,8 +260,6 @@ export default {
   dicts: ['establishment_category', 'vacant_status', 'che_district', 'business_model'],
   data() {
     return {
-      addressSelected: [],
-      addressOptions: [],
       // 遮罩层
       loading: true,
       // 选中数组
@@ -268,6 +274,8 @@ export default {
       total: 0,
       // shop表格数据
       shopList: [],
+      // tag表格数据
+      tagList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -277,8 +285,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         district: null,
-        building: null,
-        floor: null,
+        tag: null,
         status: null,
         name: null,
       },
@@ -309,7 +316,11 @@ export default {
   },
   created() {
     this.getList();
-    this.getDistrictBuidlingFloor();
+  },
+  computed: {
+    districtNotSelected() {
+      return this.queryParams.district === null;
+    }
   },
   methods: {
     /** 查询shop列表 */
@@ -321,11 +332,6 @@ export default {
         this.loading = false;
       });
     },
-    getDistrictBuidlingFloor(){
-      getDistrictBuildingFloor().then(response => {
-        this.addressOptions = response.data;
-      });
-    },
     // 取消按钮
     cancel() {
       this.open = false;
@@ -336,8 +342,7 @@ export default {
       this.form = {
         shopId: null,
         district: null,
-        building: null,
-        floor: null,
+        tag: null,
         number: null,
         status: null,
         name: null,
@@ -363,38 +368,24 @@ export default {
 
       this.queryParams.name = null;
       this.queryParams.district = null;
-      this.queryParams.building = null;
-      this.queryParams.floor = null;
+      this.queryParams.tag = null;
       this.queryParams.status = null;
 
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    handleChange(value) {
-        if (value.length == 1) {
-          this.queryParams.district = value[0];
-          this.queryParams.building = null;
-          this.queryParams.floor = null;
-        }
-
-        if (value.length == 2) {
-          this.queryParams.district = value[0];
-          this.queryParams.building = value[1];
-          this.queryParams.floor = null;
-        }
-
-        if (value.length == 3) {
-          this.queryParams.district = value[0];
-          this.queryParams.building = value[1];
-          this.queryParams.floor = value[2];
-        }
-    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.shopId)
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
+    handleSelectDistrict(data){
+      this.queryParams.tag = null;
+      listTagByDistrict(data).then(response => {
+        this.tagList = response.data;
+      });
+    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -445,7 +436,7 @@ export default {
     handleExport() {
       this.download('community/shop/export', {
         ...this.queryParams
-      }, `shop_${new Date().getTime()}.xlsx`)
+      }, `商铺信息_${new Date().getTime()}.xlsx`)
     },
     /** 导入按钮操作 */
     handleImport() {