Compare commits
2 Commits
109b526cab
...
ab87fa37ce
Author | SHA1 | Date |
---|---|---|
|
ab87fa37ce | 6 months ago |
|
d09210a735 | 6 months ago |
@ -0,0 +1,247 @@
|
|||||||
|
<!--
|
||||||
|
* @description: 提示词模板
|
||||||
|
* @fileName: index
|
||||||
|
* @author: 17076
|
||||||
|
* @date: 2024/11/11-上午9:56
|
||||||
|
* @version: V1.0.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:size="650"
|
||||||
|
append-to-body
|
||||||
|
v-model="drawerOption.show"
|
||||||
|
:show-close="false"
|
||||||
|
:with-header="false"
|
||||||
|
:before-close="closeDialog"
|
||||||
|
custom-class="AddEdit"
|
||||||
|
>
|
||||||
|
<div class="AddEdit">
|
||||||
|
<div class="header-title">
|
||||||
|
<div class="tip" />
|
||||||
|
<span>设置提示词模板</span>
|
||||||
|
</div>
|
||||||
|
<div class="line" />
|
||||||
|
<el-form ref="formRef" :model="forms" label-width="80px">
|
||||||
|
<!-- <el-form-item label="提示词模板" prop="medicalRecordAi">-->
|
||||||
|
<!-- <el-input-->
|
||||||
|
<!-- v-model="forms.medicalRecordAi"-->
|
||||||
|
<!-- type="textarea"-->
|
||||||
|
<!-- :autosize="{ minRows: 5 }"-->
|
||||||
|
<!-- placeholder="请输入提示词模板"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<el-form-item label="通用模板" prop="general">
|
||||||
|
<el-select
|
||||||
|
v-model="forms.general"
|
||||||
|
placeholder="请选择通用模板"
|
||||||
|
@change="selectChange"
|
||||||
|
style="width: 100%"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in templateOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.attributeName"
|
||||||
|
:value="item.attributeParam"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-input
|
||||||
|
v-if="forms.commonModelParam"
|
||||||
|
v-model="forms.commonModelParam"
|
||||||
|
type="textarea"
|
||||||
|
disabled
|
||||||
|
:autosize="{ minRows: 5 }"
|
||||||
|
style="margin-bottom: 10px"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in forms.medicalRecCreateListAiManageVOS"
|
||||||
|
:key="index"
|
||||||
|
class="property-item"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
:label="'属性' + (index + 1)"
|
||||||
|
:prop="
|
||||||
|
'medicalRecCreateListAiManageVOS.' + index + '.attributeName'
|
||||||
|
"
|
||||||
|
style="margin-top: 20px"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="item.attributeName"
|
||||||
|
placeholder="请选择属性模板"
|
||||||
|
@change="selectChangeProperty(item, $event)"
|
||||||
|
style="flex: 1"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in templatePropertyOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.attributeName"
|
||||||
|
:value="item.attributeName"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@click="addItem()"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
type="danger"
|
||||||
|
:disabled="index === 0"
|
||||||
|
@click="removeItem(index)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
<el-input
|
||||||
|
v-if="item.attributeParam"
|
||||||
|
v-model="item.attributeParam"
|
||||||
|
type="textarea"
|
||||||
|
disabled
|
||||||
|
:autosize="{ minRows: 5 }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!-- <pure-table-->
|
||||||
|
<!-- align-whole="center"-->
|
||||||
|
<!-- showOverflowTooltip-->
|
||||||
|
<!-- table-layout="auto"-->
|
||||||
|
<!-- adaptive-->
|
||||||
|
<!-- :data="dataList"-->
|
||||||
|
<!-- :columns="columns"-->
|
||||||
|
<!-- :header-cell-style="{-->
|
||||||
|
<!-- background: 'var(--el-table-row-hover-bg-color)',-->
|
||||||
|
<!-- color: 'var(--el-text-color-primary)'-->
|
||||||
|
<!-- }"-->
|
||||||
|
<!-- />-->
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button plain size="large" @click="reset" style="width: 120px"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="save(formRef)"
|
||||||
|
style="width: 120px"
|
||||||
|
>生成</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { FormInstance, ElMessage } from "element-plus";
|
||||||
|
import { uploadMedicalAiById } from "@/api/medicalRecord";
|
||||||
|
import { queryMedicalPromptStats } from "@/api/generalRules";
|
||||||
|
// import PureTable from "@pureadmin/table";
|
||||||
|
// 抽屉配置
|
||||||
|
const drawerOption = ref({
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
const forms = ref({
|
||||||
|
general: undefined,
|
||||||
|
commonModelParam: undefined,
|
||||||
|
medicalRecCreateListAiManageVOS: [
|
||||||
|
{ attributeParam: undefined, attributeName: undefined }
|
||||||
|
],
|
||||||
|
medicalRecId: undefined
|
||||||
|
});
|
||||||
|
// const dataList = ref([]);
|
||||||
|
// const columns = [
|
||||||
|
// {
|
||||||
|
// label: "属性名称",
|
||||||
|
// prop: "propertyName",
|
||||||
|
// minWidth: 100
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "提示词模板",
|
||||||
|
// prop: "propertyTemplate",
|
||||||
|
// minWidth: 100
|
||||||
|
// }
|
||||||
|
// ];
|
||||||
|
const templateOptions = ref([]);
|
||||||
|
const templatePropertyOptions = ref([]);
|
||||||
|
const emit = defineEmits(["update"]);
|
||||||
|
// 获取模板列表
|
||||||
|
async function queryTemplateList() {
|
||||||
|
const res = await queryMedicalPromptStats();
|
||||||
|
templateOptions.value = res.data.medicalRecAisCommon;
|
||||||
|
templatePropertyOptions.value = res.data.medicalRecAisPara;
|
||||||
|
}
|
||||||
|
// 通用模板选择
|
||||||
|
function selectChange(val) {
|
||||||
|
forms.value.commonModelParam = val;
|
||||||
|
}
|
||||||
|
// 属性模板选择
|
||||||
|
function selectChangeProperty(item, val) {
|
||||||
|
const currentName = templatePropertyOptions.value.find(
|
||||||
|
property => property.attributeName === val
|
||||||
|
).attributeParam;
|
||||||
|
item.attributeParam = currentName;
|
||||||
|
}
|
||||||
|
// 新增
|
||||||
|
function addItem() {
|
||||||
|
forms.value.medicalRecCreateListAiManageVOS.push({
|
||||||
|
attributeParam: undefined,
|
||||||
|
attributeName: undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
function removeItem(index) {
|
||||||
|
forms.value.medicalRecCreateListAiManageVOS.splice(index, 1);
|
||||||
|
}
|
||||||
|
// 关闭抽屉
|
||||||
|
function closeDialog() {
|
||||||
|
drawerOption.value.show = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
// 重置
|
||||||
|
function reset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
// 确定
|
||||||
|
function save(formEl: FormInstance | undefined) {
|
||||||
|
formEl.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
const res: any = await uploadMedicalAiById({ ...forms.value, medicalRecId: forms.value.medicalId });
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success(res.msg || "设置成功!");
|
||||||
|
drawerOption.value.show = false;
|
||||||
|
emit.apply("update", [true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
show(data: any) {
|
||||||
|
forms.value = Object.assign(
|
||||||
|
{
|
||||||
|
medicalRecCreateListAiManageVOS: [
|
||||||
|
{ attributeParam: undefined, attributeName: undefined }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
data
|
||||||
|
);
|
||||||
|
drawerOption.value.show = true;
|
||||||
|
queryTemplateList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.property-item {
|
||||||
|
border: 1px solid #cdd0d6;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,159 @@
|
|||||||
|
<!--
|
||||||
|
* @description: 生成数字人
|
||||||
|
* @fileName: CreateDigitalHuman
|
||||||
|
* @author: 17076
|
||||||
|
* @date: 2024/11/6-上午9:59
|
||||||
|
* @version: V1.0.0
|
||||||
|
-->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { FormInstance, ElMessage } from "element-plus";
|
||||||
|
import { Plus } from "@element-plus/icons-vue";
|
||||||
|
import { createHuman } from "@/api/medicalRecord";
|
||||||
|
// 抽屉配置
|
||||||
|
const drawerOption = ref({
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
const upload = ref();
|
||||||
|
const forms = ref({
|
||||||
|
image: undefined,
|
||||||
|
file: undefined,
|
||||||
|
medicalId: undefined
|
||||||
|
});
|
||||||
|
const rules = ref({
|
||||||
|
file: [{ required: true, message: "请上传文件", trigger: "blur" }]
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["update"]);
|
||||||
|
// 关闭抽屉
|
||||||
|
function closeDialog() {
|
||||||
|
drawerOption.value.show = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
// 重置
|
||||||
|
function reset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
// 确定
|
||||||
|
function save(formEl: FormInstance | undefined) {
|
||||||
|
formEl.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", forms.value.file);
|
||||||
|
formData.append("medicalId", forms.value.medicalId);
|
||||||
|
const res: any = await createHuman(formData);
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success(res.msg || "上传成功,数字人生成中");
|
||||||
|
drawerOption.value.show = false;
|
||||||
|
emit.apply("update", [true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 选择图片
|
||||||
|
const handleOnChange = () => {
|
||||||
|
upload.value.value = null;
|
||||||
|
upload.value.click();
|
||||||
|
};
|
||||||
|
// 文件选中
|
||||||
|
const handleFileChange = e => {
|
||||||
|
const files = e.target.files;
|
||||||
|
forms.value.file = files[0];
|
||||||
|
const render = new FileReader();
|
||||||
|
render.readAsDataURL(files[0]);
|
||||||
|
render.onload = result => {
|
||||||
|
forms.value.image = result.target.result;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
defineExpose({
|
||||||
|
show(data: any) {
|
||||||
|
forms.value = Object.assign({}, data);
|
||||||
|
drawerOption.value.show = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:size="650"
|
||||||
|
append-to-body
|
||||||
|
v-model="drawerOption.show"
|
||||||
|
:show-close="false"
|
||||||
|
:with-header="false"
|
||||||
|
:before-close="closeDialog"
|
||||||
|
custom-class="AddEdit"
|
||||||
|
>
|
||||||
|
<div class="AddEdit">
|
||||||
|
<div class="header-title">
|
||||||
|
<div class="tip" />
|
||||||
|
<span>生成数字人</span>
|
||||||
|
</div>
|
||||||
|
<div class="line" />
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="forms"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="top"
|
||||||
|
>
|
||||||
|
<el-form-item label="上传素材" prop="file">
|
||||||
|
<div class="avatar-uploader" @click="handleOnChange">
|
||||||
|
<img v-if="forms.image" :src="forms.image" class="avatar" />
|
||||||
|
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||||
|
<input
|
||||||
|
ref="upload"
|
||||||
|
hidden
|
||||||
|
type="file"
|
||||||
|
accept=".png,.jpg,.jpeg"
|
||||||
|
@change="handleFileChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button plain size="large" @click="reset" style="width: 120px"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="large"
|
||||||
|
@click="save(formRef)"
|
||||||
|
style="width: 120px"
|
||||||
|
>确定</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.AddEdit {
|
||||||
|
.avatar-uploader {
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
display: block;
|
||||||
|
border: 1px dashed var(--el-border-color);
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: var(--el-transition-duration-fast);
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
.avatar {
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.el-icon.avatar-uploader-icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #8c939d;
|
||||||
|
width: 178px;
|
||||||
|
height: 178px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.el-drawer__body {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,143 @@
|
|||||||
|
<!--
|
||||||
|
* @description: 编辑提示词
|
||||||
|
* @fileName: EditPrompt
|
||||||
|
* @author: 17076
|
||||||
|
* @date: 2024/11/14-上午9:40
|
||||||
|
* @version: V1.0.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:size="800"
|
||||||
|
append-to-body
|
||||||
|
v-model="dialogVisible"
|
||||||
|
:show-close="false"
|
||||||
|
:with-header="false"
|
||||||
|
:before-close="closeDialog"
|
||||||
|
custom-class="AddEdit"
|
||||||
|
>
|
||||||
|
<div class="AddEdit">
|
||||||
|
<div class="header-title">
|
||||||
|
<div class="tip" />
|
||||||
|
<span>编辑提示词</span>
|
||||||
|
</div>
|
||||||
|
<div class="line" />
|
||||||
|
<el-form
|
||||||
|
ref="refForm"
|
||||||
|
:model="formData"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="模板类型" prop="commonType">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.commonType"
|
||||||
|
placeholder="请选择模板类型"
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="isEditFlag"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="提示词名称" prop="attributeName">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.attributeName"
|
||||||
|
placeholder="请输入提示词名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="提示词" prop="attributeParam">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.attributeParam"
|
||||||
|
type="textarea"
|
||||||
|
:rows="5"
|
||||||
|
placeholder="请输入提示词"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="footer_btn">
|
||||||
|
<div class="reset" @click="resetForm">重置</div>
|
||||||
|
<div class="main" @click="submit(refForm)">确定</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { FormInstance } from "element-plus";
|
||||||
|
import {
|
||||||
|
createMedicalRecAiManage,
|
||||||
|
modifyMedicalRecAiManage
|
||||||
|
} from "@/api/generalRules";
|
||||||
|
import { message } from "@/utils/message";
|
||||||
|
const isEditFlag = ref(false);
|
||||||
|
const dialogVisible = ref(false);
|
||||||
|
const formData = ref({
|
||||||
|
commonType: "",
|
||||||
|
attributeName: "",
|
||||||
|
attributeParam: ""
|
||||||
|
});
|
||||||
|
const typeOptions = [
|
||||||
|
{ label: "通用模板", value: "00" },
|
||||||
|
{ label: "属性模板", value: "01" }
|
||||||
|
];
|
||||||
|
const refForm = ref<FormInstance>();
|
||||||
|
const rules = {
|
||||||
|
commonType: [
|
||||||
|
{ required: true, message: "模板类型不能为空!", trigger: "blur" }
|
||||||
|
],
|
||||||
|
attributeName: [
|
||||||
|
{ required: true, message: "提示词名称不能为空!", trigger: "blur" }
|
||||||
|
],
|
||||||
|
attributeParam: [
|
||||||
|
{ required: true, message: "提示词不能为空!", trigger: "blur" }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
const resetForm = (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
const closeDialog = () => {
|
||||||
|
dialogVisible.value = false;
|
||||||
|
resetForm();
|
||||||
|
};
|
||||||
|
const emit = defineEmits(["update"]);
|
||||||
|
|
||||||
|
const submit = async (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
await formEl.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (isEditFlag.value) {
|
||||||
|
const res: any = await modifyMedicalRecAiManage(formData.value);
|
||||||
|
if (res.code === 200) {
|
||||||
|
message("修改成功", { type: "success" });
|
||||||
|
emit("update");
|
||||||
|
dialogVisible.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const res = await createMedicalRecAiManage(formData.value);
|
||||||
|
if (res.code === 200) {
|
||||||
|
message("新增成功", { type: "success" });
|
||||||
|
emit("update");
|
||||||
|
dialogVisible.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
defineExpose({
|
||||||
|
show(data, isEdit) {
|
||||||
|
isEditFlag.value = isEdit;
|
||||||
|
formData.value = isEdit ? Object.assign({}, data) : {};
|
||||||
|
dialogVisible.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
@ -0,0 +1,167 @@
|
|||||||
|
<!--
|
||||||
|
* @description: 提示词管理
|
||||||
|
* @fileName: index
|
||||||
|
* @author: 17076
|
||||||
|
* @date: 2024/11/14-上午9:39
|
||||||
|
* @version: V1.0.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="app-main-content">
|
||||||
|
<div class="seach">
|
||||||
|
<el-form :model="searchForm">
|
||||||
|
<el-row>
|
||||||
|
<el-form-item label="属性名称:">
|
||||||
|
<el-input size="large" v-model="searchForm.attribute_name" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-button class="ml-8" size="large" @click="search" type="primary"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button size="large" @click="reset">重置</el-button>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div class="main-table">
|
||||||
|
<div class="main-table-title">
|
||||||
|
<div class="title">
|
||||||
|
<div class="line" />
|
||||||
|
<span>提示词配置</span>
|
||||||
|
</div>
|
||||||
|
<el-row class="mb-6">
|
||||||
|
<el-button size="large" @click="handleAdd" type="primary"
|
||||||
|
>新建</el-button
|
||||||
|
>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<pure-table
|
||||||
|
align-whole="center"
|
||||||
|
show-overflow-tooltip
|
||||||
|
table-layout="auto"
|
||||||
|
:loading="loading"
|
||||||
|
adaptive
|
||||||
|
:data="dataList"
|
||||||
|
:columns="columns"
|
||||||
|
:pagination="pagination"
|
||||||
|
:header-cell-style="{
|
||||||
|
background: 'var(--el-table-row-hover-bg-color)',
|
||||||
|
color: 'var(--el-text-color-primary)'
|
||||||
|
}"
|
||||||
|
@page-size-change="handleSizeChange"
|
||||||
|
@page-current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<template #operation="{ row }">
|
||||||
|
<el-button link type="primary" @click="handleEdit(row)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button link type="danger" @click="handleDelete(row)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</pure-table>
|
||||||
|
</div>
|
||||||
|
<!--编辑提示词-->
|
||||||
|
<edit-prompt ref="edit" @update="getData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, reactive, ref } from "vue";
|
||||||
|
import { PaginationProps } from "@pureadmin/table";
|
||||||
|
import {
|
||||||
|
deleteMedicalRecAiManage,
|
||||||
|
queryMedicalRecAiManage
|
||||||
|
} from "@/api/generalRules";
|
||||||
|
import EditPrompt from "@/views/generalRules/promptManage/components/EditPrompt.vue";
|
||||||
|
import { ElMessageBox } from "element-plus";
|
||||||
|
import { message } from "@/utils/message";
|
||||||
|
|
||||||
|
const dataList = ref([{}]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const edit = ref(null);
|
||||||
|
const searchForm = reactive({
|
||||||
|
attribute_name: ""
|
||||||
|
});
|
||||||
|
const pagination = reactive<PaginationProps>({
|
||||||
|
total: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
background: true
|
||||||
|
});
|
||||||
|
const columns: TableColumnList = [
|
||||||
|
{
|
||||||
|
label: "类型",
|
||||||
|
prop: "commonName",
|
||||||
|
minWidth: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "属性名称",
|
||||||
|
prop: "attributeName",
|
||||||
|
minWidth: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "提示词",
|
||||||
|
prop: "attributeParam",
|
||||||
|
minWidth: 240
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
slot: "operation"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const getData = async () => {
|
||||||
|
const params = {
|
||||||
|
pageNum: pagination.currentPage,
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
...searchForm
|
||||||
|
};
|
||||||
|
const res: any = await queryMedicalRecAiManage(params);
|
||||||
|
dataList.value = res.data.records;
|
||||||
|
pagination.total = res.data.total;
|
||||||
|
};
|
||||||
|
function handleSizeChange(val: number) {
|
||||||
|
pagination.pageSize = val;
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCurrentChange(val: number) {
|
||||||
|
pagination.currentPage = val;
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
const search = () => {
|
||||||
|
pagination.currentPage = 1;
|
||||||
|
pagination.pageSize = 10;
|
||||||
|
getData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const reset = () => {
|
||||||
|
seachForm.description = "";
|
||||||
|
seachForm.similarityDescription = "";
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
const handleAdd = () => {
|
||||||
|
edit.value.show(undefined, false);
|
||||||
|
};
|
||||||
|
const handleEdit = item => {
|
||||||
|
edit.value.show(item, true);
|
||||||
|
};
|
||||||
|
// 删除
|
||||||
|
const handleDelete = item => {
|
||||||
|
ElMessageBox.confirm("确定删除此项吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
callback: async () => {
|
||||||
|
const res = await deleteMedicalRecAiManage({ id: item.id });
|
||||||
|
res.code === 200
|
||||||
|
? message(res.msg || "删除成功!", { type: "success" })
|
||||||
|
: message(res.msg || "删除失败!", { type: "error" });
|
||||||
|
await getData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
Loading…
Reference in New Issue