diff --git a/src/views/system/notifyManage/index.vue b/src/views/system/notifyManage/index.vue index 164573d..630a7d0 100644 --- a/src/views/system/notifyManage/index.vue +++ b/src/views/system/notifyManage/index.vue @@ -54,7 +54,7 @@
- + 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 }