""" 為每個模組加入 CSV 匯入匯出按鈕 """ import sys import codecs # 設置 UTF-8 編碼(Windows 編碼修正) if sys.platform == 'win32': sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer, 'strict') sys.stderr = codecs.getwriter('utf-8')(sys.stderr.buffer, 'strict') with open('index.html', 'r', encoding='utf-8') as f: content = f.read() # 備份 with open('index.html.backup_csv', 'w', encoding='utf-8') as f: f.write(content) # 1. 在 中加入 csv_utils.js if '' not in content: head_insertion = ' \n' content = content.replace('', head_insertion) print("[OK] Added csv_utils.js reference") # 2. 為崗位資料模組加入 CSV 按鈕 # 在 action-buttons 區域前加入 CSV 按鈕 position_csv_buttons = '''
''' # 找到崗位資料模組的 action-buttons old_position_section = '''
''' # 找到職務資料模組的 action-buttons(注意有不同的函數名) old_job_section = '''
''' # 找到崗位描述模組的 action-buttons old_desc_section = '''