| | |
| | | <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="handleOpera(null, 'create')">添加</el-button> |
| | | </div> |
| | | <!-- 数据展示 --> |
| | | <el-table ref="multipleTable" |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="head" label="标题" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="updateTime" label="修改时间" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{changeTime(scope.row)}}</span> |
| | | </template> |
| | | <el-table-column prop="createTime" label="修改时间" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="targetFrom" label="发布人员" min-width="15"> |
| | | <el-table-column prop="createUser" label="发布人员" min-width="15"> |
| | | </el-table-column> |
| | | <el-table-column prop="channelCode" label="消息分类" min-width="10"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ getMessageType(scope.row.channelCode) }}</span> |
| | | </template> |
| | | <el-table-column prop="messageTypeName" label="消息分类" min-width="10"> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="发布状态" min-width="5"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-table-column prop="operation" label="操作" min-width="15"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleView(scope.row)">查看</el-link> |
| | | <el-link icon="el-icon-edit" class="leftPx" :underline="false" @click="handleEdit(scope.row)">编辑</el-link> |
| | | <el-link icon="el-icon-view" :underline="false" @click="handleOpera(scope.row, 'view')">查看</el-link> |
| | | <el-link icon="el-icon-edit" class="leftPx" :underline="false" @click="handleOpera(scope.row, 'update')">编辑</el-link> |
| | | <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false" |
| | | @click="handleDelete([scope.row.id])">删除</el-link> |
| | | </div> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 新建消息 --> |
| | | <el-dialog title="新建消息" :visible.sync="dialogCreate" width="80%" |
| | | :before-close="handleConfirmClose"> |
| | | <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" :myDataRow="tableRowData">></MyView> |
| | | </el-dialog> |
| | | <!-- 编辑页面 --> |
| | | <el-dialog title="编辑消息" :visible.sync="dialogEdit" width="80%" |
| | | :before-close="handleClose"> |
| | | <MyEdit @closeDialog="closeDialog" :myDataRow="tableRowData" :type="'update'"></MyEdit> |
| | | <el-dialog :destroy-on-close="true" :key="dialogType" :title="getDialogTitle" :visible.sync="isShowDialog" width="80%"> |
| | | <my-edit @closeMyDialog="closeDialog" :type="dialogType" :myDataRow="tableRowData"></my-edit> |
| | | </el-dialog> |
| | | <!-- tools --> |
| | | <div class="tools"> |
| | |
| | | <el-dialog |
| | | title="高级参数" |
| | | :visible.sync="isShowMoreParams" |
| | | width="30%" |
| | | :before-close="handleClose"> |
| | | width="30%"> |
| | | </el-dialog> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import helper from '@/utils/mydate' |
| | | import MyView from './myview' |
| | | import MyEdit from './update' |
| | | import { deleteMessage, getMessageById, getMessageList } from "@/api/operate/messageManagement"; |
| | | import {SUCCESS_CODE} from "@/utils"; |
| | | |
| | | export default { |
| | | components: { MyView, MyEdit }, |
| | | computed: { |
| | | getDialogTitle() { |
| | | if (this.dialogType === 'create') { |
| | | return '创建'; |
| | | } |
| | | |
| | | if (this.dialogType === 'update') { |
| | | return '更新'; |
| | | } |
| | | |
| | | if (this.dialogType === 'view') { |
| | | return '查看'; |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | tableData: [], |
| | | tableRowData: null, |
| | | isShowMoreParams: false, |
| | | context: '', |
| | | dialogEdit: false, |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | context: null, |
| | | isShowDialog: false, |
| | | dialogType: false, |
| | | totalNum: null, |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | this.messageStatus = 2; |
| | | this.messageType = '00'; |
| | | this.context = ''; |
| | | this.getMessageList(); |
| | | }, |
| | | |
| | | // 查看 |
| | | handleView(data){ |
| | | handleOpera(data, type){ |
| | | this.tableRowData = data; |
| | | this.dialogView = true; |
| | | }, |
| | | |
| | | // 编辑 |
| | | handleEdit(data){ |
| | | this.tableRowData = data; |
| | | this.dialogEdit = true; |
| | | this.dialogType = type; |
| | | this.isShowDialog = true; |
| | | }, |
| | | |
| | | // 删除信息 |
| | | handleDelete(idarr) { |
| | | this.$confirm('确认删除?') |
| | | .then(() => { |
| | | deleteMessage(idarr) |
| | | .then(({ code, message }) => { |
| | | if (code === SUCCESS_CODE) { |
| | | deleteMessage({ ids: idarr.join(',') }) |
| | | .then(() => { |
| | | this.getMessageList(); |
| | | this.$message({ type: 'success', message }); |
| | | } else { |
| | | this.$message({ type: 'error', message }); |
| | | } |
| | | this.$message.success('操作成功'); |
| | | }) |
| | | .catch(err => { this.$message({ type: 'error', message: err }) }); |
| | | }) |
| | |
| | | head: this.context |
| | | } |
| | | getMessageList(messageParam) |
| | | .then(({ data }) => { |
| | | this.tableData = []; |
| | | .then(({ records, total }) => { |
| | | this.tableData = records; |
| | | this.totalNum = total; |
| | | }) |
| | | .catch(err => { |
| | | this.$message({ type: 'error', message: err }); |
| | |
| | | }) |
| | | this.all = list.length === this.tableData.length; |
| | | }, |
| | | |
| | | // 修改时间格式 |
| | | changeTime({ updateTime }) { |
| | | return helper(updateTime); |
| | | }, |
| | | |
| | | // 全选 |
| | | selectAll() { |
| | | this.$refs.multipleTable.toggleAllSelection(); |
| | |
| | | this.isShowMoreParams = true; |
| | | }, |
| | | |
| | | // 关闭弹窗 |
| | | handleClose(done) { |
| | | done(); |
| | | }, |
| | | |
| | | // 确认关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | .then(_ => { |
| | | done(); |
| | | }) |
| | | .catch(err => { |
| | | }) |
| | | }, |
| | | |
| | | // 自定义关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | this.dialogView = flag; |
| | | if (index === 1) { |
| | | closeDialog() { |
| | | this.isShowDialog = false; |
| | | this.getMessageList(); |
| | | } |
| | | }, |
| | | |
| | | getMessageType(id) { |
| | | const result = this.typeList.find(item => item.id === id); |
| | | return result.columnName; |
| | | } |
| | | } |
| | | } |