| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <div class="mainBox">
- <!--搜索功能 start------------------------------------------------------------>
- <div class="layerBox_search">
- <div class="layerBoxLine">
- <el-row>
- <el-col :span="6">
- <div class="searchBox">
- <div class="searchTitle">留言标题:</div>
- <el-input placeholder="请输入留言标题" autocomplete="off" v-model="getApiData.keyword" />
- </div>
- </el-col>
- <el-col :span="6">
- <div class="searchBox">
- <div class="searchTitle">审核状态:</div>
- <el-select v-model="getApiData.is_master" placeholder="请选择..">
- <el-option label="全部" value="0"></el-option>
- <el-option label="已拒绝" value="2"></el-option>
- <el-option label="待审核" value="3"></el-option>
- </el-select>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="tag_webSite_head_btn_box">
- <div class="searchTitle"><span></span></div>
- <el-button type="primary" @click="getData('search')">搜索</el-button>
- <el-button type="info" @click="clearSearchList">重置</el-button>
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- <!--搜索功能 end------------------------------------------------------------>
- <!--表格内容 start------------------------------------------------------------>
- <div class="layerBox">
- <tableTitle :name="tableDivTitle" />
- <el-row>
- <template>
- <el-table :data="tableData" style="width: 100%">
- <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
- <el-table-column prop="title" label="留言标题" width="240"></el-table-column>
- <el-table-column prop="created_at" label="创建时间" width="240"></el-table-column>
- <el-table-column prop="updated_at" label="修改时间"></el-table-column>
- <el-table-column prop="status" label="状态">
- <template slot-scope="scope">
- <span v-if="scope.row.status == 0" class="status0">待审核</span>
- <span v-if="scope.row.status == 1" class="status1">已通过</span>
- <span v-if="scope.row.status == 2" class="status2">已拒绝</span>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="操作" width="350" header-align="center">
- <template slot-scope="scope">
- <div class="listBtnBox">
- <div class="listMainBtn" @click="editData(scope.row.id)" v-if="creatNews_user_type==10000">
- <i class="el-icon-check"></i>审核
- </div>
- <div class="listRefuseBtn" @click="refuseData(scope.row.id)" v-if="creatNews_user_type==10000">
- <i class="el-icon-close"></i>拒绝
- </div>
- <div class="listDeleteBtn" @click="deleteData(scope.row.id)">
- <i class="el-icon-delete"></i>删除
- </div>
- <div class="listEditBtn" @click="gotoEdit(scope.row.id)">
- <i class="el-icon-edit-outline"></i>编辑
- </div>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </template>
- </el-row>
- </div>
- <div class="alignBox">
- <el-row>
- <el-col :span="24">
- <el-pagination :current-page="getApiData.page" @size-change="handleSizeChange"
- @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
- :total="allCount"></el-pagination>
- </el-col>
- </el-row>
- </div>
- <!--表格内容 end------------------------------------------------------------>
- </div>
- </template>
- <script>
- //获得用户身份
- import { getWebSiteId, getUseType } from '@/utils/auth'
- //表格标题
- import tableTitle from './components/tableTitle';
- //引入公用样式
- import '@/styles/global.less';
- export default {
- components: {
- tableTitle,//表格标题
- },
- data() {
- //0.全局操作 start ------------------------------------------------------------>
- let self = this;
- //0.全局操作 end ------------------------------------------------------------>
- return {
- creatNews_user_type:0,//用户身份
- //1.列表和分页相关 start ------------------------------------------------------------>
- tableDivTitle: "留言列表",
- tableData: [],//内容
- getApiData: {
- website_id: 0,
- is_master: "0",//是否为审核列表 0=待审核列表 1=已审核列表
- title: "",//留言标题
- page: 1,//当前是第几页
- page_size: 10,//一共多少条
- },
- allCount: 0,//总条数
- //分页相关 end ------------------------------------------------------------>
- }
- },
- methods: {
- //1.列表和分页相关 start ------------------------------------------------------------>
- //1.1 开始请求列表信息方法
- getData(type) {
- //如果是搜索,重新加载第一页==搜索
- if (type == "search") {
- this.getApiData.page = 1;
- this.getApiData.title = "";
- }
- this.$store.dispatch('news/getMessageList', this.getApiData).then(res => {
- //列表
- this.tableData = res.data.data;
- //页数
- this.allCount = res.data.count;
-
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- },
- //1.2 删除内容
- deleteData(id) {
- this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- console.log("当前删除:" + id)
- this.$store.dispatch('news/delMessage', {id:id}).then(res => {
- if(res.code == 200) {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- } else {
- this.$message.error(res.message);
- }
- this.getData();
- })
- }).catch(() => {
- this.$message({
- type: 'warning',
- message: '已取消删除'
- });
- });
- },
- editData(id){
- this.$confirm('允许该留言通过审核吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'success'
- }).then(() => {
- let data = {
- id:id,
- status:1,
- reason:""
- }
- this.$store.dispatch('news/upMessageStatus', data).then(res => {
- if(res.code == 200) {
- this.$message({
- type: 'success',
- message: '审核已通过!'
- });
- } else {
- this.$message.error(res.message);
- }
- this.getData();
- })
- }).catch(() => {
- this.$message({
- type: 'warning',
- message: '已取消操作'
- });
- });
- },
- refuseData(id){
- this.$prompt('请输入拒绝理由', '拒绝', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- inputPlaceholder: '请输入拒绝理由',
- inputPattern: /\S+/, // 匹配非空内容(至少一个非空白字符)
- inputErrorMessage: '拒绝理由不能为空'
- }).then(({ value }) => {
- let data = {
- id:id,
- status:2,
- reason:value
- }
- this.$store.dispatch('news/upMessageStatus', data).then(res => {
- if(res.code == 200) {
- this.$message({
- type: 'success',
- message: '已拒绝该留言!'
- });
- this.getData();
- } else {
- this.$message.error(res.message);
- }
- })
- })
- },
- //1.3 列表内容分页
- handleSizeChange(val) {
- this.getApiData.page = val;
- this.getData();
- },
- //1.4 点击分页
- handleCurrentChange(val) {
- this.getApiData.page = val;
- this.getData();
- },
- //1.6 重置按钮
- clearSearchList() {
- this.tableData = [];
- this.getApiData.keyword = "";
- this.getApiData.name = "";
- this.getApiData.website_column_id = [];
- this.getApiData.city_id = [];
- this.getApiData.city_arr_id = [];
- this.getApiData.page = 1;
- this.getApiData.pageSize = 10;
- this.getData();
- },
- //列表和分页相关 end ------------------------------------------------------------>
- //跳转到添加留言页面 start ------------------------------------------------------------>
- // gotoCreat() {
- // this.$router.push({
- // path: '/messageCreat',
- // query: {
- // type: 'add',
- // page: 'messageReviewList'
- // }
- // });
- // },
- //编辑
- gotoEdit(id) {
- this.$router.push({
- path: '/messageCreat',
- query: {
- id: id,
- type: 'edit',
- page: 'messageReviewList'
- }
- });
- },
- //跳转到添加留言页面 end ------------------------------------------------------------>
- },
- mounted() {
- //获得第一页
- this.getData();
- //1.获得用户身份
- this.creatNews_user_type = getUseType()
- //2.获得站点id
- this.getApiData.website_id = getWebSiteId();
- //3.获得页面操作方式
- this.behavior = this.$route.query.behavior;
- },
- }
- </script>
- <style scoped lang="less">
- .status0 {
- color: #5570F1;
- }
- .status1 {
- color: #519C66;
- }
- .status2 {
- color: #CC5F5F;
- }
- //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
- ::v-deep .custom-form-item>.el-form-item__label {
- line-height: 140px !important;
- }
- ::v-deep .custom-textarea .el-textarea__inner {
- resize: none;
- /* 禁止用户拖拽调整大小 */
- }
- ::v-deep .custom-align-right .el-form-item__label {
- text-align: right;
- /* 设置标签文字右对齐 */
- }
- //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/
- .tag_webSite_head_btn_box {
- overflow: hidden;
- }
- .tag_webSite_head_btn_box .searchTitle {
- opacity: 0;
- span {
- display: block;
- height: 16px;
- }
- }
- .tag_webSite_head_btn_box button {
- float: right;
- }
- .tag_webSite_head_btn_box button:nth-of-type(1) {
- margin-left: 10px;
- }
- </style>
|