Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/jeeplus/modules/sg/overheadline/service/OverheadLineService.java
蔡德晨 5 năm trước cách đây
mục cha
commit
ca5a627351

+ 12 - 8
src/main/java/com/jeeplus/modules/sg/project/web/ProjectTemController.java

@@ -58,10 +58,12 @@ public class ProjectTemController extends BaseController {
      *数据导入
      */
     @RequestMapping("/import")
-    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request, Model model) {
+    public String importFile(MultipartFile[] file, RedirectAttributes redirectAttributes, HttpServletRequest request, Model model) {
         String projectName = request.getParameter("projectName");     //项目名称
-        String itemName = request.getParameter("itemName");     //项目名称
-        String type = request.getParameter("type");     //工程类型
+        String itemNames = request.getParameter("itemName");     //项目名称
+        String types = request.getParameter("type");     //工程类型
+        String[] itemName = itemNames.split(",");
+        String[] type = types.split(",");
         String id = getId();
         WbsProject wbsProject = new WbsProject();
         wbsProject.setProjectName(projectName);
@@ -70,12 +72,14 @@ public class ProjectTemController extends BaseController {
         WbsProject wbsProject1 = wbsProjects.get(0);
         String projectId = wbsProject1.getId();
         try {
+            for(int i = 0;i<type.length;i++) {
 //            保存数据到数据库
-            if(type.equals("1")) {
-                overheadLineService.saveJk(file,itemName, id, projectId, type);
-            }
-            if (type.equals("2")) {
-                overheadLineService.saveDl(file,itemName, id, projectId, type);
+                if (type.equals("1")) {
+                    overheadLineService.saveJk(file[i], itemName[i], id, projectId, type[i]);
+                }
+                if (type.equals("2")) {
+                    overheadLineService.saveDl(file[i], itemName[i], id, projectId, type[i]);
+                }
             }
         } catch (RuntimeException e) {
             addMessage(redirectAttributes, "导入失败,"+e.getMessage());

+ 24 - 6
src/main/webapp/webpage/modules/sg/project/addItem2Form.jsp

@@ -70,7 +70,7 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">*工程名称</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="" lay-verify="title" class="layui-input">
+                                        <input type="text" name="projectName" lay-verify="title" class="layui-input">
                                     </div>
                                 </div>
                             </div>
@@ -80,16 +80,18 @@
                             <div class="layui-upload">
                                 <button type="button" class="layui-btn layui-btn-normal" id="testList">选择文件</button>
                                 <div class="layui-upload-list">
-                                    <table class="layui-table">
+                                    <table class="layui-table" id="table">
                                         <thead>
-                                        <tr><th>文件名</th>
+                                        <tr><th hidden>项目</th>
+                                            <th>文件名</th>
+                                            <th>项目名称</th>
                                             <th>项目类型</th>
                                             <th>操作</th>
                                         </tr></thead>
                                         <tbody id="demoList"></tbody>
                                     </table>
                                 </div>
-                                <button type="button" class="layui-btn" id="testListAction">确定</button>
+                                <button type="button" class="layui-btn" id="testListAction" onclick="sub()">确定</button>
                             </div>
                             <%--<!---------列表---------->--%>
                             <%--<div class="layui-form-item">--%>
@@ -122,16 +124,19 @@
             ,accept: 'file'
             ,multiple: true
             ,auto: false
-            ,bindAction: '#testListAction'
+            // ,bindAction: '#testListAction'
             ,choose: function(obj){
                 var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                 //读取本地文件
                 // var xml = "<select name=\"type\"><option value=\"\">请选择</option><option value=\"1\">架空线路工程</option><option value=\"2\">电缆工程</option></select>";
                 obj.preview(function(index, file, result){
-                    alert(file);
                     var tr = $(['<tr id="upload-'+ index +'">'
+                        ,'<td hidden>'+ file +'</td>'
                         ,'<td>'+ file.name +'</td>'
                         ,'<td>'
+                        ,' <input type="text" >'
+                        ,'</td>'
+                        ,'<td>'
                         ,' <select name="type" class="myselect" id="myselect"><option value="">请选择</option><option value="1">架空线路工程</option><option value="2">电缆工程</option></select>'
                         ,'</td>'
                         ,'<td>'
@@ -176,4 +181,17 @@
 
     });
 </script>
+<script>
+    function sub() {
+        var array = [];
+        $("#table tr").each(function () {
+            var text = $(this).children("td:first-child").text();
+            if(text != null){
+                array.push(text)
+            }
+        })
+        array.splice(0,1);
+        alert(array);
+    }
+</script>
 </html>

+ 1 - 1
src/main/webapp/webpage/modules/sg/project/manageList.jsp

@@ -107,7 +107,7 @@
                                 xml +="<span class='myspan'>操作</span>";
                             }
                             if(d.status==3){
-                                xml +="<a class='layui-btn layui-btn-xs' href=\"${ctx}/jkxl/list?id="+d.id+"&type="+d.type+"\">编辑</a>";
+                                xml +="<a class='layui-btn layui-btn-xs' href=\"${ctx}/jkxl/list?id="+d.id+"&type="+d.type+"&projectId="+d.pid+"\">编辑</a>";
                             }
 
                             return xml;