<template>
  <!-- 招投标 -->
  <div
    class="items bgc"
    id="bid2"
  >
    <!-- 标题 -->
    <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="documentNumber"
          label="招标名称"
          align="center"
          :show-overflow-tooltip="true"
        >
         <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.documentNumber }}</a
          >
        </template>
        </el-table-column>
        <!-- <el-table-column
          prop="biddingChargeType"
          label="招标方式"
          align="center"
          :show-overflow-tooltip="true"
        >
          <template v-slot="{row}">
            {{ getDictName('zbfs', row.biddingChargeType) }}
          </template>
        </el-table-column> -->
        <el-table-column
          prop="bidWinner"
          label="中标单位"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="bidAmountExamine"
          label="招标限价(元)"
          align="center"
          width="130"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="bidAmount"
          label="中标金额(元)"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="actualSettlementAmount"
          label="安全文明施工费(元)"
          align="center"
          width="160"
          :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>
      <el-dialog
        title="招投标-详情"
        :visible.sync="dialogVisible"
        width="1000px"
      >
        <table align="center">
          <tr>
            <td
              class="bgColor"
              style="width: 150px"
            >招标名称</td>
            <td>{{ form.documentNumber }}</td>
            <td
              class="bgColor"
              style="width: 150px"
            >招标方式</td>
            <td style="width: 240px">
              {{ getDictName('zbfs', form.biddingChargeType) }}
            </td>
          </tr>
          <tr>
            <td class="bgColor">招标限价(元)</td>
            <td>{{ form.bidAmountExamine }}</td>
            <td class="bgColor">投标保证金金额(元)</td>
            <td>{{ form.projectBudget }}</td>
          </tr>
          <tr>
            <td class="bgColor">中标单位</td>
            <td>
              <el-tooltip
                content="查看合同管理信息"
                placement="top"
              >
                <el-link
                  type="primary"
                  @click="handleViewDetils(form.bidWinner)"
                >
                  <p class="descStyle">{{form.bidWinner}}</p>
                </el-link>
              </el-tooltip>
            </td>
            <td class="bgColor">中标人资质等级</td>
            <td>
              <!-- {{ form.bidWinnerAgentPhone }} -->
              <el-tooltip :content="form.bidWinnerAgentPhone " placement="top">
            <p class="descStyle">
              {{ form.bidWinnerAgentPhone  }}
            </p>
          </el-tooltip>
              </td>
          </tr>
          <tr>
            <td class="bgColor">投资性质</td>
            <td>
              {{ getDictName('zbgl-zbdwxz', form.contractPaymentMethod) }}
            </td>
            <td class="bgColor">项目经理</td>
            <td>{{ form.bidWinnerAgentName }}</td>
          </tr>
          <tr>
            <td class="bgColor">中标金额（元）</td>
            <td>{{ form.bidAmount }}</td>
            <td class="bgColor">安全文明施工费(元)</td>
            <td>{{ form.actualSettlementAmount }}</td>
          </tr>
          <tr>
            <td class="bgColor">签发日期</td>
            <td>{{ form.completionDate }}</td>
            <td class="bgColor">项目负责人电话</td>
            <td>{{ form.payeePhone }}</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>
    <contractListDialog
      :querysValue='querysValue'
      ref='contractList'
    />
  </div>
</template>
<script>
import dialogAccessory from '../dialog/dialogAccessory.vue'
import contractListDialog from '../dialog/contractListDialog.vue'
export default {
  name: 'biding',
  components: {
    dialogAccessory,
    contractListDialog
  },
  data() {
    return {
      data: [], //表格数据
      pageResult: {
        page: 1,
        pageSize: 10,
        total: 0
      },
      form: {},
      dialogVisible: false,
      dialogTitle: '添加',
      querysValue: ''
    }
  },
  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: 'advance',
            opener: 'LIKE',
            property: 'pm.ID_',
            relation: 'AND',
            value: this.$route.params.id
          }
        ],
        sorter: [{direction: 'DESC', property: 'bbm.commencement_date_'}]
      }
      this.$http
        .post('${cqxy}/biz/bidManagement/biddingManagement/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)
          }
        )
    },
    handleViewDetils(value) {
      this.querysValue = value
      this.$refs.contractList.open()
    }
  }
}
</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>
