K.define(‘kuser.kuserment’,{
 kpartname:‘测试用户管理’,//模块名称
 gridid:“kuser_gridlist”,//表格列表id
 addwin:“kuser_addwin”,//添加弹出win id
 updwim:“kuser_updatewin”,//修改弹出win id
 editFlag:undefined,
 /**
 *** 初始化
 * @param me
 * @param type**
 /
 init: function (me,type) {
 me.kuser_gridlist(me);
 },
 /
 * 渲染表格
 * @param me
 /
 kuser_gridlist:function(me){
 var listid=me.gridid;
 $("#"+listid,me.contentTarget).datagrid({
 url:“king/showUserListByJson”,
 queryParams:{},
 title:’’,
 width:‘98%’,
 rownumbers: true, //是否显示列数
 loadMsg: “正在加载数据…”,
 pagination:true ,
 //pagePosition:“top”,
 fit: true, //自适应大小
 border:false,
 nowrap: true,//数据长度超出列宽时将会自动截取。
 fitColumns:true,//自动使列适应表格宽度以防止出现水平滚动。
 singleSelect:true,
 autoRowHeight:true,
 toolbar: [{
 text:‘添加’,
 iconCls: ‘icon-add’,
 handler: function(){
 me.kuser_add(me);
 }
 },’-’,{
 text:‘修改’,
 iconCls: ‘icon-edit’,
 handler: function(){
 me.kuser_update(me,1);
 }
 }],
 columns:[[
 { field:‘ck’,checkbox:true },
 {field:‘username’,title:‘用户名’,width:120,align:‘center’},
 {field:‘password’,title:‘密码’,width:120,align:‘center’},
 {field:’_operate’,title:‘操作’,width:80,align:‘center’,formatter: function(value,row,index){
 if(row){
 var id=row.id;
 return “<a href=“javascript:void(0)” class=“editcls” οnclick=“ivk(‘kuser.kuserment.kuser_update’,”+id+”)">修改";
 }
 }}
 ]],
 onLoadSuccess:function(data){
 $(’.editcls’).kuserbutton({text:‘编辑’,plain:true,iconCls:‘icon-edit’});
 $("#"+listid,me.contentTarget).datagrid(‘fixRowHeight’);
 }
 });
 var p = $("#"+listid,me.contentTarget).datagrid(“getPager”);
 KaTeX parse error: Expected 'EOF', got '}' at position 277: …' }); }̲, /** * …("#username",’#’+formid,me.contentTarget).val();//名称
 var kpass=$("#password",’#’+formid,me.contentTarget).val();//密码
 var param = {“username” :kname,“password”:kpass};
 $(’#’+listid,me.contentTarget).datagrid(“load”,param);
 },
 /*
 * 弹出添加界面
 * @param me
 */
 kuser_add:function(me){
 K.tpl({
 tpl: “resources/template/kuser/kuserment_win.html”,
 success: function(html,data){
 var dialogs = $(’
’).dialog({
 title: ‘添加信息’,
 width:‘600’,
 height:‘160’,
 iconCls: ‘icon-edit’,
 content:html,
 modal: true,
 buttons:[{text:‘保存’,iconCls:“icon-save”,handler:function(){
 me.upresult_save(me,dialogs);
 }},{text:‘取消’,iconCls:“icon-no”,handler:function(){
 $(dialogs).dialog(‘destroy’);}}
 ],
 closed: false,
 cache: false,
 onClose : function() {
 $(this).dialog(‘destroy’);
 }
 });
 }
 });
},
 /**
- 修改弹出界面
 */
 kuser_update:function(me,kid){
 K.tpl({
 tpl: “resources/template/kuser/kuserment_win.html”,
 url:“king/showUserbyid”,
 data:{“kid”:kid},
 success: function(html,data){
 var dialogs = $(’
  ’).dialog({
 title: ‘修改信息’,
 width:‘600’,
 height:‘160’,
 iconCls: ‘icon-edit’,
 content:html,
 modal: true,
 buttons:[{text:‘保存’,iconCls:“icon-save”,handler:function(){
 me.upresult_save(me,dialogs);
 }},{text:‘取消’,iconCls:“icon-no”,handler:function(){
 $(dialogs).dialog(‘destroy’);}}
 ],
 closed: false,
 cache: false,
 onClose : function() {
 $(this).dialog(‘destroy’);
 }
 });
 }
 });
 },
 //保存数据
 upresult_save:function(me,dialogs){
 $.messager.progress();
 $(’#kuser_myform’,dialogs).form(‘submit’, {
 url: “king//usersavedata”,
 onSubmit: function(){
 var isValid = $(dialogs).form(‘validate’);
 if (!isValid){
 $.messager.progress(‘close’);
 }
 return isValid;
 },
 success: function(result){
 $.messager.progress(‘close’);
 if(result){
 dialogs.dialog(‘destroy’);
 $("#"+me.gridid,me.contentTarget).datagrid(‘reload’);
 K.kmessager(‘提示’,‘用户修改成功!’);
 }else{
 K.kmessager(‘提示’,‘用户修改失败!’);
 }
 }
 });
 }
 }, true);