Browse Source

工作台权限分配

Shannon_mu 2 years ago
parent
commit
8be52d9063

+ 27 - 10
operationSupport/src/views/newWorkBench/components/addcommonfuntion.vue

@@ -1,10 +1,9 @@
 <template>
     <div class="commonly">
-        <el-checkbox v-for="item in modelArr" v-model="item.checkbox" :label="item.id" :key="item.id" @change="clickIocn(item)"
+        <el-checkbox v-for="item in newModeA" v-model="item.checkbox" :label="item.id" :key="item.id" @change="clickIocn(item)"
             ><div class="checkImg"><img :src="item.imgPng" /></div>
             <div class="checkName">{{ item.lableTitle }}</div>
         </el-checkbox>
-        {{modelArrs}}
     </div>
 </template>
 <script>
@@ -12,19 +11,35 @@ import { modelArr } from './commonModel.js';
 import permissionComponent from './permissionComponent';
 export default {
     props: ['params'],
-        mixins: [permissionComponent],
+    mixins: [permissionComponent],
     data() {
         return {
             valueModel: [],
-            modelArr: modelArr
+            thisModelArr: []
         };
     },
-    computed:{
-        modelArrs(){
-               console.log( this.modelArr)
+    computed: {
+        newModeA() {
+            let ArMo = [];
+            this.thisModelArr.map((item, index) => {
+                if (this.filterFuntion(this.$store.getters['getMenuList'], item.lableTitle, item.toPage)) {
+                    ArMo.push(item);
+                }
+            });
+            return ArMo;
         }
     },
     methods: {
+        // 需要什么权限才能查看
+        filterFuntion(arr, nameTitle, linkPaths) {
+            return arr.some((item) => {
+                if (!!item.children) {
+                    return this.filterFuntion(item.children, nameTitle, linkPaths);
+                } else if (item.name == nameTitle && item.linkPath == linkPaths) {
+                    return true;
+                }
+            });
+        },
         clickIocn(item) {
             let sun = this.testingCheck();
             if (sun > 4) {
@@ -34,7 +49,7 @@ export default {
         },
         testingCheck() {
             let sun = 0;
-            this.modelArr.map((list, index) => {
+            this.thisModelArr.map((list, index) => {
                 if (list.checkbox == true) {
                     sun++;
                 }
@@ -47,7 +62,7 @@ export default {
                 this.$message.info('请选择4项常用模块');
             } else {
                 let installVal = {
-                    menuIds: JSON.stringify(this.modelArr.filter((item) => item.checkbox == true))
+                    menuIds: JSON.stringify(this.thisModelArr.filter((item) => item.checkbox == true))
                 };
                 let url = '/sc-community/workbenchMenuUsed/add';
                 if (!!this.params.thisObj.id) {
@@ -63,7 +78,9 @@ export default {
             }
         }
     },
-    created() {}
+    created() {
+        this.thisModelArr = JSON.parse(JSON.stringify(modelArr));
+    }
 };
 </script>
 <style lang="scss" scoped>

+ 29 - 13
operationSupport/src/views/newWorkBench/components/commonFunctions.vue

@@ -1,33 +1,39 @@
 <template>
     <div class="modelBlock">
-        <template >
+        <template>
             <div class="model-title">
                 <div class="model-title-text">常用功能</div>
                 <div class="buttons" @click="getPop"><span class="text">自拟定</span> <span class="triangle"></span></div>
             </div>
             <div class="model-content">
-                <template v-for="(item, index) in modelArrs">
-                    <div class="blockItem" v-if="index < 4" :key="index" @click="toPage(item)">
-                        <img :src="item.imgPng" />
-                        <span>{{ item.lableTitle }}</span>
-                    </div>
-                </template>
+                <div class="blockItem" :key="index" @click="toPage(item)" v-for="(item, index) in newModeA">
+                    <img :src="item.imgPng" />
+                    <span>{{ item.lableTitle }}</span>
+                </div>
             </div>
         </template>
     </div>
 </template>
 <script>
 import { modelArr } from './commonModel.js';
-import permissionComponent from './permissionComponent';
 export default {
-    mixins: [permissionComponent],
     data() {
         return {
             thisObj: {},
-            modelArr: modelArr,
             modelArrs: []
         };
     },
+    computed: {
+        newModeA() {
+            let ArMo = [];
+            this.modelArrs.map((item, index) => {
+                if (index < 4 && this.filterFuntion(this.$store.getters['getMenuList'], item.lableTitle, item.toPage)) {
+                    ArMo.push(item);
+                }
+            });
+            return ArMo;
+        }
+    },
     methods: {
         getPop() {
             new Promise((resolve) => {
@@ -51,17 +57,27 @@ export default {
                 if (status == 0) {
                     if (!!data[0]) {
                         this.thisObj = data[0];
-                        this.modelArrs = this.modelArr.filter((item) => JSON.parse(data[0].menuIds).some((ele) => ele.id == item.id));
+                        this.modelArrs = modelArr.filter((item) => JSON.parse(data[0].menuIds).some((ele) => ele.id == item.id));
                     } else {
-                        this.modelArrs = this.modelArr;
+                        this.modelArrs = modelArr;
                     }
                 } else {
-                    this.modelArrs = this.modelArr;
+                    this.modelArrs = modelArr;
                 }
             });
         },
         toPage(item) {
             this.$router.push({ path: '/' + item.toPage });
+        },
+        // 需要什么权限才能查看
+        filterFuntion(arr, nameTitle, linkPaths) {
+            return arr.some((item) => {
+                if (!!item.children) {
+                    return this.filterFuntion(item.children, nameTitle, linkPaths);
+                } else if (item.name == nameTitle && item.linkPath == linkPaths) {
+                    return true;
+                }
+            });
         }
     },
     created() {

+ 70 - 35
operationSupport/src/views/newWorkBench/components/commonModel.js

@@ -5,35 +5,40 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_shequguanli@2x.png'),
     lableTitle: '社区管理',
     toPage: 'communityManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'loudongguanli',
     imgPng: require('@assets/img/homePage/icon_loudongguanli@2x.png'),
     lableTitle: '楼栋管理',
     toPage: 'buildingManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'fangwuguanli',
     imgPng: require('@assets/img/homePage/icon_fangwuguanli@2x.png'),
     lableTitle: '房屋管理',
     toPage: 'assetManagement/housingManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shangpuguanli',
     imgPng: require('@assets/img/homePage/icon_shangpuguanli@2x.png'),
     lableTitle: '商铺管理',
     toPage: 'assetManagement/shopManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'cheweiguanli',
     imgPng: require('@assets/img/homePage/icon_cheweiguanli@2x.png'),
     lableTitle: '车位管理',
     toPage: 'parkingLotAdministration/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //住户管理
   {
@@ -41,14 +46,16 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_zhuhuguanli@2x.png'),
     lableTitle: '住户管理',
     toPage: 'ownerManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'yezhushenhe',
     imgPng: require('@assets/img/homePage/icon_yezhushenhe@2x.png'),
     lableTitle: '业主审核',
     toPage: 'ownerManagement/ownerReview/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //告警管理
   {
@@ -56,14 +63,16 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_gaojingguanli@2x.png'),
     lableTitle: '告警管理',
     toPage: "alarmManagement/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'gaojingxiangqing',
     imgPng: require('@assets/img/homePage/icon_gaojingxiangqing@2x.png'),
     lableTitle: '告警详情',
     toPage: 'alarmManagement/details',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //收费管理
   {
@@ -71,77 +80,88 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_feiyongzhangdan@2x.png'),
     lableTitle: '费用账单',
     toPage: "payService/propertyFee/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shuifeiguanli',
     imgPng: require('@assets/img/homePage/icon_shuifeiguanli@2x.png'),
     lableTitle: '水费管理',
     toPage: "payService/waterManagement/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'dianfeiguanli',
     imgPng: require('@assets/img/homePage/icon_dianfeiguanli@2x.png'),
     lableTitle: '电费管理',
     toPage: "payService/electricManagement/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'cuijiao',
     imgPng: require('@assets/img/homePage/icon_cuijiao@2x.png'),
     lableTitle: '催缴',
     toPage: "payService/call/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'jifeiguize',
     imgPng: require('@assets/img/homePage/icon_jifeiguize@2x.png'),
     lableTitle: '计费规则',
     toPage: 'payService/billingRules/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shoufeishezhi',
     imgPng: require('@assets/img/homePage/icon_shoufeishezhi@2x.png'),
     lableTitle: '收费设置',
     toPage: "payService/chargeSetting/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shoukuanzhanghao',
     imgPng: require('@assets/img/homePage/icon_shoukuanzhanghao@2x.png'),
     lableTitle: '收款账号',
     toPage: "payService/collection/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'tongjibaobiao',
     imgPng: require('@assets/img/homePage/icon_tongjibaobiao@2x.png'),
     lableTitle: '统计报表',
     toPage: "payService/statisticalReport/chargeStatistics",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shuifeimingxi',
     imgPng: require('@assets/img/homePage/icon_shuifeimingxi@2x.png'),
     lableTitle: '水费明细',
     toPage: "payService/statisticalReport/waterChargeDetails",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'dianfeimingxi',
     imgPng: require('@assets/img/homePage/icon_dianfeimingxi@2x.png'),
     lableTitle: '电费明细',
     toPage: "payService/statisticalReport/electricityBillDetails",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'xitongshezhi',
     imgPng: require('@assets/img/homePage/icon_xitongshezhi@2x.png'),
     lableTitle: '系统设置',
     toPage: "payService/systemSetup/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //设备管理
   {
@@ -149,21 +169,24 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_shebeiguanli@2x.png'),
     lableTitle: '设备管理',
     toPage: "deviceManagement/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'sheshiguanli',
     imgPng: require('@assets/img/homePage/icon_sheshiguanli@2x.png'),
     lableTitle: '设施管理',
     toPage: "deviceManagement/indexFacilities",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'sheshileixing',
     imgPng: require('@assets/img/homePage/icon_sheshileixing@2x.png'),
     lableTitle: '设施类型',
     toPage: "deviceManagement/indexType",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //运维管理
   {
@@ -171,14 +194,16 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_gongdanguanli@2x.png'),
     lableTitle: '工单管理',
     toPage: "workOrders/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'gongdanjilu',
     imgPng: require('@assets/img/homePage/icon_gongdanjilu@2x.png'),
     lableTitle: '工单记录',
     toPage: 'workOrders/records',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //设备设施巡检
   {
@@ -186,14 +211,16 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_xunjianjihua@2x.png'),
     lableTitle: '巡检计划',
     toPage: "facilityInspections/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'xunjianjilu',
     imgPng: require('@assets/img/homePage/icon_xunjianjilu@2x.png'),
     lableTitle: '巡检记录',
     toPage: 'facilityInspections/inspectionsRecords',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //巡更管理
   {
@@ -201,21 +228,24 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_xungengdianwei@2x.png'),
     lableTitle: '巡更点位',
     toPage: "patrolManagement/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'xungengluxian',
     imgPng: require('@assets/img/homePage/icon_xungengluxian@2x.png'),
     lableTitle: '巡更路线',
     toPage: "patrolManagement/patrolRoute",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'xungengjilu',
     imgPng: require('@assets/img/homePage/icon_xungengjilu@2x.png'),
     lableTitle: '巡更记录',
     toPage: 'patrolManagement/patrolRecords',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   //物业管理
 
@@ -224,28 +254,32 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_tongzhigonggao@2x.png'),
     lableTitle: '通知公告',
     toPage: 'propertyManagement/inform',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'tousujianyi',
     imgPng: require('@assets/img/homePage/icon_tousujianyi@2x.png'),
     lableTitle: '投诉建议',
     toPage: 'propertyManagement/index',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'shequlinli',
     imgPng: require('@assets/img/homePage/icon_shequlinli@2x.png'),
     toPage: "propertyManagement/neighbor",
     lableTitle: '社区邻里',
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
   {
     id: 'wuyedianhua',
     imgPng: require('@assets/img/homePage/icon_wuyedianhua@2x.png'),
     lableTitle: '物业电话',
     toPage: "propertyManagement/phone",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
 
   // {
@@ -286,6 +320,7 @@ export const modelArr = [
     imgPng: require('@assets/img/homePage/icon_liuchengguanli @2x.png'),
     lableTitle: '流程管理',
     toPage: "flow/index",
-    checkbox: false
+    checkbox: false,
+    show: true,
   },
 ]