232 lines
7.8 KiB
HTML
232 lines
7.8 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>
|
|
var vue = new Vue({
|
|
el: "#app",
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
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
|
|
}
|
|
const confirm = await this.$confirm('您确定要' + (flag ? '发送' : '保存') + '消息吗?', '提示', {
|
|
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>
|
|
<!--#
|
|
}
|
|
#--> |