DataDictionary.js 7.5 KB

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