浏览代码

任务书数据留痕

梁世豪 10 月之前
父节点
当前提交
fab4986e2c

+ 62 - 0
src/main/java/com/liang/controller/PrjProjectController.java

@@ -27,6 +27,7 @@ import org.springframework.data.domain.Page;
27 27
 import org.springframework.data.domain.PageRequest;
28 28
 import org.springframework.http.ResponseEntity;
29 29
 import org.springframework.stereotype.Controller;
30
+import org.springframework.transaction.annotation.Transactional;
30 31
 import org.springframework.ui.Model;
31 32
 import org.springframework.web.bind.annotation.*;
32 33
 import org.springframework.web.multipart.MultipartFile;
@@ -99,6 +100,8 @@ public class PrjProjectController extends BaseController {
99 100
     private SysUserInfoService sysUserInfoService;
100 101
     @Resource
101 102
     private PrjAnnualbudgetdetailDao prjAnnualbudgetdetailDao;
103
+    @Resource
104
+    private PrjProjectXgjlService prjProjectXgjlService;
102 105
 
103 106
 
104 107
     private final static List oldCddwList = new ArrayList();
@@ -2315,5 +2318,64 @@ public class PrjProjectController extends BaseController {
2315 2318
 
2316 2319
         return BaseResult.success(result);
2317 2320
     }
2321
+    /**
2322
+     * 任务书修改记录查看页面
2323
+     *
2324
+     * @return
2325
+     */
2326
+    @GetMapping("/viewRecord")
2327
+    public String viewRecord() {
2328
+        return "prjproject/view_record";
2329
+    }
2330
+
2331
+    @ResponseBody
2332
+    @RequestMapping(value = "/redordData/{xmid}", method = RequestMethod.POST)
2333
+    public BaseResult spList(@PathVariable int xmid,
2334
+                             @RequestParam("page") Integer pageNum,
2335
+                             @RequestParam("limit") Integer pageSize
2336
+                           ) {
2337
+        PageHelper.startPage(pageNum, pageSize);
2338
+        List<PrjBudget> list = prjBudgetService.getXGJL(xmid);
2339
+        PageInfo<PrjBudget> pageinfo = new PageInfo<>(list);
2340
+        //取出查询结果
2341
+        List<PrjBudget> rows = pageinfo.getList();
2342
+        int total = (int) pageinfo.getTotal();
2343
+        Map<String, Object> result = new HashMap<>();
2344
+        result.put(RESULT_ROWS, rows);
2345
+        result.put(RESULT_TOTAL, total);
2346
+
2347
+        return BaseResult.success(result);
2348
+    }
2349
+
2350
+    /**
2351
+     * 在记录表中添加修改前的数据
2352
+     * @return
2353
+     */
2354
+    @ResponseBody
2355
+    @PostMapping("/addPrjProjectRecord/{xmid}")
2356
+//    @Transactional
2357
+    public BaseResult addBudgetRecord(@PathVariable("xmid") Integer xmid) {
2358
+//        1.获取年度预算明细列表中的数据
2359
+        List<PrjBudget> xgjl = prjBudgetService.getXGJL(xmid);
2360
+//        查询当前为第几次记录
2361
+        List<PrjProjectXgjl> xgjls = prjProjectXgjlService.getXGJL(xmid);
2362
+//        获取当前年度预算审批状态
2363
+        PrjProject prjProject = prjProjectService.queryById(xmid);
2364
+        int xh = xgjls.size()+1;
2365
+        List<PrjProjectXgjl> prjProjectXgjlList = new ArrayList<>();
2366
+        for (int i = 0; i < xgjl.size(); i++) {
2367
+            PrjProjectXgjl prjProjectXgjl= new PrjProjectXgjl();
2368
+            prjProjectXgjl.setXmid(xmid);
2369
+            prjProjectXgjl.setMc(xgjl.get(i).getMc());
2370
+            prjProjectXgjl.setXg(xgjl.get(i).getXg());
2371
+            prjProjectXgjl.setXgrq(new java.sql.Date(System.currentTimeMillis()).toString());
2372
+            prjProjectXgjl.setXh(xh);
2373
+            prjProjectXgjlList.add(prjProjectXgjl);
2374
+        }
2375
+        if (prjProject.getSpzt().equals("审批结束")){
2376
+            prjProjectXgjlService.batchinsertXGJL(prjProjectXgjlList);
2377
+        }
2378
+        return BaseResult.success();
2379
+    }
2318 2380
 }
2319 2381
 

+ 34 - 0
src/main/java/com/liang/controller/PrjProjectXgjlController.java

@@ -0,0 +1,34 @@
1
+package com.liang.controller;
2
+
3
+import com.liang.common.JsonTool;
4
+import com.liang.entity.PrjAnnualbudgetXgjl;
5
+import com.liang.entity.PrjProjectXgjl;
6
+import com.liang.service.PrjProjectXgjlService;
7
+import org.springframework.stereotype.Controller;
8
+import org.springframework.web.bind.annotation.PathVariable;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RequestMethod;
11
+import org.springframework.web.bind.annotation.ResponseBody;
12
+
13
+import javax.annotation.Resource;
14
+import java.util.List;
15
+
16
+@Controller
17
+@RequestMapping("prjProjectXgjl")
18
+public class PrjProjectXgjlController {
19
+    @Resource
20
+    private PrjProjectXgjlService prjProjectXgjlService;
21
+
22
+    /**
23
+     * 获取项目修改记录
24
+     *
25
+     * @return
26
+     */
27
+    @ResponseBody
28
+    @RequestMapping(value = "/getXGJL/{xmid}", method = RequestMethod.POST)
29
+    public Object getXGJL(@PathVariable Integer xmid) {
30
+        List<PrjProjectXgjl> prjProjectXgjlList = prjProjectXgjlService.getXGJL(xmid);
31
+        return JsonTool.toJsonString(prjProjectXgjlList);
32
+    }
33
+
34
+}

+ 14 - 0
src/main/java/com/liang/dao/PrjProjectXgjlDao.java

@@ -0,0 +1,14 @@
1
+package com.liang.dao;
2
+
3
+import com.liang.entity.PrjProjectXgjl;
4
+import org.apache.ibatis.annotations.Param;
5
+
6
+import java.util.List;
7
+
8
+public interface PrjProjectXgjlDao {
9
+    List<PrjProjectXgjl> getXGJL(Integer xmid);
10
+
11
+    List<PrjProjectXgjl> getXG(@Param("xh") Integer k,@Param("xmid") Integer xmid);
12
+
13
+    void batchinsertXGJL(@Param("xgjlList") List<PrjProjectXgjl> prjProjectXgjlList);
14
+}

+ 21 - 0
src/main/java/com/liang/entity/PrjBudget.java

@@ -1,5 +1,7 @@
1 1
 package com.liang.entity;
2 2
 
3
+import lombok.Data;
4
+
3 5
 import java.io.Serializable;
4 6
 
5 7
 /**
@@ -8,6 +10,7 @@ import java.io.Serializable;
8 10
  * @author makejava
9 11
  * @since 2023-03-10 07:49:56
10 12
  */
