<template>
    <div>
        <div class="coentent">
            <div class="contents-area">
                <div class="areas">
                    <div v-if="active==0">
                        <div class="headers">
                            <div class="headers-name">我的提交列表</div>
                            <div>
                                <el-form :inline="true" :model="form" class="demo-form-inline">
                                    <el-form-item label="收入类型" size="small" style="position: relative;top: -3px;">
                                        <el-select v-model="form.revenueType" placeholder="请选择" class="selects">
                                            <el-option v-for="item in revenueTypeOptions" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                    <el-form-item label="时间筛选" size="small" style="position: relative;top: -3px;">
                                        <el-select v-model="form.year" placeholder="请选择" class="selects">
                                            <el-option v-for="item in yearOptions" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                    <el-form-item size="small" style="position: relative;top: -3px;">
                                        <el-select v-model="form.quarter" placeholder="请选择" class="selects">
                                            <el-option v-for="item in quarterOptions" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                   
                                </el-form>
                            </div>
                        </div>
                        <div class="content-table">
                            <el-table 
                                :data="tableData" 
                                :header-cell-style="{ background: '#EDEFFE', color: '#363636', textAlign: 'center' }"
                                border 
                                style="width: 100%">
                                <el-table-column prop="serial" label="序号" width="80" align="center"></el-table-column>
                                <el-table-column prop="productName" label="审批模块" align="center"></el-table-column>
                                <el-table-column prop="isMainProduct" label="提交内容" width="120" align="center">
                                    <template slot-scope="scope">
                                        <span>{{ scope.row.isMainProduct }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="revenueType" label="提交时间" width="150" align="center">
                                    <template slot-scope="scope">
                                        <span>{{ scope.row.revenueType }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="salesRevenue" label="审核人" align="center">
                                    <template slot-scope="scope">
                                        <span>{{ formatCurrency(scope.row.salesRevenue) }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="salesRevenue" label="审核状态" align="center">
                                    <template slot-scope="scope">
                                        <span>{{ formatCurrency(scope.row.salesRevenue) }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" align="center" width="150">
                                    <template slot-scope="scope">
                                        <el-button @click="handleHomepage(scope.row)" type="text" size="small" style="color: #5165f7;">查看</el-button>
                                       
                                    </template>
                                </el-table-column>
                            </el-table>
                            <div class="footer">
                                <el-pagination 
                                    @size-change="handleSizeChange" 
                                    @current-change="handleCurrentChange"
                                    :current-page="currentPage" 
                                    :page-sizes="[100, 200, 300, 400]" 
                                    :page-size="100"
                                    layout="total, sizes, prev, pager, next, jumper" 
                                    :total="400">
                                </el-pagination>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
     
    </div>
</template>
<script>
export default {
    data() {
        return {
            active: 0,
            currentPage: 1,
            dialogVisible: false,
            form: {
                revenueType: '全部',
                year: '2025',
                quarter: '第一季度'
            },
            productForm: {
                productName: '',
                isMainProduct: '',
                revenueType: '技术服务收入',
                technologySource: '',
                technologyField: '电子信息',
                technologyFieldDetail: '网络应用技术'
            },
            productFormRules: {
                productName: [
                    { required: true, message: '请输入产品(服务)名称', trigger: 'blur' }
                ],
                isMainProduct: [
                    { required: true, message: '请选择是否主要产品', trigger: 'change' }
                ],
                revenueType: [
                    { required: true, message: '请选择收入类型', trigger: 'change' }
                ]
            },
            revenueTypeOptions: [
                {
                    value: '全部',
                    label: '全部'
                },
                {
                    value: '产品收入',
                    label: '产品收入'
                },
                {
                    value: '技术转让收入',
                    label: '技术转让收入'
                }
            ],
            yearOptions: [
                {
                    value: '2023',
                    label: '2023'
                },
                {
                    value: '2024',
                    label: '2024'
                },
                {
                    value: '2025',
                    label: '2025'
                },
                {
                    value: '2026',
                    label: '2026'
                }
            ],
            quarterOptions: [
                {
                    value: '第一季度',
                    label: '第一季度'
                },
                {
                    value: '第二季度',
                    label: '第二季度'
                },
                {
                    value: '第三季度',
                    label: '第三季度'
                },
                {
                    value: '第四季度',
                    label: '第四季度'
                }
            ],
            dialogRevenueTypeOptions: [
                {
                    value: '产品收入',
                    label: '产品收入'
                },
                {
                    value: '技术转让收入',
                    label: '技术转让收入'
                },
                {
                    value: '技术服务收入',
                    label: '技术服务收入'
                }
            ],
            technologySourceOptions: [
                {
                    value: '计算机产品及其网络应用技术',
                    label: '计算机产品及其网络应用技术'
                },
                {
                    value: '自主开发',
                    label: '自主开发'
                },
                {
                    value: '合作开发',
                    label: '合作开发'
                },
                {
                    value: '引进技术',
                    label: '引进技术'
                }
            ],
            technologyFieldOptions: [
                {
                    value: '电子信息',
                    label: '电子信息'
                },
                {
                    value: '生物与新医药',
                    label: '生物与新医药'
                },
                {
                    value: '航空航天',
                    label: '航空航天'
                },
                {
                    value: '新材料',
                    label: '新材料'
                },
                {
                    value: '高技术服务',
                    label: '高技术服务'
                },
                {
                    value: '新能源与节能',
                    label: '新能源与节能'
                },
                {
                    value: '资源与环境',
                    label: '资源与环境'
                },
                {
                    value: '先进制造与自动化',
                    label: '先进制造与自动化'
                }
            ],
            technologyFieldDetailOptions: [
                {
                    value: '网络应用技术',
                    label: '网络应用技术'
                },
                {
                    value: '计算机软件技术',
                    label: '计算机软件技术'
                },
                {
                    value: '通信技术',
                    label: '通信技术'
                },
                {
                    value: '其他',
                    label: '其他'
                }
            ],
            tableData: [
                {
                    serial: 1,
                    productName: '智慧收费产品',
                    isMainProduct: '是',
                    revenueType: '产品收入',
                    salesRevenue: 1600.00
                },
                {
                    serial: 2,
                    productName: '智慧照明产品',
                    isMainProduct: '否',
                    revenueType: '产品收入',
                    salesRevenue: 1600.00
                },
                {
                    serial: 3,
                    productName: '高速公路机电系统建管养一体化服务',
                    isMainProduct: '否',
                    revenueType: '技术转让收入',
                    salesRevenue: 1600.00
                },
                {
                    serial: 4,
                    productName: '隧道智慧管控运维系统及服务',
                    isMainProduct: '否',
                    revenueType: '技术转让收入',
                    salesRevenue: 0
                },
                {
                    serial: 5,
                    productName: '交通行业省级视频云联网产品及服务',
                    isMainProduct: '否',
                    revenueType: '技术转让收入',
                    salesRevenue: 0
                }
            ]
        }
    },
    methods: {
        formatCurrency(value) {
            if (value === 0 || value === '0') {
                return '0'
            }
            return value.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
        },
        handleHomepage(row) {
       
             this.$router.push('/myreviewSee')
            // 跳转到产品主页
        },
        handleDelete(row) {
            this.$confirm('确定要删除该产品吗？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                console.log('删除', row)
                // 处理删除逻辑
                this.$message({
                    type: 'success',
                    message: '删除成功!'
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                })
            })
        },
        btnAdd() {
            this.dialogVisible = true
            // 重置表单
            this.productForm = {
                productName: '',
                isMainProduct: '',
                revenueType: '技术服务收入',
                technologySource: '',
                technologyField: '电子信息',
                technologyFieldDetail: '网络应用技术'
            }
            // 清除表单验证
            if (this.$refs.productForm) {
                this.$refs.productForm.clearValidate()
            }
        },
        handleSave() {
            this.$refs.productForm.validate((valid) => {
                if (valid) {
                    console.log('保存产品', this.productForm)
                    // 处理保存逻辑
                    this.$message({
                        type: 'success',
                        message: '保存成功!'
                    })
                    this.dialogVisible = false
                    // 这里可以添加保存后的逻辑，比如刷新列表
                } else {
                    console.log('表单验证失败')
                    return false
                }
            })
        },
        handleCancel() {
            this.dialogVisible = false
            // 重置表单
            this.productForm = {
                productName: '',
                isMainProduct: '',
                revenueType: '技术服务收入',
                technologySource: '',
                technologyField: '电子信息',
                technologyFieldDetail: '网络应用技术'
            }
            if (this.$refs.productForm) {
                this.$refs.productForm.clearValidate()
            }
        },
        handleSizeChange() {
            // 处理分页大小变化
        },
        handleCurrentChange() {
            // 处理当前页变化
        }
    }
}
</script>
<style>
.el-tooltip__popper.is-dark {
    color: #F04B4B !important;
    background: #FCF1EB !important;
}

.el-tooltip__popper .popper__arrow {
    border-top-color: #FCF1EB !important;
}

.el-tooltip__popper .popper__arrow::after {
    border-top-color: #FCF1EB !important;
}

.el-tooltip__popper[x-placement^='bottom'] .popper__arrow {
    border-bottom-color: #FCF1EB !important;
}

.el-tooltip__popper[x-placement^='left'] .popper__arrow {
    border-left-color: #FCF1EB !important;
}

.el-tooltip__popper[x-placement^='right'] .popper__arrow {
    border-right-color: #FCF1EB !important;
}
</style>
<style scoped>
.areas {
    padding-bottom: 15px;
    width: 97%;
    margin: 0 auto;
    margin-top: 12px;
    padding-top: 20px;
}

.active {
    color: #5165f7 !important;
}

.heng {
    width: 20px;
    height: 6px;
    background: #5165f7;
    margin: 0 auto;
    margin-top: 6px;
}

.header-table {
    cursor: pointer;
}

.contentss-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    width: 150px;
}

.contentss {
    width: 97%;
    margin: 0 auto;
    padding-top: 12px;
}

.contents-area {
    width: 100%;
    background: white;
    margin-top: 20px;
}

.header-title {
    position: relative;
    top: 20px;
    left: 25px;
}

.numbers {
    position: relative;
    top: -7px;
    color: #2AB95F;
}

.number-name2 {
    margin-top: 8px;
    font-size: 14px;
    color: #979BBC;
}

.number-name {
    font-weight: bold;
    font-size: 25px;
    color: #17192C;
}

.header-names {
    display: flex;
    width: 82%;
    justify-content: space-between;
    margin: 0 auto;
    padding-top: 20px;
}

.header-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 97%;
    margin: 0 auto;
}

.content-header {
    width: 100%;
    background: white;
    padding-bottom: 22px;
}

.footer {
    display: flex;
    justify-content: end;
    margin-top: 20px;
}

.tianjia {
    position: relative;
    top: -9px;
    background-color: #5065F6;
}

.tianjia2 {
    position: relative;
    top: -9px;
    background-color: #EDEFFE;
    color: #5065F6;
}

::v-deep .el-table thead {
    background-color: #EDEFFE !important;
    color: #363636 !important;
}

::v-deep .el-table__header th {
    background-color: #EDEFFE !important;
    color: #363636 !important;
}

.formitem {
    position: relative;
    top: -5px;
}

::deep .el-form-item__label {
    font-size: 15px !important;
}

.selects {
    width: 100px;
    border: 1px solid #3333;
}

.headers-name {
    font-size: 15px;
    position: relative;
    top: 14px;
}

.headers {
    display: flex;
    justify-content: space-between;
}

::v-deep .el-table__body tr:hover > td {
    background-color: transparent !important;
}

::v-deep .el-table__body tr.el-table__row--striped td {
    background-color: transparent;
}

/* 产品对话框样式 */
.product-dialog ::v-deep .el-dialog__header {
    padding: 20px 20px 10px;
    border-bottom: 1px solid #EBEEF5;
    text-align: center;
}

.product-dialog ::v-deep .el-dialog__title {
    font-size: 16px;
    font-weight: bold;
    color: #303133;
}

.product-dialog ::v-deep .el-dialog__body {
    padding: 20px;
}

.product-dialog ::v-deep .el-form-item__label {
    font-size: 14px;
    color: #606266;
}

.product-dialog .dialog-footer {
    text-align: center;
    padding-top: 10px;
}

.product-dialog .dialog-footer .el-button {
    margin: 0 10px;
}
.content-areas{
    display: flex;
    height: 50px;
    flex-wrap: wrap;
    margin-top: -1px;
}
.contents-left{
    width: 30%;
    border: 1px solid #DCE0FD;
    background: #EDEFFE;
    line-height: 50px;
    font-size: 14px;
    color: #363636;
    display: flex;
    align-items: center;
}
.contents-right{
    flex: 1;
    border: 1px solid #DCE0FD;
    border-left: none;
    line-height: 50px;
    font-size: 14px;
    color: #363636;
    display: flex;
    align-items: center;
    position: relative;
}
.contents-right:last-child {
    border-right: 1px solid #DCE0FD;
}
.content-areas2{
    position: relative;
    top: -1px;
}
.rightss{
    height: 100%;
    border: 1px solid #DCE0FD;
    border-top: none;
    border-bottom: none;
    width: 100%;
    display: flex;
    align-items: center;
    flex: 1;
}
.rightss1{
    border-left: none !important;
    border-right: 1px solid #DCE0FD !important;
}
.rightss2{
    background: #EDEFFE;
    border-left: 1px solid #DCE0FD;
    border-right: 1px solid #DCE0FD;
    width: auto;
    min-width: 120px;
    flex: 0 0 auto;
    justify-content: center;
}
.rightss3{
    border-left: none !important;
    border-right: none !important;
    flex: 1;
}
.rightss-full{
    border-left: none !important;
    border-right: 1px solid #DCE0FD !important;
    flex: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
}
.table-name{
    margin-left: 20px;
}
</style>
