From 6ec763ab7467fc01783336e13613a516423578e7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 02 七月 2020 17:14:32 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/trayCode/trayCode.js | 78 +++++++++++---------------
src/main/webapp/views/trayCode/trayCode.html | 46 ++++++++++++++-
src/main/java/com/zy/asrs/controller/TrayCodeController.java | 17 +++--
src/main/webapp/static/css/optimize.css | 0
4 files changed, 85 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/TrayCodeController.java b/src/main/java/com/zy/asrs/controller/TrayCodeController.java
index 41da46b..671ba6b 100644
--- a/src/main/java/com/zy/asrs/controller/TrayCodeController.java
+++ b/src/main/java/com/zy/asrs/controller/TrayCodeController.java
@@ -12,7 +12,6 @@
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.TrayCode;
-import com.zy.asrs.entity.param.TrayCodeParam;
import com.zy.asrs.service.TrayCodeService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,7 +32,7 @@
}
@RequestMapping(value = "/trayCode/list/auth")
- @ManagerAuth
+// @ManagerAuth
public R list(@RequestParam(defaultValue = "1")Integer curr,
@RequestParam(defaultValue = "10")Integer limit,
@RequestParam(required = false)String orderByField,
@@ -126,20 +125,22 @@
}
@PostMapping(value = "/trayCode/print/preview")
- @ManagerAuth
- public R printPreview(@RequestParam TrayCodeParam param) {
- if (param.getCount() <= 0) {
+// @ManagerAuth
+ public R printPreview(@RequestParam String startNo,
+ @RequestParam Integer count,
+ @RequestParam Integer type) {
+ if (count <= 0) {
return R.error("鏁伴噺蹇呴』澶т簬闆�");
}
List<Map<String, Object>> res = new ArrayList<>();
- for (int i = 0; i<param.getCount(); i++) {
- res.add(Cools.add("item", String.valueOf(Integer.parseInt(param.getStartNo())+i)));
+ for (int i = 0; i<count; i++) {
+ res.add(Cools.add("item", String.valueOf(Integer.parseInt(startNo)+i)));
}
return R.ok().add(res);
}
@RequestMapping(value = "/trayCode/print/auth")
- @ManagerAuth(memo = "鎵樼洏鐮佹墦鍗�")
+// @ManagerAuth(memo = "鎵樼洏鐮佹墦鍗�")
public R print(@RequestParam String startNo,
@RequestParam Integer count,
@RequestParam Integer type){
diff --git a/src/main/webapp/static/css/optimize.css b/src/main/webapp/static/css/optimize.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/main/webapp/static/css/optimize.css
diff --git a/src/main/webapp/static/js/trayCode/trayCode.js b/src/main/webapp/static/js/trayCode/trayCode.js
index 5d5d836..72d445a 100644
--- a/src/main/webapp/static/js/trayCode/trayCode.js
+++ b/src/main/webapp/static/js/trayCode/trayCode.js
@@ -106,15 +106,13 @@
layer.open({
type: 1,
title: '鐢熸垚鎵樼洏鐮�',
- offset: '100px',
- area: ['360px'],
- shade: 0.1,
+ // offset: '100px',
+ // area: ['360px'],
+ // shade: 0.1,
content: $('#print-windows'),
success: function(layero, index){
layer.iframeAuto(index)
},
- end: function () {
- }
});
break;
case 'exportData':
@@ -296,50 +294,40 @@
});
form.on('submit(print)', function (data) {
- // $.ajax({
- // url: baseUrl+"/trayCode/print/preview",
- // headers: {'token': localStorage.getItem('token')},
- // data: {
- // startNo: $('#startNo'),
- // count: $('#count'),
- // type: $("input[name='type']:checked").val()
- // },
- // method: 'POST',
- // async: false,
- // success: function (res) {
- // if (res.code === 200){
- // for (let i=0;i<res.data.length;i++){
- // res.data[i]["barcodeUrl"]=baseUrl+"/macCode/code/auth?type=1¶m="+res.data[i].item;
- // }
- // var tpl = $('#trayCodeTemplate').html();
- // var template = Handlebars.compile(tpl);
- // var html = template(res);
- // let box = $("#printBox");
- // // box.html(html);
- // // box.show();
- // // box.print();
- // // box.hide();
- // // parent.layer.close(parent.layer.getFrameIndex(window.name));
- // } else if (res.code === 403){
- // top.location.href = baseUrl+"/";
- // }else {
- // layer.msg(res.msg)
- // }
- // }
- // })
+ $.ajax({
+ url: baseUrl+"/trayCode/print/preview",
+ headers: {'token': localStorage.getItem('token')},
+ data: data.field,
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ for (let i=0;i<res.data.length;i++){
+ res.data[i]["barcodeUrl"]=baseUrl+"/macCode/code/auth?type=1¶m="+res.data[i].item;
+ }
+ var tpl = $('#trayCodeTemplate').html();
+ var template = Handlebars.compile(tpl);
+ var html = template(res);
+ let box = $("#printBox");
+ box.html(html);
+ box.show();
+ box.print();
+ box.hide();
+ layer.closeAll();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
});
-
+ $('#cancel').click(function () {
+ layer.closeAll();
+ })
});
-
-$('#print').click(function () {
-
-});
-
-$('#cancel').click(function () {
- // layer.close(layer.getFrameIndex(window.name));
-})
// 鍏抽棴鍔ㄤ綔
$(document).on('click','#data-detail-close', function () {
diff --git a/src/main/webapp/views/trayCode/trayCode.html b/src/main/webapp/views/trayCode/trayCode.html
index a60f312..9085b5d 100644
--- a/src/main/webapp/views/trayCode/trayCode.html
+++ b/src/main/webapp/views/trayCode/trayCode.html
@@ -10,6 +10,46 @@
<link rel="stylesheet" href="../../static/css/cool.css" media="all">
<link rel="stylesheet" href="../../static/css/common.css" media="all">
<link rel="stylesheet" href="../../static/css/print.css" media="all">
+ <link rel="stylesheet" href="../../static/css/optimize.css" media="all">
+ <style>
+ #print-windows .layui-form {
+ padding: 25px 30px 0 0;
+ }
+ #print-windows .layui-form-label {
+ padding: 8px 15px;
+ box-sizing: content-box;
+ -webkit-box-sizing: content-box;
+ }
+ #print-windows .layui-form-required:before {
+ content: "*";
+ display: inline-block;
+ font-family: SimSun,serif;
+ margin-right: 4px;
+ font-size: 14px;
+ line-height: 1;
+ color: #ed4014;
+ }
+ #print-windows .layui-input {
+ height: 36px;
+ border-radius: 4px;
+ }
+ #print-windows .cool-button-contain {
+ text-align: right;
+ margin: 20px 0;
+ }
+ #print-windows .layui-form-radio>i:hover, .layui-form-radioed>i {
+ color: #007bff;
+ }
+ #print-windows .layui-btn {
+ height: 36px;
+ line-height: 36px;
+ border-radius: 4px;
+ box-shadow: 0 1px 0 rgba(0,0,0,.03);
+ }
+ #print-windows .layui-btn-primary:hover {
+ border-color: #777777;
+ }
+ </style>
</head>
<body>
@@ -63,7 +103,7 @@
<iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe>
<div id="print-windows" style="display: none">
- <form class="layui-form" >
+ <div class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label layui-form-required">璧峰搴忓垪:</label>
<div class="layui-input-block">
@@ -84,10 +124,10 @@
</div>
</div>
<div class="layui-form-item cool-button-contain">
- <button class="layui-btn layui-btn-normal" id="print" >鎵撳嵃</button>
+ <button class="layui-btn layui-btn-normal" id="print" lay-filter="print" lay-submit="">鎵撳嵃</button>
<button class="layui-btn layui-btn-primary" id="cancel">鍙栨秷</button>
</div>
- </form>
+ </div>
</div>
</body>
--
Gitblit v1.9.1