export default {
  data() {
    return {
      personSigncolumns: [
        {
          label: '序号',
          index: true
        },
        {
          label: '姓名',
          prop: 'name',
          showTooltip: true
        },
        {
          label: '证件类型',
          prop: 'cardTypeName',
          showTooltip: true
        },
        {
          label: '证件号码',
          showTooltip: true,
          prop: 'socialCreditCode'
        },
        {
          label: '手机号码',
          prop: 'mobile',
          showTooltip: true
        },
        {
          label: '认证状态',
          prop: 'authStatus',
          showTooltip: true,
          render: (h, row) => {
            return <div>{ row.authStatus ? '已认证' : '未认证' }</div>
          }
        },
        {
          label: '创建时间',
          prop: 'gmtCreate',
          showTooltip: true
        },
        {
          label: '操作',
          show: true,
          render: (h, row) => {
            const btnList = [
              {
                msg: '修改详情',
                icon: 'iconfont icon-xiugai',
                power: 'individualUpdateDetail',
                category: 'updatePersonUrl'
              },
              {
                msg: '复制认证链接',
                icon: 'iconfont icon-fuzhi',
                power: 'individualCopyAuthUrl',
                category: 'copyUrl'
              },
              {
                msg: '刷新认证状态',
                icon: 'iconfont icon-shuaxin',
                power: 'individualFlushStatus',
                category: 'refreshPersonUrl'
              },
              {
                msg: '认证详情',
                icon: 'iconfont icon-Magnifier',
                power: 'individualView',
                category: 'personUrlDetail'
              },
              {
                msg: '重新生成认证链接',
                icon: 'thin-icon el-icon-refresh',
                power: 'individualCreateUrl',
                category: 'createPersonUrl'
              }
            ]
            // if(!row.authStatus) {
            //   btnList.pop()
            // }
            const options = btnList.map(item => {
              let str = item.svgIcon ?
                <svg-icon icon-class={item.svgIcon} style="width: 16px; height: 16px;" />
               : <i class={item.icon}></i>
              return ( this.personTablePower({ item }) &&
                <el-tooltip class='item' effect='dark' content={item.msg} placement='top' >
                  <span class='table-icon-box' onClick={() => { this.handlerOperate(item.category, row) }}>
                    { str }
                  </span>
                </el-tooltip>
              )
            })
            return <div>{ options }</div>
          },
          width: 200
        }
      ]
    }
  },
  computed: {
    personTablePower() {
      return ({ item }) => {
        const { power } = item
        if(power && !this.btnPermission.includes(power)) {
          return false
        }
        return true
      }
    }
  }
}
