<!--消息推送配置列表--> <template> <div class="product_container"> <div class="productFun"> <div class="productInput"> 编号 <div class="inputBox" style="width: 120px"> <el-input v-model="selectInfo.messageCode" placeholder="请输入编号" clearable class="product-input" /> </div> 标题 <div class="inputBox" style="width: 120px"> <el-input v-model="selectInfo.messageTitle" placeholder="请输入标题" clearable class="product-input" /> </div> 内容 <div class="inputBox" style="width: 120px"> <el-input v-model="selectInfo.messageContent" placeholder="请输入内容" clearable class="product-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 prop="index" label="序号" /> <el-table-column prop="messageCode" label="消息编号" /> <el-table-column prop="messageTitle" label="消息标题" /> <el-table-column prop="messageContent" label="消息内容" /> <el-table-column prop="targetUsers" label="目标用户" /> <el-table-column label="操作"> <template slot-scope="scope"> <el-button type="text" size="small" @click="editCategory(scope.row)"> 详情 </el-button> <el-button type="text" size="small" > 删除 </el-button> </template> </el-table-column> </el-table> <group-page v-model="isFristPage" :limit="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset" @setLimit="setLimit" /> <!-- 新增弹框 --> <massage-add-dialog :is-show-info="isShowAdd" :title="title" :data-info="rowInfo" @close="closeAdd" ref="addMessage"/> </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 { // 加入分页逻辑 components: { MassageAddDialog, GroupPage }, mixins: [listMixin], 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: '' } listPage(`limit=${this.limit}&offset=${1}`, {}).then(res => { // 得到相关数据 res.rows.forEach((item, index) => { item.index = (index + 1) + ((1 - 1) * 10) }) this.tableData = res }) }, editCategory(row){ console.log(row) this.isShowAdd = true this.title = '消息推送编辑' this.$refs.addMessage.init(row) } } } </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: 0px 0px 30px; 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>