<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
  <div>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
	  draggable
      width="1000px"
      @close="close"
      append-to-body
      @keyup.enter.native=""
	  v-model="visible">
      <vxe-table
        border="inner"
        show-overflow
        show-footer
        size="small"
        ref="baseTable"
        class="vxe-table-element"
        :data="dataList"
      >
        <vxe-table-column type="seq" width="50" title="序号" align="center"></vxe-table-column>
        <vxe-table-column min-width="300px" field="name" align="left" title="项目名称">
          <template #default="scope">
            <el-link type="primary" :underline="false" @click="openProjectForm(scope.row)" >{{scope.row.name}}</el-link>
          </template>
        </vxe-table-column>
        <vxe-table-column width="150px" field="no" align="center" title="项目编号"></vxe-table-column>
        <vxe-table-column width="250px" field="reportNo" align="center" title="报告号"></vxe-table-column>
      </vxe-table>
		<template #footer>
			<span class="dialog-footer">
			<el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
		  </span>
		</template>

    </el-dialog>
    <ProjectForm ref="projectForm"></ProjectForm>
  </div>
</template>

<script>
  import ProjectForm from '@/views/program/registered/ProjectForm'
  import ReimbursementApprovalService from '@/api/sys/ReimbursementService'
  export default {
    data () {
      return {
        title: '',
        method: '',
        visible: false,
        loading: false,
        dataList: ''
      }
    },
    reimbursementApprovalService: null,
    created () {
      this.reimbursementApprovalService = new ReimbursementApprovalService()
    },
    components: {
      ProjectForm
    },
    methods: {
      init (id) {
        this.method = 'view'
        this.title = '查看项目信息'
        this.visible = true
        this.dataList = []
        if (this.commonJS.isNotEmpty(id)) {
          this.list(id)
        }
      },
      async list (ids) {
        this.loading = true
        let resp = await this.reimbursementApprovalService.queryByProIds(ids)
        if (resp) {
          this.dataList = resp
        }
        this.loading = false
      },
      openProjectForm (row) {
        // this.$refs.projectForm.init('view', id)
		this.$refs.projectForm.init('view', row.id, row.auditId1, row.auditId2, row.auditId3, row.archiveId)
      },
      close () {
        this.dataList = []
        this.visible = false
      }
    }
  }
</script>
