Pārlūkot izejas kodu

任务书修改申请重新提交,修改审批列表 添加与子课题的校验
子课题完成时间带入异常处理

梁世豪 4 mēneši atpakaļ
vecāks
revīzija
07933b0211

+ 3 - 1
src/main/java/com/liang/controller/PrjProjectController.java

@@ -641,7 +641,9 @@ public class PrjProjectController extends BaseController {
641 641
             }
642 642
 
643 643
         }
644
-
644
+        //获取子科目中各公司的总经费
645
+        List<PrjCompletecompany>prjCompletecompanyListFy=prjCompletecompanyService.getCompanyListFy(id);
646
+        model.addAttribute("prjCompletecompanyListFy",prjCompletecompanyListFy);
645 647
         model.addAttribute("project", project);
646 648
 
647 649
         String fileUrl = "http://" + webfileip + ":" + webfileport + "/template/";

+ 7 - 7
src/main/java/com/liang/controller/PrjSubtopicController.java

@@ -18,11 +18,9 @@ import org.springframework.ui.Model;
18 18
 import org.springframework.web.bind.annotation.*;
19 19
 
20 20
 import javax.annotation.Resource;
21
+import java.text.DateFormat;
21 22
 import java.text.SimpleDateFormat;
22
-import java.util.Date;
23
-import java.util.HashMap;
24
-import java.util.List;
25
-import java.util.Map;
23
+import java.util.*;
26 24
 
