zoukankan      html  css  js  c++  java
  • 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 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    【caffe】create_mnist.sh在windows下的解决方案
    【caffe】loss function、cost function和error
    【caffe】未定义函数或变量caffe_
    【caffe】无法找到gpu/mxGPUArray.h: No such file or directory
    maven常见问题处理(3-1)修改maven 默认使用的 jdk 版本
    SpringCloud是什么?
    SpringCloud的服务网关zuul
    SpringCloud的EurekaClient : 客户端应用访问注册的微服务(有断路器场景)
    SpringBoot 概念和起步
    YML(1)什么是 YML
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/12543530.html
Copyright © 2011-2022 走看看