已修改角色、新增用户、检测源列表、被检设备列表、检测脚本列表
This commit is contained in:
@@ -18,4 +18,5 @@ VITE_PWA=false
|
|||||||
VITE_API_URL=/api
|
VITE_API_URL=/api
|
||||||
|
|
||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||||
|
VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]
|
||||||
13
frontend/src/api/device/device.ts
Normal file
13
frontend/src/api/device/device.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { ResPage } from '@/api/interface'
|
||||||
|
import { Device } from './interface'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 被检设备管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测脚本列表
|
||||||
|
export const getDeviceList = (params: Device.ReqDeviceParams) => {
|
||||||
|
return http.post<ResPage<Device.ResDeviceList>>(`/RoleList_Post`, params)
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/device/list`, params)
|
||||||
|
}
|
||||||
48
frontend/src/api/device/deviceData.ts
Normal file
48
frontend/src/api/device/deviceData.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'device1',
|
||||||
|
deviceName:"模拟装置1",
|
||||||
|
deviceType:"PQS882B4电能质量监测装置",
|
||||||
|
deviceChannels:"4",
|
||||||
|
PlanName: "沧州220kV留古等4座变电站电能质量检测",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device2',
|
||||||
|
deviceName:"模拟装置2",
|
||||||
|
deviceType:"PQS882A电能质量监测装置",
|
||||||
|
deviceChannels:"1",
|
||||||
|
PlanName: "邯郸220kV团城站等4座站电能质量检测",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device3',
|
||||||
|
deviceName:"模拟装置3",
|
||||||
|
deviceType:"PQS882A电能质量监测装置",
|
||||||
|
deviceChannels:"1",
|
||||||
|
PlanName: "衡水冀州光伏电站配套出口工程",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "1",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device4',
|
||||||
|
deviceName:"模拟装置4",
|
||||||
|
deviceType:"PMC-680M-22-22-00-115ANBC电能质量监测装置",
|
||||||
|
deviceChannels:"4",
|
||||||
|
PlanName: "深圳市中电软件有限公司委托送检",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "深圳中电电力技术股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export default data
|
||||||
31
frontend/src/api/device/interface/index.ts
Normal file
31
frontend/src/api/device/interface/index.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import type { ReqPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 被检设备模块
|
||||||
|
export namespace Device {
|
||||||
|
|
||||||
|
// 被检设备列表
|
||||||
|
export interface ResDeviceList {
|
||||||
|
id: string; //被检设备ID
|
||||||
|
deviceName: string; //检测设备名称
|
||||||
|
deviceType: string; //检测设备类型
|
||||||
|
deviceChannels: string;//设备通道数
|
||||||
|
PlanName: string; //所属计划名称
|
||||||
|
deviceUn: string; //设备额定电压
|
||||||
|
deviceIn: string; //设备额定电流
|
||||||
|
deviceCompany: string;//设备厂家
|
||||||
|
deviceModel: string; //设备模式 模拟 数字 比对
|
||||||
|
}
|
||||||
|
|
||||||
|
// 被检设备参数
|
||||||
|
export interface ReqDeviceParams extends ReqPage {
|
||||||
|
id: string; //被检设备ID
|
||||||
|
deviceName: string; //检测设备名称
|
||||||
|
deviceType: string; //检测设备类型
|
||||||
|
deviceChannels: string;//设备通道数
|
||||||
|
PlanName: string; //所属计划名称
|
||||||
|
deviceUn: string; //设备额定电压
|
||||||
|
deviceIn: string; //设备额定电流
|
||||||
|
deviceCompany: string;//设备厂家
|
||||||
|
deviceModel: string; //设备模式 模拟 数字 比对
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,9 @@ import http from '@/api'
|
|||||||
*/
|
*/
|
||||||
// 获取角色列表
|
// 获取角色列表
|
||||||
export const getRoleList = (params: Role.ReqRoleParams) => {
|
export const getRoleList = (params: Role.ReqRoleParams) => {
|
||||||
return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // 获取树形用户列表
|
// // 获取树形用户列表
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
rolename:"操作员",
|
rolename:"操作员1",
|
||||||
id: 'operator_role',
|
id: 'operator_role',
|
||||||
status:1,
|
status:1,
|
||||||
describe:"可以对待检设备的台账进行操作并执行检测功能",
|
describe:"可以对待检设备的台账进行操作并执行检测功能",
|
||||||
@@ -22,7 +22,7 @@ const data = [
|
|||||||
},
|
},
|
||||||
]},
|
]},
|
||||||
{
|
{
|
||||||
rolename:"管理员",
|
rolename:"管理员2",
|
||||||
id: 'manager_role',
|
id: 'manager_role',
|
||||||
status:1,
|
status:1,
|
||||||
describe:"可以设置检测脚本、误差体系、新增操作人员",
|
describe:"可以设置检测脚本、误差体系、新增操作人员",
|
||||||
@@ -44,7 +44,7 @@ const data = [
|
|||||||
},
|
},
|
||||||
]},
|
]},
|
||||||
{
|
{
|
||||||
rolename:"超级管理员",
|
rolename:"超级管理员3",
|
||||||
id: 'superManager_role',
|
id: 'superManager_role',
|
||||||
status:0,
|
status:0,
|
||||||
describe:"可以修改程序的底层配置,例如检测指标的具体类型",
|
describe:"可以修改程序的底层配置,例如检测指标的具体类型",
|
||||||
|
|||||||
24
frontend/src/api/testScript/interface/index.ts
Normal file
24
frontend/src/api/testScript/interface/index.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import type { ReqPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 检测脚本模块
|
||||||
|
export namespace TestScript {
|
||||||
|
|
||||||
|
// 检测脚本列表
|
||||||
|
export interface ResTestScriptList {
|
||||||
|
id: string; //检测脚本ID
|
||||||
|
testScriptModel: string; //检测脚本模式 模拟 数字 比对
|
||||||
|
testScriptType: string; //检测脚本类型 脚本 模板
|
||||||
|
testScriptValueType: string;//检测脚本值类型名称 相对值 绝对值
|
||||||
|
testScriptName: string; //检测脚本名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测脚本参数
|
||||||
|
// 检测脚本参数
|
||||||
|
export interface ReqTestScriptParams extends ReqPage {
|
||||||
|
id: string; //检测脚本ID
|
||||||
|
testScriptModel: string; //检测脚本模式 模拟 数字 比对
|
||||||
|
testScriptType: string; //检测脚本类型 脚本 模板
|
||||||
|
testScriptValueType: string;//检测脚本值类型名称 相对值 绝对值
|
||||||
|
testScriptName: string; //检测脚本名称
|
||||||
|
}
|
||||||
|
}
|
||||||
13
frontend/src/api/testScript/testScript.ts
Normal file
13
frontend/src/api/testScript/testScript.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { ResPage } from '@/api/interface'
|
||||||
|
import { TestScript } from './interface'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测脚本管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测脚本列表
|
||||||
|
export const getTestScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||||
|
return http.post<ResPage<TestScript.ResTestScriptList>>(`/RoleList_Post`, params)
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/testScript/list`, params)
|
||||||
|
}
|
||||||
32
frontend/src/api/testScript/testScriptData.ts
Normal file
32
frontend/src/api/testScript/testScriptData.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const data = [
|
||||||
|
{
|
||||||
|
testScriptModel:"模拟",
|
||||||
|
id: 'operatorrole',
|
||||||
|
testScriptType:"脚本",
|
||||||
|
testScriptValueType:"绝对值",
|
||||||
|
testScriptName:"国网入网检测脚本(单影响量-模拟式)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testScriptModel:"模拟",
|
||||||
|
id: 'managerrole',
|
||||||
|
testScriptType:"脚本",
|
||||||
|
testScriptValueType:"相对值",
|
||||||
|
testScriptName:"国网入网检测脚本(Q/GDW 10650.4 - 2021) 模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testScriptModel:"模拟",
|
||||||
|
id: 'superManagerrole',
|
||||||
|
testScriptType:"脚本",
|
||||||
|
testScriptValueType:"相对值",
|
||||||
|
testScriptName:"国网入网检测脚本(Q/GDW 1650.4 - 2016) 模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testScriptModel:"模拟",
|
||||||
|
id: 'superManagerroletest',
|
||||||
|
testScriptType:"脚本",
|
||||||
|
testScriptValueType:"相对值",
|
||||||
|
testScriptName:"GBT 19862 - 2016 模拟式",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export default data
|
||||||
21
frontend/src/api/testSource/interface/index.ts
Normal file
21
frontend/src/api/testSource/interface/index.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import type { ReqPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 检测源模块
|
||||||
|
export namespace TestSource {
|
||||||
|
|
||||||
|
// 检测源列表
|
||||||
|
export interface ResTestSourceList {
|
||||||
|
id: string; //检测源ID
|
||||||
|
testSourceName: string; //检测源名称
|
||||||
|
testSourceType: string; //检测源类型
|
||||||
|
testSourceModel: string; //检测源模式 标准源 高精度源
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测源参数
|
||||||
|
export interface ReqTestSourceParams extends ReqPage {
|
||||||
|
id: string; //检测源ID
|
||||||
|
testSourceName: string; //检测源名称
|
||||||
|
testSourceType: string; //检测源类型
|
||||||
|
testSourceModel: string; //检测源模式 标准源 高精度源
|
||||||
|
}
|
||||||
|
}
|
||||||
13
frontend/src/api/testSource/testSource.ts
Normal file
13
frontend/src/api/testSource/testSource.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { ResPage } from '@/api/interface'
|
||||||
|
import { TestSource } from './interface'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测源管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测脚本列表
|
||||||
|
export const getTestSourceList = (params: TestSource.ReqTestSourceParams) => {
|
||||||
|
return http.post<ResPage<TestSource.ResTestSourceList>>(`/RoleList_Post`, params)
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/testSource/list`, params)
|
||||||
|
}
|
||||||
28
frontend/src/api/testSource/testSourceData.ts
Normal file
28
frontend/src/api/testSource/testSourceData.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'testSource1',
|
||||||
|
testSourceName: '标准源-福禄克-6100A',
|
||||||
|
testSourceType: 'FLUKE.6100A电能功率标准源',
|
||||||
|
testSourceModel: '标准源',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'testSource2',
|
||||||
|
testSourceName: '标准源-昂立-PF2',
|
||||||
|
testSourceType: 'ANGLI-FP2高性能数字信号源',
|
||||||
|
testSourceModel: '标准源',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'testSource3',
|
||||||
|
testSourceName: '标准源-丹迪克-DKLN1',
|
||||||
|
testSourceType: 'DKLN-1电能质量测试分析仪智能检定装置',
|
||||||
|
testSourceModel: '标准源',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'testSource4',
|
||||||
|
testSourceName: '高精度设备-PQV520-1',
|
||||||
|
testSourceType: 'PQV-520电能质量监测装置',
|
||||||
|
testSourceModel: '高精度设备',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export default data
|
||||||
@@ -20,28 +20,21 @@ export namespace User {
|
|||||||
|
|
||||||
// 用户列表
|
// 用户列表
|
||||||
export interface ResUserList {
|
export interface ResUserList {
|
||||||
id: string;
|
id: string; //用户ID,作为唯一标识
|
||||||
username: string;
|
username: string; //用户名
|
||||||
gender: number;
|
password: string; //密码
|
||||||
age:number;
|
realname: string; //真实姓名
|
||||||
idCard: string;
|
status: number; //用户状态
|
||||||
email: string;
|
rolename: string; //角色名称
|
||||||
address: string;
|
|
||||||
createTime: string;
|
|
||||||
status: number;
|
|
||||||
avatar: string;
|
|
||||||
photo: any[];
|
|
||||||
children?: ResUserList[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReqUserParams extends ReqPage {
|
export interface ReqUserParams extends ReqPage {
|
||||||
username: string;
|
id: string; //用户ID,作为唯一标识
|
||||||
gender: number;
|
username: string; //用户名
|
||||||
idCard: string;
|
password: string; //密码
|
||||||
email: string;
|
realname: string; //真实姓名
|
||||||
address: string;
|
status: number; //用户状态
|
||||||
createTime: string[];
|
rolename: string; //角色名称
|
||||||
status: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResStatus {
|
export interface ResStatus {
|
||||||
@@ -49,21 +42,5 @@ export namespace User {
|
|||||||
userValue: number;
|
userValue: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResGender {
|
|
||||||
genderLabel: string;
|
|
||||||
genderValue: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ResDepartment {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
children?: ResDepartment[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ResRole {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
children?: ResDepartment[];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,17 +7,20 @@ import http from '@/api'
|
|||||||
*/
|
*/
|
||||||
// 用户登录
|
// 用户登录
|
||||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
// return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||||
|
return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取菜单列表
|
// 获取菜单列表
|
||||||
export const getAuthMenuListApi = () => {
|
export const getAuthMenuListApi = () => {
|
||||||
return http.get<Menu.MenuOptions[]>(`${rePrefix}/menu/list`, {}, { loading: false })
|
// return http.get<Menu.MenuOptions[]>(`${rePrefix}/menu/list`, {}, { loading: false })
|
||||||
|
return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取按钮权限
|
// 获取按钮权限
|
||||||
export const getAuthButtonListApi = () => {
|
export const getAuthButtonListApi = () => {
|
||||||
return http.get<Login.ResAuthButtons>(`${rePrefix}/auth/buttons`, {}, { loading: false })
|
// return http.get<Login.ResAuthButtons>(`${rePrefix}/auth/buttons`, {}, { loading: false })
|
||||||
|
return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户退出登录
|
// 用户退出登录
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { ResPage } from '@/api/interface'
|
|||||||
import { User } from './interface'
|
import { User } from './interface'
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import type { Resource } from '../resource/interface'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 用户管理模块
|
* @name 用户管理模块
|
||||||
@@ -13,9 +12,9 @@ export const getUserList = (params: User.ReqUserParams) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取树形用户列表
|
// 获取树形用户列表
|
||||||
export const getUserTreeList = (params: User.ReqUserParams) => {
|
// export const getUserTreeList = (params: User.ReqUserParams) => {
|
||||||
return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/tree/list`, params)
|
// return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/tree/list`, params)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
export const addUser = (params: { id: string }) => {
|
export const addUser = (params: { id: string }) => {
|
||||||
@@ -56,23 +55,3 @@ export const exportUserInfo = (params: User.ReqUserParams) => {
|
|||||||
export const getUserStatus = () => {
|
export const getUserStatus = () => {
|
||||||
return http.get<User.ResStatus[]>(`${rePrefix}/user/status`)
|
return http.get<User.ResStatus[]>(`${rePrefix}/user/status`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户状态字典
|
|
||||||
export const getResourceType = () => {
|
|
||||||
return http.get<Resource.ResType[]>(`${rePrefix}/user/status`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户性别字典
|
|
||||||
export const getUserGender = () => {
|
|
||||||
return http.get<User.ResGender[]>(`${rePrefix}/user/gender`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户部门列表
|
|
||||||
export const getUserDepartment = () => {
|
|
||||||
return http.get<User.ResDepartment[]>(`${rePrefix}/user/department`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户角色字典
|
|
||||||
export const getUserRole = () => {
|
|
||||||
return http.get<User.ResRole[]>(`${rePrefix}/user/role`)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,147 +1,99 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
'id': '623689732233728549',
|
'id': '623689732233728549',
|
||||||
'username': '薛霞',
|
'username': 'admin_A',
|
||||||
'gender': 2,
|
'password': '12345678',
|
||||||
'age': 14,
|
'realname': '薛霞',
|
||||||
'idCard': '623689732233728549',
|
|
||||||
'email': 'k.ckfkzrnhd@voyvhqubs.sl',
|
|
||||||
'address': '浙江省 温州市',
|
|
||||||
'createTime': '1985-04-15 15:42:29',
|
|
||||||
'status': 0,
|
'status': 0,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRqMK.jpg',
|
'rolename': '管理员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '621003764863621316',
|
'id': '621003764863621316',
|
||||||
'username': '冯敏',
|
'username': 'admin_B',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 16,
|
'realname': '冯敏',
|
||||||
'idCard': '621003764863621316',
|
|
||||||
'email': 'h.obqq@cpyirry.bt',
|
|
||||||
'address': '内蒙古自治区 兴安盟',
|
|
||||||
'createTime': '2003-03-24 22:30:36',
|
|
||||||
'status': 1,
|
'status': 1,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRBHS.jpg',
|
'rolename': '管理员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '652286556713195552',
|
'id': '652286556713195552',
|
||||||
'username': '潘霞',
|
'username': 'operator_A',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 28,
|
'realname': '潘霞',
|
||||||
'idCard': '652286556713195552',
|
|
||||||
'email': 'b.ttcn@xrxuorb.gov.cn',
|
|
||||||
'address': '河南省 安阳市',
|
|
||||||
'createTime': '1998-01-16 11:23:33',
|
|
||||||
'status': 1,
|
'status': 1,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRqMK.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '373930342176416776',
|
'id': '373930342176416776',
|
||||||
'username': '郝秀英',
|
'username': 'operator_B',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 17,
|
'realname': '郝秀英',
|
||||||
'idCard': '373930342176416776',
|
'status': 0,
|
||||||
'email': 'x.fatyfu@udqgch.tv',
|
'rolename': '操作员',
|
||||||
'address': '黑龙江省 哈尔滨市',
|
|
||||||
'createTime': '1987-09-22 06:43:43',
|
|
||||||
'status': 1,
|
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QR57a.jpg',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '429621442453555775',
|
'id': '429621442453555775',
|
||||||
'username': '吕洋',
|
'username': 'operator_C',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 22,
|
'realname': '吕洋',
|
||||||
'idCard': '429621442453555775',
|
|
||||||
'email': 's.uirhkbc@bkkvzztn.cv',
|
|
||||||
'address': '天津 天津市',
|
|
||||||
'createTime': '1982-10-31 09:42:09',
|
|
||||||
'status': 1,
|
'status': 1,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QR57a.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '387231964476618937',
|
'id': '387231964476618937',
|
||||||
'username': '江磊',
|
'username': 'operator_D',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 28,
|
'realname': '江磊',
|
||||||
'idCard': '387231964476618937',
|
|
||||||
'email': 'c.pbov@vusetqkrnx.net',
|
|
||||||
'address': '香港特别行政区 九龙',
|
|
||||||
'createTime': '1999-12-24 09:06:37',
|
|
||||||
'status': 0,
|
'status': 0,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRqMK.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '604013348875476647',
|
'id': '604013348875476647',
|
||||||
'username': '姚静',
|
'username': 'operator_E',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 15,
|
'realname': '姚静',
|
||||||
'idCard': '604013348875476647',
|
|
||||||
'email': 'g.nplhpxqmm@bttefv.ru',
|
|
||||||
'address': '西藏自治区 昌都地区',
|
|
||||||
'createTime': '2020-08-05 12:22:15',
|
|
||||||
'status': 0,
|
'status': 0,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRa0s.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '028222596330483467',
|
'id': '028222596330483467',
|
||||||
'username': '龙艳',
|
'username': 'operator_F',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 17,
|
'realname': '龙艳',
|
||||||
'idCard': '028222596330483467',
|
|
||||||
'email': 'e.acjsi@bbjk.ci',
|
|
||||||
'address': '云南省 普洱市',
|
|
||||||
'createTime': '1971-03-07 06:13:10',
|
|
||||||
'status': 1,
|
'status': 1,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRqMK.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '739427478368274267',
|
'id': '739427478368274267',
|
||||||
'username': '武涛',
|
'username': 'operator_G',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 18,
|
'realname': '武涛',
|
||||||
'idCard': '739427478368274267',
|
|
||||||
'email': 'x.hlwyeply@bcvejqss.bt',
|
|
||||||
'address': '香港特别行政区 香港岛',
|
|
||||||
'createTime': '1975-09-27 01:24:19',
|
|
||||||
'status': 1,
|
'status': 1,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRa0s.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '448686878612127243',
|
'id': '448686878612127243',
|
||||||
'username': '孙芳',
|
'username': 'operator_H',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 17,
|
'realname': '孙芳',
|
||||||
'idCard': '448686878612127243',
|
|
||||||
'email': 'j.cmwtpc@xovygkdk.sc',
|
|
||||||
'address': '云南省 西双版纳傣族自治州',
|
|
||||||
'createTime': '1987-04-22 14:09:59',
|
|
||||||
'status': 0,
|
'status': 0,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRBHS.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '448686878612127244',
|
'id': '448686878612127244',
|
||||||
'username': '孙芳1',
|
'username': 'operator_I',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 17,
|
'realname': '孙芳1',
|
||||||
'idCard': '448686878612127243',
|
|
||||||
'email': 'j.cmwtpc@xovygkdk.sc',
|
|
||||||
'address': '云南省 西双版纳傣族自治州',
|
|
||||||
'createTime': '1987-04-22 14:09:59',
|
|
||||||
'status': 0,
|
'status': 0,
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRBHS.jpg',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '448686878612127245',
|
'id': '448686878612127245',
|
||||||
'username': '孙芳2',
|
'username': 'operator_J',
|
||||||
'gender': 1,
|
'password': '12345678',
|
||||||
'age': 17,
|
'realname': '孙芳2',
|
||||||
'idCard': '448686878612127243',
|
'status': 1,
|
||||||
'email': 'j.cmwtpc@xovygkdk.sc',
|
'rolename': '操作员',
|
||||||
'address': '云南省 西双版纳傣族自治州',
|
|
||||||
'createTime': '1987-04-22 14:09:59',
|
|
||||||
'status': 0,
|
|
||||||
'avatar': 'https://i.imgtg.com/2023/01/16/QRBHS.jpg',
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 权限信息弹出框 -->
|
<!-- 权限信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="title" @close="handleCancel" width="800" draggable>
|
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
||||||
<div>
|
<div>
|
||||||
<el-transfer v-model="value" :data="data" :titles="['未具备的权限', '已具备的权限']"/>
|
<el-transfer v-model="value" :data="data.permissionList" :titles="['未具备的权限', '已具备的权限']"/>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -18,7 +18,53 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
const {dialogVisible,data} = defineProps(['dialogVisible','title','data'])
|
import { Role } from '@/api/role/interface'
|
||||||
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
const {dialogVisible,data} = defineProps<{
|
||||||
|
dialogVisible: boolean;
|
||||||
|
title: string;
|
||||||
|
data: Role.ResRoleList;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// const leftvalue = ref<Role.Permission[]>([])
|
||||||
|
// const rightvalue = ref<Role.Permission[]>([])
|
||||||
|
|
||||||
|
// const rightvalue = computed<Role.Permission[]>({
|
||||||
|
// get(){
|
||||||
|
// return data.permissionList?.filter(item => item.disabled) || []
|
||||||
|
// },
|
||||||
|
// set: (value: Role.Permission[]) => {
|
||||||
|
// if (data.permissionList) {
|
||||||
|
// for(let i = 0;i<value.length;i++){
|
||||||
|
// for(let j = 0;j<(data.permissionList?.length);j++){
|
||||||
|
// if(value[i].key === data.permissionList[j].key)
|
||||||
|
// {
|
||||||
|
// data.permissionList[j].disabled = value[i].disabled
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const leftvalue = computed<Role.Permission[]>({
|
||||||
|
// get(){
|
||||||
|
// return data.permissionList?.filter(item => item.disabled === false) || []
|
||||||
|
// },
|
||||||
|
// set: (value: Role.Permission[]) => {
|
||||||
|
// if (data.permissionList) {
|
||||||
|
// for(let i = 0;i<value.length;i++){
|
||||||
|
// for(let j = 0;j<(data.permissionList?.length);j++){
|
||||||
|
// if(value[i].key === data.permissionList[j].key)
|
||||||
|
// {
|
||||||
|
// data.permissionList[j].disabled = value[i].disabled
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
const value = ref()
|
const value = ref()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="title" @close="handleCancel" width="800" draggable>
|
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="data">
|
<el-form :model="data">
|
||||||
<el-form-item label="角色类型名称" :label-width="100">
|
<el-form-item label="角色类型名称" :label-width="100">
|
||||||
@@ -36,9 +36,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { ref,computed } from 'vue'
|
||||||
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
|
|
||||||
const value = ref(true)
|
|
||||||
const {dialogVisible,title,data} = defineProps<{
|
const {dialogVisible,title,data} = defineProps<{
|
||||||
dialogVisible:boolean;
|
dialogVisible:boolean;
|
||||||
title:string;
|
title:string;
|
||||||
@@ -49,6 +49,12 @@
|
|||||||
describe:string;
|
describe:string;
|
||||||
}
|
}
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const value = computed({
|
||||||
|
get: () => data.status === 1,
|
||||||
|
set: (value: boolean) => data.status = value ? 1 : 0
|
||||||
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e:'update:visible',value:boolean):void;
|
(e:'update:visible',value:boolean):void;
|
||||||
}>();
|
}>();
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='roleData'
|
:data='roleData'
|
||||||
>
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增角色</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增角色')">新增角色</el-button>
|
||||||
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出角色数据</el-button>
|
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出角色数据</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
@@ -16,10 +17,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑角色', scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||||
|
|
||||||
<el-button type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
|
<el-button type='primary' link :icon='Share' @click="openDrawer('设置权限', scope.row)">设置权限</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -73,13 +72,27 @@
|
|||||||
const roleUnitTitle = ref()
|
const roleUnitTitle = ref()
|
||||||
const permissionUnitTitle = ref()
|
const permissionUnitTitle = ref()
|
||||||
const roleUnitData = ref<Role.ResRoleList>({} as Role.ResRoleList)
|
const roleUnitData = ref<Role.ResRoleList>({} as Role.ResRoleList)
|
||||||
const permissionUnitData = ref<Role.Permission[]>([])
|
const permissionUnitData = ref<Role.ResRoleList>({} as Role.ResRoleList)
|
||||||
|
// const permissionUnitData = ref<Role.Permission[]>([])
|
||||||
return {roleUnitVisible,permissionUnitVisible,roleUnitTitle,permissionUnitTitle,roleUnitData,permissionUnitData};
|
return {roleUnitVisible,permissionUnitVisible,roleUnitTitle,permissionUnitTitle,roleUnitData,permissionUnitData};
|
||||||
}
|
}
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
const roleData = roleDataList
|
//const roleData = roleDataList
|
||||||
|
const roleData = ref<Role.ResRoleList[]>([])
|
||||||
|
getRoleList({
|
||||||
|
id: '',
|
||||||
|
rolename: '',
|
||||||
|
status: 0,
|
||||||
|
describe: '',
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
}).then(res => {
|
||||||
|
if(res.code == '200') {
|
||||||
|
roleData.value = res.data.list
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
@@ -126,6 +139,11 @@
|
|||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
minWidth: 180,
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'describe',
|
||||||
|
label: '描述',
|
||||||
|
minWidth: 380,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'status',
|
prop: 'status',
|
||||||
|
|
||||||
@@ -141,11 +159,6 @@
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
prop: 'describe',
|
|
||||||
label: '描述',
|
|
||||||
minWidth: 380,
|
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -192,7 +205,7 @@
|
|||||||
|
|
||||||
// 打开 drawer(新增、查看、编辑)
|
// 打开 drawer(新增、查看、编辑)
|
||||||
const openDrawer = (title: string, row: Partial<Role.ResRoleList> = {}) => {
|
const openDrawer = (title: string, row: Partial<Role.ResRoleList> = {}) => {
|
||||||
if(title === "新增" || title === '编辑' )
|
if(title === "新增角色" || title === '编辑角色' )
|
||||||
{
|
{
|
||||||
roleUnitVisible.value = true
|
roleUnitVisible.value = true
|
||||||
roleUnitTitle.value = title
|
roleUnitTitle.value = title
|
||||||
@@ -212,10 +225,20 @@
|
|||||||
permissionUnitVisible.value = true
|
permissionUnitVisible.value = true
|
||||||
permissionUnitTitle.value = title
|
permissionUnitTitle.value = title
|
||||||
|
|
||||||
if (row.permissionList)
|
const safeRow: Role.ResRoleList = {
|
||||||
{
|
id: row.id || '',
|
||||||
permissionUnitData.value = row.permissionList;
|
rolename: row.rolename || '',
|
||||||
}
|
status: row.status || 0,
|
||||||
|
describe: row.describe || '',
|
||||||
|
permissionList: row.permissionList || []
|
||||||
|
};
|
||||||
|
|
||||||
|
permissionUnitData.value = safeRow;
|
||||||
|
console.log(111,permissionUnitData);
|
||||||
|
// if (row.permissionList)
|
||||||
|
// {
|
||||||
|
// permissionUnitData.value = row.permissionList;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
70
frontend/src/views/authority/user/components/userUnit.vue
Normal file
70
frontend/src/views/authority/user/components/userUnit.vue
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||||
|
<div>
|
||||||
|
<el-form :model="data">
|
||||||
|
<el-form-item label="用户名" :label-width="100">
|
||||||
|
<el-input v-model="data.username" placeholder="请输入用户名" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="真实姓名" :label-width="100">
|
||||||
|
<el-input v-model="data.realname" placeholder="请输入真实姓名" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" :label-width="100">
|
||||||
|
<el-input type="password" v-model="data.password" placeholder="请输入密码" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户角色" :label-width="100">
|
||||||
|
<el-input v-model="data.rolename" placeholder="请输入用户角色" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户状态" :label-width="100">
|
||||||
|
<el-switch
|
||||||
|
v-model=value
|
||||||
|
inline-prompt
|
||||||
|
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||||
|
active-text="启用"
|
||||||
|
inactive-text="禁用"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleCancel">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref,computed } from 'vue'
|
||||||
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
|
|
||||||
|
const {dialogVisible,title,data} = defineProps<{
|
||||||
|
dialogVisible:boolean;
|
||||||
|
title:string;
|
||||||
|
data:{
|
||||||
|
username:string;
|
||||||
|
password:string;
|
||||||
|
realname:string;
|
||||||
|
status:number;
|
||||||
|
rolename:string;
|
||||||
|
}
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const value = computed({
|
||||||
|
get: () => data.status === 1,
|
||||||
|
set: (value: boolean) => data.status = value ? 1 : 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e:'update:visible',value:boolean):void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
emit('update:visible',false)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
200
frontend/src/views/authority/user/index.vue
Normal file
200
frontend/src/views/authority/user/index.vue
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='userData'
|
||||||
|
>
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增用户')">新增用户</el-button>
|
||||||
|
<el-button type='primary' :icon='Download' plain @click='downloadFile'>导出用户数据</el-button>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
|
批量删除角色
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View' @click="openDrawer('查看用户', scope.row)">查看</el-button>
|
||||||
|
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑用户', scope.row)">编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<userUnit
|
||||||
|
:dialogVisible = userUnitVisible
|
||||||
|
:title = userUnitTitle
|
||||||
|
:data = userUnitData
|
||||||
|
@update:visible="userUnitVisible = $event"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { User } from '@/api/user/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import userUnit from './components/userUnit.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import userDataList from '@/api/user/userData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getUserList,
|
||||||
|
addUser,
|
||||||
|
BatchAddUser,
|
||||||
|
editUser,
|
||||||
|
deleteUser,
|
||||||
|
changeUserStatus,
|
||||||
|
exportUserInfo,
|
||||||
|
getUserStatus,
|
||||||
|
} from '@/api/user/user'
|
||||||
|
|
||||||
|
const {userUnitVisible,userUnitTitle,userUnitData} = useCount();
|
||||||
|
function useCount() {
|
||||||
|
const userUnitVisible = ref(false)
|
||||||
|
const userUnitTitle = ref()
|
||||||
|
const userUnitData = ref<User.ResUserList>({} as User.ResUserList)
|
||||||
|
return {userUnitVisible,userUnitTitle,userUnitData};
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const userData = userDataList
|
||||||
|
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ type: 1 })
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||||||
|
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||||
|
const getTableList = (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
||||||
|
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
||||||
|
delete newParams.createTime
|
||||||
|
return getUserList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'username',
|
||||||
|
label: '用户名',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'realname',
|
||||||
|
label: '真实姓名',
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'rolename',
|
||||||
|
label: '角色类型',
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'status',
|
||||||
|
|
||||||
|
label: '状态',
|
||||||
|
enum: dictStore.getDictData('status'),
|
||||||
|
search: { el: 'tree-select', props: { filterable: true } },
|
||||||
|
minWidth: 100,
|
||||||
|
fieldNames: { label: 'label', value: 'code' },
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
// 删除角色信息
|
||||||
|
const deleteAccount = async (params: User.ResUserList) => {
|
||||||
|
await useHandleData(deleteUser, { id: [params.id] }, `删除【${params.rolename}】角色`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除角色信息
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deleteUser, { id }, '删除所选角色信息')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换角色状态
|
||||||
|
const changeStatus = async (row: User.ResUserList) => {
|
||||||
|
await useHandleData(changeUserStatus, {
|
||||||
|
id: row.id,
|
||||||
|
status: row.status == 1 ? 0 : 1,
|
||||||
|
}, `切换【${row.rolename}】角色状态`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出角色列表
|
||||||
|
const downloadFile = async () => {
|
||||||
|
ElMessageBox.confirm('确认导出角色数据?', '温馨提示', { type: 'warning' }).then(() =>
|
||||||
|
useDownload(exportUserInfo, '角色列表', proTable.value?.searchParam),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量添加角色
|
||||||
|
const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
const batchAdd = () => {
|
||||||
|
const params = {
|
||||||
|
title: '角色',
|
||||||
|
tempApi: exportUserInfo,
|
||||||
|
importApi: BatchAddUser,
|
||||||
|
getTableList: proTable.value?.getTableList,
|
||||||
|
}
|
||||||
|
dialogRef.value?.acceptParams(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开 drawer(新增、查看、编辑)
|
||||||
|
const openDrawer = (title: string, row: Partial<User.ResUserList> = {}) => {
|
||||||
|
if(title === "查看用户" ||title === "新增用户" || title === '编辑用户' )
|
||||||
|
{
|
||||||
|
userUnitVisible.value = true
|
||||||
|
userUnitTitle.value = title
|
||||||
|
|
||||||
|
if (row) {
|
||||||
|
// 确保 row 的所有属性都符合 User.ResUserList 的要求
|
||||||
|
const safeRow: User.ResUserList = {
|
||||||
|
id: row.id || '',
|
||||||
|
username: row.username || '',
|
||||||
|
password: row.password || '',
|
||||||
|
realname: row.realname || '',
|
||||||
|
status: row.status || 0,
|
||||||
|
rolename: row.rolename || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
userUnitData.value = safeRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
123
frontend/src/views/machine/device/index.vue
Normal file
123
frontend/src/views/machine/device/index.vue
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='deviceData'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='CirclePlus' >新增设备</el-button>
|
||||||
|
<el-button type='primary' :icon='Download' plain >导出设备数据</el-button>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
|
批量删除设备
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||||
|
<el-button type='primary' link :icon='EditPen' >编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { Device } from '@/api/device/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getDeviceList,
|
||||||
|
} from '@/api/device/device'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const deviceData = deviceDataList
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ type: 1 })
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||||||
|
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||||
|
const getTableList = (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
||||||
|
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
||||||
|
delete newParams.createTime
|
||||||
|
return getDeviceList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<Device.ResDeviceList>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'deviceName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceType',
|
||||||
|
label: '类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceChannels',
|
||||||
|
label: '设备通道数',
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'PlanName',
|
||||||
|
label: '所属计划',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceUn',
|
||||||
|
label: '额定电压(V)',
|
||||||
|
minWidth: 130,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceIn',
|
||||||
|
label: '额定电流(A)',
|
||||||
|
minWidth: 130,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceCompany',
|
||||||
|
label: '制作厂商',
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,10 +1,103 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>检测脚本</div>
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='testScriptData'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='CirclePlus' >新增检测脚本</el-button>
|
||||||
|
<el-button type='primary' :icon='Download' plain >导出脚本数据</el-button>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
|
批量删除脚本
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||||
|
<el-button type='primary' link :icon='EditPen' >编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||||
|
<el-button type='primary' link :icon='Upload' >升级为模板</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang='ts' setup>
|
|
||||||
onMounted(()=>{
|
<script setup lang='tsx' name='useRole'>
|
||||||
console.log()
|
import { TestScript } from '@/api/testScript/interface'
|
||||||
})
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import testScriptDataList from '@/api/testScript/testScriptData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getTestScriptList,
|
||||||
|
} from '@/api/testScript/testScript'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const testScriptData = testScriptDataList
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ type: 1 })
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||||||
|
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||||
|
const getTableList = (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
||||||
|
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
||||||
|
delete newParams.createTime
|
||||||
|
return getTestScriptList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<TestScript.ResTestScriptList>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'testScriptName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 350,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testScriptValueType',
|
||||||
|
label: '值类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testScriptType',
|
||||||
|
label: '模板类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
|
||||||
</style>
|
|
||||||
|
|||||||
103
frontend/src/views/machine/testSource/index.vue
Normal file
103
frontend/src/views/machine/testSource/index.vue
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<template>
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='testSourceData'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='CirclePlus' >新增检测源</el-button>
|
||||||
|
<el-button type='primary' :icon='Download' plain >导出检测源数据</el-button>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
|
批量删除脚本
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||||
|
<el-button type='primary' link :icon='EditPen' >编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { TestSource } from '@/api/testSource/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import testSourceDataList from '@/api/testSource/testSourceData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getTestSourceList,
|
||||||
|
} from '@/api/testSource/testSource'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const testSourceData = testSourceDataList
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ type: 1 })
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||||||
|
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||||
|
const getTableList = (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
||||||
|
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
||||||
|
delete newParams.createTime
|
||||||
|
return getTestSourceList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<TestSource.ResTestSourceList>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'testSourceName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceType',
|
||||||
|
label: '类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 220,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceModel',
|
||||||
|
label: '源类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
Reference in New Issue
Block a user