All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.modules.sys.roleinfo.ctrl.roleinfo.remove.js Maven / Gradle / Ivy

There is a newer version: 5.0.2101
Show newest version
define(function (require) {
  var Config = require('config');
  var Core = require('core/core');
  var Page = require('core/page');


  // 删除数据字典
  var RoleInfoRemove = Page.extend(function () {

    this.selfDefButton = function (row) {
      return canRemoveRole(row) && 'F' !== row.roleType;
    };

    this.renderButton = function(btn, row) {
      return this.$findUp('selfDefButton')(row);
    };

    // @override
    this.submit = function (table, data) {

      if (!canRemoveRole(data)) {
        $.messager.alert('系统内置角色不能删除。');
        return;
      }

      Core.ajax(Config.ContextPath + 'system/roleinfo/' + data.roleCode, {
        type: 'json',
        method: 'delete',
      }).then(function () {
        return require('loaders/cache/loader.system').loadAll()
      }).then(function () {
        table.datagrid('reload');
      });
    };

  });

  return RoleInfoRemove;

  function canRemoveRole(data) {
    return !~['G-SYSADMIN', 'G-anonymous', 'G-DEPLOY'].indexOf(data.roleCode);
  }
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy