修改了医院处理的问题
This commit is contained in:
parent
1b50770874
commit
8f0a66338b
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 用户评论-临床病例-文章 api 封装
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
import { postRequest, getRequest } from '/@/lib/axios';
|
||||
|
||||
export const userCommentClinicalArticleApi = {
|
||||
|
||||
/**
|
||||
* 分页查询 @author xing
|
||||
*/
|
||||
queryPage : (param) => {
|
||||
return postRequest('/userCommentClinicalArticle/queryPage', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加 @author xing
|
||||
*/
|
||||
add: (param) => {
|
||||
return postRequest('/userCommentClinicalArticle/add', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改 @author xing
|
||||
*/
|
||||
update: (param) => {
|
||||
return postRequest('/userCommentClinicalArticle/update', param);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除 @author xing
|
||||
*/
|
||||
delete: (id) => {
|
||||
return getRequest(`/userCommentClinicalArticle/delete/${id}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除 @author xing
|
||||
*/
|
||||
batchDelete: (idList) => {
|
||||
return postRequest('/userCommentClinicalArticle/batchDelete', idList);
|
||||
},
|
||||
|
||||
};
|
||||
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 用户评论-临床病例-视频 api 封装
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
import { postRequest, getRequest } from '/@/lib/axios';
|
||||
|
||||
export const userCommentClinicalVideoApi = {
|
||||
|
||||
/**
|
||||
* 分页查询 @author xing
|
||||
*/
|
||||
queryPage : (param) => {
|
||||
return postRequest('/userCommentClinicalVideo/queryPage', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加 @author xing
|
||||
*/
|
||||
add: (param) => {
|
||||
return postRequest('/userCommentClinicalVideo/add', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改 @author xing
|
||||
*/
|
||||
update: (param) => {
|
||||
return postRequest('/userCommentClinicalVideo/update', param);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除 @author xing
|
||||
*/
|
||||
delete: (id) => {
|
||||
return getRequest(`/userCommentClinicalVideo/delete/${id}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除 @author xing
|
||||
*/
|
||||
batchDelete: (idList) => {
|
||||
return postRequest('/userCommentClinicalVideo/batchDelete', idList);
|
||||
},
|
||||
|
||||
};
|
||||
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 用户评论-病例交流 api 封装
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
import { postRequest, getRequest } from '/@/lib/axios';
|
||||
|
||||
export const userCommentExchangeApi = {
|
||||
|
||||
/**
|
||||
* 分页查询 @author xing
|
||||
*/
|
||||
queryPage : (param) => {
|
||||
return postRequest('/userCommentExchange/queryPage', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加 @author xing
|
||||
*/
|
||||
add: (param) => {
|
||||
return postRequest('/userCommentExchange/add', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改 @author xing
|
||||
*/
|
||||
update: (param) => {
|
||||
return postRequest('/userCommentExchange/update', param);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除 @author xing
|
||||
*/
|
||||
delete: (id) => {
|
||||
return getRequest(`/userCommentExchange/delete/${id}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除 @author xing
|
||||
*/
|
||||
batchDelete: (idList) => {
|
||||
return postRequest('/userCommentExchange/batchDelete', idList);
|
||||
},
|
||||
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 用户评论-临床病例-文章 枚举
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 用户评论-临床病例-视频 枚举
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
};
|
||||
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 用户评论-病例交流 枚举
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
};
|
||||
@ -69,7 +69,13 @@
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
<template v-if="column.dataIndex === 'exchangeStatus'">
|
||||
<template v-if="column.dataIndex === 'exchangeTitle'">
|
||||
<div class="text-wrap">{{ text }}</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'hospitalName'">
|
||||
<div class="text-wrap">{{ text }}</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'exchangeStatus'">
|
||||
<a-switch
|
||||
:checked="text === 1"
|
||||
@change="(checked) => onStatusChange(record, checked)"
|
||||
@ -238,7 +244,7 @@
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 120,
|
||||
width: 150,
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
@ -0,0 +1,121 @@
|
||||
<!--
|
||||
* 用户评论-临床病例-文章
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="form.commentId ? '编辑' : '添加'"
|
||||
:width="1000"
|
||||
:open="visibleFlag"
|
||||
@close="onClose"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
|
||||
<a-form-item label="主键id" name="commentId">
|
||||
<a-input-number style="width: 100%" v-model:value="form.commentId" placeholder="主键id" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论状态(0:禁用 1:正常)" name="status">
|
||||
<a-input-number style="width: 100%" v-model:value="form.status" placeholder="评论状态(0:禁用 1:正常)" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论内容" name="content">
|
||||
<a-input style="width: 100%" v-model:value="form.content" placeholder="评论内容" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, nextTick } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentClinicalArticleApi } from '/@/api/business/user-comment-clinical-article/user-comment-clinical-article-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
// ------------------------ 事件 ------------------------
|
||||
|
||||
const emits = defineEmits(['reloadList']);
|
||||
|
||||
// ------------------------ 显示与隐藏 ------------------------
|
||||
// 是否显示
|
||||
const visibleFlag = ref(false);
|
||||
|
||||
function show(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData && !_.isEmpty(rowData)) {
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
|
||||
// if (form.status && form.status.length > 0) {
|
||||
// form.status = form.status.map((e) => e.valueCode);
|
||||
// }
|
||||
visibleFlag.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
visibleFlag.value = false;
|
||||
}
|
||||
|
||||
// ------------------------ 表单 ------------------------
|
||||
|
||||
// 组件ref
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
commentId: undefined, //主键id
|
||||
status: undefined, //评论状态(0:禁用 1:正常)
|
||||
content: undefined, //评论内容
|
||||
};
|
||||
|
||||
let form = reactive({ ...formDefault });
|
||||
|
||||
const rules = {
|
||||
};
|
||||
|
||||
// 点击确定,验证表单
|
||||
async function onSubmit() {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
save();
|
||||
} catch (err) {
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
}
|
||||
|
||||
// 新建、编辑API
|
||||
async function save() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.commentId) {
|
||||
await userCommentClinicalArticleApi.update(form);
|
||||
} else {
|
||||
await userCommentClinicalArticleApi.add(form);
|
||||
}
|
||||
message.success('操作成功');
|
||||
emits('reloadList');
|
||||
onClose();
|
||||
} catch (err) {
|
||||
smartSentry.captureError(err);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,321 @@
|
||||
<!--
|
||||
* 用户评论-临床病例-文章
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:11:31
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<!---------- 查询表单form begin ----------->
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="内容" class="smart-query-form-item">
|
||||
<a-input style="width: 200px" v-model:value="queryForm.keywords" placeholder="内容" />
|
||||
</a-form-item>
|
||||
<a-form-item class="smart-query-form-item">
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery" class="smart-margin-left10">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<!---------- 查询表单form end ----------->
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<!---------- 表格操作行 begin ----------->
|
||||
<a-row class="smart-table-btn-block">
|
||||
<div class="smart-table-operate-block">
|
||||
<a-button @click="showForm" type="primary" size="small">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
批量删除
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="smart-table-setting-block">
|
||||
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
|
||||
</div>
|
||||
</a-row>
|
||||
<!---------- 表格操作行 end ----------->
|
||||
|
||||
<!---------- 表格 begin ----------->
|
||||
<a-table
|
||||
size="small"
|
||||
:scroll="{ y: 800 }"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="commentId"
|
||||
bordered
|
||||
:loading="tableLoading"
|
||||
:pagination="false"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="showForm(record)" type="link">编辑</a-button>
|
||||
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<!---------- 表格 end ----------->
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="queryData"
|
||||
@showSizeChange="queryData"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<UserCommentClinicalArticleForm ref="formRef" @reloadList="queryData"/>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentClinicalArticleApi } from '/@/api/business/user-comment-clinical-article/user-comment-clinical-article-api';
|
||||
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import UserCommentClinicalArticleForm from './user-comment-clinical-article-form.vue';
|
||||
|
||||
// ---------------------------- 表格列 ----------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '主键id',
|
||||
dataIndex: 'commentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'userId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '临床文章id',
|
||||
dataIndex: 'articleId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '父级id,一级评论为null',
|
||||
dataIndex: 'parentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '根评论id,一级评论时为null。其余为一级评论id',
|
||||
dataIndex: 'rootId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论状态(0:禁用 1:正常)',
|
||||
dataIndex: 'status',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否存在敏感词(0:否 1:是)',
|
||||
dataIndex: 'isSensitive',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否置顶(0:否 1:是)',
|
||||
dataIndex: 'isTop',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '点赞数量',
|
||||
dataIndex: 'likeNum',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否作者评论(0:否 1:是)',
|
||||
dataIndex: 'isAuthor',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容',
|
||||
dataIndex: 'content',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容(原版)',
|
||||
dataIndex: 'contentWord',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论图片',
|
||||
dataIndex: 'commentImage',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updatedAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 90,
|
||||
},
|
||||
]);
|
||||
|
||||
// ---------------------------- 查询数据表单和方法 ----------------------------
|
||||
|
||||
const queryFormState = {
|
||||
keywords: undefined, //内容
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
// 查询表单form
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
// 表格加载loading
|
||||
const tableLoading = ref(false);
|
||||
// 表格数据
|
||||
const tableData = ref([]);
|
||||
// 总数
|
||||
const total = ref(0);
|
||||
|
||||
// 重置查询条件
|
||||
function resetQuery() {
|
||||
let pageSize = queryForm.pageSize;
|
||||
Object.assign(queryForm, queryFormState);
|
||||
queryForm.pageSize = pageSize;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function onSearch(){
|
||||
queryForm.pageNum = 1;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
async function queryData() {
|
||||
tableLoading.value = true;
|
||||
try {
|
||||
let queryResult = await userCommentClinicalArticleApi.queryPage(queryForm);
|
||||
tableData.value = queryResult.data.list;
|
||||
total.value = queryResult.data.total;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(queryData);
|
||||
|
||||
// ---------------------------- 添加/修改 ----------------------------
|
||||
const formRef = ref();
|
||||
|
||||
function showForm(data) {
|
||||
formRef.value.show(data);
|
||||
}
|
||||
|
||||
// ---------------------------- 单个删除 ----------------------------
|
||||
//确认删除
|
||||
function onDelete(data){
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestDelete(data);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求删除
|
||||
async function requestDelete(data){
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let deleteForm = {
|
||||
goodsIdList: selectedRowKeyList.value,
|
||||
};
|
||||
await userCommentClinicalArticleApi.delete(data.commentId);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- 批量删除 ----------------------------
|
||||
|
||||
// 选择表格行
|
||||
const selectedRowKeyList = ref([]);
|
||||
|
||||
function onSelectChange(selectedRowKeys) {
|
||||
selectedRowKeyList.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
function confirmBatchDelete() {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要批量删除这些数据吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestBatchDelete();
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求批量删除
|
||||
async function requestBatchDelete() {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await userCommentClinicalArticleApi.batchDelete(selectedRowKeyList.value);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,121 @@
|
||||
<!--
|
||||
* 用户评论-临床病例-视频
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<a-modal
|
||||
:title="form.commentId ? '编辑' : '添加'"
|
||||
:width="1000"
|
||||
:open="visibleFlag"
|
||||
@cancel="onClose"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
|
||||
<a-form-item label="主键id" name="commentId">
|
||||
<a-input-number style="width: 100%" v-model:value="form.commentId" placeholder="主键id" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论状态(0:禁用 1:正常)" name="status">
|
||||
<a-input-number style="width: 100%" v-model:value="form.status" placeholder="评论状态(0:禁用 1:正常)" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论内容" name="content">
|
||||
<a-input style="width: 100%" v-model:value="form.content" placeholder="评论内容" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, nextTick } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentClinicalVideoApi } from '/@/api/business/user-comment-clinical-video/user-comment-clinical-video-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
// ------------------------ 事件 ------------------------
|
||||
|
||||
const emits = defineEmits(['reloadList']);
|
||||
|
||||
// ------------------------ 显示与隐藏 ------------------------
|
||||
// 是否显示
|
||||
const visibleFlag = ref(false);
|
||||
|
||||
function show(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData && !_.isEmpty(rowData)) {
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
|
||||
// if (form.status && form.status.length > 0) {
|
||||
// form.status = form.status.map((e) => e.valueCode);
|
||||
// }
|
||||
visibleFlag.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
visibleFlag.value = false;
|
||||
}
|
||||
|
||||
// ------------------------ 表单 ------------------------
|
||||
|
||||
// 组件ref
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
commentId: undefined, //主键id
|
||||
status: undefined, //评论状态(0:禁用 1:正常)
|
||||
content: undefined, //评论内容
|
||||
};
|
||||
|
||||
let form = reactive({ ...formDefault });
|
||||
|
||||
const rules = {
|
||||
};
|
||||
|
||||
// 点击确定,验证表单
|
||||
async function onSubmit() {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
save();
|
||||
} catch (err) {
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
}
|
||||
|
||||
// 新建、编辑API
|
||||
async function save() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.commentId) {
|
||||
await userCommentClinicalVideoApi.update(form);
|
||||
} else {
|
||||
await userCommentClinicalVideoApi.add(form);
|
||||
}
|
||||
message.success('操作成功');
|
||||
emits('reloadList');
|
||||
onClose();
|
||||
} catch (err) {
|
||||
smartSentry.captureError(err);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,321 @@
|
||||
<!--
|
||||
* 用户评论-临床病例-视频
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:12:42
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<!---------- 查询表单form begin ----------->
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="内容" class="smart-query-form-item">
|
||||
<a-input style="width: 200px" v-model:value="queryForm.keywords" placeholder="内容" />
|
||||
</a-form-item>
|
||||
<a-form-item class="smart-query-form-item">
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery" class="smart-margin-left10">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<!---------- 查询表单form end ----------->
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<!---------- 表格操作行 begin ----------->
|
||||
<a-row class="smart-table-btn-block">
|
||||
<div class="smart-table-operate-block">
|
||||
<a-button @click="showForm" type="primary" size="small">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
批量删除
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="smart-table-setting-block">
|
||||
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
|
||||
</div>
|
||||
</a-row>
|
||||
<!---------- 表格操作行 end ----------->
|
||||
|
||||
<!---------- 表格 begin ----------->
|
||||
<a-table
|
||||
size="small"
|
||||
:scroll="{ y: 800 }"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="commentId"
|
||||
bordered
|
||||
:loading="tableLoading"
|
||||
:pagination="false"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="showForm(record)" type="link">编辑</a-button>
|
||||
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<!---------- 表格 end ----------->
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="queryData"
|
||||
@showSizeChange="queryData"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<UserCommentClinicalVideoForm ref="formRef" @reloadList="queryData"/>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentClinicalVideoApi } from '/@/api/business/user-comment-clinical-video/user-comment-clinical-video-api';
|
||||
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import UserCommentClinicalVideoForm from './user-comment-clinical-video-form.vue';
|
||||
|
||||
// ---------------------------- 表格列 ----------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '主键id',
|
||||
dataIndex: 'commentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'userId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '临床视频id',
|
||||
dataIndex: 'videoId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '父级id,一级评论为null',
|
||||
dataIndex: 'parentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '根评论id,一级评论时为null。其余为一级评论id',
|
||||
dataIndex: 'rootId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论状态(0:禁用 1:正常)',
|
||||
dataIndex: 'status',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否存在敏感词(0:否 1:是)',
|
||||
dataIndex: 'isSensitive',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否置顶(0:否 1:是)',
|
||||
dataIndex: 'isTop',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '点赞数量',
|
||||
dataIndex: 'likeNum',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否作者评论(0:否 1:是)',
|
||||
dataIndex: 'isAuthor',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容',
|
||||
dataIndex: 'content',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容(原版)',
|
||||
dataIndex: 'contentWord',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论图片',
|
||||
dataIndex: 'commentImage',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updatedAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 90,
|
||||
},
|
||||
]);
|
||||
|
||||
// ---------------------------- 查询数据表单和方法 ----------------------------
|
||||
|
||||
const queryFormState = {
|
||||
keywords: undefined, //内容
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
// 查询表单form
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
// 表格加载loading
|
||||
const tableLoading = ref(false);
|
||||
// 表格数据
|
||||
const tableData = ref([]);
|
||||
// 总数
|
||||
const total = ref(0);
|
||||
|
||||
// 重置查询条件
|
||||
function resetQuery() {
|
||||
let pageSize = queryForm.pageSize;
|
||||
Object.assign(queryForm, queryFormState);
|
||||
queryForm.pageSize = pageSize;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function onSearch(){
|
||||
queryForm.pageNum = 1;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
async function queryData() {
|
||||
tableLoading.value = true;
|
||||
try {
|
||||
let queryResult = await userCommentClinicalVideoApi.queryPage(queryForm);
|
||||
tableData.value = queryResult.data.list;
|
||||
total.value = queryResult.data.total;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(queryData);
|
||||
|
||||
// ---------------------------- 添加/修改 ----------------------------
|
||||
const formRef = ref();
|
||||
|
||||
function showForm(data) {
|
||||
formRef.value.show(data);
|
||||
}
|
||||
|
||||
// ---------------------------- 单个删除 ----------------------------
|
||||
//确认删除
|
||||
function onDelete(data){
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestDelete(data);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求删除
|
||||
async function requestDelete(data){
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let deleteForm = {
|
||||
goodsIdList: selectedRowKeyList.value,
|
||||
};
|
||||
await userCommentClinicalVideoApi.delete(data.commentId);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- 批量删除 ----------------------------
|
||||
|
||||
// 选择表格行
|
||||
const selectedRowKeyList = ref([]);
|
||||
|
||||
function onSelectChange(selectedRowKeys) {
|
||||
selectedRowKeyList.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
function confirmBatchDelete() {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要批量删除这些数据吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestBatchDelete();
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求批量删除
|
||||
async function requestBatchDelete() {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await userCommentClinicalVideoApi.batchDelete(selectedRowKeyList.value);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,121 @@
|
||||
<!--
|
||||
* 用户评论-病例交流
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<a-modal
|
||||
:title="form.commentId ? '编辑' : '添加'"
|
||||
:width="1000"
|
||||
:open="visibleFlag"
|
||||
@cancel="onClose"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
|
||||
<a-form-item label="主键id" name="commentId">
|
||||
<a-input-number style="width: 100%" v-model:value="form.commentId" placeholder="主键id" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论状态(0:禁用 1:正常)" name="status">
|
||||
<a-input-number style="width: 100%" v-model:value="form.status" placeholder="评论状态(0:禁用 1:正常)" />
|
||||
</a-form-item>
|
||||
<a-form-item label="评论内容" name="content">
|
||||
<a-input style="width: 100%" v-model:value="form.content" placeholder="评论内容" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, nextTick } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentExchangeApi } from '/@/api/business/user-comment-exchange/user-comment-exchange-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
// ------------------------ 事件 ------------------------
|
||||
|
||||
const emits = defineEmits(['reloadList']);
|
||||
|
||||
// ------------------------ 显示与隐藏 ------------------------
|
||||
// 是否显示
|
||||
const visibleFlag = ref(false);
|
||||
|
||||
function show(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData && !_.isEmpty(rowData)) {
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
|
||||
// if (form.status && form.status.length > 0) {
|
||||
// form.status = form.status.map((e) => e.valueCode);
|
||||
// }
|
||||
visibleFlag.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
visibleFlag.value = false;
|
||||
}
|
||||
|
||||
// ------------------------ 表单 ------------------------
|
||||
|
||||
// 组件ref
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
commentId: undefined, //主键id
|
||||
status: undefined, //评论状态(0:禁用 1:正常)
|
||||
content: undefined, //评论内容
|
||||
};
|
||||
|
||||
let form = reactive({ ...formDefault });
|
||||
|
||||
const rules = {
|
||||
};
|
||||
|
||||
// 点击确定,验证表单
|
||||
async function onSubmit() {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
save();
|
||||
} catch (err) {
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
}
|
||||
|
||||
// 新建、编辑API
|
||||
async function save() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.commentId) {
|
||||
await userCommentExchangeApi.update(form);
|
||||
} else {
|
||||
await userCommentExchangeApi.add(form);
|
||||
}
|
||||
message.success('操作成功');
|
||||
emits('reloadList');
|
||||
onClose();
|
||||
} catch (err) {
|
||||
smartSentry.captureError(err);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,321 @@
|
||||
<!--
|
||||
* 用户评论-病例交流
|
||||
*
|
||||
* @Author: xing
|
||||
* @Date: 2025-08-12 09:13:30
|
||||
* @Copyright gdxz
|
||||
-->
|
||||
<template>
|
||||
<!---------- 查询表单form begin ----------->
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="内容" class="smart-query-form-item">
|
||||
<a-input style="width: 200px" v-model:value="queryForm.keywords" placeholder="内容" />
|
||||
</a-form-item>
|
||||
<a-form-item class="smart-query-form-item">
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery" class="smart-margin-left10">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<!---------- 查询表单form end ----------->
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<!---------- 表格操作行 begin ----------->
|
||||
<a-row class="smart-table-btn-block">
|
||||
<div class="smart-table-operate-block">
|
||||
<a-button @click="showForm" type="primary" size="small">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
批量删除
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="smart-table-setting-block">
|
||||
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
|
||||
</div>
|
||||
</a-row>
|
||||
<!---------- 表格操作行 end ----------->
|
||||
|
||||
<!---------- 表格 begin ----------->
|
||||
<a-table
|
||||
size="small"
|
||||
:scroll="{ y: 800 }"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="commentId"
|
||||
bordered
|
||||
:loading="tableLoading"
|
||||
:pagination="false"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="showForm(record)" type="link">编辑</a-button>
|
||||
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<!---------- 表格 end ----------->
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="queryData"
|
||||
@showSizeChange="queryData"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<UserCommentExchangeForm ref="formRef" @reloadList="queryData"/>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { userCommentExchangeApi } from '/@/api/business/user-comment-exchange/user-comment-exchange-api';
|
||||
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import UserCommentExchangeForm from './user-comment-exchange-form.vue';
|
||||
|
||||
// ---------------------------- 表格列 ----------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '主键id',
|
||||
dataIndex: 'commentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'userId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '病例交流id',
|
||||
dataIndex: 'exchangeId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '父级id,一级评论为null',
|
||||
dataIndex: 'parentId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '根评论id,一级评论时为null。其余为一级评论id',
|
||||
dataIndex: 'rootId',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论状态(0:禁用 1:正常)',
|
||||
dataIndex: 'status',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否存在敏感词(0:否 1:是)',
|
||||
dataIndex: 'isSensitive',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否置顶(0:否 1:是)',
|
||||
dataIndex: 'isTop',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '点赞数量',
|
||||
dataIndex: 'likeNum',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否作者评论(0:否 1:是)',
|
||||
dataIndex: 'isAuthor',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容',
|
||||
dataIndex: 'content',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论内容(原版)',
|
||||
dataIndex: 'contentWord',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '评论图片',
|
||||
dataIndex: 'commentImage',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updatedAt',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 90,
|
||||
},
|
||||
]);
|
||||
|
||||
// ---------------------------- 查询数据表单和方法 ----------------------------
|
||||
|
||||
const queryFormState = {
|
||||
keywords: undefined, //内容
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
// 查询表单form
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
// 表格加载loading
|
||||
const tableLoading = ref(false);
|
||||
// 表格数据
|
||||
const tableData = ref([]);
|
||||
// 总数
|
||||
const total = ref(0);
|
||||
|
||||
// 重置查询条件
|
||||
function resetQuery() {
|
||||
let pageSize = queryForm.pageSize;
|
||||
Object.assign(queryForm, queryFormState);
|
||||
queryForm.pageSize = pageSize;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function onSearch(){
|
||||
queryForm.pageNum = 1;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
async function queryData() {
|
||||
tableLoading.value = true;
|
||||
try {
|
||||
let queryResult = await userCommentExchangeApi.queryPage(queryForm);
|
||||
tableData.value = queryResult.data.list;
|
||||
total.value = queryResult.data.total;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(queryData);
|
||||
|
||||
// ---------------------------- 添加/修改 ----------------------------
|
||||
const formRef = ref();
|
||||
|
||||
function showForm(data) {
|
||||
formRef.value.show(data);
|
||||
}
|
||||
|
||||
// ---------------------------- 单个删除 ----------------------------
|
||||
//确认删除
|
||||
function onDelete(data){
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestDelete(data);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求删除
|
||||
async function requestDelete(data){
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let deleteForm = {
|
||||
goodsIdList: selectedRowKeyList.value,
|
||||
};
|
||||
await userCommentExchangeApi.delete(data.commentId);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- 批量删除 ----------------------------
|
||||
|
||||
// 选择表格行
|
||||
const selectedRowKeyList = ref([]);
|
||||
|
||||
function onSelectChange(selectedRowKeys) {
|
||||
selectedRowKeyList.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
function confirmBatchDelete() {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要批量删除这些数据吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestBatchDelete();
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求批量删除
|
||||
async function requestBatchDelete() {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await userCommentExchangeApi.batchDelete(selectedRowKeyList.value);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user