export default {
  data() {
    return {
      total: 20,
      loading: false,
      tableData: [],
      tableOptions: {
        sortTable: true,
        maxHeight: 'calc(100vh - 260px)',
        height: 'calc(100vh - 260px)'
      },
      columns: [
        {
          label: '序号',
          index: true
        },
        {
          label: '结算单编号',
          prop: 'moduleNumber',
          showTooltip: true,
          width: 120
        },
        {
          label: '业务编号',
          showTooltip: true,
          prop: 'businessNumber',
          width: 120,
          showTooltip: true
        },
        {
          label: '项目名称',
          prop: 'businessName',
          width: 120,
          showTooltip: true
        },
        {
          label: '主企业名称',
          prop: 'supplierName',
          width: 120,
          showTooltip: true
        },
        {
          label: '核心企业名称',
          prop: 'customerName',
          width: 120,
          showTooltip: true
        },
        {
          label: '贸易平台',
          prop: 'platformName',
          showTooltip: true
        },
        {
          label: '结算日期',
          prop: 'settlementDate',
          showTooltip: true,
          render: (h, row) => {
            return <div>{ row.settlementDate ? row.settlementDate.split(' ')[0] : '' }</div>
          }
        },
        {
          label: '结算金额（元）',
          prop: 'settlementAmount',
          width: 120,
          showTooltip: true
        },
        {
          label: '当前阶段', // 1
          prop: 'currentStage',
          showTooltip: true
        },
        {
          label: '状态',
          prop: 'status.name',
          showTooltip: true
        },
        {
          label: '操作',
          render: (h, row) => {
            const btnList = [
              { msg: '查看', icon: 'iconfont icon-orange icon-a-Group957', power: 'projectNumber:delete', category: 'see' }
            ]
            if((!row.currentStage && row.status.name != '已完成') || row.currentStage == '录入结算单' || row.currentStage == '签署结算单') {
              btnList.push({ msg: '编辑', icon: 'iconfont icon-orange icon-a-Group8151', power: 'projectNumber:delete', category: 'edit' })
            }
            if(((!row.currentStage && row.status.name == '已完成') || row.currentStage == '单价调整') && row.buttonFlag) {
              btnList.push({ msg: '单价调整', icon: 'iconfont icon-orange icon-a-Group990', power: 'projectNumber:delete', category: 'changePrice' })
            }
            // if(row.currentStage == '财务审核') {
            //   btnList.push({ msg: '查看', icon: 'iconfont icon-Vector-2', power: 'projectNumber:delete', category: 'see' })
            // }
            if(row.status && row.status.name == '已完成') {
              btnList.push({ msg: '下载签署附件', icon: 'iconfont icon-orange icon-Union', category: 'download' })
            }
            const options = btnList.map(item => {
              return (
                <el-tooltip class='item' effect='dark' content={item.msg} placement='top' >
                  <span class='table-icon-box'>
                    <i class={item.icon} style={ item.category === 'download' ? { 'font-size': '16px', 'margin-top': '20px' } : ''} onClick={() => { this.handlerOperate(item.category, row) }}></i>
                  </span>
                </el-tooltip>
              )
            })
            return <div>{ options }</div>
          },
          width: 120
        }
      ]
    }
  }

}
