Просмотр исходного кода

年度预算修改记录功能实现

梁世豪 месяцев назад: 10
Родитель
Сommit
3cda4be624

+ 57 - 12
src/main/java/com/liang/controller/PrjAnnualBudgetRecordController.java

@@ -1,21 +1,28 @@
1 1
 package com.liang.controller;
2
+import com.google.common.collect.Lists;
2 3
 
3 4
 import com.github.pagehelper.PageHelper;
4 5
 import com.github.pagehelper.PageInfo;
5 6
 import com.liang.common.base.BaseController;
6 7
 import com.liang.common.base.BaseResult;
8
+import com.liang.common.enums.PostInfoEnum;
7 9
 import com.liang.entity.*;
8
-import com.liang.service.PrjAnnualBudgetRecordService;
9
-import com.liang.service.PrjAnnualbudgetdetailService;
10
+import com.liang.service.*;
10 11
 import org.apache.ibatis.annotations.Select;
11 12
 import org.springframework.stereotype.Controller;
13
+import org.springframework.transaction.annotation.Transactional;
12 14
 import org.springframework.ui.Model;
13 15
 import org.springframework.web.bind.annotation.*;
14 16
 
15 17
 import javax.annotation.Resource;
18
+import java.sql.Date;
19
+import java.time.LocalDateTime;
20
+import java.time.format.DateTimeFormatter;
21
+import java.util.ArrayList;
16 22
 import java.util.HashMap;
17 23
 import java.util.List;
18 24
 import java.util.Map;
25
+import java.util.stream.Collectors;
19 26
 
20 27
 /**
21 28
  * 年度预算修改记录控制器
@@ -29,23 +36,48 @@ public class PrjAnnualBudgetRecordController extends BaseController {
29 36
     @Resource
30 37
     private  PrjAnnualbudgetdetailService prjAnnualbudgetdetailService;
31 38
 
39
+    @Resource
40
+    private PrjAnnualbudgetXgjlService prjAnnualbudgetXgjlService;
41
+
42
+    @Resource
43
+    private PrjAnnualbudgetService prjAnnualbudgetService;
44
+
45
+    @Resource
46
+    private SysPostInfoService sysPostInfoService;
47
+    @Resource
48
+    private PrjApproverecordService prjApproverecordService;
49
+
32 50
     /**
33 51
      * 在年度预算修改记录表中添加修改前的数据(年度预算明细)
34 52
      *
35
-     * @param ndys 年度预算ID
53
+     * @param nys 年度预算ID
36 54
      * @return
37 55
      */
38 56
     @ResponseBody
39 57
     @PostMapping("/addBudgetRecord/{ysId}")
