Commit d99773cd authored by “yiyousong”'s avatar “yiyousong”

perf: 优化

parent d14c727c
......@@ -557,7 +557,7 @@ img {
white-space: nowrap;
}
.addclass,.ant-btn-primary {
.addclass,.ant-btn-primary:not(.ant-btn-background-ghost) {
background: linear-gradient(90deg, #5ab6ff 0%, #2e9aff 100%) !important;
color: #fff !important;
border: none !important;
......
......@@ -6,6 +6,22 @@
发送消息总量:<span class="primary font-bold">{{ total }}</span>
</a-space>
<a-space>
<a-select v-model="searchform.messageType">
<a-select-option value=""> 全部类型 </a-select-option>
<a-select-option
v-for="(v, key) in messageSetDict.messageType"
:key="key"
:value="key"
>
{{ v }}
</a-select-option>
</a-select>
<a-select v-model="searchform.appName">
<a-select-option value=""> 全部来源 </a-select-option>
<a-select-option v-for="(v, i) in appNameList" :key="i" :value="v">
{{ v }}
</a-select-option>
</a-select>
<a-select v-model="searchform.sendStatus">
<a-select-option value=""> 全部状态 </a-select-option>
<a-select-option
......@@ -70,11 +86,13 @@
<script>
import MessageInfo from "@/components/MessageInfo.vue";
import storage from "@/utils/js/Storage";
import { getMsgTaskList, deleteMsgTask } from "@/api/message";
import { getMsgTaskList, deleteMsgTask, getMsgConfigList } from "@/api/message";
let appNameList = ["排队系统", "评价系统"];
export default {
components: { MessageInfo },
data() {
return {
appNameList,
loading: false,
columns: [
{
......@@ -141,6 +159,8 @@ export default {
info: {},
searchform: {
sendStatus: "",
messageType: "",
appName: "",
BegindAndEndTime: [
this.$moment().format("YYYY-MM-DD"),
this.$moment().format("YYYY-MM-DD"),
......@@ -148,12 +168,24 @@ export default {
},
selectedRowKeys: [],
showMessageInfo: false,
messageSetDict: {}, // 配置字典
};
},
created() {
this.getMsgConfigList();
this.getMsgTaskList();
},
methods: {
async getMsgConfigList() {
let res = await getMsgConfigList({
page: 1,
size: 1,
});
if (res.code === 1) {
let { dict } = res.data;
this.messageSetDict = dict;
}
},
// 获取消息任务列表
async getMsgTaskList() {
this.loading = true;
......@@ -162,6 +194,8 @@ export default {
size: this.size,
siteId: this.siteId,
sendStatus: this.searchform.sendStatus,
messageType: this.searchform.messageType,
appName: this.searchform.appName,
createTimeStart: this.searchform.BegindAndEndTime[0],
createTimeEnd: this.searchform.BegindAndEndTime[1],
});
......@@ -206,6 +240,8 @@ export default {
];
this.selectedRowKeys = [];
this.searchform.sendStatus = "";
this.searchform.messageType = "";
this.searchform.appName = "";
this.current = 1;
this.getMsgTaskList();
},
......
<template>
<div>
<div class="flex items-center justify-between mb-[20px]">
<a-space>
<a-button type="primary" @click="handleAdd">新增</a-button>
</a-space>
</div>
<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 storage from "@/utils/js/Storage";
import {
getMsgConfigList,
deleteMsgConfig,
saveMsgConfig,
} from "@/api/message";
export default {
components: { AddMessageSet, YSwitch },
data() {
return {
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() {
this.getMsgConfigList();
},
methods: {
// 获取消息任务列表
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();
},
},
};
</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>
<YSwitch slot="extra" v-model="value"></YSwitch>
<div class="flex items-center justify-between mb-4">
<div>消息内容:</div>
<div class="primary">等待时长超时</div>
......@@ -19,6 +19,11 @@
<div>手机号码:</div>
<div class="primary">16608319500</div>
</div>
<a-divider dashed />
<div class="flex justify-end">
<a-button type="primary" ghost> 编辑 </a-button>
<!-- <span class="primary cursor-pointer"><a-icon type="edit" /> 编辑</span> -->
</div>
</a-card>
<a-card :title="title" style="width: 300px">
<YSwitch slot="extra" v-model="value"></YSwitch>
......
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