2025-06-20 09:19:32 +08:00
|
|
|
<template>
|
2025-07-07 09:32:36 +08:00
|
|
|
<div class="p-2">
|
|
|
|
<!-- <el-card shadow="hover" class="mb-[10px]"> -->
|
2025-06-20 09:19:32 +08:00
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
<div v-show="showSearch" class="search">
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
<el-form-item label="模板名称" prop="phone">
|
|
|
|
<el-input v-model="queryParams.templateName" placeholder="请输入模板名称" clearable @keyup.enter="handleQuery" />
|
|
|
|
</el-form-item>
|
2025-06-24 10:23:58 +08:00
|
|
|
<!-- <el-form-item label="模板编号" prop="phone">
|
2025-06-20 09:19:32 +08:00
|
|
|
<el-input v-model="queryParams.templatecode" placeholder="请输入模板编码" clearable @keyup.enter="handleQuery" />
|
2025-06-24 10:23:58 +08:00
|
|
|
</el-form-item> -->
|
2025-06-20 09:19:32 +08:00
|
|
|
<el-form-item label="类型" prop="phone">
|
|
|
|
<el-select v-model="queryParams.templateType" placeholder="请选择类型">
|
|
|
|
<el-option label="通知" value="0" />
|
|
|
|
<el-option label="公告" value="1" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="状态" prop="phone">
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择类型">
|
|
|
|
<el-option label="停用" value="1" />
|
|
|
|
<el-option label="正常" value="0" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2025-07-07 09:32:36 +08:00
|
|
|
<!-- </el-card> -->
|
|
|
|
<el-card shadow="hover">
|
|
|
|
<template #header>
|
|
|
|
<el-row :gutter="10">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button type="primary" plain icon="Plus" @click="showRefuteDialog = true">创建模板</el-button>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
<el-table
|
|
|
|
ref="categoryTableRef"
|
|
|
|
:data="messList"
|
|
|
|
row-key="categoryId"
|
|
|
|
border
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
|
>
|
|
|
|
<el-table-column label="id" prop="id" align="center" width="180" />
|
|
|
|
<el-table-column label="模板名称" prop="templateName" align="center" width="150" />
|
|
|
|
<!-- <el-table-column label="模板名称" prop="templateName" align="center" width="150" /> -->
|
|
|
|
<el-table-column label="模版类型" prop="templateType" align="center" width="150">
|
|
|
|
<template #default="{ row }">
|
|
|
|
{{ row.templateType == 1 ? '公告' : '通知' }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="状态" prop="status" align="center" width="150">
|
|
|
|
<template #default="{ row }">
|
|
|
|
{{ row.status == 1 ? '停用' : '正常' }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-tooltip content="查看" placement="top">
|
|
|
|
<el-button link type="primary" v-hasPermi="['workflow:video:remove']" @click="seachfun(scope.row.id)">查看</el-button>
|
|
|
|
</el-tooltip>
|
|
|
|
<el-tooltip content="编辑" placement="top">
|
|
|
|
<el-button link type="primary" v-hasPermi="['workflow:video:remove']" @click="updatefun(scope.row.id)">编辑</el-button>
|
|
|
|
</el-tooltip>
|
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
|
<el-button link type="primary" v-hasPermi="['workflow:video:remove']" @click="deltemplatefun(scope.row.id)">删除</el-button>
|
|
|
|
</el-tooltip>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
<div class="block">
|
|
|
|
<pagination v-if="total > 0" :total="total" v-model:page="queryParams.current" v-model:limit="queryParams.size" @pagination="getlist" />
|
|
|
|
</div>
|
|
|
|
</el-card>
|
2025-06-24 10:23:58 +08:00
|
|
|
<el-dialog v-model="showRefuteDialog" title="创建消息模板">
|
2025-06-20 09:19:32 +08:00
|
|
|
<el-form :model="dataparams" :rules="rules">
|
|
|
|
<el-form-item label="模板类型">
|
|
|
|
<el-select v-model="dataparams.templateType" placeholder="请选择类型">
|
|
|
|
<el-option label="通知" value="0" />
|
|
|
|
<el-option label="公告" value="1" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板名称">
|
|
|
|
<el-input v-model="dataparams.templateName" placeholder="模板名称" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板标题">
|
|
|
|
<el-input v-model="dataparams.title" placeholder="模板标题" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板内容">
|
2025-06-24 10:23:58 +08:00
|
|
|
<el-input v-model="dataparams.templateContent" placeholder="模板内容" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" />
|
2025-06-20 09:19:32 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<span class="dialog-footer">
|
2025-06-24 10:23:58 +08:00
|
|
|
<el-button type="primary" @click="cilcikgAdd">创建</el-button>
|
2025-06-20 09:19:32 +08:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
2025-06-25 15:00:52 +08:00
|
|
|
<el-dialog v-model="seachookDialog" title="查看消息模板">
|
|
|
|
<el-form :model="seachook" :rules="rules">
|
|
|
|
<el-form-item label="模板类型">
|
|
|
|
<el-select v-model="seachook.templateType" placeholder="请选择类型" disabled>
|
|
|
|
<el-option label="通知" value="0" />
|
|
|
|
<el-option label="公告" value="1" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板名称">
|
|
|
|
<el-input v-model="seachook.templateName" placeholder="模板名称" disabled />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板标题">
|
|
|
|
<el-input v-model="seachook.title" placeholder="模板标题" disabled />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板内容">
|
|
|
|
<el-input v-model="seachook.templateContent" placeholder="模板内容" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" disabled />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-dialog>
|
|
|
|
<el-dialog v-model="updatedialog" title="修改消息模板">
|
|
|
|
<el-form :model="updatahook" :rules="rules">
|
|
|
|
<el-form-item label="模板类型">
|
|
|
|
<el-select v-model="updatahook.templateType" placeholder="请选择类型">
|
|
|
|
<el-option label="通知" value="0" />
|
|
|
|
<el-option label="公告" value="1" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板名称">
|
|
|
|
<el-input v-model="updatahook.templateName" placeholder="模板名称" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板标题">
|
|
|
|
<el-input v-model="updatahook.title" placeholder="模板标题" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="模板内容">
|
|
|
|
<el-input v-model="updatahook.templateContent" placeholder="模板内容" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<span class="dialog-footer">
|
2025-06-30 15:55:00 +08:00
|
|
|
<el-button type="primary" @click="clickupdate">修改</el-button>
|
2025-06-25 15:00:52 +08:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
2025-06-20 09:19:32 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="Leave" lang="ts">
|
2025-06-30 15:55:00 +08:00
|
|
|
import { listtemplate, templateAdd, deltemplate, getnotice, updateCategory } from '@/api/set/messageindex';
|
2025-06-20 09:19:32 +08:00
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
const showSearch = ref(true);
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
2025-06-25 15:00:52 +08:00
|
|
|
import { LeaveForm, AccountQuery, AccountOV, paramsaccountOV, seachookOV } from '@/api/set/messagetype';
|
2025-06-20 09:19:32 +08:00
|
|
|
const data = reactive<PageData<LeaveForm, AccountQuery>>({
|
|
|
|
form: {},
|
|
|
|
queryParams: {
|
|
|
|
current: 1,
|
|
|
|
size: 10,
|
|
|
|
templateName: undefined,
|
|
|
|
templatecode: undefined,
|
|
|
|
templateType: undefined,
|
|
|
|
status: undefined
|
|
|
|
},
|
|
|
|
rules: {}
|
|
|
|
});
|
|
|
|
const isExpandAll = ref(true);
|
|
|
|
const { queryParams } = toRefs(data);
|
|
|
|
const messList = ref<AccountOV[]>([]);
|
|
|
|
const total = ref(0);
|
|
|
|
const showRefuteDialog = ref<boolean>(false);
|
|
|
|
const logmess = ref<boolean>(false);
|
|
|
|
const getlist = async () => {
|
|
|
|
const res = await listtemplate(queryParams.value);
|
|
|
|
if (res.code == 200) {
|
|
|
|
messList.value = res.data.records;
|
|
|
|
total.value = res.data.total;
|
|
|
|
}
|
|
|
|
};
|
2025-06-25 15:00:52 +08:00
|
|
|
const deltemplatefun = async (row: string) => {
|
|
|
|
ElMessageBox.confirm('确定要删除该模板吗?', '提示', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(async () => {
|
|
|
|
const res = await deltemplate(row);
|
|
|
|
if (res.code == 200) {
|
|
|
|
ElMessage.success('删除成功');
|
|
|
|
getlist();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2025-06-20 09:19:32 +08:00
|
|
|
const dataparams = ref<paramsaccountOV>({
|
|
|
|
templateType: null,
|
|
|
|
templateCode: null,
|
|
|
|
templateName: null,
|
|
|
|
templateContent: null,
|
|
|
|
title: null
|
|
|
|
});
|
2025-06-25 15:00:52 +08:00
|
|
|
|
2025-06-20 09:19:32 +08:00
|
|
|
const rules = reactive({
|
|
|
|
templateType: [{ required: true, message: '请输入标题', trigger: 'blur' }],
|
|
|
|
templateCode: [{ required: true, message: '请输入备注内容', trigger: 'blur' }],
|
|
|
|
templateName: [{ required: true, message: '请输入内容', trigger: 'blur' }],
|
|
|
|
templateContent: [{ required: true, message: '请输入内容', trigger: 'blur' }],
|
|
|
|
title: [{ required: true, message: '请输入标题内容', trigger: 'blur' }]
|
|
|
|
});
|
|
|
|
const handleQuery = () => {
|
|
|
|
getlist();
|
|
|
|
};
|
|
|
|
const resetQuery = () => {
|
|
|
|
queryParams.value = {
|
|
|
|
templateType: undefined,
|
|
|
|
status: undefined,
|
|
|
|
templateName: undefined,
|
|
|
|
templatecode: undefined,
|
|
|
|
current: 1,
|
|
|
|
size: 10
|
|
|
|
};
|
|
|
|
getlist();
|
|
|
|
};
|
2025-06-25 15:00:52 +08:00
|
|
|
//查看
|
|
|
|
const seachookDialog = ref<boolean>(false);
|
|
|
|
const seachook = ref<seachookOV>({
|
|
|
|
createBy: null,
|
|
|
|
createTime: null,
|
|
|
|
id: null,
|
|
|
|
status: null,
|
|
|
|
templateContent: null,
|
|
|
|
templateName: null,
|
|
|
|
templateType: null,
|
|
|
|
title: null,
|
|
|
|
updateBy: null,
|
|
|
|
updateTime: null
|
|
|
|
});
|
2025-06-20 09:19:32 +08:00
|
|
|
|
2025-06-25 15:00:52 +08:00
|
|
|
const seachfun = async (id?: string) => {
|
|
|
|
const res = await getnotice(id);
|
|
|
|
if (res.code == 200) {
|
|
|
|
seachook.value = res.data;
|
|
|
|
seachookDialog.value = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
//编辑
|
|
|
|
const updatedialog = ref<boolean>(false);
|
|
|
|
const updatahook = ref<seachookOV>({
|
|
|
|
createBy: null,
|
|
|
|
createTime: null,
|
|
|
|
id: null,
|
|
|
|
status: null,
|
|
|
|
templateContent: null,
|
|
|
|
templateName: null,
|
|
|
|
templateType: null,
|
|
|
|
title: null,
|
|
|
|
updateBy: null,
|
|
|
|
updateTime: null
|
|
|
|
});
|
|
|
|
const updatefun = async (id?: string) => {
|
|
|
|
const res = await getnotice(id);
|
|
|
|
if (res.code == 200) {
|
|
|
|
updatahook.value = res.data;
|
|
|
|
updatedialog.value = true;
|
|
|
|
}
|
|
|
|
};
|
2025-06-30 15:55:00 +08:00
|
|
|
const clickupdate = async () => {
|
|
|
|
const res = await updateCategory(updatahook.value);
|
|
|
|
if (res.code == 200) {
|
|
|
|
updatedialog.value = false;
|
|
|
|
getlist();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
//新增
|
2025-06-20 09:19:32 +08:00
|
|
|
const cilcikgAdd = async () => {
|
|
|
|
const res = await templateAdd(dataparams.value);
|
|
|
|
if (res.code == 200) {
|
|
|
|
showRefuteDialog.value = false;
|
2025-06-30 15:55:00 +08:00
|
|
|
dataparams.value = {
|
|
|
|
templateType: null,
|
|
|
|
templateCode: null,
|
|
|
|
templateName: null,
|
|
|
|
templateContent: null,
|
|
|
|
title: null
|
|
|
|
};
|
2025-06-20 09:19:32 +08:00
|
|
|
getlist();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
onMounted(() => {
|
|
|
|
getlist();
|
|
|
|
});
|
|
|
|
</script>
|