<template>
    <div>
        <div class="headers">
            <div class="headers-left">
                <div class="imgs">
                    <img v-if="enterpriseLogo" :src="enterpriseLogo" alt="企业LOGO" class="enterprise-logo-img" />
                </div>
                <div class="img-right">
                    <div class="name-title">微育科技</div>
                    <div class="right-name">数智科创 · 通达未来 </div>
                </div>
            </div>
            <div class="headers-right">
                <div class="rights">
                  <span style="position: relative;left: 32vw;">{{ isEdit ? '企业资质编辑' : '企业资质添加' }}</span>

                    
                   

                </div>
            </div>
        </div>
        
        <div class="contents">
            <div class="content-left">
                
                <div class="content-lefts">
                    <div class="leftss">

                        

                        <div class="leftss-header">
                            <div>{{ isEdit ? '资质信息编辑' : '资质信息添加' }}</div>
                            <div> <el-button size="small" @click="btnEdint"
                                    style="background-color: #5165f7;color:white;">保存提交</el-button>
                                    <el-button size="small"
                                    @click.stop="closeguan"
                                    style="width: 82px;">取消</el-button>
                            </div>
                        </div>
                        <div class="table-area">
                            <div class="table-header">
                                <div class="names">
                                    <span class="times">上传材料｜ </span>
                                </div>
                             
                                
                            </div>
                           <div class="tab-area">
                            <el-table :data="tableData2" border style="width: 97%">
                               
                              
                                <el-table-column prop="name" label="资质证书" align="center">
                                    <el-upload
                                    :http-request="handleUpload"
                                    list-type="picture-card"
                                    :file-list="fileList"
                                    :on-preview="handlePictureCardPreview"
                                    :on-remove="handleRemove">
                                    <i class="el-icon-plus"></i>
                                    <div class="shangchuang">上传材料</div>
                                    </el-upload>
                                    <el-dialog :visible.sync="dialogVisible" :destroy-on-close="true" :append-to-body="true">
                                    <img width="100%" :src="dialogImageUrl" alt="">
                                    </el-dialog>
                                </el-table-column>
                            </el-table>
                           </div>
                        </div>
                        
                        <div class="table-area" style="margin-top: 30px;">
                            <div class="table-header">
                                <div>
                                    <span class="times"> 资质信息｜   </span>
                                </div>
                             
                            </div>
                        </div>
                    </div>
                    <div class="content-table">
                       
                       <div class="content-areas content-areas2">
                           <div class="contents-left">
                               <span class="table-name">资质认证名称</span>
                           </div>
                           <div class="contents-right">
                               <div class="rightss rightss1"><span class="table-name"><el-input v-model="formData.qualification_name" style="width: 88%;" placeholder="请输入资质认证名称"></el-input></span></div>
                             
                           </div>
                       </div>
                       <div class="content-areas content-areas2" style="top: 4px;">
                           <div class="contents-left" style="border-top: none;">
                               <span class="table-name">证书编号</span>
                           </div>
                           <div class="contents-right" style="border: none;">
                               <div class="rightss rightss1"><span class="table-name">
                                <el-input v-model="formData.certificate_number" style="width:88%" placeholder="请输入证书编号"></el-input>
                                   </span></div>
                               <div class="rightss rightss2" style="border-top: none;width: 32%;"><span
                                       class="table-name">发证日期</span></div>
                               <div class="rightss rightss3"><span class="table-name">
                                <el-date-picker
                                    v-model="formData.issue_date"
                                    type="date"
                                    value-format="yyyy-MM-dd"
                                    placeholder="选择日期">
                                </el-date-picker>
                                   </span></div>
                           </div>
                       </div>
                       <div class="content-areas content-areas2" style="top: 5px;">
                           <div class="contents-left" style="border-top: none;">
                               <span class="table-name">有效期至</span>
                           </div>
                           <div class="contents-right" >
                               <div class="rightss rightss1"><span class="table-name">
                                <el-date-picker
                                    v-model="formData.valid_until"
                                    type="date"
                                    value-format="yyyy-MM-dd"
                                    placeholder="选择日期">
                                </el-date-picker>
                                   </span></div>
                               <div class="rightss rightss2" style="width: 32%;"><span
                                       class="table-name">发证机构</span></div>
                               <div class="rightss rightss3"><span class="table-name">
                                <el-input v-model="formData.issuing_authority" placeholder="请输入发证机构" style="width:88%"></el-input>
                                   </span></div>
                           </div>
                       </div>
                     
                     
                       
                   </div>
                    
                </div>
             
            </div>
            <div class="content-right">

                <div class="leftss-header right-header">
                    <div class="header-area">
                        <div class="area-name" v-for="(item,index) in listDate" 
                        :key="index"
                        @click="btnNmae(index)"
                        :class="{'active':active ==index}"
                        >
                            {{item.name }}
                        </div>
                      
                    </div>
                    <div> <el-button size="small" style="color:#5165f7;">
                           解析中</el-button>
                    </div>
                </div>
                <div class="right-area">
                    <!-- 调试信息 -->
                    <div style="display: none;">fileList长度: {{ fileList.length }}, 第一个URL: {{ fileList[0]?.url }}</div>
                    
                    <div class="preview-images" v-if="fileList && fileList.length > 0">
                        <div class="image-item" v-for="(file, index) in fileList" :key="file.uid || index">
                            <img :src="file.url" alt="资质证书" @click="handlePictureCardPreview(file)" @error="handleImageError" @load="handleImageLoad" style="max-width: 100%;" />
                        </div>
                    </div>
                    <div class="no-image-tip" v-else>
                        <span>暂无上传图片，请在左侧上传材料</span>
                    </div>
                </div>

            </div>
        </div>

        <!-- 保存成功弹框 -->
        <el-dialog :visible.sync="saveSuccessDialog" width="400px" :show-close="false" center :destroy-on-close="true" :append-to-body="true">
            <div class="success-dialog-content">
                <img src="@/assets/succes.png" alt="成功" class="success-icon" />
                <div class="success-title">提交保存成功</div>
                <div class="success-message">您提交的内容已保存成功，请等待审核</div>
                <el-button type="primary" @click="closeSuccessDialog" style="background-color: #5165f7; margin-top: 20px;">知道了</el-button>
            </div>
        </el-dialog>

        <!-- 保存失败弹框 -->
        <el-dialog :visible.sync="saveFailDialog" width="400px" :show-close="false" center :destroy-on-close="true" :append-to-body="true">
            <div class="fail-dialog-content">
                <img src="@/assets/err.png" alt="失败" class="fail-icon" />
                <div class="fail-title">保存失败</div>
                <div class="fail-message">{{ errorMessage }}</div>
                <el-button type="primary" @click="closeFailDialog" style="background-color: #5165f7; margin-top: 20px;">知道了</el-button>
            </div>
        </el-dialog>

    </div>
