<template>
  <div>
    <div class="content">
      <dataBreadcrumb :breads="breads"></dataBreadcrumb>
      <changeNav :navs="navs"></changeNav>
      <dataTable :table-data="tableData" :columns="columns"  :is-index="true">
        <el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="see(scope.row)" v-if="scope.row.replyId">查看</el-button>
			<el-button type="text" size="small" @click="reply(scope.row.questionId)" v-else>回复</el-button>
          </template>
        </el-table-column>
      </dataTable>
    </div>
  </div>
</template>

<script>
	import { clarifyInquirylist} from '@api/supply/bid'
import dataTable from '@components/nopageTable.vue'
import dataBreadcrumb from '@components/dataBreadcrumb.vue'
import changeNav from '@components/changeNav.vue'
export default {
  name: 'bidingList',
  components: {
    dataTable,
    dataBreadcrumb,
    changeNav
  },
  data() {
    return {
	  navs:["评标问题澄清"],
      breads: ['投标管理', '我参与的项目', '工作台 '],
      tableData: [],
      columns: [{
        label: '澄清标题',
        prop: 'title'
      },
      {
        label: '状态',
        prop: 'state'
      },
      {
        label: '发布时间',
        prop: 'createTime',
        sortable: true
      },
      {
        label: '回复截止时间',
        prop: 'cutOffTime'
      },
      {
        slot: 'operate'
      }
      ], // 操作列

    }
  },
  methods: {
    reply(questionId) {
      this.$router.push(`/supply/bid/joinProject/bidEvaluation/reply?questionId=${questionId}`)
    },
	see(row){
		 this.$router.push({
			 path:"/supply/bid/joinProject/bidEvaluation/see",
			 query:{
				questionId:row.questionId,
				replyId:row.replyId
			 }
		 })
	},
	  async getclarifyInquirylist() {
		  let message={}
		  message.companyId=localStorage.getItem("companyId")
		   message.projectId=localStorage.getItem("projectId")
	        const {
	          data,
	          code
	        } = await clarifyInquirylist(message)
			if(code==200){
				for (let item of data){
					if(item.replyId){
						item.state="已回复"
					}else{
						item.state="未回复"
					}
				}
				this.tableData=data
			}
	    }
  },
  created() {
  	this.getclarifyInquirylist();
  }
}
</script>

<style scoped>

</style>
