From a4d558428a453fd4a1975d1801060ac7fccbb8eb Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Tue, 30 Apr 2024 10:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=82=E5=8C=BA=E7=8F=AD=E7=BB=84=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basic/classType/index.ts | 54 ++++ src/api/system/dept/index.ts | 12 + src/api/system/role/index.ts | 11 + .../eam/basic/classType/classType.data.ts | 176 +++++++++++++ src/views/eam/basic/classType/index.vue | 244 ++++++++++++++++++ src/views/system/role/role.data.ts | 83 ++++++ 6 files changed, 580 insertions(+) create mode 100644 src/api/eam/basic/classType/index.ts create mode 100644 src/views/eam/basic/classType/classType.data.ts create mode 100644 src/views/eam/basic/classType/index.vue create mode 100644 src/views/system/role/role.data.ts diff --git a/src/api/eam/basic/classType/index.ts b/src/api/eam/basic/classType/index.ts new file mode 100644 index 0000000..89d153f --- /dev/null +++ b/src/api/eam/basic/classType/index.ts @@ -0,0 +1,54 @@ +import request from '@/config/axios' + +export interface ClassTypeVO { + workerRoleId: string + engineerRoleId: string + type: string + describes: string + factoryAreaNumber: string + siteId: string + available: string + deptId: number + concurrencyStamp: number +} + +// 查询厂区班组角色数据维护列表 +export const getClassTypePage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/class-type/senior', data }) + } else { + return await request.get({ url: `/eam/class-type/page`, params }) + } +} + +// 查询厂区班组角色数据维护详情 +export const getClassType = async (id: number) => { + return await request.get({ url: `/eam/class-type/get?id=` + id }) +} + +// 新增厂区班组角色数据维护 +export const createClassType = async (data: ClassTypeVO) => { + return await request.post({ url: `/eam/class-type/create`, data }) +} + +// 修改厂区班组角色数据维护 +export const updateClassType = async (data: ClassTypeVO) => { + return await request.put({ url: `/eam/class-type/update`, data }) +} + +// 删除厂区班组角色数据维护 +export const deleteClassType = async (id: number) => { + return await request.delete({ url: `/eam/class-type/delete?id=` + id }) +} + +// 导出厂区班组角色数据维护 Excel +export const exportClassType = async (params) => { + return await request.download({ url: `/eam/class-type/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/class-type/get-import-template' }) +} \ No newline at end of file diff --git a/src/api/system/dept/index.ts b/src/api/system/dept/index.ts index 3d902d7..b028457 100644 --- a/src/api/system/dept/index.ts +++ b/src/api/system/dept/index.ts @@ -22,6 +22,18 @@ export const getDeptPage = async (params: PageParam) => { return await request.get({ url: '/system/dept/list', params }) } +// 查询部门分页 +export const getDeptPages = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/system/dept/senior', data }) + } else { + return await request.get({ url: `/system/dept/page`, params }) + } +} + + // 查询部门详情 export const getDept = async (id: number) => { return await request.get({ url: '/system/dept/get?id=' + id }) diff --git a/src/api/system/role/index.ts b/src/api/system/role/index.ts index 93636ff..d174e95 100644 --- a/src/api/system/role/index.ts +++ b/src/api/system/role/index.ts @@ -22,6 +22,17 @@ export const getRolePage = async (params: PageParam) => { return await request.get({ url: '/system/role/page', params }) } +// 查询角色分页 +export const getRolePages = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/system/role/senior', data }) + } else { + return await request.get({ url: `/system/role/page`, params }) + } +} + // 查询角色(精简)列表 export const getSimpleRoleList = async (): Promise => { return await request.get({ url: '/system/role/list-all-simple' }) diff --git a/src/views/eam/basic/classType/classType.data.ts b/src/views/eam/basic/classType/classType.data.ts new file mode 100644 index 0000000..222f194 --- /dev/null +++ b/src/views/eam/basic/classType/classType.data.ts @@ -0,0 +1,176 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import * as deptApi from '@/api/system/dept' +import * as roleApi from '@/api/system/role' +import { Role } from '@/views/system/role/role.data' +// 表单校验 +export const ClassTypeRules = reactive({ + workerRoleId: [required], + engineerRoleId: [required], + type: [required], + factoryAreaNumber: [required], +}) +const FactoryAreaNoPage = await deptApi.getDeptPage({'deptGroup':'factory'}) +const roleList = await roleApi.getSimpleRoleList({}) +console.log('FactoryAreaNoPage',FactoryAreaNoPage); +console.log('roleList',roleList); + + const FactoryAreaNumbers = useCrudSchemas(reactive([ + + { + + label: '编号', + + field: 'id', + + sort: 'custom', + + isSearch: true, + isForm: true, + + table: { + + width: 180, + + fixed: 'left' + + }, + + }, + + { + + label: '名称', + + field: 'name', + + sort: 'custom', + + } + + ])) +export const ClassType = useCrudSchemas(reactive([ + { + label: '维修工角色id', + field: 'workerRoleId', + sort: 'custom', + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择单号', // 输入框占位文本 + searchField: 'id', // 查询弹窗赋值字段 + searchTitle: '维修工角色', // 查询弹窗标题 + searchAllSchemas: Role.allSchemas, // 查询弹窗所需类 + searchPage: roleApi.getRolePages, // 查询弹窗所需分页方法 + searchCondition: [ + // { + // key: 'deptGroup', + // value: 'factory', + // isMainValue: false + // } + ] + } + }, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return roleList.find((item) => item.id == cellValue)?.name + }, + }, + { + label: '工程师角色id', + field: 'engineerRoleId', + sort: 'custom', + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择单号', // 输入框占位文本 + searchField: 'id', // 查询弹窗赋值字段 + searchTitle: '工程师角色', // 查询弹窗标题 + searchAllSchemas: Role.allSchemas, // 查询弹窗所需类 + searchPage: roleApi.getRolePage, // 查询弹窗所需分页方法 + searchCondition: [ + // { + // key: 'deptGroup', + // value: 'factory', + // isMainValue: false + // } + ] + } + }, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return roleList.find((account) => account.id == cellValue)?.name + }, + }, + { + label: '设备类型', + field: 'type', + dictType: DICT_TYPE.CLASS_TYPE, + isSearch: false, + dictClass: 'string', + sort: 'custom', + form: { + component: 'Select' + }, + }, + { + label: '描述', + field: 'describes', + sort: 'custom', + }, + { + label: '所属厂区编号', + field: 'factoryAreaNumber', + isSearch: false, + sort: 'custom', + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择单号', // 输入框占位文本 + searchField: 'id', // 查询弹窗赋值字段 + searchTitle: '厂区信息', // 查询弹窗标题 + searchAllSchemas: FactoryAreaNumbers.allSchemas, // 查询弹窗所需类 + searchPage: deptApi.getDeptPages, // 查询弹窗所需分页方法 + searchCondition: [ + { + key: 'deptGroup', + value: 'factory', + isMainValue: false + } + ] + } + }, + //给列表用的 + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return FactoryAreaNoPage.find((account) => account.id == cellValue)?.name + }, + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isForm: false, + }, + // { + // label: '地点ID', + // field: 'siteId', + // sort: 'custom', + // }, + // { + // label: '是否可用', + // field: 'available', + // sort: 'custom', + // }, + + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) diff --git a/src/views/eam/basic/classType/index.vue b/src/views/eam/basic/classType/index.vue new file mode 100644 index 0000000..f1fb288 --- /dev/null +++ b/src/views/eam/basic/classType/index.vue @@ -0,0 +1,244 @@ + + + diff --git a/src/views/system/role/role.data.ts b/src/views/system/role/role.data.ts new file mode 100644 index 0000000..bd080c3 --- /dev/null +++ b/src/views/system/role/role.data.ts @@ -0,0 +1,83 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const RoleRules = reactive({ + name: [required], + code: [required], +}) + +export const Role = useCrudSchemas(reactive([ + { + label: '角色ID', + field: 'id', + sort: 'custom', + isForm: false, + }, + { + label: '角色名称', + field: 'name', + sort: 'custom', + }, + { + label: '角色权限字符串', + field: 'code', + sort: 'custom', + }, + { + label: '显示顺序', + field: 'sort', + sort: 'custom', + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + field: 'dataScope', + sort: 'custom', + }, + { + label: '数据范围(指定部门数组)', + field: 'dataScopeDeptIds', + sort: 'custom', + }, + { + label: '角色状态(0正常 1停用)', + field: 'status', + sort: 'custom', + form: { + component: 'Radio' + }, + }, + { + label: '角色类型', + field: 'type', + sort: 'custom', + form: { + component: 'Select' + }, + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isForm: false, + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +]))