Jelajahi Sumber

feat: 更新系统状态

wanggaokun 1 tahun lalu
induk
melakukan
74b4f228cd

+ 1 - 2
src/components/SvgIcon/index.vue

@@ -45,8 +45,7 @@ const svgClass = computed(() => {
   position: relative;
   width: 1em;
   height: 1em;
-
-  // margin-right: 5px;
+  margin-right: 5px;
   color: var(--color);
   fill: currentColor;
 }

+ 1 - 1
src/hooks/useDownload.ts

@@ -18,7 +18,7 @@ export const useDownload = async (
   api: (param: any) => Promise<any>,
   tempName: string,
   params: any = {},
-  isNotify: boolean = true,
+  isNotify: boolean = false,
   fileType: string = '.xlsx',
   fileName?: string
 ) => {

+ 1 - 1
src/layouts/LayoutClassic/index.scss

@@ -21,8 +21,8 @@
         margin-right: 16px;
         .logo-img {
           width: 28px;
-          object-fit: contain;
           margin-right: 6px;
+          object-fit: contain;
         }
         .logo-text {
           font-size: 21.5px;

+ 1 - 1
src/layouts/LayoutVertical/index.scss

@@ -23,8 +23,8 @@
         height: 55px;
         .logo-img {
           width: 28px;
-          object-fit: contain;
           margin-right: 6px;
+          object-fit: contain;
         }
         .logo-text {
           font-size: 21.5px;

+ 1 - 1
src/layouts/components/Tabs/components/MoreButton.vue

@@ -75,5 +75,5 @@ const closeAllTab = () => {
 </script>
 
 <style scoped lang="scss">
-@import '../index.scss';
+@import '../index';
 </style>

+ 0 - 1
src/routers/modules/dynamicRouter.ts

@@ -48,7 +48,6 @@ export const initDynamicRouter = async () => {
         router.addRoute('layout', item as unknown as RouteRecordRaw)
       }
     })
-    console.log('router', router.getRoutes())
   } catch (error) {
     // 当按钮 || 菜单请求出错时,重定向到登陆页
     removeToken()

+ 1 - 1
src/views/login/components/LoginForm.vue

@@ -168,5 +168,5 @@ onMounted(() => {
 </script>
 
 <style scoped lang="scss">
-@import '../index.scss';
+@import '../index';
 </style>

+ 3 - 3
src/views/system/config/index.vue

@@ -48,7 +48,7 @@ import {
   refreshCacheApi
 } from '@/api/modules/system/config'
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
-const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'))
+const { sys_y_n } = toRefs<any>(proxy?.useDict('sys_y_n'))
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
@@ -128,7 +128,7 @@ const columns = reactive<ColumnProps<any>[]>([
     search: {
       el: 'select'
     },
-    enum: sys_yes_no
+    enum: sys_y_n
   },
   {
     prop: 'remark',
@@ -179,7 +179,7 @@ const setItemsOptions = () => {
       rules: [{ required: true, message: '系统内置不能为空', trigger: 'change' }],
       compOptions: {
         elTagName: 'radio-button',
-        enum: sys_yes_no.value
+        enum: sys_y_n.value
       }
     },
     {

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

@@ -191,7 +191,7 @@ const setItemsOptions = () => {
       prop: 'status',
       span: 12,
       compOptions: {
-        value: '0',
+        value: '1',
         elTagName: 'radio-group',
         enum: sys_normal_disable.value,
         placeholder: '请选择部门状态'

+ 1 - 1
src/views/system/dict/data.vue

@@ -205,7 +205,7 @@ const setItemsOptions = () => {
       prop: 'listClass',
       compOptions: {
         elTagName: 'select',
-        enum: listClassOptions,
+        enum: listClassOptions.value,
         valueKey: 'value',
         labelKey: 'label',
         placeholder: '请输入回显样式'

+ 12 - 3
src/views/system/dict/index.vue

@@ -15,6 +15,7 @@
         >
           批量删除
         </el-button>
+        <el-button type="danger" v-auth="['system:config:remove']" icon="Refresh" plain @click="handleRefreshCache"> 刷新缓存 </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -32,12 +33,12 @@
 <script setup lang="tsx" name="Dict">
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
-import { ElMessageBox } from 'element-plus'
-
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { useDictStore } from '@/stores/modules/dict'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
-import { listDictApi, delDictApi, addDictApi, updateDictApi, exportApi, getDictApi } from '@/api/modules/system/dict'
+import { listDictApi, delDictApi, addDictApi, updateDictApi, exportApi, getDictApi, refreshCacheApi } from '@/api/modules/system/dict'
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
@@ -87,6 +88,14 @@ const router = useRouter()
 const toDetail = (row: { dictId: any }) => {
   router.push(`/system/dict-data/index/${row.dictId}`)
 }
+
+/** 刷新缓存按钮操作 */
+const handleRefreshCache = async () => {
+  await refreshCacheApi()
+  ElMessage.success('刷新成功')
+  useDictStore().cleanDict()
+}
+
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },

+ 3 - 3
src/views/system/menu/index.vue

@@ -170,7 +170,7 @@ const setItemsOptions = () => {
       span: 12,
       compOptions: {
         elTagName: 'radio-button',
-        value: '0',
+        value: '1',
         enum: sys_normal_disable.value
       }
     },
@@ -226,7 +226,7 @@ const setItemsOptions = () => {
       tooltip: '选择是外链则路由地址需要以`http(s)://`开头',
       compOptions: {
         elTagName: 'radio-button',
-        value: 'N',
+        value: '0',
         enum: sys_yes_no.value
       }
     },
@@ -240,7 +240,7 @@ const setItemsOptions = () => {
       },
       compOptions: {
         elTagName: 'radio-button',
-        value: '0',
+        value: '1',
         enum: sys_show_hide.value
       }
     },

+ 5 - 5
src/views/system/oss/config.vue

@@ -47,7 +47,7 @@ import {
 } from '@/api/modules/system/ossConfig'
 import { OssConfigVO } from '@/api/interface/system/ossConfig'
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
-const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'))
+const { sys_y_n } = toRefs<any>(proxy?.useDict('sys_y_n'))
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
 // 表单model
@@ -171,9 +171,9 @@ const columns = reactive<ColumnProps<any>[]>([
       return (
         <el-switch
           model-value={scope.row.status}
-          active-text={scope.row.status === '1' ? '停用' : '启用'}
-          active-value={'0'}
-          inactive-value={'1'}
+          active-text={scope.row.status === '0' ? '停用' : '启用'}
+          active-value={'1'}
+          inactive-value={'0'}
           onClick={() => changeStatus(scope.row)}
         />
       )
@@ -277,7 +277,7 @@ const setItemsOptions = () => {
       prop: 'isHttps',
       compOptions: {
         elTagName: 'radio-group',
-        enum: sys_yes_no.value
+        enum: sys_y_n.value
       }
     },
     {

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

@@ -217,7 +217,7 @@ const setItemsOptions = () => {
       rules: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
       compOptions: {
         elTagName: 'radio-group',
-        value: '0',
+        value: '1',
         enum: sys_normal_disable.value
       }
     },

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

@@ -106,11 +106,10 @@
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessageBox, ElMessage } from 'element-plus'
-
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/CustomDialog/index.vue'
-
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
+import ProFrom from '@/components/ProForm/index.vue'
 import {
   listRoleApi,
   delRoleApi,
@@ -127,7 +126,6 @@ import {
 import { treeSelectApi } from '@/api/modules/system/menu'
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
 const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'))
-
 const router = useRouter()
 // 菜单列表
 const menuOptions = ref<any>()
@@ -339,17 +337,19 @@ const getMenuAllCheckedKeys = () => {
 }
 // 提交
 const handleSubmit = (proFormRef: any, parameter: any, closeRefVal: any, type?: string) => {
+  debugger
   const formEl = proFormRef.proFormRef
+  const data = proFormRef.formModel
   butLoading.value = true
   if (!formEl) return
   formEl.validate(valid => {
     if (valid) {
       if (type === '1') {
-        parameter.model.menuIds = getMenuAllCheckedKeys()
+        data.menuIds = getMenuAllCheckedKeys()
       } else {
-        parameter.model.deptIds = getDeptAllCheckedKeys()
+        data.deptIds = getDeptAllCheckedKeys()
       }
-      parameter.api!(parameter.model).then(res => {
+      parameter.api!(data).then(res => {
         if (res.code == 200) {
           proFormRef?.resetForm(formEl)
           ElMessage.success('操作成功')
@@ -445,7 +445,7 @@ const setItemsOptions = () => {
       label: '角色权限',
       prop: 'roleKey',
       rules: [{ required: true, message: '角色权限字符串不能为空', trigger: 'blur' }],
-      tooltip: '@PreAuthorize("@ss.hasPermi(`admin`)")',
+      tooltip: '控制器中定义的权限字符,如:@SaCheckRole(`superAdmin`)中的superAdmin',
       compOptions: {
         placeholder: '请输入角色权限字符串'
       }
@@ -466,7 +466,7 @@ const setItemsOptions = () => {
       rules: [{ required: true, message: '角色状态不能为空', trigger: 'blur' }],
       compOptions: {
         elTagName: 'radio-group',
-        value: '0',
+        value: '1',
         enum: sys_normal_disable.value
       }
     },

+ 7 - 11
src/views/system/user/index.vue

@@ -224,23 +224,19 @@ const columns = reactive<ColumnProps<User.ResUserList>[]>([
       return (
         <el-switch
           model-value={scope.row.status}
-          active-text={scope.row.status === '1' ? '禁用' : '启用'}
-          active-value={'0'}
-          inactive-value={'1'}
+          active-text={scope.row.status === '0' ? '禁用' : '启用'}
+          active-value={'1'}
+          inactive-value={'0'}
           onClick={() => changeStatus(scope.row)}
         />
       )
     }
   },
   {
-    prop: 'sex',
+    prop: 'gender',
     label: '性别',
     width: 120,
-    enum: sys_user_gender,
-    fieldNames: {
-      label: 'dictLabel',
-      value: 'dictValue'
-    }
+    enum: sys_user_gender
   },
   { prop: 'createTime', label: '创建时间', width: 180 },
   { prop: 'operation', label: '操作', width: 240, fixed: 'right' }
@@ -292,7 +288,7 @@ const setItemsOptions = () => {
     {
       label: '性别',
       span: 12,
-      prop: 'sex',
+      prop: 'gender',
       compOptions: {
         elTagName: 'radio-group',
         enum: sys_user_gender.value,
@@ -305,7 +301,7 @@ const setItemsOptions = () => {
       prop: 'status',
       compOptions: {
         elTagName: 'radio-group',
-        value: '0',
+        value: '1',
         enum: sys_normal_disable.value
       }
     },