소스 검색

按钮字段配置

zcy 4 년 전
부모
커밋
467202c3a0

+ 1 - 0
src/components/RightModel/index.vue

@@ -135,6 +135,7 @@ export default {
       }
     },
     loadData() {
+      this.treeData = []
       getAction(this.treeList).then((res) => {
         this.allTreeKeys = []
         for (let i = 0; i < res.data.length; i++) {

+ 2 - 4
src/main.js

@@ -1,7 +1,4 @@
 import Vue from 'vue'
-
-import Cookies from 'js-cookie'
-
 import 'normalize.css/normalize.css' // a modern alternative to CSS resets
 
 import {
@@ -84,7 +81,8 @@ Vue.use(MenuItem)
 Vue.use(MenuItemGroup)
 Vue.use(Breadcrumb)
 Vue.use(BreadcrumbItem)
-
+import permission from '@/directive/permission/index.js' // 权限判断指令
+Vue.use(permission)
 // register global utility filters
 Object.keys(filters).forEach(key => {
   Vue.filter(key, filters[key])

+ 2 - 2
src/store/modules/user.js

@@ -51,7 +51,7 @@ const actions = {
           reject('Verification failed, please Login again.')
         }
 
-        const { pages, permissions, roles, user } = response
+        const { pages, btns, roles, user } = response
 
         // roles must be a non-empty array
         if (!roles || roles.length <= 0) {
@@ -59,7 +59,7 @@ const actions = {
         }
         commit('SET_USER', user)
         commit('SET_PAGES', pages)
-        commit('SET_BTNS', permissions)
+        commit('SET_BTNS', btns)
         commit('SET_ROLES', roles)
 
         resolve(response)

+ 0 - 2
src/views/dashboard/index.vue

@@ -8,12 +8,10 @@
 
 <script>
 import { mapGetters } from 'vuex'
-import permission from '@/directive/permission/index.js' // 权限判断指令
 import checkPermission from '@/utils/permission.js' // 权限判断函数
 
 export default {
   name: 'Dashboard',
-  directives: { permission },
   computed: {
     ...mapGetters([
       'user'

+ 10 - 5
src/views/sys/dept/index.vue

@@ -2,10 +2,10 @@
   <el-card style="margin: 15px">
     <!-- 操作按钮区域 -->
     <div class="table-operator" style="margin: 5px 0;float: right">
-      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-button v-permission="['pc:sys:dept:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
-          <a-menu-item key="1" @click="batchDel">
+          <a-menu-item key="1" v-permission="['pc:sys:dept:delete']" @click="batchDel">
             <a-icon type="delete" />
             删除
           </a-menu-item>
@@ -48,7 +48,7 @@
         bordered
         row-key="deptId"
         :columns="columns"
-        :defaultExpandedRowKeys="[100]"
+        :default-expanded-row-keys="[100]"
         :data-source="dataSource"
         :pagination="false"
         :loading="loading"
@@ -64,11 +64,15 @@
           />
         </template>
         <span slot="action" slot-scope="text, record">
-          <a-button size="small" type="primary" @click="handleEdit(record)">
+          <a-button v-permission="['pc:sys:dept:edit']" size="small" type="primary" @click="handleEdit(record)">
             编辑
           </a-button>
           <a-divider type="vertical" />
-          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.deptId)">
+          <a-popconfirm
+            v-permission="['pc:sys:dept:delete']"
+            title="确定删除吗?"
+            @confirm="() => handleDelete(record.deptId)"
+          >
             <a-button size="small" type="danger">
               删除
             </a-button>
@@ -86,6 +90,7 @@ import { listMixin } from '@/mixin/listMixin'
 import columns from './indexColumns'
 import CheckAndEditModel from './CheckAndEditModel'
 import { httpAction } from '@/api/request'
+
 export default {
   components: {
     CheckAndEditModel

+ 15 - 6
src/views/sys/dict/index.vue

@@ -2,13 +2,17 @@
   <el-card style="margin: 15px">
     <!-- 操作按钮区域 -->
     <div class="table-operator" style="margin: 5px 0;float: right">
-      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-button v-permission="['pc:sys:dict:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
-          <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
+          <a-menu-item key="1" v-permission="['pc:sys:dict:delete']" @click="batchDel">
+            <a-icon type="delete" />
+            删除
+          </a-menu-item>
         </a-menu>
         <a-button style="margin-left: 8px">
-          批量操作 <a-icon type="down" />
+          批量操作
+          <a-icon type="down" />
         </a-button>
       </a-dropdown>
     </div>
@@ -33,7 +37,8 @@
     <!-- table区域-begin -->
     <div>
       <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
-        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
+        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
+          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
       </div>
 
@@ -51,7 +56,7 @@
       >
 
         <span slot="action" slot-scope="text, record">
-          <a-button size="small" type="primary" @click="handleEdit(record)">
+          <a-button v-permission="['pc:sys:edit:edit']" size="small" type="primary" @click="handleEdit(record)">
             编辑
           </a-button>
           <a-divider type="vertical" />
@@ -59,7 +64,11 @@
             字典配置
           </a-button>
           <a-divider type="vertical" />
-          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.dictId)">
+          <a-popconfirm
+            v-permission="['pc:sys:dict:delete']"
+            title="确定删除吗?"
+            @confirm="() => handleDelete(record.dictId)"
+          >
             <a-button size="small" type="danger">
               删除
             </a-button>

+ 15 - 6
src/views/sys/job/index.vue

@@ -2,13 +2,17 @@
   <el-card style="margin: 15px">
     <!-- 操作按钮区域 -->
     <div class="table-operator" style="margin: 5px 0;float: right">
-      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-button v-permission="['pc:sys:job:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
-          <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
+          <a-menu-item key="1" v-permission="['pc:sys:job:delete']" @click="batchDel">
+            <a-icon type="delete" />
+            删除
+          </a-menu-item>
         </a-menu>
         <a-button style="margin-left: 8px">
-          批量操作 <a-icon type="down" />
+          批量操作
+          <a-icon type="down" />
         </a-button>
       </a-dropdown>
     </div>
@@ -33,7 +37,8 @@
     <!-- table区域-begin -->
     <div>
       <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
-        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
+        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
+          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
       </div>
 
@@ -58,7 +63,7 @@
           />
         </template>
         <span slot="action" slot-scope="text, record">
-          <a-button size="small" type="primary" @click="handleEdit(record)">
+          <a-button v-permission="['pc:sys:job:edit']" size="small" type="primary" @click="handleEdit(record)">
             编辑
           </a-button>
           <a-divider type="vertical" />
@@ -66,7 +71,11 @@
             操作权限
           </a-button>
           <a-divider type="vertical" />
-          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.roleId)">
+          <a-popconfirm
+            v-permission="['pc:sys:job:delete']"
+            title="确定删除吗?"
+            @confirm="() => handleDelete(record.roleId)"
+          >
             <a-button size="small" type="danger">
               删除
             </a-button>

+ 11 - 5
src/views/sys/menu/index.vue

@@ -2,10 +2,10 @@
   <el-card style="margin: 15px">
     <!-- 操作按钮区域 -->
     <div class="table-operator" style="margin: 5px 0;float: right">
-      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-button v-permission="['pc:sys:menu:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
-          <a-menu-item key="1" @click="batchDel">
+          <a-menu-item key="1" v-permission="['pc:sys:menu:delete']" @click="batchDel">
             <a-icon type="delete" />
             删除
           </a-menu-item>
@@ -37,7 +37,8 @@
     <!-- table区域-begin -->
     <div>
       <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
-        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
+        <i class="anticon anticon-info-circle ant-alert-icon" />
+        已选择&nbsp;<a style="font-weight: 600">{{
           selectedRowKeys.length }}</a>项&nbsp;&nbsp;
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
       </div>
@@ -75,11 +76,15 @@
           />
         </template>
         <span slot="action" slot-scope="text, record">
-          <a-button size="small" type="primary" @click="handleEdit(record)">
+          <a-button v-permission="['pc:sys:menu:edit']" size="small" type="primary" @click="handleEdit(record)">
             编辑
           </a-button>
           <a-divider type="vertical" />
-          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.menuId)">
+          <a-popconfirm
+            v-permission="['pc:sys:menu:delete']"
+            title="确定删除吗?"
+            @confirm="() => handleDelete(record.menuId)"
+          >
             <a-button size="small" type="danger">
               删除
             </a-button>
@@ -97,6 +102,7 @@ import { listMixin } from '@/mixin/listMixin'
 import columns from './indexColumns'
 import CheckAndEditModel from './CheckAndEditModel'
 import { httpAction } from '@/api/request'
+
 export default {
   components: {
     CheckAndEditModel

+ 20 - 20
src/views/sys/worker/index.vue

@@ -1,6 +1,6 @@
 <template>
   <el-card style="margin: 15px">
-    <a-row :gutter="5">
+    <a-row :gutter="15">
       <a-col :span="4">
         <leftTree @selected="getTreeData" />
       </a-col>
@@ -39,26 +39,22 @@
         </div>
         <!-- 操作按钮区域 -->
         <div class="table-operator" style="margin: 15px 0">
-          <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
-          <a-button ghost type="danger" icon="download" @click="handleExportXls('角色信息')">导出</a-button>
-          <a-upload
-            name="file"
-            :show-upload-list="false"
-            :multiple="false"
-            :headers="tokenHeader"
-            :action="url.importExcelUrl"
-            @change="handleImportExcel"
-          >
-            <a-button ghost type="danger" icon="import">导入</a-button>
-          </a-upload>
+          <a-button v-permission="['pc:sys:worker:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
+          <!--          <a-button ghost type="danger" icon="download" @click="handleExportXls('角色信息')">导出</a-button>-->
+          <!--          <a-upload-->
+          <!--            name="file"-->
+          <!--            :show-upload-list="false"-->
+          <!--            :multiple="false"-->
+          <!--            :headers="tokenHeader"-->
+          <!--            :action="url.importExcelUrl"-->
+          <!--            @change="handleImportExcel"-->
+          <!--          >-->
+          <!--            <a-button ghost type="danger" icon="import">导入</a-button>-->
+          <!--          </a-upload>-->
 
           <a-dropdown v-if="selectedRowKeys.length > 0">
             <a-menu slot="overlay">
-              <a-menu-item key="1">
-                <a-icon type="highlight" />
-                重置密码
-              </a-menu-item>
-              <a-menu-item key="2" @click="batchDel">
+              <a-menu-item key="1" v-permission="['pc:sys:worker:delete']" @click="batchDel">
                 <a-icon type="delete" />
                 批量删除
               </a-menu-item>
@@ -105,7 +101,7 @@
               />
             </template>
             <span slot="action" slot-scope="text, record">
-              <a-button size="small" type="primary" @click="handleEdit(record)">
+              <a-button v-permission="['pc:sys:worker:edit']" size="small" type="primary" @click="handleEdit(record)">
                 编辑
               </a-button>
               <a-divider type="vertical" />
@@ -128,7 +124,11 @@
                 </a-menu>
               </a-dropdown>
               <a-divider type="vertical" />
-              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+              <a-popconfirm
+                v-permission="['pc:sys:worker:delete']"
+                title="确定删除吗?"
+                @confirm="() => handleDelete(record.id)"
+              >
                 <a-button size="small" type="danger">
                   删除
                 </a-button>