refactor: 权限系统模块重构完成

Former-commit-id: b33078bfbfea309af518cfab41080d0fea819491
This commit is contained in:
horizons
2022-10-21 00:59:49 +08:00
parent b0a0033371
commit cf24d080e5
16 changed files with 576 additions and 990 deletions

View File

@@ -15,9 +15,9 @@ import {
import { Dialog } from '@/types/common';
import {
listPageDictItems,
listDictItemPages,
getDictItemData,
addDictItem,
saveDictItem,
updateDictItem,
deleteDictItems
} from '@/api/dict';
@@ -90,7 +90,7 @@ const {
function handleQuery() {
if (state.queryParams.typeCode) {
state.loading = true;
listPageDictItems(state.queryParams).then(({ data }) => {
listDictItemPages(state.queryParams).then(({ data }) => {
state.dictItemList = data.list;
state.total = data.total;
state.loading = false;
@@ -146,7 +146,7 @@ function submitForm() {
handleQuery();
});
} else {
addDictItem(state.formData).then(() => {
saveDictItem(state.formData).then(() => {
ElMessage.success('新增成功');
cancel();
handleQuery();

View File

@@ -47,9 +47,9 @@ export default {
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典名称" prop="name" width="120" />
<el-table-column label="字典名称" prop="name" />
<el-table-column label="字典编码" prop="code" />
<el-table-column label="状态" align="center" width="80">
<el-table-column label="状态" align="center" width="100">
<template #default="scope">
<el-tag v-if="scope.row.status === 1" type="success">启用</el-tag>
<el-tag v-else type="info">禁用</el-tag>
@@ -131,8 +131,8 @@ export default {
<script setup lang="ts">
import { onMounted, reactive, ref, toRefs } from 'vue';
import {
listPageDictTypes,
getDictFormData,
listDictTypePages,
getDictTypeForm,
addDictType,
updateDictType,
deleteDictTypes
@@ -141,7 +141,7 @@ import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue';
import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
import { Dialog } from '@/types/common';
import { Dict, DictFormTypeData, DictQueryParam } from '@/types/api/dict';
import { Dict, DictTypeFormData, DictQueryParam } from '@/types/api/dict';
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
@@ -165,7 +165,7 @@ const state = reactive({
dialog: { visible: false } as Dialog,
formData: {
status: 1
} as DictFormTypeData,
} as DictTypeFormData,
rules: {
name: [{ required: true, message: '请输入字典名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入字典编码', trigger: 'blur' }]
@@ -178,7 +178,7 @@ const { total, dialog, loading, dictList, formData, rules, queryParams } =
function handleQuery() {
emit('dictClick', null);
state.loading = true;
listPageDictTypes(state.queryParams).then(({ data }) => {
listDictTypePages(state.queryParams).then(({ data }) => {
state.dictList = data.list;
state.total = data.total;
state.loading = false;
@@ -209,7 +209,7 @@ function handleUpdate(row: any) {
visible: true
};
const id = row.id || state.ids;
getDictFormData(id).then(({ data }) => {
getDictTypeForm(id).then(({ data }) => {
state.formData = data;
});
}

View File

@@ -7,7 +7,7 @@ import { reactive, toRefs } from 'vue';
const state = reactive({
typeCode: '',
typeName: '',
typeName: ''
});
const { typeCode, typeName } = toRefs(state);
@@ -26,7 +26,7 @@ const handleDictTypeClick = (row: any) => {
<template>
<div class="app-container">
<el-row :gutter="10">
<el-col :span="12" :xs="24">
<el-col :span="8" :xs="24">
<el-card class="box-card">
<template #header>
<svg-icon icon-class="dict" />
@@ -36,7 +36,7 @@ const handleDictTypeClick = (row: any) => {
</el-card>
</el-col>
<el-col :span="12" :xs="24">
<el-col :span="16" :xs="24">
<el-card class="box-card">
<template #header>
<svg-icon icon-class="dict_item" />