</template>
<script>
import { show } from '@/api/homepage/corporateInformation'
import { getEnterpriseLogo } from '@/utils/auth'
import { images } from '@/api/public'
import {save,Details} from '@/api/resource/qualification/enterprise'
export default {
    data() {
        return {
            enterpriseLogo: '', // 企业LOGO图片URL
            dialogVisible: false, // 图片预览对话框显示状态
            dialogImageUrl: '', // 预览图片URL
            fileList: [], // 上传文件列表
            active: 0,
            listDate: [
                {
                    name: '资质证书'
                },
            ],
            // 编辑模式
            isEdit: false,
            editId: '',
            // 表单数据
            formData: {
                qualification_name: '', // 资质认证名称
                certificate_number: '', // 证书编号
                issue_date: '', // 发证日期
                valid_until: '', // 有效期至
                issuing_authority: '', // 发证机构
                document_path: '' // 资质证书文件路径
            },
            // 保存弹框控制
            saveSuccessDialog: false,
            saveFailDialog: false,
            errorMessage: '',
            yuanright: 0,
            tables: [
                {
                    name: '有效'
                },
                {
                    name: '无效'
                },
            ],
            shu: 0,
            lastActiveKey: 'headerActiveIndex',
            tableData: [
                {
                    date: "其中",
                    name: "",
                    address: "",
                    children: [
                        { date: "2024", name: "年度审计报告及财务情况说明书", address: "8000" },
                        { date: "2025", name: "年度审计报告及财务情况说明书", address: "7500" },
                    ],
                },
                { date: "其他项目", name: "5000", address: "4000" },
            ],
            tableData2: [
                { date: "2025", name: "年度审计报告及财务情况说明书", address: "7500" },
            ]
        }
    },

    created() {
        this.loadEnterpriseLogo()
        // 检查是否是编辑模式
        const id = this.$route.query.id
        if (id) {
            this.isEdit = true
            this.editId = id
            this.fetchDetail(id)
        }
    },

    beforeDestroy() {
        // 关闭所有 dialog，避免 Element UI 报错
        this.dialogVisible = false
        this.saveSuccessDialog = false
        this.saveFailDialog = false
    },

    watch: {

    },

    methods: {
        // 获取详情数据（编辑模式）
        async fetchDetail(id) {
            try {
                const res = await Details(id)
                if (res.code === 1 && res.data) {
                    const data = res.data
                    this.formData = {
                        qualification_name: data.qualification_name || '',
                        certificate_number: data.certificate_number || '',
                        issue_date: data.issue_date || '',
                        valid_until: data.valid_until || '',
                        issuing_authority: data.issuing_authority || '',
                        document_path: data.document_path || ''
                    }
                    // 如果有图片，添加到 fileList
                    if (data.document_path) {
                        this.fileList = [{
                            uid: Date.now(),
                            name: '资质证书',
                            url: data.document_path,
                            status: 'success'
                        }]
                    }
                } else {
                    this.$message.error(res.msg || '获取详情失败')
                }
            } catch (error) {
                console.error('获取详情失败:', error)
                this.$message.error('获取详情失败')
            }
        },
        // 保存提交
        async btnEdint() {
            // 验证必填字段
            if (!this.formData.qualification_name) {
                this.$message.warning('请输入资质认证名称')
                return
            }
            if (!this.formData.certificate_number) {
                this.$message.warning('请输入证书编号')
                return
            }
            
            try {
                // 构建保存数据
                const saveData = {
                    qualification_name: this.formData.qualification_name,
                    certificate_number: this.formData.certificate_number,
                    issue_date: this.formData.issue_date || '',
                    valid_until: this.formData.valid_until || '',
                    issuing_authority: this.formData.issuing_authority || '',
                    document_path: this.fileList.length > 0 ? this.fileList[0].url : ''
                }
                
                // 编辑模式需要传递 id
                if (this.isEdit && this.editId) {
                    saveData.id = this.editId
                }
                
                const res = await save(saveData)
                if (res.code === 1) {
                    this.saveSuccessDialog = true
                } else {
                    this.errorMessage = res.msg || '保存失败，请重试'
                    this.saveFailDialog = true
                }
            } catch (error) {
                console.error('保存失败:', error)
                this.errorMessage = error.message || '网络错误，请重试'
                this.saveFailDialog = true
            }
        },
        // 关闭成功弹框
        closeSuccessDialog() {
            this.saveSuccessDialog = false
            setTimeout(() => {
                this.$router.go(-1)
            }, 100)
        },
        // 关闭失败弹框
        closeFailDialog() {
            this.saveFailDialog = false
            this.errorMessage = ''
        },
        //取消
        closeguan(){
            // 先关闭可能打开的弹窗
            this.dialogVisible = false
            this.saveSuccessDialog = false
            this.saveFailDialog = false
            // 延迟执行路由跳转，确保 Element UI 组件完全关闭
            setTimeout(() => {
                this.$router.go(-1)
            }, 100)
        },
        // 从localStorage加载企业LOGO
        loadEnterpriseLogo() {
            const logo = getEnterpriseLogo()
            if (logo) {
                this.enterpriseLogo = logo
            }
        },
        // 获取企业LOGO（保留作为备用方法，如果localStorage没有则调用API）
        async fetchEnterpriseLogo() {
            // 先尝试从localStorage读取
            const logo = getEnterpriseLogo()
            if (logo) {
                this.enterpriseLogo = logo
                return
            }
            
            try {
                const res = await show({})
                if (res && res.code === 1 && res.data) {
                    // 数据结构可能是对象（键是数字字符串）或数组
                    let dataToProcess = res.data
                    
                    // 如果是数组，转换为对象格式以便统一处理
                    if (Array.isArray(res.data)) {
                        dataToProcess = {}
                        res.data.forEach((item, index) => {
                            const parentId = item.parent_id !== undefined ? item.parent_id : index
                            dataToProcess[String(parentId)] = item
                        })
                    }
                    
                    // 查找 parent_id: 0 的基本信息（图片数据）
                    if (dataToProcess['0'] && dataToProcess['0'].list && Array.isArray(dataToProcess['0'].list)) {
                        dataToProcess['0'].list.forEach(imgItem => {
                            if (imgItem.name === 'logo' && imgItem.value) {
                                // 如果 value 是完整 URL，直接使用
                                if (imgItem.value.startsWith('http://') || imgItem.value.startsWith('https://')) {
                                    this.enterpriseLogo = imgItem.value
                                } else if (imgItem.host) {
                                    // 如果有 host，组合完整的 URL
                                    const host = imgItem.host.endsWith('/') ? imgItem.host : imgItem.host + '/'
                                    const path = imgItem.value.startsWith('/') ? imgItem.value.slice(1) : imgItem.value
                                    this.enterpriseLogo = host + path
                                } else {
                                    this.enterpriseLogo = imgItem.value
                                }
                            }
                        })
                    }
                }
            } catch (error) {
                console.error('获取企业LOGO失败:', error)
                // 获取失败时不显示错误提示，保持默认样式
            }
        },
        // 文件上传
        async handleUpload(options) {
            try {
                // 创建 FormData，参数名是 image
                const formData = new FormData()
                formData.append('image', options.file)
                
                // 调用上传接口
                const res = await images(formData)
                
                console.log('上传接口返回:', res)
                
                if (res && res.code === 1) {
                    // 根据实际接口返回的字段设置图片URL
                    // 接口返回的数据结构：res.data.data.data (三层嵌套)
                    let fileData = null
                    
                    // 按优先级尝试获取数据
                    if (res.data && res.data.data && res.data.data.data) {
                        // 三层嵌套：res.data.data.data
                        fileData = res.data.data.data
                        console.log('使用三层嵌套数据结构')
                    } else if (res.data && res.data.data) {
                        // 两层嵌套：res.data.data
                        fileData = res.data.data
                        console.log('使用两层嵌套数据结构')
                    } else if (res.data) {
                        // 一层嵌套：res.data
                        fileData = res.data
                        console.log('使用一层嵌套数据结构')
                    }
                    
                    console.log('完整响应数据:', JSON.stringify(res, null, 2))
                    console.log('解析到的 fileData:', fileData)
                    console.log('fileData.fullURL:', fileData?.fullURL)
                    console.log('fileData.host:', fileData?.host)
                    console.log('fileData.path:', fileData?.path)
                    
                    let imageUrl = ''
                    let imageHost = ''
                    
                    // 优先使用 fullURL 字段
                    if (fileData && fileData.fullURL) {
                        imageUrl = fileData.fullURL
                        imageHost = fileData.host || ''
                        console.log('✓ 使用 fullURL 字段:', imageUrl)
                    } else if (fileData && fileData.host && fileData.path) {
                        // 保存 host
                        imageHost = fileData.host
                        // 确保 host 以 / 结尾，path 不以 / 开头
                        const host = fileData.host.endsWith('/') ? fileData.host : fileData.host + '/'
                        const path = fileData.path.startsWith('/') ? fileData.path.slice(1) : fileData.path
                        imageUrl = host + path
                        console.log('✓ 使用 host + path 组合:', { host, path, fullURL: imageUrl })
                    } else if (fileData && fileData.path) {
                        // 如果只有 path，使用默认 host
                        const defaultHost = 'http://api.sg199.net/'
                        const path = fileData.path.startsWith('/') ? fileData.path.slice(1) : fileData.path
                        imageUrl = defaultHost + path
                        imageHost = defaultHost
                        console.log('✓ 只有 path，使用默认 host + path 组合:', { defaultHost, path, fullURL: imageUrl })
                    } else if (fileData && fileData.url) {
                        imageUrl = fileData.url
                        imageHost = ''
                        console.log('✓ 使用 fileData.url:', imageUrl)
                    } else {
                        // 降级处理
                        imageUrl = res.data?.url || res.url || ''
                        console.log('✓ 使用降级处理:', imageUrl)
                    }
                    
                    console.log('✓ 最终组合后的图片URL (fullURL):', imageUrl)
                    
                    if (!imageUrl) {
                        this.$message.error('无法获取图片URL')
                        return
                    }
                    
                    // 添加到文件列表
                    const fileItem = {
                        uid: options.file.uid || Date.now() + Math.random(),
                        name: options.file.name || '上传的图片',
                        url: imageUrl,
                        host: imageHost,
                        path: fileData?.path || '',
                        status: 'success'
                    }
                    
                    // 使用 Vue.set 确保响应式更新，或者直接创建新数组
                    this.fileList = [...this.fileList, fileItem]
                    
                    console.log('当前文件列表:', this.fileList)
                    console.log('fileList 长度:', this.fileList.length)
                    console.log('第一个文件URL:', this.fileList[0]?.url)
                    console.log('右侧应该显示的图片URL:', this.fileList.map(f => f.url))
                    
                    // 延迟一下，确保视图更新
                    this.$nextTick(() => {
                        console.log('nextTick 后的 fileList:', this.fileList)
                    })
                    
                    this.$message.success('文件上传成功')
                } else {
                    this.$message.error(res?.msg || '文件上传失败')
                    // 上传失败，移除文件
                    const index = this.fileList.findIndex(item => item.uid === options.file.uid)
                    if (index > -1) {
                        this.fileList.splice(index, 1)
                    }
                }
            } catch (error) {
                console.error('文件上传失败:', error)
                this.$message.error('文件上传失败，请稍后重试')
                
                // 上传失败，移除文件
                const index = this.fileList.findIndex(item => item.uid === options.file.uid)
                if (index > -1) {
                    this.fileList.splice(index, 1)
                }
            }
        },
        // 图片预览
        handlePictureCardPreview(file) {
            this.dialogImageUrl = file.url || (file.raw ? URL.createObjectURL(file.raw) : '')
            this.dialogVisible = true
        },
        // 删除文件
        handleRemove(file, fileList) {
            // 更新文件列表
            this.fileList = fileList
        },
        // 图片加载错误处理
        handleImageError(event) {
            console.error('图片加载失败:', event.target.src)
            this.$message.error('图片加载失败: ' + event.target.src)
        },
        // 图片加载成功处理
        handleImageLoad(event) {
            console.log('图片加载成功:', event.target.src)
        }
        

    }
}
</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>