13
+@Data
11 14
 public class PrjBudget implements Serializable {
12 15
     private static final long serialVersionUID = -99295013384521803L;
13 16
 
@@ -145,6 +148,24 @@ public class PrjBudget implements Serializable {
145 148
      * 备注
146 149
      */
147 150
     private String bz;
151
+    /**
152
+     *  修改前数据
153
+     */
154
+    private String xg;
155
+
156
+    /**
157
+     * 修改记录
158
+     */
159
+    private String xg1;
160
+    private String xg2;
161
+    private String xg3;
162
+    private String xg4;
163
+    private String xg5;
164
+    private String xg6;
165
+    private String xg7;
166
+    private String xg8;
167
+    private String xg9;
168
+    private String xg10;
148 169
 
149 170
 
150 171
     public Integer getId() {

+ 29 - 0
src/main/java/com/liang/entity/PrjProjectXgjl.java

@@ -0,0 +1,29 @@
1
+package com.liang.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+import org.apache.poi.hpsf.Decimal;
7
+
8
+import java.sql.Date;
9
+
10
+@Data
11
+@AllArgsConstructor
12
+@NoArgsConstructor
13
+public class PrjProjectXgjl {
14
+    private Integer id;
15
+//    任务书id
16
+    private Integer xmid;
17
+//    费用名称
18
+    private String mc;
19
+//    修改内容
20
+    private  String xg;
21
+//    修改日期
22
+    private String xgrq;
23
+//    序号
24
+    private Integer xh;
25
+//    预算金额
26
+    private Double ysje;
27
+
28
+
29
+}

+ 2 - 0
src/main/java/com/liang/service/PrjBudgetService.java

@@ -94,4 +94,6 @@ public interface PrjBudgetService {
94 94
      * @return
95 95
      */
96 96
     int updateYsByXm(Integer xm, Integer count);
97
+
98
+    List<PrjBudget> getXGJL(int xmid);
97 99
 }

+ 14 - 0
src/main/java/com/liang/service/PrjProjectXgjlService.java

@@ -0,0 +1,14 @@
1
+package com.liang.service;
2
+
3
+import com.liang.entity.PrjProjectXgjl;
4
+
5
+import java.util.List;
6
+
7
+public interface PrjProjectXgjlService {
8
+
9
+    List<PrjProjectXgjl> getXGJL(Integer xmid);
10
+
11
+    List<PrjProjectXgjl> getXG(int k, int xmid);
12
+
13
+    void batchinsertXGJL(List<PrjProjectXgjl> prjProjectXgjlList);
14
+}

+ 146 - 2
src/main/java/com/liang/service/impl/PrjBudgetServiceImpl.java

@@ -1,17 +1,20 @@
1 1
 package com.liang.service.impl;
2 2
 
3 3
 import com.liang.dao.BaseProjectbudgetDao;
4
-import com.liang.entity.BaseProjectbudget;
5
-import com.liang.entity.PrjBudget;
4
+import com.liang.entity.*;
6 5
 import com.liang.dao.PrjBudgetDao;
7 6
 import com.liang.service.PrjBudgetService;
7
+import com.liang.service.PrjCompletecompanyService;
8
+import com.liang.service.PrjProjectXgjlService;
8 9
 import org.springframework.stereotype.Service;
9 10
 import org.springframework.data.domain.Page;
10 11
 import org.springframework.data.domain.PageImpl;
11 12
 import org.springframework.data.domain.PageRequest;
12 13
 
13 14
 import javax.annotation.Resource;
15
+import java.util.HashMap;
14 16
 import java.util.List;
17
+import java.util.Map;
15 18
 
16 19
 /**
17 20
  * 项目预算(PrjBudget)表服务实现类
@@ -25,6 +28,10 @@ public class PrjBudgetServiceImpl implements PrjBudgetService {
25 28
     private PrjBudgetDao prjBudgetDao;
26 29
     @Resource
27 30
     private BaseProjectbudgetDao baseProjectbudgetDao;
31
+    @Resource
32
+    private PrjProjectXgjlService prjProjectXgjlService;
33
+    @Resource
34
+    private PrjCompletecompanyService prjCompletecompanyService;
28 35
 
29 36
     /**
30 37
      * 通过ID查询单条数据
@@ -119,4 +126,141 @@ public class PrjBudgetServiceImpl implements PrjBudgetService {
119 126
         this.prjBudgetDao.emptyYSYE(xm);
120 127
         return num;
121 128
     }
129
+
130
+    @Override
131
+    public List<PrjBudget> getXGJL(int xmid) {
132
+        List<PrjBudget> xgjl = prjBudgetDao.getBudgetList(xmid);
133
+//        获取完成单位列表
134
+        String xm = String.valueOf(xmid);
135
+        Map<String, String> paraMap = new HashMap<>();
136
+        paraMap.put("xm", xm);
137
+        List<PrjCompletecompany> list = prjCompletecompanyService.getCompanyList(paraMap);
138
+//        拼接修改记录
139
+        for (int i = 0; i < xgjl.size(); i++) {
140
+            String xg = "";
141
+            if (xgjl.get(i).getYsje()!=null) {
142
+                 xg = xgjl.get(i).getYsje().toString()+",";
143
+            }else {
144
+                 xg = "0,";
145
+            }
146
+            for (int j = 0; j < list.size(); j++) {
147
+                int k = j + 1;
148
+                switch (k) {
149
+                    case 1:
150
+                        if (xgjl.get(i).getDw1()!=null){
151
+                            xg=xg.concat(xgjl.get(i).getDw1().toString()).concat(",");
152
+                        }else {
153
+                            xg=xg.concat("0").concat(",");
154
+                        }
155
+                        break;
156
+                    case 2:
157
+                        if (xgjl.get(i).getDw2()!=null){
158
+                            xg=xg.concat(xgjl.get(i).getDw2().toString()).concat(",");
159
+                        }else {
160
+                            xg=xg.concat("0").concat(",");
161
+                        }                        break;
162
+                    case 3:
163
+                        if (xgjl.get(i).getDw3()!=null){
164
+                            xg=xg.concat(xgjl.get(i).getDw3().toString()).concat(",");
165
+                        }else {
166
+                            xg=xg.concat("0").concat(",");
167
+                        }                        break;
168
+                    case 4:
169
+                        if (xgjl.get(i).getDw4()!=null){
170
+                            xg=xg.concat(xgjl.get(i).getDw4().toString()).concat(",");
171
+                        }else {
172
+                            xg=xg.concat("0").concat(",");
173
+                        }                        break;
174
+                    case 5:
175
+                        if (xgjl.get(i).getDw5()!=null){
176
+                            xg=xg.concat(xgjl.get(i).getDw5().toString()).concat(",");
177
+                        }else {
178
+                            xg=xg.concat("0").concat(",");
179
+                        }                        break;
180
+                    case 6:
181
+                        if (xgjl.get(i).getDw6()!=null){
182
+                            xg=xg.concat(xgjl.get(i).getDw6().toString()).concat(",");
183
+                        }else {
184
+                            xg=xg.concat("0").concat(",");
185
+                        }                        break;
186
+                    case 7:
187
+                        if (xgjl.get(i).getDw7()!=null){
188
+                            xg=xg.concat(xgjl.get(i).getDw7().toString()).concat(",");
189
+                        }else {
190
+                            xg=xg.concat("0").concat(",");
191
+                        }                        break;
192
+                    case 8:
193
+                        if (xgjl.get(i).getDw8()!=null){
194
+                            xg=xg.concat(xgjl.get(i).getDw8().toString()).concat(",");
195
+                        }else {
196
+                            xg=xg.concat("0").concat(",");
197
+                        }                        break;
198
+                    case 9:
199
+                        if (xgjl.get(i).getDw9()!=null){
200
+                            xg=xg.concat(xgjl.get(i).getDw9().toString()).concat(",");
201
+                        }else {
202
+                            xg=xg.concat("0").concat(",");
203
+                        }                        break;
204
+                    case 10:
205
+                        if (xgjl.get(i).getDw10()!=null){
206
+                            xg=xg.concat(xgjl.get(i).getDw10().toString()).concat("");
207
+                        }else {
208
+                            xg=xg.concat("0").concat("");
209
+                        }                        break;
210
+                }
211
+            }
212
+            xgjl.get(i).setXg(xg);
213
+        }
214
+        List<PrjProjectXgjl> prjProjectXgjlList=prjProjectXgjlService.getXGJL(xmid);
215
+//        获取修改记录
216
+        for (int i = 0; i < prjProjectXgjlList.size(); i++) {
217
+            int k=i+1;
218
+            List<PrjProjectXgjl> xg   =prjProjectXgjlService.getXG(k,xmid);
219
+            switch (k){
220
+                case 1:
221
+                    for (int j = 0; j < xg.size(); j++) {
222
+                        xgjl.get(j).setXg1(xg.get(j).getXg());
223
+                    };break;
224
+                case 2:
225
+                    for (int j = 0; j < xg.size(); j++) {
226
+                        xgjl.get(j).setXg2(xg.get(j).getXg());
227
+                    };break;
228
+                case 3:
229
+                    for (int j = 0; j < xg.size(); j++) {
230
+                        xgjl.get(j).setXg3(xg.get(j).getXg());
231
+                    };break;
232
+                case 4:
233
+                    for (int j = 0; j < xg.size(); j++) {
234
+                        xgjl.get(j).setXg4(xg.get(j).getXg());
235
+                    };break;
236
+                case 5:
237
+                    for (int j = 0; j < xg.size(); j++) {
238
+                        xgjl.get(j).setXg5(xg.get(j).getXg());
239
+                    };break;
240
+                case 6:
241
+                    for (int j = 0; j < xg.size(); j++) {
242
+                        xgjl.get(j).setXg6(xg.get(j).getXg());
243
+                    };break;
244
+                case 7:
245
+                    for (int j = 0; j < xg.size(); j++) {
246
+                        xgjl.get(j).setXg7(xg.get(j).getXg());
247
+                    };break;
248
+                case 8:
249
+                    for (int j = 0; j < xg.size(); j++) {
250
+                        xgjl.get(j).setXg8(xg.get(j).getXg());
251
+                    };break;
252
+                case 9:
253
+                    for (int j = 0; j < xg.size(); j++) {
254
+                        xgjl.get(j).setXg9(xg.get(j).getXg());
255
+                    };break;
256
+                case 10:
257
+                    for (int j = 0; j < xg.size(); j++) {
258
+                        xgjl.get(j).setXg10(xg.get(j).getXg());
259
+                    };break;
260
+            }
261
+
262
+        }
263
+
264
+        return xgjl;
265
+    }
122 266
 }

+ 31 - 0
src/main/java/com/liang/service/impl/PrjProjectXgjlServiceImpl.java

@@ -0,0 +1,31 @@
1
+package com.liang.service.impl;
2
+
3
+import com.liang.dao.PrjProjectXgjlDao;
4
+import com.liang.entity.PrjProjectXgjl;
5
+import com.liang.service.PrjProjectXgjlService;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+@Service("PrjProjectXgjlService")
12
+public class PrjProjectXgjlServiceImpl implements PrjProjectXgjlService {
13
+
14
+    @Resource
15
+    private PrjProjectXgjlDao prjProjectXgjlDao;
16
+
17
+    @Override
18
+    public List<PrjProjectXgjl> getXGJL(Integer xmid) {
19
+        return this.prjProjectXgjlDao.getXGJL(xmid);
20
+    }
21
+
22
+    @Override
23
+    public List<PrjProjectXgjl> getXG(int k, int xmid) {
24
+        return this.prjProjectXgjlDao.getXG(k,xmid);
25
+    }
26
+
27
+    @Override
28
+    public void batchinsertXGJL(List<PrjProjectXgjl> prjProjectXgjlList) {
29
+        prjProjectXgjlDao.batchinsertXGJL(prjProjectXgjlList);
30
+    }
31
+}

+ 40 - 0
src/main/resources/mapper/PrjProjectXgjlDao.xml

@@ -0,0 +1,40 @@
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.PrjProjectXgjlDao">
4
+    <resultMap type="com.liang.entity.PrjProjectXgjl" id="PrjProjectXgjlMap">
5
+        <result property="id" column="ID" jdbcType="INTEGER"/>
6
+        <result property="xmid" column="XMID" jdbcType="INTEGER"/>
7
+        <result property="mc" column="MC" 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
+        <result property="ysje" column="YSJE" jdbcType="DECIMAL"/>
12
+    </resultMap>
13
+    <insert id="insertXGJL" keyProperty="id" useGeneratedKeys="true">
14
+        INSERT INTO prj_ProjectRecord (nys, fymc, xg, xgrq, xh)
15
+        VALUES (#{xgjl.nys},#{xgjl.fymc}, #{xgjl.xg}, #{xgjl.xgrq}, #{xgjl.xh});
16
+    </insert>
17
+    <insert id="batchinsertXGJL" keyProperty="id" useGeneratedKeys="true">
18
+        INSERT INTO prj_ProjectRecord (xmid, mc, xg, xgrq, xh)
19
+        VALUES
20
+        <foreach collection="xgjlList" item="xgjl" separator=",">
21
+            (#{xgjl.xmid},#{xgjl.mc}, #{xgjl.xg}, #{xgjl.xgrq}, #{xgjl.xh})
22
+        </foreach>
23
+    </insert>
24
+    <select id="getXGJL" resultType="com.liang.entity.PrjProjectXgjl">
25
+        SELECT XH,xgrq
26
+        FROM prj_ProjectRecord
27
+        WHERE XMID = #{xmid}
28
+        GROUP BY XH,xgrq
29
+        ORDER BY XH ASC
30
+    </select>
31
+    <select id="getXG" resultType="com.liang.entity.PrjProjectXgjl">
32
+        SELECT b.MC,a.xg
33
+        FROM prj_ProjectRecord a
34
+                 RIGHT JOIN prj_Budget b on a.xmid=b.xm and a.mc = b.MC
35
+        WHERE a.XMID = #{xmid}
36
+          AND  a.XH = #{xh}
37
+    </select>
38
+
39
+
40
+</mapper>

+ 620 - 0
src/main/resources/templates/annualbudget/updateApply_annualbudget.html

@@ -0,0 +1,620 @@
1
+<!DOCTYPE html>
2
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+    <title>编辑</title>
7
+    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
8
+    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
9
+    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
10
+    <style>
11
+        body {
12
+            background-color: #ffffff;
13
+        }
14
+    </style>
15
+</head>
16
+<body>
17
+<form class="layui-form" action="" lay-filter="formDemo">
18
+    <div class="layui-tab layui-tab-card">
19
+        <ul class="layui-tab-title">
20
+            <li class="layui-this">常规</li>
21
+            <li>预算</li>
22
+        </ul>
23
+        <div class="layui-tab-content">
24
+            <!--常规开始-->
25
+            <div class="layui-tab-item layui-show" style="min-height: 550px; margin-bottom: 5px">
26
+                <form class="layui-form" action="" lay-filter="formDemo">
27
+                    <div class="layui-form layuimini-form">
28
+                        <div class="layui-form-item layui-inline" style="width: 100%">
29
+                            <label class="layui-form-label" style="width: 70px">名称</label>
30
+                            <div class="layui-input-inline" style="width: 855px">
31
+                                <input type="hidden" id="id" name="id" class="layui-input"
32
+                                       th:value="${annualbudget.id}">
33
+                                <input type="text" id="mc" name="mc" class="layui-input" th:value="${annualbudget.mc}">
34
+                            </div>
35
+                        </div>
36
+                        <div class="layui-form-item layui-inline" style="width: 100%">
37
+                            <label class="layui-form-label" style="width: 70px">任务书</label>
38
+                            <div class="layui-input-inline" style="width: 855px">
39
+                                <input type="hidden" id="rws" name="rws" class="layui-input"
40
+                                       th:value="${annualbudget.rws}">
41
+                                <input type="text" id="rwsmc" name="rwsmc" class="layui-input"
42
+                                       th:value="${annualbudget.rwsmc}" readonly>
43
+                            </div>
44
+                        </div>
45
+                        <div class="layui-form-item layui-inline" style="width: 100%">
46
+                            <label class="layui-form-label" style="width: 70px">项目执行期</label>
47
+                            <div class="layui-input-inline" style="width: 855px">
48
+                                <input type="hidden" name="qs" id="qs" class="layui-input" th:value="${qs}">
49
+                                <input type="hidden" name="wc" id="wc" class="layui-input" th:value="${wc}">
50
+                                <input type="text" id="xmzxq" name="xmzxq" class="layui-input"
51
+                                       th:value="${annualbudget.xmzxq}" readonly>
52
+                            </div>
53
+                        </div>
54
+                        <div class="layui-form-item layui-inline" style="width: 100%">
55
+                            <label class="layui-form-label required" style="width: 70px">年份</label>
56
+                            <div class="layui-input-inline" style="width: 855px">
57
+                                <input type="text" id="nf" name="nf" class="layui-input" th:value="${annualbudget.nf}">
58
+                            </div>
59
+                        </div>
60
+                        <div class="layui-form-item layui-inline" style="width: 100%">
61
+                            <label class="layui-form-label" style="width: 70px">说明</label>
62
+                            <div class="layui-input-inline" style="width: 855px">
63
+                                <textarea id="sm" name="sm" class="layui-textarea" style="width: 100%;height: 150px"
64
+                                          th:text="${annualbudget.sm}"></textarea>
65
+                            </div>
66
+                        </div>
67
+                        <div class="layui-form-item layui-inline" style="width: 100%">
68
+                            <label class="layui-form-label" style="width: 70px">申请人</label>
69
+                            <div class="layui-input-inline" style="width: 380px">
70
+                                <input type="text" name="sqrxm" class="layui-input" th:value="${annualbudget.sqrxm}"
71
+                                       readonly>
72
+                            </div>
73
+                            <label class="layui-form-label" style="width: 65px">申请时间</label>
74
+                            <div class="layui-input-inline" style="width: 370px">
75
+                                <input type="text" id="sqsj" name="sqsj" class="layui-input"
76
+                                       th:value="${annualbudget.sqsj}">
77
+                                <tip>日期格式:yyyy-MM-dd</tip>
78
+                            </div>
79
+                        </div>
80
+                        <!--                        <div class="layui-form-item layui-inline" style="width: 100%">-->
81
+                        <!--                            <label class="layui-form-label" style="width: 70px">审批状态</label>-->
82
+                        <!--                            <div class="layui-input-inline" style="width: 855px">-->
83
+                        <!--                                <input type="text" id="spzt" name="spzt" class="layui-input" value="未提交" readonly>-->
84
+                        <!--                            </div>-->
85
+                        <!--                        </div>-->
86
+                        <div class="layui-form-item layui-inline" style="width: 100%">
87
+                            <label class="layui-form-label" style="width: 70px">可研报告</label>
88
+                            <div class="layui-input-inline" style="width: 855px">
89
+                                <input type="text" id="xmmc" name="xmmc" class="layui-input"
90
+                                       th:value="${annualbudget.xmmc}" readonly>
91
+                            </div>
92
+                        </div>
93
+                        <div class="layui-form-item layui-inline" style="width: 100%">
94
+                            <label class="layui-form-label" style="width: 70px">ERP编号</label>
95
+                            <div class="layui-input-inline" style="width: 380px">
96
+                                <input type="text" id="erpbh" name="erpbh" class="layui-input"
97
+                                       th:value="${annualbudget.erpbh}" readonly>
98
+                            </div>
99
+                            <label class="layui-form-label" style="width: 65px">项目类型</label>
100
+                            <div class="layui-input-inline" style="width: 370px">
101
+                                <input type="text" id="xmlxmc" name="xmlxmc" class="layui-input"
102
+                                       th:value="${annualbudget.xmlxmc}" readonly>
103
+                            </div>
104
+                        </div>
105
+                        <div class="layui-form-item layui-inline" style="width: 100%">
106
+                            <label class="layui-form-label" style="width: 90px">电科院负责人</label>
107
+                            <div class="layui-input-inline" style="width: 370px">
108
+                                <input type="text" id="xmfzrxm" name="xmfzrxm" class="layui-input"
109
+                                       th:value="${annualbudget.xmfzrxm}" readonly>
110
+                            </div>
111
+                            <label class="layui-form-label" style="width: 65px">所属部门</label>
112
+                            <div class="layui-input-inline" style="width: 370px">
113
+                                <input type="text" id="ssbmmc" name="ssbmmc" class="layui-input"
114
+                                       th:value="${annualbudget.ssbmmc}" readonly>
115
+                            </div>
116
+                        </div>
117
+
118
+                        <!-- 右侧悬浮按钮 -->
119
+                        <div class="right-bottom-btn" style="margin-bottom: 5px">
120
+                            <button class="layui-btn" lay-filter="viewRwsBtn">
121
+                                <i class="layui-icon layui-icon-file"></i>查看任务书
122
+                            </button>
123
+                            <button class="layui-btn" lay-filter="cancleBtn">
124
+                                <i class="layui-icon layui-icon-close"></i>取消
125
+                            </button>
126
+                        </div>
127
+                    </div>
128
+                </form>
129
+            </div>
130
+            <!--常规结束-->
131
+            <!--预算开始-->
132
+            <div class="layui-tab-item" style="min-height: 550px; padding-left: 30px; padding-right: 30px">
133
+                <form class="layui-form" action="" lay-filter="formDemo">
134
+                    <div class="layui-form layuimini-form">
135
+                        <div class="layui-form-item" style="margin-bottom: -10px">
136
+                            <div class="layui-inline">
137
+                                <label class="layui-form-label"
138
+                                       style="width: fit-content; margin-bottom: -10px">单位:万元</label>
139
+                                <label class="layui-form-label" style="width: 170px"></label>
140
+                            </div>
141
+                            <div class="layui-inline">
142
+                                <label class="layui-form-label" style="width: 70px; margin-left: -10px">项目总预算</label>
143
+                                <div class="layui-input-inline" style="width: 100px">
144
+                                    <input type="text" id="rwsys" name="rwsys" class="layui-input" th:value="${rwsys}"
145
+                                           readonly>
146
+                                </div>
147
+                            </div>
148
+                            <div class="layui-inline">
149
+                                <label class="layui-form-label" style="width: 60px; margin-left: -15px">年度经费</label>
150
+                                <div class="layui-input-inline" style="width: 100px">
151
+                                    <input type="text" id="ndczje" name="ndczje" class="layui-input"
152
+                                           th:value="${ndczje}" readonly>
153
+                                </div>
154
+                            </div>
155
+                            <div class="layui-inline">
156
+                                <label class="layui-form-label" style="width: 70px; margin-left: -15px">年度备用金</label>
157
+                                <div class="layui-input-inline" style="width: 100px; margin-right: -15px">
158
+                                    <input type="number" id="ndbyj" name="ndbyj" class="layui-input" autocomplete="off">
159
+                                </div>
160
+                            </div>
161
+                        </div>
162
+
163
+                        <table class="layui-hide layui-table-view" id="currentTableId"
164
+                               lay-filter="currentTableFilter"></table>
165
+
166
+                        <!-- 右侧悬浮按钮 -->
167
+                        <div class="right-bottom-btn" style="margin-bottom: 5px">
168
+                            <button class="layui-btn" id="btn" lay-filter="viewRwsBtn">
169
+                                <i class="layui-icon layui-icon-file"></i>查看任务书
170
+                            </button>
171
+                            <button type="button" class="layui-btn" lay-filter="saveBtnYs">
172
+                                <i class="layui-icon layui-icon-ok"></i>申请修改
173
+                            </button>
174
+                            <button class="layui-btn" lay-filter="cancleBtn">
175
+                                <i class="layui-icon layui-icon-close"></i>取消
176
+                            </button>
177
+                        </div>
178
+                    </div>
179
+                </form>
180
+            </div>
181
+            <!--预算结束-->
182
+        </div>
183
+    </div>
184
+</form>
185
+
186
+<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
187
+<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
188
+<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
189
+<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
190
+<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
191
+
192
+<script type="text/javascript" th:inline="javascript">
193
+    //删除键盘的所有默认行为
194
+    // document.onkeypress = function(e) {
195
+    //     e.preventDefault();
196
+    // }
197
+    //全局禁用enter
198
+    document.onkeydown = function (e) {
199
+        var ev = (typeof event != 'undefined') ? window.event : e
200
+        if (ev.keyCode == 13) {
201
+            return false
202
+        }
203
+    }
204
+    AjaxUtil.ctx = /*[[@{/}]]*/'';
205
+    layui.use(['form', 'treeTable', 'layCascader', 'tableSelect', 'laydate'], function () {
206
+        var form = layui.form,
207
+            layer = layui.layer,
208
+            treeTable = layui.treeTable,
209
+            laydate = layui.laydate;
210
+
211
+        var rwsId = $("#rws").val(),
212
+            ysId = $("#id").val();
213
+        var zjfy = 0;
214
+
215
+        //申请时间
216
+        laydate.render({
217
+            elem: '#sqsj',
218
+            value: new Date()
219
+        });
220
+
221
+        // 监听查看任务书按钮
222
+        $("button[lay-filter='viewRwsBtn']").click(function (e) {
223
+            parent.layer.open({
224
+                title: '查看项目任务书',
225
+                type: 2,
226
+                shade: 0.3,
227
+                // maxmin: true,
228
+                shadeClose: true,
229
+                area: ['1100px', '750px'],
230
+                content: AjaxUtil.ctx + 'prjProject/forView/' + rwsId,
231
+                end: function (index) {
232
+                    layer.close(index);
233
+                }
234
+            });
235
+            // e.target.blur();//主动去除焦点
236
+            return false;
237
+        });
238
+
239
+        //预算
240
+        var dataBudget1 = new Array();
241
+        $.ajax({
242
+            url: AjaxUtil.ctx + 'prjAnnualbudgetdetail/list/' + ysId,
243
+            type: "post",
244
+            async: false,
245
+            dataType: "json",
246
+            success: function (result) {
247
+                dataBudget1 = result;
248
+                for (let i = 0; i < dataBudget1.length; i++) {
249
+                    if (dataBudget1[i].fymc.indexOf('总计') > -1) {
250
+                        zjfy = i;
251
+                    }
252
+                }
253
+                $("#ndbyj").val(dataBudget1[zjfy].byj);
254
+                $("#rwsys").val(dataBudget1[zjfy].xmzys);
255
+            }
256
+        });
257
+        //查看年度预算(项目总预算)
258
+        var dataBudget = new Array();
259
+        $.ajax({
260
+            url: AjaxUtil.ctx + 'prjAnnualbudget/list/' + ysId,
261
+            type: "post",
262
+            async: false,
263
+            dataType: "json",
264
+            success: function (result) {
265
+                dataBudget = result;
266
+                console.log(dataBudget)
267
+            }
268
+        });
269
+        var insTb;
270
+
271
+        function loadTreetable() {
272
+            insTb = treeTable.render({
273
+                elem: '#currentTableId',
274
+                data: dataBudget,
275
+                skin: 'grid',
276
+                style: 'overflow:auto',
277
+                tree: {
278
+                    treeColIndex: 1,
279
+                    treeSpid: "",   //最上级的父级id
280
+                    iconIndex: 1,   // 折叠图标显示在第几列
281
+                    isPidData: true,// 是否是id、pid形式数据
282
+                    idName: 'bm',  // id字段名称
283
+                    pidName: 'fj', // pid字段名称
284
+                    arrowType: 'arrow2',
285
+                    getIcon: 'ew-tree-icon-style2',
286
+                    openName: 'bm'
287
+                },
288
+                treeDefaultClose: false,
289
+                page: false,
290
+                // toolbar: '#toolbarDemo',
291
+                cols: [
292
+                    [
293
+                        {type: 'numbers', width: '3%'},
294
+                        {field: 'fymc', width: '30%', title: '费用名称'},
295
+                        {field: 'xmzys', width: '12%', title: '项目总预算', edit: 'number'},
296
+                        {field: 'xtjsyzx', width: '15%', title: '系统计算已执行', edit: 'number'},
297
+                        {field: 'sjyzx', width: '12%', title: '实际已执行', edit: 'number'},
298
+                        {field: 'ysje', width: '10%', title: '预算金额'},
299
+                        {field: 'xmz', width: '9%', title: '项目组', edit: 'number'},
300
+                        {field: "byj", width: '9%', title: '备用金'}
301
+                        // {field: 'ysqje', width: '11%', title: '已申请金额'},
302
+                        // {field: 'ybzje', width: '11%', title: '已报账金额'},
303
+                        // {field: 'byjysq', width: '11%', title: '备用金已申请'},
304
+                        // {field: 'byjybz', width: '11%', title: '备用金已报账'}
305
+                    ]
306
+                ],
307
+                edit: function (obj) {
308
+                    if (obj.data.edit === false)
309
+                        return false;
310
+                    else
311
+                        return true;
312
+                }
313
+            });
314
+        }
315
+
316
+        loadTreetable();
317
+
318
+        //年度备用金
319
+        $("#ndbyj").on("input", function (e) {
320
+            //获取input输入的值
321
+            var ndbyj = parseFloat(e.delegateTarget.value);
322
+            if (isNaN(ndbyj))
323
+                ndbyj = 0;
324
+            dataBudget[zjfy].byj = ndbyj;
325
+
326
+            var xmz = 0, byj = 0;
327
+            if (dataBudget[zjfy].xmz != null) {
328
+                xmz = parseFloat(dataBudget[zjfy].xmz);
329
+                if (isNaN(xmz))
330
+                    xmz = 0;
331
+            }
332
+            if (dataBudget[zjfy].byj != null) {
333
+                byj = parseFloat(dataBudget[zjfy].byj);
334
+                if (isNaN(byj))
335
+                    byj = 0;
336
+            }
337
+            var ysje = xmz + byj;
338
+            if (ysje == 0)
339
+                dataBudget[zjfy].ysje = "";
340
+            else
341
+                dataBudget[zjfy].ysje = ysje;
342
+
343
+            loadTreetable();
344
+        });
345
+
346
+        // 监听单元格编辑
347
+        treeTable.on('edit(currentTableId)', function (obj) {
348
+            var value = obj.value,
349
+                item = obj.data,
350
+                colName = obj.field;
351
+            if (item.children == undefined) {
352
+                //当前行预算
353
+                setCurBudget(item.bm, colName, value);
354
+                //父级预算
355
+                setFjBudget(item.fj);
356
+            }
357
+
358
+            var xmz = 0, byj = 0;
359
+            if (dataBudget[zjfy].xmz != null) {
360
+                xmz = parseFloat(dataBudget[zjfy].xmz);
361
+                if (isNaN(xmz))
362
+                    xmz = 0;
363
+            }
364
+            if (dataBudget[zjfy].byj != null) {
365
+                byj = parseFloat(dataBudget[zjfy].byj);
366
+                if (isNaN(byj))
367
+                    byj = 0;
368
+            }
369
+            var ysje = xmz + byj;
370
+            if (ysje == 0)
371
+                dataBudget[zjfy].ysje = "";
372
+            else
373
+                dataBudget[zjfy].ysje = ysje;
374
+
375
+            loadTreetable();
376
+        });
377
+
378
+        //当前行预算
379
+        function setCurBudget(bm, colName, value) {
380
+            for (var i = 0; i < dataBudget.length; i++) {
381
+                if (bm == dataBudget[i].bm) {
382
+                    value = parseFloat(value);
383
+                    if (isNaN(value))
384
+                        value = null;
385
+                    // var rwsys = $("#rwsys").val();
386
+                    // if (value !== null && value > rwsys * 0.2) {
387
+                    //     alert("不能超过项目总预算预算的20%!");
388
+                    //     return; // 返回,不进行后续处理
389
+                    // }
390
+
391
+                    //当前数据不能大于总预算列的值
392
+                    if (dataBudget[i].xmzys != null) {
393
+                        if (value !== null && value > parseFloat(dataBudget[i].xmzys * 1.2).toFixed(6)) {
394
+                            alert("输入金额不能超过项目总预算列的120%!");
395
+                            return; // 返回,不进行后续处理
396
+                        }
397
+                    }
398
+                    //当前单元格
399
+                    // if(colName == "xmzys") {
400
+                    //     dataBudget[i].xmzys = value;
401
+                    // } else
402
+                    if (colName == "xmz") {
403
+                        dataBudget[i].xmz = value;
404
+                    } else if (colName == "byj") {
405
+                        dataBudget[i].byj = value;
406
+                    } else if (colName == "xtjsyzx") {
407
+                        dataBudget[i].xtjsyzx = value;
408
+                    } else if (colName == "sjyzx") {
409
+                        dataBudget[i].sjyzx = value;
410
+                    }
411
+
412
+                    //正在编辑的预算
413
+                    var xmz = 0, byj = 0;
414
+                    if (dataBudget[i].xmz != null) {
415
+                        xmz = parseFloat(dataBudget[i].xmz);
416
+                        if (isNaN(xmz))
417
+                            xmz = 0;
418
+                    }
419
+                    if (dataBudget[i].byj != null) {
420
+                        byj = parseFloat(dataBudget[i].byj);
421
+                        if (isNaN(byj))
422
+                            byj = 0;
423
+                    }
424
+                    var ysje = xmz + byj;
425
+                    if (ysje == 0)
426
+                        dataBudget[i].ysje = "";
427
+                    else
428
+                        dataBudget[i].ysje = ysje;
429
+
430
+                    break;
431
+                }
432
+            }
433
+        }
434
+
435
+        //父级预算
436
+        function setFjBudget(fj) {
437
+            if (fj != null && fj != '') {
438
+                var xmzys = 0, xmz = 0, byj = 0, xtjsyzx = 0, sjyzx = 0;
439
+                //子节点的值相加
440
+                for (var j = 0; j < dataBudget.length; j++) {
441
+                    if (fj == dataBudget[j].fj) {
442
+                        // var t = parseFloat(dataBudget[j].xmzys);
443
+                        // if (!isNaN(t))
444
+                        //     xmzys += t;
445
+                        var t1 = parseFloat(dataBudget[j].xmz);
446
+                        if (!isNaN(t1))
447
+                            xmz += t1;
448
+                        var t2 = parseFloat(dataBudget[j].byj);
449
+                        if (!isNaN(t2))
450
+                            byj += t2;
451
+                        var t3 = parseFloat(dataBudget[j].xtjsyzx);
452
+                        if (!isNaN(t3))
453
+                            xtjsyzx += t3;
454
+                        var t4 = parseFloat(dataBudget[j].sjyzx);
455
+                        if (!isNaN(t4))
456
+                            sjyzx += t4;
457
+                    }
458
+                }
459
+
460
+                //更新父节点的值
461
+                for (var j = 0; j < dataBudget.length; j++) {
462
+                    if (fj == dataBudget[j].bm) {
463
+                        // if (xmzys == 0)
464
+                        //     dataBudget[j].xmzys = '';
465
+                        // else
466
+                        //     dataBudget[j].xmzys = xmzys.toFixed(2);
467
+                        if (xmz == 0)
468
+                            dataBudget[j].xmz = '';
469
+                        else
470
+                            dataBudget[j].xmz = xmz.toFixed(2);
471
+                        if (xtjsyzx == 0)
472
+                            dataBudget[j].xtjsyzx = '';
473
+                        else
474
+                            dataBudget[j].xtjsyzx = xtjsyzx.toFixed(2);
475
+                        if (sjyzx == 0)
476
+                            dataBudget[j].sjyzx = '';
477
+                        else
478
+                            dataBudget[j].sjyzx = sjyzx.toFixed(2);
479
+
480
+                        var ysje = xmz + byj;
481
+                        if (ysje == 0)
482
+                            dataBudget[j].ysje = "";
483
+                        else
484
+                            dataBudget[j].ysje = ysje.toFixed(2);
485
+
486
+                        setFjBudget(dataBudget[j].fj);
487
+                        break;
488
+                    }
489
+                }
490
+            }
491
+        }
492
+
493
+        //组织要保存的数据
494
+        function getBudget(budgets, data) {
495
+            var budget = {
496
+                "id": data.id,
497
+                "xmzys": data.xmzys,
498
+                "ysje": data.ysje,
499
+                "xmz": data.xmz,
500
+                "byj": data.byj,
501
+                "xtjsyzx": data.xtjsyzx,
502
+                "sjyzx": data.sjyzx
503
+            };
504
+            budgets.push(budget);
505
+            if (data.children != undefined) {
506
+                getChildNode(budgets, data);
507
+            }
508
+        }
509
+
510
+        function getChildNode(budgets, data) {
511
+            for (let item of data.children) {
512
+                getBudget(budgets, item);
513
+            }
514
+        }
515
+
516
+        // 监听保存按钮(项目预算)
517
+        $("button[lay-filter='saveBtnYs']").click(function () {
518
+            var rwsys = $("#rwsys").val();
519
+            var ndczje = $("#ndczje").val();
520
+            for (let i = 0; i < dataBudget.length; i++) {
521
+                if (dataBudget[i].fj==''){
522
+                    var ysje = dataBudget[i].ysje;
523
+                }
524
+            }
525
+            if (ndczje === "" && ndczje === null){
526
+                Message.error("年度经费为空,不能申请年段预算");
527
+                return false;
528
+            }
529
+            if (ysje === null){
530
+                Message.error("预算金额不能为空",1500);
531
+                return false;
532
+
533
+            }
534
+            if ( ysje > ndczje){
535
+                Message.error("预算金额不能大于年度经费!",1500);
536
+                return false;
537
+            }
538
+            if ( ysje < ndczje){
539
+                Message.error("预算金额不能小于年度经费!",1500);
540
+                return false;
541
+            }
542
+            if (rwsys == "") {
543
+                Message.error("任务书预算不能为空,请完善任务书项目预算!", 1500);
544
+                return false;
545
+            }
546
+
547
+            var item = dataBudget.find((item) => item.fymc == "总计");
548
+            var ndzys = item.xmzys;
549
+            if (ndzys == null) {
550
+                return false;
551
+            }
552
+            if (parseFloat(ndzys) > parseFloat(rwsys)) {
553
+                Message.error("年度总预算不能超过任务书预算!", 1500);
554
+                return false;
555
+            }
556
+            if (parseFloat(ndzys) > parseFloat(rwsys)) {
557
+                Message.error("年度总预算不能超过任务书预算!", 1500);
558
+                return false;
559
+            }
560
+
561
+            var data = insTb.options.data;
562
+            var budgets = new Array();
563
+            for (var i = 0; i < data.length; i++) {
564
+                getBudget(budgets, data[i]);
565
+            }
566
+
567
+            var index = layer.load(0, {shade: 0.1});
568
+            //添加修改记录
569
+            AjaxUtil.post({
570
+                url: AjaxUtil.ctx + 'PrjAnnualBudgetRecord/addUpdateApplyRecord/',
571
+                data:budgets,
572
+                success: function (res) {
573
+                    layer.close(index);
574
+                    if (res.code === 0) {
575
+                        AjaxUtil.post({
576
+                            url: AjaxUtil.ctx + "prjApproverecord/doAddApprove",
577
+                            data: data.field,
578
+                            success: function (res) {
579
+                                //更新审批状态
580
+                                var project = {
581
+                                    "id": xmApproval.xmid,
582
+                                    // "spzt": '部门主任审批'
583
+                                    "spzt": '科技项目管理专责审批'
584
+                                }
585
+                                console.log(data.field)
586
+                                layer.load(0, {shade: 0.1});
587
+                                AjaxUtil.post({
588
+                                    url: AjaxUtil.ctx + "prjAnnualbudget/updateSpzt",
589
+                                    contentType: "application/json",
590
+                                    data: JSON.stringify(project),
591
+                                    success: function (res) {
592
+                                        parent.setUpdateFlag();
593
+
594
+                                        var iframeIndex = parent.layer.getFrameIndex(window.name);
595
+                                        parent.layer.close(iframeIndex);
596
+                                    },
597
+                                    error: function (error) {
598
+                                    }
599
+                                });
600
+                            },
601
+                            error: function (error) {
602
+                            }
603
+                        });
604
+                    } else {
605
+                        Message.error("修改记录添加失败", 2000);
606
+                    }
607
+                }
608
+            });
609
+
610
+        });
611
+
612
+        // 监听取消按钮
613
+        $("button[lay-filter='cancleBtn']").click(function () {
614
+            var iframeIndex = parent.layer.getFrameIndex(window.name);
615
+            parent.layer.close(iframeIndex);
616
+        });
617
+    });
618
+</script>
619
+</body>
620
+</html>

+ 1 - 1
src/main/resources/templates/annualbudget/view_record.html

@@ -3,7 +3,7 @@
3 3
 <head>
4 4
     <meta charset="UTF-8">
5 5
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
-    <title>审批列表</title>
6
+    <title>修改记录</title>
7 7
     <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
8 8
     <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
9 9
     <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">

+ 54 - 15
src/main/resources/templates/prjproject/update.html

@@ -1950,29 +1950,68 @@
1950 1950
                 getBudget(budgets, data[i]);
1951 1951
             }
1952 1952
             var index = layer.load(0, {shade: 0.1});
1953
+            // //添加修改记录
1954
+            // AjaxUtil.post({
1955
+            //     url: AjaxUtil.ctx + 'prjProject/addPrjProjectRecord/' + xmId,
1956
+            //     data: data.field,
1957
+            //     success: function (res) {
1958
+            //         if (res.code === 0) {
1959
+            //         } else {
1960
+            //             Message.error("修改记录添加失败", 2000);
1961
+            //         }
1962
+            //     }
1963
+            // });
1964
+            // AjaxUtil.post({
1965
+            //     url: AjaxUtil.ctx + "prjProject/doUpdateXmys",
1966
+            //     contentType: "application/json",
1967
+            //     data: JSON.stringify(budgets),
1968
+            //     success: function (res) {
1969
+            //         if (res.code === 0) {
1970
+            //             Message.success(1000, res.message, function () {
1971
+            //                 loadTreetable();
1972
+            //                 parent.setUpdateFlag();
1973
+            //             });
1974
+            //         } else {
1975
+            //             Message.error(res.message, 1000);
1976
+            //         }
1977
+            //         layer.close(index);
1978
+            //     },
1979
+            //     error: function (error) {
1980
+            //         layer.close(index);
1981
+            //     }
1982
+            // });
1983
+            // 添加修改记录请求
1953 1984
             AjaxUtil.post({
1954
-                url: AjaxUtil.ctx + "prjProject/doUpdateXmys",
1955
-                contentType: "application/json",
1956
-                data: JSON.stringify(budgets),
1957
-                success: function (res) {
1985
+                url: AjaxUtil.ctx + 'prjProject/addPrjProjectRecord/' + xmId,
1986
+                data: data.field,
1987
+                success: function (res){
1988
+                    console.log(res)
1958 1989
                     if (res.code === 0) {
1959
-                        Message.success(1000, res.message, function () {
1960
-                            loadTreetable();
1961
-                            parent.setUpdateFlag();
1990
+                        AjaxUtil.post({
1991
+                            url: AjaxUtil.ctx + "prjProject/doUpdateXmys",
1992
+                            contentType: "application/json",
1993
+                            data: JSON.stringify(budgets),
1994
+                            success: function (res) {
1995
+                                if (res.code === 0) {
1996
+                                    Message.success(1000, res.message, function () {
1997
+                                        loadTreetable();
1998
+                                        parent.setUpdateFlag();
1999
+                                    });
2000
+                                } else {
2001
+                                    Message.error(res.message, 1000);
2002
+                                }
2003
+                                layer.close(index);
2004
+                            },
2005
+                            error: function (error) {
2006
+                                layer.close(index);
2007
+                            }
1962 2008
                         });
1963 2009
                     } else {
1964
-                        Message.error(res.message, 1000);
2010
+                        Message.error("修改记录添加失败", 2000);
1965 2011
                     }
1966
-                    layer.close(index);
1967
-                },
1968
-                error: function (error) {
1969
-                    layer.close(index);
1970 2012
                 }
1971 2013
             });
1972
-            return false;
1973 2014
         });
1974
-
1975
-
1976 2015
         //出资方案
1977 2016
         var currTable6 = table.render({
1978 2017
             elem: '#currentTableId6',

+ 112 - 0
src/main/resources/templates/prjproject/view_record.html

@@ -0,0 +1,112 @@
1
+<!DOCTYPE html>
2
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+    <title>修改记录</title>
7
+    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
8
+    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
9
+    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
10
+</head>
11
+<body>
12
+<div class="layuimini-container">
13
+    <div class="layuimini-main">
14
+        <form class="layui-form" action="" lay-filter="formDemo">
15
+            <div class="layui-form-item" style="margin: 20px 0px 0px 5px">
16
+                <input type="text" style="width: 70px; border: 0px" value="任务书:" readonly>
17
+                <input type="text" name="xm" id="xm" style="width: 1000px; border: 0px" readonly>
18
+            </div>
19
+            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
20
+
21
+            <!-- 右侧悬浮按钮 -->
22
+            <div class="layui-form layuimini-form" style="padding-bottom: 100px">
23
+                <div class="right-bottom-btn">
24
+                    <button class="layui-btn" lay-filter="cancleBtn">
25
+                        <i class="layui-icon layui-icon-close"></i>关闭
26
+                    </button>
27
+                </div>
28
+            </div>
29
+        </form>
30
+    </div>
31
+</div>
32
+<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
33
+<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
34
+<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
35
+<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
36
+<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
37
+<script th:inline="javascript" type="text/javascript">
38
+    AjaxUtil.ctx = /*[[@{/}]]*/'';
39
+    layui.use(['form', 'treeTable', 'tableSelect', 'laydate','table'], function () {
40
+
41
+        var form = layui.form,
42
+            table = layui.table;
43
+        var xmApprove = parent.getXmApproval();
44
+        var xgjl = new Array();
45
+        var dataCompany = new Array();
46
+        $("#xm").val(xmApprove.xm);
47
+        form.render();
48
+
49
+
50
+        $.ajax({
51
+            url: AjaxUtil.ctx + 'prjProjectXgjl/getXGJL/' + xmApprove.xmid,
52
+            type: "post",
53
+            async: false,
54
+            dataType: "json",
55
+            success: function (result) {
56
+                xgjl = result;
57
+            }
58
+        });
59
+        $.ajax({
60
+            url: AjaxUtil.ctx + 'prjCompletecompany/list/' + xmApprove.xmid,
61
+            type: "post",
62
+            async: false,
63
+            dataType: "json",
64
+            success: function (result) {
65
+                dataCompany = result.data.rows;
66
+            }
67
+        });
68
+        var dynamicColumns = [];
69
+        for (var i = 0; i < dataCompany.length; i++) {
70
+            dynamicColumns.push({field: "dw" + (i + 1), width: '10%', title: dataCompany[i].dwmc + '(万元)'})
71
+            if (i >= 9)
72
+                break;
73
+        }
74
+        for (var i = 0; i < xgjl.length; i++) {
75
+            field = 'xg'+xgjl[i].xh;
76
+            title = xgjl[i].xgrq+'修改';
77
+            dynamicColumns.push({field: field, width: '13%', title: title}
78
+            );
79
+        }
80
+        var newcols =[
81
+            {type: 'numbers', align: 'center'},
82
+            {field: 'mc', width: '15%', title: '费用名称'},
83
+            {field: 'ysje', width: '10%', title: '预算金额'},
84
+        ].concat(dynamicColumns);
85
+        var currTable = table.render({
86
+            elem: '#currentTableId',
87
+            url: AjaxUtil.ctx + 'prjProject/redordData/' + xmApprove.xmid,
88
+            method: 'post',
89
+            cols:[newcols],
90
+            autoSort: false,
91
+            limit: 30,
92
+            maxmin:true,
93
+            skin: 'grid',
94
+            parseData: function (res) { //res 即为原始返回的数据
95
+                return {
96
+                    "code": res.code, //解析接口状态
97
+                    "msg": res.message, //解析提示文本
98
+                    "count": res.data.total, //解析数据长度
99
+                    "data": res.data.rows, //解析数据列表
100
+                };
101
+            }
102
+        });
103
+
104
+        // 监听取消按钮
105
+        $("button[lay-filter='cancleBtn']").click(function () {
106
+            var iframeIndex = parent.layer.getFrameIndex(window.name);
107
+            parent.layer.close(iframeIndex);
108
+        });
109
+    });
110
+</script>
111
+</body>
112
+</html>