<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">
                    <div class="rights-names" >

                        <span>{{ pageTitle }}添加</span>
                    </div>

                </div>
            </div>
        </div>
        <div class="contents">
            <div class="content-left">
                <div class="content-lefts">
                    <div class="leftss">
                        <div class="leftss-header">
                            <div>
                                <el-button type="primary" size="small" style="background-color: #5165f7;" @click="handleSave">提交保存</el-button>
                                <el-button size="small" @click="btnClose">取消</el-button>
                            </div>
                          
                        </div>
                        <div class="upload-area">
                            <div class="upload-header">
                                <span>{{ pageTitle }}</span>
                               
                            </div>
                            <div class="uploads">
                                <div class="uploads-headers">
                                    上传材料
                                </div>
                                <div class="img-area">
                                    <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">
                                    <img width="100%" :src="dialogImageUrl" alt="">
                                    </el-dialog>
                               
                                </div>
                            </div>
                        </div>
                        <div class="table-area">
                            <div class="table-header">
                                <div class="table-header-left">
                                    <span class="times">材料信息｜ </span>
                                  
                              
                                </div>
                                <div style="display: flex;">
                                    <div class="youxiaos">
                                        <el-tooltip class="item" effect="dark"
                                            content="注意！设置“无效”，设置无效后改内容仅保留展但不做应用，默认有效" placement="top-start">
                                            <span> <!-- 单个根元素 -->
                                                <i class="el-icon-info" style="margin-right: 5px;"></i>
                                                <span class="youxiao">有效性设置</span>
                                            </span>
                                        </el-tooltip>

                                    </div>
                                    <div class="yuan">
                                        <div class="yuan-left" v-for="(item, index) in tables" :key="index" :class="{
                                            'yuanright': yuanright === index,
                                            'left-radius': yuanright === 0 && index === 0,
                                            'right-radius': yuanright === 1 && index === 1
                                        }" @click="btnYuan(index)">
                                            {{ item.name }}
                                        </div>


                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="content-table">
                        <div class="table-left">
                            <el-table :data="tableData2" border style="width: 97%">
                                <el-table-column prop="date" label="年度" align="center" width="200">
                                    <template #default>
                                        <el-date-picker
                                            v-model="value1"
                                            type="year"
                                            placeholder="选择年度"
                                            format="yyyy"
                                            value-format="yyyy">
                                            </el-date-picker>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="name" label="材料名称" align="center">
                                    <template #default>
                                        <el-input v-model="input" placeholder="请输入内容"></el-input>
                                    </template>
                                </el-table-column>
                             
                            </el-table>
                        </div>
                      
                    </div>
                </div>
            </div>
            <div class="content-right">

                <div class="leftss-header right-header">
                    <div>{{ pageTitle }}</div>
                   
                </div>
                <div class="right-area">
                    <div class="preview-images" v-if="fileList && fileList.length > 0">
                        <div class="image-item" v-for="(file, index) in fileList" :key="index">
                            <img :src="file.url" alt="年度审计报告" @click="handlePictureCardPreview(file)" />
                        </div>
                    </div>
                    <div class="no-image-tip" v-else>
                        <span>暂无上传图片，请在左侧上传材料</span>
                    </div>
                </div>

            </div>
        </div>

        <!-- 保存成功对话框 -->
        <el-dialog
            :visible.sync="saveSuccessDialog"
            width="450px"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            class="save-success-dialog">
            <div class="success-dialog-content">
                <div class="success-icon-wrapper">
                   <img src="@/assets/succes.png" alt="">
                </div>
                <div class="success-title">提交保存成功</div>
                <div class="success-message">
                    <p>提交内容未审核通过时资源资料库不展示该内容</p>
                    <p>审核状态请前往审核中心查看</p>
                </div>
                <div class="success-footer">
                    <el-button type="primary" @click="closeSuccessDialog" style="background-color: #5165f7;width: 100px;">知道了</el-button>
                </div>
            </div>
        </el-dialog>

        <!-- 保存失败对话框 -->
        <el-dialog
            :visible.sync="saveFailDialog"
            width="450px"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            class="save-fail-dialog">
            <div class="fail-dialog-content">
                <div class="fail-icon-wrapper">
                   <img src="@/assets/err.png" alt="">
                </div>
                <div class="fail-title">提交失败</div>
                <div class="fail-message">
                    <p>{{ errorMessage || '提交失败原因描述' }}</p>
                </div>
                <div class="fail-footer">
                    <el-button type="primary" @click="closeFailDialog" style="background-color: #5165f7;width: 100px;">知道了</el-button>
                </div>
            </div>
        </el-dialog>

    </div>
