Kaynağa Gözat

角色添加默认和是否属于管理员角色

lrf 10 ay önce
ebeveyn
işleme
24e45b9306

+ 3 - 1
src/lang/package/zh-cn/pages.js

@@ -30,6 +30,7 @@ export default {
     add_config: '添加功能'
   },
   role: {
+    is_default: '是否默认',
     dialogTitle: '角色信息',
     name: '角色名称',
     namePh: '请填写角色名称',
@@ -37,7 +38,8 @@ export default {
     codePh: '请填写角色代码',
     brief: '简介',
     menu: '权限配置',
-    is_use: '是否启用'
+    is_use: '是否启用',
+    is_admin_role: '是否是管理员使用的角色'
   },
   admin: {
     dialogTitle: '用户信息',

+ 16 - 16
src/layout/site.js

@@ -15,7 +15,7 @@ export const menuInfo = {
   },
   menuList: [
     {
-      _id: '65b7633cf546132d55d63958',
+      id: '65b7633cf546132d55d63958',
       name: 'dashboard',
       order_num: 1,
       path: '/',
@@ -24,14 +24,14 @@ export const menuInfo = {
       is_use: '0'
     },
     {
-      _id: '65b7633cf546132d55d63956',
+      id: '65b7633cf546132d55d63956',
       name: 'system',
       order_num: 2,
       type: '0',
       is_use: '0',
       children: [
         {
-          _id: '65b7633cf546132d55d6395a',
+          id: '65b7633cf546132d55d6395a',
           name: 'menus',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 1,
@@ -42,7 +42,7 @@ export const menuInfo = {
           parent_name: 'system'
         },
         {
-          _id: '65b7633cf546132d55d6395b',
+          id: '65b7633cf546132d55d6395b',
           name: 'role',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 2,
@@ -53,7 +53,7 @@ export const menuInfo = {
           parent_name: 'system'
         },
         {
-          _id: '65b7633cf546132d55d6395c',
+          id: '65b7633cf546132d55d6395c',
           name: 'dict',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 3,
@@ -64,7 +64,7 @@ export const menuInfo = {
           parent_name: 'system'
         },
         {
-          _id: '65b7633cf546132d55d6395d',
+          id: '65b7633cf546132d55d6395d',
           name: 'dictData',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 4,
@@ -75,7 +75,7 @@ export const menuInfo = {
           parent_name: 'system'
         },
         {
-          _id: '65b7633cf546132d55d6395e',
+          id: '65b7633cf546132d55d6395e',
           name: 'config',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 5,
@@ -86,7 +86,7 @@ export const menuInfo = {
           parent_name: 'system'
         },
         {
-          _id: '65b88ca947ad35b235c046a9',
+          id: '65b88ca947ad35b235c046a9',
           name: 'module',
           parent_id: '65b7633cf546132d55d63956',
           order_num: 6,
@@ -99,14 +99,14 @@ export const menuInfo = {
       ]
     },
     {
-      _id: '65b7633cf546132d55d63957',
+      id: '65b7633cf546132d55d63957',
       name: '用户管理',
       order_num: 3,
       type: '0',
       is_use: '0',
       children: [
         {
-          _id: '65b7633cf546132d55d63960',
+          id: '65b7633cf546132d55d63960',
           name: '管理员用户',
           parent_id: '65b7633cf546132d55d63957',
           order_num: 1,
@@ -117,7 +117,7 @@ export const menuInfo = {
           parent_name: '用户管理'
         },
         {
-          _id: '65b7633cf546132d55d63961',
+          id: '65b7633cf546132d55d63961',
           name: '平台用户',
           parent_id: '65b7633cf546132d55d63957',
           order_num: 2,
@@ -130,7 +130,7 @@ export const menuInfo = {
       ]
     },
     {
-      _id: '65b7633cf546132d55d63963',
+      id: '65b7633cf546132d55d63963',
       name: '公证员管理',
       order_num: 5,
       path: '/personnel',
@@ -139,7 +139,7 @@ export const menuInfo = {
       is_use: '0'
     },
     {
-      _id: '65b7633cf546132d55d63964',
+      id: '65b7633cf546132d55d63964',
       name: '申办流程管理',
       order_num: 6,
       path: '/path',
@@ -148,7 +148,7 @@ export const menuInfo = {
       is_use: '0'
     },
     {
-      _id: '65b7633cf546132d55d63965',
+      id: '65b7633cf546132d55d63965',
       name: '业务管理',
       order_num: 7,
       path: '/business',
@@ -157,7 +157,7 @@ export const menuInfo = {
       is_use: '0'
     },
     {
-      _id: '65b7633cf546132d55d63966',
+      id: '65b7633cf546132d55d63966',
       name: '申请记录管理',
       order_num: 8,
       path: '/apply',
@@ -166,7 +166,7 @@ export const menuInfo = {
       is_use: '0'
     },
     {
-      _id: '65b7633cf546132d55d63962',
+      id: '65b7633cf546132d55d63962',
       name: '修改密码',
       order_num: 999,
       path: '/acccount/updatepd',

+ 3 - 0
src/utils/axios-wrapper.js

@@ -94,6 +94,7 @@ export class AxiosWrapper {
       }
       const res = await axios.request(requestOptions)
       let returnRes = res.data
+      console.log(returnRes)
       const { errcode, errmsg, details } = returnRes
       if (errcode) {
         console.warn(`[${uri}] fail: ${errcode}-${errmsg} ${details}`)
@@ -111,6 +112,8 @@ export class AxiosWrapper {
               .catch(() => {
                 if (nowRouteFullPath !== '/login') location.reload()
               })
+          } else {
+            ElMessage.error(errmsg)
           }
         }
         return returnRes

+ 1 - 1
src/views/system/role/index.vue

@@ -97,7 +97,7 @@ const changeUse = async (data) => {
 }
 const toAdd = () => {
   dialog.value = true
-  form.value = { is_use: '0', menu: ['home'] }
+  form.value = { is_use: '0', menu: ['home'], is_admin_role: '0' }
 }
 const toClose = () => {
   dialog.value = false

+ 14 - 0
src/views/system/role/parts/form.vue

@@ -1,5 +1,18 @@
 <template>
   <el-form label-position="left" label-width="100px">
+    <!-- 开发模式下显示该字段 -->
+    <el-form-item v-if="is_dev" :label="$t('pages.role.is_default')">
+      <el-radio-group v-model="form.is_default">
+        <el-radio label="0">{{ $t('common.yes') }}</el-radio>
+        <el-radio label="1">{{ $t('common.no') }}</el-radio>
+      </el-radio-group>
+    </el-form-item>
+    <el-form-item :label="$t('pages.role.is_admin_role')">
+      <el-radio-group v-model="form.is_admin_role">
+        <el-radio label="1">{{ $t('common.yes') }}</el-radio>
+        <el-radio label="0">{{ $t('common.no') }}</el-radio>
+      </el-radio-group>
+    </el-form-item>
     <el-form-item :label="$t('pages.role.name')">
       <el-input v-model="form.name" :placeholder="$t('pages.role.namePh')"></el-input>
     </el-form-item>
@@ -35,6 +48,7 @@ const form = inject('form')
 const menuList = inject('menuList')
 const onSubmit = inject('onSubmit')
 const roleTree = ref()
+const is_dev = import.meta.env.MODE === 'development'
 const getMenus = () => {
   const list = toRaw(menuList.value)
   const result = dealMenu(list)