SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>业务风控组项目审核人员查询</title>
    <style>
        body {
            font-family: "Microsoft YaHei", sans-serif;
            max-width: 900px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
        }
        .email-notice {
            background-color: #f0f7ff;
            padding: 12px;
            border-radius: 6px;
            margin: 15px 0;
            text-align: center;
            font-weight: bold;
            border-left: 4px solid #1890ff;
            color: #333;
        }
        .email-notice a {
            color: #1890ff;
            text-decoration: none;
        }
        .email-notice a:hover {
            text-decoration: underline;
        }
        .card {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            padding: 25px;
            margin-bottom: 20px;
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #555;
        }
        select, input, textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }
        textarea {
            min-height: 100px;
            resize: vertical;
        }
        button {
            background-color: #1890ff;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 10px;
            margin-right: 10px;
        }
        button:hover {
            background-color: #40a9ff;
        }
        button.danger {
            background-color: #f5222d;
        }
        button.danger:hover {
            background-color: #ff4d4f;
        }
        button.secondary {
            background-color: #d9d9d9;
            color: #333;
        }
        button.secondary:hover {
            background-color: #bfbfbf;
        }
        #result {
            margin-top: 30px;
            display: none;
        }
        .result-content {
            background-color: #f0f7ff;
            padding: 20px;
            border-radius: 4px;
            border-left: 4px solid #1890ff;
        }
        .admin-panel {
            margin-top: 40px;
            display: none;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
        .login-form {
            max-width: 400px;
            margin: 0 auto;
        }
        .error {
            color: #f5222d;
            margin-top: 5px;
        }
        .success {
            color: #52c41a;
            margin-top: 5px;
        }
        .process-details {
            white-space: pre-line;
            margin-top: 10px;
            padding: 10px;
            background-color: #fafafa;
            border-radius: 4px;
        }
        .modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.4);
        }
        .modal-content {
            background-color: #fff;
            margin: 10% auto;
            padding: 20px;
            border-radius: 8px;
            width: 60%;
            max-width: 600px;
        }
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
        }
        .close:hover {
            color: black;
        }
        .admin-actions {
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }
        .attachment-link {
            display: inline-block;
            margin-top: 10px;
            color: #1890ff;
            text-decoration: none;
        }
        .attachment-link:hover {
            text-decoration: underline;
        }
        .attachment-section {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px dashed #ddd;
        }
        .attachment-upload {
            margin-top: 10px;
        }
        .attachment-item {
            margin: 5px 0;
            display: flex;
            align-items: center;
        }
        .attachment-item a {
            margin-right: 10px;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>景点玩乐业务部-国内业务管理中心</h1>
        <h2>业务风控组项目审核人员查询</h2>
        <div class="email-notice">
            所有审核请发至业务风控组公邮:<a href="mailto:YWFKZ@trip.com">YWFKZ@trip.com</a>
        </div>
    </div>

    <div class="card">
        <div class="form-group">
            <label for="projectType">项目分类:</label>
            <select id="projectType">
                <option value="">-- 请选择项目分类 --</option>
                <option value="包票">包票</option>
                <option value="总代">总代</option>
                <option value="共建/IP/地推/票机/广告售卖/景区置换/积分当钱花等非现金(如票房分成、免票、政策票)">共建/IP/地推/票机等非现金(如票房分成、免票、政策票)</option>
                <option value="阶梯返佣(销售奖励)">阶梯返佣(销售奖励)</option>
                <option value="优惠券审核">优惠券审核</option>
                <option value="BC价格相关(B端分销改价、BC端负毛利)">BC价格相关(B端分销改价、BC端负毛利)</option>
                <option value="资金占用成本免除考核、预付款报损">资金占用/预付款报损</option>
                <option value="预付款OA审批">预付款OA审批</option>
            </select>
        </div>

        <div class="form-group" id="regionGroup">
            <label for="region">选择大区:</label>
            <select id="region">
                <option value="">-- 请选择大区 --</option>
                <option value="华东">华东大区</option>
                <option value="华南">华南大区</option>
                <option value="华西">华西大区</option>
                <option value="华北">华北大区</option>
                <option value="云南">云南大区</option>
            </select>
        </div>

        <button onclick="findAuditor()">查询审核人员</button>

        <div id="result" class="card">
            <h3>查询结果</h3>
            <div class="result-content">
                <p id="resultProject"></p>
                <p id="resultRegion"></p>
                <p id="resultAuditor"></p>
                <h4>审核流程:</h4>
                <div id="resultProcess" class="process-details"></div>
                <div class="attachment-section" id="attachmentSection" style="display:none;">
                    <h4>相关附件:</h4>
                    <div id="attachmentList"></div>
                </div>
            </div>
        </div>
    </div>

    <!-- 管理员登录 -->
    <div id="adminLogin" class="card">
        <h3>管理员登录</h3>
        <div class="login-form">
            <div class="form-group">
                <label for="username">用户名:</label>
                <input type="text" id="username" placeholder="请输入用户名">
            </div>
            <div class="form-group">
                <label for="password">密码:</label>
                <input type="password" id="password" placeholder="请输入密码">
            </div>
            <button onclick="adminLogin()">登录</button>
            <p id="loginError" class="error"></p>
        </div>
    </div>

    <!-- 管理员配置面板 (默认隐藏) -->
    <div id="adminPanel" class="admin-panel card">
        <h2>审核规则配置</h2>
        <button onclick="showAddRuleModal()">添加新规则</button>
        <table id="rulesTable">
            <thead>
                <tr>
                    <th>项目分类</th>
                    <th>适用大区</th>
                    <th>审核人员</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody id="rulesBody">
                <!-- 动态生成 -->
            </tbody>
        </table>
        
        <div class="admin-actions">
            <h3>管理员操作</h3>
            <button onclick="showChangePasswordModal()">修改管理员密码</button>
            <button class="danger" onclick="adminLogout()">退出登录</button>
        </div>
    </div>

    <!-- 添加/编辑规则模态框 -->
    <div id="ruleModal" class="modal">
        <div class="modal-content">
            <span class="close" onclick="closeModal()">&times;</span>
            <h2 id="modalTitle">添加审核规则</h2>
            <div class="form-group">
                <label for="modalProject">项目分类:</label>
                <input type="text" id="modalProject" placeholder="例如: 包票">
            </div>
            <div class="form-group">
                <label for="modalRegions">适用大区(多个大区用逗号分隔,全部大区请输入"全部"):</label>
                <input type="text" id="modalRegions" placeholder="例如: 华东,华南 或 全部">
            </div>
            <div class="form-group">
                <label for="modalAuditor">审核人员:</label>
                <input type="text" id="modalAuditor" placeholder="例如: 李天逸">
            </div>
            <div class="form-group">
                <label for="modalProcess">审核流程:</label>
                <textarea id="modalProcess" placeholder="请输入完整的审核流程"></textarea>
            </div>
            <div class="form-group">
                <label>上传附件:</label>
                <div id="existingAttachments"></div>
                <input type="file" id="modalAttachment" class="attachment-upload">
                <button onclick="addAttachment()" style="margin-top: 5px;">添加附件</button>
                <div id="attachmentPreview"></div>
            </div>
            <button onclick="saveRule()">保存</button>
            <button class="secondary" onclick="closeModal()">取消</button>
            <p id="modalError" class="error"></p>
        </div>
    </div>

    <!-- 修改密码模态框 -->
    <div id="passwordModal" class="modal">
        <div class="modal-content">
            <span class="close" onclick="closeModal()">&times;</span>
            <h2>修改管理员密码</h2>
            <div class="form-group">
                <label for="currentPassword">当前密码:</label>
                <input type="password" id="currentPassword" placeholder="请输入当前密码">
            </div>
            <div class="form-group">
                <label for="newPassword">新密码:</label>
                <input type="password" id="newPassword" placeholder="请输入新密码">
            </div>
            <div class="form-group">
                <label for="confirmPassword">确认新密码:</label>
                <input type="password" id="confirmPassword" placeholder="请再次输入新密码">
            </div>
            <button onclick="changePassword()">确认修改</button>
            <button class="secondary" onclick="closeModal()">取消</button>
            <p id="passwordError" class="error"></p>
            <p id="passwordSuccess" class="success"></p>
        </div>
    </div>

    <script>
        // 审核规则数据 - 根据最新Excel表格更新
        let auditRules = [
            { 
                project: "包票", 
                regions: ["华西", "华北", "云南"], 
                auditor: "李天逸", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "包票", 
                regions: ["华东", "华南"], 
                auditor: "方琳琳", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "总代", 
                regions: ["华西", "华北", "云南"], 
                auditor: "李天逸", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "总代", 
                regions: ["华东", "华南"], 
                auditor: "方琳琳", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "共建/IP/地推/票机/广告售卖/景区置换/积分当钱花等非现金(如票房分成、免票、政策票)", 
                regions: ["华西", "华北", "云南"], 
                auditor: "李天逸", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "共建/IP/地推/票机/广告售卖/景区置换/积分当钱花等非现金(如票房分成、免票、政策票)", 
                regions: ["华东", "华南"], 
                auditor: "方琳琳", 
                process: "业务→大区(项目负责人)→管理中心(业务风控组)→(创新中心、共建项目组、营销中心)→(业务负责人 李哲总)→财务→(CEO 季总)\n1. 无项目支出的总代权益与免票收益,可直接报备到管理中心(业务风控组)\n2. 涉及到共建、地推等混合类项目,需相关项目组审批\n3. 超500万、硬包,升级李哲总\n4. 超2,000万元的项目,升级季总(3,000万元的项目,报备集团资金部)",
                attachments: []
            },
            { 
                project: "阶梯返佣(销售奖励)", 
                regions: ["全部"], 
                auditor: "林诗牧", 
                process: "业务→阶返系统录入→管理中心(业务风控组)→财务、法务→供管\n包票(大额预付项目)含销售奖励:业务→阶返系统录入→需阶返审核通过后才可过包票审核",
                attachments: []
            },
            { 
                project: "优惠券审核", 
                regions: ["全部"], 
                auditor: "李天逸", 
                process: "业务→大区→管理中心(业务风控组)→(策略组)→财务→营销中心制作优惠券\n涉及到负毛利需策略组审批",
                attachments: []
            },
            { 
                project: "BC价格相关(B端分销改价、BC端负毛利)", 
                regions: ["全部"], 
                auditor: "林娜", 
                process: "业务→大区→管理中心(业务风控组)→分销组→(财务)\n涉及到负毛利需财务审批\n不含涉及优惠券的负毛利\nB端分销改价:包含景区指定分销商",
                attachments: []
            },
            { 
                project: "资金占用成本免除考核、预付款报损", 
                regions: ["全部"], 
                auditor: "吴娜娜", 
                process: "业务→大区→管理中心(业务风控组)→(业务负责人 李哲总)→财务\n1. 业务风控组预判,涉及特殊场景,升级李哲总特批\n2. 预付款报损,需在财务审批前+结算确认具体金额\n预付款OA审批流:结算+会签管理中心(业务风控组)",
                attachments: []
            },
            { 
                project: "预付款OA审批", 
                regions: ["全部"], 
                auditor: "吴娜娜", 
                process: "业务→大区→管理中心(业务风控组)→(业务负责人 李哲总)→财务\n1. 业务风控组预判,涉及特殊场景,升级李哲总特批\n2. 预付款报损,需在财务审批前+结算确认具体金额\n预付款OA审批流:结算+会签管理中心(业务风控组)",
                attachments: []
            }
        ];

        // 管理员凭据
        let adminCredentials = {
            username: "admin",
            password: "123456"
        };

        // 当前编辑的规则索引
        let currentEditIndex = -1;
        // 当前编辑的附件列表
        let currentAttachments = [];

        // 页面加载时初始化
        window.onload = function() {
            // 从本地存储加载管理员凭据和规则
            const savedCredentials = localStorage.getItem('adminCredentials');
            const savedRules = localStorage.getItem('auditRules');
            
            if (savedCredentials) {
                adminCredentials = JSON.parse(savedCredentials);
            }
            
            if (savedRules) {
                try {
                    const parsedRules = JSON.parse(savedRules);
                    // 确保所有规则都有attachments属性
                    auditRules = parsedRules.map(rule => ({
                        ...rule,
                        attachments: rule.attachments || []
                    }));
                } catch (e) {
                    console.error("解析规则失败:", e);
                }
            }
            
            // 检查登录状态
            if (localStorage.getItem('adminLoggedIn') === 'true') {
                document.getElementById('adminLogin').style.display = 'none';
                document.getElementById('adminPanel').style.display = 'block';
                loadRulesTable();
            }
            
            // 根据项目类型显示/隐藏大区选择
            document.getElementById('projectType').addEventListener('change', function() {
                const projectType = this.value;
                const regionGroup = document.getElementById('regionGroup');
                
                // 检查是否需要显示大区选择
                const needsRegion = auditRules.some(rule => 
                    rule.project === projectType && rule.regions[0] !== "全部"
                );
                
                regionGroup.style.display = needsRegion ? 'block' : 'none';
            });
        };

        // 查询审核人员
        function findAuditor() {
            const projectType = document.getElementById('projectType').value;
            const region = document.getElementById('region').value;
            const resultDiv = document.getElementById('result');
            const attachmentSection = document.getElementById('attachmentSection');
            
            if (!projectType) {
                alert("请选择项目分类");
                return;
            }
            
            // 查找匹配的规则
            let matchedRule = null;
            
            for (const rule of auditRules) {
                if (rule.project === projectType) {
                    if (rule.regions[0] === "全部") {
                        matchedRule = rule;
                        break;
                    } else if (rule.regions.includes(region)) {
                        matchedRule = rule;
                        break;
                    }
                }
            }
            
            if (matchedRule) {
                document.getElementById('resultProject').innerHTML = `<strong>项目分类:</strong> ${matchedRule.project}`;
                
                if (matchedRule.regions[0] === "全部") {
                    document.getElementById('resultRegion').innerHTML = `<strong>适用大区:</strong> 全部大区`;
                } else {
                    document.getElementById('resultRegion').innerHTML = `<strong>适用大区:</strong> ${matchedRule.regions.join('、')}大区`;
                }
                
                document.getElementById('resultAuditor').innerHTML = `<strong>风控审核对接人:</strong> <span style="color: #1890ff; font-weight: bold;">${matchedRule.auditor}</span>`;
                document.getElementById('resultProcess').innerHTML = matchedRule.process.replace(/\n/g, '<br>');
                
                // 显示附件
                const attachmentList = document.getElementById('attachmentList');
                attachmentList.innerHTML = '';
                
                if (matchedRule.attachments && matchedRule.attachments.length > 0) {
                    attachmentSection.style.display = 'block';
                    matchedRule.attachments.forEach(attachment => {
                        const link = document.createElement('a');
                        link.href = attachment.url;
                        link.className = 'attachment-link';
                        link.textContent = attachment.name;
                        link.target = '_blank';
                        link.download = attachment.name;
                        attachmentList.appendChild(link);
                        attachmentList.appendChild(document.createElement('br'));
                    });
                } else {
                    attachmentSection.style.display = 'none';
                }
                
                resultDiv.style.display = 'block';
            } else {
                alert("未找到匹配的审核规则,请联系管理员");
            }
        }

        // 管理员登录
        function adminLogin() {
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            const errorElement = document.getElementById('loginError');
            
            if (username === adminCredentials.username && password === adminCredentials.password) {
                localStorage.setItem('adminLoggedIn', 'true');
                document.getElementById('adminLogin').style.display = 'none';
                document.getElementById('adminPanel').style.display = 'block';
                loadRulesTable();
                errorElement.textContent = '';
            } else {
                errorElement.textContent = '用户名或密码错误';
            }
        }

        // 管理员退出登录
        function adminLogout() {
            localStorage.removeItem('adminLoggedIn');
            document.getElementById('adminPanel').style.display = 'none';
            document.getElementById('adminLogin').style.display = 'block';
            document.getElementById('username').value = '';
            document.getElementById('password').value = '';
        }

        // 加载规则表格
        function loadRulesTable() {
            const tbody = document.getElementById('rulesBody');
            tbody.innerHTML = '';
            
            auditRules.forEach((rule, index) => {
                const row = document.createElement('tr');
                
                row.innerHTML = `
                    <td>${rule.project}</td>
                    <td>${rule.regions.join(', ')}</td>
                    <td>${rule.auditor}</td>
                    <td>
                        <button onclick="showEditRuleModal(${index})">编辑</button>
                        <button class="danger" onclick="deleteRule(${index})">删除</button>
                    </td>
                `;
                
                tbody.appendChild(row);
            });
        }

        // 显示添加规则模态框
        function showAddRuleModal() {
            currentEditIndex = -1;
            currentAttachments = [];
            document.getElementById('modalTitle').textContent = '添加审核规则';
            document.getElementById('modalProject').value = '';
            document.getElementById('modalRegions').value = '';
            document.getElementById('modalAuditor').value = '';
            document.getElementById('modalProcess').value = '';
            document.getElementById('existingAttachments').innerHTML = '';
            document.getElementById('attachmentPreview').innerHTML = '';
            document.getElementById('modalError').textContent = '';
            document.getElementById('ruleModal').style.display = 'block';
        }

        // 显示编辑规则模态框
        function showEditRuleModal(index) {
            currentEditIndex = index;
            const rule = auditRules[index];
            currentAttachments = [...(rule.attachments || [])];
            document.getElementById('modalTitle').textContent = '编辑审核规则';
            document.getElementById('modalProject').value = rule.project;
            document.getElementById('modalRegions').value = rule.regions.join(', ');
            document.getElementById('modalAuditor').value = rule.auditor;
            document.getElementById('modalProcess').value = rule.process;
            
            // 渲染附件列表
            renderAttachmentList();
            
            document.getElementById('attachmentPreview').innerHTML = '';
            document.getElementById('modalError').textContent = '';
            document.getElementById('ruleModal').style.display = 'block';
        }

        // 渲染附件列表
        function renderAttachmentList() {
            const existingAttachments = document.getElementById('existingAttachments');
            existingAttachments.innerHTML = '';
            
            if (currentAttachments && currentAttachments.length > 0) {
                const label = document.createElement('p');
                label.textContent = '已有附件:';
                existingAttachments.appendChild(label);
                
                currentAttachments.forEach((attachment, i) => {
                    const attachmentDiv = document.createElement('div');
                    attachmentDiv.className = 'attachment-item';
                    
                    const link = document.createElement('a');
                    link.href = attachment.url;
                    link.textContent = attachment.name;
                    link.target = '_blank';
                    link.download = attachment.name;
                    
                    const deleteBtn = document.createElement('button');
                    deleteBtn.textContent = '删除';
                    deleteBtn.className = 'danger';
                    deleteBtn.style.padding = '2px 5px';
                    deleteBtn.style.fontSize = '12px';
                    deleteBtn.style.marginLeft = '10px';
                    deleteBtn.onclick = (function(index) {
                        return function(e) {
                            e.preventDefault();
                            currentAttachments.splice(index, 1);
                            renderAttachmentList();
                        };
                    })(i);
                    
                    attachmentDiv.appendChild(link);
                    attachmentDiv.appendChild(deleteBtn);
                    existingAttachments.appendChild(attachmentDiv);
                });
            }
        }

        // 添加附件
        function addAttachment() {
            const fileInput = document.getElementById('modalAttachment');
            const file = fileInput.files[0];
            
            if (!file) {
                alert('请先选择文件');
                return;
            }
            
            // 创建文件URL
            const fileUrl = URL.createObjectURL(file);
            
            currentAttachments.push({
                name: file.name,
                url: fileUrl,
                file: file // 保留文件对象以便后续处理
            });
            
            // 显示预览
            const preview = document.getElementById('attachmentPreview');
            preview.innerHTML = '';
            
            const p = document.createElement('p');
            p.textContent = `已添加附件: ${file.name}`;
            preview.appendChild(p);
            
            // 重新渲染附件列表
            renderAttachmentList();
            
            // 清空文件输入
            fileInput.value = '';
        }

        // 显示修改密码模态框
        function showChangePasswordModal() {
            document.getElementById('currentPassword').value = '';
            document.getElementById('newPassword').value = '';
            document.getElementById('confirmPassword').value = '';
            document.getElementById('passwordError').textContent = '';
            document.getElementById('passwordSuccess').textContent = '';
            document.getElementById('passwordModal').style.display = 'block';
        }

        // 关闭模态框
        function closeModal() {
            document.getElementById('ruleModal').style.display = 'none';
            document.getElementById('passwordModal').style.display = 'none';
        }

        // 保存规则
        function saveRule() {
            const project = document.getElementById('modalProject').value.trim();
            const regions = document.getElementById('modalRegions').value.trim();
            const auditor = document.getElementById('modalAuditor').value.trim();
            const process = document.getElementById('modalProcess').value.trim();
            const errorElement = document.getElementById('modalError');
            
            // 验证输入
            if (!project || !regions || !auditor || !process) {
                errorElement.textContent = '所有字段都必须填写';
                return;
            }
            
            const regionArray = regions.split(',').map(r => r.trim());
            
            // 处理附件 - 确保只保留必要的属性
            const attachmentsToSave = currentAttachments.map(att => ({
                name: att.name,
                url: att.url
            }));
            
            if (currentEditIndex === -1) {
                // 添加新规则
                auditRules.push({
                    project,
                    regions: regionArray,
                    auditor,
                    process,
                    attachments: attachmentsToSave
                });
            } else {
                // 更新现有规则
                auditRules[currentEditIndex] = {
                    project,
                    regions: regionArray,
                    auditor,
                    process,
                    attachments: attachmentsToSave
                };
            }
            
            // 保存到本地存储
            localStorage.setItem('auditRules', JSON.stringify(auditRules));
            
            loadRulesTable();
            closeModal();
        }

        // 修改密码
        function changePassword() {
            const currentPassword = document.getElementById('currentPassword').value;
            const newPassword = document.getElementById('newPassword').value;
            const confirmPassword = document.getElementById('confirmPassword').value;
            const errorElement = document.getElementById('passwordError');
            const successElement = document.getElementById('passwordSuccess');
            
            // 验证输入
            if (!currentPassword || !newPassword || !confirmPassword) {
                errorElement.textContent = '所有字段都必须填写';
                return;
            }
            
            if (currentPassword !== adminCredentials.password) {
                errorElement.textContent = '当前密码不正确';
                return;
            }
            
            if (newPassword !== confirmPassword) {
                errorElement.textContent = '新密码与确认密码不一致';
                return;
            }
            
            if (newPassword.length < 6) {
                errorElement.textContent = '密码长度至少为6位';
                return;
            }
            
            // 更新密码
            adminCredentials.password = newPassword;
            localStorage.setItem('adminCredentials', JSON.stringify(adminCredentials));
            
            errorElement.textContent = '';
            successElement.textContent = '密码修改成功!';
            
            // 3秒后自动关闭模态框
            setTimeout(() => {
                closeModal();
                successElement.textContent = '';
            }, 3000);
        }

        // 删除规则
        function deleteRule(index) {
            if (confirm("确定要删除这条规则吗?")) {
                auditRules.splice(index, 1);
                localStorage.setItem('auditRules', JSON.stringify(auditRules));
                loadRulesTable();
                alert("规则已删除");
            }
        }
    </script>
</body>
</html>