<template>
  <!-- 清单限价 -->
  <div
    class="do-jump items bgc"
    id="bid1"
  >
    <!-- 标题 -->
    <div class="title">
      <span class="icon"></span>
      <span class="text">清单限价</span>
    </div>
    <!-- 详情 -->
    <!-- tabs切换 -->
    <div class="main-content">
      <el-tabs
        type="border-card"
        v-model="activeName"
        @tab-click="handleClick"
      >
        <!-- 编制 -->
        <el-tab-pane
          label="编制"
          name="establishment"
        >
          <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="name"
                label="清单信息名称"
                align="center"
                :show-overflow-tooltip="true"
              >
               <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.name }}</a
          >
        </template>
              </el-table-column>
              <el-table-column
                prop="tenderee"
                label="编制单位"
                align="center"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
              <ht-table-column
                prop="tendereeDate"
                label="编制日期"
                align="center"
                width="130"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <el-table-column
                prop="priceCeiling"
                label="编制金额(元)"
                align="center"
                width="130"
                :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>
          </div>
          <el-dialog
            title="清单限价-编制-详情"
            :visible.sync="dialogVisible"
            width="1000px"
          >
            <table align="center">
              <tr>
                <td
                  class="bgColor"
                  style="width: 130px"
                >清单信息名称</td>
                <td>
                  <!-- {{ formData.name }} -->
                   <el-tooltip
                    :content="formData.name"
                    placement="top"
                  >
                    <p class="descStyle">
                      {{ formData.name }}
                    </p>
                  </el-tooltip>
                </td>
                <td
                  class="bgColor"
                  style="width: 130px"
                >编制单位</td>
                <td>
                  <el-tooltip
                    content="查看合同管理信息"
                    placement="top"
                  >
                    <el-link
                      type="primary"
                      @click="handleViewDetils(formData.tenderee)"
                    >
                      <p class="descStyle">{{ formData.tenderee }}</p>
                    </el-link>
                  </el-tooltip>
                </td>
              </tr>
              <tr>
                <td class="bgColor">编制日期</td>
                <td>{{ formData.tendereeDate }}</td>
                <td class="bgColor">编制金额(元)</td>
                <td>{{ formData.priceCeiling }}</td>
              </tr>
              <!-- <tr>
                <td class="bgColor">附件信息</td>
                <td colspan="3">
                  <el-link
                    type="primary"
                    @click="handleLook(formData.accessoryInfo)"
                    v-if="
                      formData.accessoryInfo &&
                      formData.accessoryInfo.length > 0
                    "
                  >查看附件({{ formData.accessoryInfo.length }}个)</el-link>
                  <span v-else></span>
                </td>
              </tr> -->
              <tr>
                <td class="bgColor">备注</td>
                <td colspan="3">{{ formData.establishmentRemarks }}</td>
              </tr>
            </table>
            <dialog-accessory ref="accessory" :accessoryInfo="formData.accessoryInfo" />
            <div class="flexEnd">
              <div class="end">
                <!-- <span>项目名称：{{ formData.projectInfo && formData.projectInfo.projectName}}</span> -->
                <span>{{ formData.projectInfo && formData.projectInfo.projectManager}}</span>
                <span>{{ formData.projectInfo && formData.projectInfo.commencementTime}}</span>
              </div>
            </div>
          </el-dialog>
        </el-tab-pane>
        <!-- 审核 -->
        <el-tab-pane
          label="审核"
          name="audit"
        >
          <div class="table-border">
            <el-table
              :data="data2"
              height="200"
              border
              style="width: 100%"
              :header-cell-style="{background: '#f2f2f2', color: '#000'}"
              @row-click="handleRowDBClick2"
            >
              <el-table-column
                type="index"
                label="序号"
                width="55"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="tenderee"
                label="审核单位"
                align="center"
                :show-overflow-tooltip="true"
              >
               <template v-slot="{row}">
          <a
            class="a-link"
            >{{ row.tenderee }}</a
          >
        </template>
              </el-table-column>
              <ht-table-column
                prop="tendereeDate"
                label="审核日期"
                align="center"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <el-table-column
                prop="priceCeiling"
                label="审定金额(元)"
                align="center"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
              <el-table-column
                prop="name"
                label="安全文明施工费(元)"
                align="center"
                width="160"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
              <el-table-column
                prop="docNumber"
                label="审减/审增金额(元)"
                align="center"
                width="160"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
              <el-table-column
                prop="ownerUnit"
                label="审减/审增率(%)"
                align="center"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
              <el-table-column
                prop="establishmentRemarks"
                label="备注"
                align="center"
                width="80"
                :show-overflow-tooltip="true"
              >
              </el-table-column>
            </el-table>
            <div class="page-footer">
              <el-pagination
                @size-change="handleSizeChange2"
                @current-change="handleCurrentChange2"
                :current-page="pageResult2.page"
                :page-sizes="[5, 10, 20, 30, 50]"
                :page-size="pageResult2.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="pageResult2.total"
              >
              </el-pagination>
            </div>
          </div>
          <el-dialog
            title="清单限价-审核-详情"
            :visible.sync="dialogVisible2"
            width="1000px"
          >
            <table align="center">
              <tr>
                <td
                  class="bgColor"
                  style="width: 130px"
                >审核单位</td>
                <td>
                  <el-tooltip
                    content="查看合同管理信息"
                    placement="top"
                  >
                    <el-link
                      type="primary"
                      @click="handleViewDetils(formData2.tenderee)"
                    >
                      <p class="descStyle">{{ formData2.tenderee }}</p>
                    </el-link>
                  </el-tooltip>
                </td>
                <td
                  class="bgColor"
                  style="width: 150px"
                >审核日期</td>
                <td style="width:200px">{{ formData2.tendereeDate }}</td>
              </tr>
              <tr>
                <td class="bgColor">审定金额(元)</td>
                <td>{{ formData2.priceCeiling }}</td>
                <td class="bgColor">安全文明施工费(元)</td>
                <td>{{formData2.name}}</td>
              </tr>
              <tr>
                <td class="bgColor">审减/审增金额(元)</td>
                <td>{{ formData2.docNumber }}</td>
                <td class="bgColor">审减/审增率(%)</td>
                <td>{{formData2.ownerUnit}}</td>
              </tr>
              <!-- <tr>
                <td class="bgColor">附件信息</td>
                <td colspan="3">
                  <el-link
                    type="primary"
                    @click="handleLook(formData2.accessoryInfo)"
                    v-if="
                      formData2.accessoryInfo &&
                      formData2.accessoryInfo.length > 0
                    "
                  >查看附件({{ formData2.accessoryInfo.length }}个)</el-link>
                  <span v-else>无</span>
                </td>
              </tr> -->
              <tr>
                <td class="bgColor">备注</td>
                <td colspan="3">{{ formData2.establishmentRemarks }}</td>
              </tr>
            </table>
            <dialog-accessory ref="accessory" :accessoryInfo="formData2.accessoryInfo" />
            <div class="flexEnd">
              <div class="end">
                <!-- <span>项目名称：{{formData2.projectInfo && formData2.projectInfo.projectName}}</span> -->
                <span>{{formData2.projectInfo && formData2.projectInfo.projectManager}}</span>
                <span>{{formData2.projectInfo && formData2.projectInfo.commencementTime}}</span>
              </div>
            </div>
          </el-dialog>
        </el-tab-pane>
      </el-tabs>
    </div>
    <!-- <dialog-accessory ref="accessory" /> -->
    <contractListDialog
      :querysValue='querysValue'
      ref='contractList'
    />
  </div>
