<template>
  <div>
    <el-dialog
      :close-on-click-modal="false"
      title="报价详情"
      :visible.sync="showTroubleshooting"
      width="80%"
      :close-on-press-escape="false"
      :before-close="handleClose"
    >
      <template>
        <el-table
          ref="multipleSelection"
          v-loading="loading"
          border
          :data="tableData"
          :style="{width: '100%'}"
          :max-height="tableMaxHeight"
          :cell-style="{'text-align': 'center'}"
          :header-cell-style="{'text-align': 'center'}"
        >
        <el-table-column
            prop="matCode"
            min-width="100px"
            label="企业物料编号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matPlatcode"
            min-width="100px"
            label="平台物料编号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matName"
            min-width="100px"
            label="物料名称"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matMaterial"
            min-width="100px"
            label="物料牌号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matSpec"
            min-width="100px"
            label="规格型号"
            show-overflow-tooltip
            align="center"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matNum"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="数量"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="matUnit"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="计量单位"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="quotationRounds"
            show-overflow-tooltip
            min-width="90px"
            align="center"
            label="报价轮次"
            resizable
          >
          </el-table-column>
          <el-table-column
          prop="quotationMethod"
          show-overflow-tooltip
          min-width="100px"
          align="center"
          label="报价方式"
          resizable
        >
          <template slot-scope="scope">
            <span v-if="scope.row.quotationMethod==1">现金</span>
            <span v-if="scope.row.quotationMethod==2">承兑</span>
            <span v-if="scope.row.quotationMethod==3">其他</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="isTax"
          show-overflow-tooltip
          min-width="100px"
          align="center"
          label="是否含税"
          resizable
        >
          <template slot-scope="scope">
            <div>
              {{ scope.row.isTax ==1?'含税':'不含税' }}
            </div>
          </template>
        </el-table-column>
          <el-table-column
            prop="quotationPrice"
            show-overflow-tooltip
            min-width="100"
            align="center"
            label="报价单价(元)"
            resizable
          >
          </el-table-column>
          <el-table-column
            prop="quotationAmount"
            show-overflow-tooltip
            min-width="100"
            align="center"
            label="报价金额(元)"
            resizable
          >
          <template slot-scope="scope">
            <div>
              {{(scope.row.quotationPrice * scope.row.matNum).toFixed(2)}}
            </div>
          </template>
          </el-table-column>
        </el-table>
      </template>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {TableMixin} from '@/mixins/tableMixin'
// import nineLittlePlaceApi from '@/views/Manage/saftyDanger/api/nineLittlePlaceApi'
export default {
  name: 'CmgtSaftyDangerCheckplanFormDialogTroubleshooting', // 排查计划明细
  props: {},
  data() {
    return {
      tableMaxHeight: 400,
      showTroubleshooting: false, // 控制弹层显示与隐藏
      activeName: '综合评标法',
      tableData: [],
      querys: [
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quo.NOTICE_ID_',
          relation: 'AND',
          value: ''
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quo.QUOTATION_COMPANY_ID_',
          relation: 'AND',
          value: ''
        },
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'quo.QUOTATION_ROUNDS_',
          relation: 'AND',
          value: ''
        }
      ],
      queryParam: {
        pageBean: {
          page: 1,
          pageSize: 20
        }
      },
      checkedGh: '',
    }
  },
  mixins: [TableMixin],
  created() {},
  methods: {
    //搜索
    handleSearch() {
      // this.loadData()
    },
    //重置
    handleReset() {
      // this.loadData()
    },
    //显示弹框
    add(row) {
      console.log(row,'row');
      this.querys[0].value = row.noticeId
      this.querys[1].value = row.quotationCompanyId
      this.querys[2].value = row.quotationRounds
      this.showTroubleshooting = true
      this.loadData()
    },
    // 获取list
    loadData(page) {
      if (page) {
        this.queryParam.pageBean.page = page
      }
      // 不分页
      this.queryParam.pageBean.pageSize = -1
      this.loading = true
      this.tableData = []
      this.queryParam.querys = []
      if (this.querys[0].value) {
        this.queryParam.querys.push(this.querys[0])
      }
      if (this.querys[1].value) {
        this.queryParam.querys.push(this.querys[1])
      }
      if (this.querys[2].value) {
        this.queryParam.querys.push(this.querys[2])
      }
      this.$http.post('${portal}/bizBiddingQuotation/v1/pageMatDetail',this.queryParam).then(res=>{
        if(res.data.state){
          this.tableData = res.data.value.rows
          this.total = res.data.value.total
        }
        this.$set(this.tableData)
        this.loading = false
      })
    },
    // 重置
    clearQuerys() {
      this.querys[0].value = ''
      this.querys[1].value = ''
    },
    // 点击关闭按钮
    handleClose() {
      this.$refs.multipleSelection.clearSelection()
      this.showTroubleshooting = false
    },
    // 保存按钮
    handleSave() {
      this.$emit('addDetail', this.multipleSelection[0])
      this.handleClose()
    }
  }
}
</script>

<style scoped lang="scss">
/deep/.el-dialog__body {
  padding: 0 20px 40px 20px;
}
</style>
