浏览代码

feat(s0): 品类采购前置期物料属性改字典下拉+可维护配置面板

新增字典类型 s0_category_material_kind(线材/钣金件/半导体/芯片,IncreSeed 幂等),
CategoryLeadTimeList 物料属性 el-input 改 el-select(allow-create 兼容历史手填),
列表加配置字典入口复用 DictDataMaintainPanel 支持后台增删选项。

bump version Web 2.4.267 / server 1.0.288
YY968XX 1 周之前
父节点
当前提交
19339cd9e3

+ 1 - 1
Web/package.json

@@ -1,7 +1,7 @@
 {
   "name": "admin.net",
   "type": "module",
-  "version": "2.4.266",
+  "version": "2.4.267",
   "packageManager": "pnpm@10.32.1",
   "lastBuildTime": "2026.03.15",
   "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",

+ 48 - 2
Web/src/views/aidop/s0/supply/CategoryLeadTimeList.vue

@@ -14,6 +14,7 @@
 				<el-button type="primary" @click="loadList">查询</el-button>
 				<el-button @click="resetQuery">重置</el-button>
 				<el-button type="success" @click="openCreate">新增</el-button>
+				<el-button @click="openDictConfig">配置字典</el-button>
 			</el-form-item>
 		</el-form>
 
@@ -87,7 +88,17 @@
 					</el-col>
 					<el-col :span="12">
 						<el-form-item label="物料属性" prop="ownerApplication">
-							<el-input v-model="form.ownerApplication" />
+							<el-select
+								v-model="form.ownerApplication"
+								filterable
+								clearable
+								allow-create
+								default-first-option
+								placeholder="字典选择或手工输入"
+								style="width: 100%"
+							>
+								<el-option v-for="opt in materialKindOptions" :key="opt.value" :label="opt.label" :value="opt.label" />
+							</el-select>
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
@@ -117,6 +128,17 @@
 				<el-button type="primary" :loading="saving" @click="submitForm">保存</el-button>
 			</template>
 		</el-dialog>
+
+		<el-dialog v-model="dictDialogVisible" title="配置物料属性字典" width="620px" destroy-on-close>
+			<DictDataMaintainPanel
+				:dict-code="MATERIAL_KIND_DICT_CODE"
+				title="物料属性选项(线材 / 钣金件 / 半导体 / 芯片,可自行增删)"
+				@changed="onDictChanged"
+			/>
+			<template #footer>
+				<el-button type="primary" @click="dictDialogVisible = false">关闭</el-button>
+			</template>
+		</el-dialog>
 	</AidopDemoShell>
 </template>
 
@@ -125,13 +147,19 @@ import { computed, onMounted, reactive, ref, watch } from 'vue';
 import { useRoute } from 'vue-router';
 import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus';
 import AidopDemoShell from '../../components/AidopDemoShell.vue';
+import DictDataMaintainPanel from '../sales/components/DictDataMaintainPanel.vue';
 import {
+	loadDictOptions,
 	loadOrgList,
 	s0CategoryLeadTimesApi,
+	type OptionItem,
 	type OrgOption,
 	type S0CategoryLeadTimeRow,
 	type S0CategoryLeadTimeUpsert,
 } from '../api/s0SupplyApi';
+
+// 物料属性字典编码(品类采购前置期专用,可后台维护,见 S0DictTypeSeedData)
+const MATERIAL_KIND_DICT_CODE = 's0_category_material_kind';
 import { applyDefaultOrgScopeForCreate, normalizeOrgScopeForSubmit, preserveOrgScopeForEdit, shouldClearFactoryOnCompanyChange } from '../composables/useS0MfgOrgScope';
 
 const route = useRoute();
@@ -158,6 +186,24 @@ const formRef = ref<FormInstance>();
 const companyOptions = ref<OrgOption[]>([]);
 const factoryOptions = ref<OrgOption[]>([]);
 
+// 物料属性下拉选项(来自可后台维护的字典 s0_category_material_kind)
+const materialKindOptions = ref<OptionItem[]>([]);
+// 配置字典弹窗
+const dictDialogVisible = ref(false);
+
+async function loadMaterialKindOptions() {
+	materialKindOptions.value = await loadDictOptions(MATERIAL_KIND_DICT_CODE);
+}
+
+function openDictConfig() {
+	dictDialogVisible.value = true;
+}
+
+// 字典项在配置面板里增改停用后,重载下拉,保证选项即时同步
+function onDictChanged() {
+	void loadMaterialKindOptions();
+}
+
 const form = reactive<S0CategoryLeadTimeUpsert>({
 	companyRefId: undefined,
 	factoryRefId: undefined,
@@ -340,7 +386,7 @@ function onDelete(row: S0CategoryLeadTimeRow) {
 }
 
 onMounted(async () => {
-	await loadOptions();
+	await Promise.all([loadOptions(), loadMaterialKindOptions()]);
 	await loadList();
 });
 </script>

+ 3 - 3
server/Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj

@@ -11,9 +11,9 @@
     <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
     <Copyright>Admin.NET</Copyright>
     <Description>Admin.NET ͨ��Ȩ�޿���ƽ̨</Description>
-    <AssemblyVersion>1.0.287</AssemblyVersion>
-    <FileVersion>1.0.287</FileVersion>
-    <Version>1.0.287</Version>
+    <AssemblyVersion>1.0.288</AssemblyVersion>
+    <FileVersion>1.0.288</FileVersion>
+    <Version>1.0.288</Version>
   </PropertyGroup>
 
   <ItemGroup>

+ 8 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/SeedData/S0DictDataSeedData.cs

@@ -30,6 +30,7 @@ public class S0DictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
         var lineTypeId             = types[16].Id;
         var lineCategoryId         = types[17].Id;
         var lineLocationId         = types[18].Id;
+        var categoryMaterialKindId = types[19].Id;
 
         long seq = 1329900100001L;
 
@@ -152,6 +153,13 @@ public class S0DictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
             D(seq++, supplyCategoryId, "标准", "标准", 100, ct),
             D(seq++, supplyCategoryId, "VMI",  "VMI",  101, ct),
             D(seq++, supplyCategoryId, "委外", "委外", 102, ct),
+
+            // ── s0_category_material_kind ──(品类采购前置期-物料属性,value=label 中文直存,可后台维护)
+            // 追加在数组末尾:seq 自然续号,不移位任何既有字典 Id,保持 IncreSeed 幂等。
+            D(seq++, categoryMaterialKindId, "线材",   "线材",   100, ct),
+            D(seq++, categoryMaterialKindId, "钣金件", "钣金件", 101, ct),
+            D(seq++, categoryMaterialKindId, "半导体", "半导体", 102, ct),
+            D(seq++, categoryMaterialKindId, "芯片",   "芯片",   103, ct),
         };
     }
 

+ 1 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/SeedData/S0DictTypeSeedData.cs

@@ -30,6 +30,7 @@ public class S0DictTypeSeedData : ISqlSugarEntitySeedData<SysDictType>
             new SysDictType { Id = 1329900001017L, Name = "S0-产线类型",     Code = "s0_line_type",          SysFlag = YesNoEnum.N, OrderNo = 516, Remark = "S0 生产线类型(自动/半自动/手工)",              Status = StatusEnum.Enable, CreateTime = ct },
             new SysDictType { Id = 1329900001018L, Name = "S0-产线类别",     Code = "s0_line_category",      SysFlag = YesNoEnum.N, OrderNo = 517, Remark = "S0 生产线类别(装配/加工/检验)",                Status = StatusEnum.Enable, CreateTime = ct },
             new SysDictType { Id = 1329900001019L, Name = "S0-主库位",       Code = "s0_line_location",      SysFlag = YesNoEnum.N, OrderNo = 518, Remark = "S0 生产线主库位编码",                            Status = StatusEnum.Enable, CreateTime = ct },
+            new SysDictType { Id = 1329900001020L, Name = "S0-品类物料属性", Code = "s0_category_material_kind", SysFlag = YesNoEnum.N, OrderNo = 519, Remark = "S0 品类采购前置期-物料属性(线材/钣金件/半导体/芯片,可后台维护)", Status = StatusEnum.Enable, CreateTime = ct },
         };
     }
 }