first commit
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
<!--#
|
||||
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>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,264 @@
|
||||
const MSG_FORM_TEMPLATE = {
|
||||
template: `
|
||||
<div>
|
||||
<el-form :model="formData" ref="addForm" :rules="formRules" label-width="120px">
|
||||
<el-form-item prop="title" label="标题">
|
||||
<el-input maxlength="255" placeholder="请输入标题" v-model="formData.title"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="url" label="链接地址">
|
||||
<el-input placeholder="请输入链接地址" v-model="formData.url"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="needBack" label="是否需要反馈">
|
||||
<el-radio-group v-model="formData.needBack" size="small">
|
||||
<el-radio border :label="true">是</el-radio>
|
||||
<el-radio border :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item prop="type" label="消息类型">
|
||||
<el-radio-group v-model="formData.type" size="small">
|
||||
<!-- <el-radio border label="system">系统消息</el-radio>-->
|
||||
<el-radio border label="user">用户消息</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户列表" v-if="'user'==formData.type">
|
||||
<el-row class="mb10">
|
||||
<el-button icon="el-icon-search" @click="openSelect" size="small">选择用户</el-button>
|
||||
<el-button icon="el-icon-delete" @click="clearSelect" type="danger" size="small">清空用户</el-button>
|
||||
</el-row>
|
||||
<el-table :data="userTableData" style="width: 100%" size="mini" max-height="500">
|
||||
<el-table-column fixed prop="loginname" label="工号" width="150"></el-table-column>
|
||||
<el-table-column prop="username" label="姓名" width="120"></el-table-column>
|
||||
<el-table-column prop="sex" label="性别" width="50"></el-table-column>
|
||||
<el-table-column prop="userState" label="在职状态" width="120"></el-table-column>
|
||||
<el-table-column prop="personType" label="教职工类别" width="120"></el-table-column>
|
||||
<el-table-column prop="preparedBy" label="编制类别" width="120"></el-table-column>
|
||||
<el-table-column prop="mobile" label="手机" width="120"></el-table-column>
|
||||
<el-table-column prop="unitName" label="所属单位" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="unionName" label="所属工会" show-overflow-tooltip></el-table-column>
|
||||
</el-table>
|
||||
<p style="color: var(--color-primary)">总计:{{userTableData.length}}人</p>
|
||||
</el-form-item>
|
||||
<el-form-item prop="note" label="消息内容">
|
||||
<text-editor v-model="formData.note"></text-editor>
|
||||
</el-form-item>
|
||||
<el-form-item prop="files" label="消息附件">
|
||||
<file-upload
|
||||
:value.sync="formData.files"
|
||||
:upload_number="5"
|
||||
upload_result_category="array"
|
||||
complete_result
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-row class="mt20" justify="end" type="flex">
|
||||
<el-button @click="back">取消</el-button>
|
||||
<el-button type="primary" @click="doAdd">确定</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-dialog title="选择用户" :visible.sync="selectDialogVisible" width="65%" append-to-body top="2%">
|
||||
<div class="btn-group tool-button">
|
||||
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch" style="width: 300px">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 80px">
|
||||
<el-option label="工号" value="u.loginname"></el-option>
|
||||
<el-option label="姓名" value="u.username"></el-option>
|
||||
<el-option label="手机" value="u.mobile"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
<el-select v-model="pageForm.sex" placeholder="性别" clearable>
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select v-model="pageForm.unionId" @change="flushUnits" @clear="flushUnits" placeholder="请选择所属工会" filterable clearable>
|
||||
<el-option v-for="item in unionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="pageForm.unitId" placeholder="请选择所属单位" filterable clearable>
|
||||
<el-option v-for="item in unitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="pageForm.roleId" placeholder="请选择角色" filterable clearable>
|
||||
<el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button icon="el-icon-search" @click="doSearch" type="primary"></el-button>
|
||||
</div>
|
||||
<div class="left-span-label mt20">人员列表</div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
>
|
||||
<el-table-column type="selection" reserve-selection width="35"></el-table-column>
|
||||
<el-table-column fixed prop="loginname" label="工号" width="150"></el-table-column>
|
||||
<el-table-column prop="username" label="姓名" width="120"></el-table-column>
|
||||
<el-table-column prop="sex" label="性别" width="50"></el-table-column>
|
||||
<el-table-column prop="userState" label="在职状态" width="120"></el-table-column>
|
||||
<el-table-column prop="personType" label="教职工类别" width="120"></el-table-column>
|
||||
<el-table-column prop="preparedBy" label="编制类别" width="120"></el-table-column>
|
||||
<el-table-column prop="mobile" label="手机" width="120"></el-table-column>
|
||||
<el-table-column prop="unitName" label="所属单位" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="unionName" label="所属工会" show-overflow-tooltip></el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="selectDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doSelect">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
`,
|
||||
props: {
|
||||
unionList: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
unitList: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
roleList: [],
|
||||
userTableData: [],
|
||||
tableData: [],
|
||||
pageForm: {
|
||||
searchName: "u.username",
|
||||
searchKeyword: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: ""
|
||||
},
|
||||
formData: {},
|
||||
formRules: {
|
||||
title: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||
note: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||
needBack: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||
type: [{ required: true, message: "必填", trigger: ["blur", "change"] }]
|
||||
},
|
||||
selectDialogVisible: false,
|
||||
selectUsers: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.unitList = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
this.doSearch()
|
||||
},
|
||||
back() {
|
||||
this.$emit("back")
|
||||
},
|
||||
parentDoSearch() {
|
||||
this.$emit("parent-do-search")
|
||||
},
|
||||
doAdd() {
|
||||
this.$refs["addForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const loginNames = this.userTableData.map((u) => u.loginname)
|
||||
if (loginNames.length === 0 && this.formData.type === "user") {
|
||||
this.$message.warning("请选择用户")
|
||||
return false
|
||||
}
|
||||
|
||||
if(loginNames.length > 100){
|
||||
this.$message.warning("单条消息最多发送100人,请分批次发送。")
|
||||
return false
|
||||
}
|
||||
|
||||
this.$confirm('您确定要发送吗, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(()=>{
|
||||
this.$axios
|
||||
.post("/platform/sys/msg/addDo", {
|
||||
msg: JSON.stringify(this.formData),
|
||||
users: JSON.stringify(loginNames)
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.parentDoSearch()
|
||||
this.back()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageData()
|
||||
},
|
||||
pageNumberChange(val) {
|
||||
this.pageForm.pageNumber = val
|
||||
this.pageData()
|
||||
},
|
||||
pageSizeChange(val) {
|
||||
this.pageForm.pageSize = val
|
||||
this.pageData()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectUsers = val
|
||||
},
|
||||
initAdd() {
|
||||
this.formData = {
|
||||
id: "",
|
||||
type: "user",
|
||||
needBack: false
|
||||
}
|
||||
if (this.$refs["addForm"]) this.$refs["addForm"].resetFields()
|
||||
},
|
||||
openSelect: function () {
|
||||
this.selectDialogVisible = true
|
||||
this.pageData()
|
||||
},
|
||||
clearSelect() {
|
||||
this.userTableData = []
|
||||
if(this.$refs.tableRef){
|
||||
this.$refs.tableRef.clearSelection()
|
||||
}
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post("/platform/sys/msg/user_data", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
},
|
||||
doSelect() {
|
||||
const self = this
|
||||
console.log(this.selectUsers)
|
||||
console.log(this.userTableData)
|
||||
const tableLoginNames = this.userTableData.map(v=>v.loginname)
|
||||
this.selectUsers.forEach(function (o) {
|
||||
if(!tableLoginNames.includes(o.loginname)){
|
||||
self.userTableData.push(o)
|
||||
}
|
||||
})
|
||||
if(this.$refs.tableRef){
|
||||
this.$refs.tableRef.clearSelection()
|
||||
}
|
||||
this.selectDialogVisible = false
|
||||
},
|
||||
async getRoleList() {
|
||||
const resp = await this.$axios.post("/platform/sys/msg/getRoleList")
|
||||
return resp.data
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.roleList = await this.getRoleList()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
const VIEW_USER_TEMPLATE = {
|
||||
template: `
|
||||
<div>
|
||||
<el-dialog :title="viewUserTitle" :visible.sync="viewDialogVisible" width="65%" top="2%">
|
||||
<div class="btn-group tool-button">
|
||||
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" size="small" @keyup.enter.native="doSearch" style="width: 300px">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 80px">
|
||||
<el-option label="工号" value="u.loginname"></el-option>
|
||||
<el-option label="姓名" value="u.username"></el-option>
|
||||
<el-option label="手机" value="u.mobile"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
<el-select v-model="pageForm.unionId" @change="flushUnits" @clear="flushUnits" placeholder="请选择所属工会" size="small" filterable clearable>
|
||||
<el-option v-for="item in unionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="pageForm.unitId" placeholder="请选择所属单位" size="small" filterable clearable>
|
||||
<el-option v-for="item in unitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button icon="el-icon-search" @click="doSearch" size="small" type="primary"></el-button>
|
||||
</div>
|
||||
<div class="left-span-label mt20">{{viewUserTitle}}列表</div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%; margin-top: 10px; margin-bottom: 10px"
|
||||
size="small"
|
||||
>
|
||||
<el-table-column fixed prop="loginname" label="工号" width="150"></el-table-column>
|
||||
<el-table-column prop="username" label="姓名" width="120"></el-table-column>
|
||||
<el-table-column prop="sex" label="性别" width="120"></el-table-column>
|
||||
<el-table-column prop="mobile" label="联系方式"></el-table-column>
|
||||
<el-table-column prop="unitName" label="所属单位"></el-table-column>
|
||||
<el-table-column prop="unionName" label="所属工会"></el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="viewDialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
`,
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
unionList: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
unitList: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewUserTitle: "",
|
||||
viewDialogVisible: false,
|
||||
tableData: [],
|
||||
pageForm: {
|
||||
searchName: "u.username",
|
||||
searchKeyword: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.unitList = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
this.doSearch()
|
||||
},
|
||||
open() {
|
||||
this.viewDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
if ("all" === this.type) {
|
||||
this.viewUserTitle = "全部用户"
|
||||
}
|
||||
if ("unread" === this.type) {
|
||||
this.viewUserTitle = "未读用户"
|
||||
}
|
||||
this.pageForm.type = this.type
|
||||
this.pageForm.id = this.id
|
||||
this.doSearch()
|
||||
})
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageData()
|
||||
},
|
||||
pageNumberChange(val) {
|
||||
this.pageForm.pageNumber = val
|
||||
this.pageData()
|
||||
},
|
||||
pageSizeChange(val) {
|
||||
this.pageForm.pageSize = val
|
||||
this.pageData()
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post("/platform/sys/msg/user_view_data", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style></style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="消息类型">
|
||||
<el-select clearable placeholder="请选择消息类型" v-model="pageForm.searchType" style="width: 100%" @change="getMsg">
|
||||
<el-option label="全部类型消息" value="all"></el-option>
|
||||
<el-option label="系统消息" value="system"></el-option>
|
||||
<el-option label="用户消息" value="user"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="消息标题">
|
||||
<el-select placeholder="请选择消息标题" v-model="pageForm.msgId" style="width: 100%" @change="doSearch">
|
||||
<el-option v-for="item in msgOptions" :key="item.id" :label="item.title" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="状态">
|
||||
<el-select placeholder="请选择状态" v-model="pageForm.readStatus" style="width: 100%" @change="doSearch">
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<el-option label="未阅读" :value="0"></el-option>
|
||||
<el-option label="已阅读未反馈" :value="1"></el-option>
|
||||
<el-option label="已阅读无需反馈" :value="2"></el-option>
|
||||
<el-option label="已阅读已反馈" :value="3"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="姓名/工号">
|
||||
<el-input placeholder="请输入姓名或工号" v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch" clearable>
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 80px">
|
||||
<el-option label="工号" value="mu.loginname"></el-option>
|
||||
<el-option label="姓名" value="mu.userName"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select v-model="pageForm.unionId" @change="flushUnits" @clear="flushUnits" placeholder="请选择所属工会" filterable clearable>
|
||||
<el-option v-for="item in unionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select v-model="pageForm.unitId" placeholder="请选择所属单位" filterable clearable @change="doSearch">
|
||||
<el-option v-for="item in unitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="人员列表">
|
||||
<el-button type="primary" @click="exportMultipleAsZip" size="small">导出压缩包</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" size="small" style="width: 100%">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
|
||||
<el-table-column prop="userName" label="姓名"></el-table-column>
|
||||
<el-table-column prop="loginname" label="工号"></el-table-column>
|
||||
<!-- <el-table-column prop="sex" label="性别"></el-table-column>-->
|
||||
<!-- <el-table-column prop="mobile" label="联系方式"></el-table-column>-->
|
||||
<el-table-column prop="unitName" label="所属单位"></el-table-column>
|
||||
<el-table-column prop="unionName" label="所属工会"></el-table-column>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template v-slot="scope">
|
||||
<el-tag size="mini" v-if="0 === scope.row.status">未阅读</el-tag>
|
||||
<el-tag size="mini" type="warning" v-else-if="1 === scope.row.status && scope.row.needBack">已阅读未反馈</el-tag>
|
||||
<el-tag size="mini" type="success" v-else-if="1 === scope.row.status && !scope.row.needBack">已阅读无需反馈</el-tag>
|
||||
<el-tag size="mini" v-else-if="2 === scope.row.status">已阅读已反馈</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="backFiles" label="反馈附件">
|
||||
<template v-slot="scope">
|
||||
<el-link type="primary" v-if="scope.row.backFiles.length > 0" @click="viewFiles(scope.row)">点击查看</el-link>
|
||||
<el-link type="info" v-else>暂无</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
<el-dialog :visible.sync="backDialogVisible" title="反馈附件" width="40%" top="2%">
|
||||
<div style="width: 100%; text-align: center">
|
||||
<file-preview :files="backFiles" complete_result></file-preview>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
backDialogVisible: false,
|
||||
backFiles: [],
|
||||
backFormData: {},
|
||||
|
||||
msgOptions: [],
|
||||
pageForm: {
|
||||
searchType: "all",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: "",
|
||||
searchName: "mu.userName",
|
||||
readType: null
|
||||
},
|
||||
unionList: [],
|
||||
unitList: []
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
exportMultipleAsZip() {
|
||||
this.$downLoad(loc() + "/exportMultipleAsZip", this.pageForm)
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.unitList = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||
this.unitList = data
|
||||
})
|
||||
}
|
||||
this.doSearch()
|
||||
},
|
||||
viewFiles(row) {
|
||||
this.backFiles = row.backFiles
|
||||
this.backDialogVisible = true
|
||||
},
|
||||
async getMsg() {
|
||||
const resp = await this.$axios.post("/platform/sys/msg/summary/getMsg", { searchType: this.pageForm.searchType })
|
||||
this.msgOptions = resp.data
|
||||
if (this.msgOptions && this.msgOptions.length > 0) {
|
||||
this.pageForm.msgId = this.msgOptions[0].id
|
||||
}
|
||||
},
|
||||
async pageData() {
|
||||
const resp = await this.$axios.post("/platform/sys/msg/summary/pageData", this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data.list
|
||||
this.tableData.forEach((item) => {
|
||||
item.backFiles = item.backFiles ? JSON.parse(item.backFiles) : []
|
||||
})
|
||||
this.pageForm.totalCount = resp.data.totalCount
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getMsg()
|
||||
const isAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
|
||||
if (isAdmin) {
|
||||
this.$businessTool.listUnion(this.pageForm.unionId).then((data) => {
|
||||
this.unionList = data
|
||||
})
|
||||
} else {
|
||||
this.$businessTool.listUnion(this.$store.state.user.union.id).then((data) => {
|
||||
this.unionList = data
|
||||
})
|
||||
}
|
||||
this.unitList = await this.$businessTool.listUnit()
|
||||
await this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,35 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<header class="header navbar bg-white shadow">
|
||||
<div class="btn-group tool-button m5">
|
||||
<a class="el-button el-button--default el-button--medium" href="${base}/platform/sys/msg/user/all" data-pjax>
|
||||
<i class="ti-angle-left"></i>
|
||||
返回
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="content-wrap">
|
||||
<div class="wrapper" style="min-height: 500px">
|
||||
<section class="panel">
|
||||
<div class="row mb10">
|
||||
<div class="col-lg-12">
|
||||
<!--#if(!isEmpty(obj)){#-->
|
||||
<div style="text-align: center">
|
||||
<h4>${obj.title!}</h4>
|
||||
</div>
|
||||
<div style="text-align: center; font-size: 14px; line-height: 24px">${@date.getDate(obj.sendAt)}</div>
|
||||
<div style="margin-top: 16px !important; border-bottom: 1px solid #ddd"></div>
|
||||
<div style="margin-top: 16px !important">${obj.note!}</div>
|
||||
<!--#}else{#-->
|
||||
消息不存在,或您没有阅读权限!
|
||||
<!--#}#-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,35 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<header class="header navbar bg-white shadow">
|
||||
<div class="btn-group tool-button m5">
|
||||
<a class="el-button el-button--default el-button--medium" href="${base}/platform/sys/msg/user/read" data-pjax>
|
||||
<i class="ti-angle-left"></i>
|
||||
返回
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="content-wrap">
|
||||
<div class="wrapper" style="min-height: 500px">
|
||||
<section class="panel">
|
||||
<div class="row mb10">
|
||||
<div class="col-lg-12">
|
||||
<!--#if(!isEmpty(obj)){#-->
|
||||
<div style="text-align: center">
|
||||
<h4>${obj.title!}</h4>
|
||||
</div>
|
||||
<div style="text-align: center; font-size: 14px; line-height: 24px">${@date.getDate(obj.sendAt)}</div>
|
||||
<div style="margin-top: 16px !important; border-bottom: 1px solid #ddd"></div>
|
||||
<div style="margin-top: 16px !important">${obj.note!}</div>
|
||||
<!--#}else{#-->
|
||||
消息不存在,或您没有阅读权限!
|
||||
<!--#}#-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,35 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<header class="header navbar bg-white shadow">
|
||||
<div class="btn-group tool-button m5">
|
||||
<a class="el-button el-button--default el-button--medium" href="${base}/platform/sys/msg/user/unread" data-pjax>
|
||||
<i class="ti-angle-left"></i>
|
||||
返回
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="content-wrap">
|
||||
<div class="wrapper" style="min-height: 500px">
|
||||
<section class="panel">
|
||||
<div class="row mb10">
|
||||
<div class="col-lg-12">
|
||||
<!--#if(!isEmpty(obj)){#-->
|
||||
<div style="text-align: center">
|
||||
<h4>${obj.title!}</h4>
|
||||
</div>
|
||||
<div style="text-align: center; font-size: 14px; line-height: 24px">${@date.getDate(obj.sendAt)}</div>
|
||||
<div style="margin-top: 16px !important; border-bottom: 1px solid #ddd"></div>
|
||||
<div style="margin-top: 16px !important">${obj.note!}</div>
|
||||
<!--#}else{#-->
|
||||
消息不存在,或您没有阅读权限!
|
||||
<!--#}#-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,202 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-msg-active {
|
||||
background-color: #546478;
|
||||
color: #ffffff;
|
||||
}
|
||||
</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="all"></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 shadow="never">
|
||||
<table-tool label="消息列表">
|
||||
<el-radio-group v-model="pageForm.status" @change="doSearch" size="small">
|
||||
<el-radio-button label="all">全部消息</el-radio-button>
|
||||
<el-radio-button label="read">已读消息</el-radio-button>
|
||||
<el-radio-button label="unread">未读消息</el-radio-button>
|
||||
</el-radio-group>
|
||||
</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 prop="type" label="消息类型" width="120">
|
||||
<template v-slot="scope">
|
||||
<span v-if="'system'===scope.row.type">系统消息</span>
|
||||
<span v-if="'user'===scope.row.type">用户消息</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="title" label="标题" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="createdAt" label="接收时间">
|
||||
<template slot-scope="scope">{{$moment(scope.row.createdAt).format("YYYY-MM-DD HH:mm:ss")}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template v-slot="scope">
|
||||
<el-tag size="mini" v-if="0 === scope.row.status">未阅读</el-tag>
|
||||
<el-tag size="mini" type="warning" v-else-if="1 === scope.row.status && scope.row.needBack">已阅读未反馈</el-tag>
|
||||
<el-tag size="mini" type="success" v-else-if="1 === scope.row.status && !scope.row.needBack">已阅读无需反馈</el-tag>
|
||||
<el-tag size="mini" v-else-if="2 === scope.row.status">已阅读已反馈</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="backFiles" label="反馈附件">
|
||||
<template v-slot="scope">
|
||||
<el-link type="primary" v-if="scope.row.backFiles.length > 0" @click="viewFiles(scope.row)">点击查看</el-link>
|
||||
<el-link type="info" v-else>暂无</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="primary" @click="openView(scope.row)">查看</el-button>
|
||||
<el-button v-if="scope.row.needBack" size="mini" type="primary" @click="openBack(scope.row)">反馈</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
<template #view>
|
||||
<div style="text-align: center">
|
||||
<h4>{{viewData.title}}</h4>
|
||||
</div>
|
||||
<div style="text-align: center; font-size: 14px; line-height: 24px">{{$moment(viewData.createdAt).format('YYYY-MM-DD HH:mm')}}</div>
|
||||
<div style="margin-top: 16px !important; border-bottom: 1px solid #ddd"></div>
|
||||
<div style="margin-top: 16px !important;" v-html="viewData.note"></div>
|
||||
<file-preview complete_result :files="viewData.files"></file-preview>
|
||||
</template>
|
||||
</guava>
|
||||
<el-dialog :visible.sync="backDialogVisible" title="反馈附件" width="40%" top="2%">
|
||||
<el-form v-model="backFormData" ref="backFormRef" label-width="80px">
|
||||
<el-form-item label="反馈附件" prop="files">
|
||||
<file-upload
|
||||
v-if="isViewFiles === false"
|
||||
:value.sync="backFormData.files"
|
||||
upload_mode="drag"
|
||||
:upload_number="5"
|
||||
upload_result_category="array"
|
||||
complete_result
|
||||
upload_mode="file"
|
||||
></file-upload>
|
||||
<div v-else style="width: 100%; text-align: center">
|
||||
<file-preview :files="backFormData.files" complete_result></file-preview>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="反馈内容" prop="backText">
|
||||
<el-input v-model="backFormData.backText" type="textarea" :rows="4" placeholder="非必填" max="500" :readonly="isViewFiles"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer" v-if="isViewFiles === false">
|
||||
<el-button @click="backDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="backDo">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data: function () {
|
||||
return {
|
||||
backFormData: {},
|
||||
backFiles: [],
|
||||
backDialogVisible: false,
|
||||
viewData: {},
|
||||
tableData: [],
|
||||
pageForm: {
|
||||
searchType: "all",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: "",
|
||||
status: "unread"
|
||||
},
|
||||
isViewFiles: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
viewFiles(row) {
|
||||
this.isViewFiles = true
|
||||
this.backFormData = {
|
||||
files: row.backFiles,
|
||||
backText: row.backText
|
||||
}
|
||||
this.backDialogVisible = true
|
||||
},
|
||||
async backDo() {
|
||||
if (this.backFormData.files.length === 0) {
|
||||
this.$message.warning("请上传反馈附件")
|
||||
return
|
||||
}
|
||||
|
||||
const resp = await this.$axios.post("/platform/sys/msg/user/backDo", {
|
||||
id: this.backFormData.id,
|
||||
backText: this.backFormData.backText,
|
||||
files: JSON.stringify(this.backFormData.files)
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.doSearch()
|
||||
this.backDialogVisible = false
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
},
|
||||
async openView(row) {
|
||||
const resp = await this.$axios.post("/platform/sys/msg/user/findOne", { id: row.msgId })
|
||||
this.viewData = resp.data
|
||||
this.$refs.guava.view()
|
||||
this.pageData()
|
||||
window.webSocketPubSub.send(
|
||||
JSON.stringify({
|
||||
room: store.state.room,
|
||||
action: "getMessage"
|
||||
})
|
||||
)
|
||||
},
|
||||
openBack(row) {
|
||||
this.isViewFiles = false
|
||||
this.backFormData = {
|
||||
files: row.backFiles,
|
||||
backText: row.backText,
|
||||
id: row.id
|
||||
}
|
||||
this.backDialogVisible = true
|
||||
},
|
||||
async pageData() {
|
||||
const resp = await this.$axios.post("/platform/sys/msg/user/data/" + this.pageForm.status, this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data.list
|
||||
this.tableData.forEach((item) => {
|
||||
item.backFiles = item.backFiles ? JSON.parse(item.backFiles) : []
|
||||
})
|
||||
this.pageForm.totalCount = resp.data.totalCount
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
},
|
||||
formatAt: function (val) {
|
||||
if (val && val > 0) return this.$moment(val).format("YYYY-MM-DD HH:mm")
|
||||
return ""
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.pageForm.searchType = GetQueryString("type") ? GetQueryString("type") : "all"
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,209 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-msg-active {
|
||||
background-color: #546478;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/read"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'all'==pageForm.searchType}"
|
||||
>
|
||||
全部类型消息
|
||||
</a>
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/read?type=system"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'system'==pageForm.searchType}"
|
||||
>
|
||||
系统消息
|
||||
<span v-if="unreadnum.system>0">({{unreadnum.system}})</span>
|
||||
</a>
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/read?type=user"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'user'==pageForm.searchType}"
|
||||
>
|
||||
用户消息
|
||||
<span v-if="unreadnum.user>0">({{unreadnum.user}})</span>
|
||||
</a>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
@sort-change="pageOrder"
|
||||
size="small"
|
||||
header-align="center"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="35"></el-table-column>
|
||||
<el-table-column prop="status" width="45">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="0==scope.row.status"><i class="fa fa-circle text-info ml5"></i></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="消息类型" header-align="center" align="center" width="120">
|
||||
<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 prop="title" label="标题" header-align="center" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<a :href="'${base}/platform/sys/msg/user/read/detail/'+scope.row.msgid" data-pjax>{{scope.row.title}}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="opat" label="接收时间" header-align="center" align="center">
|
||||
<template slot-scope="scope">{{formatAt(scope.row.opat)}}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row class="el-pagination-container">
|
||||
<el-pagination
|
||||
style="float: left"
|
||||
@size-change="pageSizeChange"
|
||||
@current-change="pageNumberChange"
|
||||
:current-page="pageForm.pageNumber"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:page-size="pageForm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pageForm.totalCount"
|
||||
></el-pagination>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data: function () {
|
||||
return {
|
||||
addDialogVisible: false,
|
||||
editDialogVisible: false,
|
||||
selectDialogVisible: false,
|
||||
viewDialogVisible: false,
|
||||
tableData: [],
|
||||
pageForm: {
|
||||
searchType: "${type!}",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "createdAt",
|
||||
pageOrderBy: "descending"
|
||||
},
|
||||
formData: {
|
||||
id: "",
|
||||
type: "system"
|
||||
},
|
||||
selectData: [],
|
||||
unreadnum: {
|
||||
system: 0,
|
||||
user: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pageOrder: function (column) {
|
||||
//按字段排序
|
||||
this.pageForm.pageOrderName = column.prop
|
||||
this.pageForm.pageOrderBy = column.order
|
||||
this.pageData()
|
||||
},
|
||||
pageNumberChange: function (val) {
|
||||
//页码更新操作
|
||||
this.pageForm.pageNumber = val
|
||||
this.pageData()
|
||||
},
|
||||
pageSizeChange: function (val) {
|
||||
//分页大小更新操作
|
||||
this.pageForm.pageSize = val
|
||||
this.pageData()
|
||||
},
|
||||
pageData: function () {
|
||||
//加载分页数据
|
||||
var self = this
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/data/read",
|
||||
self.pageForm,
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.tableData = data.data.list
|
||||
self.pageForm.totalCount = data.data.totalCount
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
},
|
||||
formatAt: function (val) {
|
||||
if (val && val > 0) return moment(val).format("YYYY-MM-DD HH:mm")
|
||||
return ""
|
||||
},
|
||||
handleSelectionChange: function (val) {
|
||||
this.selectData = val
|
||||
},
|
||||
delMore: function () {
|
||||
var self = this
|
||||
if (self.selectData.length == 0) {
|
||||
self.$message({
|
||||
message: "请选择消息",
|
||||
type: "warning"
|
||||
})
|
||||
return false
|
||||
}
|
||||
var ids = []
|
||||
self.selectData.forEach(function (val) {
|
||||
ids.push(val.id)
|
||||
})
|
||||
self.$confirm("您确定要删除选中的 " + ids.length + " 条消息? ", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: function (a, b) {
|
||||
if ("confirm" == a) {
|
||||
//确认后再执行
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/delete",
|
||||
{ ids: ids.toString() },
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "success"
|
||||
})
|
||||
self.pageData()
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,302 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-msg-active {
|
||||
background-color: #546478;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/unread"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'all'==pageForm.searchType}"
|
||||
>
|
||||
全部类型消息
|
||||
</a>
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/unread?type=system"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'system'==pageForm.searchType}"
|
||||
>
|
||||
系统消息
|
||||
<span v-if="unreadnum.system>0">({{unreadnum.system}})</span>
|
||||
</a>
|
||||
<a
|
||||
href="${base}/platform/sys/msg/user/unread?type=user"
|
||||
data-pjax
|
||||
class="el-button el-button--default el-button--medium"
|
||||
:class="{'el-msg-active':'user'==pageForm.searchType}"
|
||||
>
|
||||
用户消息
|
||||
<span v-if="unreadnum.user>0">({{unreadnum.user}})</span>
|
||||
</a>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
@sort-change="pageOrder"
|
||||
size="small"
|
||||
header-align="center"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="35"></el-table-column>
|
||||
<el-table-column prop="status" width="45">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="0==scope.row.status"><i class="fa fa-circle text-info ml5"></i></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="消息类型" header-align="center" align="center" width="120">
|
||||
<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 prop="title" label="标题" header-align="center" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<a :href="'${base}/platform/sys/msg/user/unread/detail/'+scope.row.msgid" data-pjax>{{scope.row.title}}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="opat" label="接收时间" header-align="center" align="center">
|
||||
<template slot-scope="scope">{{formatAt(scope.row.opat)}}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-row class="el-pagination-container">
|
||||
<el-pagination
|
||||
style="float: left"
|
||||
@size-change="pageSizeChange"
|
||||
@current-change="pageNumberChange"
|
||||
:current-page="pageForm.pageNumber"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:page-size="pageForm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pageForm.totalCount"
|
||||
></el-pagination>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data: function () {
|
||||
return {
|
||||
addDialogVisible: false,
|
||||
editDialogVisible: false,
|
||||
selectDialogVisible: false,
|
||||
viewDialogVisible: false,
|
||||
tableData: [],
|
||||
pageForm: {
|
||||
searchType: "${type!}",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "createdAt",
|
||||
pageOrderBy: "descending"
|
||||
},
|
||||
formData: {
|
||||
id: "",
|
||||
type: "system"
|
||||
},
|
||||
selectData: [],
|
||||
unreadnum: {
|
||||
system: 0,
|
||||
user: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pageOrder: function (column) {
|
||||
//按字段排序
|
||||
this.pageForm.pageOrderName = column.prop
|
||||
this.pageForm.pageOrderBy = column.order
|
||||
this.pageData()
|
||||
},
|
||||
pageNumberChange: function (val) {
|
||||
//页码更新操作
|
||||
this.pageForm.pageNumber = val
|
||||
this.pageData()
|
||||
},
|
||||
pageSizeChange: function (val) {
|
||||
//分页大小更新操作
|
||||
this.pageForm.pageSize = val
|
||||
this.pageData()
|
||||
},
|
||||
pageData: function () {
|
||||
//加载分页数据
|
||||
var self = this
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/data/unread",
|
||||
self.pageForm,
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.tableData = data.data.list
|
||||
self.pageForm.totalCount = data.data.totalCount
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
},
|
||||
formatAt: function (val) {
|
||||
if (val && val > 0) return moment(val).format("YYYY-MM-DD HH:mm")
|
||||
return ""
|
||||
},
|
||||
handleSelectionChange: function (val) {
|
||||
this.selectData = val
|
||||
},
|
||||
unreadData: function () {
|
||||
//加载分页数据
|
||||
var self = this
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/unread_num",
|
||||
{},
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.unreadnum = data.data
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
},
|
||||
readMore: function () {
|
||||
var self = this
|
||||
if (self.selectData.length == 0) {
|
||||
self.$message({
|
||||
message: "请选择消息",
|
||||
type: "warning"
|
||||
})
|
||||
return false
|
||||
}
|
||||
var ids = []
|
||||
self.selectData.forEach(function (val) {
|
||||
ids.push(val.id)
|
||||
})
|
||||
self.$confirm("您确定要标记选中的 " + ids.length + " 条消息为已读吗? ", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: function (a, b) {
|
||||
if ("confirm" == a) {
|
||||
//确认后再执行
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/status/read",
|
||||
{ ids: ids.toString() },
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "success"
|
||||
})
|
||||
self.pageData()
|
||||
self.unreadData()
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
readAll: function () {
|
||||
var self = this
|
||||
self.$confirm("您确定要标记全部消息为已读吗? ", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: function (a, b) {
|
||||
if ("confirm" == a) {
|
||||
//确认后再执行
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/status/readAll",
|
||||
{},
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "success"
|
||||
})
|
||||
self.pageData()
|
||||
self.unreadData()
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
delMore: function () {
|
||||
var self = this
|
||||
if (self.selectData.length == 0) {
|
||||
self.$message({
|
||||
message: "请选择消息",
|
||||
type: "warning"
|
||||
})
|
||||
return false
|
||||
}
|
||||
var ids = []
|
||||
self.selectData.forEach(function (val) {
|
||||
ids.push(val.id)
|
||||
})
|
||||
self.$confirm("您确定要删除选中的 " + ids.length + " 条消息? ", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: function (a, b) {
|
||||
if ("confirm" == a) {
|
||||
//确认后再执行
|
||||
$.post(
|
||||
base + "/platform/sys/msg/user/delete",
|
||||
{ ids: ids.toString() },
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "success"
|
||||
})
|
||||
self.pageData()
|
||||
self.unreadData()
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.pageData()
|
||||
this.unreadData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user