body, html {
  width: 100%;
  overflow-x: hidden;
}

.area-name{
margin-left: 30px;
cursor: pointer;
}
.active{
   
   
    height: 48px;
}
.header-area{
    display: flex;
    position: relative;
    left: -30px;
}
.rightss3{
    border-right: none;
    border-left: none;
}
.table-name{
    margin-left: 20px;
}
.rightss2{
    background: #EDEFFE;
}
.rightss1{
    border-left: none !important;
    border-right: none !important;
   
}
.rightss{
    height: 100%;
    border: 1px solid #DCE0FD;
    width: 100%;
    border-top: none;

}
.content-areas2{
    position: relative;
    top: 1px;

}
.contents-right{
    flex: 1;
    border: 1px solid #DCE0FD;
    line-height: 50px;
    font-size: 14px;
    color: #363636;
    display: flex
}
.contents-left{
    width: 30%;
    border: 1px solid #DCE0FD;
    background: #EDEFFE;;
    line-height: 50px;
    font-size: 14px;
    color: #363636;
    
}
.content-areas{
    display: flex;
    height: 50px;
    flex-wrap: wrap;
}
.tab-area{
    margin-top: 24px;
}
.namess{
    color: #5B5E72;
    font-size: 13px;
    margin-left: 12px;
}
.names{
    font-size: 14px;
    color: #363636;
}
:deep .el-tooltip__popper.is-dark {
    color: #F04B4B !important;
}

