<template>
  <!-- 单位工程验收 -->
  <div
    class="items bgc"
    id="acc1"
  >
    <!-- 标题 -->
    <div class="title">
      <span class="icon"></span>
      <span class="text">单位工程验收</span>
    </div>
    <!-- 详情 -->
    <div class="table-border">
      <el-table
        :data="data"
        height="230"
        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="sketch"
          label="验收会议主题"
          align="center"
          width="380"
          :show-overflow-tooltip="true"
        >
         <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.sketch }}</a
          >
        </template>
        </el-table-column>
        <el-table-column
          prop="acceptanceDate"
          label="验收时间"
          align="center"
          width="130"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        
        <el-table-column
          prop="handlerUnit"
          label="参加单位"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <!-- <ht-table-column
          prop="acceptancePlace"
          label="会议地点"
          align="center"
          :show-overflow-tooltip="true"
        >
        </ht-table-column> -->
        <!-- <el-table-column
            prop="handlerName"
            label="经办人"
            align="center"
            :show-overflow-tooltip="true"
            >
          </el-table-column> -->

        <el-table-column
          prop="remarks"
          label="备注"
          align="center"
          width="80"
          :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>
    </div>
    <el-dialog
      title="单位工程验收-详情"
      :visible.sync="dialogVisible"
      width="1000px"
    >
      <table align="center">
        <tr>
          <td class="bgColor">验收会议主题</td>
          <td colspan="3">{{ form.sketch }}</td>
        </tr>
        <tr>
          <td
            class="bgColor"
            style="width: 130px"
          >验收时间</td>
          <td style="width: 280px">{{ form.acceptanceDate }}</td>
          <td class="bgColor" style="width: 130px">验收地点</td>
          <td>{{form.acceptancePlace}}</td>
          <!-- <td class="bgColor" style="width: 150px">经办人</td>
          <td>{{ form.handlerName }}</td> -->
        </tr>
        
        <tr>
          <td class="bgColor">参建单位</td>
          <td colspan="3">{{ form.handlerUnit }}</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.remarks }}</td>
        </tr>
      </table>
      <dialog-accessory ref="accessory" :accessoryInfo="form.accessoryInfo" />
      <div class="flexEnd">
        <div class="end">
          <span>{{form.projectInfo && form.projectInfo.projectManager}}</span>
          <span>{{form.projectInfo && form.projectInfo.commencementTime}}</span>
        </div>
      </div>
    </el-dialog>
    <!-- <dialog-accessory ref="accessory" /> -->
  </div>
</template>
<script>
import dialogAccessory from '../dialog/dialogAccessory.vue'
export default {
  name: 'unitAccpet',
  components: {
    dialogAccessory
  },
  data() {
    return {
      data: [], //表格数据
      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) {
      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
          }
        ],
        sorter: [
          {
            direction: 'DESC',
            property: 'acceptance_date_'
          }
        ]
      }
      this.$http
        .post(
          '${cqxy}/biz/completionAcceptance/unitProjectAcceptance/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';
.page-footer {
  padding-top: 10px;
  float: right;
}
.table-border {
  height: 515px;
}
/deep/ .el-table {
  height: calc(100% - 32px) !important;
}
</style>