27 25
 /**
28 26
  * (PrjSubtopic)表控制层
@@ -120,11 +118,13 @@ public class PrjSubtopicController extends BaseController {
120 118
     public String forAdd(Model model, @PathVariable Integer xm) {
121 119
         //查询项目的时间信息 暂时只需要给子课题默认完成时间
122 120
         List<Map<String, Object>> projectDate = prjSubtopicService.queryProjectDate(xm);
123
-        SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd");
121
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
122
+        dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
124 123
         Date rq = (Date) projectDate.get(0).get("WC");
125 124
         Date qs = (Date) projectDate.get(0).get("QS");
126
-        String wcrq = format.format(rq);
127
-        String qsrq = format.format(qs);
125
+
126
+        String wcrq = dateFormat.format(rq);
127
+        String qsrq = dateFormat.format(qs);
128 128
         model.addAttribute("qsrq", qsrq);
129 129
         model.addAttribute("wcrq", wcrq);
130 130
         model.addAttribute("xm", xm);

+ 1 - 1
src/main/resources/templates/prjproject/list_myproject.html

@@ -96,7 +96,7 @@
96 96
                     <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出
97 97
                 </button>
98 98
                 <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="Xgsq">
99
-                    <i class="layui-icon layui-icon-file" style="font-size: 10px;"></i>修改申请
99
+                    <i class="layui-icon layui-icon-file" style="font-size: 10px;"></i>预算修改申请
100 100
                 </button>
101 101
 
102 102
             </div>

+ 115 - 44
src/main/resources/templates/prjproject/xg_update.html

@@ -31,12 +31,12 @@
31 31
                             <div class="layui-input-inline" style="width: 30%">
32 32
                                 <input type="hidden" id="id" name="id" th:value="${project.id}">
33 33
                                 <input type="text" id="zwmc" name="zwmc" lay-verify="required" lay-reqtext="中文名称不能为空"
34
-                                       placeholder="项目名称(中文)不能超过30字(含字符)" autocomplete="off" th:value="${project.zwmc}"
34
+                                       placeholder="项目名称(中文)不能超过30字(含字符)" readonly autocomplete="off" th:value="${project.zwmc}"
35 35
                                        class="layui-input">
36 36
                             </div>
37
-                            <label class="layui-form-label" style="width: 15%">学科分类1</label>
37
+                            <label class="layui-form-label"  style="width: 15%">学科分类1</label>
38 38
                             <div class="layui-input-inline" style="width: 30%">
39
-                                <select name="xkfl1" id="xkfl1" lay-filter="xkfl">
39
+                                <select name="xkfl1" id="xkfl1" lay-filter="xkfl" disabled>
40 40
                                     <option value="">[无]</option>
41 41
                                     <option value="-1">[浏览]</option>
42 42
                                     <option th:value="${project.xkfl1}" th:text="${project.xkflmc1}" selected></option>
@@ -47,11 +47,11 @@
47 47
                             <label class="layui-form-label" style="width: 10%">英文名称</label>
48 48
                             <div class="layui-input-inline" style="width: 30%">
49 49
                                 <input type="text" id="ywmc" name="ywmc" placeholder="项目名称(英文)不能超过30字(含字符)"
50
-                                       autocomplete="off" th:value="${project.ywmc}" class="layui-input">
50
+                                       readonly autocomplete="off" th:value="${project.ywmc}" class="layui-input">
51 51
                             </div>
52 52
                             <label class="layui-form-label" style="width: 15%">学科分类2</label>
53 53
                             <div class="layui-input-inline" style="width: 30%">
54
-                                <select name="xkfl2" id="xkfl2" lay-filter="xkfl">
54
+                                <select name="xkfl2" id="xkfl2" lay-filter="xkfl" disabled>
55 55
                                     <option value="">[无]</option>
56 56
                                     <option value="-1">[浏览]</option>
57 57
                                     <option th:value="${project.xkfl2}" th:text="${project.xkflmc2}" selected></option>
@@ -62,12 +62,12 @@
62 62
                             <label class="layui-form-label required" style="width: 10%">ERP编号</label>
63 63
                             <div class="layui-input-inline" style="width: 30%">
64 64
                                 <input type="text" id="erpbh" name="erpbh" th:value="${project.erpbh}"
65
-                                       autocomplete="off" class="layui-input" lay-verify="required"
65
+                                       autocomplete="off" class="layui-input" lay-verify="required" readonly
66 66
                                        lay-reqtext="ERP编号不能为空">
67 67
                             </div>
68 68
                             <label class="layui-form-label" style="width: 15%">学科分类3</label>
69 69
                             <div class="layui-input-inline" style="width: 30%">
70
-                                <select name="xkfl3" id="xkfl3" lay-filter="xkfl">
70
+                                <select name="xkfl3" id="xkfl3" lay-filter="xkfl" disabled>
71 71
                                     <option value="">[无]</option>
72 72
                                     <option value="-1">[浏览]</option>
73 73
                                     <option th:value="${project.xkfl3}" th:text="${project.xkflmc3}" selected></option>
@@ -84,7 +84,7 @@
84 84
                             </div>
85 85
                             <label class="layui-form-label" style="width: 15%">所属国民经济行业</label>
86 86
                             <div class="layui-input-inline" style="width: 30%">
87
-                                <select name="ssgmjjhy" id="ssgmjjhy" lay-filter="gmjjhy">
87
+                                <select name="ssgmjjhy" id="ssgmjjhy" lay-filter="gmjjhy" disabled>
88 88
                                     <option value="">[无]</option>
89 89
                                     <option value="-1">[浏览]</option>
90 90
                                     <option th:value="${project.ssgmjjhy}" th:text="${project.ssgmjjhymc}"
@@ -103,13 +103,13 @@
103 103
                             <label class="layui-form-label" style="width: 15%">是否国家秘密技术项目</label>
104 104
                             <div class="layui-input-inline">
105 105
                                 <input type="checkbox" name="sfgjmmjsxm" lay-skin="primary"
106
-                                       th:checked="${project.sfgjmmjsxm}">
106
+                                       th:checked="${project.sfgjmmjsxm}" disabled>
107 107
                             </div>
108 108
                         </div>
109 109
                         <div class="layui-form-item layui-inline" style="width: 100%">
110 110
                             <label class="layui-form-label" style="width: 10%">费用来源</label>
111 111
                             <div class="layui-input-inline" style="width: 30%">
112
-                                <input type="text" id="fyly" name="fyly" autocomplete="off" th:value="${project.fyly}"
112
+                                <input type="text" id="fyly" name="fyly" autocomplete="off" th:value="${project.fyly}" readonly
113 113
                                        class="layui-input">
114 114
                             </div>
115 115
                             <label class="layui-form-label required" style="width: 15%">项目起止时间</label>
@@ -117,13 +117,13 @@
117 117
                                 <div class="layui-input-inline" style="width: 138px">
118 118
                                     <input type="text" name="qs" id="qs" lay-verify="required|date" placeholder="开始日期"
119 119
                                            lay-reqtext="开始日期不能为空" autocomplete="off" th:value="${project.qs}"
120
-                                           class="layui-input">
120
+                                           class="layui-input" disabled>
121 121
                                 </div>
122 122
                                 <div class="layui-form-mid">-</div>
123 123
                                 <div class="layui-input-inline" style="width: 138px">
124 124
                                     <input type="text" name="wc" id="wc" lay-verify="required|date" placeholder="结束日期"
125 125
                                            lay-reqtext="结束日期不能为空" autocomplete="off" th:value="${project.wc}"
126
-                                           class="layui-input">
126
+                                           class="layui-input" disabled>
127 127
                                 </div>
128 128
                                 <br>
129 129
                                 <tip>日期格式:yyyy-MM-dd</tip>
@@ -208,7 +208,7 @@
208 208
                             <div class="layui-input-inline" style="width: 75%">
209 209
                                 <input type="hidden" id="dkyfzr" name="dkyfzr" th:value="${project.dkyfzr}"
210 210
                                        class="layui-input">
211
-                                <input type="text" id="dkyfzrxm" name="dkyfzrxm" placeholder="可多选"
211
+                                <input type="text" id="dkyfzrxm" name="dkyfzrxm" placeholder="可多选" disabled
212 212
                                        th:value="${project.dkyfzrxm}" autocomplete="off" class="layui-input"
213 213
                                        lay-verify="required" lay-reqtext="电科院负责人不能为空" readonly>
214 214
                             </div>
@@ -320,6 +320,12 @@
320 320
         var initFlag = 0;
321 321
         var zwmc = [[${project.zwmc}]]
322 322
         var xmid = [[${project.id}]]
323
+        //子课题单位分工费用统计
324
+        var prjCompletecompanyListFy = [[${prjCompletecompanyListFy}]];
325
+
326
+        //用于审批列表重新提交
327
+        var spList;
328
+        var spListId;
323 329
         //日期
324 330
         // 监听器
325 331
         laydate.render({
@@ -381,7 +387,18 @@
381 387
 
382 388
            }
383 389
        });
384
-
390
+        AjaxUtil.get({
391
+            url: AjaxUtil.ctx + 'prjApproverecord/spLists/' + xmid + '/prj_ProjectRecord',
392
+            success: function (res) {
393
+                var a   = res.length -1;
394
+                if (res[a] != null) {
395
+                    spList = res[a].wc
396
+                    spListId =res[a].id
397
+                } else {
398
+                    spList = -1;
399
+                }
400
+            }
401
+        });
385 402
         //下拉框回显
386 403
         function set_select(id, value) {
387 404
             let obj = $("#" + id)
@@ -1602,39 +1619,93 @@
1602 1619
             for (var i = 0; i < data.length; i++) {
1603 1620
                 getBudget(budgets, data[i]);
1604 1621
             }
1605
-            var index = layer.load(0, {shade: 0.1});
1606
-            // 将数据存储到中间表中
1607
-            AjaxUtil.post({
1608
-                url: AjaxUtil.ctx + 'prjBudgetRecord/addUpdateApplyRecord1/',
1609
-                contentType: "application/json",
1610
-                data: JSON.stringify(budgets),
1611
-                success: function (res) {
1612
-                    layer.close(index);
1613
-                    if (res.code === 0) {
1614
-                        var project = {
1615
-                            "xm":zwmc,
1616
-                            "xmid":xmid,
1617
-                            "zt":"未提交"
1622
+            for (let i = 0; i < prjCompletecompanyListFy.length; i++) {
1623
+                if (prjCompletecompanyListFy[i].sumjf == null){
1624
+                    prjCompletecompanyListFy[i].sumjf =0;
1625
+                }
1626
+                if ( budgets[0]['dw' + (i + 1)] == null ||  budgets[0]['dw' + (i + 1)] ==''){
1627
+                    budgets[0]['dw' + (i + 1)] ==0;
1628
+                }
1629
+                if (budgets[0]['dw' + (i + 1)] != prjCompletecompanyListFy[i].sumjf ){
1630
+                    alert("保存失败,"+prjCompletecompanyListFy[i].dwmc+'在子课题单位分工中所有经费总和为:'
1631
+                        +prjCompletecompanyListFy[i].sumjf+'万元,请确保所填数据一致!!!')
1632
+                    return false
1633
+                }
1634
+            }
1635
+            // var index = layer.load(0, {shade: 0.1});
1636
+            if (spList == false){
1637
+                layer.confirm("该年度预算的修改申请还存在未结束的审批流程,是否重新提交?",function (index) {
1638
+                    layer.close(index)
1639
+                    AjaxUtil.get({
1640
+                        url: AjaxUtil.ctx + 'prjApproverecord/updatSpList/' + spListId,
1641
+                        success: function (res) {
1642
+                            // 将数据存储到中间表中
1643
+                            AjaxUtil.post({
1644
+                                url: AjaxUtil.ctx + 'prjBudgetRecord/addUpdateApplyRecord1/',
1645
+                                contentType: "application/json",
1646
+                                data: JSON.stringify(budgets),
1647
+                                success: function (res) {
1648
+                                    // layer.close(index);
1649
+                                    if (res.code === 0) {
1650
+                                        var project = {
1651
+                                            "xm": zwmc,
1652
+                                            "xmid": xmid,
1653
+                                            "zt": "未提交"
1654
+                                        }
1655
+                                        //添加审批记录
1656
+                                        AjaxUtil.post({
1657
+                                            url: AjaxUtil.ctx + "prjApproverecord/doUpdatPrjProject",
1658
+                                            data: project,
1659
+                                            success: function (res) {
1660
+                                                Message.success('修改申请提交成功,可在审批列表中查看审批进度.', 2000);
1661
+                                                setTimeout(function () {
1662
+                                                    parent.layer.close(parent.layer.getFrameIndex(window.name)); // 关闭子窗口
1663
+                                                }, 1000);
1664
+                                            },
1665
+                                            error: function (error) {
1666
+                                            }
1667
+                                        });
1668
+                                    } else {
1669
+                                        Message.error("修改记录添加失败", 2000);
1670
+                                    }
1671
+                                }
1672
+                            });
1618 1673
                         }
1619
-                        //添加审批记录
1620
-                        AjaxUtil.post({
1621
-                            url: AjaxUtil.ctx + "prjApproverecord/doUpdatPrjProject",
1622
-                            data:project,
1623
-                            success: function (res) {
1624
-                                Message.success(res.message, 2000);
1625
-                                layer.load(0, {shade: 0.1});
1626
-                                setTimeout(function() {
1627
-                                    parent.layer.close(parent.layer.getFrameIndex(window.name)); // 关闭子窗口
1628
-                                }, 1000);
1629
-                            },
1630
-                            error: function (error) {
1674
+                    })
1675
+                })
1676
+                }else {
1677
+                AjaxUtil.post({
1678
+                    url: AjaxUtil.ctx + 'prjBudgetRecord/addUpdateApplyRecord1/',
1679
+                    contentType: "application/json",
1680
+                    data: JSON.stringify(budgets),
1681
+                    success: function (res) {
1682
+                        // layer.close(index);
1683
+                        if (res.code === 0) {
1684
+                            var project = {
1685
+                                "xm": zwmc,
1686
+                                "xmid": xmid,
1687
+                                "zt": "未提交"
1631 1688
                             }
1632
-                        });
1633
-                    } else {
1634
-                        Message.error("修改记录添加失败", 2000);
1689
+                            //添加审批记录
1690
+                            AjaxUtil.post({
1691
+                                url: AjaxUtil.ctx + "prjApproverecord/doUpdatPrjProject",
1692
+                                data: project,
1693
+                                success: function (res) {
1694
+                                    Message.success('修改申请提交成功,可在审批列表中查看审批进度.', 2000);
1695
+                                    setTimeout(function () {
1696
+                                        parent.layer.close(parent.layer.getFrameIndex(window.name)); // 关闭子窗口
1697
+                                    }, 3000);
1698
+                                },
1699
+                                error: function (error) {
1700
+                                }
1701
+                            });
1702
+                        } else {
1703
+                            Message.error("修改记录添加失败", 2000);
1704
+                        }
1635 1705
                     }
1636
-                }
1637
-            });
1706
+                });
1707
+
1708
+            }
1638 1709
             return false;
1639 1710
         });
1640 1711
         //出资方案

+ 4 - 2
src/main/resources/templates/prjsubtopic/add.html

@@ -103,14 +103,14 @@
103 103
                             <label class="layui-form-label required" style="width: 15%;margin-left: -70px">起止时间</label>
104 104
                             <div class="layui-input-inline" style="width:20%">
105 105
                                 <input type="text" name="qssj" id="qssj" placeholder="开始日期" lay-verify="required"
106
-                                       lay-reqtext="开始日期不能为空" autocomplete="off" class="layui-input" disabled>
106
+                                       lay-reqtext="开始日期不能为空" autocomplete="off" class="layui-input" >
107 107
                                 <tip>日期格式:yyyy-MM-dd</tip>
108 108
 
109 109
                             </div>
110 110
                             <div class="layui-form-mid">-</div>
111 111
                             <div class="layui-input-inline" style="width: 20%">
112 112
                                 <input type="text" name="jssj" id="jssj" placeholder="结束日期" lay-verify="required"
113
-                                       lay-reqtext="结束日期不能为空" autocomplete="off" class="layui-input" disabled>
113
+                                       lay-reqtext="结束日期不能为空" autocomplete="off" class="layui-input" >
114 114
                             </div>
115 115
                         </div>
116 116
                         <div class="layui-form-item layui-inline" style="width: 100%">
@@ -196,11 +196,13 @@
196 196
         var qsrq = [[${qsrq}]]
197 197
         var xmId = parseInt($("#xm").val());//项目任务书ID
198 198
         var wcrq = document.getElementById('wcrq').value;//项目任务书完成日期
199
+        console.log(wcrq)
199 200
         var zktId = -1;//子课题ID
200 201
 
201 202
         //申请时间
202 203
         laydate.render({
203 204
             elem: '#qssj',
205
+            value: qsrq,
204 206
             done: function (value, date, endDate) {
205 207
                 if (value<qsrq){
206 208
                     alert("开始时间不能早于任务书执行周期!!")