DictPropertyGrid.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * Created by Caosy on 2021/1/5.
  3. */
  4. Ext.define('erp.view.ma.DictPropertyGrid',{
  5. extend: 'Ext.grid.Panel',
  6. alias: 'widget.dictpropertygrid',
  7. layout : 'fit',
  8. id: 'propertygrid',
  9. emptyText : $I18N.common.grid.emptyText,
  10. columnLines : true,
  11. autoScroll : true,
  12. bodyStyle: 'background-color:#f1f1f1;',
  13. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  14. clicksToEdit: 1,
  15. listeners:{
  16. beforeedit:function(e){
  17. var g=e.grid,r=e.record,f=e.field;
  18. if(g.binds){
  19. var bool=true;
  20. Ext.Array.each(g.binds,function(item){
  21. if(Ext.Array.contains(item.fields,f)){
  22. Ext.each(item.refFields,function(field){
  23. if(r.get(field)!=null && r.get(field)!=0 && r.get(field)!='' && r.get(field)!='0'){
  24. bool=false;
  25. }
  26. });
  27. }
  28. });
  29. return bool;
  30. }
  31. }
  32. }
  33. }), Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  34. GridUtil: Ext.create('erp.util.GridUtil'),
  35. BaseUtil: Ext.create('erp.util.BaseUtil'),
  36. dbfinds: [],
  37. caller: null,
  38. condition: null,
  39. gridCondition:null,
  40. columnLines:true,
  41. plugins: [Ext.create('erp.view.core.grid.HeaderFilter'),Ext.create('Ext.grid.plugin.CellEditing', {
  42. clicksToEdit: 1
  43. })],
  44. necessaryFields:['column_name','data_type'],
  45. initComponent : function(){
  46. var me=this;
  47. Ext.apply(me,{
  48. columns:[{
  49. dataIndex:'column_name',
  50. cls: "x-grid-header-1",
  51. text:'列名',
  52. sortable:false,
  53. width:150,
  54. filter: {xtype:"textfield", filterName:"column_name"}
  55. },{
  56. dataIndex:'data_type',
  57. cls: "x-grid-header-1",
  58. text:'数据类型',
  59. sortable:false,
  60. logic : 'ignore',
  61. width:100,
  62. filter: {xtype:"textfield", filterName:"data_type"}
  63. },{
  64. dataIndex:'comments',
  65. cls: "x-grid-header-1",
  66. text:'注释',
  67. logic : 'ignore',
  68. sortable:false,
  69. format:'',
  70. flex:1,
  71. filter: {xtype:"textfield", filterName:"comments"}
  72. },{
  73. dataIndex:'allowbatchupdate_',
  74. cls: "x-grid-header-1",
  75. text:'允许批量更新',
  76. xtype: 'checkcolumn',
  77. sortable:false,
  78. format:'',
  79. width:110,
  80. filter: {xtype:"textfield", filterName:"allowbatchupdate_"},
  81. editor: {
  82. xtype: 'checkbox',
  83. cls: "x-grid-checkheader-editor"
  84. }
  85. }],
  86. store:Ext.create('Ext.data.Store',{
  87. fields:['column_name','data_type','allowbatchupdate_',{name:'comments',type:'string',format:''}],
  88. proxy: {
  89. type: 'ajax',
  90. url: basePath+'/common/getProperty.action',
  91. extraParams :{
  92. tablename:tablename
  93. },
  94. reader: {
  95. type: 'json',
  96. root: 'list',
  97. idProperty:'column_name'
  98. }
  99. },
  100. autoLoad: true
  101. })
  102. });
  103. this.callParent(arguments);
  104. }
  105. });