Explorar o código

付款页面增加作废按钮,系统管理员及科研管理专责有权限作废

ly hai 7 meses
pai
achega
1aa47830a9

+ 14 - 0
src/main/java/com/liang/controller/StaPayapprovalController.java

@@ -699,5 +699,19 @@ public class StaPayapprovalController extends BaseController {
699 699
 
700 700
         return staPayapproval;
701 701
     }
702
+
703
+    @RequestMapping(value = "/getZf",method = RequestMethod.POST)
704
+    @ResponseBody
705
+    public BaseResult getZf(
706
+            @RequestParam(required = false, defaultValue = "",value = "id") Integer id) {
707
+       StaPayapproval staPayapproval =  staPayapprovalService.queryById(id);
708
+       staPayapproval.setSpzt("作废");
709
+       int mun = staPayapprovalService.update(staPayapproval);
710
+       if (mun <=  0){
711
+         return   BaseResult.failure("'"+staPayapproval.getFkjh()+"'"+"该笔付款计划作废失败!");
712
+       }
713
+        return  BaseResult.success("该笔付款计划作废成功 ");
714
+    }
715
+
702 716
 }
703 717
 

+ 86 - 11
src/main/resources/templates/payapply/list.html

@@ -7,6 +7,24 @@
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">
10
+
11
+    <style>
12
+
13
+        .layui-btn-container {
14
+            display: flex; /* 使用flex布局 */
15
+            flex-wrap: wrap; /* 允许换行 */
16
+        }
17
+
18
+        .layui-btn-container button {
19
+            margin-right: 5px; /* 设置按钮右侧间距为5px */
20
+        }
21
+
22
+        /* 可选:去掉最后一个按钮的右边距,以避免额外的间距 */
23
+        .layui-btn-container button:last-child {
24
+            margin-right: 0;
25
+        }
26
+
27
+    </style>
10 28
 </head>
11 29
 <body>
12 30
 <div class="layuimini-container">
@@ -122,9 +140,9 @@
122 140
                 <button class="layui-btn layui-btn-sm iconfont layui-icon-export" lay-event="export" style="background-color: black">
123 141
                     <i class="layui-icon"  style="font-size: 10px;"></i>导出列表
124 142
                 </button>
125
-<!--                <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nullify">-->
126
-<!--                    <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>作废-->
127
-<!--                </button>-->
143
+                <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nullify" id="zf" style="display: none">
144
+                    <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>作废
145
+                </button>
128 146
 <!--                <button class="layui-btn layui-btn-sm" lay-event="exportExcel">
129 147
                     <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出列表
130 148
                 </button>-->
@@ -186,7 +204,6 @@
186 204
         var userId = $("#userId").val();
187 205
         var selectYear = $("#nf").val();
188 206
 
189
-
190 207
         //日期
191 208
         laydate.render({
192 209
             elem: '#cjsj1'
@@ -194,7 +211,6 @@
194 211
         laydate.render({
195 212
             elem: '#cjsj2'
196 213
         });
197
-
198 214
         var currTable = table.render({
199 215
             elem: '#currentTableId',
200 216
             url: AjaxUtil.ctx + 'staPayapproval/list/?nf='+ selectYear,
@@ -204,7 +220,7 @@
204 220
             cols: [
205 221
                 [
206 222
                     {type: "checkbox", fixed: 'left'},
207
-                    {type: 'numbers', fixed: 'left'},
223
+                    {type: 'numbers', fixed: 'left',title: '序号'},
208 224
                     {field: 'spzt', width: '11%',title: '审批状态', fixed: 'left'},
209 225
                     {field: 'rwsmc', width: '11%', title: '项目名称', fixed: 'left'},
210 226
                     {field: 'bh', width: '11%', title: '科研编号'},
@@ -238,6 +254,7 @@
238 254
                 // console.log(JSON.stringify(permissionSet));
239 255
             }
240 256
         });
257
+        // 只有科研项目管理专责 或者 系统管理员 超级管理员有权限 作废项目
241 258
 
242 259
         // 监听搜索操作
243 260
         form.on('submit(data-search-btn)', function (data) {
@@ -517,10 +534,9 @@
517 534
                 a.click();
518 535
                 a.parentNode.removeChild(a);
519 536
             }
520
-
521
-    else if(obj.event==='tjrevokeApprove'){
522
-            var projects = table.cache["currentTableId"];
523
-            if (projects.length == 0)
537
+            else if(obj.event==='tjrevokeApprove'){
538
+                var projects = table.cache["currentTableId"];
539
+                if (projects.length == 0)
524 540
                 return;
525 541
             var checkStatus = table.checkStatus('currentTableId')
526 542
                 , data = checkStatus.data;
@@ -568,7 +584,49 @@
568 584
                     });
569 585
                 });
570 586
             }
571
-        }
587
+        }else if (obj.event === "nullify"){
588
+                // 获取table 元素
589
+                var dataBudget = table.cache["currentTableId"];
590
+                if(dataBudget.length == 0)
591
+                    return;
592
+
593
+                var checkStatus = table.checkStatus('currentTableId')
594
+                    , data = checkStatus.data;
595
+                if (data == null || data.length === 0) {
596
+                    Message.warning("请选择要作废的付款申请!", 1500);
597
+                    return;
598
+                } else if (data.length > 1) {
599
+                    Message.warning("请选择一条记录进行作废!", 1500);
600
+                    return;
601
+                } else if (data[0].spzt == "作废") {
602
+                    Message.warning("该付款申请已作废!", 1500);
603
+                    return;
604
+                } else if (data[0].spzt != null && data[0].spzt.indexOf("未提交") < 0) {
605
+                    Message.warning("该付款申请审批中,不能作废!", 2000);
606
+                    return;
607
+                }else {
608
+                    layer.confirm('确定要作废付款申请吗?', function (index) {
609
+                        layer.close(index);
610
+                        AjaxUtil.post({
611
+                            url: AjaxUtil.ctx + "staPayapproval/getZf?id="+data[0].id,
612
+                            contentType: "application/json",
613
+                            data: JSON.stringify(data),
614
+                            success: function (res) {
615
+                                if (res.code === 0) {
616
+                                    Message.success(1500, res.message, function () {
617
+                                        // 重载表格
618
+                                        currTable.reload();
619
+                                    });
620
+                                } else {
621
+                                    Message.error(res.message, 1000);
622
+                                }
623
+                            },
624
+                            error: function (error) {
625
+                            }
626
+                        });
627
+                    });
628
+                }
629
+            }
572 630
     });
573 631
 
574 632
         //双击
@@ -587,6 +645,21 @@
587 645
             });
588 646
         });
589 647
     });
648
+
649
+    $(document).ready(function () {
650
+       setTimeout(function () {
651
+           const useId = $("#userId").val()
652
+           if ( $("#userId").val() == 1 || $("#userId").val() == 42){
653
+               $("#zf").css('display','block')
654
+               layer.msg("按钮权限加载已完成",{icon:1});
655
+               /*document.getElementById('zf').style.display = 'block';
656
+           */}
657
+
658
+
659
+       },1000);
660
+    });
661
+
662
+
590 663
     function getXmApproval() {
591 664
         return xmApproval;
592 665
     }
@@ -594,6 +667,8 @@
594 667
     function setUpdateFlag() {
595 668
         updateflag = 1;
596 669
     }
670
+
671
+
597 672
 </script>
598 673
 </body>
599 674
 </html>