Browse Source

通知管理 创建通知test

master
x_ying 3 years ago
parent
commit
491902586b
  1. 62
      src/views/system/notifyManage/index.vue

62
src/views/system/notifyManage/index.vue

@ -54,7 +54,7 @@
<div class="setting-dialog">
<el-form ref="formDom" :rules="rules" :model="sendForm" size="small" label-width="80px" style="margin-left:85px">
<el-form-item label="消息类型" prop="msgType" class="down-select">
<el-select v-model="sendForm.msgType" placeholder="请选择" style="width:315px">
<el-select v-model="noticeType" placeholder="请选择" style="width:315px">
<el-option
v-for="item in msgTypeOptions"
:key="item.name"
@ -103,23 +103,12 @@
<script>
import { presenter, crud } from '@crud/crud'
// import pagination from '@crud/Pagination'
import { getAllDev, getAllUser, getNoticeList } from '@/api/system/logs'
import { noticeCreate, getAllDev, getAllUser, getNoticeList } from '@/api/system/logs'
export default {
name: 'NotifyManage',
// components: { pagination },
mixins: [presenter(), crud()],
// cruds() {
// return CRUD({
// url: '/api/notice/list'
// // optShow: {
// // add: false,
// // edit: false,
// // del: false,
// // download: true
// // }
// })
// },
data() {
return {
tableData: [],
@ -127,15 +116,16 @@ export default {
sendVisible: false,
delVisible: false,
sendForm: {
msgType: 1,
// msgType: 1,
notification: '',
pushObj: '用户',
// pushObj: '',
sendObj: ['全选']
},
pushObj: '用户',
checked: '',
noticeType: '1',
msgTypeOptions: [
{ value: 1, label: '系统通知' }
{ value: '1', label: '系统通知' }
// { value: 2, label: '', disabled: true },
// { value: 3, label: '', disabled: true },
// { value: 4, label: '', disabled: true }
@ -160,9 +150,9 @@ export default {
oldSelect: null,
showTags: true,
rules: {
msgType: [
{ required: true, message: '请选择类型', trigger: 'blur' }
],
// msgType: [
// { required: true, message: '', trigger: 'blur' }
// ],
notification: [
{ required: true, message: '请填写内容', trigger: 'blur' }
],
@ -320,16 +310,32 @@ export default {
handleSave() {
this.$refs.formDom.validate((valid) => {
if (valid) {
// noticeCreate(params).then(res => {
// if (res === SUCCESS) {
// this.sendVisible = false
// this.$refs.formDom.resetFields()
// this.$refs.formDom.clearValidate()
// }
const params = {}
params.noticeType = this.noticeType
params.noticeContent = this.sendForm.notification
if (this.pushObj === '用户') {
params.pushType = 1
if (this.selectOptions.length === this.sendObjOptions.length) {
params.users = this.selectOptions.filter(item => item !== 0)
} else {
params.users = this.selectOptions
}
}
// params.users = params.users.map(item => {
// return item + ''
// })
this.sendVisible = false
this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate()
console.log(params, '--params')
noticeCreate(params).then(res => {
console.log(res, '===创建')
if (res === 'SUCCESS') {
this.sendVisible = false
this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate()
}
})
// this.sendVisible = false
// this.$refs.formDom.resetFields()
// this.$refs.formDom.clearValidate()
} else {
return false
}

Loading…
Cancel
Save