This commit is contained in:
于晏彭 2023-03-15 11:00:41 +08:00
parent da6f266b45
commit 2660dbf9e1
8 changed files with 167 additions and 34 deletions

View File

@ -1,16 +1,16 @@
// * 请求响应参数(不包含data) // * 请求响应参数(不包含data)
export interface Result { export declare interface Result {
code: string; code: string;
message: string; message: string;
} }
// * 请求响应参数(包含data) // * 请求响应参数(包含data)
export interface ResultData<T = any> extends Result { export declare interface ResultData<T = any> extends Result {
result: T; result: T;
} }
// * 分页响应参数 // * 分页响应参数
export interface ResPage<T> { export declare interface ResPage<T> {
result: T[]; result: T[];
pageNo: number; pageNo: number;
pageSize: number; pageSize: number;
@ -18,35 +18,35 @@ export interface ResPage<T> {
} }
// * 分页请求参数 // * 分页请求参数
export interface ReqPage { export declare interface ReqPage {
pageNum: number; pageNum: number;
pageSize: number; pageSize: number;
} }
// * 文件上传模块 // * 文件上传模块
export namespace Upload { export declare namespace Upload {
export interface ResFileUrl { interface ResFileUrl {
fileUrl: string; fileUrl: string;
} }
} }
// * 登录模块 // * 登录模块
export namespace Login { export declare namespace Login {
export interface ReqLoginForm { interface ReqLoginForm {
account: string; account: string;
showPassword: string; showPassword: string;
} }
export interface ResLogin { interface ResLogin {
token: string; token: string;
} }
export interface ResAuthButtons { interface ResAuthButtons {
[key: string]: string[]; [key: string]: string[];
} }
} }
// * 用户管理模块 // * 用户管理模块
export namespace User { export declare namespace User {
export interface ReqUserParams extends ReqPage { interface ReqUserParams extends ReqPage {
username: string; username: string;
gender: number; gender: number;
idCard: string; idCard: string;
@ -55,7 +55,7 @@ export namespace User {
createTime: string[]; createTime: string[];
status: number; status: number;
} }
export interface ResRecords { interface ResRecords {
createTime: string; createTime: string;
dictCode: string; dictCode: string;
dictLabel: string; dictLabel: string;
@ -66,7 +66,7 @@ export namespace User {
remark: string; remark: string;
status: string; status: string;
} }
export interface ResResults { interface ResResults {
current: string; current: string;
hitCount: boolean; hitCount: boolean;
pages: string; pages: string;
@ -75,7 +75,7 @@ export namespace User {
total: string; total: string;
records: ResRecords[]; records: ResRecords[];
} }
export interface ResUserList { interface ResUserList {
id: string; id: string;
configId: string; configId: string;
dictCode: string; dictCode: string;
@ -86,29 +86,30 @@ export namespace User {
age: number; age: number;
}; };
}; };
records?: ResRecords[];
idCard: string; idCard: string;
email: string; email: string;
address: string; address: string;
createTime: string; createTime: string;
status: number; status: number;
avatar: string; avatar: string;
records?: ResRecords[];
children?: ResUserList[]; children?: ResUserList[];
} }
export interface ResStatus { interface ResStatus {
userLabel: string; userLabel: string;
userValue: number; userValue: number;
} }
export interface ResGender { interface ResGender {
genderLabel: string; genderLabel: string;
genderValue: number; genderValue: number;
} }
export interface ResDepartment { interface ResDepartment {
id: string; id: string;
name: string; name: string;
children?: ResDepartment[]; children?: ResDepartment[];
} }
export interface ResRole { interface ResRole {
id: string; id: string;
name: string; name: string;
children?: ResDepartment[]; children?: ResDepartment[];

View File

@ -1,4 +1,5 @@
import { ResPage, User } from "@/api/interface/index"; // import { ResPage, User } from "@/api/interface/index";
import { ResPage, User } from "@/api/types/common";
import { PORT1 } from "@/api/config/servicePort"; import { PORT1 } from "@/api/config/servicePort";
import http from "@/api"; import http from "@/api";

116
src/api/types/common.d.ts vendored Normal file
View File

@ -0,0 +1,116 @@
// * 请求响应参数(不包含data)
export declare interface Result {
code: string;
message: string;
}
// * 请求响应参数(包含data)
export declare interface ResultData<T = any> extends Result {
result: T;
}
// * 分页响应参数
export declare interface ResPage<T> {
result: T[];
pageNo: number;
pageSize: number;
total: number;
}
// * 分页请求参数
export declare interface ReqPage {
pageNum: number;
pageSize: number;
}
// * 文件上传模块
export declare namespace Upload {
interface ResFileUrl {
fileUrl: string;
}
}
// * 登录模块
export declare namespace Login {
interface ReqLoginForm {
account: string;
showPassword: string;
}
interface ResLogin {
token: string;
}
interface ResAuthButtons {
[key: string]: string[];
}
}
// * 用户管理模块
export declare namespace User {
interface ReqUserParams extends ReqPage {
username: string;
gender: number;
idCard: string;
email: string;
address: string;
createTime: string[];
status: number;
}
interface ResRecords {
createTime: string;
dictCode: string;
dictLabel: string;
dictSort: number;
dictType: string;
dictValue: string;
isDefault: string;
remark: string;
status: string;
}
interface ResResults {
current: string;
hitCount: boolean;
pages: string;
searchCount: boolean;
size: string;
total: string;
records: ResRecords[];
}
interface ResUserList {
id: string;
configId: string;
dictCode: string;
username: string;
gender: string;
user: {
detail: {
age: number;
};
};
records?: ResRecords[];
idCard: string;
email: string;
address: string;
createTime: string;
status: number;
avatar: string;
children?: ResUserList[];
}
interface ResStatus {
userLabel: string;
userValue: number;
}
interface ResGender {
genderLabel: string;
genderValue: number;
}
interface ResDepartment {
id: string;
name: string;
children?: ResDepartment[];
}
interface ResRole {
id: string;
name: string;
children?: ResDepartment[];
}
}

0
src/api/types/company/User.d.ts vendored Normal file
View File

2
src/api/types/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./company/User";
export * from "./jxj/User";

17
src/api/types/jxj/User.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
import type { User } from "../common";
export declare namespace jxj_User {
interface ResUserList extends User.ResUserList {
// 解决 dictionary 组件 报错
dictId: number;
dictName: string;
dictCode: number;
dictValue: string;
// 解决 menumanage 组件 报错
moduleId: string | number;
actionId: string | number;
menuId: string | number;
username: string;
}
}

View File

@ -86,7 +86,8 @@
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { User } from "@/api/interface"; // import { User } from "@/api/interface";
import { jxj_User } from "@/api/types";
import { ColumnProps } from "@/components/ProTable/interface"; import { ColumnProps } from "@/components/ProTable/interface";
import { useHandleData } from "@/hooks/useHandleData"; import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue"; import ProTable from "@/components/ProTable/index.vue";
@ -188,12 +189,6 @@ const columns: ColumnProps[] = [
{ {
prop: "createTime", prop: "createTime",
label: "创建时间" label: "创建时间"
// search: {
// el: "date-picker",
// span: 2,
// props: { type: "datetimerange", valueFormat: "YYYY-MM-DD HH:mm:ss" },
// defaultValue: ["", ""]
// }
}, },
{ prop: "operation", label: "操作", fixed: "right" } { prop: "operation", label: "操作", fixed: "right" }
]; ];
@ -309,13 +304,13 @@ const DiaSubmit = async (form: any) => {
}; };
// //
const deleteAccount = async (params: User.ResUserList) => { const deleteAccount = async (params: jxj_User.ResUserList) => {
await useHandleData(deleteDictionary, { id: params.dictId }, `删除【${params.dictName}】用户`); await useHandleData(deleteDictionary, { id: params.dictId }, `删除【${params.dictName}】用户`);
proTable.value.getTableList(); proTable.value.getTableList();
}; };
// //
const DeleteBtn = async (params: User.ResUserList) => { const DeleteBtn = async (params: jxj_User.ResUserList) => {
await useHandleData(deleteDia, { id: params.dictCode }, `删除【${params.dictValue}】用户`); await useHandleData(deleteDia, { id: params.dictCode }, `删除【${params.dictValue}】用户`);
proTable.value.getTableList(); proTable.value.getTableList();
}; };

View File

@ -176,7 +176,8 @@
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { User } from "@/api/interface"; // import { User } from "@/api/interface";
import { jxj_User } from "@/api/types";
import { ColumnProps } from "@/components/ProTable/interface"; import { ColumnProps } from "@/components/ProTable/interface";
import { useHandleData } from "@/hooks/useHandleData"; import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue"; import ProTable from "@/components/ProTable/index.vue";
@ -562,17 +563,17 @@ const onBtnManage = async (row: any) => {
}; };
// //
const deleteAccount = async (params: User.ResUserList) => { const deleteAccount = async (params: jxj_User.ResUserList) => {
await useHandleData(deleteMunu, { id: params.moduleId }, `删除【${params.username}】用户`); await useHandleData(deleteMunu, { id: params.moduleId }, `删除【${params.username}】用户`);
proTable.value.getTableList(); proTable.value.getTableList();
}; };
// //
const deleteMenu = async (params: User.ResUserList) => { const deleteMenu = async (params: jxj_User.ResUserList) => {
await useHandleData(deletesysMenu, { menuId: params.menuId }, `删除【${params.username}】用户`); await useHandleData(deletesysMenu, { menuId: params.menuId }, `删除【${params.username}】用户`);
await menuList({ moduleId: params.moduleId }); await menuList({ moduleId: params.moduleId });
}; };
// //
const onBtnDelete = async (params: User.ResUserList) => { const onBtnDelete = async (params: jxj_User.ResUserList) => {
await useHandleData(deleteAction, { actionId: params.actionId }, `删除【${params.username}】用户`); await useHandleData(deleteAction, { actionId: params.actionId }, `删除【${params.username}】用户`);
getBtnTabList({ menuId: params.menuId }); getBtnTabList({ menuId: params.menuId });
}; };