From f5ab1beef8bee453e6177e55fe7ecc2838f247e8 Mon Sep 17 00:00:00 2001
From: zmk <496160012@qq.com>
Date: 星期三, 03 七月 2024 18:29:17 +0800
Subject: [PATCH] 提交代码
---
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html | 75 ++++++++++++++++++++++++++++++-------
1 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html
index a63ca3c..c6b8daa 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/add.html
@@ -19,21 +19,12 @@
<input name="tubName" class="form-control" type="text" placeholder="璇峰~鍐欐潗鏂欏悕绉�" required>
</div>
</div>
-<!-- <div class="form-group"> -->
-<!-- <label class="col-sm-3 control-label">绫诲瀷锛�</label>-->
-<!-- <div class="col-sm-8">-->
-<!-- <select name="type" class="form-control m-b">-->
-<!-- <option value="">鎵�鏈�</option>-->
-<!-- </select>-->
-<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 浠g爜鐢熸垚璇烽�夋嫨瀛楀吀灞炴��</span>-->
-<!-- </div>-->
-<!-- </div>-->
- <div class="form-group">
+ <div class="form-group">
<label class="col-sm-3 control-label">鍑哄簱鏃堕棿锛�</label>
<div class="col-sm-8">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
- <input name="outboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
+ <input id="outboundDateId" name="outboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
</div>
</div>
</div>
@@ -42,7 +33,7 @@
<div class="col-sm-8">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
- <input name="inboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
+ <input id="inboundDateId" name="inboundDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
</div>
</div>
</div>
@@ -76,6 +67,13 @@
<textarea id="remark" name="remark" class="form-control"></textarea>
</div>
</div>
+
+ <div class="form-group">
+ <label class="col-sm-3 control-label">涓婁紶鍥剧墖/鎵弿浠讹細</label>
+ <div class="col-sm-8">
+ <input type="file" name= "file" id="file"/>
+ </div>
+ </div>
</form>
</div>
<th:block th:include="include :: footer" />
@@ -85,17 +83,59 @@
var projectId = [[${projectId}]];
var code = [[${code}]];
-
$("#form-TubLog-add").validate({
focusCleanup: true
});
function submitHandler() {
+ var result = doSubmitFile();
+ var documentFile = "";
+ if(result !=null){
+ if(result.code == web_status.SUCCESS){
+ documentFile= result.fileName;
+ }
+ }
+
+ let inboundDateValue = $("#inboundDateId").val();
+ let outboundDateValue = $("#outboundDateId").val();
+ if ($.common.isEmpty(inboundDateValue) && $.common.isEmpty(outboundDateValue)) {
+ $.modal.alertWarning("鍑哄叆搴撴椂闂达紝璇烽�夋嫨涓�鏉¤褰�");
+ return;
+ }
+ if (!$.common.isEmpty(inboundDateValue) && !$.common.isEmpty(outboundDateValue)) {
+ $.modal.alertWarning("鍑哄叆搴撴椂闂达紝璇烽�夋嫨涓�鏉¤褰�");
+ return;
+ }
+
if ($.validate.form()) {
let formData = $('#form-TubLog-add').serialize();
- let data = formData + "&projectId=" + projectId + "&code=" + code;
+ let data = formData + "&projectId=" + projectId + "&code=" + code +"&fileUrl="+documentFile;
$.operate.save(prefix + "/add", data);
}
+ }
+
+ //涓婁紶鏂囦欢
+ function doSubmitFile(){
+ var file = $('#file').val();
+ if (file == '' || file ==null){
+ return null;
+ }
+ var formData = new FormData();
+ formData.append("file", $('#file')[0].files[0]);
+ var data = null;
+ $.ajax({
+ url: ctx + "geo/TubLog/uploadTubLogFile",
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false,
+ type: 'POST',
+ async:false,
+ success: function (result) {
+ data= result;
+ }
+ });
+ return data;
}
$("input[name='outboundDate']").datetimepicker({
@@ -109,6 +149,13 @@
minView: "month",
autoclose: true
});
+
+
+
+
+
+
+
</script>
</body>
</html>
\ No newline at end of file
--
Gitblit v1.9.1