export default {
  data() {
    return {
      comSigncolumns: [
        {
          label: '序号',
          index: true
        },
        {
          label: '公司名称',
          prop: 'corporateName',
          showTooltip: true
        },
        {
          label: '认证状态',
          prop: 'authStatus',
          showTooltip: true,
          render: (h, row) => {
            return <div>{ row.authStatus ? '已认证' : '未认证' }</div>
          }
        },
        {
          label: '自动签署状态',
          showTooltip: true,
          prop: 'autoSignStatus',
          render: (h, row) => {
            return <div>{ row.autoSignStatus ? '已签署' : '未签署' }</div>
          }
        },
        {
          label: '创建时间',
          prop: 'gmtCreate',
          showTooltip: true
        },
        {
          label: '操作',
          show: true,
          render: (h, row) => {
            const btnList = [
              {
                msg: '复制认证链接',
                icon: 'iconfont icon-fuzhi',
                power: 'companyCopyAuthUrl',
                category: 'copyUrl'
              },
              {
                msg: '复制自动签署链接',
                icon: 'iconfont icon-fuzhi',
                power: 'companyCopySignUrl',
                category: 'copyAutoUrl'
              },
              {
                msg: '刷新认证状态',
                icon: 'iconfont icon-shuaxin',
                power: 'companyFlushStatus',
                category: 'refreshComUrl'
              },
              {
                msg: '重新生成认证和签署链接',
                icon: 'thin-icon el-icon-refresh',
                power: 'companyCreateUrl',
                category: 'createComUrl'
              },
              {
                msg: '认证详情',
                icon: 'iconfont icon-Magnifier',
                power: 'companyAuthDetail',
                category: 'comUrlDetail'
              }
            ]
            // if(!row.authStatus) {
            //   btnList.splice(-2)
            // }
            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.comTablePower({ 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: {
    comTablePower() {
      return ({ item }) => {
        const { power } = item
        if (power && !this.btnPermission.includes(power)) {
          return false
        }
        return true
      }
    }
  }
}
