|
|
@@ -0,0 +1,312 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
|
+<head>
|
|
|
+ <th:block th:include="include :: header('修改牛只信息管理')" />
|
|
|
+ <th:block th:include="include :: datetimepicker-css" />
|
|
|
+ <th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
|
+</head>
|
|
|
+<body class="white-bg">
|
|
|
+ <div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
+ <form class="form-horizontal m" id="form-info-edit" th:object="${syglCattleInfo}">
|
|
|
+ <input name="id" th:field="*{id}" type="hidden">
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">编号:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="no" th:field="*{no}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">是否被认养:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="isAdopt" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isAdopt}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">是否入住牛只:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="isCheckin" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isCheckin}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">是否种牛:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="isCattle" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isCattle}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">是否出栏:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="isChulan" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isChulan}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">初始体重:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="initialWeight" th:field="*{initialWeight}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">品种:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="variety" th:field="*{variety}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">入社月龄:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="monthAge" th:field="*{monthAge}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">养殖开始时间:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <div class="input-group date">
|
|
|
+ <input name="startTime" th:value="${#dates.format(syglCattleInfo.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
|
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">预计出舍时间:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <div class="input-group date">
|
|
|
+ <input name="deliveryTime" th:value="${#dates.format(syglCattleInfo.deliveryTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
|
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">屠宰时间:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <div class="input-group date">
|
|
|
+ <input name="slaughterTime" th:value="${#dates.format(syglCattleInfo.slaughterTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
|
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">生长周期:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="growthCycle" th:field="*{growthCycle}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">养殖状态:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <select name="status" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{status}"></option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">设备码:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="code" th:field="*{code}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">溯源二维码:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="qrCode" th:field="*{qrCode}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">采购成本:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input name="purchaseCost" th:field="*{purchaseCost}" class="form-control" type="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label is-required">图片附件:</label>
|
|
|
+ <div class="col-sm-8">
|
|
|
+ <input type="hidden" name="filePath" th:field="*{filePath}">
|
|
|
+ <div class="file-loading">
|
|
|
+ <input class="form-control file-upload" id="jlrdFileObject" name="file" type="file" multiple onclick="getMeg()">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <th:block th:include="include :: footer" />
|
|
|
+ <th:block th:include="include :: datetimepicker-js" />
|
|
|
+ <th:block th:include="include :: bootstrap-fileinput-js"/>
|
|
|
+ <script th:inline="javascript">
|
|
|
+ var local = window.location.href.substring(0,window.location.href.indexOf(window.location.pathname));//附件用,获取网址
|
|
|
+ var fileP=$("input[name='schoolPic']").val();
|
|
|
+ var prefix = ctx + "cattleInfo/info";
|
|
|
+ $("#form-info-edit").validate({
|
|
|
+ focusCleanup: true
|
|
|
+ });
|
|
|
+
|
|
|
+ function submitHandler() {
|
|
|
+ if ($.validate.form()) {
|
|
|
+ $("input[name='filePath']").val(getImgUrl());//附件用
|
|
|
+ $.operate.save(prefix + "/edit", $('#form-info-edit').serialize());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $("input[name='startTime']").datetimepicker({
|
|
|
+ format: "yyyy-mm-dd",
|
|
|
+ minView: "month",
|
|
|
+ autoclose: true
|
|
|
+ });
|
|
|
+
|
|
|
+ $("input[name='deliveryTime']").datetimepicker({
|
|
|
+ format: "yyyy-mm-dd",
|
|
|
+ minView: "month",
|
|
|
+ autoclose: true
|
|
|
+ });
|
|
|
+
|
|
|
+ $("input[name='slaughterTime']").datetimepicker({
|
|
|
+ format: "yyyy-mm-dd",
|
|
|
+ minView: "month",
|
|
|
+ autoclose: true
|
|
|
+ });
|
|
|
+
|
|
|
+ //f附件用,通用,只需要更改文件参数===============Start
|
|
|
+ var newFilePs = []; //图片回显
|
|
|
+ var imgConfig = []; //预览参数
|
|
|
+ var uploadImageArray = [];//所有已上传的图片路径
|
|
|
+
|
|
|
+ var urlsArr = ($("input[name='filePath']").val()).split(",");
|
|
|
+ for(var i in urlsArr) {
|
|
|
+ if (urlsArr[i] != "") {
|
|
|
+ uploadImageArray.push(urlsArr[i]);
|
|
|
+ newFilePs[i] = ctx + urlsArr[i];
|
|
|
+ var fileType = urlsArr[i].substr(urlsArr[i].lastIndexOf(".")+1,urlsArr[i].length-1);
|
|
|
+ var ftype ="image"; //文件类型
|
|
|
+ if(fileType=="pdf"){
|
|
|
+ ftype = "pdf";
|
|
|
+ }
|
|
|
+ imgConfig[i] = {
|
|
|
+ url: ctx+"/common/removeFile",
|
|
|
+ downloadUrl:ctx+urlsArr[i], //下载路径,此项不设置的话下载按钮不显示
|
|
|
+ type:ftype, //文件类型
|
|
|
+ key: urlsArr[i], //参数,用于文件删除向后台传参
|
|
|
+ caption:urlsArr[i].substr(urlsArr[i].lastIndexOf("/")+1,urlsArr[i].length-1) //文件名,用于预览文件显示的文件名
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $(".file-upload").each(function (i) {
|
|
|
+ console.log(imgConfig);
|
|
|
+ $(this).fileinput({
|
|
|
+ language: 'zh', //设置语言
|
|
|
+ uploadUrl: ctx+'/common/upload',
|
|
|
+ deleteUrl:ctx+'/common/removeFile',
|
|
|
+ allowedFileExtensions: ['jpg', 'png','pdf','docx','xlsx','doc','xls'],//接收的文件后缀
|
|
|
+// allowedFileExtensions: ['jpg', 'png','pdf','docx','xlsx','doc','xls'],//接收的文件后缀
|
|
|
+ showUpload: false, //是否显示上传按钮
|
|
|
+ showRemove: false, //显示移除按钮
|
|
|
+ showPreview: true, //是否显示预览
|
|
|
+ showCaption: false,//是否显示标题
|
|
|
+ browseClass: "btn btn-primary", //按钮样式
|
|
|
+ dropZoneEnabled: true,//是否显示拖拽区域
|
|
|
+ initialPreviewAsData: true,
|
|
|
+ enctype: 'multipart/form-data',
|
|
|
+ initialPreview: newFilePs,
|
|
|
+// initialPreviewFileType: ['pdf','image'],
|
|
|
+ uploadAsync: true, //默认异步上传(true),回调fileuploaded,false为同步上传,回调filebatchuploadsuccess
|
|
|
+ maxFileCount: 6,
|
|
|
+ overwriteInitial: false, //不覆盖已存在的图片
|
|
|
+ initialPreviewConfig: imgConfig, //配置预览的参数
|
|
|
+ autoReplace: true,
|
|
|
+ preferIconicPreview: true,// 强制缩略图显示以下文件扩展名的图标
|
|
|
+ previewFileIconSettings: {
|
|
|
+ 'doc': '<i class="fa fa-file-word-o text-primary"></i>',
|
|
|
+ 'xls': '<i class="fa fa-file-excel-o text-success"></i>',
|
|
|
+ 'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>',
|
|
|
+ 'zip': '<i class="fa fa-file-archive-o text-muted"></i>',
|
|
|
+ 'htm': '<i class="fa fa-file-code-o text-info"></i>',
|
|
|
+ 'txt': '<i class="fa fa-file-text-o text-info"></i>',
|
|
|
+ 'mov': '<i class="fa fa-file-movie-o text-warning"></i>',
|
|
|
+ 'mp3': '<i class="fa fa-file-audio-o text-warning"></i>',
|
|
|
+ },
|
|
|
+ previewFileExtSettings: { // configure the logic for determining icon file extensions
|
|
|
+ 'doc': function(ext) {
|
|
|
+ return ext.match(/(doc|docx)$/i);
|
|
|
+ },
|
|
|
+ 'xls': function(ext) {
|
|
|
+ return ext.match(/(xls|xlsx)$/i);
|
|
|
+ },
|
|
|
+ 'ppt': function(ext) {
|
|
|
+ return ext.match(/(ppt|pptx)$/i);
|
|
|
+ },
|
|
|
+ 'zip': function(ext) {
|
|
|
+ return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i);
|
|
|
+ },
|
|
|
+ 'htm': function(ext) {
|
|
|
+ return ext.match(/(htm|html)$/i);
|
|
|
+ },
|
|
|
+ 'txt': function(ext) {
|
|
|
+ return ext.match(/(txt|ini|csv|java|php|js|css)$/i);
|
|
|
+ },
|
|
|
+ 'mov': function(ext) {
|
|
|
+ return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i);
|
|
|
+ },
|
|
|
+ 'mp3': function(ext) {
|
|
|
+ return ext.match(/(mp3|wav)$/i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).on('fileuploaded', function (event, data, previewId, index) {
|
|
|
+ fileP += data.response.fileName+",";
|
|
|
+ $('#zoom-'+previewId).find(".kv-preview-data").attr("src",data.response.fileName);//上传成功后替换文件路径(替换为实际数据库的存储路径)
|
|
|
+
|
|
|
+ }).on("filebatchselected", function (event, previewId, files) {//选中文件后执行
|
|
|
+ $(".file-upload").fileinput("upload");
|
|
|
+ }).on('fileremoved', function (event, id, index) {//预览时点击缩略图上的删除按钮才能触发的
|
|
|
+ console.log('fileremoved');
|
|
|
+ getMeg();
|
|
|
+ }).on("filepredelete", function (event, key, jqXHR, data) { //预览图片删除
|
|
|
+ console.log('filepredelete')
|
|
|
+ getMeg();
|
|
|
+ }).on("filesuccessremove", function (event, id) { //使用缩略图删除按钮删除成功上传的缩略图后
|
|
|
+ console.log('filesuccessremove')
|
|
|
+ getMeg();
|
|
|
+ })
|
|
|
+ $(this).fileinput('_initFileActions');
|
|
|
+ });
|
|
|
+
|
|
|
+ function nowImgTotal() {
|
|
|
+ return $(".file-preview-thumbnails").find('.file-preview-frame').length / 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ function getMeg() {
|
|
|
+ if (nowImgTotal() >= 6) {
|
|
|
+// console.log('file set disabled');
|
|
|
+ $('#jlrdFileObject').attr('disabled', 'disabled');
|
|
|
+ $.modal.alert("图片允许上传的最大数值为6,请删除需要被替换的图片后再进行上传操作!")
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+// console.log('file set null');
|
|
|
+ $('#jlrdFileObject').removeAttr("disabled");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ 获取当前页面图片附件的存储路径
|
|
|
+ */
|
|
|
+ function getImgUrl(){
|
|
|
+ var initFileDiv = $(".kv-zoom-cache");
|
|
|
+ var imgUrl = [];
|
|
|
+ initFileDiv.each(function(i,e){
|
|
|
+ var fullPath = $(this).find(".kv-preview-data").attr("src");
|
|
|
+ if(fullPath.length>=2)
|
|
|
+ imgUrl[i]="/profile/upload/"+(fullPath.split("upload/",fullPath.length-1))[1];
|
|
|
+ });
|
|
|
+ return imgUrl;
|
|
|
+ }
|
|
|
+ //f附件用,通用,只需要更改文件参数===============End
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|