.right-area {
    width: 90%;
    margin: 0 auto;
    height: calc(100% - 80px);
    background: #f8f8f8;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}
.preview-images {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.image-item {
    width: 200px;
    height: 200px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

.image-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #5165f7;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-fit: contain;
}
.no-image-tip {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}
.shangchuang{
    font-size: 12px;
    position: relative;
    top: -62px;
}
:deep(.el-upload-list--picture-card .el-upload-list__item) {
  width: 80px !important;  /* 缩略图宽度 */
  height: 80px !important;  /* 缩略图高度 */
}

:deep(.el-upload--picture-card) {
  width: 80px !important;  /* 调整卡片宽度 */
  height: 80px !important;  /* 调整卡片高度 */
  line-height: 80px !important;  /* 调整内部的 "+" 图标居中 */
}

.right-header {
    width: 90%;
    margin: 0 auto;
}

.ths {
    text-align: center;
    background: #DCE0FD !important;
    color: #363636;
}

.tou {
    height: 30px;
    line-height: 30px;
    color: #606266;
    text-align: center;
}

.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.financial-table th,
.financial-table td {
    border: 1px solid #ddd;
    padding: 8px 7px;
    text-align: center;
}

.financial-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.financial-table .nested-label {
   
    text-align: center;
    vertical-align: middle;
    font-weight: bold;
}

.table-right {
    flex: 1;
}

.table-left {
    flex: 1;
}
.content-areas22 {
    display: flex;

    flex-wrap: wrap;
}
.content-table {
   
    width: 90%;
    margin: 0 auto;
    margin-top: 14px;
}

/* 默认情况（有效）左边圆角 */
.left-radius {
    border-bottom-left-radius: 16px !important;
    border-top-left-radius: 16px !important;
}

/* 无效情况右边圆角 */
.right-radius {
    border-bottom-right-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

.yuan-left {
    flex: 1;
    text-align: center;
    line-height: 30px;
    background: #f8f8f8;
    /* border-bottom-left-radius: 16px;
    border-top-left-radius: 16px; */
    cursor: pointer;
}

.yuanright {
    flex: 1;
    background: #5165f7;
    color: white;

    /* border-bottom-right-radius: 16px;
    border-top-right-radius: 16px;  */
    text-align: center;
    line-height: 30px;
    cursor: pointer;

}

.youxiaos {
    position: relative;
    top: 6px;
    left: -12px;
    cursor: pointer;
}

/* 修改.yuan的样式，移除外层圆角 */
.yuan {
    width: 100px;
    height: 30px;
    background: white;
    display: flex;
    font-size: 14px;
    overflow: hidden;
    /* 关键：确保内部div的圆角效果不被截断 */
}

/* 默认状态下两个按钮的外侧圆角 */
.yuan-left:first-child {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.yuan-left:last-child {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* 选中状态样式 */
.yuanright {
    background: #5165f7;
    color: white;
}

/* 选中"有效"时的样式 */
.yuan-left.left-radius {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* 选中"无效"时的样式 */
.yuan-left.right-radius {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}


.times {
    position: relative;
    top: 3px;
}

.youxiao {
    color: #5B5D76;
    font-size: 13px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
}

.table-area {
    margin-top: 12px;
    font-size: 15px;
}

.leftss-header {
    display: flex;
    height: 60px;
    line-height: 60px;
    border-bottom: 1px solid #3333;
    font-weight: bold;
    justify-content: space-between;
}

.leftss {
    width: 90%;
    margin: 0 auto;
}

.content-lefts {
    background: white;
    padding-bottom: 30px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.content-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-right {
    width: 600px;
    background: white;
}

.contents {
    width: 100%;
    box-sizing: border-box;
    height: calc(100vh - 100px);
    background: #f8f8f8;
    display: flex;
    margin-top: 6px;
}


.shu {
    width: 3px;
    height: 18px;
    background: #5165f7;
    position: relative;
    display: inline-block;
    top: 7px;
}

::v-deep .el-table thead {
    background-color: #DCE0FD !important;
    color: #363636 !important;
    font-weight: bold;
}

::v-deep .el-table__header th {
    background-color: #DCE0FD !important;
    color: #363636 !important;
    font-weight: bold;
}




.shu{
  width: 10px;
    height: 20px;
    background: #5165f7;
    position: relative;
    top: -24px;
    left: 40%;
}
.active{
    color: #5165f7 !important;
}
.rights-names{
    margin-left: 32px;
    cursor: pointer;
}
.rights{
    width: 96%;
    height: 100%;
    margin: 0 auto;
    line-height: 94px;
    display: flex;
    position: relative;
    left: -27px;
}
.name-title{
    position: relative;
    top: -6px;
    font-weight: bold;
}
.right-name{
    font-size: 12px;
}
.img-right{
    font-size: 14px;
    position: relative;
    top: 40px;
    height: 40px;
    margin-left: 12px;
}
.imgs{
    width: 45px;
    height: 46px;
    background: #5165f7;
    border-radius: 6px;
    position: relative;
    top: 26px;
    margin-left: 24px;
    overflow: hidden;
}
.enterprise-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}
.headers-right{
    flex: 1;
    background: white;
  
}
.headers-left{
    width: 222px;
    height: 100%;
    display: flex;
    background: white;
    border-right: 1px solid #EDEFFE;
}
.headers{
  width: 100%;
    height: 90px;
    display: flex
;
    border-bottom: 1px solid #EDEFFE;
}





.patent-container {
      max-width: 1000px;
      margin: 0 auto;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
      overflow: hidden;
    }
    .patent-header {
      background: linear-gradient(135deg, #6a5acd, #8a7dff);
      color: white;
      padding: 20px 30px;
      text-align: center;
    }
    .patent-header h1 {
      font-size: 24px;
      margin-bottom: 10px;
      font-weight: 600;
    }
    .patent-header p {
      opacity: 0.9;
      font-size: 14px;
    }
    .search-box {
      padding: 15px 30px;
      background-color: #f8f9fa;
      border-bottom: 1px solid #eaeaea;
    }
    .search-box input {
      width: 100%;
      padding: 10px 15px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 14px;
      transition: border-color 0.3s;
    }
    .search-box input:focus {
      outline: none;
      border-color: #8a7dff;
      box-shadow: 0 0 0 2px rgba(138, 125, 255, 0.2);
    }
    .patent-table {
      width: 100%;
      border-collapse: collapse;
    }
    .patent-table th {
      background-color: #f0e6ff;
      color: #5a4fcf;
      padding: 12px 15px;
      text-align: left;
      font-weight: 600;
      border-bottom: 1px solid #ddd;
    }
    .patent-table td {
      padding: 12px 15px;
      border-bottom: 1px solid #f0f0f0;
      transition: background-color 0.2s;
    }
    .patent-table tr:hover td {
      background-color: #f9f7ff;
    }
    .patent-table tr:last-child td {
      border-bottom: none;
    }
    .status-badge {
      display: inline-block;
      padding: 4px 8px;
      border-radius: 4px;
      font-size: 12px;
      font-weight: 500;
    }
    .status-paid {
      background-color: #e8f5e9;
      color: #2e7d32;
    }
    .patent-footer {
      padding: 15px 30px;
      text-align: center;
      color: #777;
      font-size: 14px;
      border-top: 1px solid #eaeaea;
      background-color: #fafafa;
    }

/* 成功弹框样式 */
.success-dialog-content {
    text-align: center;
    padding: 20px;
}
.success-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}
.success-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}
.success-message {
    font-size: 14px;
    color: #666;
}

/* 失败弹框样式 */
.fail-dialog-content {
    text-align: center;
    padding: 20px;
}
.fail-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}
.fail-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}
.fail-message {
    font-size: 14px;
    color: #F04B4B;
}

</style>