Browse Source

2024-07-30 pdf模版处理,模版管理功能优化改进;打印机查询接口

master
zhousq 4 months ago
parent
commit
bafc632349
  1. 2
      win-admin/src/main/java/com/win/WinApplication.java
  2. 4
      win-admin/src/main/java/com/win/web/controller/print/WinPrintServerControler.java
  3. 39
      win-admin/src/main/resources/static/ajax/libs/ueditor/ueditor.config.js
  4. 4
      win-common/src/main/java/com/win/common/utils/file/FileUploadUtils.java
  5. 8
      win-print/src/main/java/com/win/print/controller/WinPrintClientPrintersController.java
  6. 34
      win-print/src/main/java/com/win/print/controller/WinPrintModelController.java
  7. 2
      win-print/src/main/java/com/win/print/mapper/WinPrintClientPrintersMapper.java
  8. 2
      win-print/src/main/java/com/win/print/mapper/WinPrintModelMapper.java
  9. 2
      win-print/src/main/java/com/win/print/service/IWinPrintClientPrintersService.java
  10. 2
      win-print/src/main/java/com/win/print/service/IWinPrintModelService.java
  11. 2
      win-print/src/main/java/com/win/print/service/impl/WinPrintClientPrintersServiceImpl.java
  12. 2
      win-print/src/main/java/com/win/print/service/impl/WinPrintModelServiceImpl.java
  13. 52
      win-print/src/main/java/com/win/print/util/PdfModelUitl.java
  14. 1
      win-print/src/main/resources/templates/print/clientPrinters/add.html
  15. 25
      win-print/src/main/resources/templates/print/clientPrinters/clientPrinters.html
  16. 56
      win-print/src/main/resources/templates/print/modelmanager/add.html
  17. 24
      win-print/src/main/resources/templates/print/modelmanager/edit.html

2
win-admin/src/main/java/com/win/WinApplication.java