</template>
<script>
import {save, Details} from '@/api/finance/annual/index'
import { show } from '@/api/homepage/corporateInformation'
import { getEnterpriseLogo } from '@/utils/auth'
import { images } from '@/api/public'
export default {
    data() {
        return {
            enterpriseLogo: '', // 企业LOGO图片URL
            dialogVisible: false, // 图片预览对话框显示状态
            dialogImageUrl: '', // 预览图片URL
            fileList: [], // 上传文件列表
            saveSuccessDialog: false, // 保存成功对话框显示状态
            saveFailDialog: false, // 保存失败对话框显示状态
            errorMessage: '', // 错误信息
            editId: null, // 编辑时的ID，新增时为null
            pageType: 1, // 页面类型，默认为1
            pageTitle: '年度审计报告', // 页面标题，默认年度审计报告
            yuanright: 0,
            value:"",
            value1: "", // 年度日期选择
            input: "", // 材料名称输入
            tables: [
                {
                    name: '有效'
                },
                {
                    name: '无效'
                },
            ],
            options:[
                {
                    value:1,
                    label:'2024'
                },
              
            ],
            shu: 0,
            active: 0,
            lastActiveKey: 'headerActiveIndex',
            tableData: [
                {
                    date: "其中",
                    name: "",
                    address: "",
                    children: [
                        { date: "营业利润", name: "10000", address: "8000" },
                        { date: "利润总额", name: "9500", address: "7500" },
                        { date: "净利润", name: "8500", address: "7000" },
                        { date: "综合收益总额", name: "9000", address: "6500" },
                    ],
                },
                { date: "其他项目", name: "5000", address: "4000" },
            ],

            tableData2: [{
                date: '2025',
                name: '年度审计报告及财务情况说明书',
                address: '10200'
            }
           ]
        }
    },

    computed: {
        // 根据类型映射标题
        typeTitleMap() {
            return {
                1: '年度审计报告',
                2: '差异性说明',
                3: '专项审计报告',
                4: '审计机构证明',
                5: '企业所得纳税情况'
            }
        }
    },
    created() {
        this.loadEnterpriseLogo()
        // 从路由参数获取 id 和 type
        const id = this.$route.query.id
        const type = this.$route.query.type
        if (id) {
            this.editId = id
            // 如果有 id，调用详情接口获取数据
            this.fetchDetail(id)
        }
        // 根据 type 设置页面标题
        if (type) {
            this.pageType = parseInt(type) || 1
        } else if (id) {
            // 如果没有传 type 但从详情页进入，尝试从详情数据中获取
            // 但此时详情数据还未加载，所以需要在 fetchDetail 中处理
        }
        this.setPageTitle()
    },
    watch: {

    },
    methods: {
        // 设置页面标题
        setPageTitle() {
            this.pageTitle = this.typeTitleMap[this.pageType] || '年度审计报告'
        },
        // 获取详情数据并回显
        async fetchDetail(id) {
            try {
                const res = await Details(id)
                if (res && res.code === 1 && res.data) {
                    const data = res.data
                    
                    // 如果详情数据中有 type，更新 pageType
                    if (data.type) {
                        this.pageType = data.type
                        this.setPageTitle()
                    }
                    
                    // 回显年度
                    if (data.year) {
                        this.value1 = data.year
                    }
                    
                    // 回显材料名称
                    if (data.name) {
                        this.input = data.name
                    }
                    
                    // 回显状态（status 1是有效，0是无效）
                    this.yuanright = data.status === 1 ? 0 : 1
                    
                    // 回显图片
                    if (data.file) {
                        let imageUrl = data.file
                        // 如果 file 不是完整 URL，可能需要拼接 host
                        if (!data.file.startsWith('http://') && !data.file.startsWith('https://')) {
                            imageUrl = data.file
                        }
                        
                        // 添加到文件列表
                        this.fileList = [{
                            uid: Date.now(),
                            name: data.name || '年度审计报告.jpg',
                            url: imageUrl,
                            status: 'success'
                        }]
                    }
                    
                    // 更新表格数据
                    this.tableData2 = [{
                        date: data.year || '',
                        name: data.name || '',
                        address: ''
                    }]
                }
            } catch (error) {
                console.error('获取详情失败:', error)
                this.$message.error('获取详情失败，请稍后重试')
            }
        },
          //切换时效性
          btnYuan(e) {
            this.yuanright = e
        },
        //取消
        btnClose(){
            this.$router.go('-1')
        },
        btnShang() {
            this.$router.push('/operate')
        },
        // 从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)
                
                if (res && res.code === 1) {
                    // 根据实际接口返回的字段设置图片URL
                    const fileData = res.data?.data || res.data
                    let imageUrl = ''
                    let imageHost = ''
                    
                    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
                    } else {
                        imageUrl = res.data?.url || res.data || res.url
                    }
                    
                    // 添加到文件列表
                    const fileItem = {
                        uid: options.file.uid,
                        name: options.file.name,
                        url: imageUrl,
                        host: imageHost,
                        path: fileData?.path || '',
                        status: 'success'
                    }
                    this.fileList.push(fileItem)
                    
                    this.$message.success('文件上传成功')
                } else {
                    this.$message.error('文件上传失败')
                    // 上传失败，移除文件
                    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
        },
        // 提交保存
        async handleSave() {
            try {
                // 验证必填字段
                if (!this.value1) {
                    this.errorMessage = '请选择年度'
                    this.saveFailDialog = true
                    return
                }
                if (!this.input) {
                    this.errorMessage = '请输入材料名称'
                    this.saveFailDialog = true
                    return
                }

                // 格式化年度：从日期选择器获取年份
                let year = ''
                if (this.value1) {
                    // 使用 value-format="yyyy" 后，value1 直接是 "yyyy" 格式的字符串
                    year = String(this.value1)
                }

                // 构建保存数据 - 根据接口文档和示例JSON
                const saveData = {
                    id: this.editId ? String(this.editId) : '0', // id: 字符串类型，新增时传"0"，编辑时传实际id
                    year: year, // 年度,格式 YYYY
                    name: this.input, // 材料名称
                    type: this.pageType, // type根据页面类型传递（1-5）
                    status: this.yuanright === 0 ? 1 : 0, // 状态:1=有效,0=无效
                    file: (this.fileList.length > 0 ? this.fileList[0].url : null) || null // 附件
                }

                // 调用保存接口
                const res = await save(saveData)
                
                if (res && res.code === 1) {
                    // 显示成功对话框
                    this.saveSuccessDialog = true
                } else {
                    // 显示失败对话框，优先使用 message 字段，其次使用 msg 字段
                    this.errorMessage = res?.message || res?.msg || '保存失败，请稍后重试'
                    this.saveFailDialog = true
                }
            } catch (error) {
                console.error('保存失败:', error)
                // 显示失败对话框，优先使用响应中的 message 字段
                const errorData = error?.response?.data || {}
                this.errorMessage = errorData?.message || errorData?.msg || error?.message || '保存失败，请稍后重试'
                this.saveFailDialog = true
            }
        },
        // 关闭成功对话框
        closeSuccessDialog() {
            this.saveSuccessDialog = false
            // 返回到上一页
            this.$router.go(-1)
        },
        // 关闭失败对话框
        closeFailDialog() {
            this.saveFailDialog = false
            this.errorMessage = ''
        }

    }
}
</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>
.shangchuang{
    font-size: 12px;
    position: relative;
    top: -62px;
}
.img-area{
    display: flex;
    justify-content: center;
    margin-top: 12px;
}
: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;  /* 调整内部的 "+" 图标居中 */
}

