Files
zhgh_zjvtit/target/classes/views/platform/sys/msg/index.html
T
2026-08-26 14:25:17 +08:00

183 lines
7.8 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-msg-active {
background-color: #546478;
color: #ffffff;
}
.note {
width: 100%;
height: 320px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="消息类型:">
<el-select clearable placeholder="请选择消息类型" v-model="pageForm.searchType" style="width: 100%" @change="doSearch">
<el-option label="全部类型消息" value=""></el-option>
<el-option label="系统消息" value="system"></el-option>
<el-option label="用户消息" value="user"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="消息列表">
<el-button size="small" type="primary" icon="el-icon-plus" @click="openAdd">发送消息</el-button>
</table-tool>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
<el-table-column align="center" header-align="center" label="消息类型" prop="type" sortable>
<template slot-scope="scope">
<span v-if="'system'==scope.row.type">系统消息</span>
<span v-if="'user'==scope.row.type">用户消息</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" header-align="center" label="标题" prop="title"></el-table-column>
<el-table-column :show-overflow-tooltip="true" header-align="center" label="消息内容" prop="note">
<template slot-scope="scope">
<el-link type="primary" @click="openViewNote(scope.row)">查看</el-link>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="总接收用户" prop="all_num">
<template slot-scope="scope">
<el-link type="primary" @click="viewUserList('all',scope.row.id)">{{scope.row.all_num}}</el-link>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="未读用户" prop="unread_num">
<template slot-scope="scope">
<el-link type="primary" @click="viewUserList('unread',scope.row.id)">{{scope.row.unread_num}}</el-link>
</template>
</el-table-column>
<el-table-column header-align="center" label="发送时间" prop="createdAt" sortable>
<template slot-scope="scope">{{$moment(scope.row.createdAt).format("YYYY-MM-DD HH:mm:ss")}}</template>
</el-table-column>
<el-table-column header-align="center" label="发送人" prop="createdAt" sortable>
<template slot-scope="scope">{{scope.row.username}}</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="消息状态" prop="delFlag" sortable>
<template slot-scope="scope">
<el-tag size="mini" type="error" v-if="scope.row.delFlag">已删除</el-tag>
<el-tag size="mini" type="success" v-if="!scope.row.delFlag">已发送</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="deleteDo(scope.row.id, scope.row.title)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit>
<msg-form ref="msgForm" @back="back" :union-list="unionList" :unit-list="unitList" @parent-do-search="doSearch"></msg-form>
</template>
</guava>
<view-user ref="viewUser" :type="type" :id="id" :union-list="unionList" :unit-list="unitList"></view-user>
<el-dialog title="消息内容" :visible.sync="noteVisible" width="50%">
<div class="note" v-html="nodeData.note">
</div>
<file-preview complete_result :files="nodeData.files"></file-preview>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
<!--#include("msgManage/msgManageForm.js"){}#-->
<!--#include("msgManage/viewUser.js"){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"msg-form": MSG_FORM_TEMPLATE,
"view-user": VIEW_USER_TEMPLATE
},
data: function () {
return {
tableData: [],
pageForm: {
searchType: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
type: "",
id: "",
unionList: [],
unitList: [],
noteVisible: false,
nodeData: {}
}
},
methods: {
openViewNote(row) {
this.noteVisible = true
this.nodeData = {
note: row.note,
files: row.files
}
},
back() {
this.$refs.guava.index()
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
async pageData() {
const resp = await this.$axios.post("/platform/sys/msg/data", this.pageForm)
if (resp.code === 0) {
this.tableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
} else {
this.$message.warning(resp.msg)
}
},
openAdd() {
this.$refs.guava.edit()
this.$nextTick(() => {
this.$refs.msgForm.initAdd()
})
},
viewUserList(type, id) {
this.type = type
this.id = id
this.$refs.viewUser.open()
},
deleteDo(id, title) {
this.$confirm("您确定要删除" + title + "吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
const resp = await this.$axios.post("/platform/sys/msg/delete/" + id)
if (resp.code === 0) {
this.$message.success(resp.msg)
this.doSearch()
} else {
this.$message.warning(resp.msg)
}
})
}
},
created: async function () {
this.unitList = await this.$businessTool.listUnit()
this.unionList = await this.$businessTool.listUnion()
this.pageData()
}
})
</script>
<!--#
}
#-->