@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class WinApplication
{
public static void main(String[] args)
@ -19,5 +18,6 @@ public class WinApplication
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(WinApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 闻荫打印服务启动成功 ლ(´ڡ`ლ)゙ ");
//自动注册客户端
}
}

4
win-admin/src/main/java/com/win/web/controller/print/WinPrintServerControler.java

@ -209,9 +209,7 @@ public class WinPrintServerControler extends BaseController {
};
}
/**
* 数据库方式
* 获取指定客户端编码的打印机列表all时为所有客户端的所有打印机
* 适用于固定服务接口的访问
*
* */
@GetMapping("/printerList")
@ResponseBody

39
win-admin/src/main/resources/static/ajax/libs/ueditor/ueditor.config.js

@ -33,19 +33,30 @@
, serverUrl: URL + "ueditor/controller"
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
, toolbars: [[
'fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
'directionalityltr', 'directionalityrtl', 'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
'print', 'preview', 'searchreplace', 'drafts', 'help'
]]
// , toolbars: [[
// 'fullscreen', 'source', '|', 'undo', 'redo', '|',
// 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
// 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
// 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
// 'directionalityltr', 'directionalityrtl', 'indent', '|',
// 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
// 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
// 'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
// 'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
// 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
// 'print', 'preview', 'searchreplace', 'drafts', 'help'
// ]]
, toolbars: [[
'fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough','removeformat', 'formatmatch', 'autotypeset', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
'directionalityltr', 'directionalityrtl', 'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
'horizontal', '|',
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
'searchreplace', 'help'
]]
//当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
//,labelMap:{
// 'anchor':'', 'undo':''
@ -140,7 +151,7 @@
// }
//}()
//,allHtmlEnabled:false //提交到后台的数据是否包含整个html字符串
,allHtmlEnabled:true //提交到后台的数据是否包含整个html字符串
//insertorderedlist
//有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准

4
win-common/src/main/java/com/win/common/utils/file/FileUploadUtils.java

@ -122,7 +122,9 @@ public class FileUploadUtils
*/
public static final String extractFilename(MultipartFile file)
{
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
// return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
// FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
return StringUtils.format("{}/{}_{}.{}","",
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
}

8
win-print/src/main/java/com/win/print/controller/WinPrintClientPrintersController.java

@ -1,6 +1,8 @@
package com.win.print.controller;
import java.util.List;
import cn.hutool.core.date.DateUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -85,7 +87,9 @@ public class WinPrintClientPrintersController extends BaseController
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(WinPrintClientPrinters winPrintClientPrinters)
{
{ winPrintClientPrinters.setStatus("0");
winPrintClientPrinters.setCreatedTime(DateUtil.date());
winPrintClientPrinters.setCreatedBy(getLoginName());
return toAjax(winPrintClientPrintersService.insertWinPrintClientPrinters(winPrintClientPrinters));
}
@ -110,6 +114,8 @@ public class WinPrintClientPrintersController extends BaseController
@ResponseBody
public AjaxResult editSave(WinPrintClientPrinters winPrintClientPrinters)
{
winPrintClientPrinters.setUpdatedTime(DateUtil.date());
winPrintClientPrinters.setUpdatedBy(getLoginName());
return toAjax(winPrintClientPrintersService.updateWinPrintClientPrinters(winPrintClientPrinters));
}

34
win-print/src/main/java/com/win/print/controller/WinPrintModelController.java

@ -2,9 +2,15 @@ package com.win.print.controller;
import java.util.List;
import com.win.common.config.WinConfig;
import com.win.common.utils.DateUtils;
import com.win.common.utils.ServletUtils;
import com.win.common.utils.file.FileUploadUtils;
import com.win.common.utils.file.FileUtils;
import com.win.print.util.DataUnitl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
@ -20,6 +26,7 @@ import com.win.common.core.controller.BaseController;
import com.win.common.core.domain.AjaxResult;
import com.win.common.utils.poi.ExcelUtil;
import com.win.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 打印模版设置Controller
@ -35,14 +42,37 @@ public class WinPrintModelController extends BaseController
@Autowired
private IWinPrintModelService winPrintModelService;
@Value("${win.path.template}")
private String templatePathDefault;
@RequiresPermissions("print:modelmanager:view")
@GetMapping()
public String modelmanager()
{
return prefix + "/modelmanager";
}
@PostMapping("/upload")
@ResponseBody
public AjaxResult uploadFile(MultipartFile file,String type) throws Exception
{
try
{
// 上传文件路径
String filePath = DataUnitl.getWorkingDir(templatePathDefault);
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
//String url =" http://"+ ServletUtils.getRequest().getServerName()+":"+ServletUtils.getRequest().getServerPort() +"/service/printfileName/file" ;
AjaxResult ajax = AjaxResult.success();
//ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 查询打印模版设置列表
*/

2
win-print/src/main/java/com/win/print/mapper/WinPrintClientPrintersMapper.java

@ -29,7 +29,7 @@ public interface WinPrintClientPrintersMapper
* @return 客户端打印机对照集合
*/
public List<WinPrintClientPrinters> selectWinPrintClientPrintersList(WinPrintClientPrinters winPrintClientPrinters);
public List<WinPrintClientPrinters> selectClientPrintersList();
public List<WinPrintClientPrinterSimple> selectClientPrintersList();
/**
* 新增客户端打印机对照
*

2
win-print/src/main/java/com/win/print/mapper/WinPrintModelMapper.java

@ -20,7 +20,7 @@ public interface WinPrintModelMapper
* @return 打印模版设置
*/
public WinPrintModel selectWinPrintModelById(Long id);
public WinPrintModelSimple selectWinPrintModelListSimple();
public List<WinPrintModelSimple> selectWinPrintModelListSimple();
public WinPrintModel selectWinPrintModelByCode(String code);
/**

2
win-print/src/main/java/com/win/print/service/IWinPrintClientPrintersService.java

@ -28,7 +28,7 @@ public interface IWinPrintClientPrintersService
* @return 客户端打印机对照集合
*/
public List<WinPrintClientPrinters> selectWinPrintClientPrintersList(WinPrintClientPrinters winPrintClientPrinters);
public List<WinPrintClientPrinters> selectClientPrintersList();
public List<WinPrintClientPrinterSimple> selectClientPrintersList();
/**
* 新增客户端打印机对照
*

2
win-print/src/main/java/com/win/print/service/IWinPrintModelService.java

@ -19,7 +19,7 @@ public interface IWinPrintModelService
* @return 打印模版设置
*/
public WinPrintModel selectWinPrintModelById(Long id);
public WinPrintModelSimple selectWinPrintModelListSimple();
public List<WinPrintModelSimple> selectWinPrintModelListSimple();
/**
* 查询打印模版设置列表

2
win-print/src/main/java/com/win/print/service/impl/WinPrintClientPrintersServiceImpl.java

@ -52,7 +52,7 @@ public class WinPrintClientPrintersServiceImpl implements IWinPrintClientPrinter
return winPrintClientPrintersMapper.selectWinPrintClientPrintersList(winPrintClientPrinters);
}
@Override
public List<WinPrintClientPrinters> selectClientPrintersList(){
public List<WinPrintClientPrinterSimple> selectClientPrintersList(){
return winPrintClientPrintersMapper.selectClientPrintersList();
}
/**

2
win-print/src/main/java/com/win/print/service/impl/WinPrintModelServiceImpl.java

@ -42,7 +42,7 @@ public class WinPrintModelServiceImpl implements IWinPrintModelService
}
@Override
public WinPrintModelSimple selectWinPrintModelListSimple()
public List<WinPrintModelSimple> selectWinPrintModelListSimple()
{
return winPrintModelMapper.selectWinPrintModelListSimple();

52
win-print/src/main/java/com/win/print/util/PdfModelUitl.java

@ -17,6 +17,7 @@ import com.itextpdf.kernel.pdf.*;
import com.itextpdf.kernel.pdf.annot.PdfAnnotation;
import com.itextpdf.kernel.pdf.annot.PdfWidgetAnnotation;
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
import com.itextpdf.layout.Document;
import com.win.common.utils.file.ImageUtils;
import com.win.print.domain.WinPrintModel;
import com.win.print.domain.WinPrintModelParams;
@ -30,8 +31,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@ -59,25 +62,44 @@ public class PdfModelUitl {
* 待填充的PDF模板文档
*/
public void pdfMdelFromRender(List<WinPrintModelParams> paramsList,File tempFile, JSONObject data, String modelName, String templatePath) throws IOException, NoSuchFieldException {
PdfReader reader = new PdfReader(templatePath+"/"+modelName);
PdfWriter writer = new PdfWriter(tempFile);
PdfDocument pdf = new PdfDocument(reader, writer);
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true);
Document document = new Document(pdf);
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, false);
if (CollUtil.isNotEmpty(paramsList)) {
if (ObjectUtil.isNotEmpty(data)) {
paramsList.forEach(item -> {
if ("QRIMG".equals(item.getParamType())) {
//渲染Qr图片
qrCodeService.generateQRCode(Optional.ofNullable(data.getString(item.getParamCode())).orElse(""),172,172);
PdfFormField field = form.getField(item.getParamCode());
field.setFont(defaultFont());
field.setFontSize(12);
if(ObjectUtil.isNotEmpty(field)) {
if ("QRIMG".equals(item.getParamType())) {
//渲染Qr图片
try {
BufferedImage bufferedImage = qrCodeService.generateQRCode(Optional.ofNullable(data.getString(item.getParamCode())).orElse(""), 172, 172);
byte[] pngs = qrCodeService.getImgBuffer("jpeg", bufferedImage);
com.itextpdf.layout.element.Image image=new com.itextpdf.layout.element.Image(ImageDataFactory.create(pngs));
Rectangle rtl = field.getWidgets().get(0).getRectangle().toRectangle(); // 获取表单域的xy坐标
image.setFixedPosition(rtl.getX(), rtl.getY(),rtl.getWidth()); // 设置图片固定位置
//image.setRelativePosition(rtl.getLeft(),rtl.getTop(), rtl.getRight(),rtl.getBottom());
document.add(image);
} else if ("IMG".equals(item.getParamType())) {
//渲染普通图片
} else {
Optional.ofNullable( form.getField(item.getParamCode())).ifPresent(act->{act.setValue(Optional.ofNullable(data.getString(item.getParamCode())).orElse(""));});
}
} catch (IOException e) {
field.setValue("无图片");
}
} else if ("IMG".equals(item.getParamType())) {
//渲染普通图片
//PdfPage annotationPage = findAnnotationPage(item.getParamCode(),pdf);
//byte[] pngs = ImageIO.read("")
//doFillFieldImage(annotationPage,field,pngs);
} else {
String s = Optional.ofNullable(data.getString(item.getParamCode())).orElse("");
field.setValue(s);
}
}
});
} else {
throw new NoSuchFieldException("没有任何可渲染的数据内容!");
@ -85,10 +107,10 @@ public class PdfModelUitl {
} else { //如果没有配置任何模版参数抛出异常
throw new NoSuchFieldException("没找到模版的参数配置信息!");
}
// 重复以上步骤,根据需要填充所有字段
// 设置表单为只读(可选)
form.flattenFields();
//writer.close();
document.close();
pdf.close();
}
@ -209,7 +231,7 @@ public class PdfModelUitl {
* 加载字体
*/
private static final String ILLEGAL_CHARACTERS_REGEX = "[\\\\/:*?\"<>|]";
private static final String DEFAULT_FONT_PATH = "/fonts/STKAITI.TTF";
private static final String DEFAULT_FONT_PATH = "/fonts/iconfont.ttf";
private static final String DEFAULT_EXTEND_PATH = "/fonts/extend/";
private static final Map<String, String> FONTS_MAP = fontsMap();
/**
@ -221,7 +243,9 @@ public class PdfModelUitl {
// 默认华文楷体
PdfFont baseFont;
try {
baseFont = PdfFontFactory.createFont(DEFAULT_FONT_PATH, PdfEncodings.IDENTITY_H);
//PdfFontFactory.register(DEFAULT_FONT_PATH);
//baseFont = PdfFontFactory.createFont(DEFAULT_FONT_PATH, PdfEncodings.IDENTITY_H);
baseFont=PdfFontFactory.createFont("STSong-Light", "UniGB-UCS2-H");
} catch (Exception e) {
throw new RuntimeException("无法获取默认字体:" + e.getMessage(),e);
}

1
win-print/src/main/resources/templates/print/clientPrinters/add.html

@ -46,7 +46,6 @@
$("#form-clientPrinters-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-clientPrinters-add').serialize());

25
win-print/src/main/resources/templates/print/clientPrinters/clientPrinters.html

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('客户端打印机对照列表')" />
<th:block th:include="include :: header('打印机管理')" />
</head>
<body class="gray-bg">
<div class="container-div">
@ -63,30 +63,31 @@
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "客户端打印机对照",
modalName: "打印机管理",
columns: [{
checkbox: true
},
{
field: 'clientCode',
title: '客户端编码'
},
{
field: 'printerName',
title: '打印机实体名称'
},
{
field: 'printerUuid',
title: '打印机编码',
visible: false
visible: true
},
{
field: 'printerNameBusy',
title: '打印机业务名称'
},
{
field: 'clientCode',
title: '客户端编码'
},
{
field: 'printerName',
title: '打印机实体名称'
},
{
field: 'status',
title: '状态'
title: '状态',
visible: false
},
{
field: 'id',

56
win-print/src/main/resources/templates/print/modelmanager/add.html

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:insert="~{include :: header('打印模版设置列表')}" />
<th:block th:include="~{include :: bootstrap-fileinput-css}" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -27,7 +28,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">模版类型:</label>
<div class="col-sm-8">
<select name="mType" class="form-control" th:with="type=${@dict.getType('model_type')}" required>
<select name="mType" class="form-control" th:with="type=${@dict.getType('model_type')}" required >
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
@ -37,7 +38,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">模版来源:</label>
<div class="col-sm-8">
<select name="mTypeSrc" class="form-control" th:with="type=${@dict.getType('model_type_src')}" required>
<select name="mTypeSrc" id="mTypeSrcid" onchange="imgChange(value)" class="form-control" th:with="type=${@dict.getType('model_type_src')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
@ -47,15 +48,23 @@
<div class="form-group">
<label class="col-sm-3 control-label">文件名称:</label>
<div class="col-sm-8">
<input name="mFilename" class="form-control" type="text">
<input name="mFilename" id="mFilename" iclass="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<div class="col-xs-12" >
<div id="filediv" class="form-group" style="display: none">
<label class="font-noraml">模版文件上传</label>
<div class="file-loading" >
<input id="singleFile" name="file" type="file" >
</div>
</div>
</div>
<div class="col-xs-12" >
<div class="form-group" id="editordiv" style="display: none">
<label class="col-sm-3 control-label">模版内容:</label>
<div class="col-sm-8">
<script id="editor" name="mData" type="text/plain" style="height: 300px;"></script>
<script id="editor" name="mData" type="text/plain" style="height: 300px;" ></script>
<textarea id="mData" style="display: none;">[[*{mData}]]</textarea>
</div>
</div>
@ -113,6 +122,7 @@
</div>
<th:block th:include="~{include :: footer}" />
<th:block th:include="~{include :: ueditor-js}" />
<th:block th:include="~{include :: bootstrap-fileinput-js}" />
<script th:inline="javascript">
var prefix = ctx + "print/modelmanager"
var paramTypeDatas = [[${@dict.getType('param_type')}]];
@ -131,7 +141,22 @@
$.operate.save(prefix + "/add", $('#form-modelmanager-add').serialize());
}
}
function imgChange(value){
let elementById = document.getElementById("editordiv");
let fileUpload = document.getElementById("filediv");
if(value==="STRING"){
elementById.style.display="block";
fileUpload.style.display="none";
}else{
elementById.style.display="none";
if(value==="FILE"){
fileUpload.style.display="block";
}else{
fileUpload.style.display="none";
}
}
}
$(function() {
var options = {
pagination: false,
@ -201,6 +226,25 @@
}
sub.addRow(row);
}
$(document).ready(function () {
// 单图上传
$("#singleFile").fileinput({
//uploadUrl: ctx + 'common/upload',
uploadUrl:"/print/modelmanager/upload",
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
var rsp = data.response;
//log.info("return url:" + rsp.url)
//console.log("reutrn fileName:" + rsp.fileName)
//log.info("reutrn newFileName:" + rsp.newFileName)
//log.info("return originalFilename:" + rsp.originalFilename)
document.getElementById("mFilename").value=rsp.newFileName;
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
});
</script>
</body>
</html>

24
win-print/src/main/resources/templates/print/modelmanager/edit.html

@ -6,7 +6,7 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-modelmanager-edit" th:object="${winPrintModel}">
<h4 class="form-header h4">打印模版设置信息</h4>
<h4 class="form-header h4">打印模版设置</h4>
<input name="id" th:field="*{id}" type="hidden">
<div class="col-xs-12">
<div class="form-group">
@ -46,21 +46,21 @@
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">模版地址</label>
<label class="col-sm-3 control-label">文件名称</label>
<div class="col-sm-8">
<input name="mFilename" th:field="*{mFilename}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">模版内容:</label>
<div class="col-sm-8">
<script id="editor" name="mData" type="text/plain" style="height: 300px;"></script>
<textarea id="mData" style="display: none;">[[*{mData}]]</textarea>
<input name="mFilename" th:field="*{mFilename}" class="form-control" type="text" required>
</div>
</div>
</div>
<!-- <div class="col-xs-12">-->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">模版内容:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <script id="editor" name="mData" type="text/plain" style="height: 300px;"></script>-->
<!-- <textarea id="mData" style="display: none;">[[*{mData}]]</textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label is-required">纸张类型:</label>

Loading…
Cancel
Save