消息模板
This commit is contained in:
parent
ad226da54e
commit
12522cbf36
@ -10,6 +10,21 @@ export const listlist = (query?: LeaveQuery): AxiosPromise => {
|
||||
data: query
|
||||
});
|
||||
};
|
||||
//删除模板
|
||||
export const deltemplate = (query?: string): AxiosPromise => {
|
||||
return request({
|
||||
url: `/system/message/template/${query}`,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
//查看详情模板
|
||||
export const getnotice = (query?: string): AxiosPromise => {
|
||||
return request({
|
||||
url: `/system/message/template/${query}`,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
//获取下拉列表
|
||||
export const listuserlist = (query?: string | number): AxiosPromise => {
|
||||
return request({
|
||||
|
@ -48,8 +48,8 @@ export interface LeaveQuery {
|
||||
title?: string;
|
||||
content?: string;
|
||||
sendTime?: string;
|
||||
recipient?: string;
|
||||
type?: string;
|
||||
startTime?: string;
|
||||
subType?: string;
|
||||
}
|
||||
export interface LeaveForm {}
|
||||
|
||||
@ -66,8 +66,10 @@ export interface LeaveVO {
|
||||
}
|
||||
|
||||
export interface LeaveListVO {
|
||||
sendScope: number | string;
|
||||
sendScope: Array<string>;
|
||||
templateId: string;
|
||||
subType: string;
|
||||
scheduledTime: string;
|
||||
logmess: number;
|
||||
}
|
||||
export interface AccountOV {
|
||||
@ -85,3 +87,15 @@ export interface paramsaccountOV {
|
||||
templateContent: string;
|
||||
title: string;
|
||||
}
|
||||
export interface seachookOV {
|
||||
createBy: string;
|
||||
createTime: string;
|
||||
id: string;
|
||||
status: string;
|
||||
templateContent: string;
|
||||
templateName: string;
|
||||
templateType: string;
|
||||
title: string;
|
||||
updateBy: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
@ -52,8 +52,14 @@
|
||||
</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']">删除</el-button>
|
||||
<el-button link type="primary" v-hasPermi="['workflow:video:remove']" @click="deltemplatefun(scope.row.id)">删除</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -85,15 +91,58 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<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">
|
||||
<el-button type="primary" @click="cilcikgAdd">修改</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Leave" lang="ts">
|
||||
import { listtemplate, templateAdd } from '@/api/set/messageindex';
|
||||
import { listtemplate, templateAdd, deltemplate, getnotice } from '@/api/set/messageindex';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const showSearch = ref(true);
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
import { LeaveForm, AccountQuery, AccountOV, paramsaccountOV } from '@/api/set/messagetype';
|
||||
import { LeaveForm, AccountQuery, AccountOV, paramsaccountOV, seachookOV } from '@/api/set/messagetype';
|
||||
const data = reactive<PageData<LeaveForm, AccountQuery>>({
|
||||
form: {},
|
||||
queryParams: {
|
||||
@ -114,12 +163,24 @@ const showRefuteDialog = ref<boolean>(false);
|
||||
const logmess = ref<boolean>(false);
|
||||
const getlist = async () => {
|
||||
const res = await listtemplate(queryParams.value);
|
||||
console.log(res);
|
||||
if (res.code == 200) {
|
||||
messList.value = res.data.records;
|
||||
total.value = res.data.total;
|
||||
}
|
||||
};
|
||||
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();
|
||||
}
|
||||
});
|
||||
};
|
||||
const dataparams = ref<paramsaccountOV>({
|
||||
templateType: null,
|
||||
templateCode: null,
|
||||
@ -127,6 +188,7 @@ const dataparams = ref<paramsaccountOV>({
|
||||
templateContent: null,
|
||||
title: null
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
templateType: [{ required: true, message: '请输入标题', trigger: 'blur' }],
|
||||
templateCode: [{ required: true, message: '请输入备注内容', trigger: 'blur' }],
|
||||
@ -148,8 +210,49 @@ const resetQuery = () => {
|
||||
};
|
||||
getlist();
|
||||
};
|
||||
const formRef = ref<ElFormInstance>();
|
||||
//查看
|
||||
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
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
const cilcikgAdd = async () => {
|
||||
const res = await templateAdd(dataparams.value);
|
||||
if (res.code == 200) {
|
||||
|
@ -9,22 +9,23 @@
|
||||
<el-form-item label="发送内容">
|
||||
<el-input v-model="queryParams.content" placeholder="请输入发送内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送时间">
|
||||
<el-date-picker v-model="queryParams.sendTime" type="date" placeholder="选择发送时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送对象">
|
||||
<el-input v-model="queryParams.recipient" placeholder="请输入发送对象" />
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker v-model="queryParams.startTime" type="date" placeholder="开始时间" />至
|
||||
<el-date-picker v-model="queryParams.sendTime" type="date" placeholder="结束时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送类型">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择发送类型">
|
||||
<el-select v-model="queryParams.subType" placeholder="请选择发送类型">
|
||||
<!-- 这里需要根据实际的发送类型选项添加 el-option -->
|
||||
<el-option label="类型1" value="1" />
|
||||
<el-option label="类型2" value="2" />
|
||||
<el-option label="关注" value="0" />
|
||||
<el-option label="系统" value="1" />
|
||||
<el-option label="互动" value="2" />
|
||||
<el-option label="订单" value="3" />
|
||||
<el-option label="通知" value="4" />
|
||||
</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-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-button type="primary" @click="showRefuteDialog = true">发送信息</el-button>
|
||||
@ -44,11 +45,16 @@
|
||||
<el-table-column label="内容" prop="content" align="center" width="150" />
|
||||
<el-table-column label="创建时间" prop="createTime" align="center" width="200" />
|
||||
<el-table-column label="定时发送时间" prop="scheduledTime" align="center" width="200" />
|
||||
<el-table-column label="消息类型" prop="title" align="center" width="150">
|
||||
<el-table-column label="触发类型" prop="title" align="center" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ row.msgType == 1 ? '手动' : '自动' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="消息类型" prop="title" align="center" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ isSub[row.subType] }}
|
||||
</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">
|
||||
@ -76,11 +82,13 @@
|
||||
<el-option v-for="item in idoptions" :key="item.id" :label="item.templateName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="指定">
|
||||
<el-button @click="dataparams.logmess = 1" :style="{ background: dataparams.logmess == 1 ? '#FFB6C1' : '' }">{{ '指定角色' }}</el-button>
|
||||
<el-button @click="dataparams.logmess = 2" :style="{ background: dataparams.logmess == 2 ? '#FFB6C1' : '' }">{{ '指定用户' }}</el-button>
|
||||
<el-button @click="islofun(1)" :style="{ background: dataparams.logmess == 1 ? '#FFB6C1' : '' }">{{ '指定角色' }}</el-button>
|
||||
<el-button @click="islofun(2)" :style="{ background: dataparams.logmess == 2 ? '#FFB6C1' : '' }">{{ '指定用户' }}</el-button>
|
||||
<!-- <el-button @click="dataparams.logmess = 3" :style="{ background: dataparams.logmess == 3 ? '#FFB6C1' : '' }">{{ '指定群' }}</el-button> -->
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="手机号/名称" v-show="dataparams.logmess == 2">
|
||||
<el-select
|
||||
v-model="dataparams.sendScope"
|
||||
@ -110,10 +118,23 @@
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="指定角色" v-show="dataparams.logmess == 1">
|
||||
<el-select v-model="dataparams.sendScope" placeholder="请选择角色">
|
||||
<el-select v-model="fncode" placeholder="请选择角色" @change="getlistdata">
|
||||
<el-option v-for="(item, index) in sendScopelist" :label="item.label" :value="item.value" :key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发送类型">
|
||||
<el-select v-model="dataparams.subType" placeholder="请选择发送类型">
|
||||
<!-- 这里需要根据实际的发送类型选项添加 el-option -->
|
||||
<el-option label="关注" value="0" />
|
||||
<el-option label="系统" value="1" />
|
||||
<el-option label="互动" value="2" />
|
||||
<el-option label="订单" value="3" />
|
||||
<el-option label="通知" value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手自动时间">
|
||||
<el-date-picker v-model="dataparams.scheduledTime" type="datetime" placeholder="请输入自动发送时间" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
@ -139,8 +160,8 @@ const data = reactive<PageData<LeaveForm, LeaveQuery>>({
|
||||
title: null,
|
||||
content: null,
|
||||
sendTime: null,
|
||||
recipient: null,
|
||||
type: null
|
||||
startTime: null,
|
||||
subType: null
|
||||
},
|
||||
rules: {}
|
||||
});
|
||||
@ -151,17 +172,44 @@ const total = ref(0);
|
||||
const showRefuteDialog = ref<boolean>(false);
|
||||
const getlist = async () => {
|
||||
const res = await listlist(queryParams.value);
|
||||
console.log(res);
|
||||
if (res.code == 200) {
|
||||
messList.value = res.data.records;
|
||||
total.value = res.data.total;
|
||||
}
|
||||
};
|
||||
const islofun = (e) => {
|
||||
dataparams.value.logmess = e;
|
||||
fncode.value = '';
|
||||
dataparams.value.sendScope = null;
|
||||
};
|
||||
const resetQuery = () => {
|
||||
queryParams.value = {
|
||||
title: null,
|
||||
content: null,
|
||||
sendTime: null,
|
||||
startTime: null,
|
||||
subType: null
|
||||
};
|
||||
getlist();
|
||||
};
|
||||
const isSub = ref({
|
||||
0: '关注',
|
||||
1: '系统',
|
||||
2: '互动',
|
||||
3: '订单',
|
||||
4: '通知'
|
||||
});
|
||||
const fncode = ref('');
|
||||
const dataparams = ref<LeaveListVO>({
|
||||
sendScope: null,
|
||||
templateId: null,
|
||||
subType: null,
|
||||
scheduledTime: null,
|
||||
logmess: 1 // 1:角色 2:用户 3:群聊
|
||||
});
|
||||
const getlistdata = async (e: any) => {
|
||||
dataparams.value.sendScope = [e];
|
||||
};
|
||||
const rules = reactive({
|
||||
id: [{ required: false, message: '请输入', trigger: 'blur' }],
|
||||
sendScope: [{ required: true, message: '请输入内容', trigger: 'blur' }]
|
||||
@ -170,7 +218,9 @@ const select = ref([
|
||||
{ label: '自动', value: 0 },
|
||||
{ label: '手动', value: 1 }
|
||||
]);
|
||||
const handleQuery = () => {};
|
||||
const handleQuery = () => {
|
||||
getlist();
|
||||
};
|
||||
const sendScopelist = ref([
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '达人', value: 'expert' },
|
||||
@ -184,16 +234,22 @@ const cilcikgAdd = async () => {
|
||||
dataparams.value = {
|
||||
sendScope: null,
|
||||
templateId: null,
|
||||
subType: null,
|
||||
scheduledTime: null,
|
||||
logmess: 1 // 1:角色 2:用户 3:群聊
|
||||
};
|
||||
fncode.value = '';
|
||||
showRefuteDialog.value = false;
|
||||
getlist();
|
||||
}
|
||||
};
|
||||
const clearFormData = () => {
|
||||
fncode.value = '';
|
||||
dataparams.value = {
|
||||
sendScope: null,
|
||||
subType: null,
|
||||
templateId: null,
|
||||
scheduledTime: null,
|
||||
logmess: 1 // 1:角色 2:用户 3:群聊
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user