From b397b0aefc81cb0475d347ebad16e565254c06e2 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期六, 18 三月 2023 17:28:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- management/guns-admin/src/main/webapp/static/modular/system/tSystemBulletin/tSystemBulletin_info.js | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 177 insertions(+), 0 deletions(-) diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tSystemBulletin/tSystemBulletin_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tSystemBulletin/tSystemBulletin_info.js new file mode 100644 index 0000000..f642ef3 --- /dev/null +++ b/management/guns-admin/src/main/webapp/static/modular/system/tSystemBulletin/tSystemBulletin_info.js @@ -0,0 +1,177 @@ +/** + * 初始化详情对话框 + */ +var TSystemBulletinInfoDlg = { + tSystemBulletinInfoData : {}, + validateFields: { + introduce: { + validators: { + notEmpty: { + message: '介绍不能为空' + } + } + }, + } +}; + +/** + * 验证数据是否为空 + */ +TSystemBulletinInfoDlg.validate = function () { + $('#systemBulletinInfoForm').data("bootstrapValidator").resetForm(); + $('#systemBulletinInfoForm').bootstrapValidator('validate'); + return $("#systemBulletinInfoForm").data('bootstrapValidator').isValid(); +}; + +/** + * 清除数据 + */ +TSystemBulletinInfoDlg.clearData = function() { + this.tSystemBulletinInfoData = {}; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +TSystemBulletinInfoDlg.set = function(key, val) { + this.tSystemBulletinInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; + return this; +} + +/** + * 设置对话框中的数据 + * + * @param key 数据的名称 + * @param val 数据的具体值 + */ +TSystemBulletinInfoDlg.get = function(key) { + return $("#" + key).val(); +} + +/** + * 关闭此对话框 + */ +TSystemBulletinInfoDlg.close = function() { + parent.layer.close(window.parent.TSystemBulletin.layerIndex); +} + +/** + * 收集数据 + */ +TSystemBulletinInfoDlg.collectData = function() { + if(UE.getEditor('content').hasContents()){ + $('#content').val(UE.getEditor('content').getContent()); + } + this + .set('id') + .set('introduce') + .set('img') + .set('content') + .set('status') + .set('state') + .set('createTime'); +} + +/** + * 提交添加 + */ +TSystemBulletinInfoDlg.addSubmit = function() { + + this.clearData(); + this.collectData(); + + if(!this.validate()){ + return ; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/add", function(data){ + Feng.success("添加成功!"); + window.parent.TSystemBulletin.table.refresh(); + TSystemBulletinInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.tSystemBulletinInfoData); + ajax.start(); +} + +/** + * 提交添加 + */ +TSystemBulletinInfoDlg.addSend = function() { + + this.clearData(); + this.collectData(); + + if(!this.validate()){ + return ; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/addSend", function(data){ + Feng.success("发送成功!"); + window.parent.TSystemBulletin.table.refresh(); + TSystemBulletinInfoDlg.close(); + },function(data){ + Feng.error("发送失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.tSystemBulletinInfoData); + ajax.start(); +} + +/** + * 提交修改 + */ +TSystemBulletinInfoDlg.editSubmit = function() { + + this.clearData(); + this.collectData(); + + if(!this.validate()){ + return ; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/update", function(data){ + Feng.success("修改成功!"); + window.parent.TSystemBulletin.table.refresh(); + TSystemBulletinInfoDlg.close(); + },function(data){ + Feng.error("修改失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.tSystemBulletinInfoData); + ajax.start(); +} + +/** + * 提交修改发送 + */ +TSystemBulletinInfoDlg.editSend = function() { + + this.clearData(); + this.collectData(); + + if(!this.validate()){ + return ; + } + + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/editSend", function(data){ + Feng.success("发送成功!"); + window.parent.TSystemBulletin.table.refresh(); + TSystemBulletinInfoDlg.close(); + },function(data){ + Feng.error("发送失败!" + data.responseJSON.message + "!"); + }); + ajax.set(this.tSystemBulletinInfoData); + ajax.start(); +} + +$(function() { + TSystemBulletinInfoDlg.editor = UE.getEditor('content'); + Feng.initValidator("systemBulletinInfoForm", TSystemBulletinInfoDlg.validateFields); +}); -- Gitblit v1.7.1