Explorar o código

活动审核权限控制

LuChongMei hai 7 meses
pai
achega
028284f881

+ 6 - 1
src/api/sys/userSets.js

@@ -32,7 +32,12 @@ export default class userSets {
             params
         )
     };
-
+	//  用户权限
+	getMenus() {
+	    return request.get(
+	      `/sys/user/getMenus`
+	    )
+	  };
     //盐政通测试用户同步规则
     SchemaService(params) {
         return request.post(

+ 2 - 0
src/main.js

@@ -7,6 +7,7 @@ import './styles/style.css';
 import api from '@/api';
 import axios from 'axios';
 import dictUtils from '@/utils/dictUtils'
+import {hasPermission} from '@/utils/auth'
 
 
 import { NavBar, Button, Form, Field, CellGroup, Tabbar, TabbarItem, Icon, Toast, Image as VanImage, Grid, GridItem, Row, Col, Tab, Tabs, Popup, PickerGroup, DatePicker, TimePicker, Picker, Uploader, Dialog, List, Cell, Cascader, Search, RadioGroup, Radio, DropdownMenu, DropdownItem, SwipeCell, Checkbox, CheckboxGroup, Swipe, SwipeItem, Loading, TextEllipsis, TreeSelect, Sidebar, SidebarItem } from 'vant';
@@ -60,4 +61,5 @@ app.use(router)
 app.config.globalProperties.$API = api
 app.config.globalProperties.$axios = axios
 app.config.globalProperties.$dictUtils = dictUtils
+app.config.globalProperties.$hasPermission = hasPermission
 app.mount('#app')

+ 10 - 1
src/store/index.js

@@ -2,11 +2,13 @@ import { createStore } from "vuex";
 const TOKEN_Key = "MZ_USER";
 const PCTOKEN_Key = "MZ_TOKEN";
 const COLOR_Key = "MZ_COLOR";
+const PERMISSIONS_KEY = "permissions";
 const store = createStore({
     state: {
         user: window.localStorage.getItem(TOKEN_Key),
         pctoken: window.localStorage.getItem(PCTOKEN_Key),
-        selectcolor: window.localStorage.getItem(COLOR_Key)
+        selectcolor: window.localStorage.getItem(COLOR_Key),
+        permissions: window.localStorage.getItem(PERMISSIONS_KEY)
     },
     mutations: {
         setUser(state, data) {
@@ -29,6 +31,13 @@ const store = createStore({
             })
             window.localStorage.setItem(COLOR_Key, state.selectcolor);
         },
+        setPermissions(state, data) {
+            state.permissions = data;
+            xm.setStorage({ key: PERMISSIONS_KEY, value: state.permissions }).then(() => {
+
+            })
+            window.localStorage.setItem(PERMISSIONS_KEY, state.permissions);
+        },
     },
 });
 export default store;

+ 1 - 1
src/views/activityMan/placeactivity/placeActivityInfo.vue

@@ -187,7 +187,7 @@
       </van-cell-group>
     </div>
     <van-button
-      v-if="placeActivity.assessment == 0"
+      v-if="placeActivity.assessment == 0 && $hasPermission('reporting:reportingActivities:kor')"
       type="primary"
       class="btn-sub"
       @click="update"

+ 1 - 1
src/views/activityMan/placeactivity/placeActivityView.vue

@@ -33,7 +33,7 @@
 				</van-popup>
 			</van-cell-group>
 			<van-cell-group>
-				<van-field v-model="placeActivity.participantsNum" center readonly required
+				<van-field v-model="placeActivity.participantsNum" center required
 					:rules="[{ required: true }]" clearable label="参会人数:" placeholder="请填写参会人数" input-align="right"
 					type="digit" />
 			</van-cell-group>

+ 31 - 12
src/views/tab_a/tabAll.vue

@@ -155,7 +155,9 @@ export default {
 
   created() {
     let id = this.$route.query.id;
-    window.xm.setNavigationBarTitle({ title: "宗教和顺" });
+    window.xm.setNavigationBarTitle({
+      title: "宗教和顺",
+    });
     this.TokenLogin2();
     this.$dictUtils.refreshDictList();
   },
@@ -166,7 +168,9 @@ export default {
       let value = JSON.stringify(e.currentTarget.id);
       this.$router.push({
         path: "/toBeDone",
-        query: { name: value },
+        query: {
+          name: value,
+        },
       });
     },
     // 场所登记跳转
@@ -237,12 +241,21 @@ export default {
           {
             token: token,
           },
-          { allowDots: true, arrayFormat: "indices" }
+          {
+            allowDots: true,
+            arrayFormat: "indices",
+          }
         );
         var res = await this.$API.yin.TokenLogin.get(inputForm);
-        //存PCtoken
-        this.$store.commit("setPcToken", res.PcToken);
-        this.$store.commit("setUser", res.account);
+        new userSets().getMenus().then(({ data }) => {
+          //存PCtoken
+          this.$store.commit("setPcToken", res.PcToken);
+          this.$store.commit("setUser", res.account);
+          that.$store.commit(
+            "setPermissions",
+            JSON.stringify(data.permissions || "[]")
+          );
+        });
 
         //})//上线取消注释
       }
@@ -265,11 +278,17 @@ export default {
               token: token,
             })
             .then((res) => {
-              that.$store.commit("setPcToken", res.PcToken);
-              that.$store.commit("setUser", res.account);
-              that.getBannerImg(); //获取轮播图
-              that.getSelectColor(); //获取主题颜色
-              that.dataNumber(); //获取待办事项数
+              new userSets().getMenus().then(({ data }) => {
+                that.$store.commit("setPcToken", res.PcToken);
+                that.$store.commit("setUser", res.account);
+                that.$store.commit(
+                  "setPermissions",
+                  JSON.stringify(data.permissions || "[]")
+                );
+                that.getBannerImg(); //获取轮播图
+                that.getSelectColor(); //获取主题颜色
+                that.dataNumber(); //获取待办事项数
+              });
             });
         }); //上线取消注释
       } else {
@@ -432,4 +451,4 @@ export default {
   height: 100%;
   background: #ffffff;
 }
-</style>
+</style>