<template> <div class="product_container"> <div class="productFun"> <div class="productInput"> 编号 <div class="inputBox" style="width: 120px"> <el-input placeholder="请输入编号" v-model="selectInfo.messageCode" clearable class="product-input" > </el-input> </div> 标题 <div class="inputBox" style="width: 120px"> <el-input placeholder="请输入标题" v-model="selectInfo.messageTitle" clearable class="product-input" > </el-input> </div> 内容 <div class="inputBox" style="width: 120px"> <el-input placeholder="请输入内容" v-model="selectInfo.messageContent" clearable class="product-input" > </el-input> </div> <!-- <div class="inputBox" style="width: 140px"> <el-select v-model="value" filterable placeholder="热门推荐" > <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" > </el-option> </el-select> </div> --> </div> <div class="productBtn"> <el-button type="primary" icon="el-icon-search" class="btnItem" @click="selectData" >查询</el-button > <el-button type="primary" icon="el-icon-refresh-right" class="btnItem" @click="reset">重置</el-button > <el-button type="success" icon="el-icon-circle-plus-outline" class="btnItem bggreen" @click="addCategory" >新增</el-button > <el-button type="danger" icon="el-icon-delete-solid" class="btnItem bgred" >删除</el-button > </div> </div> <el-table :data="tableData.rows" :row-class-name="tableRowClassName" :header-cell-style="{ 'text-align': 'center', background: ' #2483b3', color: 'white', }" :row-style="{ 'text-align': 'center' }" style="width: 100%" > <el-table-column type="selection" width="55"> </el-table-column> <el-table-column prop="index" label="序号"> </el-table-column> <el-table-column prop="messageCode" label="消息编号"> </el-table-column> <el-table-column prop="messageTitle" label="消息标题"> </el-table-column> <el-table-column prop="messageContent" label="消息内容"> </el-table-column> <el-table-column prop="targetUsers" label="目标用户"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button type="text" size="small">编辑</el-button> <el-button @click="handleClick(scope.row)" type="text" size="small" >删除</el-button > </template> </el-table-column> </el-table> <group-page :limit ="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset" @setLimit ="setLimit" v-model="isFristPage"/> <!-- 新增弹框 --> <massage-add-dialog :isShowInfo="isShowAdd" :title="title" :dataInfo="rowInfo" @close="closeAdd"></massage-add-dialog> </div> </template> <script> //组件 import GroupPage from '../../components/mycomponent/groupPage.vue'; import MassageAddDialog from '../../components/mycomponent/dialog/move/massageAddDialog.vue'; //逻辑 import { tableRowClassName } from "../../utils/myUtils/changeTableTr"; import { listMixin } from '../../utils/myUtils/mixins/listPage' import { listPage } from "../../api/move/message" export default { mixins:[listMixin], // 加入分页逻辑 components: { MassageAddDialog, GroupPage }, data() { return { isShowAdd: false, //显示新增功能 selectInfo:{ messageCode:'', messageTitle:"", messageContent:"" } , title:'', rowInfo:'' }; }, methods: { tableRowClassName: tableRowClassName, closeAdd() { this.isShowAdd = false; this.refresh() }, addCategory() { this.isShowAdd = true; this.title="消息推送新增" }, getListPage(limit,offset){ listPage(`limit=${limit}&offset=${offset}`,this.queryInfo).then(res => { // 得到相关数据 res.rows.forEach((item,index)=>{ item.index =(index+1)+((offset-1)*10) }) this.tableData = res }) }, reset(){ this.selectInfo = { messageCode:'', messageTitle:"", messageContent:"" } }, }, }; </script> <style lang="scss" scoped> .product_container { position: relative; width: 100%; min-height: 700px; overflow: auto; .productData { width: 100%; display: flex; justify-content: center; .middle { margin: 0 30px; } } .productFun { margin: 30px 0; display: flex; justify-content: space-between; .productInput { display: flex; align-items: center; .inputBox { margin: 0 50px 0 10px; } } .productBtn { .btnItem { margin-right: 10px; border-radius: 5px; // height: 32px; // width: 84px; font-size: 16px; } } } .footer { display: flex; justify-content: space-between; color: #6666; margin: 30px 10px; } } </style>