| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // var page_size=10;
- function queryConstant(){
- var data = {
- "flag_name": $("#keywords").val()
- }
- var cols = [
- {width: 40, text: '序号', type: 'number', flex: true, field: 'num'},
- {width: 40, text: '字典值', type: 'string', flex: true, field: 'code_value'},
- {width: 80, text: '字典名称', type: 'string', flex: true, field: 'code_name'},
- {width: 60, text: '有效标志', type: 'string', flex: true, field: 'valid'},
- {width: 160, text: '字典标识', type: 'string', flex: true, field: 'code_flag'},
- {width: 160, text: '标识名称', type: 'string', flex: true, field: 'flag_name'},
- {width: 80, text: '备注', type: 'string', flex: true, field: 'remark'},
- {width: 80, text: '操作', type: 'string', flex: true, field: 'id',
- oper:[
- {func:'showEditConstant',text:'修改',icon_class:'icon-edit'},
- {func:'deleteConstant',text:'删除',icon_class:'icon-remove-circle'}
- ]
- }
- ];
-
- // var pager = {
- // page_size:10
- // }
- $('.datatable').mytable({'cols':cols,
- 'url':"/constant/getConstantByName/",
- 'param':data}
- );
- }
- function showAddConstant(){
- $('#code_flag').val('');
- $('#flag_name').val('');
- $('#code_value').val('');
- $('#code_name').val('');
- $('#sort_no').val('');
- $('#remark').val('');
- $("#valid").attr('checked','true');
- showPopup4Common('添加常量',function(){
- addOrUpdateConstant("/constant/add/");
- },'400px');
- }
- var cur_id;
- function addOrUpdateConstant(url){
- var valid=1;
- if(!$("#valid").is(':checked')) valid=0;
- var param ={
- 'id':cur_id,
- 'code_flag':$('#code_flag').val(),
- 'flag_name':$('#flag_name').val(),
- 'code_value':Number($('#code_value').val()),
- 'code_name':$('#code_name').val(),
- 'sort_no':Number($('#sort_no').val()),
- 'remark':$('#remark').val(),
- 'valid':valid
- };
- addOrUpdateItem4Common(param,url,queryConstant);
- }
- function showEditConstant(id){
- cur_id='';
- var rowData=getItemByIdFromArr(id,$('.datatable').mytable('getTableData'));
- if(rowData) {
- cur_id = rowData.id;
- $('#code_flag').val(rowData.code_flag);
- $('#flag_name').val(rowData.flag_name);
- $('#code_value').val(rowData.code_value);
- $('#code_name').val(rowData.code_name);
- $('#sort_no').val(rowData.sort_no);
- $('#remark').val(rowData.remark);
- if(rowData.valid==1){
- $("#valid").attr('checked','true');
- }else{
- $("#valid").attr('checked','false');
- }
- showPopup4Common('修改常量',function(){
- addOrUpdateConstant("/constant/update/");
- },'400px');
- }
- }
- function deleteConstant(id){
- deleteItem4Common(id,"/constant/delete/",queryConstant);
- }
|