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);
props.notify("请填写方案名称和所属领域");
return;
}
+ if (!/^[A-Z]+$/.test((abbr.value || "").trim())) {
+ props.notify("缩写必须为英文大写字母");
+ return;
+ }
busy.value = true;
try {
const row = await fetchDb("/domain-templates", {
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,
}),
</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">