Files
UNION_HUTB/target/classes/views/platform/msgNotify/send.html
T
2026-09-09 09:14:28 +08:00

245 lines
8.6 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-card__body {
width: 70%;
margin: 0 auto;
}
.card {
height: 100%;
}
.transition-item {
height: 100%;
}
.el-card {
overflow-y: auto;
height: 100%;
}
.el-select-dropdown el-popper is-multiple {
z-index: 1 !important;
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<template #header>
<el-row type="flex">
<el-col :span="12" v-if="notify_id">
<el-button @click="location.replace('/platform/msgNotifyTitle/list')" icon="el-icon-back"
style="font-size: 16px" type="text">返回
</el-button>
</el-col>
<el-col :span="12" class="text-right">
<h3 style="color: rgb(24, 103, 176);">{{h3Title}}</h3>
</el-col>
</el-row>
</template>
<msg-notify :hold="hold" :notify_id="notify_id" ref="a" v-model="msgData"></msg-notify>
<div style="text-align: right" v-if="!hold">
<el-button type="primary" @click="doAdd(false)">保 存</el-button>
<el-button type="primary" @click="doAdd(true)">发 送</el-button>
</div>
</el-card>
</guava>
</div>
<script>
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
contentList: [
// {id: "3cddb3bd15974d91baf82b3c59d07abe", name: "XX老师,喜气卷地百花开,千福万福道贺来!祝您新婚快乐!——校工会"},
{id: "9e92d6f686974ce7b5055e0f3a98d4b4", name: "XX老师,悉知亲人离世,望节哀顺变。保重身体。—校工会"}
],
h3Title: "新建消息",
msgData: {
type: "",
sendTypes: []
},
formData: {
type: "",
sendTypes: []
},
menuOptions: [],
activityGroupList: [],
notify_id: "",
holdAdd: false,
hold: false,
users: [],
selections: [],
selectUsers: [],
active: 0,
meetingOptions: [],
roleList: [],
pageForm: {
searchName: 'username'
},
pageForm1: {
groupId: "",
searchName: 'u.username',
pageNumber: 1,
pageSize: 5,
totalCount: 0,
},
formRules: {
title: [{required: true, message: '请输入发送标题', trigger: ['blur', 'change']}],
sendTypes: [{required: true, message: '请输入发送方式', trigger: ['blur', 'change']}],
content: [{required: true, message: '请输入发送内容', trigger: ['blur', 'change']}],
}
}
},
components: {
'msg-notify': httpVueLoader('/components/msgNotify/msgNotify.vue'),
},
methods: {
pageSizeChange1(val) {
this.pageForm1.pageSize = val;
if (this.formData.roleIds.length > 0) {
this.changeRole();
} else if (this.formData.activityGroupId != "") {
this.getActivityUserData()
} else {
this.getUsersByTitleId(this.formData.id)
}
},
pageNumberChange1(val) {
this.pageForm1.pageNumber = val;
if (this.formData.roleIds.length > 0) {
this.changeRole();
} else if (this.formData.activityGroupId != "") {
this.getActivityUserData()
} else {
this.getUsersByTitleId(this.formData.id)
}
},
async changeRole() {
const data = await $.post(loc() + "/getUserByRoleId", {
roleIds: JSON.stringify(this.formData.roleIds),
module: this.formData.module,
teacherMeetingId: this.formData.teacherMeetingId,
pageSize: this.pageForm1.pageSize,
pageNumber: this.pageForm1.pageNumber,
searchName: this.pageForm1.searchName,
searchKeyword: this.pageForm1.searchKeyword
})
this.users = data.data.list;
this.pageForm1.totalCount = data.data.totalCount;
},
addUser() {
this.users = this.users.concat(this.selectUsers)
this.selectDialogVisible = false;
},
async openSelect() {
this.pageData(this.users)
this.selectDialogVisible = true
},
async doAdd(flag) {
this.formData = this.msgData
if (this.formData.users && this.formData.users.length === 0) {
this.$notify.warning('请选择需要发送的人员')
return
}
let aa = "保存此条消息吗?"
if (flag) {
if (!this.formData.contentId){
this.$notify.warning('请选择模板在发送')
return
}
const content = this.contentList.find(v => v.id === this.formData.contentId)
aa = "发送【" + content.name + "】模板消息吗?"
}
const confirm = await this.$confirm('您确定要' + aa, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm) {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
let aa = ((!flag && this.formData.id) || (flag && this.formData.id)) ? "/doEdit" : "/doAdd"
const resp = await $.post(loc() + aa, {
msgNotify: JSON.stringify(this.formData),
users: JSON.stringify(this.formData.users.length > 0 ? this.formData.users.map(v => v.id) : this.formData.users),
flag: flag
})
if (resp.code === 0) {
this.$notify.success(resp.msg)
sublime.jumpPagePjax('/platform/msgNotifyTitle/list')
} else {
this.$notify.error(resp.msg)
}
loading.close()
}
},
pageData() {
sublime.showLoadingbar();
this.tableLoading = true
const pageForm = clone(this.pageForm)
pageForm.users = JSON.stringify(this.users.map(v => v.id))
$.post(loc() + "/pageData", pageForm, (data) => {
sublime.closeLoadingbar();
this.tableLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
},
async getMenuOptions() {
const {data} = await $.get("/platform/sys/role/getMenuOptions")
this.menuOptions = data
if (!this.formData.id) {
this.$set(this.formData, "roleIds", [])
this.$set(this, "users", [])
}
}
},
async created() {
this.meetingOptions = await proposal.getOpenMeeting()
await this.getMenuOptions()
this.notify_id = GetQueryString("notifyId")
if (this.notify_id) {
this.hold = GetQueryString("hold")
this.h3Title = this.hold === "true" ? "查看消息" : "编辑消息"
this.hold = this.hold !== 'false'
}
}
})
</script>
<!--#
}
#-->