diff --git a/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs b/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
index c2a9340f737f1b273dee43eaadbfc6960783cdbe..13c99987f58d3b1f560b7d981ed12853a2a4a002 100644
--- a/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
+++ b/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
@@ -16,6 +16,20 @@ namespace Admin.NET.Core;
[SysTable]
public class SysCodeGen : EntityBase
{
+ ///
+ /// 支持打印类型
+ ///
+ [SugarColumn(ColumnDescription = "支持打印类型", Length = 32)]
+ [MaxLength(32)]
+ public string? PrintType { get; set; }
+
+ ///
+ /// 打印模版名称
+ ///
+ [SugarColumn(ColumnDescription = "打印模版名称", Length = 32)]
+ [MaxLength(32)]
+ public string? PrintName { get; set; }
+
///
/// 作者姓名
///
diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
index 653aa6142483d6a6c96b012350ecb2220ca4d14e..0aa72bb0b0ac4209cbf11a7f92b1e72e11f37336 100644
--- a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
+++ b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
@@ -74,6 +74,9 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData
new SysDictData{ Id=1300000000603, DictTypeId=1300000000106, Value="部门", Code="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
new SysDictData{ Id=1300000000604, DictTypeId=1300000000106, Value="区域", Code="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
new SysDictData{ Id=1300000000605, DictTypeId=1300000000106, Value="组", Code="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+
+ new SysDictData{ Id=1300000000701, DictTypeId=1300000000107, Value="不需要", Code="off", OrderNo=100, Remark="不需要打印支持", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
+ new SysDictData{ Id=1300000000702, DictTypeId=1300000000107, Value="绑定打印模版", Code="custom", OrderNo=101, Remark="绑定打印模版", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
};
}
}
\ No newline at end of file
diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
index 695b234fe8b381170b861ba397f40b76fd237f91..6c27ac938b5ab29342402cfdbad36c2214b25b56 100644
--- a/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
+++ b/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
@@ -28,6 +28,7 @@ public class SysDictTypeSeedData : ISqlSugarEntitySeedData
new SysDictType{ Id=1300000000104, Name="代码生成方式", Code="code_gen_create_type", OrderNo=103, Remark="代码生成方式", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysDictType{ Id=1300000000105, Name="代码生成基类", Code="code_gen_base_class", OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysDictType{ Id=1300000000106, Name="机构类型", Code="org_type", OrderNo=105, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+ new SysDictType{ Id=1300000000107, Name="代码生成支持打印类型", Code="code_gen_print_type", OrderNo=106, Remark="代码生成支持打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
};
}
}
\ No newline at end of file
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
index ebf22e3cd29bb5505a3145b966d5d1f94f16cb81..d0dba185d6477ea89f4070bc4d13c7eb6b8774e8 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
@@ -27,6 +27,10 @@ public class CustomViewEngine : ViewEngineModel
///
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; }
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
index e05211da0ce9c514d0b4ce29dffbdd70e0649d46..94d55b15c91b3dc2a5b16bfa057c9f6247db0f6b 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
@@ -14,6 +14,16 @@ namespace Admin.NET.Core.Service;
///
public class CodeGenInput : BasePageInput
{
+ ///
+ /// 支持打印类型
+ ///
+ public virtual string PrintType { get; set; }
+
+ ///
+ /// 打印模版名称
+ ///
+ public virtual string PrintName { get; set; }
+
///
/// 作者姓名
///
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
index 87b5c08f59f3c45667888f66b35a524c870f8fc5..dd61f0e83707c54eefc01b9b6c2ab13f3c9d86bb 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
@@ -19,6 +19,16 @@ public class CodeGenOutput
///
public long Id { get; set; }
+ ///
+ /// 支持打印类型
+ ///
+ public string PrintType { get; set; }
+
+ ///
+ /// 打印模版名称
+ ///
+ public string PrintName { get; set; }
+
///
/// 作者姓名
///
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
index febd77ddeb1b458afbee51e74c2abac196b212d5..36b094c22605aa77d4a17193f3f08345301fb179 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
+++ b/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,
diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
index 7902dac5d03ca0b2df8b72a2a9fb7276df6c052a..7bd850c09d4ac7572baa97ed2dde79e1b5ffe4bc 100644
--- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm
@@ -160,8 +160,14 @@
}
}
}
-
-
+ @if(@Model.PrintType == "custom"){
+ @:
+ @:
+ @: 打印
+ }else{
+ @:
+ @:
+ }
编辑
删除
@@ -178,6 +184,10 @@
@@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
+
([]);
@@ -233,6 +252,8 @@
pageSize: 10,
total: 0,
});
+
+ const print@(@Model.ClassName)Title = ref("");
const edit@(@Model.ClassName)Title = ref("");
// 改变高级查询的控件显示状态
@@ -261,6 +282,18 @@
editDialogRef.value.openDialog({});
};
+ // 打开打印页面
+ const openPrint@(@Model.ClassName) = async (row: any) => {
+ print@(@Model.ClassName)Title.value = '打印@(@Model.BusName)';
+ @if(@Model.PrintType == "custom"){
+ @:var res = await getAPI(SysPrintApi).apiSysPrintPrintNameGet('@Model.PrintName');
+ @:var printTemplate = res.data.result as SysPrint;
+ @:var template = JSON.parse(printTemplate.template);
+ @:row['printDate'] = formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS')
+ @:printDialogRef.value.showDialog(new hiprint.PrintTemplate({template: template}), row, template.panels[0].width);
+ }
+ }
+
// 打开编辑页面
const openEdit@(@Model.ClassName) = (row: any) => {
edit@(@Model.ClassName)Title.value = '编辑@(@Model.BusName)';
@@ -302,7 +335,7 @@
@:@LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList.value = list.data.result ?? [];
@:};
@:get@(@column.FkEntityName)@(@column.PropertyName)DropdownList();
-@:
+ @:
}
}
handleQuery();
diff --git a/Web/src/api-services/models/update-code-gen-input.ts b/Web/src/api-services/models/update-code-gen-input.ts
index 9c0151d7414a3647dc35db29b7a3e75f2822602f..8175a5cc8f483b65a26597da5dde17474c595d08 100644
--- a/Web/src/api-services/models/update-code-gen-input.ts
+++ b/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;
+
/**
* 作者姓名
*
diff --git a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
index 2b014502e656e1cdcaf47b9f9c6f0beb4e6a3903..28a0f54e1c27480f39a8657d0f1f0d3392a05d4a 100644
--- a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
+++ b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
@@ -92,6 +92,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -108,8 +122,8 @@
import { onMounted, reactive, ref } from 'vue';
import { getAPI } from '/@/utils/axios-utils';
-import { SysCodeGenApi, SysDictDataApi, SysMenuApi } from '/@/api-services/api';
-import { UpdateCodeGenInput, AddCodeGenInput, SysMenu } from '/@/api-services/models';
+import { SysCodeGenApi, SysDictDataApi, SysMenuApi, SysPrintApi } from '/@/api-services/api';
+import { UpdateCodeGenInput, AddCodeGenInput, SysMenu, SysPrint } from '/@/api-services/models';
const props = defineProps({
title: String,
@@ -124,6 +138,8 @@ const state = reactive({
dbData: [] as any,
menuData: [] as Array,
codeGenTypeList: [] as any,
+ printTypeList: [] as any,
+ printList: [] as Array,
});
onMounted(async () => {
@@ -135,6 +151,12 @@ onMounted(async () => {
let resDicData = await getAPI(SysDictDataApi).apiSysDictDataDataListCodeGet('code_gen_create_type');
state.codeGenTypeList = resDicData.data.result;
+
+ let printTypeResDicData = await getAPI(SysDictDataApi).apiSysDictDataDataListCodeGet('code_gen_print_type');
+ state.printTypeList = printTypeResDicData.data.result;
+
+ let resPrintIdData = await getAPI(SysPrintApi).apiSysPrintPagePost();
+ state.printList = resPrintIdData.data.result?.items ?? [];
});
// db改变