Browse Source

同步已执行按钮

梁世豪 11 months ago
parent
commit
eaf2f5b6d8
1 changed files with 43 additions and 1 deletions
  1. 43 1
      src/main/resources/templates/annualbudget/list.html

+ 43 - 1
src/main/resources/templates/annualbudget/list.html

@@ -112,6 +112,10 @@
112 112
 <!--                <button class="layui-btn layui-btn-sm" lay-event="exportExcel">-->
113 113
 <!--                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出列表-->
114 114
 <!--                </button>-->
115
+                <button class="layui-btn layui-btn-sm" lay-event="tongBu" style="background: #FF8040"
116
+                        id="tbYzx">
117
+                    同步已执行
118
+                </button>
115 119
             </div>
116 120
         </script>
117 121
 
@@ -175,6 +179,9 @@
175 179
                 // 测试打印出后端返回的权限列表
176 180
                 // let permissionSet = [[${permissionSet}]];
177 181
                 // console.log(JSON.stringify(permissionSet));
182
+                if (userId != 40 && userId != 42 && userId != 1) {
183
+                    document.getElementById("tbYzx").style.display = 'none';
184
+                }
178 185
             }
179 186
         });
180 187
 
@@ -605,7 +612,42 @@
605 612
                     });
606 613
                 });
607 614
             }
608
-        }
615
+        }else if (obj.event==='tongBu'){
616
+                var project = table.cache["currentTableId"];
617
+                if (project.length == 0) {
618
+                    return;
619
+                }
620
+                var checkStatus = table.checkStatus('currentTableId')
621
+                    , data = checkStatus.data;
622
+                if (data == null || data.length === 0) {
623
+                    Message.warning("请选择要同步数据的年度预算!", 1500);
624
+                } else if (data.length > 1) {
625
+                    Message.warning("请选择一条记录进行同步!", 1500);
626
+                }  else {
627
+
628
+                    layer.confirm('确定要将该年度预算进行数据同步吗?', function (index) {
629
+                        layer.close(index);
630
+                        AjaxUtil.get({
631
+                            url: AjaxUtil.ctx + "updateSJYZXAndXTJSYZX/"+data[0].rws+"/"+data[0].id,
632
+                            contentType: "application/json",
633
+                            success: function (res) {
634
+                                if (res.code === 0) {
635
+                                    Message.success(1500, res.message, function () {
636
+                                        // 重载表格
637
+                                        currTable.reload();
638
+
639
+                                    });
640
+                                } else {
641
+                                    Message.error(res.message, 1000);
642
+                                }
643
+                            },
644
+                            error: function () {
645
+                            }
646
+                        });
647
+                    });
648
+
649
+                }
650
+            }
609 651
     });
610 652
 
611 653