import sys import os filepath = r'd:\\haomi\\cursor_projects\\writeOff\\frontend\\src\\views\\modules\\meeting-page\\MeetingMaterialDrawer.vue' with open(filepath, 'r', encoding='utf-8') as f: text = f.read() # 1. Update Scripts script_idx = text.rfind('defineEmits<{') insert_script = """const emit = defineEmits<{ materialTabChange: [name: string]; saveMaterial: []; submitMaterial: []; }>(); const handleSidebarMenuClick = async (moduleCode: string) => { if (selectedModuleCode.value === moduleCode) return; const canLeave = await handleBeforeTabLeave(moduleCode, selectedModuleCode.value); if (canLeave) { selectedModuleCode.value = moduleCode; emit('materialTabChange', moduleCode); } }; const displayModuleTitle = computed(() => { const map: Record = { BASIC_INFO: '会议基本信息', WRITE_OFF_DOCS: '核销材料', EXPERT_PROFILE: '专家简介/串场', EXPERT_LIST: '专家配置及材料', MEETING_INVOICE: '会议各项发票' }; return map[selectedModuleCode.value] || '会议资料'; }); """ end_emits_idx = text.find('}();', script_idx) + 5 if end_emits_idx < script_idx + 5: # fallback end_emits_idx = text.find('}>();', script_idx) + 5 text = text[:script_idx] + insert_script + text[end_emits_idx:] # 2. Top layout replacement basic_info_idx = text.find("', 0, basic_info_idx) sidebar_replacement = """', ' \n \n \n \n\n' ) # We also have which we just delete entirely. start_footer = text.find('', start_footer) + len('') if start_footer != -1: text = text[:start_footer] + '' + text[end_footer:] text = text.replace('\n ', '\n \n \n \n \n') # 4. Segmented Control for EXPERT_LIST internal tabs: text = text.replace( ''' ''', '''
现场照片
劳务协议
''' ) # 5. Add custom CSS at the end style_idx = text.rfind('') custom_css = """ /* Custom Material Drawer Styles */ :global(.custom-material-drawer .el-drawer__body) { padding: 0 !important; background-color: var(--wo-bg-light, #f5f7fa); } .material-layout { display: flex; height: 100%; width: 100%; overflow: hidden; } .material-sidebar { width: 280px; background-color: var(--wo-bg-side, #ffffff); border-right: 1px solid var(--wo-border-light, #e4e7ed); display: flex; flex-direction: column; flex-shrink: 0; padding: 24px 0; z-index: 10; } .sidebar-header { padding: 0 24px; margin-bottom: 24px; } .sidebar-title { font-size: 20px; font-weight: 600; color: var(--wo-text-primary, #303133); } .sidebar-menu { list-style: none; padding: 0 12px; margin: 0; flex: 1; } .sidebar-menu li { padding: 12px 16px; margin-bottom: 8px; border-radius: 8px; cursor: pointer; color: var(--wo-text-regular, #606266); font-size: 14px; transition: all 0.2s ease; font-weight: 500; } .sidebar-menu li:hover { background-color: var(--wo-bg-light, #f5f7fa); color: var(--wo-text-primary, #303133); } .sidebar-menu li.is-active { background-color: var(--el-color-primary-light-9); color: var(--el-color-primary); font-weight: 600; } .sidebar-budget-card { margin: 20px 16px 0; padding: 16px; border-radius: 12px; background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%); border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 4px 12px rgba(0,0,0,0.03); } .sidebar-notice-card { margin: 16px; padding: 16px; border-radius: 12px; background-color: var(--el-color-info-light-9); border: 1px solid var(--el-color-info-light-7); } .notice-title { color: var(--el-color-info); font-weight: 600; font-size: 13px; margin-bottom: 8px; } .notice-content { font-size: 13px; color: var(--wo-text-regular); line-height: 1.5; } .budget-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--wo-text-primary); } .budget-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; } .budget-divider { height: 1px; background-color: rgba(0,0,0,0.06); margin: 12px 0; } .material-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background-color: #f7f8fa; } .main-header { height: 72px; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; background-color: #ffffff; border-bottom: 1px solid var(--wo-border-light, #e4e7ed); flex-shrink: 0; } .main-title { font-size: 18px; font-weight: 600; color: var(--wo-text-primary); } .main-content { flex: 1; padding: 32px; overflow-y: auto; } .material-module-card { background-color: #ffffff; border-radius: 12px; padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,0.02); border: 1px solid var(--wo-border-light, #e4e7ed); } .material-module-card.p-0 { padding: 0; background: transparent; box-shadow: none; border: none; } /* Custom Segmented Control */ .custom-segmented-control { display: inline-flex; background-color: var(--wo-bg-light, #f5f7fa); padding: 4px; border-radius: 8px; } .segmented-item { padding: 8px 24px; font-size: 14px; font-weight: 500; color: var(--wo-text-regular); cursor: pointer; border-radius: 6px; transition: all 0.2s ease; } .segmented-item.is-active { background-color: #ffffff; color: var(--el-color-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); } .expert-list-container { display: flex; gap: 16px; height: 100%; } .expert-list-container .section-card-sm, .expert-list-container .section-card { background-color: #ffffff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.02); border: 1px solid var(--wo-border-light, #e4e7ed); } """ if style_idx != -1: text = text[:style_idx] + custom_css + text[style_idx:] with open(filepath, 'w', encoding='utf-8') as f: f.write(text) print('Done!')