ソースを参照

优化绑定打印模版

orzMaster 2 年 前
コミット
c4103546db

+ 4 - 4
Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs

@@ -24,11 +24,11 @@ public class SysCodeGen : EntityBase
     public string? PrintType { get; set; }
 
     /// <summary>
-    /// 打印模版Id
+    /// 打印模版名称
     /// </summary>
-    [SugarColumn(ColumnDescription = "打印模版Id", Length = 20)]
-    [MaxLength(20)]
-    public long? PrintId { get; set; }
+    [SugarColumn(ColumnDescription = "打印模版名称", Length = 32)]
+    [MaxLength(32)]
+    public string? PrintName { get; set; }
 
     /// <summary>
     /// 作者姓名

+ 4 - 0
Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs

@@ -27,6 +27,10 @@ public class CustomViewEngine : ViewEngineModel
     /// </summary>
     public string ConfigId { get; set; } = SqlSugarConst.MainConfigId;
 
+    public string PrintType { get; set; }
+
+    public string PrintName { get; set; }
+
     public string AuthorName { get; set; }
 
     public string BusName { get; set; }

+ 3 - 3
Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs

@@ -15,14 +15,14 @@ namespace Admin.NET.Core.Service;
 public class CodeGenInput : BasePageInput
 {
     /// <summary>
-    /// 是否支持打印
+    /// 支持打印类型
     /// </summary>
     public virtual string PrintType { get; set; }
 
     /// <summary>
-    /// 打印模版编号
+    /// 打印模版名称
     /// </summary>
-    public virtual long PrintId { get; set; }
+    public virtual string PrintName { get; set; }
 
     /// <summary>
     /// 作者姓名

+ 3 - 3
Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs

@@ -20,14 +20,14 @@ public class CodeGenOutput
     public long Id { get; set; }
 
     /// <summary>
-    /// 是否支持打印
+    /// 支持打印类型
     /// </summary>
     public string PrintType { get; set; }
 
     /// <summary>
-    /// 打印模版编号
+    /// 打印模版名称
     /// </summary>
-    public long PrintId { get; set; }
+    public string PrintName { get; set; }
 
     /// <summary>
     /// 作者姓名

+ 2 - 0
Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

@@ -329,6 +329,8 @@ public class SysCodeGenService : IDynamicApiController, ITransient
         var data = new CustomViewEngine(_db)
         {
             ConfigId = input.ConfigId,
+            PrintType = input.PrintType,
+            PrintName = input.PrintName,
             AuthorName = input.AuthorName,
             BusName = input.BusName,
             NameSpace = input.NameSpace,

+ 14 - 0
Web/src/api-services/models/update-code-gen-input.ts

@@ -64,6 +64,20 @@ export interface UpdateCodeGenInput {
      */
     descStr?: string | null;
 
+    /**
+     * 打印模版名称
+     * @type {number}
+     * @memberof UpdateCodeGenInput
+     */
+    printName?: string | null;
+
+    /**
+     * 支持打印类型
+     * @type {string}
+     * @memberof UpdateCodeGenInput
+     */
+    printType?: string | null;
+    
     /**
      * 作者姓名
      *

+ 6 - 6
Web/src/views/system/codeGen/component/editCodeGenDialog.vue

@@ -100,9 +100,9 @@
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="state.ruleForm.printType == 'custom'">
-						<el-form-item label="打印模版" prop="printId">
-							<el-select v-model="state.ruleForm.printId" filterable class="w100">
-								<el-option v-for="item in state.printIdList" :key="item.id" :label="item.name" :value="item.id" />
+						<el-form-item label="打印模版" prop="printName">
+							<el-select v-model="state.ruleForm.printName" filterable class="w100">
+								<el-option v-for="item in state.printList" :key="item.id" :label="item.name" :value="item.name" />
 							</el-select>
 						</el-form-item>
 					</el-col>
@@ -123,7 +123,7 @@ import { onMounted, reactive, ref } from 'vue';
 
 import { getAPI } from '/@/utils/axios-utils';
 import { SysCodeGenApi, SysDictDataApi, SysMenuApi, SysPrintApi } from '/@/api-services/api';
-import { UpdateCodeGenInput, AddCodeGenInput, SysMenu } from '/@/api-services/models';
+import { UpdateCodeGenInput, AddCodeGenInput, SysMenu, SysPrint } from '/@/api-services/models';
 
 const props = defineProps({
 	title: String,
@@ -139,7 +139,7 @@ const state = reactive({
 	menuData: [] as Array<SysMenu>,
 	codeGenTypeList: [] as any,
 	printTypeList: [] as any,
-	printIdList: [] as any,
+	printList: [] as Array<SysPrint>,
 });
 
 onMounted(async () => {
@@ -156,7 +156,7 @@ onMounted(async () => {
 	state.printTypeList = printTypeResDicData.data.result;
 
 	let resPrintIdData = await getAPI(SysPrintApi).apiSysPrintPagePost();
-	state.printIdList = resPrintIdData.data.result?.items ?? [];
+	state.printList = resPrintIdData.data.result?.items ?? [];
 });
 
 // db改变