DataDictionary.js 7.8 KB

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