打印模板管理,设计
This commit is contained in:
1 parent
53dfc9ef1d
commit
ad932a7050
15 files changed
+283
-120
No files matched your search
@@ -9,7 +9,7 @@ using WalkingTec.Mvvm.Core;
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// WCS接口
|
||||
/// 提供给WCS调用接口
|
||||
/// 调用方向 WCS --> WMS
|
||||
/// </summary>
|
||||
[Public]
|
||||
@@ -34,46 +34,6 @@ namespace HHWMS.Web
|
||||
[HttpPost]
|
||||
public IActionResult RequestIn(WcsRequest request)
|
||||
{
|
||||
//var inv = new List<Inventory>();
|
||||
//for (int i = 0; i < 10; i++)
|
||||
// inv.Add(new Inventory
|
||||
// {
|
||||
// ContainerCode = "test" + i
|
||||
// });
|
||||
//_unitwork.BatchAdd<Inventory>(inv);
|
||||
//_unitwork.DeleteById<Inventory>(1441);
|
||||
//_unitwork.BatchUpdate<Inventory>(x => x.ID > 1030, x=>new Inventory { Batch = "test"});
|
||||
|
||||
// 测试 删除数据 保存到历史表 主子表数据
|
||||
/*var receipt = _unitwork.Find<ReceiptHeader>(x => x.ID == 3)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<ReceiptDetail>(x => x.HeaderId == 3)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<ReceiptHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<ReceiptDetail[], IEnumerable<ReceiptDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);*/
|
||||
|
||||
/*var receipt = _unitwork.Find<ShipmentHeader>(x => x.ID == 3)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<ShipmentDetail>(x => x.HeaderId == 3)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<ShipmentHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<ShipmentDetail[], IEnumerable<ShipmentDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);*/
|
||||
|
||||
var receipt = _unitwork.Find<TaskHeader>(x => 1==1)
|
||||
.FirstOrDefault();
|
||||
|
||||
var details = _unitwork.Find<TaskDetail>(x => x.HeaderId == receipt.ID)
|
||||
.ToArray();
|
||||
var his = _mapper.Map<TaskHeaderHistory>(receipt);
|
||||
var his2 = _mapper.Map<TaskDetail[], IEnumerable<TaskDetailHistory>>(details);
|
||||
_unitwork.Add(his);
|
||||
_unitwork.BatchAdd(his2);
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
@@ -86,6 +46,5 @@ namespace HHWMS.Web
|
||||
{
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using System.DirectoryServices.Protocols;
|
||||
using System.Web;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -96,6 +98,9 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
//替换 "
|
||||
vm.Entity.Template = HttpUtility.HtmlDecode(vm.Entity.Template);
|
||||
|
||||
vm.DoEdit();
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
@@ -224,5 +229,12 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
[ActionDescription("Sys.Print")]
|
||||
public ActionResult Design(string id)
|
||||
{
|
||||
var vm = Wtm.CreateVM<PrintConfigVM>(id);
|
||||
return PartialView(vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,14 @@ namespace HHWMS.Web
|
||||
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||
this.MakeStandardAction("PrintConfig", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||
// 打印模板设计
|
||||
this.MakeAction("PrintConfig","Design",Localizer["Sys.Design"],Localizer["Sys.Design"],GridActionParameterTypesEnum.SingleId,"configs")
|
||||
.SetShowDialog(true)
|
||||
.SetMax(),
|
||||
// 打印预览
|
||||
this.MakeAction("PrintConfig","PrintPreview",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.SingleId,"configs")
|
||||
.SetShowDialog(false)
|
||||
.SetOnClickScript("print"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,7 +43,7 @@ namespace HHWMS.Web
|
||||
this.MakeGridHeader(x => x.Name),
|
||||
this.MakeGridHeader(x => x.Template),
|
||||
this.MakeGridHeader(x => x.TestData),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
this.MakeGridHeaderAction(width: 300)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
@model HHWMS.Web.PrintConfigVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<wt:form vm="@Model">
|
||||
<wt:textbox field="Entity.Template" />
|
||||
<wt:hidden field="Entity.ID" />
|
||||
<wt:row align="AlignEnum.Right">
|
||||
<wt:submitbutton submit-url="/configs/PrintConfig/Edit"/>
|
||||
<wt:closebutton />
|
||||
</wt:row>
|
||||
</wt:form>
|
||||
|
||||
|
||||
<link href="/hiprint/content/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- 单独使用无需引入 -->
|
||||
<script src="/hiprint/custom/custom-etype-provider.js"></script>
|
||||
|
||||
<wt:row>
|
||||
<!-- 列表 -->
|
||||
<div class="layui-col-xs1 layui-col-md1" style="padding-right:0px;">
|
||||
<div class="rect-printElement-types hiprintEpContainer">
|
||||
<ul class="hiprint-printElement-type">
|
||||
<li>
|
||||
<span class="title"><code>拖拽列表</code></span>
|
||||
<ul>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.text" style="">
|
||||
<span class="glyphicon glyphicon-text-width"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">文本</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.image" style="">
|
||||
<span class="glyphicon glyphicon-picture"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">图片</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.longText">
|
||||
<span class="glyphicon glyphicon-subscript"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">长文</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.tableCustom" style="">
|
||||
<span class="glyphicon glyphicon-th" aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">表格</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.html">
|
||||
<span class="glyphicon glyphicon-header"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">html</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="title">辅助</span>
|
||||
<ul>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.hline" style="">
|
||||
<span class="glyphicon glyphicon-resize-horizontal"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">横线</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.vline" style="">
|
||||
<span class="glyphicon glyphicon-resize-vertical"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">竖线</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.rect">
|
||||
<span class="glyphicon glyphicon-unchecked"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">矩形</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="ep-draggable-item" tid="testModule.oval">
|
||||
<span class="glyphicon glyphicon-record"
|
||||
aria-hidden="true"></span>
|
||||
<span class="glyphicon-class">椭圆</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 内容 -->
|
||||
<div class="layui-col-xs8 layui-col-md8">
|
||||
<div class="hiprint-toolbar" style="margin-top:15px;">
|
||||
<ul>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('A3')">A3</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('A4')">A4</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('A5')">A5</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('B3')">B3</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('B4')">B4</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="setPaper('B5')">B5</a></li>
|
||||
|
||||
<li><a class="hiprint-toolbar-item"><input type="text" id="customWidth"
|
||||
style="width: 50px;height: 19px;border: 0px;"
|
||||
placeholder="宽/mm" /></a></li>
|
||||
<li><a class="hiprint-toolbar-item"><input type="text" id="customHeight"
|
||||
style="width: 50px;height: 19px;border: 0px;"
|
||||
placeholder="高/mm" /></a></li>
|
||||
|
||||
<li><a class="hiprint-toolbar-item"
|
||||
onclick="setPaper($('#customWidth').val(),$('#customHeight').val())">自定义</a>
|
||||
</li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="rotatePaper()">旋转</a></li>
|
||||
<li><a class="hiprint-toolbar-item" onclick="clearTemplate()">清空</a></li>
|
||||
|
||||
<li>
|
||||
<a id="A4_directPrint" class="btn hiprint-toolbar-item " style="color: #fff;
|
||||
background-color: #d9534f;
|
||||
border-color: #d43f3a;">
|
||||
打印
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
<div id="hiprint-printTemplate" class="hiprint-printTemplate" style="margin-top:20px;">
|
||||
|
||||
</div>
|
||||
<div style="padding-top:15px;">
|
||||
<button type="button" class="btn btn-primary"
|
||||
id="A4_getJson_toTextarea">生成json到textarea</button>
|
||||
</div>
|
||||
<textarea class="layui-textarea" id="A4_textarea_json"></textarea>
|
||||
</div>
|
||||
|
||||
<!-- 属性 -->
|
||||
<div class="layui-col-xs3 layui-col-md3">
|
||||
<div id="PrintElementOptionSetting" style="margin-top:10px;"></div>
|
||||
</div>
|
||||
</wt:row>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var l = $('[name="Entity.Template"]').val();
|
||||
|
||||
var hiprintTemplate;
|
||||
$(document).ready(function () {
|
||||
|
||||
// 默认值
|
||||
var customPrintJson = JSON.parse(l);
|
||||
|
||||
var printData = {}
|
||||
|
||||
//初始化打印插件
|
||||
hiprint.init({
|
||||
providers: [new customElementTypeProvider()]
|
||||
});
|
||||
|
||||
//设置左侧拖拽事件
|
||||
hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
|
||||
|
||||
hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: customPrintJson,
|
||||
settingContainer: '#PrintElementOptionSetting',
|
||||
paginationContainer: '.hiprint-printPagination'
|
||||
});
|
||||
//打印设计
|
||||
hiprintTemplate.design('#hiprint-printTemplate');
|
||||
|
||||
$('#A4_directPrint').click(function () {
|
||||
hiprintTemplate.print(printData);
|
||||
});
|
||||
|
||||
$('#A4_getJson_toTextarea').click(function () {
|
||||
$('#A4_textarea_json').html(JSON.stringify(hiprintTemplate.getJson()));
|
||||
$('[name="Entity.Template"]').val(JSON.stringify(hiprintTemplate.getJson()));
|
||||
})
|
||||
});
|
||||
|
||||
//调整纸张
|
||||
var setPaper = function (paperTypeOrWidth, height) {
|
||||
hiprintTemplate.setPaper(paperTypeOrWidth, height);
|
||||
}
|
||||
|
||||
//旋转
|
||||
var rotatePaper = function () {
|
||||
hiprintTemplate.rotatePaper();
|
||||
}
|
||||
var clearTemplate = function () {
|
||||
hiprintTemplate.clear();
|
||||
}
|
||||
</script>
|
||||
@@ -6,4 +6,24 @@
|
||||
<wt:textbox field="Searcher.Name" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/configs/PrintConfig/Search"/>
|
||||
<wt:grid vm="@Model" url="/configs/PrintConfig/Search" height="400"/>
|
||||
|
||||
<script>
|
||||
|
||||
// 打印模板,打印预览
|
||||
|
||||
function print(id, data) {
|
||||
|
||||
var printData = eval('(' + data[0].TestData.replace(/"/g, '"') + ')')
|
||||
|
||||
hiprint.init();
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||
template: JSON.parse(data[0].Template.replace(/"/g, '"'))
|
||||
|
||||
});
|
||||
|
||||
hiprintTemplate.print([printData]);
|
||||
printData = {};
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,10 @@
|
||||
@model HHWMS.Web.PrintConfigVM
|
||||
@inject IStringLocalizer<Program> Localizer;
|
||||
|
||||
<script>
|
||||
import {hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
|
||||
|
||||
hiprint.init({
|
||||
providers: [new defaultElementTypeProvider()]
|
||||
})
|
||||
</script>
|
||||
Reference in new issue
Block a user