SvnLog.js.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. Ext.define('erp.view.ma.SvnLog', {
  2. extend : 'Ext.Viewport',
  3. layout : 'anchor',
  4. hideBorders : true,
  5. initComponent : function() {
  6. var me = this, store = me.getStore();
  7. Ext.apply(me, {
  8. items : [ {
  9. xtype: 'form',
  10. layout: {
  11. align: 'center',
  12. pack: 'center',
  13. type: 'vbox'
  14. },
  15. anchor : '100% 15%',
  16. bodyStyle: 'background:#f1f2f5;',
  17. items: [{
  18. xtype: 'fieldcontainer',
  19. layout: 'column',
  20. width: 1000,
  21. items: [{
  22. columnWidth: .2,
  23. fieldLabel: '系统当前版本',
  24. xtype: 'displayfield',
  25. id: 'svninfo'
  26. },{
  27. columnWidth: .2,
  28. fieldLabel: '程序最新版本',
  29. xtype: 'displayfield',
  30. id: 'svnlast'
  31. },{
  32. columnWidth: .2,
  33. boxLabel: '只显示未更新版本',
  34. xtype: 'checkbox',
  35. id: 'switch'
  36. },{
  37. columnWidth: .2,
  38. boxLabel: '只显示未评审版本',
  39. xtype: 'checkbox',
  40. id: 'unaudit'
  41. },{
  42. columnWidth: .2,
  43. boxLabel: '只显示未测试版本',
  44. xtype: 'checkbox',
  45. id: 'untest'
  46. },{
  47. columnWidth: .4,
  48. fieldLabel: '提交时间',
  49. labelWidth: 80,
  50. id: 'date',
  51. xtype: 'ftdatefield'
  52. },{
  53. xtype: 'fieldcontainer',
  54. columnWidth: .4,
  55. layout: 'hbox',
  56. defaults: {
  57. style: {
  58. marginLeft: '5px'
  59. }
  60. },
  61. items: [{
  62. xtype: 'button',
  63. text: '今天',
  64. param: ['d', 0, 'd', 0]
  65. },{
  66. xtype: 'button',
  67. text: '近三天',
  68. param: ['d', -2, 'd', 0]
  69. },{
  70. xtype: 'button',
  71. text: '近一周',
  72. param: ['d', -6, 'd', 0]
  73. },{
  74. xtype: 'button',
  75. text: '近一个月',
  76. param: ['m', -1, 'd', 0]
  77. },{
  78. xtype: 'button',
  79. text: '近三个月',
  80. param: ['m', -3, 'd', 0]
  81. },{
  82. xtype: 'button',
  83. text: '全部',
  84. param: ['y', -3, 'd', 0]
  85. }]
  86. },{
  87. xtype: 'textfield',
  88. fieldLabel: '注释',
  89. labelWidth: 50,
  90. columnWidth: .2,
  91. id: 'remark'
  92. }]
  93. }],
  94. buttonAlign: 'center',
  95. buttons: [{
  96. cls : 'x-btn-blue',
  97. id : 'refresh',
  98. text : $I18N.common.button.erpRefreshButton,
  99. width : 80,
  100. margin : '0 0 0 5'
  101. }, {
  102. cls : 'x-btn-blue',
  103. id : 'close',
  104. text : $I18N.common.button.erpCloseButton,
  105. width : 80,
  106. margin : '0 0 0 5'
  107. }]
  108. },{
  109. xtype : 'grid',
  110. id : 'grid',
  111. cls: 'custom-grid-autoheight',
  112. anchor : '100% 85%',
  113. columns : [ {
  114. text : '提交时间',
  115. dataIndex : 'date',
  116. width: 160,
  117. renderer: function(val) {
  118. return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
  119. }
  120. }, {
  121. text : '版本',
  122. dataIndex : 'version',
  123. width: 60
  124. }, {
  125. text : '提交人',
  126. dataIndex : 'man',
  127. width: 100
  128. }, {
  129. text : '注释',
  130. dataIndex : 'remark',
  131. width: 300,
  132. renderer: function(v, m, r) {
  133. if(r.get('test_result') === 0 && v.indexOf('\n') > -1) {
  134. var a = v.split('\n');
  135. return '<dl class="dl-horizontal"><dt>问题:</dt><dd>' + a[0] + '</dd><dt>内容:</dt><dd>' + a[1] + '</dd></dl>';
  136. }
  137. return v;
  138. }
  139. }, {
  140. text: '评审',
  141. columns: [{
  142. text: '人员',
  143. dataIndex : 'auditor',
  144. width: 80
  145. },{
  146. text: '评语',
  147. dataIndex : 'auditComment',
  148. width: 160
  149. }]
  150. }, {
  151. text: '测试',
  152. columns: [{
  153. text: '人员',
  154. dataIndex : 'tester',
  155. width: 80
  156. },{
  157. text: '结果',
  158. dataIndex : 'testResult',
  159. width: 50,
  160. renderer: function(v) {
  161. return v === 1 ? '<img src="' + basePath + 'resource/images/icon/agree.png">' :
  162. '<img src="' + basePath + 'resource/images/icon/unagree.png">';
  163. }
  164. },{
  165. text: '评语',
  166. dataIndex : 'testComment',
  167. width: 200
  168. }]
  169. } ],
  170. columnLines : true,
  171. enableColumnResize : true,
  172. store : store,
  173. dockedItems: [{
  174. xtype: 'pagingtoolbar',
  175. store: store,
  176. dock: 'bottom',
  177. displayInfo: true,
  178. moveFirst : function(){
  179. if (this.fireEvent('beforechange', this, 1) !== false){
  180. this.store.loadPage(1, {
  181. params: {
  182. condition : this.ownerCt.condition
  183. }
  184. });
  185. }
  186. },
  187. movePrevious : function(){
  188. var me = this,
  189. prev = me.store.currentPage - 1;
  190. if (prev > 0) {
  191. if (me.fireEvent('beforechange', me, prev) !== false) {
  192. this.store.previousPage({
  193. params: {
  194. condition : this.ownerCt.condition
  195. }
  196. });
  197. }
  198. }
  199. },
  200. moveNext : function(){
  201. var me = this,
  202. total = me.getPageData().pageCount,
  203. next = me.store.currentPage + 1;
  204. if (next <= total) {
  205. if (me.fireEvent('beforechange', me, next) !== false) {
  206. me.store.nextPage({
  207. params: {
  208. condition : this.ownerCt.condition
  209. }
  210. });
  211. }
  212. }
  213. },
  214. moveLast : function(){
  215. var me = this,
  216. last = me.getPageData().pageCount;
  217. if (me.fireEvent('beforechange', me, last) !== false) {
  218. me.store.loadPage(last, {
  219. params: {
  220. condition : this.ownerCt.condition
  221. }
  222. });
  223. }
  224. },
  225. doRefresh : function(){
  226. var me = this,
  227. current = me.store.currentPage;
  228. if (me.fireEvent('beforechange', me, current) !== false) {
  229. me.store.loadPage(current, {
  230. params: {
  231. condition : this.ownerCt.condition
  232. }
  233. });
  234. }
  235. }
  236. }],
  237. viewConfig: {
  238. listeners: {
  239. itemcontextmenu: function(view, record, item, index, e) {
  240. me.onContextmenu(view, record, e);
  241. }
  242. }
  243. }
  244. } ]
  245. });
  246. me.callParent(arguments);
  247. },
  248. getStore: function() {
  249. return Ext.create('Ext.data.Store', {
  250. fields : [ 'date', 'man', 'changed', 'remark', 'version', 'auditor', 'auditComment', 'tester', 'testResult', 'testComment' ],
  251. pageSize: 15,
  252. autoLoad: false,
  253. proxy : {
  254. type : 'ajax',
  255. url : basePath + 'ma/svn/log.action',
  256. reader : {
  257. type : 'json',
  258. root : 'content',
  259. totalProperty: 'totalElements'
  260. }
  261. }
  262. });
  263. },
  264. onContextmenu: function(view, record, e) {
  265. e.preventDefault();
  266. var menu = view.contextMenu;
  267. if (!menu) {
  268. menu = view.contextMenu = new Ext.menu.Menu({
  269. items: [{
  270. text : '查看修改内容',
  271. name: 'item-changedetail',
  272. iconCls: 'x-button-icon-content'
  273. },{
  274. xtype: 'menuseparator'
  275. },{
  276. text : '提交评审报告',
  277. name: 'item-audit',
  278. iconCls: 'x-button-icon-readed',
  279. disabled: true
  280. },{
  281. text : '提交测试报告',
  282. name: 'item-test',
  283. iconCls: 'x-button-icon-agree',
  284. disabled: true
  285. }]
  286. });
  287. }
  288. menu.showAt(e.getXY());
  289. menu.record = record;
  290. }
  291. });