DataDictionary.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. Ext.define('erp.view.ma.DataDictionary',{
  2. extend: 'Ext.Viewport',
  3. layout: 'border',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype:'form',
  10. frame:true,
  11. region:'north',
  12. layout:'column',
  13. defaults:{
  14. cls: "form-field-allowBlank",
  15. xtype:'textfield',
  16. focusCls: 'x-form-field-cir-focus',
  17. fieldStyle: "background:#FFFAFA;color:#515151;",
  18. columnWidth:0.5
  19. },
  20. items:[{
  21. fieldLabel:'表名',
  22. allowBlank:false,
  23. name:'object_name'
  24. },{
  25. fieldLabel:'注释',
  26. allowBlank:false,
  27. name:'comments',
  28. xtype:'textareatrigger'
  29. },{
  30. fieldLabel:'ID',
  31. name:'object_id',
  32. hidden:true
  33. }],
  34. bbar:['->',{
  35. xtype: 'button',
  36. cls: 'x-btn-blue',
  37. text: '新增',
  38. itemId:'add',
  39. width: 80,
  40. margin: '0 0 0 5'
  41. },{
  42. xtype: 'button',
  43. cls: 'x-btn-blue',
  44. text: '保存',
  45. itemId:'save',
  46. formBind: true,
  47. width: 80,
  48. margin: '0 0 0 5'
  49. },{
  50. xtype: 'button',
  51. cls: 'x-btn-blue',
  52. text: '关闭',
  53. width: 80,
  54. itemId:'close',
  55. margin: '0 0 0 5'
  56. },'->']
  57. },{
  58. xtype:'tabpanel',
  59. region:'center',
  60. id:'dictab',
  61. items:[{
  62. title:'列信息',
  63. xtype: 'dictionarygrid'
  64. },{
  65. title:'索引',
  66. layout:'border',
  67. items:[{
  68. region:'west',
  69. width:300,
  70. xtype:'panel',
  71. layout:'fit',
  72. frame:true,
  73. dockedItems:{
  74. dock : 'top',
  75. /*ui: 'footer',*/
  76. xtype:'toolbar',
  77. items:[{
  78. xtype:'label',
  79. html:'<h1>索引名称</h1>'
  80. },{
  81. xtype:'button',
  82. iconCls:'x-button-icon-add',
  83. text:'添加',
  84. itemId:'add_index'
  85. },{
  86. xtype:'button',
  87. iconCls:'x-button-icon-delete2',
  88. text:'删除',
  89. itemId:'delete_index'
  90. }]
  91. },
  92. items:[{
  93. xtype:'boundlist',
  94. deferInitialRefresh: false,
  95. multiSelect: true,
  96. store: me.store,
  97. name:'tab_indexs',
  98. itemSelector:'li',
  99. displayField:'index_name',
  100. border: false,
  101. disabled: false,
  102. store:Ext.create('Ext.data.Store', {
  103. fields: [ {name: 'index_name'},
  104. {name:'uniqueness'},
  105. {name:'ind_columns'}],
  106. proxy: {
  107. type: 'ajax',
  108. url: basePath+'/common/getColumnIndex.action',
  109. extraParams :{
  110. tablename:tablename
  111. },
  112. reader: {
  113. idProperty:'index_name',
  114. type: 'json',
  115. root: 'list'
  116. }
  117. },
  118. autoLoad:true
  119. })
  120. }]
  121. },{
  122. region:'center',
  123. layout: 'anchor',
  124. style:'margin-top:10px',
  125. xtype:'container',
  126. items:[{
  127. xtype:'textfield',
  128. fieldLabel:'索引名称',
  129. name:'index_name',
  130. id:'index_name',
  131. anchor:'100%',
  132. maxWidth:400,
  133. frame:true
  134. },{
  135. xtype: 'radiogroup',
  136. fieldLabel: '唯一性',
  137. layout: 'column',
  138. name:'uniqueness',
  139. id:'uniqueness',
  140. defaults: {
  141. columnWidth:1,
  142. labelStyle: 'padding:4px;'
  143. },
  144. items: [{boxLabel: '唯一', name: 'uniqueness', inputValue: 'UNIQUE'},
  145. {boxLabel: '不唯一', name: 'uniqueness', inputValue: 'NONUNIQUE', checked: true}]
  146. },{
  147. xtype:'gridpanel',
  148. id:'index_column_grid',
  149. columnLines:true,
  150. plugins:[Ext.create('Ext.grid.plugin.CellEditing', {
  151. clicksToEdit: 1,
  152. })],
  153. tbar:[{
  154. xtype:'label',
  155. html:'<h1>表达式</h1>'
  156. },{
  157. xtype:'button',
  158. iconCls:'x-button-icon-add',
  159. text:'添加',
  160. itemId:'add_ind_column'
  161. },{
  162. xtype:'button',
  163. iconCls:'x-button-icon-delete2',
  164. text:'删除',
  165. itemId:'delete_ind_column'
  166. }],
  167. columns:[{
  168. text:'索引字段',
  169. dataIndex:'COLUMN_NAME',
  170. cls: "x-grid-header-1",
  171. width:200,
  172. editor:{
  173. xtype:'combo',
  174. queryMode: 'local',
  175. displayField: 'column_name',
  176. valueField: 'column_name',
  177. store:Ext.create('Ext.data.Store',{
  178. fields:['column_name'],
  179. data:[]
  180. }),
  181. onTriggerClick:function(trigger){
  182. var me=this,store=this.getStore();
  183. if(store.totalCount<1){
  184. store.loadRecords(Ext.getCmp('grid').getStore().data.items);
  185. }
  186. if (!me.readOnly && !me.disabled) {
  187. if (me.isExpanded) {
  188. me.collapse();
  189. } else {
  190. me.expand();
  191. }
  192. me.inputEl.focus();
  193. }
  194. }
  195. }
  196. },{
  197. text:'排序',
  198. dataIndex:'DESCEND',
  199. cls: "x-grid-header-1",
  200. width:100,
  201. editor:{
  202. xtype:'combo',
  203. queryMode: 'local',
  204. displayField: 'display',
  205. valueField: 'value',
  206. store:Ext.create('Ext.data.Store',{
  207. fields:['display','value'],
  208. data:[{
  209. display:'ASC',
  210. value:'ASC'
  211. },{
  212. display:'DESC',
  213. value:'DESC'
  214. }]
  215. })
  216. }
  217. }],
  218. store:Ext.create('Ext.data.Store',{
  219. fields:['COLUMN_NAME','DESCEND'],
  220. data:[]
  221. })
  222. }]
  223. }]
  224. },{
  225. title:'修改日志',
  226. listeners:{
  227. activate:function(tab){
  228. if(!tab.loaded && tablename){
  229. Ext.Ajax.request({
  230. method: 'post',
  231. url : basePath + '/common/getFieldsDatas.action',
  232. params :{
  233. caller:'DB$LOG',
  234. fields:'alter_type,alter_remark,alter_date,alter_man',
  235. condition:"table_name='"+tablename+"'"
  236. },
  237. callback : function(options, success, response){
  238. var res = new Ext.decode(response.responseText);
  239. tab.loaded=true;
  240. tab.getStore().loadData(new Ext.decode(res.data));
  241. }
  242. });
  243. }
  244. }
  245. },
  246. xtype:'gridpanel',
  247. id:'log-grid',
  248. loaded:false,
  249. columnLines:true,
  250. plugins: [Ext.create('erp.view.core.grid.HeaderFilter')],
  251. columns:[{
  252. text:'操作描述',
  253. dataIndex:'ALTER_REMARK',
  254. flex:1,
  255. filter: {xtype:"textfield", filterName:"ALTER_REMARK"}
  256. },{
  257. text:'操作类型',
  258. dataIndex:'ALTER_TYPE',
  259. width:80,
  260. filter: {xtype:"textfield", filterName:"ALTER_TYPE"}
  261. },{
  262. text:'操作人',
  263. width:150,
  264. filter: {xtype:"textfield", filterName:"ALTER_MAN"},
  265. dataIndex:'ALTER_MAN'
  266. },{
  267. text:'操作时间',
  268. xtype:'datecolumn',
  269. format:'Y-m-d H:i:s',
  270. width:150,
  271. filter: {xtype:"textfield", filterName:"ALTER_DATE"},
  272. dataIndex:'ALTER_DATE'
  273. }],
  274. store:Ext.create('Ext.data.Store', {
  275. fields: [ {name: 'alter_remark'},
  276. {name:'alter_type'},
  277. {name:'alter_man'},{
  278. name:'alter_date'
  279. }],
  280. sorters: [{
  281. property : 'alter_date',
  282. direction: 'ASC'
  283. }],
  284. data:[]
  285. })
  286. }]
  287. }]
  288. });
  289. me.callParent(arguments);
  290. }
  291. });