diff --git a/static/app.js b/static/app.js
index a1eed76..daf57e4 100644
--- a/static/app.js
+++ b/static/app.js
@@ -430,11 +430,13 @@ function renderChartOn(id, data) {
});
}
-function drawerField(icon, label, name, value, multiline = false) {
+function drawerField(icon, label, name, value, multiline = false, customControl = null) {
const initialValue = text(value);
- const control = multiline
- ? ``
- : ``;
+ const control = customControl
+ ? customControl
+ : multiline
+ ? ``
+ : ``;
return `
${label}
${control}
@@ -448,7 +450,7 @@ function openDrawer(resource, id) {
const fields = resource === "sales"
? [["target_customer","业务机会"],["priority","优先级"],["status","状态"]]
: resource === "operations"
- ? [["project_name","项目名称"],["owner","负责人"],["current_stage","当前阶段"],["expected_sign_date","截止时间"],["expected_contract_amount","金额"],["notes","项目说明"]]
+ ? [["project_name","项目名称"],["owner","负责人"],["expected_sign_date","截止时间"],["expected_contract_amount","金额"],["notes","项目说明"]]
: resource === "proposals"
? [["customer_or_project_name","客户/项目"],["version","版本号"],["description","版本说明"],["created_date","创建日期"],["status","状态"]]
: [["product_name","产品名称"],["version","版本号"],["version_goal","版本目标"],["feature_list","核心功能清单"],["platform","平台"],["launch_date","上线日期"],["status","当前状态"],["notes","备注"]];
@@ -467,7 +469,10 @@ function openDrawer(resource, id) {
drawer.innerHTML = `
${resource === "proposals" ? `
方案文件
${["方案","成本","SOP","财务流程"].map((cat) => fileGroup("proposal", item.id, item.version, cat, item.files.filter((f) => f.file_category === cat))).join("")}
` : ""}
${followupTarget ? `
@@ -534,7 +539,7 @@ function bindDrawerAutosave(resource, id, item) {
field.addEventListener("keydown", (event) => {
if (event.key === "Enter" && field.tagName !== "TEXTAREA") field.blur();
});
- field.addEventListener("blur", async () => {
+ const doSave = async () => {
const value = field.value;
if (value === field.dataset.original) return;
const previous = field.dataset.original;
@@ -554,7 +559,9 @@ function bindDrawerAutosave(resource, id, item) {
setDrawerSaveStatus("保存失败", "danger");
alert(`自动保存失败:${error.message}`);
}
- });
+ };
+ field.addEventListener("blur", doSave);
+ if (field.tagName === "SELECT") field.addEventListener("change", doSave);
});
}