Ver código fonte

弹框配置后台页面优化

chenyanan 1 ano atrás
pai
commit
d96e93d485

+ 1 - 1
suishenbang-admin/src/main/java/com/dgtly/web/controller/system/AlertConfigurationController.java

@@ -122,7 +122,7 @@ public class AlertConfigurationController extends BaseController
                 return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
             }else {
                 if (alertConfiguration.getAlertStatus().equals("1")){
-                    return AjaxResult.error("列表中只能有一条日志配置");
+                    return AjaxResult.error("列表中只能有一条日志配置启动");
                 }else {
                     return toAjax(alertConfigurationService.updateAlertConfiguration(alertConfiguration));
                 }

+ 32 - 1
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html

@@ -106,7 +106,7 @@
                     title : '弹框每日可弹次数'
                 },
                 {
-                    field : 'userType', 
+                    field : 'userType',
                     title : '用户类型',
                     formatter: function(value, row, index) {
                         if (value.indexOf('1') != -1 && value.indexOf('0') != -1){
@@ -120,6 +120,14 @@
                         }
                     }
                 },
+                    {
+                        visible: editFlag == 'hidden' ? false : true,
+                        title: '是否启动',
+                        align: 'center',
+                        formatter: function (value, row, index) {
+                            return statusTools(row);
+                        }
+                    },
                 {
                     field : 'alertStatus', 
                     title : '是否启动',
@@ -145,6 +153,29 @@
             };
             $.table.init(options);
         });
+
+        /* 启动状态显示 */
+        function statusTools(row) {
+            if (row.alertStatus == 0) {
+                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.alertId + '\')"></i> ';
+            } else {
+                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.alertId + '\')"></i> ';
+            }
+        }
+
+        /* 停用 */
+        function disable(roleId) {
+            $.modal.confirm("确认关闭该通知吗?", function() {
+                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 0 });
+            })
+        }
+
+        /* 启用 */
+        function enable(roleId) {
+            $.modal.confirm("确认启用该通知吗?", function() {
+                $.operate.post(prefix + "/edit", { "alertId": roleId, "alertStatus": 1 });
+            })
+        }
     </script>
 </body>
 </html>