<template>
  <div>
    <div class="content">
		<div class="absolut">
			<el-button @click="add">新增问题</el-button>
		</div>
      <dataBreadcrumb :breads="breads"></dataBreadcrumb>
      <changeNav :navs="navs"></changeNav>
      <div class="flex-between" style="width: 80%;margin:30px auto 20px">
        <div>项目编号：{{projectCode}}</div>
        <div>项目名称：{{projectName}}</div>
      </div>
      <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="handleSee(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </dataTable>
      <div class="button flex-center">
        <el-button @click="back">返回</el-button>
      </div>
    </div>
  </div>
</template>

<script>
	import { clarifyinquiryList} from '@api/purchaser/bid'
		import { getTime1} from '@utils/time'
		
import dataTable from '@components/nopageTable.vue'
import dataBreadcrumb from '@components/dataBreadcrumb.vue'
import changeNav from '@components/changeNav.vue'
export default {
  components: {
    dataTable,
    dataBreadcrumb,
    changeNav
  },
  data() {
    return {
		projectCode:"",
		projectName:"",
		projectId:"",
      navs: ['澄清质疑'],
      breads: ['招标管理', '招标项目管理', '工作台'],
      tableData: [],
      columns: [{
        label: '澄清质询问题标题',
        prop: 'title'
      },
      {
        label: '投标人',
        prop: 'companyName'
      },
      {
        label: '提出人',
        prop: 'createBy'
      },
      {
        label: '提出时间',
        prop: 'updateTime',
        sortable: true
      },
      {
        label: '状态',
        prop: 'state'
      },
      {
        slot: 'operate'
      }
      ], // 操作列
    }
  },
  created() {
  	this.getClarifyinquiryList();
	this.projectCode=localStorage.getItem("projectCode")
	this.projectName=localStorage.getItem("projectName")
  },
  methods: {
    back() {
      this.$router.go(-1)
    },
	async getClarifyinquiryList() {
		try {
			let projectId=localStorage.getItem("projectId");
			const {
				data,
				code
			} = await clarifyinquiryList(projectId)
			if (code === 200) {
				for(let item of data){
					item.updateTime=getTime1(item.updateTime)
					if(item.replyId){
						item.state="已回复"
					}else{
						item.state="未回复"
					}		
				}
				this.tableData = data
			}
		} catch (e) {
			console.log(e)
		}
	},
	back(){
		this.$router.go(-1)
	},
	handleSee(row){
		let id=row.pid;
		 this.$router.push({path:`/purchaser/bid/bidEvaluation/review/see?id=${id}`})
	},
	add(){
		this.$router.push("/purchaser/bid/bidEvaluation/review/add")
	}
  }
}
</script>

<style scoped>
	.absolut{
		position: absolute;
		right: 30px;
		top: 70px;
	}
 .button{
width: 100%;
height: 300px;
 }
</style>
