	<template>
    <div>
        <div class="content">
            <dataBreadcrumb :breads="breads"></dataBreadcrumb>
            <div>招标文件澄清列表</div>
            <changeNav :navs="navs" @getIndex="getIndex"></changeNav>
            <div class="absolute">
                <el-button type="primary" @click="propose">提出澄清</el-button>
            </div>
            <div v-show="idx == 0">
                <dataTable :columns="columns" :page-obj="pageObj" url="tender-clarifies/list">
                    <el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">
                        <template slot-scope="scope">
                            <div v-if="scope.row.clarifiesType == 0">
                                <el-button type="text" size="small" @click="handleSee(scope.row)">查看</el-button>
                            </div>
                            <div v-else>
                                <el-button v-if="scope.row.noticeId" type="text" size="small" @click="handleSee(scope.row)">查看</el-button>
                                <el-button v-else type="text" size="small" @click="handleReply(scope.row)">回复</el-button>
                            </div>
                        </template>
                    </el-table-column>
                </dataTable>
            </div>
            <div v-show="idx == 1">
                <dataTable :columns="columns1" :page-obj="pageObj1" url="tender-clarifies/list">
                    <el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">
                        <template slot-scope="scope">
                            <div v-if="scope.row.clarifiesType == 0">
                                <el-button type="text" size="small" @click="handleSee(scope.row)">查看</el-button>
                            </div>
                            <div v-else>
                                <div v-if="scope.row.status == 2">
                                    <el-button type="text" size="small" @click="edit(scope.row.noticeId)">修改</el-button>
                                </div>
                                <div v-else>
                                    <el-button v-if="scope.row.noticeId" type="text" size="small" @click="handleSee(scope.row)"
                                        >查看</el-button
                                    >
                                    <el-button v-else type="text" size="small" @click="handleReply(scope.row)">回复</el-button>
                                </div>
                            </div>
                        </template>
                    </el-table-column>
                </dataTable>
            </div>
            <div class="centerButton">
                <el-button @click="back">返回</el-button>
            </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 {
    components: {
        dataTable,
        changeNav,
        dataBreadcrumb
    },
    data() {
        return {
            idx: 0,
            navs: ['问题列表', '公告列表'],
            breads: ['招标管理', '招标项目管理', '工作台'],
            tableData: [],
            columns: [
                {
                    label: '澄清问题标题',
                    prop: 'title'
                },
                {
                    label: '状态',
                    prop: 'operaion'
                },
                {
                    label: '提出时间',
                    prop: 'createTime',
                    sortable: true
                },
                {
                    label: '供应商',
                    prop: 'bidCompanyName'
                },
                {
                    slot: 'operate'
                }
            ],
            columns1: [
                {
                    label: '澄清公告标题',
                    prop: 'title'
                },
                {
                    label: '状态',
                    prop: 'operaion'
                },
                {
                    label: '提出时间',
                    prop: 'createTime',
                    sortable: true
                },
                {
                    label: '提出人',
                    prop: 'tenderCompanyName'
                },
                {
                    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: {
        back() {
            this.$router.go(-1);
        },
        getIndex(value) {
            this.idx = value;
        },
        //修改
        edit(noticeId){
          this.$router.push(`/purchaser/bid/bidStage/clearManagement/propose?type=1&noticeId=${noticeId}`);
        },
        // 提出
        propose() {
            this.$router.push('/purchaser/bid/bidStage/clearManagement/propose');
        },
        // 查看
        handleSee(row) {
            this.$router.push({
                path: '/purchaser/bid/bidStage/clearManagement/see',
                query: {
                    questionId: row.questionId,
                    noticeId: row.noticeId
                }
            });
        },
        // 回复
        handleReply(row) {
            this.$router.push({
                path: '/purchaser/bid/bidStage/clearManagement/reply',
                query: {
                    questionId: row.questionId
                }
            });
        }
    }
};
</script>

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