Commit 138c61cf authored by “yiyousong”'s avatar “yiyousong”

feat: 消息接口调试

parent 08445621
import http from "../request/http";
let baseURL = process.env.VUE_APP_API_BASE_URL;
// 获取消息任务列表
export function getMsgTaskList(params) {
return http.post(`${baseURL}/zwfw/message/task/list`, params);
}
// 查询消息配置列表
export function getMsgConfigList(params) {
return http.post(`${baseURL}/zwfw/message/config/list`, params);
}
// 查看消息配置
export function getMsgConfig(params) {
return http.get(`${baseURL}/zwfw/message/config/info`, params);
}
// 保存消息配置
export function saveMsgConfig(params) {
return http.post(`${baseURL}/zwfw/message/config/save`, params);
}
// 删除消息配置
export function deleteMsgConfig(params) {
return http.get(`${baseURL}/zwfw/message/config/delete`, params);
}
......@@ -4,21 +4,31 @@
:zIndex="2000"
title="消息详情"
placement="right"
width="500px"
width="600px"
:visible="Visible"
@close="onClose"
>
<a-descriptions :column="1">
<a-descriptions-item label="消息类型"> 预警消息 </a-descriptions-item>
<a-descriptions-item label="消息内容"> 等待超时 </a-descriptions-item>
<a-descriptions-item label="消息来源"> 排队系统 </a-descriptions-item>
<a-descriptions-item label="消息类型">
{{ detailsInfo.messageType }}
</a-descriptions-item>
<a-descriptions-item label="消息内容">
{{ detailsInfo.content }}
</a-descriptions-item>
<a-descriptions-item label="消息来源">
{{ detailsInfo.appName }}
</a-descriptions-item>
<a-descriptions-item label="系统提醒时间">
2022-11-07 16:00:00
{{ detailsInfo.alarmTime }}
</a-descriptions-item>
<a-descriptions-item label="发送状态">
{{ detailsInfo.sendStatus }}
</a-descriptions-item>
<a-descriptions-item label="接收人">
{{ detailsInfo.msgRecipients }}
</a-descriptions-item>
<a-descriptions-item label="是否短线提醒"></a-descriptions-item>
<a-descriptions-item label="接收人"> 张三 </a-descriptions-item>
<a-descriptions-item label="短线提醒时间">
2022-11-07 16:00:00
<a-descriptions-item label="短信提醒时间">
{{ detailsInfo.sendTime }}
</a-descriptions-item>
</a-descriptions>
</a-drawer>
......
......@@ -145,6 +145,7 @@ export default {
clickSite(obj) {
storage.set(2, "siteId", obj.id);
storage.set(2, "siteName", obj.label);
storage.set(2, "siteCode", obj.siteCode);
this.show = false;
if (location.href.search(/token/gi) >= 0) {
this.$router.push({ path: "/resource/advimg" });
......
......@@ -83,7 +83,7 @@
overlayClassName="message-popover"
placement="bottomRight"
>
<div slot="title" class="text-[16px]">999条消息</div>
<div slot="title" class="text-[16px]">{{ messageTotal }}条消息</div>
<div slot="content" class="message-content">
<div class="message-list">
<template v-if="messageList.length">
......@@ -92,21 +92,25 @@
:key="v.id"
@click="changeMessageInfo(v)"
>
<div class="flex justify-between items-start">
<div
class="flex justify-between items-start gap-[6px] cursor-pointer"
>
<div class="flex gap-[6px]">
<div
class="w-[50px] h-[50px] rounded-full flex justify-center items-center text-white hint"
class="w-[50px] h-[50px] rounded-full flex justify-center items-center text-white hint flex-shrink-0"
>
预警
</div>
<div class="flex flex-col justify-between">
<div>{{ v.message }}</div>
<div>{{ v.time }}</div>
<div>
{{ v.messageType }}
</div>
<div>{{ v.alarmTime }}</div>
</div>
<a-tag color="blue"> 排队系统 </a-tag>
</div>
<a-divider dashed v-if="i < 4" />
<a-tag color="blue"> {{ v.appName }} </a-tag>
</div>
<a-divider dashed v-if="i < messageList.length - 1" />
</div>
</template>
<a-empty
......@@ -133,7 +137,7 @@
查看更多 >
</div>
</div>
<a-badge :count="10" :overflow-count="999">
<a-badge :count="messageTotal" :overflow-count="999">
<i class="iconfont icon-notice cursor-pointer"></i>
</a-badge>
</a-popover>
......@@ -147,6 +151,7 @@
<script>
import { mapState, mapMutations, mapGetters } from "vuex";
import { LogoutInterface } from "@/api/user";
import { getMsgTaskList } from "@/api/message";
import changePassword from "./components/changePassword.vue";
import HeaderSite from "./components/HeaderSite.vue";
import MessageInfo from "@/components/MessageInfo.vue";
......@@ -160,6 +165,7 @@ export default {
data() {
return {
sysName: process.env.VUE_APP_systemName,
siteId: storage.get(2, "siteId") ? storage.get(2, "siteId") : "",
siteInfo: {
key: storage.get(2, "siteId"),
},
......@@ -176,33 +182,10 @@ export default {
"/home/thePlatformIsSet/setPlatformes",
],
// 消息列表
messageList: [
{
id: 1,
message: "等待时长超时",
time: "04.08 09:00:00",
},
{
id: 2,
message: "等待时长超时",
time: "04.08 09:00:00",
},
{
id: 3,
message: "等待时长超时",
time: "04.08 09:00:00",
},
{
id: 4,
message: "等待时长超时",
time: "04.08 09:00:00",
},
{
id: 5,
message: "等待时长超时",
time: "04.08 09:00:00",
},
],
messageList: [],
messageTotal: 0,
timer: null,
timer2: null,
};
},
computed: {
......@@ -223,6 +206,7 @@ export default {
},
hasMessagePage() {
let { menuList } = this.userData;
if (menuList && !menuList.length) return false;
let platform = menuList.find(
(v) =>
v.name === "平台设置" ||
......@@ -240,9 +224,46 @@ export default {
},
created() {
this.setMoment();
this.getMsgTaskList();
this.autoUpdate();
},
methods: {
...mapMutations("user", ["reset"]),
// 获取消息任务列表
async getMsgTaskList() {
if (!this.hasMessagePage) return;
let res = await getMsgTaskList({
page: 1,
size: 5,
siteId: this.siteId,
createTimeStart: this.$moment().format("YYYY-MM-DD"),
createTimeEnd: this.$moment().format("YYYY-MM-DD"),
});
if (res.code === 1) {
let { data, total, dict } = res.data;
data.forEach((v) => {
v.alarmTime = this.$moment(v.alarmTime).format("YYYY-MM-DD HH:mm:ss");
v.sendTime = v.sendTime
? this.$moment(v.sendTime).format("YYYY-MM-DD HH:mm:ss")
: "";
v.sendStatus = dict.sendStatus && dict.sendStatus[v.sendStatus];
});
this.messageList = data;
this.messageTotal = total;
}
},
// 自动更新消息
autoUpdate() {
this.timer2 = setInterval(() => {
if (!this.hasMessagePage) {
clearInterval(this.timer2);
return;
}
this.getMsgTaskList();
}, 1000 * 60);
},
handleChange(info) {
storage.set(2, "siteId", info.key);
storage.set(2, "siteName", info.label);
......@@ -302,6 +323,7 @@ export default {
},
beforeDestroy() {
clearInterval(this.timer);
clearInterval(this.timer2);
},
};
</script>
......
......@@ -431,8 +431,10 @@ export default {
let siteId = siteIds.split(",")[0];
let firstSite = findSitesById(siteList, siteId);
let siteName = firstSite.label;
let siteCode = firstSite.siteCode;
storage.set(2, "siteId", siteId);
storage.set(2, "siteName", siteName);
storage.set(2, "siteCode", siteCode);
}
setTimeout(() => {
this.$router.push("/home");
......
......@@ -2,18 +2,26 @@
<div>
<div class="flex items-center justify-between mb-[20px]">
<div>
发送消息总量:<span class="primary font-bold">4545645646</span>
发送消息总量:<span class="primary font-bold">{{ total }} </span>
</div>
<a-space>
<a-select>
<a-select-option value=""> 全部内容 </a-select-option>
</a-select>
<a-select>
<a-select-option value=""> 全部来源 </a-select-option>
<a-select v-model="searchform.sendStatus">
<a-select-option value=""> 全部状态 </a-select-option>
<a-select-option
v-for="(v, key) in dict.sendStatus"
:key="key"
:value="key"
>
{{ v }}
</a-select-option>
</a-select>
<a-range-picker v-model="BegindAndEndTime" />
<a-button type="primary">搜索</a-button>
<a-button>重置</a-button>
<a-range-picker
:allowClear="false"
valueFormat="YYYY-MM-DD"
v-model="searchform.BegindAndEndTime"
/>
<a-button type="primary" @click="handSearch">搜索</a-button>
<a-button @click="resetSearch">重置</a-button>
</a-space>
</div>
<a-table
......@@ -29,22 +37,37 @@
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changePagination,
onShowSizeChange: showSizeChange,
}"
:columns="columns"
:data-source="tableData"
:loading="loading"
@change="changePagination"
>
<template slot="action" slot-scope="text, record">
<a-space>
<span class="cursor-pointer primary" @click="handleInfo(record)"
>查看详情</span
>
</a-space>
</template>
</a-table>
<MessageInfo
ref="MessageInfo"
:show.sync="showMessageInfo"
:detailsInfo="info"
/>
</div>
</template>
<script>
import Storage from "@/utils/js/Storage";
import MessageInfo from "@/components/MessageInfo.vue";
import storage from "@/utils/js/Storage";
import { getMsgTaskList } from "@/api/message";
export default {
components: { MessageInfo },
data() {
return {
loading: false,
columns: [
{
width: "60px",
......@@ -57,68 +80,121 @@ export default {
{
title: "消息类型",
align: "center",
dataIndex: "name",
width: 200,
dataIndex: "messageType",
},
{
title: "消息内容",
title: "消息来源",
align: "center",
dataIndex: "age",
width: 200,
dataIndex: "appName",
},
{
title: "消息来源",
title: "系统提醒时间",
align: "center",
dataIndex: "address",
width: 200,
dataIndex: "alarmTime",
},
{
title: "系统提醒时间",
title: "接收人",
align: "center",
dataIndex: "address",
width: 200,
dataIndex: "msgRecipients",
},
{
title: "是否短信提醒",
title: "接收人手机号码",
align: "center",
dataIndex: "address",
width: 200,
dataIndex: "recipient",
},
{
title: "接收人",
title: "发送状态",
align: "center",
dataIndex: "address",
width: 200,
dataIndex: "sendStatus",
customRender: (text) => {
return <a-tag>{{ text }}</a-tag>;
},
},
{
title: "短信提醒时间",
align: "center",
dataIndex: "address",
width: 200,
dataIndex: "sendTime",
},
{
title: "操作",
align: "center",
dataIndex: "address",
width: 200,
width: 100,
scopedSlots: { customRender: "action" },
},
],
tableData: [],
siteId: Storage.get(2, "siteId") ? Storage.get(2, "siteId") : "",
siteId: storage.get(2, "siteId") ? storage.get(2, "siteId") : "",
searchName: "",
BegindAndEndTime: [
this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"),
],
pageSizeOptions: ["10", "30", "50", "100"],
current: 1,
size: 10,
total: 0,
dict: {}, // 日志字典
info: {},
searchform: {
sendStatus: "",
BegindAndEndTime: [
this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"),
],
},
showMessageInfo: false,
};
},
created() {},
methods: {},
created() {
this.getMsgTaskList();
},
methods: {
// 获取消息任务列表
async getMsgTaskList() {
this.loading = true;
let res = await getMsgTaskList({
page: this.current,
size: this.size,
siteId: this.siteId,
sendStatus: this.searchform.sendStatus,
createTimeStart: this.searchform.BegindAndEndTime[0],
createTimeEnd: this.searchform.BegindAndEndTime[1],
});
this.loading = false;
if (res.code === 1) {
let { data, total, dict } = res.data;
data.forEach((v) => {
v.alarmTime = this.$moment(v.alarmTime).format("YYYY-MM-DD HH:mm:ss");
v.sendTime = v.sendTime
? this.$moment(v.sendTime).format("YYYY-MM-DD HH:mm:ss")
: "";
v.sendStatus = dict.sendStatus && dict.sendStatus[v.sendStatus];
});
this.tableData = data;
this.total = total;
this.dict = dict;
}
},
changePagination({ current, pageSize }) {
this.current = current;
this.size = pageSize;
this.getMsgTaskList();
},
handleInfo(row) {
this.info = row;
this.showMessageInfo = true;
},
handSearch() {
this.current = 1;
this.getMsgTaskList();
},
resetSearch() {
this.searchform.BegindAndEndTime = [
this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"),
];
this.searchform.sendStatus = "";
this.current = 1;
this.getMsgTaskList();
},
},
};
</script>
......
<template>
<div class="flex items-center gap-6">
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value" @onChange="handleSwitch"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">等待时长超时</div>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">排队系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">办理时长超时</div>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">排队系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">差评</div>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">评价系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<AddReceive :show.sync="show"></AddReceive>
</div>
</template>
<script>
import YSwitch from "@/components/YSwitch.vue";
import AddReceive from "./components/AddReceive.vue";
export default {
components: {
YSwitch,
AddReceive,
},
data() {
return {
title: "预警消息",
value: 1,
show: false,
};
},
created() {},
methods: {
handleSwitch() {
this.show = true;
},
},
};
</script>
<style lang="less" scoped>
/deep/.ant-spin-container {
display: block;
}
</style>
<template>
<div class="flex items-center gap-6">
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value" @onChange="handleSwitch"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">等待时长超时</div>
<div>
<div class="flex items-center justify-between mb-[20px]">
<a-space>
<a-button type="primary" @click="handleAdd">新增</a-button>
</a-space>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">排队系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">办理时长超时</div>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">排队系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">差评</div>
</div>
<div class="flex items-center justify-between">
<div>消息来源:</div>
<div class="primary">评价系统</div>
</div>
<a-divider dashed />
<div class="flex items-center justify-between mb-4">
<div>接收人:</div>
<div class="primary">张三</div>
</div>
<div class="flex items-center justify-between">
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
</a-card>
<AddReceive :show.sync="show"></AddReceive>
<a-table
size="small"
bordered
:scroll="{ y: 590 }"
:row-key="(record) => record.id"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: current,
total: total,
pageSize: size,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
}"
:columns="columns"
:data-source="tableData"
:loading="loading"
@change="changePagination"
>
<template slot="enabled" slot-scope="text, record">
<YSwitch v-model="record.enabled" @onChange="handleSwitch(record)" />
</template>
<template slot="action" slot-scope="text, record">
<a-space>
<span class="cursor-pointer primary" @click="handleEdit(record)"
>编辑</span
>
<span class="cursor-pointer delete" @click="handleDel(record.id)"
>删除</span
>
</a-space>
</template>
</a-table>
<!-- 新增 -->
<AddMessageSet
ref="AddMessageSet"
:show.sync="show"
:title="title"
:dict="dict"
@success="getMsgConfigList"
></AddMessageSet>
</div>
</template>
<script>
import AddMessageSet from "./components/AddMessageSet.vue";
import YSwitch from "@/components/YSwitch.vue";
import AddReceive from "./components/AddReceive.vue";
import storage from "@/utils/js/Storage";
import {
getMsgConfigList,
deleteMsgConfig,
saveMsgConfig,
} from "@/api/message";
export default {
components: {
YSwitch,
AddReceive,
},
components: { AddMessageSet, YSwitch },
data() {
return {
title: "预警消息",
value: 1,
loading: false,
columns: [
{
width: "60px",
title: "序号",
align: "center",
customRender: (text, record, index) => {
return (this.current - 1) * this.size + index + 1;
},
},
{
title: "短信消息模板ID",
align: "center",
dataIndex: "templateId",
},
{
title: "消息类型",
align: "center",
dataIndex: "messageType",
},
{
title: "应用平台标识",
align: "center",
dataIndex: "appName",
},
{
title: "接收人",
align: "center",
dataIndex: "msgRecipients",
},
{
title: "接收人手机号码",
align: "center",
dataIndex: "recipient",
},
{
title: "启用",
align: "center",
dataIndex: "enabled",
width: 200,
scopedSlots: { customRender: "enabled" },
},
{
title: "操作",
align: "center",
width: 120,
scopedSlots: { customRender: "action" },
},
],
tableData: [],
siteId: storage.get(2, "siteId") ? storage.get(2, "siteId") : "",
pageSizeOptions: ["10", "30", "50", "100"],
current: 1,
size: 10,
total: 0,
dict: {}, // 日志字典
title: "新增",
show: false,
};
},
created() {},
created() {
this.getMsgConfigList();
},
methods: {
handleSwitch() {
// 获取消息任务列表
async getMsgConfigList() {
this.loading = true;
let res = await getMsgConfigList({
page: this.current,
size: this.size,
siteId: this.siteId,
});
this.loading = false;
if (res.code === 1) {
let { data, total, dict } = res.data;
if (!data.length && this.current > 1) {
this.current -= 1;
this.getMsgConfigList();
}
this.tableData = data;
this.total = total;
this.dict = dict;
}
},
changePagination({ current, pageSize }) {
this.current = current;
this.size = pageSize;
this.getMsgConfigList();
},
handleAdd() {
this.title = "新增";
this.show = true;
this.$refs.AddMessageSet.onAdd();
},
handleEdit(row) {
this.title = "编辑";
this.show = true;
this.$refs.AddMessageSet.onEdit(row);
},
handleDel(id) {
this.$confirm({
okType: "danger",
title: "系统提示",
content: "删除不可恢复,是否继续?",
okText: "",
cancelText: "",
centered: true,
onOk: async () => {
let res = await deleteMsgConfig({ id });
if (res.code === 1) {
this.$message.success(res.msg);
this.getMsgConfigList();
}
},
});
},
async handleSwitch(row) {
let res = await saveMsgConfig(row);
if (res.code === 1) {
this.$message.success("修改成功");
}
this.getMsgConfigList();
},
},
};
......
<template>
<div class="roleEditModal_box" ref="roleEditModal_box">
<a-modal
:title="title"
:visible="Visible"
@cancel="handleCancel"
width="30%"
>
<a-form-model
:label-col="{
span: 6,
}"
:wrapper-col="{
span: 18,
}"
ref="form"
:model="form"
:rules="rules"
>
<a-form-model-item label="消息类型" prop="messageType">
<a-select v-model="form.messageType" placeholder="请选择消息类型">
<a-select-option
v-for="(v, key) in dict.messageType"
:key="key"
:value="key"
>{{ v }}</a-select-option
>
</a-select>
</a-form-model-item>
<!-- <a-form-model-item label="应用平台标识" prop="appName">
<a-input
placeholder="请输入应用平台标识"
allowClear
v-model="form.appName"
/>
</a-form-model-item> -->
<a-form-model-item label="短信消息模板ID" prop="templateId">
<a-input
placeholder="请输入短信消息模板ID"
allowClear
v-model.number="form.templateId"
/>
</a-form-model-item>
<a-form-model-item label="接收人" prop="msgRecipients">
<a-input
placeholder="请输入接收人姓名"
allowClear
v-model="form.msgRecipients"
/>
</a-form-model-item>
<a-form-model-item label="接收人手机号码" prop="recipient">
<a-input
placeholder="请输入接收人手机号码"
allowClear
v-model="form.recipient"
/>
</a-form-model-item>
<a-form-model-item label="启用" prop="enabled">
<YSwitch v-model="form.enabled"></YSwitch>
</a-form-model-item>
<a-form-model-item label="备注" prop="remark">
<a-input
type="textarea"
placeholder="请输入备注"
allowClear
v-model="form.remark"
/>
</a-form-model-item>
</a-form-model>
<template slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button type="primary" :loading="loading" @click="handleOk"
>确定</a-button
>
</template>
</a-modal>
</div>
</template>
<script>
import storage from "@/utils/js/Storage";
import YSwitch from "@/components/YSwitch.vue";
import { saveMsgConfig } from "@/api/message";
export default {
components: {
YSwitch,
},
props: {
title: {
required: true,
type: String,
default: "新增",
},
show: {
required: true,
type: Boolean,
default: false,
},
dict: {
required: true,
type: Object,
default: () => {},
},
},
data() {
const changePhone = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入手机号"));
callback();
} else if (!/^1[3-9]\d{9}$/.test(value)) {
callback(new Error("手机号码格式不正确"));
} else {
callback();
}
};
return {
loading: false,
form: {
siteId: storage.get(2, "siteId") ? storage.get(2, "siteId") : "", // 站点id
siteName: storage.get(2, "siteName") ? storage.get(2, "siteName") : "", // 站点名称
siteCode: storage.get(2, "siteCode") ? storage.get(2, "siteCode") : "", // 站点编码
templateId: "", // 短信消息模板ID
// appName: "", // 应用平台标识
messageType: undefined, // 消息类型(等待超时预警,办理超时预警,差评预警)
recipient: "", // 手机号
msgRecipients: "", // 消息发送对象
channel: "SMS", // 消息发送渠道,SMS(短信)、EMAIL(邮件)、PUSH(推送通知)
enabled: 1, // 是否启用该发送服务(0.否,1.是)
remark: "", //备注
},
rules: {
messageType: [
{ required: true, message: "请选择消息类型", trigger: "change" },
],
msgRecipients: [
{
required: true,
message: "请输入接收人姓名",
trigger: "msgRecipients",
},
],
templateId: [
{ required: true, message: "请输入短信消息模板ID", trigger: "blur" },
],
recipient: [
{ required: true, validator: changePhone, trigger: "blur" },
],
},
};
},
computed: {
Visible: {
get() {
return this.show;
},
set(val) {
this.$emit("update:show", val);
},
},
},
methods: {
onAdd() {
Object.assign(this.form, this.$options.data().form);
this.form.id && this.$delete(this.form, "id");
},
onEdit(row) {
setTimeout(() => {
this.form = { ...row };
}, 10);
},
handleCancel() {
this.resetForm();
this.loading = false;
this.Visible = false;
},
resetForm() {
this.$refs.form.resetFields();
},
handleOk() {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.loading = true;
let res = await saveMsgConfig(this.form);
this.loading = false;
if (res.code === 1) {
let { msg } = res;
this.$message.success(msg);
this.$emit("success");
this.handleCancel();
}
}
});
},
},
};
</script>
<style lang="less" scoped></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment