From d127b647f1a2e8c1c3490af276e97c024d52f904 Mon Sep 17 00:00:00 2001
From: zmk <496160012@qq.com>
Date: 星期二, 21 五月 2024 13:14:47 +0800
Subject: [PATCH] 提交代码

---
 javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectPerson/edit.html |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectPerson/edit.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectPerson/edit.html
index 482bb42..a14508e 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectPerson/edit.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectPerson/edit.html
@@ -76,6 +76,14 @@
                     <input name="documentCode" th:field="*{documentCode}" 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 type="file" name= "file" id="file"/>
+
+                </div>
+            </div>
         </form>
     </div>
     <th:block th:include="include :: footer" />
@@ -87,9 +95,42 @@
         });
 
         function submitHandler() {
-            if ($.validate.form()) {
-                $.operate.save(prefix + "/edit", $('#form-projectPerson-edit').serialize());
+            var result = doSubmitFile();
+            var documentFile =null;
+            if(result !=null){
+                if(result.code == web_status.SUCCESS){
+                    documentFile= result.fileName;
+                }
             }
+            if ($.validate.form()) {
+                let formData = $('#form-projectPerson-edit').serialize();
+                let data = formData  +"&documentPath="+documentFile;
+                $.operate.save(prefix + "/edit",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/projectPerson/uploadPersonFile",
+                data: formData,
+                cache: false,
+                contentType: false,
+                processData: false,
+                type: 'POST',
+                async:false,
+                success: function (result) {
+                    data=  result;
+                }
+            });
+            return data;
         }
 
 

--
Gitblit v1.9.1