5 changed files with 438 additions and 0 deletions
@ -0,0 +1,57 @@ |
|||||
|
import { defHttp } from '@/utils/http/axios'; |
||||
|
import { ID, IDS, commonExport } from '@/api/base'; |
||||
|
import { DocumentTasksPermissionsDetailVO, DocumentTasksPermissionsDetailForm, DocumentTasksPermissionsDetailQuery } from './model'; |
||||
|
|
||||
|
/** |
||||
|
* 查询文档任务权限详情列表 |
||||
|
* @param params |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailList(params?: DocumentTasksPermissionsDetailQuery) { |
||||
|
return defHttp.get<DocumentTasksPermissionsDetailVO[]>({ url: '/productManagement/DocumentTasksPermissionsDetail/list', params }); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出文档任务权限详情列表 |
||||
|
* @param params |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailExport(params?: DocumentTasksPermissionsDetailQuery) { |
||||
|
return commonExport('/productManagement/DocumentTasksPermissionsDetail/export', params ?? {}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询文档任务权限详情详细 |
||||
|
* @param id id |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailInfo(id: ID) { |
||||
|
return defHttp.get<DocumentTasksPermissionsDetailVO>({ url: '/productManagement/DocumentTasksPermissionsDetail/' + id }); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增文档任务权限详情 |
||||
|
* @param data |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailAdd(data: DocumentTasksPermissionsDetailForm) { |
||||
|
return defHttp.postWithMsg<void>({ url: '/productManagement/DocumentTasksPermissionsDetail', data }); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 更新文档任务权限详情 |
||||
|
* @param data |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailUpdate(data: DocumentTasksPermissionsDetailForm) { |
||||
|
return defHttp.putWithMsg<void>({ url: '/productManagement/DocumentTasksPermissionsDetail', data }); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除文档任务权限详情 |
||||
|
* @param id id |
||||
|
* @returns |
||||
|
*/ |
||||
|
export function DocumentTasksPermissionsDetailRemove(id: ID | IDS) { |
||||
|
return defHttp.deleteWithMsg<void>({ url: '/productManagement/DocumentTasksPermissionsDetail/' + id },); |
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
import { BaseEntity, PageQuery } from '@/api/base'; |
||||
|
|
||||
|
export interface DocumentTasksPermissionsDetailVO { |
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
id: string | number; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
userId: string | number; |
||||
|
|
||||
|
/** |
||||
|
* 剩余文档数 |
||||
|
*/ |
||||
|
remainingDocumentCount: number; |
||||
|
|
||||
|
/** |
||||
|
* 任务种类 |
||||
|
*/ |
||||
|
taskType: string; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
export interface DocumentTasksPermissionsDetailForm extends BaseEntity { |
||||
|
/** |
||||
|
* 主键ID |
||||
|
*/ |
||||
|
id?: string | number; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
userId?: string | number; |
||||
|
|
||||
|
/** |
||||
|
* 剩余文档数 |
||||
|
*/ |
||||
|
remainingDocumentCount?: number; |
||||
|
|
||||
|
/** |
||||
|
* 任务种类 |
||||
|
*/ |
||||
|
taskType?: string; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
export interface DocumentTasksPermissionsDetailQuery extends PageQuery { |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
userId?: string | number; |
||||
|
|
||||
|
/** |
||||
|
* 剩余文档数 |
||||
|
*/ |
||||
|
remainingDocumentCount?: number; |
||||
|
|
||||
|
/** |
||||
|
* 任务种类 |
||||
|
*/ |
||||
|
taskType?: string; |
||||
|
|
||||
|
/** |
||||
|
* 日期范围参数 |
||||
|
*/ |
||||
|
params?: any; |
||||
|
} |
@ -0,0 +1,128 @@ |
|||||
|
import { BasicColumn } from '@/components/Table'; |
||||
|
import { FormSchema } from '@/components/Form'; |
||||
|
import { getDictOptions } from '@/utils/dict'; |
||||
|
import { useRender } from '@/hooks/component/useRender'; |
||||
|
import { getUsersAll } from '@/api/taskPermissions/DocumentTasksPermissions'; |
||||
|
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: 'remainingDocumentCount', |
||||
|
component: 'Input', |
||||
|
}, |
||||
|
{ |
||||
|
label: '任务种类', |
||||
|
field: 'taskType', |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: getDictOptions('document_task'), |
||||
|
}, |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
const { renderDict } = useRender(); |
||||
|
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: 'remainingDocumentCount', |
||||
|
}, |
||||
|
{ |
||||
|
title: '任务种类', |
||||
|
dataIndex: 'taskType', |
||||
|
customRender: ({ value }) => renderDict(value, 'document_task'), |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
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}, |
||||
|
disabled: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: 'remainingDocumentCount', |
||||
|
required: true, |
||||
|
component: 'Input', |
||||
|
}, |
||||
|
{ |
||||
|
label: '任务种类', |
||||
|
field: 'taskType', |
||||
|
required: true, |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
options: getDictOptions('document_task'), |
||||
|
}, |
||||
|
}, |
||||
|
]; |
@ -0,0 +1,68 @@ |
|||||
|
<template> |
||||
|
<BasicModal |
||||
|
v-bind="$attrs" |
||||
|
:title="title" |
||||
|
@register="registerInnerModal" |
||||
|
@ok="handleSubmit" |
||||
|
@cancel="resetForm" |
||||
|
> |
||||
|
<BasicForm @register="registerForm" /> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { BasicModal, useModalInner } from '@/components/Modal'; |
||||
|
import { BasicForm, useForm } from '@/components/Form'; |
||||
|
import { computed, ref, unref } from 'vue'; |
||||
|
import { DocumentTasksPermissionsDetailInfo, DocumentTasksPermissionsDetailAdd, DocumentTasksPermissionsDetailUpdate } from '@/api/taskPermissions/DocumentTasksPermissionsDetail'; |
||||
|
import { modalSchemas } from './DocumentTasksPermissionsDetail.data'; |
||||
|
|
||||
|
defineOptions({ name: 'DocumentTasksPermissionsDetailModal' }); |
||||
|
|
||||
|
const emit = defineEmits(['register', 'reload']); |
||||
|
|
||||
|
const isUpdate = ref<boolean>(false); |
||||
|
const title = computed<string>(() => { |
||||
|
return isUpdate.value ? '编辑文档任务权限详情' : '新增文档任务权限详情'; |
||||
|
}); |
||||
|
|
||||
|
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner( |
||||
|
async (data: { record?: Recordable; update: boolean }) => { |
||||
|
modalLoading(true); |
||||
|
const { record, update } = data; |
||||
|
isUpdate.value = update; |
||||
|
if (update && record) { |
||||
|
const ret = await DocumentTasksPermissionsDetailInfo(record.id); |
||||
|
await setFieldsValue(ret); |
||||
|
} |
||||
|
modalLoading(false); |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({ |
||||
|
labelWidth: 100, |
||||
|
showActionButtonGroup: false, |
||||
|
baseColProps: { span: 24 }, |
||||
|
schemas: modalSchemas, |
||||
|
}); |
||||
|
|
||||
|
async function handleSubmit() { |
||||
|
try { |
||||
|
modalLoading(true); |
||||
|
const data = await validate(); |
||||
|
if (unref(isUpdate)) { |
||||
|
await DocumentTasksPermissionsDetailUpdate(data); |
||||
|
} else { |
||||
|
await DocumentTasksPermissionsDetailAdd(data); |
||||
|
} |
||||
|
emit('reload'); |
||||
|
closeModal(); |
||||
|
await resetForm(); |
||||
|
} catch (e) { |
||||
|
} finally { |
||||
|
modalLoading(false); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped></style> |
@ -0,0 +1,115 @@ |
|||||
|
<template> |
||||
|
<PageWrapper dense> |
||||
|
<BasicTable @register="registerTable"> |
||||
|
<!-- <template #toolbar> |
||||
|
<a-button |
||||
|
@click="downloadExcel(DocumentTasksPermissionsDetailExport, '文档任务权限详情数据', getForm().getFieldsValue())" |
||||
|
v-auth="'productManagement:DocumentTasksPermissionsDetail:export'" |
||||
|
>导出</a-button |
||||
|
> |
||||
|
<a-button |
||||
|
type="primary" |
||||
|
danger |
||||
|
@click="multipleRemove(DocumentTasksPermissionsDetailRemove)" |
||||
|
:disabled="!selected" |
||||
|
v-auth="'productManagement:DocumentTasksPermissionsDetail:remove'" |
||||
|
>删除</a-button |
||||
|
> |
||||
|
<a-button |
||||
|
type="primary" |
||||
|
@click="handleAdd" |
||||
|
v-auth="'productManagement:DocumentTasksPermissionsDetail:add'" |
||||
|
>新增</a-button |
||||
|
> |
||||
|
</template> --> |
||||
|
<template #bodyCell="{ column, record }"> |
||||
|
<template v-if="column.key === 'action'"> |
||||
|
<TableAction |
||||
|
stopButtonPropagation |
||||
|
:actions="[ |
||||
|
{ |
||||
|
label: '修改', |
||||
|
icon: IconEnum.EDIT, |
||||
|
type: 'primary', |
||||
|
ghost: true, |
||||
|
auth: 'productManagement:DocumentTasksPermissionsDetail:edit', |
||||
|
onClick: handleEdit.bind(null, record), |
||||
|
}, |
||||
|
// { |
||||
|
// label: '删除', |
||||
|
// icon: IconEnum.DELETE, |
||||
|
// type: 'primary', |
||||
|
// danger: true, |
||||
|
// ghost: true, |
||||
|
// auth: 'productManagement:DocumentTasksPermissionsDetail:remove', |
||||
|
// popConfirm: { |
||||
|
// placement: 'left', |
||||
|
// title: '是否删除文档任务权限详情[' + record.id + ']?', |
||||
|
// confirm: handleDelete.bind(null, record), |
||||
|
// }, |
||||
|
// }, |
||||
|
]" |
||||
|
/> |
||||
|
</template> |
||||
|
</template> |
||||
|
</BasicTable> |
||||
|
<DocumentTasksPermissionsDetailModal @register="registerModal" @reload="reload" /> |
||||
|
</PageWrapper> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { PageWrapper } from '@/components/Page'; |
||||
|
import { BasicTable, useTable, TableAction } from '@/components/Table'; |
||||
|
import { DocumentTasksPermissionsDetailList, DocumentTasksPermissionsDetailExport, DocumentTasksPermissionsDetailRemove } from '@/api/taskPermissions/DocumentTasksPermissionsDetail'; |
||||
|
import { downloadExcel } from '@/utils/file/download'; |
||||
|
import { useModal } from '@/components/Modal'; |
||||
|
import DocumentTasksPermissionsDetailModal from './DocumentTasksPermissionsDetailModal.vue'; |
||||
|
import { formSchemas, columns } from './DocumentTasksPermissionsDetail.data'; |
||||
|
import { IconEnum } from '@/enums/appEnum'; |
||||
|
|
||||
|
defineOptions({ name: 'DocumentTasksPermissionsDetail' }); |
||||
|
|
||||
|
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({ |
||||
|
rowSelection: { |
||||
|
type: 'checkbox', |
||||
|
}, |
||||
|
title: '文档任务权限详情列表', |
||||
|
api: DocumentTasksPermissionsDetailList, |
||||
|
showIndexColumn: false, |
||||
|
rowKey: 'id', |
||||
|
useSearchForm: true, |
||||
|
formConfig: { |
||||
|
schemas: formSchemas, |
||||
|
baseColProps: { |
||||
|
xs: 24, |
||||
|
sm: 24, |
||||
|
md: 24, |
||||
|
lg: 6, |
||||
|
}, |
||||
|
}, |
||||
|
columns: columns, |
||||
|
actionColumn: { |
||||
|
width: 200, |
||||
|
title: '操作', |
||||
|
key: 'action', |
||||
|
fixed: 'right', |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
const [registerModal, { openModal }] = useModal(); |
||||
|
|
||||
|
function handleEdit(record: Recordable) { |
||||
|
openModal(true, { record, update: true }); |
||||
|
} |
||||
|
|
||||
|
function handleAdd() { |
||||
|
openModal(true, { update: false }); |
||||
|
} |
||||
|
|
||||
|
async function handleDelete(record: Recordable) { |
||||
|
await DocumentTasksPermissionsDetailRemove([record.id]); |
||||
|
await reload(); |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped></style> |
Loading…
Reference in new issue