<template>
    <div>
        <div class="content">
            <dataTable :columns="columns" :page-obj="pageObj" :breads="breads" :checklist="checklist" url="/bidder/project/list">
                <el-table-column slot="opration" align="center" label="状态" flexd="right" width="200px">
                    <template slot-scope="scope">
                        <div>{{ totalMarks(scope.row.status) }}</div>
                    </template>
                </el-table-column>
                <el-table-column slot="opration" align="center" label="快捷操作" flexd="right" width="300px">
                    <template slot-scope="scope">
                        <el-button type="text" size="small" @click="handlesee(scope.row)">查看招标公告 </el-button>
                        <el-button type="text" size="small" @click="jump(scope.row)">查看询价公告 </el-button>
                        <el-button type="text" size="small" @click="signup(scope.row)">报名 </el-button>
                    </template>
                </el-table-column>
            </dataTable>
        </div>
    </div>
</template>

<script>
import { projectStatusList } from '@api/common/list';
import dataTable from '@components/dataTable.vue';
export default {
    components: {
        dataTable
    },
    data() {
        return {
            pageObj: {
                size: 10,
                currentPage: 1,
                func: (currentPage) => {
                    this.pageTurning(currentPage);
                }
            },
            checklist: [
                {
                    title: '项目名称',
                    type: 'input',
                    model: 'projectName'
                }
            ],
            breads: ['招标管理', '在线报名'],
            columns: [
                {
                    label: '项目编号',
                    prop: 'code'
                },
                {
                    label: '项目名称',
                    prop: 'name'
                },
                {
                    label: '标书结束时间',
                    prop: 'end'
                },
                {
                    slot: 'opration'
                }
            ]
        };
    },
    created() {
        this.getprojectStatusList();
    },
    methods: {
        jump(row) {
            this.$router.push('/supply/bid/signupOnline/seePrice');
            localStorage.setItem('projectId', row.projectId);
        },
        totalMarks: function (status) {
            let value = this.map.get(status);
            return value;
        },
        // 获取状态
        async getprojectStatusList() {
            const data = await projectStatusList();
            this.map = new Map();
            for (let item of data) {
                this.map.set(item.id, item.name);
            }
        },
        handlesee(row) {
            this.$router.push('/supply/bid/signupOnline/seeAnnouncement');
            // this.$router.push(`/supply/bid/signupOnline/seeAnnouncement?id=${row.projectId}`)
            localStorage.setItem('projectId', row.projectId);
        },
        signup(row) {
            this.$router.push('/supply/bid/signupOnline/SignUp');
            // this.$router.push(`/supply/bid/signupOnline/SignUp?id=${row.projectId}`)
            localStorage.setItem('projectId', row.projectId);
        }
    }
};
</script>

<style scoped>
.home > .user {
    box-sizing: border-box;
    padding-top: 20px;
    padding-left: 20px;
    background: #fff;
}
.name {
    font-size: 20px;
    margin-left: 20px;
}
</style>