| | |
| | | <header> |
| | | <div class="header-nav"> |
| | | <span class="nav-left">数据筛选</span> |
| | | <span class="nav-right">高级搜索</span> |
| | | <span class="nav-right" @click="showMoreParamsDialog">高级搜索</span> |
| | | </div> |
| | | <div class="header-content"> |
| | | <div class="search"> |
| | |
| | | </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-select v-model="messageType" placeholder="请选择消息分类"> |
| | | <el-option v-for="item in typeList" :key="item.id" :label="item.columnName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="channelCode" label="消息分类" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{scope.row.channelCode === '01' ? '站内信':scope.row.channelCode |
| | | ==='02'?"邮件":'短信'}}</span> |
| | | <span>{{ getMessageType(scope.row.channelCode) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="发布状态" min-width="5"> |
| | |
| | | <!-- 新建消息 --> |
| | | <el-dialog title="新建消息" :visible.sync="dialogCreate" v-if="dialogCreate" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <MyCreate @closeMyDialog="closeDialog"></MyCreate> |
| | | <MyEdit @closeMyDialog="closeDialog" :type="'create'" :myDataRow="null"></MyEdit> |
| | | </el-dialog> |
| | | <!-- 消息详情 --> |
| | | <el-dialog title="消息详情" :visible.sync="dialogView" v-if="dialogView" width="45%" |
| | | :before-close="handleClose"> |
| | | <MyView @closeDialog="closeDialog" :myinfo="info">></MyView> |
| | | <MyView @closeDialog="closeDialog" :myDataRow="tableRowData">></MyView> |
| | | </el-dialog> |
| | | <!-- 编辑页面 --> |
| | | <el-dialog title="编辑消息" :visible.sync="dialogEdit" v-if="dialogEdit" width="80%" |
| | | :before-close="handleClose"> |
| | | <MyEdit @closeDialog="closeDialog" :myDataRow="info"></MyEdit> |
| | | <MyEdit @closeDialog="closeDialog" :myDataRow="tableRowData" :type="'update'"></MyEdit> |
| | | </el-dialog> |
| | | <!-- tools --> |
| | | <div class="tools"> |
| | |
| | | </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> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | title="高级参数" |
| | | :visible.sync="isShowMoreParams" |
| | | width="30%" |
| | | :before-close="handleClose"> |
| | | </el-dialog> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import helper from '@/utils/mydate' |
| | | import MyView from './myview' |
| | | import MyCreate from './createUser' |
| | | // 引入编辑组件 |
| | | import MyEdit from './update' |
| | | import { deleteMessage, getMessageById, getMessageList } from "@/api/operate/messageManagement"; |
| | | import {SUCCESS_CODE} from "@/utils"; |
| | | |
| | | export default { |
| | | components: { |
| | | MyView, MyCreate,MyEdit |
| | | }, |
| | | components: { MyView, MyEdit }, |
| | | data() { |
| | | return { |
| | | tableData: [], |
| | | context: "", |
| | | dialogEdit:false, |
| | | tableRowData: null, |
| | | isShowMoreParams: false, |
| | | context: '', |
| | | dialogEdit: false, |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | totalNum: null, |
| | |
| | | ], |
| | | tempList: [], |
| | | messageStatus: 2, |
| | | messageKind: '00', |
| | | messageType: '00', |
| | | statusList: [ |
| | | { |
| | | label: '全部', |
| | |
| | | value: 1, |
| | | } |
| | | ], |
| | | kindList: [ |
| | | typeList: [ |
| | | { |
| | | id:'00', |
| | | columnName:'全部', |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | const {setTableData} = this |
| | | setTableData(); |
| | | this.getMessageList(); |
| | | }, |
| | | |
| | | methods: { |
| | | // 查询 |
| | | handleSearch(){ |
| | | this.setTableData(); |
| | | this.getMessageList(); |
| | | }, |
| | | |
| | | // 重置 |
| | | handleReset(){ |
| | | |
| | | this.messageStatus = 2; |
| | | this.messageType = '00'; |
| | | this.context = ''; |
| | | }, |
| | | |
| | | // 查看 |
| | | handleView(data){ |
| | | this.info = data; |
| | | this.dialogView = true; |
| | | this.tableRowData = data; |
| | | this.dialogView = true; |
| | | }, |
| | | |
| | | // 编辑 |
| | | handleEdit(data){ |
| | | this.info = data; |
| | | this.dialogEdit = true; |
| | | this.tableRowData = data; |
| | | this.dialogEdit = 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(() => { |
| | | deleteMessage(idarr) |
| | | .then(({ code, message }) => { |
| | | if (code === SUCCESS_CODE) { |
| | | this.getMessageList(); |
| | | this.$message({ type: 'success', message }); |
| | | } else { |
| | | this.$message({ type: 'error', message }); |
| | | } |
| | | }) |
| | | .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/list', |
| | | data: { |
| | | body: "", |
| | | channelCode: messageKind === '00' ?'':messageKind, |
| | | createUser: '', |
| | | current: currentPage, |
| | | head: context, |
| | | messageType: "", |
| | | pageSize: pageSize, |
| | | randomCode: "", |
| | | remark: "", |
| | | sendTime: "", |
| | | status: messageStatus === 2 ? '':messageStatus, |
| | | targetFrom: "", |
| | | targetTo: "" |
| | | } |
| | | }) |
| | | .then(res => { |
| | | arr = res.data; |
| | | }) |
| | | return arr; |
| | | getMessageList() { |
| | | const messageParam = { |
| | | current: this.currentPage, |
| | | size: this.pageSize, |
| | | channelCode: this.messageType, |
| | | status: this.messageStatus, |
| | | head: this.context |
| | | } |
| | | getMessageList(messageParam) |
| | | .then(({ data }) => { |
| | | this.tableData = []; |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ type: 'error', message: err }); |
| | | }); |
| | | }, |
| | | |
| | | // 批量下拉框操作 |
| | | async selectChange(list) { |
| | | console.log(this.tempList); |
| | | if (this.tempList.length !== 0) { |
| | | this.preMyIdx = list; |
| | | if (list === 3) { |
| | |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 批量操作 |
| | | mulUpdateStatus(idArr, flag) { |
| | | this.$confirm(flag === 1 ? "您确定要进行批量启用角色吗?" : '您确定要进行批量禁用角色吗?') |
| | |
| | | message: res.message |
| | | }) |
| | | } |
| | | console.log(res); |
| | | }) |
| | | }) |
| | | .catch(err => { console.log(err) }) |
| | | }, |
| | | |
| | | // 表格监听 |
| | | tableChange(list) { |
| | | this.tempList = []; |
| | | 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 }) { |
| | | return helper(updateTime); |
| | | }, |
| | | |
| | | // 全选 |
| | | selectAll() { |
| | | this.$refs.multipleTable.toggleAllSelection(); |
| | | }, |
| | | |
| | | // 反选 |
| | | disSame(list) { |
| | | list.forEach(row => { |
| | | this.$refs.multipleTable.toggleRowSelection(row) |
| | | }) |
| | | }, |
| | | |
| | | // 设置表格斑马纹 |
| | | 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(); |
| | | this.getMessageList(); |
| | | }, |
| | | |
| | | showMoreParamsDialog() { |
| | | this.isShowMoreParams = true; |
| | | }, |
| | | |
| | | // 关闭弹窗 |
| | | handleClose(done) { |
| | | done(); |
| | | }, |
| | | |
| | | // 确认关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | |
| | | console.log(err); |
| | | }) |
| | | }, |
| | | |
| | | // 自定义关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | this.dialogView = flag; |
| | | if (index === 1) { |
| | | this.setTableData(); |
| | | this.getMessageList(); |
| | | } |
| | | }, |
| | | |
| | | getMessageType(id) { |
| | | const result = this.typeList.find(item => item.id === id); |
| | | return result.columnName; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | 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; |