| | |
| | | '#4b9bb7', |
| | | '#09152f' |
| | | ] |
| | | |
| | | this.editor.config.onchange =(html)=>{ |
| | | |
| | | this.editor.config.onchange = (html)=>{ |
| | | // 第二步,监控变化,同步更新到 textarea |
| | | this.$emit('getMyBody',html); |
| | | this.$emit('getMyBody', html); |
| | | } |
| | | this.editor.create(); |
| | | this.editor.create(); |
| | | }, |
| | | beforeDestroy() { |
| | | this.editor.destroy(); |
| | |
| | | import { sendMessage, updateMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd,MyColView }, |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | | props: ['type', 'myDataRow'], |
| | | data() { |
| | | return { |
| | |
| | | <div class="createUser"> |
| | | <main> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules" |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="rules" |
| | | label-position="right"> |
| | | <!-- 消息栏目 --> |
| | | <el-form-item class="optionItem" label="短信模板:" prop="messageType"> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <span class="message-add" @click='dialogCreate = true'> 添加栏目</span> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息标题 --> |
| | |
| | | |
| | | <el-form-item> |
| | | <div class="optionBtn"> |
| | | <el-button type="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">发布 |
| | | </el-button> |
| | | <el-button messageType="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">发布</el-button> |
| | | <el-button class="btn cancel" @click.native.prevent="handleReset">重置</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 新增栏目 --> |
| | | <el-dialog title="添加栏目" :visible.sync="dialogCreate" v-if="dialogCreate" width="60%" |
| | | :before-close="handleConfirmClose" append-to-body> |
| | | <MyColumnAdd @closeDialog="closeDialog"></MyColumnAdd> |
| | | </el-dialog> |
| | | <!-- 预览消息 --> |
| | | <el-dialog title="消息预览" :visible.sync="dialogView" v-if="dialogView" width="60%" |
| | | :before-close="handleConfirmClose" append-to-body> |
| | | <MyColView :info="info" @closeDialog="closeDialog"></MyColView> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import MyEditor from '@/components/edit' |
| | | import { sendMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor }, |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写消息栏目")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (value.length !== 0) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请选择接收对象')); |
| | | } |
| | | }; |
| | | const validateMessageContent = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error('请输入短信内容')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | |
| | | return { |
| | | role: { |
| | | messageType: '', |
| | |
| | | targetTo: '', |
| | | targetFrom: null, |
| | | body: '', |
| | | channelCode: '01', |
| | | channelCode: '03' |
| | | }, |
| | | createRoleRules: { |
| | | rules: { |
| | | messageType: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | { required: true, trigger: ['blur', 'change'], message: '请选择短信模板' }, |
| | | ], |
| | | head: [ |
| | | { required: false, trigger: "blur", validator: validatePass }, |
| | | { required: true, trigger: "blur", message: '请输入短信标题' }, |
| | | ], |
| | | targetTo: [ |
| | | { required: false, trigger: "blur", validator: validateTruename }, |
| | | { required: true , trigger: "blur", message: '请选择接收人' }, |
| | | ], |
| | | body: [ |
| | | { required: true, trigger: ['blur', 'change'], validator: validateMessageContent } |
| | | ] |
| | | }, |
| | | colList: [], |
| | | departList: [], |
| | |
| | | dialogView: false, |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'departName', |
| | | // disabled: function (data, node) { |
| | | // if (data.createTime) { |
| | | // return !data.leaf |
| | | // } |
| | | // } |
| | | label: 'departName' |
| | | }, |
| | | checkedList: [], |
| | | tempNameArr:[], |
| | | info:{}, |
| | | info: {}, |
| | | sendUser:"" |
| | | } |
| | | }, |
| | |
| | | url: 'sccg/message_column/getAllColumn' |
| | | }) |
| | | .then(res => { |
| | | console.log(res); |
| | | arr = res.data; |
| | | }) |
| | | return arr; |
| | |
| | | // 处理部门树 |
| | | async filterDepartList() { |
| | | let arr = await this.getDepartList(); |
| | | const { setChildren } = this; |
| | | // console.log(setChildren); |
| | | arr.forEach(item => { |
| | | setChildren(item); |
| | | this.setChildren(item); |
| | | }) |
| | | return arr; |
| | | }, |
| | |
| | | }, |
| | | // 选中id |
| | | handleCheck(data, node) { |
| | | let arr = [],nameArr = [] |
| | | console.log(node.checkedNodes) |
| | | node.checkedNodes.forEach(item => { |
| | | if(!item.hasOwnProperty('departType')){ |
| | | arr.push(item.id) |
| | | nameArr.push(item.departName) |
| | | this.checkedList.push(item.id) |
| | | this.tempNameArr.push(item.departName) |
| | | } |
| | | }) |
| | | this.checkedList = arr |
| | | this.tempNameArr = nameArr |
| | | console.log(this.tempNameArr) |
| | | this.role.targetTo = arr.length + '人' |
| | | this.role.targetTo = this.checkedList.length + '人'; |
| | | }, |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { role, checkedList } = this; |
| | | console.log(checkedList); |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: 'sccg/message/sendMessage', |
| | | data: { |
| | | body: role.body, |
| | | channelCode: '03', |
| | | head: role.head, |
| | | messageType: role.messageType, |
| | | sendTime: new Date(), |
| | | targetTo: checkedList.join(','), |
| | | targetFrom: `${role.targetFrom}`, |
| | | status: mystatus, |
| | | } |
| | | }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: mystatus === 1 ? '发送成功' : '保存成功', |
| | | }) |
| | | this.$emit('closeMyDialog', { flag: false, index: 1 }); |
| | | } |
| | | }) |
| | | const params = Object.assign({}, this.role); |
| | | params.targetTo = this.checkedList.join(','); |
| | | params.targetFrom = this.sendUser; |
| | | params.status = mystatus; |
| | | sendMessage(params) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.$emit('closeDialog'); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | } else { |
| | | return false; |
| | | } |
| | |
| | | }, |
| | | // 获得消息体 |
| | | getMyBody(obj) { |
| | | console.log(obj); |
| | | this.role.body = obj; |
| | | }, |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | // this.$refs.edit.wangEditor.txt.html('<p><br></p>') |
| | | this.setDepartList(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | |
| | | handleView() { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { role,getColText,tempNameArr,sendUser } = this |
| | | this.dialogView = true; |
| | | let info = {} |
| | | // 获得栏目消息 |
| | | info.channelCode = role.channelCode === '01'? '站内信': role.channelCode === '02' ? '邮件':'短信' |
| | | info.messageType = getColText(role.messageType) |
| | | info.body = role.body |
| | | info.head = role.head |
| | | info.targetTo = tempNameArr |
| | | info.targetFrom = sendUser |
| | | this.info = info |
| | | this.info = { |
| | | messageType: this.getColText(role.messageType), |
| | | body: this.role.body, |
| | | head: this.role.head, |
| | | targetTo: this.tempNameArr, |
| | | targetFrom: this.sendUser |
| | | }; |
| | | } else { |
| | | return false |
| | | } |
| | |
| | | }, |
| | | // 获得栏目消息 |
| | | getColText(id){ |
| | | console.log(id) |
| | | const {colList} = this |
| | | let str = '' |
| | | colList.forEach(item=>{ |
| | |
| | | |
| | | main { |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | background-color: #09152f; |
| | | padding-bottom: 50px; |
| | | |
| | |
| | | <div class="mainContent"> |
| | | <div class="main-nav"> |
| | | <span>数据列表</span> |
| | | <el-button type="primary" icon="el-icon-plus" @click="dialogCreate = true">添加</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="isShowDialog = true">添加</el-button> |
| | | </div> |
| | | <!-- 数据展示 --> |
| | | <el-table ref="multipleTable" |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 新建消息 --> |
| | | <el-dialog title="新建消息" :visible.sync="dialogCreate" v-if="dialogCreate" width="80%" |
| | | <el-dialog title="新建消息" :visible.sync="isShowDialog" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <MyCreate @closeMyDialog="closeDialog"></MyCreate> |
| | | <MyCreate @closeMyDialog="closeDialog" :type="dialogType"></MyCreate> |
| | | </el-dialog> |
| | | <div class="tools"> |
| | | <div class="funs"> |
| | |
| | | </div> |
| | | <div class="pagination"> |
| | | <el-pagination background :current-page="currentPage" layout="prev, pager, next" |
| | | :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage" |
| | | > |
| | | :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage"> |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | |
| | | <script> |
| | | import helper from '@/utils/mydate' |
| | | import MyCreate from './createSms' |
| | | import SMS from "@/api/operate/SMS"; |
| | | import { getMessageList, deleteMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | tableData: [], |
| | | context: "", |
| | | dialogEdit:false, |
| | | dialogCreate: false, |
| | | isShowDialog: false, |
| | | dialogView: false, |
| | | totalNum: null, |
| | | pageSize: 10, |
| | |
| | | id:'03', |
| | | columnName:'短信', |
| | | } |
| | | ] |
| | | ], |
| | | dialogType: '' |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | handleReset(){ |
| | | |
| | | }, |
| | | // 查看 |
| | | handleView(data){ |
| | | this.info = data; |
| | | this.dialogView = true; |
| | | }, |
| | | // 编辑 |
| | | handleEdit(data){ |
| | | this.info = data; |
| | | this.dialogEdit = true; |
| | | }, |
| | | // 删除信息 |
| | | handleDelete(idarr) { |
| | | handleDelete(ids) { |
| | | this.$confirm('确认删除?') |
| | | .then(_ => { |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: 'sccg/message/delete?ids=' + idarr, |
| | | }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '删除成功', |
| | | }) |
| | | this.setTableData(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .then(() => { |
| | | deleteMessage(ids) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.getTableData(); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | }) |
| | | }, |
| | | |
| | | getTableData() { |
| | | SMS.getSMSTemplateList() |
| | | getMessageList() |
| | | .then(({ records, total }) => { |
| | | this.tableData = records; |
| | | this.totalNum = total; |
| | |
| | | }, |
| | | // 批量下拉框操作 |
| | | async selectChange(list) { |
| | | console.log(this.tempList); |
| | | if (this.tempList.length !== 0) { |
| | | this.preMyIdx = list; |
| | | if (list === 3) { |
| | |
| | | method: 'post', |
| | | url: 'sccg/role/updateStatusBatch?ids=' + idArr + '&status=' + flag, |
| | | }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '更改用户状态成功', |
| | | }) |
| | | this.getUserList(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: res.message |
| | | }) |
| | | } |
| | | console.log(res); |
| | | .then(() => { |
| | | this.getTableData(); |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ type: 'error', message: err }); |
| | | }) |
| | | }) |
| | | .catch(err => { console.log(err) }) |
| | |
| | | list.forEach(item => { |
| | | this.tempList.push(item.id); |
| | | }) |
| | | if (list.length === this.tableData.length) { |
| | | this.all = true; |
| | | } else { |
| | | this.all = false |
| | | } |
| | | this.all = list.length === this.tableData.length; |
| | | }, |
| | | // 修改时间格式 |
| | | changeTime({ updateTime }) { |
| | |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | if ((rowIndex + 1) % 2 === 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | }, |
| | | // 当前页改变触发事件 |
| | | changeCurrentPage(page) { |
| | | this.currentPage = page; |
| | | this.setTableData(); |
| | | }, |
| | | // 关闭弹窗 |
| | | handleClose(done) { |
| | | done(); |
| | | }, |
| | | // 确认关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | .then(_ => { |
| | | .then(()=> { |
| | | done(); |
| | | }) |
| | | .catch(err => { |
| | | console.log(err); |
| | | }) |
| | | }, |
| | | // 自定义关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | this.dialogView = flag; |
| | | if (index === 1) { |
| | | this.setTableData(); |
| | | } |
| | | closeDialog() { |
| | | this.isShowDialog = false; |
| | | this.getTableData(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | header { |
| | | background-color: #09152f; |
| | | border: 1pox solid #fff; |
| | | |
| | | .header-nav { |
| | | line-height: 40px; |
| | |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding-bottom: 50px; |
| | | border: 1pox solid #fff; |
| | | |
| | | .el-link { |
| | | color: #4b9bb7; |
| | |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules" |
| | | label-position="right"> |
| | | <!-- 消息栏目 --> |
| | | <el-form-item class="optionItem" label="模板类型:" prop="messageType"> |
| | | <el-form-item class="optionItem" label="模板类型:" prop="type"> |
| | | <div class="message-item"> |
| | | <div class="message-item__left"> |
| | | <el-select v-model="role.messageType" placeholder="请选择"> |
| | | <el-select v-model="role.type" placeholder="请选择"> |
| | | <el-option v-for="item in colList" :key="item.id" :label="item.columnName" |
| | | :value="item.id"> |
| | | </el-option> |
| | |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息标题 --> |
| | | <el-form-item class="optionItems" label="消息标题:" prop="head"> |
| | | <el-form-item class="optionItems" label="消息标题:" prop="title" :disabled="disabled"> |
| | | <div class="message-item__left"> |
| | | <el-input v-model="role.head" placeholder="请选择消息标题"></el-input> |
| | | <el-input v-model="role.title" placeholder="请选择消息标题"></el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 接收对象 --> |
| | | <!-- <el-form-item class="optionItem" label="接收对象:" prop="targetTo"> |
| | | <div class="message-item__left"> |
| | | <el-select v-model="role.targetTo" placeholder="请选择接收对象" > |
| | | <el-option :value="role.targetTo"> |
| | | <el-tree ref="tree" :data="departList" :props="defaultProps" show-checkbox |
| | | @check="handleCheck" default-expand-all node-key="id"> |
| | | </el-tree> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </el-form-item> --> |
| | | <!-- 消息内容 --> |
| | | <el-form-item class="optionItem" label="消息内容:" prop="body"> |
| | | <MyEditor ref="edit" @getMyBody="getMyBody"></MyEditor> |
| | | <!-- <el-input type="textarea" v-model="role.description" placeholder="请输入描述内容200字以内"></el-input> --> |
| | | <el-form-item class="optionItem" label="消息内容:" prop="body" :disabled="disabled"> |
| | | <MyEditor ref="edit" @getMyBody="getMyBody" ></MyEditor> |
| | | </el-form-item> |
| | | <!-- 提醒方式 --> |
| | | <!-- <el-form-item class="optionItem" label="提醒方式:" prop="channelCode"> |
| | | <el-radio-group v-model="role.channelCode"> |
| | | <el-radio label="01">站内信</el-radio> |
| | | <el-radio label="02">邮件</el-radio> |
| | | <el-radio label="03">短信</el-radio> |
| | | </el-radio-group> |
| | | <span class="message-tip">(短信可用数: 1000条)</span> |
| | | </el-form-item> --> |
| | | <el-form-item> |
| | | <div class="optionBtn"> |
| | | <el-button type="primary" @click.native.prevent="handleSubmit(0)" class="btn save">保存 |
| | | </el-button> |
| | | <!-- <el-button type="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">发布 |
| | | </el-button> |
| | | <el-button type="primary" @click.native.prevent="handleView" class="btn submit">预览 |
| | | </el-button> --> |
| | | <el-button class="btn cancel" @click.native.prevent="handleReset">重置</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 新增栏目 --> |
| | | <el-dialog title="添加栏目" :visible.sync="dialogCreate" v-if="dialogCreate" width="60%" |
| | | :before-close="handleConfirmClose" append-to-body> |
| | | <MyColumnAdd @closeDialog="closeDialog"></MyColumnAdd> |
| | | </el-dialog> |
| | | <!-- 预览消息 --> |
| | | <el-dialog title="消息预览" :visible.sync="dialogView" v-if="dialogView" width="60%" |
| | | :before-close="handleConfirmClose" append-to-body> |
| | | <MyColView :info="info" @closeDialog="closeDialog"></MyColView> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import MyEditor from '@/components/edit' |
| | | import MyEditor from '@/components/edit'; |
| | | import SMS from "@/api/operate/SMS"; |
| | | import { deepClone } from "@/utils/helper"; |
| | | |
| | | export default { |
| | | components: { MyEditor, }, |
| | | components: { MyEditor }, |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写消息栏目")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (value.length !== 0) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请选择接收对象')); |
| | | } |
| | | }; |
| | | const validateMessageContent = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error('请输入短信内容')) |
| | | } else { |
| | | this.$refs.user.clearValidate('body'); |
| | | } |
| | | } |
| | | return { |
| | | role: { |
| | | messageType: '', |
| | | head: '', |
| | | targetTo: '', |
| | | targetFrom: null, |
| | | type: '', |
| | | title: '', |
| | | body: '', |
| | | channelCode: '01', |
| | | }, |
| | | createRoleRules: { |
| | | messageType: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | type: [ |
| | | { required: true, trigger: "blur", message: '请填写消息栏目' }, |
| | | ], |
| | | head: [ |
| | | { required: false, trigger: "blur", validator: validatePass }, |
| | | title: [ |
| | | { required: true, trigger: "blur", message: '请填写消息标题' }, |
| | | ], |
| | | targetTo: [ |
| | | { required: false, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | body: [ |
| | | { required: true, trigger: ['blur', 'change'], validator: validateMessageContent } |
| | | ] |
| | | }, |
| | | colList: [], |
| | | departList: [], |
| | | typeList: [], |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'departName', |
| | | // disabled: function (data, node) { |
| | | // if (data.createTime) { |
| | | // return !data.leaf |
| | | // } |
| | | // } |
| | | }, |
| | | checkedList: [], |
| | | tempNameArr:[], |
| | | info:{}, |
| | | sendUser:"" |
| | | colList: [{ id: "1", columnName: "验证码模板"}, {id: "2",columnName: "活动模板"}], |
| | | disabled: this.dialogType === 'view' |
| | | } |
| | | }, |
| | | created() { |
| | | this.setColumnList(); |
| | | this.setDepartList(); |
| | | this.getLoginUserInfo(); |
| | | if (this.tableRowData) { |
| | | this.role = deepClone(this.tableRowData); |
| | | } |
| | | }, |
| | | methods: { |
| | | // 关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | .then(_ => { |
| | | done(); |
| | | }) |
| | | }, |
| | | // 设置栏目 |
| | | async setColumnList() { |
| | | this.colList = [{"id":"1","columnName":"验证码模板"},{"id":"2","columnName":"活动模板"}]; |
| | | }, |
| | | // 获取栏目 |
| | | async getColumnList() { |
| | | let arr; |
| | | await this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/message_column/getAllColumn' |
| | | }) |
| | | .then(res => { |
| | | console.log(res); |
| | | arr = res.data; |
| | | }) |
| | | return arr; |
| | | }, |
| | | // 关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | if (index === 1) { |
| | | // 重新设置栏目 |
| | | this.setColumnList(); |
| | | } |
| | | }, |
| | | // 获取部门树 |
| | | async getDepartList() { |
| | | let arr |
| | | await this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/depart/tree' |
| | | }) |
| | | .then(res => { |
| | | arr = res.data |
| | | }) |
| | | return arr; |
| | | }, |
| | | // 设置部门树 |
| | | async setDepartList() { |
| | | this.departList = await this.filterDepartList(); |
| | | }, |
| | | // 处理部门树 |
| | | async filterDepartList() { |
| | | let arr = await this.getDepartList(); |
| | | const { setChildren } = this; |
| | | // console.log(setChildren); |
| | | arr.forEach(item => { |
| | | setChildren(item); |
| | | }) |
| | | return arr; |
| | | }, |
| | | // 递归children |
| | | setChildren(obj) { |
| | | if (obj.children !== null) { |
| | | if (obj.children.length !== 0) { |
| | | obj.children.forEach(item => { |
| | | return this.setChildren(item); |
| | | }) |
| | | } |
| | | } else { |
| | | if (obj.userInfoDTOS.length !== 0) { |
| | | obj.children = []; |
| | | obj.userInfoDTOS.forEach(item => { |
| | | obj.children.push({ id: item.userId, departName: item.username }) |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | // 选中id |
| | | handleCheck(data, node) { |
| | | let arr = [],nameArr = [] |
| | | console.log(node.checkedNodes) |
| | | node.checkedNodes.forEach(item => { |
| | | if(!item.hasOwnProperty('departType')){ |
| | | arr.push(item.id) |
| | | nameArr.push(item.departName) |
| | | } |
| | | }) |
| | | this.checkedList = arr |
| | | this.tempNameArr = nameArr |
| | | console.log(this.tempNameArr) |
| | | this.role.targetTo = arr.length + '人' |
| | | }, |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | handleSubmit() { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { role, checkedList } = this; |
| | | console.log(checkedList); |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: 'sccg/message_sms_template/addSmsTemplate', |
| | | data: { |
| | | body: role.body, |
| | | channelCode: `${role.channelCode}`, |
| | | title: role.head, |
| | | type: role.messageType, |
| | | sendTime: new Date(), |
| | | targetTo: checkedList.join(','), |
| | | targetFrom: `${role.targetFrom}`, |
| | | status: mystatus, |
| | | } |
| | | }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: mystatus === 1 ? '发送成功' : '保存成功', |
| | | }) |
| | | this.$emit('closeMyDialog', { flag: false, index: 1 }); |
| | | } |
| | | if (this.dialogType === 'created') { |
| | | SMS.addNewSMSTemplate(this.role) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.$emit('closeDialog'); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | } else { |
| | | SMS.updateSMSTemplatate(this.tableRowData.id, this.role) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.$emit('closeDialog'); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | } |
| | | |
| | | } else { |
| | | return false; |
| | | this.$message({ type: 'warning', message: '请检查必填项' }); |
| | | } |
| | | }) |
| | | }, |
| | | // 获得消息体 |
| | | getMyBody(obj) { |
| | | console.log(obj); |
| | | this.role.body = obj; |
| | | }, |
| | | |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | // this.$refs.edit.wangEditor.txt.html('<p><br></p>') |
| | | this.setDepartList(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | | // 获取当前登录用户信息 |
| | | getLoginUserInfo() { |
| | | const name = sessionStorage.getItem('name'); |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/admin/info?name=' + name, |
| | | }) |
| | | .then(res => { |
| | | this.role.targetFrom = res.data.userId |
| | | this.sendUser = res.data.username |
| | | }) |
| | | }, |
| | | // 消息预览 |
| | | handleView() { |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { role,getColText,tempNameArr,sendUser } = this |
| | | this.dialogView = true; |
| | | let info = {} |
| | | // 获得栏目消息 |
| | | info.channelCode = role.channelCode === '01'? '站内信': role.channelCode === '02' ? '邮件':'短信' |
| | | info.messageType = getColText(role.messageType) |
| | | info.body = role.body |
| | | info.head = role.head |
| | | info.targetTo = tempNameArr |
| | | info.targetFrom = sendUser |
| | | this.info = info |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | // 获得栏目消息 |
| | | getColText(id){ |
| | | console.log(id) |
| | | const {colList} = this |
| | | let str = '' |
| | | colList.forEach(item=>{ |
| | | item.id === id ? str = item.columnName : '' |
| | | }) |
| | | return str |
| | | } |
| | | }, |
| | | props: ['closeMyDialog'] |
| | | props: ['tableRowData', 'dialogType'] |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | |
| | | |
| | | main { |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | background-color: #09152f; |
| | | padding-bottom: 50px; |
| | | |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <!-- <div class="message-kind"> |
| | | <span>消息分类:</span> |
| | | <el-select v-model="messageKind" placeholder="请选择消息分类"> |
| | | <el-option v-for="item in kindList" :key="item.id" :label="item.columnName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> --> |
| | | <div class="find"> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button> |
| | | <el-button icon="el-icon-delete-solid" @click="handleReset">重置</el-button> |
| | |
| | | <div class="mainContent"> |
| | | <div class="main-nav"> |
| | | <span>数据列表</span> |
| | | <el-button type="primary" icon="el-icon-plus" @click="dialogCreate = true">添加</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="isShowDialog = true; dialogType = 'created'">添加</el-button> |
| | | </div> |
| | | <!-- 数据展示 --> |
| | | <el-table ref="multipleTable" |
| | |
| | | <span>{{changeTime(scope.row)}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="targetFrom" label="发布人员" min-width="15"> |
| | | </el-table-column> --> |
| | | <el-table-column prop="type" label="模板类型" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{scope.row.type === 1 ? '验证码模板':scope.row.type |
| | | ===2?"活动模板":'其他模板'}}</span> |
| | | <span>{{scope.row.type === 1 ? '验证码模板':scope.row.type === 2 ? '活动模板' :' 其他模板'}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="status" label="发布状态" min-width="5"> |
| | | <template slot-scope="scope"> |
| | | {{scope.row.status === 0 ? '未发布' :'已发布'}} |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="operation" label="操作" min-width="15"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 新建消息 --> |
| | | <el-dialog title="新建短信模板" :visible.sync="dialogCreate" v-if="dialogCreate" width="80%" |
| | | <el-dialog title="新建短信模板" :visible.sync="isShowDialog" v-if="isShowDialog" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <MyCreate @closeMyDialog="closeDialog"></MyCreate> |
| | | <MyCreate @closeMyDialog="handleConfirmClose" :dialogType="dialogType" :tableRowData="messageTemplateData"></MyCreate> |
| | | </el-dialog> |
| | | <!-- 消息详情 --> |
| | | <!-- <el-dialog title="消息详情" :visible.sync="dialogView" v-if="dialogView" width="45%" |
| | | :before-close="handleClose"> |
| | | <MyView @closeDialog="closeDialog" :myinfo="info">></MyView> |
| | | </el-dialog> --> |
| | | <!-- 编辑页面 --> |
| | | <!-- <el-dialog title="编辑消息" :visible.sync="dialogEdit" v-if="dialogEdit" width="80%" |
| | | :before-close="handleClose"> |
| | | <MyEdit @closeDialog="closeDialog" :myDataRow="info"></MyEdit> |
| | | </el-dialog> --> |
| | | <!-- tools --> |
| | | <div class="tools"> |
| | | <div class="funs"> |
| | | <div class="funsItem funs-sp"> |
| | |
| | | </div> |
| | | <div class="pagination"> |
| | | <el-pagination background :current-page="currentPage" layout="prev, pager, next" |
| | | :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage" |
| | | > |
| | | :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage"> |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | |
| | | <script> |
| | | import helper from '@/utils/mydate' |
| | | import MyCreate from './createTemplate' |
| | | import SMS from "@/api/operate/SMS"; |
| | | |
| | | export default { |
| | | components: { |
| | | MyCreate, |
| | |
| | | return { |
| | | tableData: [], |
| | | context: "", |
| | | dialogEdit:false, |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | dialogType: '', |
| | | isShowDialog: false, |
| | | totalNum: null, |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | id:'03', |
| | | columnName:'短信', |
| | | } |
| | | ] |
| | | ], |
| | | messageTemplateData: null |
| | | } |
| | | }, |
| | | created() { |
| | | const {setTableData} = this |
| | | setTableData(); |
| | | this.getMessageList(); |
| | | }, |
| | | methods: { |
| | | // 查询 |
| | | handleSearch(){ |
| | | this.setTableData(); |
| | | this.getMessageList(); |
| | | }, |
| | | // 重置 |
| | | handleReset(){ |
| | | |
| | | }, |
| | | // 查看 |
| | | handleView(data){ |
| | | this.info = data; |
| | | this.dialogView = true; |
| | | this.messageTemplateData = data; |
| | | this.dialogType = 'view'; |
| | | this.isShowDialog = true; |
| | | }, |
| | | // 编辑 |
| | | handleEdit(data){ |
| | | this.info = data; |
| | | this.dialogEdit = true; |
| | | this.messageTemplateData = data; |
| | | this.dialogType = 'edit'; |
| | | this.isShowDialog = true; |
| | | }, |
| | | // 删除信息 |
| | | handleDelete(idarr) { |
| | | this.$confirm('确认删除?') |
| | | .then(_ => { |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: 'sccg/message/delete?ids=' + idarr, |
| | | }) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '删除成功', |
| | | }) |
| | | this.setTableData(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .then(() => { |
| | | SMS.deleteSMSTemplatate({ ids: idarr }) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message }); |
| | | this.getMessageList(); |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ type: 'error', message: err }); |
| | | }) |
| | | }) |
| | | }, |
| | | // 设置表格数据 |
| | | async setTableData() { |
| | | const arr = await this.getMessageList(); |
| | | this.tableData = arr.records; |
| | | this.totalNum = arr.total |
| | | }, |
| | | // 获取消息数据 |
| | | async getMessageList() { |
| | | let arr = []; |
| | | const { currentPage, pageSize,context,messageStatus,messageKind } = this; |
| | | await this.$axios({ |
| | | method: 'post', |
| | | url: 'sccg/message_sms_template/list', |
| | | data: { |
| | | body: "", |
| | | channelCode: messageKind === '00' ?'':messageKind, |
| | | createUser: '', |
| | | current: currentPage, |
| | | title: context, |
| | | messageType: "", |
| | | pageSize: pageSize, |
| | | randomCode: "", |
| | | remark: "", |
| | | sendTime: "", |
| | | type: messageStatus === 0 ? '':messageStatus, |
| | | targetFrom: "", |
| | | targetTo: "" |
| | | } |
| | | }) |
| | | .then(res => { |
| | | arr = res.data; |
| | | getMessageList() { |
| | | SMS.getSMSTemplateList({ current: this.currentPage, pageSize: this.pageSize, context: this.context, type: this.messageType }) |
| | | .then(({ records, total }) => { |
| | | this.tableData = records; |
| | | this.totalNum = total; |
| | | }) |
| | | return arr; |
| | | .catch(err => { |
| | | this.$message({ type: 'success', message: err }); |
| | | }) |
| | | }, |
| | | // 批量下拉框操作 |
| | | async selectChange(list) { |
| | | console.log(this.tempList); |
| | | if (this.tempList.length !== 0) { |
| | | this.preMyIdx = list; |
| | | if (list === 3) { |
| | |
| | | type: 'success', |
| | | message: '更改用户状态成功', |
| | | }) |
| | | this.getUserList(); |
| | | this.getMessageList(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: res.message |
| | | }) |
| | | } |
| | | console.log(res); |
| | | }) |
| | | }) |
| | | .catch(err => { console.log(err) }) |
| | |
| | | list.forEach(item => { |
| | | this.tempList.push(item.id); |
| | | }) |
| | | if (list.length === this.tableData.length) { |
| | | this.all = true; |
| | | } else { |
| | | this.all = false |
| | | } |
| | | this.all = list.length === this.tableData.length; |
| | | }, |
| | | // 修改时间格式 |
| | | changeTime({ updateTime }) { |
| | |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | if ((rowIndex + 1) % 2 === 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | }, |
| | | // 当前页改变触发事件 |
| | | changeCurrentPage(page) { |
| | | this.currentPage = page; |
| | | this.setTableData(); |
| | | }, |
| | | // 关闭弹窗 |
| | | handleClose(done) { |
| | | done(); |
| | | this.getMessageList(); |
| | | }, |
| | | // 确认关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | .then(_ => { |
| | | .then(() => { |
| | | done(); |
| | | }) |
| | | .catch(err => { |
| | | console.log(err); |
| | | }) |
| | | }, |
| | | // 自定义关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | this.dialogView = flag; |
| | | if (index === 1) { |
| | | this.setTableData(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | header { |
| | | background-color: #09152f; |
| | | border: 1pox solid #fff; |
| | | |
| | | .header-nav { |
| | | line-height: 40px; |
| | |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding-bottom: 50px; |
| | | border: 1pox solid #fff; |
| | | |
| | | .el-link { |
| | | color: #4b9bb7; |