/source/gl/mb/form/form_config.html
http://prosporous.googlecode.com/ · HTML · 450 lines · 424 code · 11 blank · 15 comment · 0 complexity · da667699ea57446d070b5fc7f14d157e MD5 · raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>??????</title>
- <{$showjs}>
- <link rel="stylesheet" type="text/css" href="/Plug-in/ext/resources/css/xtheme-slate.css" />
- <{$ajax}>
- <link rel="stylesheet" type="text/css" href="../css/main1.css" />
- <style type=text/css>
- <!--
- .x-btn-left{
- background-position:2px 0;
- }
- .x-btn-over .x-btn-left{
- background-position:2px -63px;
- }
- .i_sx{background-image:url(../img/arrow_refresh_small.png) !important;}
- .i_cs{background-image:url(../img/application_form_add.png) !important;}
- .i_sc{background-image:url(../img/application_form_delete.png) !important;}
- .i_qk{background-image:url(../img/application_delete.png) !important;}
- .i_px{background-image:url(../img/sucaiwcom8170000bzc.gif) !important;}
- .x-grid-record-del{text-decoration:line-through;background:#FFF893;color:#000;}
- .x-grid-record-new{color:#00933B;}
- --> </style>
- <script type="text/javascript" src="/Plug-in/ext/Ext.grid.CheckColumn.js"></script>
- <script type="text/javascript">
- Ext.onReady(function(){
- var myMask = new Ext.LoadMask(Ext.getBody(), {
- msg: '???...'
- });
- var fm = Ext.form;
- var sm = new Ext.grid.CheckboxSelectionModel();
- var fields = [
- sm,
- {name: 'id', mapping : 'id'},
- {name: 'fname', mapping : 'fname'},
- {name: 'name', mapping : 'name'},
- {name: 'type', mapping : 'type'},
- {name : 'cfg', mapping : 'cfg'},
- {name : 'xr', mapping : 'xr'},
- {name : 'del',type:'int'},
- {name : 'isnew',type:'int'}
- ];
- var store = new Ext.data.JsonStore({
- id:'store',
- url: 'form_config.php',
- fields: fields
- });
- var comboStore = new Ext.data.JsonStore({
- id:'comboStore',
- url: 'form_config.php',
- fields: ['name','value']
- });
- comboStore.load({params:{op: 'combo_store'}});
- var donotrender = new Ext.grid.CheckColumn({
- header: "??????",
- dataIndex: 'xr',
- width: 80
- });
- var delRender = new Ext.grid.CheckColumn({
- header:'??',
- dataIndex:'del',
- width:50
- })
- var row_id=0;
- var cm = new Ext.grid.ColumnModel([
- {
- id : 'id',
- header: "????",
- dataIndex: 'id',
- width: 80/*,
- renderer:function(value,cellmeta,record,rowIndex){
- return rowIndex+1;}*/
- },{
- id : 'fname',
- header: "???",
- dataIndex: 'fname',
- width: 80
- },{
- id : 'name',
- header: "???",
- dataIndex: 'name',
- width: 100,
- editor: new fm.TextField({
- allowBlank: false
- })
- },
- {
- id : 'type',
- header: "??",
- dataIndex: 'type',
- width: 130,
- editor: new fm.ComboBox({
- id : 'catalog',
- name : 'catalog',
- emptyText :'??????',
- fieldLabel : '??',
- allowBlank : true,
- store:comboStore,
- hiddenName : 'type',
- selectOnFocus:true,
- mode:'local',
- readOnly :true,
- displayField: "value",
- valueField :'name',
- forceSelection: true,
- triggerAction: "all"
- })
- },{id : 'cfg', header: "????", sortable: true,width:80, dataIndex: 'cfg',renderer:function(val){
- return val==1?'<img src="../img/wrench.png" width="12">????':'<img src="../img/wrench_orange.png" width="12">????';
- }},donotrender,
- //??
- delRender
-
- ]);
- store.load({params:{op: 'formitem',tid:'<{$tid}>',lg:'<{$lg}>'}});
- var grid = new Ext.grid.EditorGridPanel({
- id :'grid',
- store : store,
- cm : cm,
- sm : sm,
- autoExpandColumn : 'name',
- plugins : [donotrender,delRender],
- region : 'center',
- frame : false,
- clicksToEdit : 2,
- ddGroup :'GridDD',
- enableDragDrop : true,
- border : false,
- title : false,
- tbar:[{xtype: 'button',text:'<{$tname}> - ????[<{$sytable}>]',iconCls:'i_tablecfg'}],
- listeners: {
- 'render': function(){
- bbar2.render(this.tbar);
- },
- "beforeedit":{
- fn: function(items){
- row_id=items.row;
- },
- scope: this
- },
- "afterEdit": {
- fn: function(items){
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'items_config_save_ingrid',id:items.record.data.id,value:items.value,field:items.field},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- },
- scope: this
- }
- },
- viewConfig : {
- forceFit :true,
- getRowClass : function(record,rowIndex,rowParams,store){
- //????
- if(record.data.del=='1'){
- return 'x-grid-record-del';
- }else if(record.data.isnew=='1'){
- return 'x-grid-record-new';
- }else{
- return '';
- }
- }
- }
- });
-
- grid.on('celldblclick', function(grid, row, col, e) {
-
- // var row = grid.getSelectionModel().getSelected();
- // alert(row.data.id);
- var record = grid.getStore().getAt(row); //Get the Record
- var fieldName = grid.getColumnModel().getDataIndex(col); //Get field name
- //
- //alert(fieldName);
- if(fieldName=='cfg'){
- var data = record.get('id');
- var pr=top.Ext.get(data);
- if(pr){
- pr.close();
- }
- top.xajax_loadUrl(record.get('fname')+'_'+record.get('type')+'_'+'????','./form/fldcfg.php?op=cfg&id='+data,680,520,false,data)
- // Ext.MessageBox.alert('show','????????'+data)
- }else{
- return true;}
-
- });
- bbar2 = new Ext.Toolbar({
- renderTo:grid.tbar
- ,items:['->',{
- text:'??',iconCls:'i_sx',handler:function(){
- myMask.show();
- store.reload();
- myMask.hide();
- }
- },'-',{
- text:'?????????',iconCls:'i_cs',handler:function(){
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'cs',tid:"<{$tid}>",lg:'<{$lg}>'},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- },'-',{
- text:'???????',iconCls:'i_px',handler:function(){
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'pxcs',tid:"<{$tid}>",lg:'<{$lg}>'},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- },'-',{
- text:'???????????',iconCls:'i_qk',handler:function(){
- Ext.Msg.confirm('??','???????????',function(a){
- if(a == 'yes'){
- myMask.show();
- Ext.Ajax.request({
- waitMsg:'????....',
- method:'POST',
- params:{op:'qk',tid:"<{$tid}>",lg:'<{$lg}>'},
- url:'form_config.php',
- success:function(form, action) {
- store.removeAll() ;
- myMask.hide();
- },
- failure: function(form, action) {
- }
- });
- }
- })
- }
- },{
- text:'????',
- iconCls:'i_sc',
- handler:function(){
- myMask.show();
- var selections = grid.selModel.getSelections();
- var prez = [];
- for(i = 0; i< grid.selModel.getCount(); i++){
- prez.push(selections[i].json.id);
- }
- var encoded_array= Ext.encode(prez);
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'form_component_del',ids:encoded_array,field:'xr',val:1},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- },{
- text:'????',
- iconCls:'i_sc',
- handler:function(){
- myMask.show();
- var selections = grid.selModel.getSelections();
- var prez = [];
- for(i = 0; i< grid.selModel.getCount(); i++){
- prez.push(selections[i].json.id);
- }
- var encoded_array= Ext.encode(prez);
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'form_component_del',ids:encoded_array,field:'xr',val:0},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- },{
- text:'??',
- iconCls:'i_sc',
- handler:function(){
- myMask.show();
- var selections = grid.selModel.getSelections();
- var prez = [];
- for(i = 0; i< grid.selModel.getCount(); i++){
- prez.push(selections[i].json.id);
- }
- var encoded_array= Ext.encode(prez);
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'form_component_del',ids:encoded_array,field:'del',val:1},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- },{
- text:'???',
- iconCls:'i_sc',
- handler:function(){
- myMask.show();
- var selections = grid.selModel.getSelections();
- var prez = [];
- for(i = 0; i< grid.selModel.getCount(); i++){
- prez.push(selections[i].json.id);
- }
- var encoded_array= Ext.encode(prez);
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'form_component_del',ids:encoded_array,field:'del',val:0},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- }, '-'
- ]
- });
- var viewport = new Ext.Viewport({
- layout : 'fit',
- items:[
- grid
- ]
- });
- donotrender.on('click',function(a,b,c){
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'items_config_save_ingrid',id:c.data.id,value:c.data[a.dataIndex],field:a.dataIndex},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- });
- delRender.on('click',function(a,b,c){
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'items_config_save_ingrid',id:c.data.id,value:c.data[a.dataIndex],field:a.dataIndex},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- });
- var ddrow = new Ext.dd.DropTarget(grid.getView().mainBody, {
- ddGroup : 'GridDD',
- copy:false,
- notifyDrop : function(dd, e, data) {
-
- var sm = grid.getSelectionModel();
- var rows = sm.getSelections();
- var param =rows[0].data;
- //alert(param.id);
- var cindex = dd.getDragData(e).rowIndex;
- //alert(dd.getDragData(e).selections['id']);
- myMask.show();
- Ext.Ajax.request(
- {
- waitMsg:'????....',
- method:'POST',
- params:{op:'px',nowid:param.id,wz:cindex,lg:'<{$lg}>'},
- url:'form_config.php',
- success:function(form, action) {
- store.reload();
- myMask.hide();
- },
- failure: function(form, action) {
- }
- }
- );
- }
- });
- });
- </script>
- </head>
- <body>
- </body>
- </html>