소스 검색

修改分发步骤的文件为多文件上传 相应修改分发反馈为多个反馈

huZhiHao 5 년 전
부모
커밋
de64976761

+ 1 - 0
sql/20200319.sql

@@ -0,0 +1 @@
+ALTER TABLE industrial_land_supply ADD countersign_comment text COLLATE utf8_bin COMMENT '会签说明'

+ 1 - 0
src/main/java/platform/common/Constant.java

@@ -171,6 +171,7 @@ public final class Constant {
         public static String INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT = "INDUSTRIAL_LAND_SUPPLY_COMMERCE_SUPPLEMENT";//产业供地商业业务员补充附件
         public static String INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER = "INDUSTRIAL_LAND_SUPPLY_COMMERCE_LEADER";//产业供地商务领导审核附件
         public static String INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER = "INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER";//产业供地管委会领导审核附件
+        public static String INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN = "INDUSTRIAL_LAND_SUPPLY_MANAGEMENT_COMMITTEE_LEADER_COUNTERSIGN";//产业供地管委会领导审核附件
         public static String INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE = "INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE";//产业供地分发附件
         public static String INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK = "INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_FEEDBACK";//产业供地分发反馈附件
         public static String INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY = "INDUSTRIAL_LAND_SUPPLY_DISTRIBUTE_SUMMARY";//产业供地分发汇总附件

+ 343 - 0
src/main/java/platform/common/util/word/XWPFHelper.java

@@ -0,0 +1,343 @@
+package platform.common.util.word;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
+import org.apache.poi.xwpf.usermodel.TextAlignment;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFPicture;
+import org.apache.poi.xwpf.usermodel.XWPFPictureData;
+import org.apache.poi.xwpf.usermodel.XWPFRelation;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHyperlink;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTInd;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STLineSpacingRule;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @Description 设置docx文档的样式及一些操作
+ * @Author  Huangxiaocong
+ * 2018年12月1日  下午12:18:41
+ * 基本概念说明:XWPFDocument代表一个docx文档,其可以用来读docx文档,也可以用来写docx文档
+*     XWPFParagraph代表文档、表格、标题等种的段落,由多个XWPFRun组成
+ *     XWPFRun代表具有同样风格的一段文本
+ *  XWPFTable代表一个表格
+ *  XWPFTableRow代表表格的一行
+ *  XWPFTableCell代表表格的一个单元格
+ *  XWPFChar 表示.docx文件中的图表
+ *  XWPFHyperlink 表示超链接
+ *  XWPFPicture  代表图片
+ *
+ *  注意:直接调用XWPFRun的setText()方法设置文本时,在底层会重新创建一个XWPFRun。
+ */
+public class XWPFHelper {
+    private static Logger logger = Logger.getLogger(XWPFHelper.class.toString());
+
+    /**
+     * 创建一个word对象
+     * @return
+     * @Author Huangxiaocong 2018年12月1日 上午11:56:35
+     */
+    public XWPFDocument createDocument() {
+        XWPFDocument document = new XWPFDocument();
+        return document;
+    }
+    /**
+     * 打开word文档
+     * @param path 文档所在路径
+     * @return
+     * @throws IOException
+     * @Author Huangxiaocong 2018年12月1日 下午12:30:07
+     */
+    public XWPFDocument openDoc(String path) throws IOException {
+        InputStream is = new FileInputStream(path);
+        return new XWPFDocument(is);
+    }
+    /**
+     * 保存word文档
+     * @param document 文档对象
+     * @param savePath    保存路径
+     * @throws IOException
+     * @Author Huangxiaocong 2018年12月1日 下午12:32:37
+     */
+    public void saveDocument(XWPFDocument document, String savePath) throws IOException {
+        OutputStream os = new FileOutputStream(savePath);
+        document.write(os);
+        os.close();
+    }
+
+    public void saveDocument(XWPFDocument document, HttpServletResponse response) throws IOException {
+        OutputStream os = response.getOutputStream();
+        document.write(os);
+        os.close();
+    }
+    /**
+     * 设置段落文本样式  设置超链接及样式
+     * @param paragraph
+     * @param textStyle
+     * @param url
+     * @Author Huangxiaocong 2018年12月1日 下午3:56:32
+     */
+    public void addParagraphTextHyperlink(XWPFParagraph paragraph, TextStyle textStyle) {
+        String id = paragraph.getDocument().getPackagePart().
+                addExternalRelationship(textStyle.getUrl(),
+                        XWPFRelation.HYPERLINK.getRelation()).getId();
+        //追加链接并将其绑定到关系中
+        CTHyperlink cLink = paragraph.getCTP().addNewHyperlink();
+        cLink.setId(id);
+        //创建链接文本
+        CTText ctText = CTText.Factory.newInstance();
+        ctText.setStringValue(textStyle.getText());
+        CTR ctr = CTR.Factory.newInstance();
+        CTRPr rpr = ctr.addNewRPr();
+        //以下设置各种样式 详情看TextStyle类
+        if(textStyle.getFontFamily() != "" && textStyle.getFontFamily() != null     ) {
+            CTFonts fonts = rpr.isSetRFonts() ? rpr.getRFonts() : rpr.addNewRFonts();
+            fonts.setAscii(textStyle.getFontFamily());
+            //...
+        }
+        //设置字体大小
+    }
+    /**
+     * 设置段落的基本样式  设置段落间距信息, 一行 = 100    一磅=20
+     * @param paragraph
+     * @param paragStyle
+     * @Author Huangxiaocong 2018年12月1日 下午4:27:17
+     */
+    public void setParagraphSpacingInfo(XWPFParagraph paragraph, ParagraphStyle paragStyle, STLineSpacingRule.Enum lineValue) {
+        CTPPr pPPr = getParagraphCTPPr(paragraph);
+        CTSpacing pSpacing = pPPr.getSpacing() != null ? pPPr.getSpacing() : pPPr.addNewSpacing();
+        if(paragStyle.isSpace()) {
+            //段前磅数
+            if(paragStyle.getBefore() != null) {
+                pSpacing.setBefore(new BigInteger(paragStyle.getBefore()));
+            }
+            //段后磅数
+            if(paragStyle.getAfter() != null) {
+                pSpacing.setAfter(new BigInteger(paragStyle.getAfter()));
+            }
+            //依次设置段前行数、段后行数
+            //...
+        }
+        //间距
+        if(paragStyle.isLine()) {
+            if(paragStyle.getLine() != null) {
+                pSpacing.setLine(new BigInteger(paragStyle.getLine()));
+            }
+            if(lineValue != null) {
+                pSpacing.setLineRule(lineValue);    //
+            }
+        }
+    }
+    /**
+     * 设置段落缩进信息  1厘米 约等于 567
+     * @param paragraph
+     * @param paragStyle
+     * @Author Huangxiaocong 2018年12月1日 下午7:59:35
+     */
+    public void setParagraphIndInfo(XWPFParagraph paragraph, ParagraphStyle paragStyle) {
+        CTPPr pPPr = getParagraphCTPPr(paragraph);
+        CTInd pInd = pPPr.getInd() != null ? pPPr.getInd() : pPPr.addNewInd();
+        if(paragStyle.getFirstLine() != null) {
+            pInd.setFirstLine(new BigInteger(paragStyle.getFirstLine()));
+        }
+        //再进行其他设置
+        //...
+    }
+    /**
+     * 设置段落对齐 方式
+     * @param paragraph
+     * @param pAlign
+     * @param valign
+     * @Author Huangxiaocong 2018年12月1日 下午8:54:43
+     */
+    public void setParagraphAlignInfo(XWPFParagraph paragraph, ParagraphAlignment pAlign, TextAlignment valign) {
+        if(pAlign != null) {
+            paragraph.setAlignment(pAlign);
+        }
+        if(valign != null) {
+            paragraph.setVerticalAlignment(valign);
+        }
+    }
+    /**
+     * 得到段落的CTPPr
+     * @param paragraph
+     * @return
+     * @Author Huangxiaocong 2018年12月1日 下午7:36:10
+     */
+    public CTPPr getParagraphCTPPr(XWPFParagraph paragraph) {
+        CTPPr pPPr = null;
+        if(paragraph.getCTP() != null) {
+            if(paragraph.getCTP().getPPr() != null) {
+                pPPr = paragraph.getCTP().getPPr();
+            } else {
+                pPPr = paragraph.getCTP().addNewPPr();
+            }
+        }
+        return pPPr;
+    }
+    /**
+     * 得到XWPFRun的CTRPr
+     * @param paragraph
+     * @param pRun
+     * @return
+     * @Author Huangxiaocong 2018年12月1日 下午7:46:01
+     */
+    public CTRPr getRunCTRPr(XWPFParagraph paragraph, XWPFRun pRun) {
+        CTRPr ctrPr = null;
+        if(pRun.getCTR() != null) {
+            ctrPr = pRun.getCTR().getRPr();
+            if(ctrPr == null) {
+                ctrPr = pRun.getCTR().addNewRPr();
+            }
+        } else {
+            ctrPr = paragraph.getCTP().addNewR().addNewRPr();
+        }
+        return ctrPr;
+    }
+
+
+    /**
+     * 复制表格
+     * @param targetTable
+     * @param sourceTable
+     * @Author Huangxiaocong 2018年12月1日 下午1:40:01
+     */
+    public void copyTable(XWPFTable targetTable, XWPFTable sourceTable) {
+        //复制表格属性
+        targetTable.getCTTbl().setTblPr(sourceTable.getCTTbl().getTblPr());
+        //复制行
+        for(int i = 0; i < sourceTable.getRows().size(); i++) {
+            XWPFTableRow targetRow = targetTable.getRow(i);
+            XWPFTableRow sourceRow = sourceTable.getRow(i);
+            if(targetRow == null) {
+                targetTable.addRow(sourceRow);
+            } else {
+                copyTableRow(targetRow, sourceRow);
+            }
+        }
+    }
+    /**
+     * 复制单元格
+     * @param targetRow
+     * @param sourceRow
+     * @Author Huangxiaocong 2018年12月1日 下午1:33:22
+     */
+    public void copyTableRow(XWPFTableRow targetRow, XWPFTableRow sourceRow) {
+        //复制样式
+        if(sourceRow != null) {
+            targetRow.getCtRow().setTrPr(sourceRow.getCtRow().getTrPr());
+        }
+        //复制单元格
+        for(int i = 0; i < sourceRow.getTableCells().size(); i++) {
+            XWPFTableCell tCell = targetRow.getCell(i);
+            XWPFTableCell sCell = sourceRow.getCell(i);
+            if(tCell == sCell) {
+                tCell = targetRow.addNewTableCell();
+            }
+            copyTableCell(tCell, sCell);
+        }
+    }
+    /**
+     * 复制单元格(列) 从sourceCell到targetCell
+     * @param targetCell
+     * @param sourceCell
+     * @Author Huangxiaocong 2018年12月1日 下午1:27:38
+     */
+    public void copyTableCell(XWPFTableCell targetCell, XWPFTableCell sourceCell) {
+        //表格属性
+        if(sourceCell.getCTTc() != null) {
+            targetCell.getCTTc().setTcPr(sourceCell.getCTTc().getTcPr());
+        }
+        //删除段落
+        for(int pos = 0; pos < targetCell.getParagraphs().size(); pos++) {
+            targetCell.removeParagraph(pos);
+        }
+        //添加段落
+        for(XWPFParagraph sourceParag : sourceCell.getParagraphs()) {
+            XWPFParagraph targetParag = targetCell.addParagraph();
+            copyParagraph(targetParag, sourceParag);
+        }
+    }
+    /**
+     * 复制段落,从sourceParag到targetParag
+     * @param targetParag
+     * @param sourceParag
+     * @Author Huangxiaocong 2018年12月1日 下午1:16:26
+     */
+    public void copyParagraph(XWPFParagraph targetParag, XWPFParagraph sourceParag) {
+        targetParag.getCTP().setPPr(sourceParag.getCTP().getPPr());    //设置段落样式
+        //移除所有的run
+        for(int pos = targetParag.getRuns().size() - 1; pos >= 0; pos-- ) {
+            targetParag.removeRun(pos);
+        }
+        //copy新的run
+        for(XWPFRun sRun : sourceParag.getRuns()) {
+            XWPFRun tarRun = targetParag.createRun();
+            copyRun(tarRun, sRun);
+        }
+    }
+    /**
+     * 复制XWPFRun 从sourceRun到targetRun
+     * @param targetRun
+     * @param sourceRun
+     * @Author Huangxiaocong 2018年12月1日 下午12:56:53
+     */
+    public void copyRun(XWPFRun targetRun, XWPFRun sourceRun) {
+        //设置targetRun属性
+        targetRun.getCTR().setRPr(sourceRun.getCTR().getRPr());
+        targetRun.setText(sourceRun.text());//设置文本
+        //处理图片
+        List<XWPFPicture> pictures = sourceRun.getEmbeddedPictures();
+        for(XWPFPicture picture : pictures) {
+            try {
+                copyPicture(targetRun, picture);
+            } catch (InvalidFormatException e) {
+                e.printStackTrace();
+                logger.log(Level.WARNING, "copyRun", e);
+            } catch (IOException e) {
+                e.printStackTrace();
+                logger.log(Level.WARNING, "copyRun", e);
+            }
+        }
+    }
+    /**
+     * 复制图片从sourcePicture到 targetRun(XWPFPicture --> XWPFRun)
+     * @param targetRun
+     * @param source
+     * @throws IOException
+     * @throws InvalidFormatException
+     * @Author Huangxiaocong 2018年12月1日 下午12:57:33
+     */
+    public void copyPicture(XWPFRun targetRun, XWPFPicture sourcePicture) throws InvalidFormatException, IOException {
+        XWPFPictureData picData = sourcePicture.getPictureData();
+        String fileName = picData.getFileName();    //图片的名称
+        InputStream picInIsData = new ByteArrayInputStream(picData.getData());
+        int picType = picData.getPictureType();
+        int width = (int) sourcePicture.getCTPicture().getSpPr().getXfrm().getExt().getCx();
+        int height =  (int) sourcePicture.getCTPicture().getSpPr().getXfrm().getExt().getCy();
+        targetRun.addPicture(picInIsData, picType, fileName, width, height);
+//        targetRun.addBreak();//分行
+    }
+}

+ 8 - 0
src/main/java/platform/modules/company/dto/LandSupplyApprovalDto.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import platform.modules.government.entity.FileDown;
 
+import javax.persistence.Transient;
 import java.util.List;
 
 @Data
@@ -31,4 +32,11 @@ public class LandSupplyApprovalDto {
     private List<FileDown> fileDowns;
 
     private FileDown fileDown = new FileDown();
+
+    //会签说明
+    private String countersign_comment;
+
+    //会签 文件
+    private FileDown countersign_file = new FileDown();
+
 }

+ 7 - 0
src/main/java/platform/modules/government/entity/IndustrialLandSupplyDetail.java

@@ -147,4 +147,11 @@ public class IndustrialLandSupplyDetail extends BaseEntity {
     @Transient
     private FileDown final_file = new FileDown();
 
+    //会签说明
+    private String countersign_comment;
+
+    //会签 文件
+    @Transient
+    private FileDown countersign_file = new FileDown();
+
 }

+ 5 - 0
src/main/java/platform/modules/government/entity/IndustrialLandSupplyDistribution.java

@@ -6,6 +6,7 @@ import platform.common.base.model.BaseEntity;
 
 import javax.persistence.Table;
 import javax.persistence.Transient;
+import java.util.List;
 
 /**
  * 产业供地分发Entity
@@ -34,6 +35,10 @@ public class IndustrialLandSupplyDistribution extends BaseEntity {
     @Transient
     private FileDown distribution_file = new FileDown();
 
+    //分发文件
+    @Transient
+    private List<FileDown> distribution_file_list;
+
     //反馈
     private String feedback;
 

+ 191 - 39
src/main/resources/templates/admin/government/industrial_land_supply/distribute.html

@@ -92,7 +92,8 @@
 
         <div class="line">咨询问题</div>
         <div class="row cl">
-            <div class="col-xs-8 col-sm-9 col-xs-offset-2 col-sm-offset-1">
+            <label class="form-label col-xs-4 col-sm-2"></label>
+            <div class="formControls col-xs-8 col-sm-9">
                 <table class="table table-border table-bordered table-bg table-hover processTb">
                     <thead>
                     <tr class="text-c">
@@ -146,9 +147,31 @@
             </div>
         </div>
 
+        <div class="line">会签</div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-2"><span>会签说明:</span></label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <div th:utext="${data.countersign_comment}">
+                </div>
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-2"><span>文件:</span></label>
+            <div class="formControls col-xs-8 col-sm-9">
+                <div class="uploader-list">
+                    <th:block
+                            th:unless="${data.countersign_file==null || data.countersign_file.file_url== null}">
+                        <a style="color: #0c80fe;" th:href="${fileUrl} + ${data.countersign_file.file_url}"
+                           target="_blank">[[${data.countersign_file.file_name}]]</a>
+                    </th:block>
+                </div>
+            </div>
+        </div>
+
         <div class="line">预审审批</div>
         <div class="row cl">
-            <div class="col-xs-8 col-sm-9 col-xs-offset-2 col-sm-offset-1">
+            <label class="form-label col-xs-4 col-sm-2"></label>
+            <div class="formControls col-xs-8 col-sm-9">
                 <table class="table table-border table-bordered table-bg table-hover processTb">
                     <thead>
                     <tr class="text-c">
@@ -159,21 +182,21 @@
                     </tr>
                     </thead>
                     <tbody>
-<!--                    <tr class="text-c">-->
-<!--                        <td>商务局分管领导</td>-->
-<!--                        <td th:text="${data.commerce_leader_pre_approve_operate}" class="viewComment"-->
-<!--                            th:data="*{data.commerce_leader_pre_approve_operate}"></td>-->
-<!--                        <td th:text="${data.commerce_leader_pre_approve_comment}" class="viewComment"-->
-<!--                            th:data="*{data.commerce_leader_pre_approve_comment}"></td>-->
-<!--                        <td>-->
-<!--                            <th:block-->
-<!--                                    th:unless="${data.commerce_leader_pre_approve_file==null || data.commerce_leader_pre_approve_file.file_url== null}">-->
-<!--                                <a style="color: #0c80fe;"-->
-<!--                                   th:href="${fileUrl} + ${data.commerce_leader_pre_approve_file.file_url}"-->
-<!--                                   target="_blank">[[${data.commerce_leader_pre_approve_file.file_name}]]</a>-->
-<!--                            </th:block>-->
-<!--                        </td>-->
-<!--                    </tr>-->
+                    <!--                    <tr class="text-c">-->
+                    <!--                        <td>商务局分管领导</td>-->
+                    <!--                        <td th:text="${data.commerce_leader_pre_approve_operate}" class="viewComment"-->
+                    <!--                            th:data="*{data.commerce_leader_pre_approve_operate}"></td>-->
+                    <!--                        <td th:text="${data.commerce_leader_pre_approve_comment}" class="viewComment"-->
+                    <!--                            th:data="*{data.commerce_leader_pre_approve_comment}"></td>-->
+                    <!--                        <td>-->
+                    <!--                            <th:block-->
+                    <!--                                    th:unless="${data.commerce_leader_pre_approve_file==null || data.commerce_leader_pre_approve_file.file_url== null}">-->
+                    <!--                                <a style="color: #0c80fe;"-->
+                    <!--                                   th:href="${fileUrl} + ${data.commerce_leader_pre_approve_file.file_url}"-->
+                    <!--                                   target="_blank">[[${data.commerce_leader_pre_approve_file.file_name}]]</a>-->
+                    <!--                            </th:block>-->
+                    <!--                        </td>-->
+                    <!--                    </tr>-->
                     <tr class="text-c">
                         <td>管委会分管领导</td>
                         <td th:text="${data.committee_leader_pre_approve_operate}" class="viewComment"
@@ -197,35 +220,99 @@
     <form class="form form-horizontal" id="form-add">
         <input id="id" name="id" type="hidden" th:value="${data.id}"/>
         <div class="line">分发文件</div>
-        <div class="row cl">
+        <div class="row cl" th:id=" 'department0'">
             <label class="form-label col-xs-4 col-sm-2"><span>所有部门可见:</span></label>
+            <!--            <div class="formControls col-xs-8 col-sm-9">-->
+            <!--                <div class="uploader-thum-container">-->
+            <!--                    <input class="uploadFileName btn btn-upload radius" name="uploadFileName" readonly="readonly"-->
+            <!--                           type="text" value="上传文件"-->
+            <!--                           th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile'+'\',this);'"/>-->
+            <!--                    <input class="uploadFileId" type="hidden"-->
+            <!--                           th:name="'distributionList[20].distribution_file.file_id'"/>-->
+            <!--                    <input class="departmentId" type="hidden" value="0"-->
+            <!--                           th:name="'distributionList[20].department_id'"/>-->
+            <!--                    <a style="color: #0c80fe;" th:onclick="'javascript:deleteFile(this)'">删除</a>-->
+            <!--                </div>-->
+            <!--            </div>-->
             <div class="formControls col-xs-8 col-sm-9">
-                <div class="uploader-thum-container">
-                    <input class="uploadFileName btn btn-upload radius" name="uploadFileName" readonly="readonly"
-                           type="text" value="上传文件"
-                           th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile'+'\',this);'"/>
-                    <input class="uploadFileId" type="hidden"
-                           th:name="'distributionList[20].distribution_file.file_id'"/>
-                    <input class="departmentId" type="hidden" value="0"
-                           th:name="'distributionList[20].department_id'"/>
-                    <a style="color: #0c80fe;" th:onclick="'javascript:deleteFile(this)'">删除</a>
-                </div>
+                <div><i class="Hui-iconfont" style="cursor: pointer;"
+                        th:onclick="'javascript:addFileLineS(\'department0\')'">&#xe600; 添加</i></div>
+                <table class="table table-border table-bordered table-bg table-hover ">
+                    <thead>
+                    <tr class="text-c">
+                        <th>文件</th>
+                        <th>操作</th>
+                    </tr>
+                    </thead>
+                    <tbody class="add_file_line" th:id="'tbody_department0'">
+                    <!--                    <tr class="text-c"-->
+                    <!--                        th:each="landSupplyCons,landSupplyConsStat: ${industrialLandSupplyConsultationList}"-->
+                    <!--                        th:if="*{item.id+''==landSupplyCons.department_id}">-->
+                    <tr class="text-c">
+                        <td class="td_material">
+                            <div>
+                                <input class="uploadFileName btn btn-upload radius" name="uploadFileName"
+                                       readonly="readonly"
+                                       type="text" value="上传文件"
+                                       th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile\',this);'"/>
+                                <input class="uploadFileId distribution" type="hidden"
+                                       th:name="'distributionList[99].distribution_file.file_id'"/>
+                                <input class="department_id" type="hidden" value="0"
+                                       th:name="'distributionList[99].department_id'"/>
+                            </div>
+                        </td>
+                        <td class="icon_font"><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
             </div>
         </div>
         <th:block th:each="item,itemStat : ${distDepartmentList}">
-            <div class="row cl">
+            <div class="row cl" th:id="'department'+${item.id}">
                 <label class="form-label col-xs-4 col-sm-2"><span>[[${item.name}]]可见:</span></label>
                 <div class="formControls col-xs-8 col-sm-9">
-                    <div class="uploader-thum-container">
-                        <input class="uploadFileName btn btn-upload radius" name="uploadFileName" readonly="readonly"
-                               type="text" value="上传文件"
-                               th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile'+'\',this);'"/>
-                        <input class="uploadFileId" type="hidden"
-                               th:name="'distributionList['+${itemStat.index}+'].distribution_file.file_id'"/>
-                        <input class="departmentId" type="hidden" th:value="${item.id}"
-                               th:name="'distributionList['+${itemStat.index}+'].department_id'"/>
-                        <a style="color: #0c80fe;" th:onclick="'javascript:deleteFile(this)'">删除</a>
-                    </div>
+                    <!--                    <div class="uploader-thum-container">-->
+                    <!--                        <input class="uploadFileName btn btn-upload radius" name="uploadFileName" readonly="readonly"-->
+                    <!--                               type="text" value="上传文件"-->
+                    <!--                               th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile'+'\',this);'"/>-->
+                    <!--                        <input class="uploadFileId" type="hidden"-->
+                    <!--                               th:name="'distributionList['+${itemStat.index}+'].distribution_file.file_id'"/>-->
+                    <!--                        <input class="departmentId" type="hidden" th:value="${item.id}"-->
+                    <!--                               th:name="'distributionList['+${itemStat.index}+'].department_id'"/>-->
+                    <!--                        <a style="color: #0c80fe;" th:onclick="'javascript:deleteFile(this)'">删除</a>-->
+                    <!--                    </div>-->
+                    <div><i class="Hui-iconfont" style="cursor: pointer;"
+                            th:onclick="'javascript:addFileLine(\''+'department'+${item.id}+'\')'">&#xe600; 添加</i></div>
+                    <table class="table table-border table-bordered table-bg table-hover ">
+                        <thead>
+                        <tr class="text-c">
+                            <th>文件</th>
+                            <th>操作</th>
+                        </tr>
+                        </thead>
+                        <tbody class="add_file_line" th:id="'tbody_department'+${item.id}">
+                        <!--                        <tr class="text-c"-->
+                        <!--                            th:each="landSupplyCons,landSupplyConsStat: ${industrialLandSupplyConsultationList}"-->
+                        <!--                            th:if="*{item.id+''==landSupplyCons.department_id}">-->
+                        <tr class="text-c">
+                            <td class="td_material">
+                                <div>
+                                    <input class="uploadFileName btn btn-upload radius" name="uploadFileName"
+                                           readonly="readonly"
+                                           type="text" value="上传文件"
+                                           th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile\',this);'"/>
+                                    <input class="uploadFileId distribution" type="hidden"
+                                           th:name="'distributionList[10'+${itemStat.index}+'].distribution_file.file_id'"/>
+                                    <input class="department_id" type="hidden" th:value="${item.id}"
+                                           th:name="'distributionList[10'+${itemStat.index}+'].department_id'"/>
+                                </div>
+                            </td>
+                            <td class="icon_font"><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>
+                            </td>
+                        </tr>
+                        </tbody>
+                    </table>
                 </div>
             </div>
         </th:block>
@@ -294,6 +381,71 @@
         var index = parent.layer.getFrameIndex(window.name);
         parent.layer.close(index);
     }
+
+    var distDepartmentList = [[${distDepartmentList}]];
+    var index = distDepartmentList.length;
+
+    function addFileLine(divId) {
+        var length = index;
+        if ($("#" + divId).find('.add_file_line>tr').length > 0) {
+            var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>";
+            $("#" + divId).find(".add_file_line  tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
+                .find(".distribution").removeAttr("name").attr("name", "distributionList[" + length + "].distribution_file.file_id").val("").end()
+                .find(".department_id").removeAttr("name").attr("name", "distributionList[" + length + "].department_id").end()
+                .find(".uploadFileName").val("上传文件").end()
+                .find(".icon_font").html(html).end();
+        } else {
+            var str = "";
+            str += "<tr class='text-c'>"
+            str += "<td class='td_material'>"
+            str += "<div>"
+            str += "<input class='uploadFileName btn btn-upload radius' name='uploadFileName' readonly='readonly' type='text' value='上传文件' onclick=\"addFileByName('/land_supply/addApplyFile',this);\"/>"
+            str += "<input class='uploadFileId distribution' hidden name='distributionList[" + length + "].distribution_file.file_id'/>"
+            str += "<input class='department_id' hidden value='" + divId.split("department")[1] + "' name='distributionList[" + length + "].department_id' />"
+            str += "</div>"
+            str += "</td>"
+            str += "<td class='icon_font'><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>"
+            str += "</td>"
+            str += "</tr>"
+
+            $("#tbody_" + divId).html(str);
+        }
+        $('#layui-layer2').height(48);
+        index++;
+    }
+
+    function addFileLineS(divId) {
+        var length = index;
+        if ($("#" + divId).find('.add_file_line>tr').length > 0) {
+            var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>";
+            $("#" + divId).find(".add_file_line  tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
+                .find(".distribution").removeAttr("name").attr("name", "distributionList[" + length + "].distribution_file.file_id").val("").end()
+                .find(".department_id").removeAttr("name").attr("name", "distributionList[" + length + "].department_id").end()
+                .find(".uploadFileName").val("上传文件").end()
+                .find(".icon_font").html(html).end();
+        } else {
+            var str = "";
+            str += "<tr class='text-c'>"
+            str += "<td class='td_material'>"
+            str += "<div>"
+            str += "<input class='uploadFileName btn btn-upload radius' name='uploadFileName' readonly='readonly' type='text' value='上传文件' onclick=\"addFileByName('/land_supply/addApplyFile',this);\"/>"
+            str += "<input class='uploadFileId distribution' hidden name='distributionList[" + length + "].distribution_file.file_id'/>"
+            str += "<input class='department_id' hidden value='0' name='distributionList[" + length + "].department_id' />"
+            str += "</div>"
+            str += "</td>"
+            str += "<td class='icon_font'><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>"
+            str += "</td>"
+            str += "</tr>"
+
+            $("#tbody_" + divId).html(str);
+        }
+        $('#layui-layer2').height(48);
+        index++;
+    }
+
+    function removeLine(obj) {
+        $(obj).parent().parent().remove();
+    }
 </script>
 </body>
 </html>

+ 16 - 12
src/main/resources/templates/admin/government/industrial_land_supply/distribute_feedback.html

@@ -131,30 +131,33 @@
 
     <form class="form form-horizontal" id="form-add">
         <div class="line">分发反馈</div>
+        <th:block th:each="item,itemStat: ${departmentFile}">
+            <th:block th:unless="${item == null || item.file_url == null}">
+                <div class="row cl">
+                    <label class="form-label col-xs-4 col-sm-2"><span th:if="${itemStat.index==0}">公共文件:</span></label>
+                    <div class="formControls col-xs-8 col-sm-9">
+                        <div class="uploader-list">
+                            <a style="color: #0c80fe;" th:href="${fileUrl} + ${item.file_url}"
+                               target="_blank">[[${item.file_name}]]</a>
+                        </div>
+                    </div>
+                </div>
+            </th:block>
+        </th:block>
         <th:block th:each="item,itemStat: ${data.distributionList}">
             <input hidden th:name="'distributionList['+${itemStat.index}+'].id'" th:value="${item.id}"/>
             <div class="row cl">
                 <label class="form-label col-xs-4 col-sm-2"><span>部门文件:</span></label>
                 <div class="formControls col-xs-8 col-sm-9">
                     <div class="uploader-list">
-                        <th:block th:unless="${item.distribution_file == null || item.distribution_file.file_url == null}">
+                        <th:block
+                                th:unless="${item.distribution_file == null || item.distribution_file.file_url == null}">
                             <a style="color: #0c80fe;" th:href="${fileUrl} + ${item.distribution_file.file_url}"
                                target="_blank">[[${item.distribution_file.file_name}]]</a>
                         </th:block>
                     </div>
                 </div>
             </div>
-            <div class="row cl">
-                <label class="form-label col-xs-4 col-sm-2"><span>公共文件:</span></label>
-                <div class="formControls col-xs-8 col-sm-9">
-                    <div class="uploader-list">
-                        <th:block th:unless="${departmentFile == null || departmentFile.file_url == null}">
-                            <a style="color: #0c80fe;" th:href="${fileUrl} + ${departmentFile.file_url}"
-                               target="_blank">[[${departmentFile.file_name}]]</a>
-                        </th:block>
-                    </div>
-                </div>
-            </div>
             <div class="row cl">
                 <label class="form-label col-xs-4 col-sm-2">反馈内容:</label>
                 <div class="formControls col-xs-8 col-sm-9">
@@ -181,6 +184,7 @@
                     </div>
                 </div>
             </div>
+            <div class="line"></div>
         </th:block>
 
         <div class="row cl text-c" style="background-color: white">