</template>
<script>
import dialogAccessory from '../dialog/dialogAccessory.vue'
import planning from './planning.vue'
import contractListDialog from '../dialog/contractListDialog.vue'
export default {
  name: 'projectInfo',
  components: {
    dialogAccessory,
    planning,
    contractListDialog
  },
  data() {
    return {
      data: [],
      data2: [],
      activeName: 'establishment',
      dialogTitle: '详情',
      dialogVisible: false,
      dialogVisible2: false,
      formData: {},
      formData2: {},
      pageResult: {
        page: 1,
        pageSize: 10,
        total: 0
      },
      pageResult2: {
        page: 1,
        pageSize: 10,
        total: 0
      },
      querysValue: ''
    }
  },
  mounted() {
    this.loadData()
    this.loadData2()
  },
  methods: {
    //tabs
    handleClick(tab, even) {
      // console.log(tab.paneName)
    },
    //附件
    handleLook(obj) {
      this.$refs.accessory.open(obj)
    },
    handleRowDBClick(data) {
      this.dialogVisible = true
      this.formData = data
    },
    handleRowDBClick2(data) {
      this.dialogVisible2 = true
      this.formData2 = data
    },
    handleSizeChange(val) {
      this.pageResult.pageSize = val
      this.loadData()
    },
    handleCurrentChange(val) {
      this.pageResult.page = val
      this.loadData()
    },
    handleSizeChange2(val) {
      this.pageResult.pageSize = val
      this.loadData2()
    },
    handleCurrentChange2(val) {
      this.pageResult2.page = val
      this.loadData2()
    },
    handleDialogCancel() {
      this.dialogVisible = false
    },
    // handleRowDBClick2(data) {
    //   this.dialogVisible2 = true
    //   this.formData2 = data
    // },

    handleDialogCancel2() {
      this.dialogVisible2 = false
    },
    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: 'bbpl.tenderee_date_'}]
      }
      this.$http
        .post('${cqxy}/biz/bidManagement/biddingPriceLimit/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)
          }
        )
    },
    loadData2() {
      let param = {
        pageBean: {
          ...this.pageResult2
        },
        querys: [
          {
            group: 'advance',
            opener: 'LIKE',
            property: 'pm.ID_',
            relation: 'AND',
            value: this.$route.params.id
          }
        ],
        sorter: [{direction: 'DESC', property: 'bbpe.tenderee_date_'}]
      }
      this.$http
        .post('${cqxy}/biz/bidManagement/biddingPriceExamine/v1/page', param)
        .then(
          resp => {
            let response = resp.data.value
            this.data2 = response.rows
            this.pageResult2 = {
              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-tabs__item {
  font-size: 18px !important;
}
/deep/ .el-tabs__content {
  padding: 10px !important;
}
.table-border {
  height: 515px;
  .el-table {
    height: calc(100% - 55px) !important;
  }
}
.page-footer {
  margin-top: 10px;
  height: 30px;
  float: right;
}
</style>