5 changed files with 571 additions and 0 deletions
@ -0,0 +1,57 @@ |
|||
import { defHttp } from '@/utils/http/axios'; |
|||
import { ID, IDS, commonExport } from '@/api/base'; |
|||
import { ContractualTasksVO, ContractualTasksForm, ContractualTasksQuery } from './model'; |
|||
|
|||
/** |
|||
* 查询合同任务列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksList(params?: ContractualTasksQuery) { |
|||
return defHttp.get<ContractualTasksVO[]>({ url: '/productManagement/ContractualTasks/list', params }); |
|||
} |
|||
|
|||
/** |
|||
* 导出合同任务列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksExport(params?: ContractualTasksQuery) { |
|||
return commonExport('/productManagement/ContractualTasks/export', params ?? {}); |
|||
} |
|||
|
|||
/** |
|||
* 查询合同任务详细 |
|||
* @param id id |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksInfo(id: ID) { |
|||
return defHttp.get<ContractualTasksVO>({ url: '/productManagement/ContractualTasks/' + id }); |
|||
} |
|||
|
|||
/** |
|||
* 新增合同任务 |
|||
* @param data |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksAdd(data: ContractualTasksForm) { |
|||
return defHttp.postWithMsg<void>({ url: '/productManagement/ContractualTasks', data }); |
|||
} |
|||
|
|||
/** |
|||
* 更新合同任务 |
|||
* @param data |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksUpdate(data: ContractualTasksForm) { |
|||
return defHttp.putWithMsg<void>({ url: '/productManagement/ContractualTasks', data }); |
|||
} |
|||
|
|||
/** |
|||
* 删除合同任务 |
|||
* @param id id |
|||
* @returns |
|||
*/ |
|||
export function ContractualTasksRemove(id: ID | IDS) { |
|||
return defHttp.deleteWithMsg<void>({ url: '/productManagement/ContractualTasks/' + id },); |
|||
} |
@ -0,0 +1,115 @@ |
|||
import { BaseEntity, PageQuery } from '@/api/base'; |
|||
|
|||
export interface ContractualTasksVO { |
|||
/** |
|||
* |
|||
*/ |
|||
id: string | number; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion: string; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
contractTaskName: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
documentName: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
ossId: string | number; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
progressStatus: string; |
|||
|
|||
} |
|||
|
|||
export interface ContractualTasksForm extends BaseEntity { |
|||
/** |
|||
* |
|||
*/ |
|||
id?: string | number; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry?: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion?: string; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
contractTaskName?: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
documentName?: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
ossId?: string | number; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
progressStatus?: string; |
|||
|
|||
} |
|||
|
|||
export interface ContractualTasksQuery extends PageQuery { |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry?: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion?: string; |
|||
|
|||
/** |
|||
* 合同任务名称 |
|||
*/ |
|||
contractTaskName?: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
documentName?: string; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
ossId?: string | number; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
progressStatus?: string; |
|||
|
|||
/** |
|||
* 日期范围参数 |
|||
*/ |
|||
params?: any; |
|||
} |
@ -0,0 +1,162 @@ |
|||
import { BasicColumn } from '@/components/Table'; |
|||
import { FormSchema } from '@/components/Form'; |
|||
import { getDictOptions } from '@/utils/dict'; |
|||
import { useRender } from '@/hooks/component/useRender'; |
|||
import { uploadDocument } from '@/api/documentReview/DocumentTasks'; |
|||
import { useUserStore } from '@/store/modules/user'; |
|||
import { RoleEnum } from '@/enums/roleEnum'; |
|||
|
|||
const { roleList } = useUserStore(); |
|||
export const formSchemas: FormSchema[] = [ |
|||
// {
|
|||
// label: '模型所属行业',
|
|||
// field: 'taskIndustry',
|
|||
// component: 'Select',
|
|||
// componentProps: {
|
|||
// options: getDictOptions('model_industry')
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '模型所属区域',
|
|||
// field: 'taskRegion',
|
|||
// component: 'Select',
|
|||
// componentProps: {
|
|||
// options: getDictOptions('model_region')
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '任务名称', |
|||
field: 'taskNameList', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: [ |
|||
{ |
|||
label: '合同审核', |
|||
value: 'contractReview', |
|||
}, |
|||
], |
|||
mode: 'multiple', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '文档名称', |
|||
field: 'documentName', |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'progressStatus', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('document_task_status'), |
|||
}, |
|||
}, |
|||
]; |
|||
|
|||
const { renderDict } = useRender(); |
|||
export const columns: BasicColumn[] = [ |
|||
{ |
|||
title: '任务名称', |
|||
dataIndex: 'taskName', |
|||
customRender: ({ value }) => { |
|||
if(value === 'contractReview'){ |
|||
return '合同审核' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
title: '文档名称', |
|||
dataIndex: 'documentName', |
|||
}, |
|||
{ |
|||
title: '模型所属区域', |
|||
dataIndex: 'taskRegion', |
|||
customRender: ({ value }) => renderDict(value, 'model_region'), |
|||
}, |
|||
{ |
|||
title: '模型所属行业', |
|||
dataIndex: 'taskIndustry', |
|||
customRender: ({ value }) => renderDict(value, 'model_industry'), |
|||
}, |
|||
{ |
|||
title: '上传时间', |
|||
dataIndex: 'createTime', |
|||
}, |
|||
{ |
|||
title: '提交人', |
|||
dataIndex: 'createUser', |
|||
auth: 'documentReview:DocumentTasks:tableShow', |
|||
}, |
|||
{ |
|||
title: '任务耗时', |
|||
dataIndex: 'taskDuration', |
|||
}, |
|||
{ |
|||
title: '状态', |
|||
dataIndex: 'progressStatus', |
|||
customRender: ({ value }) => renderDict(value, 'document_task_status'), |
|||
}, |
|||
]; |
|||
|
|||
export const modalSchemas: FormSchema[] = [ |
|||
{ |
|||
label: '模型所属区域', |
|||
field: 'taskRegion', |
|||
required: true, |
|||
component: 'Select', |
|||
// componentProps: {
|
|||
// options: taskRegionPermission(),
|
|||
// defaultValue:"normal",
|
|||
// },
|
|||
componentProps: () => { |
|||
const isSuperAdmin = roleList.includes(RoleEnum.SUPER_ADMIN); |
|||
let options = getDictOptions('model_region'); |
|||
if (!isSuperAdmin) { |
|||
// 如果不是超级管理员,移除 label 带有 '#' 的项
|
|||
options = options.filter((option) => !option.label.includes('#')); |
|||
} |
|||
return { |
|||
options: options, |
|||
defaultValue: 'normal', |
|||
}; |
|||
}, |
|||
}, |
|||
{ |
|||
label: '模型所属行业', |
|||
field: 'taskIndustry', |
|||
required: true, |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('model_industry'), |
|||
defaultValue: 'normal', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '任务名称', |
|||
field: 'taskNameList', |
|||
required: true, |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: [ |
|||
{ |
|||
label: '合同审核', |
|||
value: 'contractReview', |
|||
}, |
|||
], |
|||
mode: 'multiple', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '文档名称', |
|||
field: 'ossId', |
|||
required: true, |
|||
component: 'Upload', |
|||
componentProps: { |
|||
accept: ['.docx', '.doc', '.wps'], |
|||
maxSize: 500, |
|||
multiple: false, |
|||
resultField: 'ossId', |
|||
api: uploadDocument, |
|||
}, |
|||
}, |
|||
]; |
@ -0,0 +1,72 @@ |
|||
<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 { ContractualTasksInfo, ContractualTasksAdd, ContractualTasksUpdate } from '@/api/contractReview/ContractualTasks'; |
|||
import { modalSchemas } from './ContractualTasks.data'; |
|||
import { ModelUserPromptssettingInfoByUserId } from '@/api/modelConfiguration/ModelUserPromptssetting/index'; |
|||
|
|||
defineOptions({ name: 'ContractualTasksModal' }); |
|||
|
|||
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 settings = await ModelUserPromptssettingInfoByUserId(); |
|||
await setFieldsValue(settings); |
|||
// const { record, update } = data; |
|||
// isUpdate.value = update; |
|||
// if (update && record) { |
|||
// const ret = await ContractualTasksInfo(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(); |
|||
data['ossId'] = data['ossId'][0]; |
|||
if (unref(isUpdate)) { |
|||
await ContractualTasksUpdate(data); |
|||
} else { |
|||
await ContractualTasksAdd(data); |
|||
} |
|||
emit('reload'); |
|||
closeModal(); |
|||
await resetForm(); |
|||
} catch (e) { |
|||
} finally { |
|||
modalLoading(false); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -0,0 +1,165 @@ |
|||
<template> |
|||
<PageWrapper dense> |
|||
<BasicTable @register="registerTable"> |
|||
<template #toolbar> |
|||
<a-button |
|||
@click="downloadExcel(ContractualTasksExport, '合同任务数据', getForm().getFieldsValue())" |
|||
v-auth="'productManagement:ContractualTasks:export'" |
|||
>导出</a-button |
|||
> |
|||
<a-button |
|||
type="primary" |
|||
danger |
|||
@click="multipleRemove(ContractualTasksRemove)" |
|||
:disabled="!selected" |
|||
v-auth="'productManagement:ContractualTasks:remove'" |
|||
>删除</a-button |
|||
> |
|||
<a-button |
|||
type="primary" |
|||
@click="handleAdd" |
|||
v-auth="'productManagement:ContractualTasks: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, |
|||
ifShow: () => { |
|||
if ( |
|||
record.progressStatus != 'PENDING' && |
|||
record.progressStatus != 'STARTED' && |
|||
record.progressStatus != 'REVOKED' |
|||
) { |
|||
return true; |
|||
} else { |
|||
return false; |
|||
} |
|||
}, |
|||
onClick: handleDetail.bind(null, record), |
|||
}, |
|||
{ |
|||
label: '终止任务', |
|||
icon: IconEnum.DELETE, |
|||
type: 'primary', |
|||
danger: true, |
|||
ghost: true, |
|||
ifShow: () => { |
|||
if (record.progressStatus == 'PENDING') { |
|||
return true; |
|||
} else { |
|||
return false; |
|||
} |
|||
}, |
|||
popConfirm: { |
|||
placement: 'left', |
|||
title: '是否终止当前任务?', |
|||
confirm: handleStop.bind(null, record), |
|||
}, |
|||
}, |
|||
]" |
|||
/> |
|||
</template> |
|||
</template> |
|||
</BasicTable> |
|||
<ContractualTasksModal @register="registerModal" @reload="reload" /> |
|||
<DocsDrawer @register="registerDrawer" /> |
|||
</PageWrapper> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { PageWrapper } from '@/components/Page'; |
|||
import { BasicTable, useTable, TableAction } from '@/components/Table'; |
|||
import { DocumentTasksStop } from '@/api/documentReview/DocumentTasks'; |
|||
import { |
|||
ContractualTasksList, |
|||
ContractualTasksExport, |
|||
ContractualTasksRemove, |
|||
} from '@/api/contractReview/ContractualTasks'; |
|||
import { downloadExcel } from '@/utils/file/download'; |
|||
import { useModal } from '@/components/Modal'; |
|||
import ContractualTasksModal from './ContractualTasksModal.vue'; |
|||
import { formSchemas, columns } from './ContractualTasks.data'; |
|||
import { IconEnum } from '@/enums/appEnum'; |
|||
import DocsDrawer from '@/views/documentReview/DocumentTasks/DocsDrawer.vue'; |
|||
import { useDrawer } from '@/components/Drawer'; |
|||
|
|||
const [registerDrawer, { openDrawer }] = useDrawer(); |
|||
|
|||
defineOptions({ name: 'ContractualTasks' }); |
|||
|
|||
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({ |
|||
rowSelection: { |
|||
type: 'checkbox', |
|||
}, |
|||
title: '合同任务列表', |
|||
api: ContractualTasksList, |
|||
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(); |
|||
import { DocumentTaskResultsInfoByTaskId } from '@/api/documentReview/DocumentTaskResults'; |
|||
|
|||
async function handleDetail(record: Recordable) { |
|||
try { |
|||
let res = await DocumentTaskResultsInfoByTaskId(record.id); |
|||
if (record.taskName == 'schemEvaluation') { |
|||
// res.result=generateTable(JSON.parse(res.result as string)) |
|||
const updatedHtmlText = res.result?.replace( |
|||
/文件名称:\S+/g, |
|||
`文件名称:${record.documentName}`, |
|||
); |
|||
openDrawer(true, { value: updatedHtmlText, type: 'html' }); |
|||
} else if (record.taskName == 'checkDocumentError') { |
|||
openDrawer(true, { value: res.result, type: 'html' }); |
|||
} else { |
|||
openDrawer(true, { value: res.result, type: 'markdown' }); |
|||
} |
|||
console.log('res', res); |
|||
} catch (ex) { |
|||
openDrawer(true, { value: '加载失败,请刷新页面', type: 'markdown' }); |
|||
} |
|||
//根据record.id查询结果详情 |
|||
} |
|||
|
|||
async function handleStop(record: Recordable) { |
|||
await DocumentTasksStop(record.id); |
|||
await reload(); |
|||
} |
|||
|
|||
function handleAdd() { |
|||
openModal(true, { update: false }); |
|||
} |
|||
|
|||
async function handleDelete(record: Recordable) { |
|||
await ContractualTasksRemove([record.id]); |
|||
await reload(); |
|||
} |
|||
</script> |
|||
|
|||
<style scoped></style> |
Loading…
Reference in new issue