<template>
  <el-dialog
    v-if="visible"
    :visible.sync="visible"
    :before-close="handleClose"
    :append-to-body="true"
    title="审批流程"
    width="60%">
    <el-table
      ref="multipleTable"
      :data="list"
      :header-cell-style="{'font-weight': 'bold','color': '#000'}"
      tooltip-effect="dark"
      border
      fit
      highlight-current-row>
      <el-table-column type="index" label="序号" width="50" align="center"/>
      <el-table-column prop="CREATOR_TIME" label="审批流创建时间" align="center"/>
      <el-table-column label="操作" align="center" width="250">
        <template slot-scope="{row}">
          <el-button type="primary" icon="el-icon-edit" size="mini" @click="handleShow(row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeWindow">取 消</el-button>
    </div>
    <flow-info ref="flowInfo" append-to-body/>
  </el-dialog>
</template>

<script>
import { requestFN } from '@/utils/request'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import FlowInfo from './flowInfo.vue'

export default {
  components: {
    FlowInfo,
    Treeselect
  },
  props: {
    corpInfo: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      visible: false,
      loading: false,
      list: [],
      form: {
        XGF_USER_ID: ''
      }
    }
  },
  methods: {
    init(e) {
      this.visible = true
      this.loading = false
      this.form.XGF_USER_ID = e.XGF_USER_ID
      this.getInfo()
    },
    getInfo() {
      requestFN(
        '/xgf/user/getApproveInfo', this.form
      ).then((data) => {
        this.list = data.list
      }).catch((e) => {
        console.log(e)
      })
    },
    handleShow(row) {
      this.$refs.flowInfo.init(row)
    },
    handleClose() {
      this.visible = false
      this.$emit('finish', '')
    },
    closeWindow() {
      this.handleClose()
    }
  }
}
</script>
