sync_page.py
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import streamlit as st
import importlib.util
import os
import sys
def load_module(module_name, file_path):
module_dir = os.path.dirname(file_path)
if module_dir not in sys.path:
sys.path.insert(0, module_dir)
spec = importlib.util.spec_from_file_location(module_name, file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def show():
st.header("同步数据到审计库")
st.info("请从左侧选择业务类型以加载对应的同步逻辑。")
def show_with_category(category):
st.header(f"同步数据到审计库 - {category}")
base_dir = os.path.dirname(os.path.abspath(__file__))
if category == "E盾-智慧车管":
module_path = os.path.join(base_dir, "edun", "edun_sync.py")
try:
module = load_module("edun_sync", module_path)
module.show()
except Exception as e:
st.error(f"加载 E盾 同步模块失败: {e}")
elif category == "嘀加-旧版本":
#
module_path = os.path.join(base_dir, "dijia", "dijia_sync.py")
try:
module = load_module("dijia_sync", module_path)
module.show()
except Exception as e:
st.error(f"加载 嘀加 同步模块失败: {e}")
else:
st.warning(f"未知的业务类型: {category}")