• xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!


    vue & table with operation slot

    seed demo

    
    <!-- @format -->
    
    <template>
      <seed ref="list" :fetch-list="fetchList" :seed="seed">
        <template slot="column-joinNum" slot-scope="{ row }">
          <el-button
            @click="showHistory('join', row)"
            :disabled="row.joinNum === 0"
            type="text"
            >{{ row.joinNum }}</el-button
          >
        </template>
        <template slot="column-violationNum" slot-scope="{ row }">
          <el-button
            @click="showHistory('violation', row)"
            :disabled="row.violationNum === 0"
            type="text"
            >{{ row.violationNum }}</el-button
          >
        </template>
        <template slot="column-control" slot-scope="{ row }">
          <el-button size="mini" @click="reject(row.id)" type="danger"
            >驳 回</el-button
          >
        </template>
      </seed>
    </template>
    
    <script>
    /**
     * 正常用户
     */
    import axios from 'axios'
    import JoinHistory from './JoinHistory'
    import ViolationHistory from './ViolationHistory'
    import { SelectBox } from '@/mixins/audit'
    const REJECT_REASONS = [
      '发布营销内容',
      '发布与事实不符内容',
      '发布辱骂内容',
      '发布不符合社区制度内容',
      '发布违法内容'
    ]
    export default {
      components: {
        JoinHistory,
        ViolationHistory
      },
      data() {
        return {
          seed: [
            {
              key: 'userId',
              label: '用户ID',
              readonly: true
            },
            {
              key: 'userName',
              label: '用户名称',
              readonly: true
            },
            {
              key: 'mobileNo',
              label: '用户手机号',
              readonly: true
            },
            {
              key: 'feedNum',
              label: '内容数',
              readonly: true
            },
            {
              key: 'qualityFeedNum',
              label: '优质内容数',
            },
            {
              label: '最新加入时间',
              key: 'addTime',
              type: 'time',
            },
            {
              key: 'joinNum',
              label: '加入次数',
            },
            {
              key: 'violationNum',
              label: '违规次数',
            }
          ]
        }
      },
      methods: {
        fetchList(params) {
          return axios('/opapi/tweetClub', {
            params: {
              ...params,
              status: 1
            }
          })
        },
        showHistory(type = 'join', row = {}) {
          const h = this.$createElement
          let { userId, userName } = row
          this.$msgbox({
            title: userName + '的' + (type === 'join' ? '加入' : '违规') + '记录',
            message: h(type + '-history', {
              key: userId,
              props: {
                userId
              }
            })
          })
        },
        reject(id) {
          if (!id) {
            this.$message.error('没有ID')
            return
          }
          SelectBox(
            REJECT_REASONS,
            '是否驳回该用户身份,驳回后该用户将不享受福利!'
          )
            .then(supplement => {
              return axios.put(`/opapi/tweetClub/${id}/reject`, '', {
                params: {
                  supplement
                }
              })
            })
            .then(() => {
              this.$message({
                message: '驳回成功',
                type: 'success',
              })
              this.$nextTick(() => {
                this.$refs.list.refresh()
              })
            })
            .catch(e => {
              let message = e.message || e
              if (e.response) {
                message = e.response.data
              }
              this.$message.error(message)
            })
        }
      }
    }
    </script>
    
    
    

    refs

    seed



    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    windows系统设置虚拟机开机自启并运行虚拟系统
    Pycharm模板添加默认信息
    (翻译)从底层了解ASP.NET体系结构 [转]
    sql2000安装在win2003后只有在本机才能访问,局域网内其他机器不能访问
    Web上传文件的原理及实现[转]
    Http 请求处理流程[转]
    .net 必知
    sql2000数据库在企业管理器中显示置疑(suspect),在查询分析器不显示。在企业管理器中附加:提示错误823
    HTTP请求过程简介[转]
    面向对象
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/12543530.html
Copyright © 2020-2023  润新知