<template>
  <!-- 立项备案 -->
  <div class="do-jump items bgc" id="page3">
    <!-- 标题 -->
    <div class="title">
      <span class="icon"></span>
      <span class="text">立项备案</span>
    </div>
    <!-- 详情 -->
    <!-- <div class="main-content" v-if="show">
      <table align="center">
        <tr>
          <td class="bgColor" style="width: 130px">项目代码</td>
          <td >{{ data.pcode }}</td>
            <td class="bgColor">建设性质</td>
          <td style="width:240px">{{ getDictName('xmgl-jclx-jsxz',data.establishmentName) }}</td>
          
        </tr>
        <tr>
          <td class="bgColor">总投资(万元)</td>
          <td>{{ data.establishmentInvestmentAmount }}</td>
          <td class="bgColor">批复日期</td>
          <td>{{ data.establishmentDate }}</td>
          
        </tr>
        <tr>
          <td class="bgColor">审批单位</td>
          <td :colspan="3">
            {{ getDictName('xmgl-lxspjg', data.establishmentApprovalUnit) }}
          </td>
        </tr>
        <tr>
          <td class="bgColor">附件信息</td>
          <td colspan="3">
            <el-link
              type="primary"
              @click="handleLook(data.accessoryInfo)"
              v-if="data.accessoryInfo && data.accessoryInfo.length > 0"
              >查看附件({{ data.accessoryInfo.length }}个)</el-link
            >
            <span v-else></span>
          </td>
        </tr>
        <tr>
          <td class="bgColor">备注</td>
          <td colspan="3">{{ data.establishmentRemarks }}</td>
        </tr>
      </table>
      <div class="flexEnd">
        <div class="end">
          <span>项目名称：{{ data.projectInfo && data.projectInfo.projectName}}</span>
          <span>创建负责人：{{data.projectInfo && data.projectInfo.projectManager}}</span>
          <span>创建时间：{{data.projectInfo && data.projectInfo.commencementTime}}</span>
        </div>
      </div>
    </div>
    <div class="main-content" v-else>
      <el-empty description="暂无数据" :image-size="100"></el-empty>
    </div> -->
     <div class="table-border">
      <el-table
        :data="data"
        height="200"
        border
        style="width: 100%"
        :header-cell-style="{background: '#f2f2f2', color: '#000'}"
        @row-click="handleRowDBClick"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60"
          align="center"
        >
        </el-table-column>
        <!-- <el-table-column
          prop="projectInfo.projectName"
          label="项目名称"
          align="center"
          :show-overflow-tooltip="true"
        > 
        </el-table-column>-->
        <el-table-column
          prop="pcode"
          label="项目代码"
          align="center"
          :show-overflow-tooltip="true"
        >
         <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.pcode }}</a
          >
        </template>
        </el-table-column>
        <el-table-column
          prop="establishmentName"
          label="建设性质"
          width="100"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="establishmentApprovalUnit"
          label="审批单位"
          align="center"
          :show-overflow-tooltip="true"
        >
        <template v-slot="{row}">
            {{getDictName('xmgl-lxspjg', row.establishmentApprovalUnit)}}
        </template>
        </el-table-column>
        <el-table-column
          prop="establishmentDate"
          label="批复日期"
          align="center"
          width="130"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
         <el-table-column
          prop="establishmentInvestmentAmount"
          label="总投资(万元)"
          align="center"
          width="150"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="establishmentRemarks"
          label="备注"
          align="center"
          width="100"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
      </el-table>
      <div class="page-footer">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageResult.page"
          :page-sizes="[5, 10, 20, 30, 50]"
          :page-size="pageResult.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageResult.total"
        >
        </el-pagination>
      </div>
      <el-dialog
        title="立项备案-详情"
        :visible.sync="dialogVisible"
        width="1000px"
      >
       <table align="center">
        <tr>
          <td class="bgColor" style="width: 130px">项目代码</td>
          <td >{{ form.pcode }}</td>
            <td class="bgColor" style="width: 130px">建设性质</td>
          <td style="width:240px">{{ getDictName('xmgl-jclx-jsxz',form.establishmentName) }}</td>
          
        </tr>
        <tr>
          <td class="bgColor">总投资(万元)</td>
          <td>{{ form.establishmentInvestmentAmount }}</td>
          <td class="bgColor">批复日期</td>
          <td>{{ form.establishmentDate }}</td>
          
        </tr>
        <tr>
          <td class="bgColor">审批单位</td>
          <td :colspan="3">
            {{ getDictName('xmgl-lxspjg', form.establishmentApprovalUnit) }}
          </td>
        </tr>
        <!-- <tr>
          <td class="bgColor">附件信息</td>
          <td colspan="3">
            <el-link
              type="primary"
              @click="handleLook(form.accessoryInfo)"
              v-if="form.accessoryInfo && form.accessoryInfo.length > 0"
              >查看附件({{ form.accessoryInfo.length }}个)</el-link
            >
            <span v-else>无</span>
          </td>
        </tr> -->
        <tr>
          <td class="bgColor">备注</td>
          <td colspan="3">{{ form.establishmentRemarks }}</td>
        </tr>
      </table>
      <dialog-accessory ref="accessory" :accessoryInfo="form.accessoryInfo" />
      <div class="flexEnd">
        <div class="end">
          <!-- <span>项目名称：{{ form.projectInfo && form.projectInfo.projectName}}</span> -->
          <span>{{form.projectInfo && form.projectInfo.projectManager}}</span>
          <span>{{form.projectInfo && form.projectInfo.commencementTime}}</span>
        </div>
      </div>
      </el-dialog>
      
    </div>
  </div>
</template>
<script>
import dialogAccessory from '../dialog/dialogAccessory.vue'
export default {
  name: 'approval',
  components: {
    dialogAccessory,
  },
  data() {
    return {
      data: [],
      show: true,
      pageResult: {
        page: 1,
        pageSize: 10,
        total: 0
      },
      form: {},
      dialogVisible: false,
      dialogTitle: '详情',
    }
  },
  mounted() {
    this.loadData()
  },
  methods: {
     //附件
    handleLook(obj) {
      this.$refs.accessory.open(obj)
    },
    handleSizeChange(val) {
      this.pageResult.pageSize = val
      this.loadData()
    },
    handleCurrentChange(val) {
      this.pageResult.page = val
      this.loadData()
    },
    handleRowDBClick(data) {
      console.log(data)
      this.dialogVisible = true
      this.form = data
    },
    loadData() {
      let param = {
        pageBean: {
        ...this.pageResult
        },
        querys: [
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'PROJECT_ID_ ',
            relation: 'AND',
            value: this.$route.params.id,
          },
        ],
      }
      this.$http
        .post('${cqxy}/biz/projectApproval/projectEstablishment/v1/page', param)
        .then(
          (res) => {
            let resp=res.data.value
            this.data=resp.rows
            this.pageResult={
               page: resp.page,
               pageSize: resp.pageSize,
               total: resp.total
            }
          },
          (error) => {
            reject(error)
          }
        )
    },
  },
}
</script>
<style lang="scss" scoped>
@import '../css/projectCommon.scss';
/deep/ .el-main .content {
  padding: 0 !important;
}
.page-footer {
  padding-top: 10px;
  float: right;
  height: 38px;
}
/deep/ .el-dialog__body {
  padding-top: 10px;
}
.table-border {
  height: 500px;
}
/deep/ .el-table {
  height: calc(100% - 38px) !important;
}
</style>