对比新文件 |
| | |
| | | import request from '@/config/axios'
|
| | |
|
| | | // 大模型问题模板 VO
|
| | | export interface QuestionTemplateVO {
|
| | | id: string // id
|
| | | modelId: string // 模型id
|
| | | questionCode: string // 问题编号
|
| | | questionName: string // 问题名称
|
| | | questionContent: string // 问题内容
|
| | | dataLength: number // 输入个数
|
| | | isEnable: number // 是否启用(0禁用 1启用)
|
| | | remark: string // 备注
|
| | | createDate: Date // 创建时间
|
| | | updator: number // 更新者
|
| | | updateDate: Date // 更新时间
|
| | | }
|
| | |
|
| | | // 大模型问题模板 API
|
| | | export const QuestionTemplateApi = {
|
| | | // 查询大模型问题模板分页
|
| | | getQuestionTemplatePage: async (params: any) => {
|
| | | return await request.get({ url: `/ai/question-template/page`, params })
|
| | | },
|
| | |
|
| | | // 查询大模型问题模板详情
|
| | | getQuestionTemplate: async (id: number) => {
|
| | | return await request.get({ url: `/ai/question-template/get?id=` + id })
|
| | | },
|
| | |
|
| | | // 新增大模型问题模板
|
| | | createQuestionTemplate: async (data: QuestionTemplateVO) => {
|
| | | return await request.post({ url: `/ai/question-template/create`, data })
|
| | | },
|
| | |
|
| | | // 修改大模型问题模板
|
| | | updateQuestionTemplate: async (data: QuestionTemplateVO) => {
|
| | | return await request.put({ url: `/ai/question-template/update`, data })
|
| | | },
|
| | |
|
| | | // 删除大模型问题模板
|
| | | deleteQuestionTemplate: async (id: number) => {
|
| | | return await request.delete({ url: `/ai/question-template/delete?id=` + id })
|
| | | },
|
| | |
|
| | | // 导出大模型问题模板 Excel
|
| | | exportQuestionTemplate: async (params) => {
|
| | | return await request.download({ url: `/ai/question-template/export-excel`, params })
|
| | | },
|
| | | }
|
对比新文件 |
| | |
| | | <template> |
| | | <!-- 搜索 --> |
| | | <ContentWrap> |
| | | <el-form |
| | | class="-mb-15px" |
| | | :model="queryParams" |
| | | ref="queryFormRef" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="模型编号" prop="modelCode"> |
| | | <el-input |
| | | v-model="queryParams.modelCode" |
| | | placeholder="请输入模型编号" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="模型名称" prop="modelName"> |
| | | <el-input |
| | | v-model="queryParams.modelName" |
| | | placeholder="请输入模型名称" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="handleQuery"> |
| | | <Icon icon="ep:search" class="mr-5px" /> |
| | | 搜索 |
| | | </el-button> |
| | | <el-button @click="resetQuery"> |
| | | <Icon icon="ep:refresh" class="mr-5px" /> |
| | | 重置 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | @click="openForm('create')" |
| | | v-hasPermi="['ai:question-template:create']" |
| | | > |
| | | <Icon icon="ep:plus" class="mr-5px" /> |
| | | 新增 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | |
| | | <!-- 列表 --> |
| | | <ContentWrap> |
| | | <el-table v-loading="loading" :data="list"> |
| | | <el-table-column label="模型id" align="center" prop="modelId" min-width="100"/> |
| | | <el-table-column label="问题编号" header-align="center" align="left" prop="questionCode" min-width="100"/> |
| | | <el-table-column label="问题内容" align="center" prop="questionName" min-width="100"/> |
| | | <el-table-column label="问题名称" header-align="center" align="left" prop="questionContent" min-width="200"/> |
| | | <el-table-column label="输入个数" align="center" prop="isEnable" min-width="100"/> |
| | | <el-table-column label="是否启用" align="center" prop="portLength" min-width="100"/> |
| | | <el-table-column label="备注" header-align="center" align="left" prop="remark" min-width="200" /> |
| | | <el-table-column label="操作" align="center" min-width="100" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['ai:question-template:update']" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['ai:question-template:delete']" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | | :total="total" |
| | | v-model:page="queryParams.pageNo" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </ContentWrap> |
| | | |
| | | <!-- 表单弹窗:添加/修改 --> |
| | | <TemplateForm ref="formRef" @success="getList" /> |
| | | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import {DICT_TYPE, getIntDictOptions} from '@/utils/dict' |
| | | import {dateFormatter} from '@/utils/formatTime' |
| | | import download from '@/utils/download' |
| | | import * as AiQuestionTemplateApi from '@/api/ai/questiontemplate' |
| | | import TemplateForm from './templateForm.vue' |
| | | |
| | | defineOptions({name: 'AiTemplate'}) |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const {t} = useI18n() // 国际化 |
| | | |
| | | const loading = ref(true) // 列表的加载中 |
| | | const total = ref(0) // 列表的总页数 |
| | | const list = ref([]) // 列表的数据 |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | modelCode: undefined, |
| | | modelName: undefined |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | const exportLoading = ref(false) // 导出的加载中 |
| | | |
| | | /** 查询列表 */ |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const page = await AiQuestionTemplateApi.QuestionTemplateApi.getQuestionTemplatePage(queryParams) |
| | | list.value = page.list |
| | | total.value = page.total |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | queryParams.pageNo = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields() |
| | | handleQuery() |
| | | } |
| | | |
| | | /** 添加/修改操作 */ |
| | | const formRef = ref() |
| | | const openForm = (type: string, id?: number) => { |
| | | formRef.value.open(type, id) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | | const handleDelete = async (id: number) => { |
| | | try { |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await AiQuestionTemplateApi.QuestionTemplateApi.deleteQuestionTemplate(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | | } catch { |
| | | } |
| | | } |
| | | |
| | | /** 初始化 **/ |
| | | onMounted(async () => { |
| | | await getList() |
| | | }) |
| | | </script> |
对比新文件 |
| | |
| | | <template> |
| | | <Dialog v-model="dialogVisible" :title="dialogTitle" width="75%"> |
| | | <el-form |
| | | ref="formRef" |
| | | v-loading="formLoading" |
| | | :model="formData" |
| | | :rules="formRules" |
| | | label-width="120px" |
| | | > |
| | | <el-divider content-position="left">基本信息</el-divider> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="问题编号" prop="questionCode"> |
| | | <el-input v-model="formData.questionCode" placeholder="请输入问题编号" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="问题名称" prop="questionName"> |
| | | <el-input v-model="formData.questionName" placeholder="请输入问题名称" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="输入个数" prop="dataLength"> |
| | | <el-input v-model="formData.dataLength" placeholder="请输入输入个数"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="问题内容" prop="questionContent"> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2}" |
| | | placeholder="请输入问题内容" |
| | | v-model="formData.questionContent"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left">设置参数</el-divider> |
| | | <el-table |
| | | :data="formData.settingList" |
| | | border |
| | | style="width: 100%; margin-top: 5px;"> |
| | | <el-table-column |
| | | prop="" |
| | | label="键" |
| | | min-width="150" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.settingKey" maxlength="20" clearable |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="" |
| | | label="名称" |
| | | min-width="150" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.settingName" maxlength="20" clearable |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="" |
| | | label="值" |
| | | min-width="150" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.settingValue" maxlength="256" clearable |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="" |
| | | label="操作" |
| | | width="150" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | @click.prevent="addRow(scope.$index, formData.settingList)" |
| | | type="primary" |
| | | size="small"> |
| | | 添加 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | @click.prevent="deleteRow(scope.$index, formData.settingList)" |
| | | type="primary" |
| | | size="small"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </template> |
| | | </Dialog> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
| | | import * as AiQuestionTemplateApi from '@/api/ai/questiontemplate' |
| | | import { CommonStatusEnum } from '@/utils/constants' |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | defineOptions({ name: 'AiTemplateForm' }) |
| | | |
| | | const { t } = useI18n() |
| | | const message = useMessage() |
| | | const dialogVisible = ref(false) |
| | | const dialogTitle = ref('') |
| | | const formLoading = ref(false) |
| | | const formType = ref('') |
| | | const formData = ref({ |
| | | id: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | dataLength: undefined, |
| | | questionContent: undefined, |
| | | settingList: [{ |
| | | settingKey: '', |
| | | settingName: '', |
| | | settingValue: '', |
| | | }] |
| | | }) |
| | | const formRules = reactive({ |
| | | questionCode: [{ required: true, message: '问题编号不能为空', trigger: 'blur' }], |
| | | questionName: [{ required: true, message: '问题名称不能为空', trigger: 'blur' }], |
| | | dataLength: [{ required: true, message: '输入个数不能为空', trigger: 'blur' }], |
| | | questionContent: [{ required: true, message: '问题内容不能为空', trigger: 'blur' }] |
| | | }) |
| | | const formRef = ref() |
| | | |
| | | const addRow = function (index, rows) { |
| | | rows.splice(index + 1, 0, { |
| | | settingKey: '', |
| | | settingName: '', |
| | | settingValue: '', |
| | | }) |
| | | } |
| | | |
| | | const deleteRow = function (index, rows) { |
| | | if (rows.length <= 1) { |
| | | message.error('至少保留一个参数') |
| | | return |
| | | } |
| | | rows.splice(index, 1) |
| | | } |
| | | |
| | | const open = async (type: string, id?: number) => { |
| | | dialogVisible.value = true |
| | | dialogTitle.value = t('action.' + type) |
| | | formType.value = type |
| | | resetForm() |
| | | if (id) { |
| | | formLoading.value = true |
| | | try { |
| | | formData.value = await AiQuestionTemplateApi.QuestionTemplateApi.getQuestionTemplate(id) |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | } |
| | | defineExpose({ open }) |
| | | |
| | | const emit = defineEmits(['success']) |
| | | const submitForm = async () => { |
| | | if (!formRef) return |
| | | const valid = await formRef.value.validate() |
| | | if (!valid) return |
| | | |
| | | formLoading.value = true |
| | | try { |
| | | const data = formData.value |
| | | if (formType.value === 'create') { |
| | | await AiQuestionTemplateApi.QuestionTemplateApi.createQuestionTemplate(data) |
| | | message.success(t('common.createSuccess')) |
| | | } else { |
| | | await AiQuestionTemplateApi.QuestionTemplateApi.updateQuestionTemplate(data) |
| | | message.success(t('common.updateSuccess')) |
| | | } |
| | | dialogVisible.value = false |
| | | emit('success') |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | |
| | | const resetForm = () => { |
| | | formData.value = { |
| | | id: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | dataLength: undefined, |
| | | questionContent: undefined, |
| | | settingList: [{ |
| | | settingKey: '', |
| | | settingName: '', |
| | | settingValue: '', |
| | | }] |
| | | } |
| | | formRef.value?.resetFields() |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 对话框(添加 / 修改) --> |
| | | <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag |
| | | append-to-body> |
| | | <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" |
| | | label-width="100px"> |
| | | <el-form-item label="问题模板id" prop="templateId"> |
| | | <el-input v-model="formData.templateId" placeholder="请输入问题模板id"/> |
| | | </el-form-item> |
| | | <el-form-item label="key" prop="settingKey"> |
| | | <el-input v-model="formData.settingKey" placeholder="请输入key"/> |
| | | </el-form-item> |
| | | <el-form-item label="参数名称" prop="settingName"> |
| | | <el-input v-model="formData.settingName" placeholder="请输入参数名称"/> |
| | | </el-form-item> |
| | | <el-form-item label="参数默认值" prop="settingValue"> |
| | | <el-input v-model="formData.settingValue" placeholder="请输入参数默认值"/> |
| | | </el-form-item> |
| | | <el-form-item label="排序" prop="sort"> |
| | | <el-input v-model="formData.sort" placeholder="请输入排序"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | <Dialog :title="dialogTitle" v-model="dialogVisible"> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="formData" |
| | | :rules="formRules" |
| | | label-width="100px" |
| | | v-loading="formLoading" |
| | | > |
| | | <el-form-item label="问题模板id" prop="templateId"> |
| | | <el-input v-model="formData.templateId" placeholder="请输入问题模板id" /> |
| | | </el-form-item> |
| | | <el-form-item label="key" prop="settingKey"> |
| | | <el-input v-model="formData.settingKey" placeholder="请输入key" /> |
| | | </el-form-item> |
| | | <el-form-item label="参数名称" prop="settingName"> |
| | | <el-input v-model="formData.settingName" placeholder="请输入参数名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="参数默认值" prop="settingValue"> |
| | | <el-input v-model="formData.settingValue" placeholder="请输入参数默认值" /> |
| | | </el-form-item> |
| | | <el-form-item label="排序" prop="sort"> |
| | | <el-input v-model="formData.sort" placeholder="请输入排序" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </template> |
| | | </Dialog> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import { QuestionParamSettingApi, QuestionParamSettingVO } from '@/api/ai/questionparamsetting' |
| | | |
| | | <script> |
| | | import * as QuestionParamSettingApi from '@/api/ai/questionparamsetting'; |
| | | /** 大模型问题设置参数 表单 */ |
| | | defineOptions({ name: 'QuestionParamSettingForm' }) |
| | | |
| | | export default { |
| | | name: "QuestionParamSettingForm", |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | // 弹出层标题 |
| | | dialogTitle: "", |
| | | // 是否显示弹出层 |
| | | dialogVisible: false, |
| | | // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
| | | formLoading: false, |
| | | // 表单参数 |
| | | formData: { |
| | | id: undefined, |
| | | templateId: undefined, |
| | | settingKey: undefined, |
| | | settingName: undefined, |
| | | settingValue: undefined, |
| | | sort: undefined, |
| | | }, |
| | | // 表单校验 |
| | | formRules: { |
| | | templateId: [{required: true, message: '问题模板id不能为空', trigger: 'blur'}], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | /** 打开弹窗 */ |
| | | async open(id) { |
| | | this.dialogVisible = true; |
| | | this.reset(); |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | this.formLoading = true; |
| | | try { |
| | | const res = await QuestionParamSettingApi.getQuestionParamSetting(id); |
| | | this.formData = res.data; |
| | | this.title = "修改大模型问题设置参数"; |
| | | } finally { |
| | | this.formLoading = false; |
| | | } |
| | | } |
| | | this.title = "新增大模型问题设置参数"; |
| | | }, |
| | | /** 提交按钮 */ |
| | | async submitForm() { |
| | | // 校验主表 |
| | | await this.$refs["formRef"].validate(); |
| | | this.formLoading = true; |
| | | try { |
| | | const data = this.formData; |
| | | // 修改的提交 |
| | | if (data.id) { |
| | | await QuestionParamSettingApi.updateQuestionParamSetting(data); |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.dialogVisible = false; |
| | | this.$emit('success'); |
| | | return; |
| | | } |
| | | // 添加的提交 |
| | | await QuestionParamSettingApi.createQuestionParamSetting(data); |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.dialogVisible = false; |
| | | this.$emit('success'); |
| | | } finally { |
| | | this.formLoading = false; |
| | | } |
| | | }, |
| | | /** 表单重置 */ |
| | | reset() { |
| | | this.formData = { |
| | | id: undefined, |
| | | templateId: undefined, |
| | | settingKey: undefined, |
| | | settingName: undefined, |
| | | settingValue: undefined, |
| | | sort: undefined, |
| | | }; |
| | | this.resetForm("formRef"); |
| | | const { t } = useI18n() // 国际化 |
| | | const message = useMessage() // 消息弹窗 |
| | | |
| | | const dialogVisible = ref(false) // 弹窗的是否展示 |
| | | const dialogTitle = ref('') // 弹窗的标题 |
| | | const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
| | | const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
| | | const formData = ref({ |
| | | id: undefined, |
| | | templateId: undefined, |
| | | settingKey: undefined, |
| | | settingName: undefined, |
| | | settingValue: undefined, |
| | | sort: undefined, |
| | | }) |
| | | const formRules = reactive({ |
| | | templateId: [{ required: true, message: '问题模板id不能为空', trigger: 'blur' }], |
| | | }) |
| | | const formRef = ref() // 表单 Ref |
| | | |
| | | /** 打开弹窗 */ |
| | | const open = async (type: string, id?: number) => { |
| | | dialogVisible.value = true |
| | | dialogTitle.value = t('action.' + type) |
| | | formType.value = type |
| | | resetForm() |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | formLoading.value = true |
| | | try { |
| | | formData.value = await QuestionParamSettingApi.getQuestionParamSetting(id) |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | } |
| | | defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
| | | |
| | | /** 提交表单 */ |
| | | const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
| | | const submitForm = async () => { |
| | | // 校验表单 |
| | | await formRef.value.validate() |
| | | // 提交请求 |
| | | formLoading.value = true |
| | | try { |
| | | const data = formData.value as unknown as QuestionParamSettingVO |
| | | if (formType.value === 'create') { |
| | | await QuestionParamSettingApi.createQuestionParamSetting(data) |
| | | message.success(t('common.createSuccess')) |
| | | } else { |
| | | await QuestionParamSettingApi.updateQuestionParamSetting(data) |
| | | message.success(t('common.updateSuccess')) |
| | | } |
| | | dialogVisible.value = false |
| | | // 发送操作成功的事件 |
| | | emit('success') |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | | const resetForm = () => { |
| | | formData.value = { |
| | | id: undefined, |
| | | templateId: undefined, |
| | | settingKey: undefined, |
| | | settingName: undefined, |
| | | settingValue: undefined, |
| | | sort: undefined, |
| | | } |
| | | formRef.value?.resetFields() |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <ContentWrap> |
| | | <!-- 搜索工作栏 --> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" |
| | | label-width="68px"> |
| | | <el-form |
| | | class="-mb-15px" |
| | | :model="queryParams" |
| | | ref="queryFormRef" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="问题模板id" prop="templateId"> |
| | | <el-input v-model="queryParams.templateId" placeholder="请输入问题模板id" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.templateId" |
| | | placeholder="请输入问题模板id" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="key" prop="settingKey"> |
| | | <el-input v-model="queryParams.settingKey" placeholder="请输入key" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.settingKey" |
| | | placeholder="请输入key" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="参数名称" prop="settingName"> |
| | | <el-input v-model="queryParams.settingName" placeholder="请输入参数名称" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.settingName" |
| | | placeholder="请输入参数名称" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="参数默认值" prop="settingValue"> |
| | | <el-input v-model="queryParams.settingValue" placeholder="请输入参数默认值" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.settingValue" |
| | | placeholder="请输入参数默认值" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="排序" prop="sort"> |
| | | <el-input v-model="queryParams.sort" placeholder="请输入排序" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.sort" |
| | | placeholder="请输入排序" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
| | | <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | @click="openForm('create')" |
| | | v-hasPermi="['ai:question-param-setting:create']" |
| | | > |
| | | <Icon icon="ep:plus" class="mr-5px" /> 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['ai:question-param-setting:export']" |
| | | > |
| | | <Icon icon="ep:download" class="mr-5px" /> 导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | |
| | | <!-- 操作工具栏 --> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)" |
| | | v-hasPermi="['ai:question-param-setting:create']">新增 |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <!-- 列表 --> |
| | | <ContentWrap> |
| | | <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
| | | <el-table-column label="id" align="center" prop="id"/> |
| | | <el-table-column label="问题模板id" align="center" prop="templateId"/> |
| | | <el-table-column label="key" align="center" prop="settingKey"/> |
| | | <el-table-column label="参数名称" align="center" prop="settingName"/> |
| | | <el-table-column label="参数默认值" align="center" prop="settingValue"/> |
| | | <el-table-column label="排序" align="center" prop="sort"/> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template v-slot="scope"> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)" |
| | | v-hasPermi="['ai:question-param-setting:update']">修改 |
| | | <el-table-column label="id" align="center" prop="id" /> |
| | | <el-table-column label="问题模板id" align="center" prop="templateId" /> |
| | | <el-table-column label="key" align="center" prop="settingKey" /> |
| | | <el-table-column label="参数名称" align="center" prop="settingName" /> |
| | | <el-table-column label="参数默认值" align="center" prop="settingValue" /> |
| | | <el-table-column label="排序" align="center" prop="sort" /> |
| | | <el-table-column label="操作" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['ai:question-param-setting:update']" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| | | v-hasPermi="['ai:question-param-setting:delete']">删除 |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['ai:question-param-setting:delete']" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 分页组件 --> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList"/> |
| | | <!-- 对话框(添加 / 修改) --> |
| | | <QuestionParamSettingForm ref="formRef" @success="getList"/> |
| | | </div> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | | :total="total" |
| | | v-model:page="queryParams.pageNo" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </ContentWrap> |
| | | |
| | | <!-- 表单弹窗:添加/修改 --> |
| | | <QuestionParamSettingForm ref="formRef" @success="getList" /> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as QuestionParamSettingApi from '@/api/ai/questionparamsetting'; |
| | | import QuestionParamSettingForm from './QuestionParamSettingForm.vue'; |
| | | <script setup lang="ts"> |
| | | import download from '@/utils/download' |
| | | import { QuestionParamSettingApi, QuestionParamSettingVO } from '@/api/ai/questionparamsetting' |
| | | import QuestionParamSettingForm from './QuestionParamSettingForm.vue' |
| | | |
| | | export default { |
| | | name: "QuestionParamSetting", |
| | | components: { |
| | | QuestionParamSettingForm, |
| | | }, |
| | | data() { |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 显示搜索条件 |
| | | showSearch: true, |
| | | // 总条数 |
| | | total: 0, |
| | | // 大模型问题设置参数列表 |
| | | list: [], |
| | | // 是否展开,默认全部展开 |
| | | isExpandAll: true, |
| | | // 重新渲染表格状态 |
| | | refreshTable: true, |
| | | // 选中行 |
| | | currentRow: {}, |
| | | // 查询参数 |
| | | queryParams: { |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | templateId: null, |
| | | settingKey: null, |
| | | settingName: null, |
| | | settingValue: null, |
| | | sort: null, |
| | | }, |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** 查询列表 */ |
| | | async getList() { |
| | | try { |
| | | this.loading = true; |
| | | const res = await QuestionParamSettingApi.getQuestionParamSettingPage(this.queryParams); |
| | | this.list = res.data.list; |
| | | this.total = res.data.total; |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNo = 1; |
| | | this.getList(); |
| | | }, |
| | | /** 重置按钮操作 */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | /** 添加/修改操作 */ |
| | | openForm(id) { |
| | | this.$refs["formRef"].open(id); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | async handleDelete(row) { |
| | | const id = row.id; |
| | | await this.$modal.confirm('是否确认删除大模型问题设置参数编号为"' + id + '"的数据项?') |
| | | try { |
| | | await QuestionParamSettingApi.deleteQuestionParamSetting(id); |
| | | await this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | } catch { |
| | | } |
| | | }, |
| | | /** 大模型问题设置参数 列表 */ |
| | | defineOptions({ name: 'QuestionParamSetting' }) |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const { t } = useI18n() // 国际化 |
| | | |
| | | const loading = ref(true) // 列表的加载中 |
| | | const list = ref<QuestionParamSettingVO[]>([]) // 列表的数据 |
| | | const total = ref(0) // 列表的总页数 |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | templateId: undefined, |
| | | settingKey: undefined, |
| | | settingName: undefined, |
| | | settingValue: undefined, |
| | | sort: undefined, |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | const exportLoading = ref(false) // 导出的加载中 |
| | | |
| | | /** 查询列表 */ |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const data = await QuestionParamSettingApi.getQuestionParamSettingPage(queryParams) |
| | | list.value = data.list |
| | | total.value = data.total |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | }; |
| | | </script> |
| | | } |
| | | |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | queryParams.pageNo = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields() |
| | | handleQuery() |
| | | } |
| | | |
| | | /** 添加/修改操作 */ |
| | | const formRef = ref() |
| | | const openForm = (type: string, id?: number) => { |
| | | formRef.value.open(type, id) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | | const handleDelete = async (id: number) => { |
| | | try { |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await QuestionParamSettingApi.deleteQuestionParamSetting(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | | } catch {} |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await QuestionParamSettingApi.exportQuestionParamSetting(queryParams) |
| | | download.excel(data, '大模型问题设置参数.xls') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 初始化 **/ |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- 对话框(添加 / 修改) --> |
| | | <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag |
| | | append-to-body> |
| | | <el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" |
| | | label-width="100px"> |
| | | <el-form-item label="模型id" prop="modelId"> |
| | | <el-input v-model="formData.modelId" placeholder="请输入模型id"/> |
| | | </el-form-item> |
| | | <el-form-item label="问题编号" prop="questionCode"> |
| | | <el-input v-model="formData.questionCode" placeholder="请输入问题编号"/> |
| | | </el-form-item> |
| | | <el-form-item label="问题名称" prop="questionName"> |
| | | <el-input v-model="formData.questionName" placeholder="请输入问题名称"/> |
| | | </el-form-item> |
| | | <el-form-item label="问题内容"> |
| | | <Editor v-model="formData.questionContent" :min-height="192"/> |
| | | </el-form-item> |
| | | <el-form-item label="输入个数" prop="dataLength"> |
| | | <el-input v-model="formData.dataLength" placeholder="请输入输入个数"/> |
| | | </el-form-item> |
| | | <el-form-item label="是否启用(0禁用 1启用)" prop="isEnable"> |
| | | <el-input v-model="formData.isEnable" placeholder="请输入是否启用(0禁用 1启用)"/> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="formData.remark" placeholder="请输入备注"/> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间" prop="createDate"> |
| | | <el-date-picker clearable v-model="formData.createDate" type="date" |
| | | value-format="timestamp" placeholder="选择创建时间"/> |
| | | </el-form-item> |
| | | <el-form-item label="更新者" prop="updator"> |
| | | <el-input v-model="formData.updator" placeholder="请输入更新者"/> |
| | | </el-form-item> |
| | | <el-form-item label="更新时间" prop="updateDate"> |
| | | <el-date-picker clearable v-model="formData.updateDate" type="date" |
| | | value-format="timestamp" placeholder="选择更新时间"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | <Dialog :title="dialogTitle" v-model="dialogVisible"> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="formData" |
| | | :rules="formRules" |
| | | label-width="100px" |
| | | v-loading="formLoading" |
| | | > |
| | | <el-form-item label="模型id" prop="modelId"> |
| | | <el-input v-model="formData.modelId" placeholder="请输入模型id" /> |
| | | </el-form-item> |
| | | <el-form-item label="问题编号" prop="questionCode"> |
| | | <el-input v-model="formData.questionCode" placeholder="请输入问题编号" /> |
| | | </el-form-item> |
| | | <el-form-item label="问题名称" prop="questionName"> |
| | | <el-input v-model="formData.questionName" placeholder="请输入问题名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="问题内容" prop="questionContent"> |
| | | <Editor v-model="formData.questionContent" height="150px" /> |
| | | </el-form-item> |
| | | <el-form-item label="输入个数" prop="dataLength"> |
| | | <el-input v-model="formData.dataLength" placeholder="请输入输入个数" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否启用(0禁用 1启用)" prop="isEnable"> |
| | | <el-input v-model="formData.isEnable" placeholder="请输入是否启用(0禁用 1启用)" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="formData.remark" placeholder="请输入备注" /> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间" prop="createDate"> |
| | | <el-date-picker |
| | | v-model="formData.createDate" |
| | | type="date" |
| | | value-format="x" |
| | | placeholder="选择创建时间" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="更新者" prop="updator"> |
| | | <el-input v-model="formData.updator" placeholder="请输入更新者" /> |
| | | </el-form-item> |
| | | <el-form-item label="更新时间" prop="updateDate"> |
| | | <el-date-picker |
| | | v-model="formData.updateDate" |
| | | type="date" |
| | | value-format="x" |
| | | placeholder="选择更新时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </template> |
| | | </Dialog> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import { QuestionTemplateApi, QuestionTemplateVO } from '@/api/ai/questiontemplate' |
| | | |
| | | <script> |
| | | import * as QuestionTemplateApi from '@/api/ai/questiontemplate'; |
| | | import Editor from '@/components/Editor'; |
| | | /** 大模型问题模板 表单 */ |
| | | defineOptions({ name: 'QuestionTemplateForm' }) |
| | | |
| | | export default { |
| | | name: "QuestionTemplateForm", |
| | | components: { |
| | | Editor, |
| | | }, |
| | | data() { |
| | | return { |
| | | // 弹出层标题 |
| | | dialogTitle: "", |
| | | // 是否显示弹出层 |
| | | dialogVisible: false, |
| | | // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
| | | formLoading: false, |
| | | // 表单参数 |
| | | formData: { |
| | | id: undefined, |
| | | modelId: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | questionContent: undefined, |
| | | dataLength: undefined, |
| | | isEnable: undefined, |
| | | remark: undefined, |
| | | createDate: undefined, |
| | | updator: undefined, |
| | | updateDate: undefined, |
| | | }, |
| | | // 表单校验 |
| | | formRules: { |
| | | modelId: [{required: true, message: '模型id不能为空', trigger: 'blur'}], |
| | | questionCode: [{required: true, message: '问题编号不能为空', trigger: 'blur'}], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | /** 打开弹窗 */ |
| | | async open(id) { |
| | | this.dialogVisible = true; |
| | | this.reset(); |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | this.formLoading = true; |
| | | try { |
| | | const res = await QuestionTemplateApi.getQuestionTemplate(id); |
| | | this.formData = res.data; |
| | | this.title = "修改大模型问题模板"; |
| | | } finally { |
| | | this.formLoading = false; |
| | | } |
| | | } |
| | | this.title = "新增大模型问题模板"; |
| | | }, |
| | | /** 提交按钮 */ |
| | | async submitForm() { |
| | | // 校验主表 |
| | | await this.$refs["formRef"].validate(); |
| | | this.formLoading = true; |
| | | try { |
| | | const data = this.formData; |
| | | // 修改的提交 |
| | | if (data.id) { |
| | | await QuestionTemplateApi.updateQuestionTemplate(data); |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.dialogVisible = false; |
| | | this.$emit('success'); |
| | | return; |
| | | } |
| | | // 添加的提交 |
| | | await QuestionTemplateApi.createQuestionTemplate(data); |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.dialogVisible = false; |
| | | this.$emit('success'); |
| | | } finally { |
| | | this.formLoading = false; |
| | | } |
| | | }, |
| | | /** 表单重置 */ |
| | | reset() { |
| | | this.formData = { |
| | | id: undefined, |
| | | modelId: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | questionContent: undefined, |
| | | dataLength: undefined, |
| | | isEnable: undefined, |
| | | remark: undefined, |
| | | createDate: undefined, |
| | | updator: undefined, |
| | | updateDate: undefined, |
| | | }; |
| | | this.resetForm("formRef"); |
| | | const { t } = useI18n() // 国际化 |
| | | const message = useMessage() // 消息弹窗 |
| | | |
| | | const dialogVisible = ref(false) // 弹窗的是否展示 |
| | | const dialogTitle = ref('') // 弹窗的标题 |
| | | const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
| | | const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
| | | const formData = ref({ |
| | | id: undefined, |
| | | modelId: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | questionContent: undefined, |
| | | dataLength: undefined, |
| | | isEnable: undefined, |
| | | remark: undefined, |
| | | createDate: undefined, |
| | | updator: undefined, |
| | | updateDate: undefined, |
| | | }) |
| | | const formRules = reactive({ |
| | | modelId: [{ required: true, message: '模型id不能为空', trigger: 'blur' }], |
| | | questionCode: [{ required: true, message: '问题编号不能为空', trigger: 'blur' }], |
| | | }) |
| | | const formRef = ref() // 表单 Ref |
| | | |
| | | /** 打开弹窗 */ |
| | | const open = async (type: string, id?: number) => { |
| | | dialogVisible.value = true |
| | | dialogTitle.value = t('action.' + type) |
| | | formType.value = type |
| | | resetForm() |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | formLoading.value = true |
| | | try { |
| | | formData.value = await QuestionTemplateApi.getQuestionTemplate(id) |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | } |
| | | defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
| | | |
| | | /** 提交表单 */ |
| | | const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
| | | const submitForm = async () => { |
| | | // 校验表单 |
| | | await formRef.value.validate() |
| | | // 提交请求 |
| | | formLoading.value = true |
| | | try { |
| | | const data = formData.value as unknown as QuestionTemplateVO |
| | | if (formType.value === 'create') { |
| | | await QuestionTemplateApi.createQuestionTemplate(data) |
| | | message.success(t('common.createSuccess')) |
| | | } else { |
| | | await QuestionTemplateApi.updateQuestionTemplate(data) |
| | | message.success(t('common.updateSuccess')) |
| | | } |
| | | dialogVisible.value = false |
| | | // 发送操作成功的事件 |
| | | emit('success') |
| | | } finally { |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | | const resetForm = () => { |
| | | formData.value = { |
| | | id: undefined, |
| | | modelId: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | questionContent: undefined, |
| | | dataLength: undefined, |
| | | isEnable: undefined, |
| | | remark: undefined, |
| | | createDate: undefined, |
| | | updator: undefined, |
| | | updateDate: undefined, |
| | | } |
| | | formRef.value?.resetFields() |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <ContentWrap> |
| | | <!-- 搜索工作栏 --> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" |
| | | label-width="68px"> |
| | | <el-form |
| | | class="-mb-15px" |
| | | :model="queryParams" |
| | | ref="queryFormRef" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="模型id" prop="modelId"> |
| | | <el-input v-model="queryParams.modelId" placeholder="请输入模型id" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.modelId" |
| | | placeholder="请输入模型id" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="问题编号" prop="questionCode"> |
| | | <el-input v-model="queryParams.questionCode" placeholder="请输入问题编号" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.questionCode" |
| | | placeholder="请输入问题编号" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="问题名称" prop="questionName"> |
| | | <el-input v-model="queryParams.questionName" placeholder="请输入问题名称" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.questionName" |
| | | placeholder="请输入问题名称" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="输入个数" prop="dataLength"> |
| | | <el-input v-model="queryParams.dataLength" placeholder="请输入输入个数" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.dataLength" |
| | | placeholder="请输入输入个数" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="是否启用(0禁用 1启用)" prop="isEnable"> |
| | | <el-input v-model="queryParams.isEnable" placeholder="请输入是否启用(0禁用 1启用)" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.isEnable" |
| | | placeholder="请输入是否启用(0禁用 1启用)" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.remark" |
| | | placeholder="请输入备注" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间" prop="createDate"> |
| | | <el-date-picker v-model="queryParams.createDate" style="width: 240px" |
| | | value-format="yyyy-MM-dd HH:mm:ss" type="daterange" |
| | | range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" |
| | | :default-time="['00:00:00', '23:59:59']"/> |
| | | <el-date-picker |
| | | v-model="queryParams.createDate" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="daterange" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="更新者" prop="updator"> |
| | | <el-input v-model="queryParams.updator" placeholder="请输入更新者" clearable |
| | | @keyup.enter.native="handleQuery"/> |
| | | <el-input |
| | | v-model="queryParams.updator" |
| | | placeholder="请输入更新者" |
| | | clearable |
| | | @keyup.enter="handleQuery" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="更新时间" prop="updateDate"> |
| | | <el-date-picker v-model="queryParams.updateDate" style="width: 240px" |
| | | value-format="yyyy-MM-dd HH:mm:ss" type="daterange" |
| | | range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" |
| | | :default-time="['00:00:00', '23:59:59']"/> |
| | | <el-date-picker |
| | | v-model="queryParams.updateDate" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="daterange" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
| | | <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | @click="openForm('create')" |
| | | v-hasPermi="['ai:question-template:create']" |
| | | > |
| | | <Icon icon="ep:plus" class="mr-5px" /> 新增 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | @click="handleExport" |
| | | :loading="exportLoading" |
| | | v-hasPermi="['ai:question-template:export']" |
| | | > |
| | | <Icon icon="ep:download" class="mr-5px" /> 导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | |
| | | <!-- 操作工具栏 --> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)" |
| | | v-hasPermi="['ai:question-template:create']">新增 |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <!-- 列表 --> |
| | | <ContentWrap> |
| | | <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
| | | <el-table-column label="id" align="center" prop="id"/> |
| | | <el-table-column label="模型id" align="center" prop="modelId"/> |
| | | <el-table-column label="问题编号" align="center" prop="questionCode"/> |
| | | <el-table-column label="问题名称" align="center" prop="questionName"/> |
| | | <el-table-column label="问题内容" align="center" prop="questionContent"/> |
| | | <el-table-column label="输入个数" align="center" prop="dataLength"/> |
| | | <el-table-column label="是否启用(0禁用 1启用)" align="center" prop="isEnable"/> |
| | | <el-table-column label="备注" align="center" prop="remark"/> |
| | | <el-table-column label="创建时间" align="center" prop="createDate" width="180"> |
| | | <template v-slot="scope"> |
| | | <span>{{ parseTime(scope.row.createDate) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="更新者" align="center" prop="updator"/> |
| | | <el-table-column label="更新时间" align="center" prop="updateDate" width="180"> |
| | | <template v-slot="scope"> |
| | | <span>{{ parseTime(scope.row.updateDate) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template v-slot="scope"> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)" |
| | | v-hasPermi="['ai:question-template:update']">修改 |
| | | <el-table-column label="id" align="center" prop="id" /> |
| | | <el-table-column label="模型id" align="center" prop="modelId" /> |
| | | <el-table-column label="问题编号" align="center" prop="questionCode" /> |
| | | <el-table-column label="问题名称" align="center" prop="questionName" /> |
| | | <el-table-column label="问题内容" align="center" prop="questionContent" /> |
| | | <el-table-column label="输入个数" align="center" prop="dataLength" /> |
| | | <el-table-column label="是否启用(0禁用 1启用)" align="center" prop="isEnable" /> |
| | | <el-table-column label="备注" align="center" prop="remark" /> |
| | | <el-table-column |
| | | label="创建时间" |
| | | align="center" |
| | | prop="createDate" |
| | | :formatter="dateFormatter" |
| | | width="180px" |
| | | /> |
| | | <el-table-column label="更新者" align="center" prop="updator" /> |
| | | <el-table-column |
| | | label="更新时间" |
| | | align="center" |
| | | prop="updateDate" |
| | | :formatter="dateFormatter" |
| | | width="180px" |
| | | /> |
| | | <el-table-column label="操作" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['ai:question-template:update']" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| | | v-hasPermi="['ai:question-template:delete']">删除 |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['ai:question-template:delete']" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 分页组件 --> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList"/> |
| | | <!-- 对话框(添加 / 修改) --> |
| | | <QuestionTemplateForm ref="formRef" @success="getList"/> |
| | | </div> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | | :total="total" |
| | | v-model:page="queryParams.pageNo" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </ContentWrap> |
| | | |
| | | <!-- 表单弹窗:添加/修改 --> |
| | | <QuestionTemplateForm ref="formRef" @success="getList" /> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as QuestionTemplateApi from '@/api/ai/questiontemplate'; |
| | | import QuestionTemplateForm from './QuestionTemplateForm.vue'; |
| | | <script setup lang="ts"> |
| | | import { dateFormatter } from '@/utils/formatTime' |
| | | import download from '@/utils/download' |
| | | import { QuestionTemplateApi, QuestionTemplateVO } from '@/api/ai/questiontemplate' |
| | | import QuestionTemplateForm from './QuestionTemplateForm.vue' |
| | | |
| | | export default { |
| | | name: "QuestionTemplate", |
| | | components: { |
| | | QuestionTemplateForm, |
| | | }, |
| | | data() { |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 显示搜索条件 |
| | | showSearch: true, |
| | | // 总条数 |
| | | total: 0, |
| | | // 大模型问题模板列表 |
| | | list: [], |
| | | // 是否展开,默认全部展开 |
| | | isExpandAll: true, |
| | | // 重新渲染表格状态 |
| | | refreshTable: true, |
| | | // 选中行 |
| | | currentRow: {}, |
| | | // 查询参数 |
| | | queryParams: { |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | modelId: null, |
| | | questionCode: null, |
| | | questionName: null, |
| | | questionContent: null, |
| | | dataLength: null, |
| | | isEnable: null, |
| | | remark: null, |
| | | createDate: [], |
| | | updator: null, |
| | | updateDate: [], |
| | | }, |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** 查询列表 */ |
| | | async getList() { |
| | | try { |
| | | this.loading = true; |
| | | const res = await QuestionTemplateApi.getQuestionTemplatePage(this.queryParams); |
| | | this.list = res.data.list; |
| | | this.total = res.data.total; |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNo = 1; |
| | | this.getList(); |
| | | }, |
| | | /** 重置按钮操作 */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | /** 添加/修改操作 */ |
| | | openForm(id) { |
| | | this.$refs["formRef"].open(id); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | async handleDelete(row) { |
| | | const id = row.id; |
| | | await this.$modal.confirm('是否确认删除大模型问题模板编号为"' + id + '"的数据项?') |
| | | try { |
| | | await QuestionTemplateApi.deleteQuestionTemplate(id); |
| | | await this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | } catch { |
| | | } |
| | | }, |
| | | /** 大模型问题模板 列表 */ |
| | | defineOptions({ name: 'QuestionTemplate' }) |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const { t } = useI18n() // 国际化 |
| | | |
| | | const loading = ref(true) // 列表的加载中 |
| | | const list = ref<QuestionTemplateVO[]>([]) // 列表的数据 |
| | | const total = ref(0) // 列表的总页数 |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | modelId: undefined, |
| | | questionCode: undefined, |
| | | questionName: undefined, |
| | | questionContent: undefined, |
| | | dataLength: undefined, |
| | | isEnable: undefined, |
| | | remark: undefined, |
| | | createDate: [], |
| | | updator: undefined, |
| | | updateDate: [], |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | const exportLoading = ref(false) // 导出的加载中 |
| | | |
| | | /** 查询列表 */ |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const data = await QuestionTemplateApi.getQuestionTemplatePage(queryParams) |
| | | list.value = data.list |
| | | total.value = data.total |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | }; |
| | | </script> |
| | | } |
| | | |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | queryParams.pageNo = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields() |
| | | handleQuery() |
| | | } |
| | | |
| | | /** 添加/修改操作 */ |
| | | const formRef = ref() |
| | | const openForm = (type: string, id?: number) => { |
| | | formRef.value.open(type, id) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | | const handleDelete = async (id: number) => { |
| | | try { |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await QuestionTemplateApi.deleteQuestionTemplate(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | | } catch {} |
| | | } |
| | | |
| | | /** 导出按钮操作 */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导出的二次确认 |
| | | await message.exportConfirm() |
| | | // 发起导出 |
| | | exportLoading.value = true |
| | | const data = await QuestionTemplateApi.exportQuestionTemplate(queryParams) |
| | | download.excel(data, '大模型问题模板.xls') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 初始化 **/ |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | </script> |
| | |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="20"> |
| | | <el-form-item label="模型id" prop="modelId"> |
| | | <el-input v-model="formData.modelId" placeholder=""/> |
| | | <el-form-item label="调度模型" prop="modelId"> |
| | | <el-select v-model="formData.modelId" |
| | | clearable |
| | | filterable |
| | | :fit-input-width="false" placeholder="请选择调度模型"> |
| | | <el-option |
| | | v-for="item in scheduleModelList" |
| | | :key="item.id" |
| | | :label="item.modelName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import * as SnapshotConfigApi from '@/api/model/sche/suggest/snapshotConfig' |
| | | import * as ScheduleModelApi from "@/api/model/sche/model"; |
| | | const scheduleModelList = ref([] as ScheduleModelApi.ScheduleModelVO[]) |
| | | |
| | | defineOptions({ name: 'SnapshotConfigForm' }) |
| | | |
| | |
| | | scheduleObj: undefined, |
| | | }) |
| | | const formRules = reactive({ |
| | | chartName: [{ required: true, message: '不能为空', trigger: 'blur' }], |
| | | chartCode: [{ required: true, message: '不能为空', trigger: 'blur' }], |
| | | title: [{ required: true, message: '不能为空', trigger: 'blur' }], |
| | | modelId: [{ required: true, message: '不能为空', trigger: 'blur' }], |
| | | scheduleObj: [{ required: true, message: '不能为空', trigger: 'blur' }], |
| | | }) |
| | | const formRef = ref() // 表单 Ref |
| | | |
| | |
| | | dialogTitle.value = t('action.' + type) |
| | | formType.value = type |
| | | resetForm() |
| | | // 加载调度模型列表 |
| | | scheduleModelList.value = await ScheduleModelApi.getScheduleModelList() |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | formLoading.value = true |
| | |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="标题" prop="snapshotConfigName"> |
| | | <el-form-item label="标题" prop="title"> |
| | | <el-input |
| | | v-model="queryParams.snapshotConfigName" |
| | | placeholder="请输入图表名称" |
| | | clearable |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="模型ID" prop="snapshotConfigCode"> |
| | | <el-input |
| | | v-model="queryParams.snapshotConfigCode" |
| | | placeholder="请输入模型ID" |
| | | v-model="queryParams.title" |
| | | placeholder="请输入标题" |
| | | clearable |
| | | class="!w-240px" |
| | | /> |
| | |
| | | row-key="id" |
| | | > |
| | | <el-table-column prop="title" label="标题"/> |
| | | <el-table-column prop="modelId" label="模型ID"/> |
| | | <el-table-column prop="modelName" label="模型名称"/> |
| | | <el-table-column prop="scheduleObj" label="调整对象"/> |
| | | <el-table-column label="操作" align="center" width="200px"> |
| | | <template #default="scope"> |
| | |
| | | const queryParams = reactive({ |
| | | page: 1, |
| | | limit: 10, |
| | | modelId: '', |
| | | snapshotConfigCode: '' |
| | | title: '', |
| | | modelId: '' |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | |