<template>
	<div>
		<div class="content">
			<dataBreadcrumb :breads="breads"></dataBreadcrumb>
			<changeNav :navs="navs" @getIndex="getIndex"></changeNav>
			<div class="absolute">
				<el-button type="primary" @click="out">提出问题</el-button>
			</div>
			<div v-show="idx==0">
				<dataTable :columns="columns" :page-obj="pageObj" url="bidder-clarifies/list">
					<el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">
						<template slot-scope="scope">
							<el-button v-if="scope.row.operaion=='待确认'" type="text" size="small" @click="confirm(scope.row)">确认</el-button>
							<el-button v-else type="text" size="small" @click="handleSee(scope.row)">查看</el-button>
						</template>
					</el-table-column>
				</dataTable>
			</div>
			<div v-show="idx==1">
				<dataTable :columns="columns" :page-obj="pageObj1" url="bidder-clarifies/list">
					<el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">  
						<template slot-scope="scope">
							<el-button v-if="scope.row.operaion=='待确认'" type="text" size="small" @click="confirm(scope.row)">确认</el-button>
							<el-button v-else type="text" size="small" @click="handleSee1(scope.row)">查看</el-button>
						</template>
					</el-table-column>
				</dataTable>
			</div>
		</div>
	</div>
</template>

<script>
	// import { getList } from '@api/common/list'
	import dataTable from '@components/dataTable.vue'
	import changeNav from '@components/changeNav.vue'
	import dataBreadcrumb from '@components/dataBreadcrumb.vue'
	export default {
		name: 'bidingList',
		components: {
			dataTable,
			changeNav,
			dataBreadcrumb
		},
		data() {
			return {
				idx:0,
				navs: ["问题列表","公告列表"],
				breads: ['投标管理', '我参与的项目', '工作台'],
				checklist: [{
					title: '公告名称',
					type: 'input'
				}, {
					title: '状态',
					type: 'select',
					selectlist: [{
						value: '1',
						label: '公开招标'
					}, {
						value: '2',
						label: '邀请招标'
					}],
					change: row => ''
				}],
				tableData: [],
				columns: [{
						label: '澄清问题标题',
						prop: 'title'
					},
					{
						label: '提出时间',
						prop: 'createTime',
						sortable: true
					},
					{
						label: '状态',
						prop: 'operaion'
					},
					{
						label: '提出人',
						prop: 'tenderCompanyName'
					},
					{
						label: '回复人',
						prop: 'bidCompanyName'
					},
					{
						slot: 'operate'
					}
				], // 操作列
				pageObj: {
				  size: 10,
				  currentPage: 1,
				  type:1,
				  func: (currentPage) => {
				    this.pageTurning(currentPage)
				  }
				},
				pageObj1: {
				  size: 10,
				  currentPage: 1,
				  type:2,
				  func: (currentPage) => {
				    this.pageTurning(currentPage)
				  }
				}
			}  
		},
		created() {
			this.pageObj.projectId = localStorage.getItem("projectId")
			this.pageObj.companyId = localStorage.getItem("companyId")
			this.pageObj1.projectId = localStorage.getItem("projectId")
			this.pageObj1.companyId = localStorage.getItem("companyId")
		},
		methods: {
			getIndex(value){
					 this.idx=value
			},
			// 问题查看
			handleSee(row) {
				this.$router.push({
					path: '/supply/bid/joinProject/bidStage/clearManagement/see',
					query: {
						questionId:row.questionId,
						type:"question"
					}
				})
			},
			// 公开查看
			handleSee1(row) {
				this.$router.push({
					path: '/supply/bid/joinProject/bidStage/clearManagement/see',
					query: {
						noticeId:row.noticeId,
						type:"notice"
					}
				})
			},
			// 确定
			confirm(row) {
				this.$router.push({
					path: '/supply/bid/joinProject/bidStage/clearManagement/confirm',
					query: {
						noticeId:row.noticeId,
						bidCompanyName:row.bidCompanyName,
						title:row.title
					}
				})
			},
			out() {
				this.$router.push("/supply/bid/joinProject/bidStage/clearManagement/propose")		
			}

		}
	}
</script>

<style scoped>
	.absolute {
		position: absolute;
		right: 50px;
		top: 65px
	}
</style>