40
-    public BaseResult addBudgetRecord(@PathVariable("ysId") Integer ndys) {
41
-        System.out.println("进入了添加预算的方法");
42
-        List<PrjAnnualBudgetRecord> prjAnnualBudgetRecords = prjAnnualBudgetRecordService.queryDetailByNys(ndys, getSysUserInfo().getUserId());
43
-        if (prjAnnualBudgetRecords != null) {
44
-            prjAnnualBudgetRecordService.addHistoryRecord(prjAnnualBudgetRecords);
45
-            return BaseResult.success("添加成功");
46
-        } else {
47
-            return BaseResult.failure("未查询到该年度预算明细");
58
+    @Transactional
59
+    public BaseResult addBudgetRecord(@PathVariable("ysId") Integer nys) {
60
+//        1.获取年度预算明细列表中的数据
61
+        List<PrjAnnualbudgetdetail> xgjl = prjAnnualbudgetdetailService.getXGJL(nys);
62
+//        查询当前为第几次记录
63
+        List<PrjAnnualbudgetXgjl> xgjls = prjAnnualbudgetXgjlService.getXGJL(nys);
64
+//        获取当前年度预算审批状态
65
+        PrjAnnualbudget prjAnnualbudget = prjAnnualbudgetService.queryById(nys);
66
+        int xh = xgjls.size()+1;
67
+        List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList = new ArrayList<>();
68
+        for (int i = 0; i < xgjl.size(); i++) {
69
+            PrjAnnualbudgetXgjl prjAnnualbudgetXgjl= new PrjAnnualbudgetXgjl();
70
+            prjAnnualbudgetXgjl.setNys(nys);
71
+            prjAnnualbudgetXgjl.setFymc(xgjl.get(i).getFymc());
72
+            prjAnnualbudgetXgjl.setXg(xgjl.get(i).getXgjlxz());
73
+            prjAnnualbudgetXgjl.setXgrq(new Date(System.currentTimeMillis()).toString());
74
+            prjAnnualbudgetXgjl.setXh(xh);
75
+            prjAnnualbudgetXgjlList.add(prjAnnualbudgetXgjl);
76
+        }
77
+        if (prjAnnualbudget.getSpzt().equals("审批结束")){
78
+            prjAnnualbudgetXgjlService.batchinsertXGJL(prjAnnualbudgetXgjlList);
48 79
         }
80
+        return BaseResult.success();
49 81
     }
50 82
 
51 83
     /**
@@ -67,7 +99,6 @@ public class PrjAnnualBudgetRecordController extends BaseController {
67 99
                              @RequestParam(required = false, defaultValue = "", value = "sortName") String sortName,
68 100
                              @RequestParam(required = false, defaultValue = "", value = "sortOrder") String sortOrder) {
69 101
         PageHelper.startPage(pageNum, pageSize);
70
-//        List<PrjAnnualBudgetRecord> list = prjAnnualBudgetRecordService.queryRecordByNdysid(xmid);
71 102
         List<PrjAnnualbudgetdetail> list = prjAnnualbudgetdetailService.getXGJL(xmid);
72 103
         PageInfo<PrjAnnualbudgetdetail> pageinfo = new PageInfo<>(list);
73 104
         //取出查询结果
@@ -79,6 +110,20 @@ public class PrjAnnualBudgetRecordController extends BaseController {
79 110
 
80 111
         return BaseResult.success(result);
81 112
     }
113
+    @ResponseBody
114
+    @RequestMapping(value = "/addUpdateApplyRecord", method = RequestMethod.POST)
115
+    @Transactional
116
+    public BaseResult addUpdateApplyRecord(
117
+                             @RequestParam("budgets") List<PrjAnnualBudgetRecord> record) {
118
+//插入到修改申请表中
119
+        int i = prjAnnualBudgetRecordService.addHistoryRecord(record);
120
+
121
+        if (i>0){
122
+            return BaseResult.success();
123
+        }else {
124
+            return BaseResult.failure("");
125
+        }
126
+    }
82 127
 
83 128
 
84 129
 }

+ 39 - 0
src/main/java/com/liang/controller/PrjAnnualbudgetController.java

@@ -590,6 +590,44 @@ public class PrjAnnualbudgetController extends BaseController {
590 590
 
591 591
         return "annualbudget/update_annualbudget";
592 592
     }
593
+    /**
594
+     * 修改申请
595
+     *
596
+     * @return
597
+     */
598
+    @RequestMapping(value = "/forUpdateApply/{id}", method = RequestMethod.GET)
599
+    public String forUpdateApply(Model model, @PathVariable Integer id) {
600
+        PrjAnnualbudget annualbudget = prjAnnualbudgetService.queryById(id);
601
+        model.addAttribute("annualbudget", annualbudget);
602
+
603
+        String xmzxq = annualbudget.getXmzxq();
604
+        model.addAttribute("qs", xmzxq.substring(0, 4));
605
+        int index = xmzxq.trim().indexOf("至") + 2;
606
+        model.addAttribute("wc", xmzxq.substring(index, index + 4));
607
+
608
+        PrjProject project = prjProjectService.queryById(annualbudget.getRws());
609
+        model.addAttribute("rwsys", project.getYsje());
610
+
611
+        Map<String, String> paraMap = new HashMap<>();
612
+        if (ProjectTypeEnnum.ZFLXM.msg().equals(annualbudget.getXmlxmc())) {
613
+            List<Integer> nfList = prjFeeschemeService.getYearList(annualbudget.getRws());
614
+            paraMap.put("xm", annualbudget.getRws().toString());
615
+            paraMap.put("nf", nfList.get(nfList.size() - 1).toString());
616
+        } else {
617
+            paraMap.put("xm", annualbudget.getRws().toString());
618
+            paraMap.put("nf", annualbudget.getNf());
619
+        }
620
+        Double ndczje;
621
+        if (ProjectTypeEnnum.GWGSKJXM.msg().equals((annualbudget.getXmlxmc()))) {
622
+            ndczje = prjFeeschemeService.getNdFeeSchemeofDKY(paraMap);
623
+        } else {
624
+            ndczje = prjFeeschemeService.getNdFeeScheme(paraMap);
625
+
626
+        }
627
+        model.addAttribute("ndczje", ndczje);
628
+
629
+        return "annualbudget/updateApply_annualbudget";
630
+    }
593 631
 
594 632
 
595 633
     /**
@@ -866,5 +904,6 @@ public class PrjAnnualbudgetController extends BaseController {
866 904
 
867 905
         ExcelPoiUtil.excelPort("年度预算", listName, list, null, response);
868 906
     }
907
+
869 908
 }
870 909
 

+ 36 - 0
src/main/java/com/liang/controller/PrjAnnualbudgetXgjlController.java

@@ -0,0 +1,36 @@
1
+package com.liang.controller;
2
+
3
+import com.liang.common.JsonTool;
4
+import com.liang.entity.PrjAnnualbudgetXgjl;
5
+import com.liang.service.PrjAnnualbudgetService;
6
+import com.liang.service.PrjAnnualbudgetXgjlService;
7
+import com.liang.vo.PrjAnnualbudgetNfVo;
8
+import com.liang.vo.PrjAnnualbudgetYzxqkVo;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.stereotype.Controller;
11
+import org.springframework.web.bind.annotation.*;
12
+
13
+import javax.annotation.Resource;
14
+import java.util.List;
15
+import java.util.stream.Collectors;
16
+
17
+@Controller
18
+@Slf4j
19
+@RequestMapping("prjAnnualbudgetXgjl")
20
+public class PrjAnnualbudgetXgjlController {
21
+
22
+    @Resource
23
+    private PrjAnnualbudgetXgjlService prjAnnualbudgetXgjlService;
24
+
25
+    /**
26
+     * 获取项目修改记录
27
+     *
28
+     * @return
29
+     */
30
+    @ResponseBody
31
+    @RequestMapping(value = "/getXGJL/{nys}", method = RequestMethod.POST)
32
+    public Object getXGJL(@PathVariable Integer nys) {
33
+        List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList=prjAnnualbudgetXgjlService.getXGJL(nys);
34
+        return JsonTool.toJsonString(prjAnnualbudgetXgjlList);
35
+    }
36
+}

+ 16 - 0
src/main/java/com/liang/dao/PrjAnnualbudgetXgjlDao.java

@@ -0,0 +1,16 @@
1
+package com.liang.dao;
2
+
3
+import com.liang.entity.PrjAnnualbudgetXgjl;
4
+import org.apache.ibatis.annotations.Param;
5
+
6
+import java.util.List;
7
+
8
+public interface PrjAnnualbudgetXgjlDao {
9
+    List<PrjAnnualbudgetXgjl> getXGJL(Integer nys);
10
+
11
+    List<PrjAnnualbudgetXgjl> getXG(@Param("xh") int i, @Param("nys") Integer nys);
12
+
13
+    void insertXGJL(@Param("xgjl") PrjAnnualbudgetXgjl prjAnnualbudgetXgjl);
14
+
15
+    void batchinsertXGJL(@Param("xgjlList") List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList);
16
+}

+ 36 - 0
src/main/java/com/liang/entity/PrjAnnualbudgetXgjl.java

@@ -0,0 +1,36 @@
1
+package com.liang.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+import java.util.List;
8
+
9
+@Data
10
+@AllArgsConstructor
11
+@NoArgsConstructor
12
+public class PrjAnnualbudgetXgjl {
13
+
14
+    private Integer id;
15
+//    年度预算id
16
+    private Integer nys;
17
+//     费用名称
18
+    private String fymc;
19
+//    修改内容
20
+    private String xg;
21
+//    修改日期
22
+    private String  xgrq;
23
+//    修改序号
24
+    private Integer xh;
25
+//    修改记录
26
+    private List<PrjAnnualbudgetXgjl> xglist;
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+}

+ 11 - 0
src/main/java/com/liang/entity/PrjAnnualbudgetdetail.java

@@ -213,5 +213,16 @@ public class PrjAnnualbudgetdetail implements Serializable {
213 213
     private BigDecimal bndsqje;
214 214
     private BigDecimal bndbzje;
215 215
 
216
+    private String xg1;
217
+    private String xg2;
218
+    private String xg3;
219
+    private String xg4;
220
+    private String xg5;
221
+    private String xg6;
222
+    private String xg7;
223
+    private String xg8;
224
+    private String xg9;
225
+    private String xg10;
226
+
216 227
 }
217 228
 

+ 16 - 0
src/main/java/com/liang/service/PrjAnnualbudgetXgjlService.java

@@ -0,0 +1,16 @@
1
+package com.liang.service;
2
+
3
+import com.liang.entity.PrjAnnualbudgetXgjl;
4
+import org.springframework.stereotype.Service;
5
+
6
+import java.util.List;
7
+
8
+public interface PrjAnnualbudgetXgjlService {
9
+    List<PrjAnnualbudgetXgjl> getXGJL(Integer nys);
10
+
11
+    List<PrjAnnualbudgetXgjl> getXG(int i,Integer nys);
12
+
13
+    void insertXGJL(PrjAnnualbudgetXgjl prjAnnualbudgetXgjl);
14
+
15
+    void batchinsertXGJL(List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList);
16
+}

+ 35 - 0
src/main/java/com/liang/service/impl/PrjAnnualbudgetXgjlServiceImpl.java

@@ -0,0 +1,35 @@
1
+package com.liang.service.impl;
2
+
3
+import com.liang.dao.PrjAnnualbudgetXgjlDao;
4
+import com.liang.entity.PrjAnnualbudgetXgjl;
5
+import com.liang.service.PrjAnnualbudgetXgjlService;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service("prjAnnualbudgetXgjlService")
12
+public class PrjAnnualbudgetXgjlServiceImpl implements PrjAnnualbudgetXgjlService {
13
+    @Resource
14
+    private PrjAnnualbudgetXgjlDao prjAnnualbudgetXgjlDao;
15
+
16
+    @Override
17
+    public List<PrjAnnualbudgetXgjl> getXGJL(Integer nys) {
18
+        return this.prjAnnualbudgetXgjlDao.getXGJL(nys);
19
+    }
20
+
21
+    @Override
22
+    public List<PrjAnnualbudgetXgjl> getXG(int i,Integer nys) {
23
+        return this.prjAnnualbudgetXgjlDao.getXG(i,nys);
24
+    }
25
+
26
+    @Override
27
+    public void insertXGJL(PrjAnnualbudgetXgjl prjAnnualbudgetXgjl) {
28
+        prjAnnualbudgetXgjlDao.insertXGJL(prjAnnualbudgetXgjl);
29
+    }
30
+
31
+    @Override
32
+    public void batchinsertXGJL(List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList) {
33
+        prjAnnualbudgetXgjlDao.batchinsertXGJL(prjAnnualbudgetXgjlList);
34
+    }
35
+}

+ 56 - 0
src/main/java/com/liang/service/impl/PrjAnnualbudgetdetailServiceImpl.java

@@ -1,11 +1,14 @@
1 1
 package com.liang.service.impl;
2 2
 
3
+import com.liang.dao.PrjAnnualbudgetXgjlDao;
3 4
 import com.liang.dao.PrjBudgetDao;
4 5
 import com.liang.dao.PrjCompletecompanyDao;
6
+import com.liang.entity.PrjAnnualbudgetXgjl;
5 7
 import com.liang.entity.PrjAnnualbudgetdetail;
6 8
 import com.liang.dao.PrjAnnualbudgetdetailDao;
7 9
 import com.liang.entity.PrjBudget;
8 10
 import com.liang.entity.PrjCompletecompany;
11
+import com.liang.service.PrjAnnualbudgetXgjlService;
9 12
 import com.liang.service.PrjAnnualbudgetdetailService;
10 13
 import org.springframework.stereotype.Service;
11 14
 import org.springframework.data.domain.Page;
@@ -32,6 +35,9 @@ public class PrjAnnualbudgetdetailServiceImpl implements PrjAnnualbudgetdetailSe
32 35
     @Resource
33 36
     private PrjCompletecompanyDao prjCompletecompanyDao;
34 37
 
38
+    @Resource
39
+    private PrjAnnualbudgetXgjlService prjAnnualbudgetXgjlService;
40
+
35 41
 
36 42
     /**
37 43
      * 通过ID查询单条数据
@@ -241,6 +247,56 @@ public class PrjAnnualbudgetdetailServiceImpl implements PrjAnnualbudgetdetailSe
241 247
           String xgjlxz = xgjl.get(i).getXmz() + ","+xgjl.get(i).getYsje()+","+xgjl.get(i).getByj();
242 248
           xgjl.get(i).setXgjlxz(xgjlxz);
243 249
         }
250
+        List<PrjAnnualbudgetXgjl> prjAnnualbudgetXgjlList=prjAnnualbudgetXgjlService.getXGJL(xmid);
251
+//        获取修改记录
252
+        for (int i = 0; i < prjAnnualbudgetXgjlList.size(); i++) {
253
+            int k=i+1;
254
+            List<PrjAnnualbudgetXgjl> xg   =prjAnnualbudgetXgjlService.getXG(k,xmid);
255
+            switch (k){
256
+                case 1:
257
+                    for (int j = 0; j < xg.size(); j++) {
258
+                        xgjl.get(j).setXg1(xg.get(j).getXg());
259
+                    };break;
260
+                case 2:
261
+                    for (int j = 0; j < xg.size(); j++) {
262
+                        xgjl.get(j).setXg2(xg.get(j).getXg());
263
+                    };break;
264
+                case 3:
265
+                    for (int j = 0; j < xg.size(); j++) {
266
+                        xgjl.get(j).setXg3(xg.get(j).getXg());
267
+                    };break;
268
+                case 4:
269
+                    for (int j = 0; j < xg.size(); j++) {
270
+                        xgjl.get(j).setXg4(xg.get(j).getXg());
271
+                    };break;
272
+                case 5:
273
+                    for (int j = 0; j < xg.size(); j++) {
274
+                        xgjl.get(j).setXg5(xg.get(j).getXg());
275
+                    };break;
276
+                case 6:
277
+                    for (int j = 0; j < xg.size(); j++) {
278
+                        xgjl.get(j).setXg6(xg.get(j).getXg());
279
+                    };break;
280
+                case 7:
281
+                    for (int j = 0; j < xg.size(); j++) {
282
+                        xgjl.get(j).setXg7(xg.get(j).getXg());
283
+                    };break;
284
+                case 8:
285
+                    for (int j = 0; j < xg.size(); j++) {
286
+                        xgjl.get(j).setXg8(xg.get(j).getXg());
287
+                    };break;
288
+                case 9:
289
+                    for (int j = 0; j < xg.size(); j++) {
290
+                        xgjl.get(j).setXg9(xg.get(j).getXg());
291
+                    };break;
292
+                case 10:
293
+                    for (int j = 0; j < xg.size(); j++) {
294
+                        xgjl.get(j).setXg10(xg.get(j).getXg());
295
+                    };break;
296
+            }
297
+
298
+        }
299
+
244 300
         return xgjl;
245 301
     }
246 302
 

+ 39 - 0
src/main/resources/mapper/PrjAnnualbudgetXgjlDao.xml

@@ -0,0 +1,39 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.liang.dao.PrjAnnualbudgetXgjlDao">
4
+    <resultMap type="com.liang.entity.PrjAnnualbudgetXgjl" id="PrjAnnualbudgetXgjlMap">
5
+    <result property="id" column="ID" jdbcType="INTEGER"/>
6
+    <result property="nys" column="NYS" jdbcType="INTEGER"/>
7
+    <result property="fymc" column="FYMC" jdbcType="VARCHAR"/>
8
+    <result property="xg" column="XG" jdbcType="VARCHAR"/>
9
+    <result property="xh" column="XH" jdbcType="INTEGER"/>
10
+    <result property="xgrq" column="XGRQ" jdbcType="DATE"/>
11
+    </resultMap>
12
+    <insert id="insertXGJL" keyProperty="id" useGeneratedKeys="true">
13
+        INSERT INTO prj_AnnualBudget_xgjl (nys, fymc, xg, xgrq, xh)
14
+        VALUES (#{xgjl.nys},#{xgjl.fymc}, #{xgjl.xg}, #{xgjl.xgrq}, #{xgjl.xh});
15
+    </insert>
16
+    <insert id="batchinsertXGJL" keyProperty="id" useGeneratedKeys="true">
17
+        INSERT INTO prj_AnnualBudget_xgjl (nys, fymc, xg, xgrq, xh)
18
+        VALUES
19
+        <foreach collection="xgjlList" item="xgjl" separator=",">
20
+        (#{xgjl.nys},#{xgjl.fymc}, #{xgjl.xg}, #{xgjl.xgrq}, #{xgjl.xh})
21
+        </foreach>
22
+    </insert>
23
+    <select id="getXGJL" resultType="com.liang.entity.PrjAnnualbudgetXgjl">
24
+        SELECT XH,xgrq
25
+        FROM prj_AnnualBudget_xgjl
26
+        WHERE NYS = #{nys}
27
+        GROUP BY XH,xgrq
28
+        ORDER BY XH ASC
29
+    </select>
30
+    <select id="getXG" resultType="com.liang.entity.PrjAnnualbudgetXgjl">
31
+        SELECT b.FYMC,a.xg
32
+        FROM prj_AnnualBudget_xgjl a
33
+                 RIGHT JOIN prj_AnnualBudgetDetail b on a.nys=b.nys and a.fymc = b.FYMC
34
+        WHERE a.NYS = #{nys}
35
+          AND  a.XH = #{xh}
36
+    </select>
37
+
38
+
39
+</mapper>

+ 20 - 21
src/main/resources/templates/annualbudget/update_annualbudget.html

@@ -615,30 +615,29 @@
615 615
                 success: function (res) {
616 616
                     layer.close(index);
617 617
                     if (res.code === 0) {
618
-
619
-                    } else {
620
-                        Message.error("修改记录添加失败", 2000);
621
-                    }
622
-                }
623
-            });
624
-            AjaxUtil.post({
625
-                url: AjaxUtil.ctx + "prjAnnualbudgetdetail/doUpdate",
626
-                contentType: "application/json",
627
-                data: JSON.stringify(budgets),
628
-                success: function (res) {
629
-                    if (res.code === 0) {
630
-                        Message.success(1500, res.message, function () {
631
-                            loadTreetable();
632
-                            parent.setUpdateFlag();
633
-                            parent.layer.close(parent.layer.getFrameIndex(window.name));// 关闭子窗口
618
+                        AjaxUtil.post({
619
+                            url: AjaxUtil.ctx + "prjAnnualbudgetdetail/doUpdate",
620
+                            contentType: "application/json",
621
+                            data: JSON.stringify(budgets),
622
+                            success: function (res) {
623
+                                if (res.code === 0) {
624
+                                    Message.success(1500, res.message, function () {
625
+                                        loadTreetable();
626
+                                        parent.setUpdateFlag();
627
+                                        parent.layer.close(parent.layer.getFrameIndex(window.name));// 关闭子窗口
628
+                                    });
629
+                                } else {
630
+                                    Message.error(res.message, 1000);
631
+                                }
632
+                                layer.close(index);
633
+                            },
634
+                            error: function (error) {
635
+                                layer.close(index);
636
+                            }
634 637
                         });
635 638
                     } else {
636
-                        Message.error(res.message, 1000);
639
+                        Message.error("修改记录添加失败", 2000);
637 640
                     }
638
-                    layer.close(index);
639
-                },
640
-                error: function (error) {
641
-                    layer.close(index);
642 641
                 }
643 642
             });
644 643
         });

+ 31 - 16
src/main/resources/templates/annualbudget/view_record.html

@@ -36,35 +36,50 @@
36 36
 <script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
37 37
 <script th:inline="javascript" type="text/javascript">
38 38
     AjaxUtil.ctx = /*[[@{/}]]*/'';
39
-    layui.use(['form', 'table'], function () {
39
+    layui.use(['form', 'treeTable', 'tableSelect', 'laydate','table'], function () {
40 40
 
41 41
         var form = layui.form,
42 42
             table = layui.table;
43
-
44 43
         var xmApprove = parent.getXmApproval();
45 44
         $("#xm").val(xmApprove.xm);
46 45
         form.render();
47 46
 
47
+        var xgjl = new Array();
48
+        $.ajax({
49
+            url: AjaxUtil.ctx + 'prjAnnualbudgetXgjl/getXGJL/' + xmApprove.xmid,
50
+            type: "post",
51
+            async: false,
52
+            dataType: "json",
53
+            success: function (result) {
54
+                xgjl = result;
55
+            }
56
+        });
57
+        var field = '';
58
+        var title = '修改';
59
+        var dynamicColumns = [];
60
+
61
+        for (var i = 0; i < xgjl.length; i++) {
62
+            field = 'xg'+xgjl[i].xh;
63
+            title = xgjl[i].xgrq+'修改';
64
+            dynamicColumns.push({field: field, width: '13%', title: title});
65
+        }
66
+        var newcols =[
67
+            {type: 'numbers', align: 'center'},
68
+            {field: 'fymc', width: '15%', title: '费用名称'},
69
+            {field: 'nf', width: '7%', title: '年份'},
70
+            {field: 'xmzys', width: '5%', title: '项目总预算'},
71
+            {field: 'sptgzt', width: '10%', title: '审批通过状态'},
72
+            {field: 'xgjlxz', width: '13%', title: '现在'},
73
+        ].concat(dynamicColumns);
48 74
         var currTable = table.render({
49 75
             elem: '#currentTableId',
50 76
             url: AjaxUtil.ctx + 'PrjAnnualBudgetRecord/redordData/' + xmApprove.xmid,
51 77
             method: 'post',
52
-            // toolbar: '#toolbarDemo',
53
-            // defaultToolbar: ['filter', 'exports', 'print'],
54
-            cols: [
55
-                [
56
-                    {type: 'numbers', align: 'center'},
57
-                    {field: 'fymc', width: '20%', title: '费用名称'},
58
-                    {field: 'nf', width: '10%', title: '年份'},
59
-                    {field: 'xmzys', width: '20%', title: '项目总预算'},
60
-                    {field: 'sptgzt', width: '20%', title: '审批通过状态'},
61
-                    {field: 'xgjlxz', width: '20%', title: '现在'},
62
-                ]
63
-            ],
64
-            sortName: 'jtsj',
78
+            cols:[newcols],
65 79
             autoSort: false,
66 80
             limits: [20, 25, 50, 100],
67 81
             limit: 30,
82
+            maxmin:true,
68 83
             page: true,
69 84
             skin: 'grid',
70 85
             parseData: function (res) { //res 即为原始返回的数据
@@ -72,7 +87,7 @@
72 87
                     "code": res.code, //解析接口状态
73 88
                     "msg": res.message, //解析提示文本
74 89
                     "count": res.data.total, //解析数据长度
75
-                    "data": res.data.rows //解析数据列表
90
+                    "data": res.data.rows, //解析数据列表
76 91
                 };
77 92
             }
78 93
         });