diff --git a/src/api/taskPermissions/DocumentTasksPermissions/index.ts b/src/api/taskPermissions/DocumentTasksPermissions/index.ts new file mode 100644 index 0000000..80f27da --- /dev/null +++ b/src/api/taskPermissions/DocumentTasksPermissions/index.ts @@ -0,0 +1,67 @@ +import { defHttp } from '@/utils/http/axios'; +import { ID, IDS, commonExport } from '@/api/base'; +import { DocumentTasksPermissionsVO, DocumentTasksPermissionsForm, DocumentTasksPermissionsQuery } from './model'; + +/** + * 查询文档任务权限列表 + * @param params + * @returns + */ +export function DocumentTasksPermissionsList(params?: DocumentTasksPermissionsQuery) { + return defHttp.get({ url: '/productManagement/DocumentTasksPermissions/list', params }); +} + +/** + * 导出文档任务权限列表 + * @param params + * @returns + */ +export function DocumentTasksPermissionsExport(params?: DocumentTasksPermissionsQuery) { + return commonExport('/productManagement/DocumentTasksPermissions/export', params ?? {}); +} + +/** + * 查询文档任务权限详细 + * @param id id + * @returns + */ +export function DocumentTasksPermissionsInfo(id: ID) { + return defHttp.get({ url: '/productManagement/DocumentTasksPermissions/' + id }); +} + +/** + * 新增文档任务权限 + * @param data + * @returns + */ +export function DocumentTasksPermissionsAdd(data: DocumentTasksPermissionsForm) { + return defHttp.postWithMsg({ url: '/productManagement/DocumentTasksPermissions', data }); +} + +/** + * 更新文档任务权限 + * @param data + * @returns + */ +export function DocumentTasksPermissionsUpdate(data: DocumentTasksPermissionsForm) { + return defHttp.putWithMsg({ url: '/productManagement/DocumentTasksPermissions', data }); +} + +/** + * 删除文档任务权限 + * @param id id + * @returns + */ +export function DocumentTasksPermissionsRemove(id: ID | IDS) { + return defHttp.deleteWithMsg({ url: '/productManagement/DocumentTasksPermissions/' + id },); +} +/** + * 获取所有人员列表 + * @returns 所有人员列表 + */ +export const getUsersAll = () => { + return defHttp.get({ url: '/productManagement/DocumentTasksPermissions/getUsersAll' }); +} +export const getTasksPermissionsByUserId = () => { + return defHttp.get({ url: '/productManagement/DocumentTasksPermissions/getTasksPermissionsByUserId' }); +} \ No newline at end of file diff --git a/src/api/taskPermissions/DocumentTasksPermissions/model.ts b/src/api/taskPermissions/DocumentTasksPermissions/model.ts new file mode 100644 index 0000000..c0dd144 --- /dev/null +++ b/src/api/taskPermissions/DocumentTasksPermissions/model.ts @@ -0,0 +1,115 @@ +import { BaseEntity, PageQuery } from '@/api/base'; + +export interface DocumentTasksPermissionsVO { + /** + * 主键ID + */ + id: string | number; + + /** + * 用户ID + */ + userId: string | number; + + /** + * 角色ID + */ + roleId: string | number; + + /** + * 每日文档数 + */ + dailyDocumentCount: number; + + /** + * 优先级 + */ + priority: number; + + /** + * 任务种类 + */ + taskType: string; + + /** + * 当日剩余任务数 + */ + remainingTasksToday: number; + +} + +export interface DocumentTasksPermissionsForm extends BaseEntity { + /** + * 主键ID + */ + id?: string | number; + + /** + * 用户ID + */ + userId?: string | number; + + /** + * 角色ID + */ + roleId?: string | number; + + /** + * 每日文档数 + */ + dailyDocumentCount?: number; + + /** + * 优先级 + */ + priority?: number; + + /** + * 任务种类 + */ + taskType?: string; + + /** + * 当日剩余任务数 + */ + remainingTasksToday?: number; + +} + +export interface DocumentTasksPermissionsQuery extends PageQuery { + + /** + * 用户ID + */ + userId?: string | number; + + /** + * 角色ID + */ + roleId?: string | number; + + /** + * 每日文档数 + */ + dailyDocumentCount?: number; + + /** + * 优先级 + */ + priority?: number; + + /** + * 任务种类 + */ + taskType?: string; + + /** + * 当日剩余任务数 + */ + remainingTasksToday?: number; + + /** + * 日期范围参数 + */ + params?: any; +} diff --git a/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissions.data.ts b/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissions.data.ts new file mode 100644 index 0000000..ab7b4f4 --- /dev/null +++ b/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissions.data.ts @@ -0,0 +1,221 @@ +import { BasicColumn } from '@/components/Table'; +import { FormSchema } from '@/components/Form'; +import { roleOptionSelect, roleInfo } from '@/api/system/role'; +import { getDictOptions,getDict } from '@/utils/dict'; +import { getUsersAll } from '@/api/taskPermissions/DocumentTasksPermissions'; +import { useRender } from '@/hooks/component/useRender'; +const { renderDict,renderDictTags } = useRender(); +const roleOption = await roleOptionSelect() +const userOption = await getUsersAll() + +export const formSchemas: FormSchema[] = [ + { + label: '用户', + field: 'userId', + component: 'ApiSelect', + componentProps: ({ formModel, formActionType }) => { + //获取所有用户列表,如果用户选择了用户,则不显示角色,如果用户选择了角色,则不显示用户 + return { + api: ()=>{return userOption}, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + valueField: 'userId', + labelField: 'userName', + onChange: (value: any) => { + const { updateSchema, setFieldsValue } = formActionType; + if (value) { + updateSchema({ field: 'roleId', show: false, required: false }); + } else { + updateSchema({ field: 'roleId', show: true, required: true }); + } + }, + }; + }, + }, + { + label: '角色', + field: 'roleId', + component: 'ApiSelect', + componentProps: ({ formModel, formActionType }) => { + //获取角色列表,如果用户选择了用户,则不显示角色,如果用户选择了角色,则不显示用户 + return { + api: ()=>{return roleOption}, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + valueField: 'roleId', + labelField: 'roleName', + onChange: (value: any) => { + const { updateSchema, setFieldsValue } = formActionType; + console.log(value); + if (value) { + updateSchema({ field: 'userId', show: false, required: false }); + } else { + updateSchema({ field: 'userId', show: true, required: true }); + } + }, + }; + }, + }, + { + label: '任务种类', + field: 'taskType', + component: 'Select', + componentProps: { + options: getDictOptions('document_task') + }, + }, + { + label: '每日文档数', + field: 'dailyDocumentCount', + component: 'Input', + }, + { + label: '优先级', + field: 'priority', + component: 'Input', + }, + +]; + +export const columns: BasicColumn[] = [ + { + title: '主键ID', + dataIndex: 'id', + ifShow: false, + }, + { + title: '用户', + dataIndex: 'userId', + customRender: ({ value }) => { + for (const item of userOption) { + if (item.userId === value) { + return item.userName; + } + } + }, + }, + { + title: '角色', + dataIndex: 'roleId', + customRender: ({ value }) => { + for (const item of roleOption) { + if (item.roleId === value) { + return item.roleName; + } + } + }, + }, + { + title: '任务种类', + dataIndex: 'taskTypeList', + customRender: ({ value }) => renderDictTags(value, getDict('document_task')), + }, + + { + title: '每日文档数', + dataIndex: 'dailyDocumentCount', + }, + { + title: '优先级', + dataIndex: 'priority', + }, +]; + +export const modalSchemas: FormSchema[] = [ + { + label: '主键ID', + field: 'id', + required: false, + component: 'Input', + show: false, + }, + { + label: '用户', + field: 'userId', + required: true, + component: 'ApiSelect', + componentProps: ({ formModel, formActionType }) => { + //获取所有用户列表,如果用户选择了用户,则不显示角色,如果用户选择了角色,则不显示用户 + return { + api: ()=>{return userOption}, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + valueField: 'userId', + labelField: 'userName', + onChange: (value: any) => { + const { updateSchema, setFieldsValue } = formActionType; + if (value) { + updateSchema({ field: 'roleId', show: false, required: false }); + } else { + updateSchema({ field: 'roleId', show: true, required: true }); + } + }, + }; + }, + }, + { + label: '角色', + field: 'roleId', + required: true, + component: 'ApiSelect', + componentProps: ({ formModel, formActionType }) => { + //获取角色列表,如果用户选择了用户,则不显示角色,如果用户选择了角色,则不显示用户 + return { + api: ()=>{return roleOption}, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + valueField: 'roleId', + labelField: 'roleName', + onChange: (value: any) => { + const { updateSchema, setFieldsValue } = formActionType; + console.log(value); + if (value) { + updateSchema({ field: 'userId', show: false, required: false }); + } else { + updateSchema({ field: 'userId', show: true, required: true }); + } + }, + }; + }, + }, + { + label: '任务种类', + field: 'taskTypeList', + required: true, + component: 'Select', + componentProps: { + options: getDictOptions('document_task'), + mode: 'multiple', + }, + }, + { + label: '每日文档数', + field: 'dailyDocumentCount', + required: true, + component: 'Input', + }, + { + label: '优先级', + field: 'priority', + required: true, + component: 'InputNumber', + componentProps: { + min: 1, + max: 10, + step: 1, + }, + }, + +]; diff --git a/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissionsModal.vue b/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissionsModal.vue new file mode 100644 index 0000000..187b431 --- /dev/null +++ b/src/views/taskPermissions/DocumentTasksPermissions/DocumentTasksPermissionsModal.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/views/taskPermissions/DocumentTasksPermissions/index.vue b/src/views/taskPermissions/DocumentTasksPermissions/index.vue new file mode 100644 index 0000000..c731e9e --- /dev/null +++ b/src/views/taskPermissions/DocumentTasksPermissions/index.vue @@ -0,0 +1,115 @@ + + + + +