瀏覽代碼

添加权限按钮

DESKTOP-SVI9JE1\muzen 1 年之前
父節點
當前提交
500603d10d
共有 1 個文件被更改,包括 20 次插入14 次删除
  1. 20 14
      src/views/operation/map/index.vue

+ 20 - 14
src/views/operation/map/index.vue

@@ -6,7 +6,7 @@
         <el-input v-model="form.name" placeholder="请输入门店名称" clearable />
       </el-form-item>
       <el-form-item label="城市筛选:">
-        <el-cascader :options="options" placeholder="请选择省市区" @change="handleChange"
+        <el-cascader v-model="form.list" :options="options" placeholder="请选择省市区" clearable
           :props="{ value: 'id', label: 'name', children: 'childList', checkStrictly: true }" />
       </el-form-item>
       <el-form-item label="当前状态:">
@@ -17,7 +17,8 @@
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
         <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
-        <el-button type="primary" icon="el-icon-plus" plain @click="getDetail()">新增</el-button>
+        <el-button type="primary" icon="el-icon-plus" plain @click="getDetail()"
+          v-hasPermi="['operation:map:add']">新增</el-button>
       </el-form-item>
     </el-form>
     <!-- 列表 -->
@@ -41,11 +42,13 @@
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
           <el-button type="text" @click="getDetail(scope.row.id, true)">查看</el-button>
-          <el-button v-if="scope.row.status === 0" type="text" @click="getChange(scope.row.id, 1, '禁用')">禁用</el-button>
+          <el-button v-if="scope.row.status === 0" type="text" @click="getChange(scope.row.id, 1, '禁用')"
+            v-hasPermi="['operation:map:down']">禁用</el-button>
           <span v-else style="margin-left: 10px;">
-            <el-button type="text" @click="getDetail(scope.row.id, true)">编辑</el-button>
-            <el-button type="text" @click="getChange(scope.row.id, 0, '启用')">启用</el-button>
-            <el-button type="delete" @click="getDelete(scope.row)">删除</el-button>
+            <el-button type="text" @click="getDetail(scope.row.id)" v-hasPermi="['operation:map:edit']">编辑</el-button>
+            <el-button type="text" @click="getChange(scope.row.id, 0, '启用')"
+              v-hasPermi="['operation:map:up']">启用</el-button>
+            <el-button type="delete" @click="getDelete(scope.row)" v-hasPermi="['operation:map:delete']">删除</el-button>
           </span>
         </template>
       </el-table-column>
@@ -65,8 +68,11 @@ export default {
       // 表单
       form: {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
+        list: []
       },
+      // 总数据
+      total: 0,
       // 省市区
       options: [],
       // 列表
@@ -81,6 +87,13 @@ export default {
       }]
     }
   },
+  watch: {
+    'form.list'(val) {
+      this.form.province = val[0]
+      this.form.city = val[1]
+      this.form.area = val[2]
+    }
+  },
   async mounted() {
     await this.getOptions()
     this.getList()
@@ -124,13 +137,6 @@ export default {
       })
     },
 
-    // 选择省市区
-    handleChange(e) {
-      this.form.province = e[0]
-      this.form.city = e[1]
-      this.form.area = e[2]
-    },
-
     // 新增、 编辑、 查看
     getDetail(id, boolean) {
       this.$router.push({