<template>
  <!-- 结算 -->
  <div
    class="items bgc"
    id="acc5"
  >
    <!-- 标题 -->
    <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="projectInfo.projectName"
          label="项目名称"
          :show-overflow-tooltip="true"
          align="center"
        >
         <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.projectInfo.projectName }}</a
          >
        </template>
        </el-table-column>

        <el-table-column
          prop="filingAuthorityDate"
          label="结算时间"
          :show-overflow-tooltip="true"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="filingAuthorityOpinions"
          label="结算单位"
          :show-overflow-tooltip="true"
          align="center"
        >
        </el-table-column>

        <el-table-column
          prop="filingAuthorityRegistrant"
          label="结算金额(元)"
          :show-overflow-tooltip="true"
          align="center"
        >
        </el-table-column>

        <el-table-column
          prop="remarks"
          label="备注"
          width="120"
          :show-overflow-tooltip="true"
          align="center"
        >
        </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>
              <el-tooltip
                class="item"
                effect="dark"
                :content="form.filingAuthorityOpinions"
                placement="top-start"
              >
                <p class="descStyle">
                  {{ form.filingAuthorityOpinions }}
                </p>
              </el-tooltip>
            </td>
            <td
              class="bgColor"
              style="width: 130px"
            >结算时间</td>
            <td style="width: 180px">{{ form.filingAuthorityDate }}</td>
          </tr>
          <tr>
            <td class="bgColor">结算金额(元)</td>
            <td>{{ form.filingAuthorityRegistrant }}</td>
            <td class="bgColor"></td>
            <td></td>
            <!-- <td class="bgColor">合同名称</td>
          <td >{{ form.contractName }}</td> -->
          </tr>
          <!-- <tr>
           <td class="bgColor">合同金额(万元)</td>
          <td >{{ form.contractInfo.contractAmount }}</td>
        </tr> -->
          <!-- <tr>
          <td class="bgColor">乙方单位</td>
          <td >{{ form.handlerUnit }}</td>
           <td class="bgColor"></td>
          <td ></td>
        </tr> -->
          <tr>
            <td class="bgColor">审批意见</td>
            <td colspan="3">{{ form.approvalOpinion }}</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>项目名称：{{data.projectInfo && data.projectInfo.projectName}}</span> -->
            <span>{{form.projectInfo && form.projectInfo.projectManager}}</span>
            <span>{{form.projectInfo && form.projectInfo.commencementTime}}</span>
          </div>
        </div>
      </el-dialog>
      <!-- <dialog-accessory ref="accessory" /> -->
    </div>
    <!-- <div class="main-content" v-if="show">
      
    </div> -->
    <!-- <div class="main-content" v-else>
      <el-empty description="暂无数据" :image-size="100"></el-empty>
    </div> -->
    <!-- <dialog-accessory ref="accessory" /> -->
  </div>
</template>
<script>
import dialogAccessory from '../dialog/dialogAccessory.vue'
export default {
  name: 'handOver',
  components: {
    dialogAccessory
  },
  data() {
    return {
      data: [],
      show: true,
      dialogVisible:false,
      pageResult:{
        page:1,
        pageSize:10,
        total:0
      },
      form: {},
    }
  },
  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: 'pm.ID_',
            relation: 'AND',
            value: this.$route.params.id
          }
        ]
      }
      this.$http
        .post(
          '${cqxy}/biz/completionAcceptance/acceptanceSettlement/v1/page',
          param
        )
        .then(
         resp => {
            let response = resp.data.value
            this.data = response.rows
            this.pageResult = {
              page: response.page,
              pageSize: response.pageSize,
              total: response.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;
}
/deep/ .el-dialog__body {
  padding-top: 10px;
}
.table-border {
  height: 515px;
}
/deep/ .el-table {
  height: calc(100% - 40px) !important;
}
</style>