]> acesimba.cloud Git - StationBuilder-vue.git/commitdiff
领域方案导入页:补齐与编辑页一致的字段(缩写必英文大写、所属领域、版本号、状态)
authorroot <root@localhost.localdomain>
Mon, 28 Sep 2026 07:09:00 +0000 (15:09 +0800)
committerroot <root@localhost.localdomain>
Mon, 28 Sep 2026 07:09:00 +0000 (15:09 +0800)
- 新增「缩写(英文大写)」必填项,输入自动转大写并校验 /^[A-Z]+$/
- 新增「状态」下拉(可用 / 编辑中)
- 字段顺序与标签对齐领域方案编辑页:方案名称、缩写、所属领域、版本号、状态、方案说明
- submit 时一并提交 abbr 与 status

src-vue/pages/domain/ImportDomainPackage.vue

index c4bdb0c246474e487ce1fd4d160ef054a9c5222e..9ca94a5fa90286b5344a2972cd895715548d7ca0 100644 (file)
@@ -21,7 +21,9 @@ const props = defineProps({
 const file = ref(null);
 const domainId = ref(0);
 const name = ref("");
+const abbr = ref("");
 const version = ref("1.0");
+const status = ref("available");
 const description = ref("");
 const busy = ref(false);
 
@@ -54,6 +56,10 @@ async function submit() {
     props.notify("请填写方案名称和所属领域");
     return;
   }
+  if (!/^[A-Z]+$/.test((abbr.value || "").trim())) {
+    props.notify("缩写必须为英文大写字母");
+    return;
+  }
   busy.value = true;
   try {
     const row = await fetchDb("/domain-templates", {
@@ -62,8 +68,9 @@ async function submit() {
       body: JSON.stringify({
         domain_id: domainId.value,
         name: name.value.trim(),
+        abbr: (abbr.value || "").trim().toUpperCase(),
         description: description.value.trim() || `由 ${file.value.name} 人工导入的领域方案`,
-        status: "available",
+        status: status.value,
         version: version.value.trim() || "1.0",
         creator: CURRENT_USER_EMAIL,
       }),
@@ -90,14 +97,23 @@ async function submit() {
         </label>
         <div class="domain-import-form">
           <Field label="方案名称" required><UiInput :value="name" @change="(e) => (name = e.target.value)" placeholder="例如:AIDC 标准场站方案" /></Field>
+          <Field label="缩写(英文大写)" required>
+            <UiInput :value="abbr" maxLength="10" @change="(e) => (abbr = e.target.value.toUpperCase())" placeholder="如 WTP" />
+          </Field>
           <Field label="所属领域" required>
             <UiSelect :value="domainId" @change="(e) => (domainId = Number(e.target.value))">
               <option value="0">请选择领域</option>
               <option v-for="d in doms" :key="d.id" :value="d.id">{{ friendlyDomainName(d.name) }}</option>
             </UiSelect>
           </Field>
-          <Field label="方案版本"><UiInput :value="version" @change="(e) => (version = e.target.value)" placeholder="1.0" /></Field>
-          <Field label="导入说明"><UiInput textarea :rows="4" :value="description" @change="(e) => (description = e.target.value)" placeholder="说明方案来源、适用场景或需要现场调整的内容" /></Field>
+          <Field label="版本号"><UiInput :value="version" @change="(e) => (version = e.target.value)" placeholder="1.0" /></Field>
+          <Field label="状态">
+            <UiSelect :value="status" @change="(e) => (status = e.target.value)">
+              <option value="available">可用</option>
+              <option value="editing">编辑中</option>
+            </UiSelect>
+          </Field>
+          <Field label="方案说明"><UiInput textarea :rows="4" :value="description" @change="(e) => (description = e.target.value)" placeholder="说明方案来源、适用场景或需要现场调整的内容" /></Field>
         </div>
       </div>
       <div class="domain-package-check">