123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- // 添加分组
- function bindAddProjectGroup() {
- $("#addProjectGroupBtn").click(function () {
- doLoader("/projectGroup/page/add");
- });
- }
- // 修改分组
- function bindEditProjectGroup($projectGroupSelect) {
- $("#editProjectGroupBtn").click(function () {
- var $id = $projectGroupSelect.selectpicker('val');
- if (!isBlank($id)) {
- doLoader('/projectGroup/page/edit?id=' + $id);
- return;
- }
- bootGrowl("请选择分组", "danger");
- });
- }
- // 删除分组
- function bindRemoveProjectGroup($projectGroupSelect) {
- $("#removeProjectGroupBtn").click(function () {
- var $id = $projectGroupSelect.selectpicker('val');
- if (isBlank($id)) {
- bootGrowl("请选择分组", "danger");
- return;
- }
- BootstrapDialog.show({
- title: "提示",
- type: BootstrapDialog.TYPE_INFO,
- message: "确认删除分组?",
- size: BootstrapDialog.SIZE_NORMAL,
- buttons: [{
- label: "确定",
- action: function (dialog) {
- doPoster('/projectGroup/remove',{id: $id}, function (data) {
- if (data.success == true) {
- // 显示主页
- backIndexPage();
- bootGrowl(data.resultValue, "success");
- } else {
- bootGrowl(data.resultValue, "danger");
- }
- });
- dialog.close();
- }
- }, {
- label: "取消",
- action: function (dialog) {
- dialog.close();
- }
- }]
- });
- });
- }
- // 给分组下拉绑定事件
- function bindProjectGroupSelect($projectGroupSelect) {
- // 绑定选择事件
- $projectGroupSelect.on('change, changed.bs.select', function () {
- $.loadingT(true);
- doLoader("/index?projectGroupId=" + $(this).val());
- });
- }
- // 添加连接
- function bindAddConnector() {
- // 绑定添加连接按钮点击事件
- $("#indexAddConnectorBtn").click(function () {
- doLoader('/connector/page/add');
- });
- }
- // 编辑连接
- function bindEditConnector() {
- $(".connectorList .dbsyncer_block").click(function () {
- var $id = $(this).attr("id");
- doLoader('/connector/page/edit?id=' + $id);
- });
- }
- // 添加驱动
- function bindAddMapping() {
- $("#indexAddMappingBtn").click(function () {
- doLoader('/mapping/pageAdd');
- });
- }
- // 编辑驱动
- function bindEditMapping() {
- $(".mappingList .dbsyncer_block").click(function () {
- var $id = $(this).attr("id");
- doLoader('/mapping/page/edit?id=' + $id);
- });
- }
- // 查看驱动日志
- function bindQueryData() {
- $(".mappingList .queryData").click(function () {
- // 阻止触发click传递事件
- event.cancelBubble=true;
- var $menu = $('#menu > li');
- $menu.removeClass('active');
- $menu.find("a[url='/monitor']").parent().addClass('active');
- var $id = $(this).attr("id");
- doLoader('/monitor?id=' + $id);
- });
- }
- function bindConnectorDropdownMenu() {
- $(".connectorList .dropdown-menu li").click(function () {
- var $url = $(this).attr("url");
- // 如果当前为恢复状态
- BootstrapDialog.show({
- title: "警告",
- type: BootstrapDialog.TYPE_DANGER,
- message: "确认删除连接?",
- size: BootstrapDialog.SIZE_NORMAL,
- buttons: [{
- label: "确定",
- action: function (dialog) {
- doPost($url);
- dialog.close();
- }
- }, {
- label: "取消",
- action: function (dialog) {
- dialog.close();
- }
- }]
- });
- });
- }
- // 给驱动下拉菜单绑定事件
- function bindMappingDropdownMenu() {
- $(".mappingList .dropdown-menu li").click(function () {
- var $url = $(this).attr("url");
- var $confirm = $(this).attr("confirm");
- var $confirmMessage = $(this).attr("confirmMessage");
- if ("true" == $confirm) {
- // 如果当前为恢复状态
- BootstrapDialog.show({
- title: "警告",
- type: BootstrapDialog.TYPE_DANGER,
- message: $confirmMessage,
- size: BootstrapDialog.SIZE_NORMAL,
- buttons: [{
- label: "确定",
- action: function (dialog) {
- doPost($url);
- dialog.close();
- }
- }, {
- label: "取消",
- action: function (dialog) {
- dialog.close();
- }
- }]
- });
- return;
- }
- doPost($url);
- });
- }
- function doPost(url) {
- doPoster(url, null, function(data){
- if (data.success == true) {
- // 显示主页
- backIndexPage();
- bootGrowl(data.resultValue, "success");
- } else {
- bootGrowl(data.resultValue, "danger");
- }
- });
- }
- $(function () {
- // 初始化select插件
- initSelectIndex($(".select-control"), 1);
- bindAddProjectGroup();
- var $projectGroupSelect = $("#projectGroup");
- bindEditProjectGroup($projectGroupSelect);
- bindRemoveProjectGroup($projectGroupSelect);
- bindProjectGroupSelect($projectGroupSelect);
- bindAddConnector();
- bindEditConnector();
- bindAddMapping();
- bindEditMapping();
- bindQueryData();
- bindConnectorDropdownMenu();
- bindMappingDropdownMenu();
- });
|