|
|
@@ -61,7 +61,7 @@
|
|
|
<el-form-item label="类型描述"><el-input v-model="form.descr1" /></el-form-item>
|
|
|
<el-form-item label="单号分类"><el-input v-model="form.nbrClass" /></el-form-item>
|
|
|
<el-form-item label="部门"><el-input v-model="form.dept" /></el-form-item>
|
|
|
- <el-form-item label="域编码" prop="domainCode"><el-input v-model="form.domainCode" /></el-form-item>
|
|
|
+ <el-form-item v-if="false" label="域编码" prop="domainCode"><el-input v-model="form.domainCode" /></el-form-item>
|
|
|
<el-form-item label="启用"><el-switch v-model="form.isActive" /></el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
@@ -79,6 +79,7 @@ import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'elem
|
|
|
import AidopDemoShell from '../../components/AidopDemoShell.vue';
|
|
|
import { s0NbrTypesApi, type S0NbrTypeRow, type S0NbrTypeUpsert } from '../api/s0WarehouseApi';
|
|
|
import { loadOrgList, type OrgOption } from '../api/s0SalesApi';
|
|
|
+import { getDefaultS0OrgScope } from '../composables/useS0MfgOrgScope';
|
|
|
|
|
|
const route = useRoute();
|
|
|
const pageTitle = computed(() => (route.meta?.title as string) || '单号类型');
|
|
|
@@ -112,7 +113,6 @@ const formFactoryOptions = computed(() => {
|
|
|
|
|
|
const rules: FormRules = {
|
|
|
nbrType: [{ required: true, message: '请填写单号类型编码', trigger: 'blur' }],
|
|
|
- domainCode: [{ required: true, message: '请填写域编码', trigger: 'blur' }],
|
|
|
};
|
|
|
|
|
|
watch(
|
|
|
@@ -133,7 +133,13 @@ async function loadList() {
|
|
|
}
|
|
|
function resetQuery() { Object.assign(query, { keyword: '', domainCode: '', dept: '', isActive: undefined, page: 1 }); void loadList(); }
|
|
|
function resetForm() { editingId.value = null; Object.assign(form, { companyRefId: undefined, factoryRefId: undefined, domainCode: '', nbrType: '', descr1: '', nbrClass: '', dept: '', isActive: true }); formRef.value?.clearValidate(); }
|
|
|
-function openCreate() { resetForm(); dialogTitle.value = '新增单号类型'; dialogVisible.value = true; }
|
|
|
+function openCreate() {
|
|
|
+ resetForm();
|
|
|
+ // 域编码降级为后台归属字段(前台隐藏):新增时从默认工厂 code 灌入,取不到默认组织时保留空由 submit 兜底。
|
|
|
+ form.domainCode = getDefaultS0OrgScope(companyOptions.value, factoryOptions.value).domainCode ?? form.domainCode ?? '';
|
|
|
+ dialogTitle.value = '新增单号类型';
|
|
|
+ dialogVisible.value = true;
|
|
|
+}
|
|
|
function openEdit(row: S0NbrTypeRow) {
|
|
|
resetForm(); editingId.value = row.id; dialogTitle.value = `编辑单号类型 ${row.nbrType}`;
|
|
|
Object.assign(form, { companyRefId: row.companyRefId, factoryRefId: row.factoryRefId, domainCode: row.domainCode ?? '', nbrType: row.nbrType, descr1: row.descr1 ?? '', nbrClass: row.nbrClass ?? '', dept: row.dept ?? '', isActive: row.isActive });
|
|
|
@@ -142,6 +148,8 @@ function openEdit(row: S0NbrTypeRow) {
|
|
|
async function submitForm() {
|
|
|
await formRef.value?.validate();
|
|
|
applyDefaultOrg();
|
|
|
+ // 域编码兜底:隐藏字段后仍确保域非空(单号类型域为后端必填业务键),缺则取默认工厂 code。
|
|
|
+ if (!form.domainCode) form.domainCode = getDefaultS0OrgScope(companyOptions.value, factoryOptions.value).domainCode ?? form.domainCode;
|
|
|
saving.value = true;
|
|
|
try {
|
|
|
if (editingId.value) { await s0NbrTypesApi.update(editingId.value, { ...form }); ElMessage.success('已保存'); }
|