fix(字典管理): 🐛 字典管理

字典管理
This commit is contained in:
猿小天
2023-03-06 01:49:39 +08:00
parent 284f09f90d
commit 4de58819e5
9 changed files with 39 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ export function GetList(query: PageQuery) {
return request({
url: apiPrefix,
method: 'get',
data: query,
params: query,
});
}
export function GetObj(id: InfoReq) {

View File

@@ -2,11 +2,12 @@ import * as api from './api';
import { dict, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudOptions } from '@fast-crud/fast-crud';
import { request } from '/@/utils/service';
import { dictionary } from '/@/utils/dictionary';
import {watch} from "vue";
interface CreateCrudOptionsTypes {
crudOptions: CrudOptions;
}
export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExpose }): CreateCrudOptionsTypes {
export const createCrudOptions = function ({ crudExpose,currentRow }: { crudExpose: CrudExpose,currentRow:any }): CreateCrudOptionsTypes {
const pageRequest = async (query: PageQuery) => {
return await api.GetList(query);
};
@@ -20,6 +21,7 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
const addRequest = async ({ form }: AddReq) => {
return await api.AddObj(form);
};
return {
crudOptions: {
request: {
@@ -41,6 +43,7 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
//计算序号,你可以自定义计算规则,此处为翻页累加
let index = context.index ?? 1;
let pagination = crudExpose.crudBinding.value.pagination;
// @ts-ignore
return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1;
},
},

View File

@@ -1,5 +1,5 @@
<template>
<el-drawer size="70%" v-model="drawer" direction="rtl" destroy-on-close :before-close="handleClose">
<el-drawer size="70%" v-model="drawer" direction="rtl" destroy-on-close :before-close="handleClose">
<fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
</fs-page>
@@ -24,8 +24,10 @@ const { resetCrudOptions } = useCrud({ crudExpose, crudOptions });
//抽屉是否显示
const drawer = ref(false);
//抽屉关闭确认
const handleClose = (done: () => void) => {
ElMessageBox.confirm('您确定要关闭?', {
confirmButtonText: '确定',
cancelButtonText: '取消',