DataList.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * Created by zhouy on 2018/10/18.
  3. */
  4. Ext.define('make.saas.view.document.warehouse.DataList', {
  5. extend: 'saas.view.document.kind.Kind',
  6. xtype: 'document-warehouse-datalist',
  7. viewModel: 'document-warehouse-datalist',
  8. defaultType:'warehouse',
  9. windowType:'document-warehouse-window',
  10. _openUrl:'/api/document/warehouse/open',
  11. _closeUrl:'/api/document/warehouse/close',
  12. tbar: ['->',{
  13. xtype:'button',
  14. text:'新增',
  15. listeners: {
  16. click: 'onAdd'
  17. }
  18. },{
  19. xtype:'button',
  20. text:'刷新',
  21. listeners: {
  22. click: 'onRefresh'
  23. }
  24. }],
  25. etc:{
  26. warehouse:{
  27. columns: [{
  28. text: '仓库编号',
  29. dataIndex: 'wh_code',
  30. width: 150
  31. },{
  32. text: '仓库名称',
  33. dataIndex: 'wh_description',
  34. width: 200
  35. },{
  36. text: '仓库类型',
  37. dataIndex: 'wh_type',
  38. width: 110
  39. },{
  40. text: '参与MRP运算',
  41. dataIndex: 'wh_ifmrp',
  42. width: 0,
  43. renderer: function (value, metaData, record) {
  44. if(value=='1'){
  45. return '是';
  46. }else{
  47. return '否';
  48. }
  49. }
  50. },{
  51. text: '仓库状态码',
  52. dataIndex: 'wh_status',
  53. hidden:true,
  54. },{
  55. text: '仓库状态',
  56. dataIndex: 'wh_statuscode',
  57. width:90,
  58. xtype: 'actioncolumn',
  59. align : 'center',
  60. items: [{
  61. iconCls:'',
  62. getClass: function(v, meta, rec) {
  63. if(rec.get('wh_statuscode')=='ENABLE'){
  64. return 'x-grid-checkcolumn-checked-btn';
  65. }else{
  66. return 'x-grid-checkcolumn-btn';
  67. }
  68. },
  69. handler: function(view, rowIndex, colIndex) {
  70. var rec = view.getStore().getAt(rowIndex);
  71. var type=rec.get('wh_statuscode')=='ENABLE'?true:false;
  72. // 禁用/启用
  73. var form = this.ownerCt.ownerCt.ownerCt;
  74. var grid = this.ownerCt.ownerCt;
  75. saas.util.BaseUtil.request({
  76. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  77. params: '',
  78. method: 'POST',
  79. })
  80. .then(function(localJson) {
  81. if(localJson.success){
  82. saas.util.BaseUtil.showSuccessToast('操作成功');
  83. grid.store.load();
  84. }
  85. })
  86. .catch(function(e) {
  87. saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
  88. });
  89. }
  90. }]
  91. }],
  92. keyField:'id',
  93. reqUrl: '/api/document/warehouse/save',
  94. delUrl: '/api/document/warehouse/delete'
  95. }
  96. },
  97. listeners:{
  98. afterrender:function(p){
  99. p.getViewModel().setData({title:'仓库'});
  100. }
  101. }
  102. })