diff --git a/ad_user_creator/templates/index.html b/ad_user_creator/templates/index.html
index 6f0b496..9206a74 100644
--- a/ad_user_creator/templates/index.html
+++ b/ad_user_creator/templates/index.html
@@ -203,6 +203,12 @@
currentUIOptions = await res.json();
renderSelect('dept_ou', currentUIOptions.ou_list, '请选择部门 OU...');
renderSelect('base_group', currentUIOptions.base_group_list, '请选择基础组...');
+
+ // 如果列表包含 staff,设置为默认选项
+ if (currentUIOptions.base_group_list && currentUIOptions.base_group_list.includes('staff')) {
+ document.getElementById('base_group').value = 'staff';
+ }
+
renderCheckboxes('project_groups_container', 'project_groups_input', currentUIOptions.project_group_list);
renderCheckboxes('resource_groups_container', 'resource_groups_input', currentUIOptions.resource_group_list);
}
diff --git a/run.sh b/run.sh
index 0270252..868d861 100755
--- a/run.sh
+++ b/run.sh
@@ -1,15 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
-PYTHON_BIN="/opt/homebrew/Caskroom/miniconda/base/bin/python"
+PYTHON_BIN="python3"
CONFIG_PATH="config/config.yaml"
INPUT_FILE=""
DRY_RUN="false"
CONTINUE_ON_ERROR="true"
+COMMAND=""
usage() {
cat <<'EOF'
Usage:
+ ./run.sh ui
./run.sh
./run.sh -f users.csv
./run.sh -f users.xlsx
@@ -17,6 +19,9 @@ Usage:
./run.sh -f users.xlsx --continue-on-error false
./run.sh -c config/config.yaml
+Commands:
+ ui Start the Web UI in the background on port 9999
+
Options:
-f Batch input file (.csv/.xlsx). If omitted, interactive mode is used.
-c YAML config path (default: config/config.yaml)
@@ -26,6 +31,12 @@ Options:
EOF
}
+# 检查是否为独立的 ui 命令
+if [[ "${1:-}" == "ui" ]]; then
+ COMMAND="ui"
+ shift
+fi
+
while [[ $# -gt 0 ]]; do
case "$1" in
-f)
@@ -60,6 +71,16 @@ while [[ $# -gt 0 ]]; do
esac
done
+if [[ "${COMMAND}" == "ui" ]]; then
+ mkdir -p state
+ LOG_FILE="state/web.log"
+ nohup "${PYTHON_BIN}" -m ad_user_creator.main --config "${CONFIG_PATH}" web --port 9999 > "${LOG_FILE}" 2>&1 &
+ echo "UI 服务已在后台启动,监听 http://0.0.0.0:9999"
+ echo "PID: $!"
+ echo "日志: ${LOG_FILE}"
+ exit 0
+fi
+
if [[ -z "${INPUT_FILE}" ]]; then
CMD=("${PYTHON_BIN}" -m ad_user_creator.main --config "${CONFIG_PATH}" interactive)
if [[ "${DRY_RUN}" == "true" ]]; then