5 changed files with 628 additions and 0 deletions
@ -0,0 +1,60 @@ |
|||
import { defHttp } from '@/utils/http/axios'; |
|||
import { ID, IDS, commonExport } from '@/api/base'; |
|||
import { ModelPromptsHistoryVO, ModelPromptsHistoryForm, ModelPromptsHistoryQuery } from './model'; |
|||
|
|||
/** |
|||
* 查询模型提示词历史记录列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryList(params?: ModelPromptsHistoryQuery) { |
|||
return defHttp.get<ModelPromptsHistoryVO[]>({ url: '/productManagement/ModelPromptsHistory/list', params }); |
|||
} |
|||
|
|||
/** |
|||
* 导出模型提示词历史记录列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryExport(params?: ModelPromptsHistoryQuery) { |
|||
return commonExport('/productManagement/ModelPromptsHistory/export', params ?? {}); |
|||
} |
|||
|
|||
/** |
|||
* 查询模型提示词历史记录详细 |
|||
* @param id id |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryInfo(id: ID) { |
|||
return defHttp.get<ModelPromptsHistoryVO>({ url: '/productManagement/ModelPromptsHistory/' + id }); |
|||
} |
|||
|
|||
/** |
|||
* 新增模型提示词历史记录 |
|||
* @param data |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryAdd(data: ModelPromptsHistoryForm) { |
|||
return defHttp.postWithMsg<void>({ url: '/productManagement/ModelPromptsHistory', data }); |
|||
} |
|||
|
|||
/** |
|||
* 更新模型提示词历史记录 |
|||
* @param data |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryUpdate(data: ModelPromptsHistoryForm) { |
|||
return defHttp.putWithMsg<void>({ url: '/productManagement/ModelPromptsHistory', data }); |
|||
} |
|||
|
|||
/** |
|||
* 删除模型提示词历史记录 |
|||
* @param id id |
|||
* @returns |
|||
*/ |
|||
export function ModelPromptsHistoryRemove(id: ID | IDS) { |
|||
return defHttp.deleteWithMsg<void>({ url: '/productManagement/ModelPromptsHistory/' + id },); |
|||
} |
|||
export function ModelPromptsHistoryRestore(id: ID) { |
|||
return defHttp.postWithMsg<void>({ url: '/productManagement/ModelPromptsHistory/restore/'+id}); |
|||
} |
@ -0,0 +1,160 @@ |
|||
import { BaseEntity, PageQuery } from '@/api/base'; |
|||
|
|||
export interface ModelPromptsHistoryVO { |
|||
/** |
|||
* id |
|||
*/ |
|||
id: string | number; |
|||
|
|||
/** |
|||
* 提示词id |
|||
*/ |
|||
promptId: string | number; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
taskRoleDesc: string; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
taskName: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion: string; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry: string; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
context: string; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
description: string; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
workflow: string; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
outputDesc: string; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
cautions: string; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
modelVersion: string; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
note: string; |
|||
|
|||
} |
|||
|
|||
export interface ModelPromptsHistoryForm extends BaseEntity { |
|||
/** |
|||
* id |
|||
*/ |
|||
id?: string | number; |
|||
|
|||
/** |
|||
* 提示词id |
|||
*/ |
|||
promptId?: string | number; |
|||
|
|||
/** |
|||
* 任务角色描述 |
|||
*/ |
|||
taskRoleDesc?: string; |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
taskName?: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion?: string; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry?: string; |
|||
|
|||
/** |
|||
* 任务背景 |
|||
*/ |
|||
context?: string; |
|||
|
|||
/** |
|||
* 任务描述 |
|||
*/ |
|||
description?: string; |
|||
|
|||
/** |
|||
* 任务流程 |
|||
*/ |
|||
workflow?: string; |
|||
|
|||
/** |
|||
* 输出说明 |
|||
*/ |
|||
outputDesc?: string; |
|||
|
|||
/** |
|||
* 注意事项 |
|||
*/ |
|||
cautions?: string; |
|||
|
|||
/** |
|||
* 模型版本 |
|||
*/ |
|||
modelVersion?: string; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
note?: string; |
|||
|
|||
} |
|||
|
|||
export interface ModelPromptsHistoryQuery extends PageQuery { |
|||
|
|||
/** |
|||
* 模型任务名称 |
|||
*/ |
|||
taskName?: string; |
|||
|
|||
/** |
|||
* 模型所属区域 |
|||
*/ |
|||
taskRegion?: string; |
|||
|
|||
/** |
|||
* 模型所属行业 |
|||
*/ |
|||
taskIndustry?: string; |
|||
|
|||
/** |
|||
* 日期范围参数 |
|||
*/ |
|||
params?: any; |
|||
} |
@ -0,0 +1,211 @@ |
|||
import { BasicColumn } from '@/components/Table'; |
|||
import { FormSchema } from '@/components/Form'; |
|||
import { getDictOptions } from '@/utils/dict'; |
|||
import { useRender } from '@/hooks/component/useRender'; |
|||
export const formSchemas: FormSchema[] = [ |
|||
{ |
|||
label: '模型任务名称', |
|||
field: 'taskName', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('document_task') |
|||
}, |
|||
}, |
|||
{ |
|||
label: '模型所属区域', |
|||
field: 'taskRegion', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('model_region') |
|||
}, |
|||
}, |
|||
{ |
|||
label: '模型所属行业', |
|||
field: 'taskIndustry', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('model_industry') |
|||
}, |
|||
}, |
|||
]; |
|||
|
|||
const { renderDict } = useRender(); |
|||
export const columns: BasicColumn[] = [ |
|||
{ |
|||
title: '提示词id', |
|||
dataIndex: 'promptId', |
|||
ifShow:false |
|||
}, |
|||
{ |
|||
title: '模型任务名称', |
|||
dataIndex: 'taskName', |
|||
customRender: ({ value }) => renderDict(value, 'document_task'), |
|||
}, |
|||
{ |
|||
title: '模型所属区域', |
|||
dataIndex: 'taskRegion', |
|||
customRender: ({ value }) => renderDict(value, 'model_region'), |
|||
}, |
|||
{ |
|||
title: '模型所属行业', |
|||
dataIndex: 'taskIndustry', |
|||
customRender: ({ value }) => renderDict(value, 'model_industry'), |
|||
}, |
|||
{ |
|||
title: '任务角色描述', |
|||
dataIndex: 'taskRoleDesc', |
|||
}, |
|||
{ |
|||
title: '任务背景', |
|||
dataIndex: 'context', |
|||
}, |
|||
{ |
|||
title: '任务描述', |
|||
dataIndex: 'description', |
|||
}, |
|||
{ |
|||
title: '任务流程', |
|||
dataIndex: 'workflow', |
|||
}, |
|||
{ |
|||
title: '输出说明', |
|||
dataIndex: 'outputDesc', |
|||
}, |
|||
{ |
|||
title: '注意事项', |
|||
dataIndex: 'cautions', |
|||
}, |
|||
{ |
|||
title: '模型版本', |
|||
dataIndex: 'modelVersion', |
|||
}, |
|||
{ |
|||
title: '备注', |
|||
dataIndex: 'note', |
|||
}, |
|||
]; |
|||
|
|||
export const modalSchemas: FormSchema[] = [ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
required: false, |
|||
component: 'Input', |
|||
show: false, |
|||
}, |
|||
{ |
|||
label: '提示词id', |
|||
field: 'promptId', |
|||
required: false, |
|||
component: 'Input', |
|||
show: false, |
|||
}, |
|||
{ |
|||
label: '模型任务名称', |
|||
field: 'taskName', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('document_task') |
|||
}, |
|||
}, |
|||
{ |
|||
label: '模型所属区域', |
|||
field: 'taskRegion', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('model_region') |
|||
}, |
|||
}, |
|||
{ |
|||
label: '模型所属行业', |
|||
field: 'taskIndustry', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions('model_industry') |
|||
}, |
|||
}, |
|||
{ |
|||
label: '任务角色描述', |
|||
field: 'taskRoleDesc', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '任务背景', |
|||
field: 'context', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '任务描述', |
|||
field: 'description', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '任务流程', |
|||
field: 'workflow', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '输出说明', |
|||
field: 'outputDesc', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '注意事项', |
|||
field: 'cautions', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
label: '备注', |
|||
field: 'note', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'InputTextArea', |
|||
componentProps:{ |
|||
rows:10, |
|||
} |
|||
}, |
|||
{ |
|||
label: '模型版本', |
|||
field: 'modelVersion', |
|||
required: false, |
|||
dynamicDisabled:true, |
|||
component: 'Input', |
|||
}, |
|||
]; |
@ -0,0 +1,69 @@ |
|||
<template> |
|||
<BasicModal |
|||
v-bind="$attrs" |
|||
:title="title" |
|||
@register="registerInnerModal" |
|||
@ok="handleSubmit" |
|||
@cancel="resetForm" |
|||
width="60%" |
|||
> |
|||
<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 { ModelPromptsHistoryInfo, ModelPromptsHistoryAdd, ModelPromptsHistoryUpdate } from '@/api/modelConfiguration/ModelPromptsHistory'; |
|||
import { modalSchemas } from './ModelPromptsHistory.data'; |
|||
|
|||
defineOptions({ name: 'ModelPromptsHistoryModal' }); |
|||
|
|||
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 ModelPromptsHistoryInfo(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 ModelPromptsHistoryUpdate(data); |
|||
} else { |
|||
await ModelPromptsHistoryAdd(data); |
|||
} |
|||
emit('reload'); |
|||
closeModal(); |
|||
await resetForm(); |
|||
} catch (e) { |
|||
} finally { |
|||
modalLoading(false); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -0,0 +1,128 @@ |
|||
<template> |
|||
<PageWrapper dense> |
|||
<BasicTable @register="registerTable"> |
|||
<template #toolbar> |
|||
<a-button |
|||
@click="downloadExcel(ModelPromptsHistoryExport, '模型提示词历史记录数据', getForm().getFieldsValue())" |
|||
v-auth="'productManagement:ModelPromptsHistory:export'" |
|||
>导出</a-button |
|||
> |
|||
<!-- <a-button |
|||
type="primary" |
|||
danger |
|||
@click="multipleRemove(ModelPromptsHistoryRemove)" |
|||
:disabled="!selected" |
|||
v-auth="'productManagement:ModelPromptsHistory:remove'" |
|||
>删除</a-button |
|||
> |
|||
<a-button |
|||
type="primary" |
|||
@click="handleAdd" |
|||
v-auth="'productManagement:ModelPromptsHistory:add'" |
|||
>新增</a-button |
|||
> --> |
|||
</template> |
|||
<template #bodyCell="{ column, record }"> |
|||
<template v-if="column.key === 'action'"> |
|||
<TableAction |
|||
stopButtonPropagation |
|||
:actions="[ |
|||
{ |
|||
label: '还原', |
|||
icon: IconEnum.IMPORT, |
|||
color:'success', |
|||
type: 'primary', |
|||
ghost: true, |
|||
auth: 'productManagement:ModelPromptsHistory:restore', |
|||
popConfirm: { |
|||
placement: 'left', |
|||
title: '是否还原任务名称是[' + record.taskName + ']的模型提示词', |
|||
confirm: handleRestore.bind(null, record), |
|||
} |
|||
}, |
|||
{ |
|||
label: '查看', |
|||
icon: IconEnum.EDIT, |
|||
type: 'primary', |
|||
ghost: true, |
|||
auth: 'productManagement:ModelPromptsHistory:query', |
|||
onClick: handleQuery.bind(null, record), |
|||
}, |
|||
// { |
|||
// label: '删除', |
|||
// icon: IconEnum.DELETE, |
|||
// type: 'primary', |
|||
// danger: true, |
|||
// ghost: true, |
|||
// auth: 'productManagement:ModelPromptsHistory:remove', |
|||
// popConfirm: { |
|||
// placement: 'left', |
|||
// title: '是否删除模型提示词历史记录[' + record.id + ']?', |
|||
// confirm: handleDelete.bind(null, record), |
|||
// }, |
|||
// }, |
|||
]" |
|||
/> |
|||
</template> |
|||
</template> |
|||
</BasicTable> |
|||
<ModelPromptsHistoryModal @register="registerModal" @reload="reload" /> |
|||
</PageWrapper> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { PageWrapper } from '@/components/Page'; |
|||
import { BasicTable, useTable, TableAction } from '@/components/Table'; |
|||
import { ModelPromptsHistoryList, ModelPromptsHistoryExport, ModelPromptsHistoryRestore } from '@/api/modelConfiguration/ModelPromptsHistory'; |
|||
import { downloadExcel } from '@/utils/file/download'; |
|||
import { useModal } from '@/components/Modal'; |
|||
import ModelPromptsHistoryModal from './ModelPromptsHistoryModal.vue'; |
|||
import { formSchemas, columns } from './ModelPromptsHistory.data'; |
|||
import { IconEnum } from '@/enums/appEnum'; |
|||
|
|||
defineOptions({ name: 'ModelPromptsHistory' }); |
|||
|
|||
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({ |
|||
rowSelection: { |
|||
type: 'checkbox', |
|||
}, |
|||
title: '模型提示词历史记录列表', |
|||
api: ModelPromptsHistoryList, |
|||
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 handleQuery(record: Recordable) { |
|||
openModal(true, { record, update: true }); |
|||
} |
|||
|
|||
function handleAdd() { |
|||
openModal(true, { update: false }); |
|||
} |
|||
|
|||
async function handleRestore(record: Recordable) { |
|||
await ModelPromptsHistoryRestore(record.id); |
|||
await reload(); |
|||
} |
|||
</script> |
|||
|
|||
<style scoped></style> |
Loading…
Reference in new issue