123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /**
- * 角色模块js
- */
- $.namespace("role.main");
- role.main.init=function(){
- //把form传入,构造翻页控件
- pageinfo($("#roleform"));
- }
- //查询
- role.main.search=function(){
- $("#roleform").submit();
- }
- //删除
- role.main.del=function(data){
-
- var _this = $(this);
- base.delGetAction({
- tip : '确定删除?',
- execute : function() {
- var roleId = _this.parent().find('#roleId').val();
- var action = 'role/delOneRole.html';
- var data = {
- roleId : roleId
- };
- base.WAP_POST(action, data, 'json', function(o) {
- if (o.statusCode == 10000) {
- alert('删除成功!');
- base.getAction('role/querylist.html');
- } else {
- alert('删除失败!');
- }
- });
- }
- });
- }
- //清空新增输入
- role.main.clear=function(){
- $("#editid").val("");
- $("#editroleName").val("");
- $("#editroleCode").val("");
- $("#editsortno").val("");
- }
- /*role.main.edit=function(data){
- var roleId = $('#roleId').val();
- var action = 'role/roleInfo.html?roleId=' + roleId;
- base.getAction(action);
- }*/
- //编辑
- role.main.edit=function(data){
- $.post(basePath+"/role/edit.html", {
- id : data
- }, function(data) {
- alert(1)
- debugger;
- if(data){
- for(var a in data){
- if($("#edit"+a)){
- $("#edit"+a).val(data[a]);
- }
- }
- }
- }, "json");
- }
- //编辑和新增保存
- role.main.save=function save(){
- $.ajax({
- url:basePath+"/role/saveRole.html",
- data:$("#addform").serialize(),
- type:"post",
- dataType:"json",
- success:function(data){//ajax返回的数据
- if (data.success) {
- $.alert({
- title: '提示',
- content: '保存成功',
- confirm: function(){
-
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
-
- }
- });
- }
- }
-
- });
- },
- role.main.grant=function(date){
- alert(date)
- location.href=$.app+"/role/rolegrant.html?roleId="+date;
- }
|