.uploads-headers{
    width: 100%;
    height: 50px;
    background: #EDEFFE;
    line-height: 50px;
    text-align: center;
}
.uploads{
    width: 100%;
    height: 150px;
    border:1px solid #DCE0FD;
    background:white;
    margin-top: 15px;
    padding-bottom: 12px;
}
.upload-name{
    font-size: 12px;
    color: #6C6C6C;
    margin-left: 6px;
}
.upload-header{
    font-size: 14px;
}
.upload-area{
    margin-top: 12px;
}
.selects{
    width: 120px;
    margin-left: 12px;
    position: relative;
    top: 3px;
}
:deep .el-tooltip__popper.is-dark{
    color: #F04B4B !important;
}
.right-area {
    width: 90%;
    margin: 0 auto;
    height: 80vh;
    background: #f8f8f8;
    padding: 20px;
    overflow-y: auto;
}
.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;
}

.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-table {
    display: flex;
    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 {
    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;
    height: 100%;
    width: 100%;
}

.content-left {
    flex: 1;
  
    height: 100%;
}

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

.contents {
    width: 100%;
    height: 92vh;
    background: #f8f8f8;
    display: flex;
    margin-top: 6px;
    /* flex-wrap: wrap */
}

.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{
    flex: 1;
    text-align: center;
    cursor: pointer;
}
.rights{
    width: 96%;
    height: 100%;
    margin: 0 auto;
    line-height: 94px;
    display: flex;
    justify-content: center;
    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
}
.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;
}
/* 保存成功对话框样式 */
.save-success-dialog ::v-deep .el-dialog {
    border-radius: 8px;
    padding: 0;
}
.save-success-dialog ::v-deep .el-dialog__body {
    padding: 0;
}
.success-dialog-content {
    padding: 40px 30px 30px;
    text-align: center;
}
.success-icon-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}
.success-icon-wrapper img {
    width: 64px;
    height: 64px;
}
.success-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}
.success-message {
    font-size: 14px;
    color: #666;
    line-height: 24px;
    margin-bottom: 30px;
    text-align: center;
    padding: 0 20px;
}
.success-message p {
    margin: 8px 0;
}
.success-footer {
    text-align: center;
}
/* 保存失败对话框样式 */
.save-fail-dialog ::v-deep .el-dialog {
    border-radius: 8px;
    padding: 0;
}
.save-fail-dialog ::v-deep .el-dialog__body {
    padding: 0;
}
.fail-dialog-content {
    padding: 40px 30px 30px;
    text-align: center;
}
.fail-icon-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}
.fail-icon-wrapper img {
    width: 64px;
    height: 64px;
}
.fail-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}
.fail-message {
    font-size: 14px;
    color: #666;
    line-height: 24px;
    margin-bottom: 30px;
    text-align: center;
    padding: 0 20px;
    min-height: 48px;
}
.fail-message p {
    margin: 8px 0;
}
.fail-footer {
    text-align: center;
}
</style>