修改文章病例库管理相关操作问题

This commit is contained in:
wucongxing8150 2025-08-11 19:22:38 +08:00
parent cd6dd3d202
commit 7103c40c44
4 changed files with 124 additions and 22 deletions

View File

@ -65,6 +65,13 @@ export const caseExchangeApi = {
return postRequest(`/caseExchange/selected/update`, { exchangeId, isSelected }); return postRequest(`/caseExchange/selected/update`, { exchangeId, isSelected });
}, },
/**
* 更新审核状态 @author xing
*/
updateAuditStatus: (exchangeId, auditStatus) => {
return postRequest(`/caseExchange/auditStatus/update`, { exchangeId, auditStatus });
},
/** /**
* 获取疾病标签数据 @author xing * 获取疾病标签数据 @author xing
*/ */

View File

@ -140,7 +140,7 @@
</div> </div>
</a-form-item> </a-form-item>
<a-form-item label="内容" name="articleContent"> <a-form-item label="内容" name="articleContent" v-if="!isLinkChecked">
<SmartWangeditor ref="contentRef" :modelValue="form.articleContent" :height="300" /> <SmartWangeditor ref="contentRef" :modelValue="form.articleContent" :height="300" />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -356,8 +356,13 @@
// //
function isLinkCheckedChange(checked) { function isLinkCheckedChange(checked) {
form.isLink = checked ? 1 : 0; form.isLink = checked ? 1 : 0;
if (!checked) { if (checked) {
form.isLinkUrl = undefined; // //
form.articleContent = '';
form.articleContentText = '';
} else {
//
form.isLinkUrl = undefined;
} }
} }
@ -617,18 +622,47 @@
form.authorList.splice(index, 1); form.authorList.splice(index, 1);
} }
const rules = { //
const rules = computed(() => ({
articleTitle: [{ required: true, message: '标题 必填' }], articleTitle: [{ required: true, message: '标题 必填' }],
articleStatus: [{ required: true, message: '状态1:正常 2:禁用) 必填' }], articleStatus: [{ required: true, message: '状态1:正常 2:禁用) 必填' }],
pushDate: [{ required: true, message: '发表时间 必填' }], pushDate: [{ required: true, message: '发表时间 必填' }],
articleContent: [{ required: true, message: '内容 必填' }], isLinkUrl: [{
}; required: isLinkChecked.value,
message: '外部链接地址 必填',
validator: (rule, value) => {
if (!isLinkChecked.value) {
return Promise.resolve();
}
if (!value || value.trim() === '') {
return Promise.reject('外部链接地址 必填');
}
return Promise.resolve();
}
}],
articleContent: [{
required: !isLinkChecked.value,
message: '内容 必填',
validator: (rule, value) => {
if (isLinkChecked.value) {
return Promise.resolve();
}
if (!value || value.trim() === '') {
return Promise.reject('内容 必填');
}
return Promise.resolve();
}
}],
}));
// //
async function onSubmit() { async function onSubmit() {
try { try {
form.articleContent = contentRef.value.getHtml(); //
form.articleContentText = contentRef.value.getText(); if (!isLinkChecked.value) {
form.articleContent = contentRef.value.getHtml();
form.articleContentText = contentRef.value.getText();
}
await formRef.value.validateFields(); await formRef.value.validateFields();
save(); save();
} catch (err) { } catch (err) {

View File

@ -10,14 +10,11 @@
<a-form class="smart-query-form"> <a-form class="smart-query-form">
<a-row class="smart-query-form-row"> <a-row class="smart-query-form-row">
<a-form-item label="关键字" class="smart-query-form-item"> <a-form-item label="关键字" class="smart-query-form-item">
<a-input style="width: 200px" v-model:value="queryForm.keywords" placeholder="标题/作者/" /> <a-input style="width: 200px" v-model:value="queryForm.keywords" placeholder="疾病名称/标题/作者" />
</a-form-item> </a-form-item>
<a-form-item label="状态" name="articleStatus" class="smart-query-form-item"> <a-form-item label="状态" name="articleStatus" class="smart-query-form-item">
<SmartEnumSelect enum-name="STATUS_ENUM" v-model:value="queryForm.articleStatus" width="160px" /> <SmartEnumSelect enum-name="STATUS_ENUM" v-model:value="queryForm.articleStatus" width="160px" />
</a-form-item> </a-form-item>
<a-form-item label="删除状态" name="deleteStatus" class="smart-query-form-item">
<SmartEnumSelect enum-name="DELETE_STATUS_ENUM" v-model:value="queryForm.deleteStatus" width="160px" />
</a-form-item>
<a-form-item class="smart-query-form-item"> <a-form-item class="smart-query-form-item">
<a-button type="primary" @click="onSearch"> <a-button type="primary" @click="onSearch">
<template #icon> <template #icon>
@ -107,10 +104,6 @@
/> />
</template> </template>
<template v-if="column.dataIndex === 'deleteStatus'">
<span>{{ text === 1 ? '是' : '否' }}</span>
</template>
<template v-if="column.dataIndex === 'articleTitle'"> <template v-if="column.dataIndex === 'articleTitle'">
<div class="text-wrap">{{ text }}</div> <div class="text-wrap">{{ text }}</div>
</template> </template>
@ -196,11 +189,6 @@
}, },
width: 150, width: 150,
}, },
{
title: '删除状态',
dataIndex: 'deleteStatus',
ellipsis: true,
},
{ {
title: '阅读量', title: '阅读量',
dataIndex: 'readNum', dataIndex: 'readNum',
@ -239,7 +227,6 @@
const queryFormState = { const queryFormState = {
keywords: undefined, // keywords: undefined, //
articleStatus: undefined, // articleStatus: undefined, //
deleteStatus: undefined, //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };

View File

@ -18,6 +18,9 @@
<a-form-item label="精选状态" name="isSelected" class="smart-query-form-item"> <a-form-item label="精选状态" name="isSelected" class="smart-query-form-item">
<SmartEnumSelect enum-name="SELECTED_ENUM" v-model:value="queryForm.isSelected" width="160px" /> <SmartEnumSelect enum-name="SELECTED_ENUM" v-model:value="queryForm.isSelected" width="160px" />
</a-form-item> </a-form-item>
<a-form-item label="审核状态" name="auditStatus" class="smart-query-form-item">
<SmartEnumSelect enum-name="AUDIT_STATUS_ENUM" v-model:value="queryForm.auditStatus" width="160px" />
</a-form-item>
<a-form-item class="smart-query-form-item"> <a-form-item class="smart-query-form-item">
<a-button type="primary" @click="onSearch"> <a-button type="primary" @click="onSearch">
<template #icon> <template #icon>
@ -82,6 +85,11 @@
size="small" size="small"
/> />
</template> </template>
<template v-if="column.dataIndex === 'auditStatus'">
<a-tag :color="getAuditStatusColor(text)">
{{ getAuditStatusText(text) }}
</a-tag>
</template>
<template v-if="column.dataIndex === 'caseExchangeLabel'"> <template v-if="column.dataIndex === 'caseExchangeLabel'">
<div v-if="text && text.length > 0" class="label-list-display"> <div v-if="text && text.length > 0" class="label-list-display">
<div v-for="label in text" :key="label.exchangeLabelId" class="label-item-display"> <div v-for="label in text" :key="label.exchangeLabelId" class="label-item-display">
@ -92,6 +100,7 @@
</template> </template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate"> <div class="smart-table-operate">
<a-button @click="showAuditModal(record)" type="link" v-if="hasPermission('caseExchange:auditStatusUpdate')">审核</a-button>
<a-button @click="showForm(record)" type="link">编辑</a-button> <a-button @click="showForm(record)" type="link">编辑</a-button>
<a-button @click="onDelete(record)" danger type="link">删除</a-button> <a-button @click="onDelete(record)" danger type="link">删除</a-button>
</div> </div>
@ -179,6 +188,16 @@
}, },
width: 100, width: 100,
}, },
{
title: '审核状态',
dataIndex: 'auditStatus',
resizable: true,
filterOptions: {
type: 'enum-select',
enumName: 'AUDIT_STATUS_ENUM',
},
width: 100,
},
{ {
title: '阅读量', title: '阅读量',
dataIndex: 'readNum', dataIndex: 'readNum',
@ -229,6 +248,7 @@
keyword: undefined, // keyword: undefined, //
exchangeStatus: undefined, // exchangeStatus: undefined, //
isSelected: undefined, // isSelected: undefined, //
auditStatus: undefined, //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };
@ -356,6 +376,60 @@
// ---------------------------- ---------------------------- // ---------------------------- ----------------------------
//
function getAuditStatusText(status) {
switch (status) {
case 0: return '待审核';
case 1: return '审核通过';
case 2: return '审核不通过';
default: return '未知';
}
}
//
function getAuditStatusColor(status) {
switch (status) {
case 0: return 'orange';
case 1: return 'green';
case 2: return 'red';
default: return 'default';
}
}
//
function hasPermission(permission) {
//
// true
return true;
}
//
function showAuditModal(record) {
Modal.confirm({
title: '审核病例交流',
content: `确定要将"${record.exchangeTitle}"标记为审核通过吗?`,
okText: '审核通过',
okType: 'primary',
cancelText: '取消',
onOk() {
updateAuditStatus(record, 1);
},
onCancel() {},
});
}
//
async function updateAuditStatus(record, auditStatus) {
try {
await caseExchangeApi.updateAuditStatus(record.exchangeId, auditStatus);
record.auditStatus = auditStatus;
message.success('审核状态更新成功');
} catch (e) {
smartSentry.captureError(e);
message.error('审核状态更新失败');
}
}
// //
async function onStatusChange(record, checked) { async function onStatusChange(record, checked) {
try { try {