Window.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * Created by zhouy on 2018/10/18.
  3. */
  4. Ext.define('trade.saas.view.document.warehouse.Window', {
  5. extend: 'saas.view.document.kind.ChildForm',
  6. xtype: 'document-warehouse-window',
  7. dataKind:'warehouse',//类型标识
  8. caller:'WareHouse',
  9. belong:{
  10. columns: [{
  11. text: '编号',
  12. dataIndex: 'wh_code',
  13. width: 150
  14. },{
  15. text: '仓库名称',
  16. dataIndex: 'wh_description',
  17. width: 200
  18. },{
  19. text: '类型',
  20. dataIndex: 'wh_type',
  21. width: 110
  22. },{
  23. text: '仓库状态码',
  24. dataIndex: 'wh_status',
  25. hidden:true,
  26. },{
  27. text: '仓库状态',
  28. dataIndex: 'wh_statuscode',
  29. width:90,
  30. xtype: 'actioncolumn',
  31. align : 'center',
  32. items: [{
  33. iconCls:'',
  34. getClass: function(v, meta, rec) {
  35. if(rec.get('wh_statuscode')=='ENABLE'){
  36. return 'x-grid-checkcolumn-checked-btn';
  37. }else{
  38. return 'x-grid-checkcolumn-btn';
  39. }
  40. },
  41. handler: function(view, rowIndex, colIndex) {
  42. var rec = view.getStore().getAt(rowIndex);
  43. var type=rec.get('wh_statuscode')=='ENABLE'?true:false;
  44. // 禁用/启用
  45. var form = this.ownerCt.ownerCt.ownerCt;
  46. var grid = this.ownerCt.ownerCt;
  47. saas.util.BaseUtil.request({
  48. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  49. params: '',
  50. method: 'POST',
  51. })
  52. .then(function(localJson) {
  53. if(localJson.success){
  54. saas.util.BaseUtil.showSuccessToast('操作成功');
  55. grid.store.load();
  56. }
  57. })
  58. .catch(function(e) {
  59. saas.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
  60. });
  61. }
  62. }]
  63. }],
  64. keyField:'id',
  65. reqUrl: '/api/document/warehouse/save',
  66. delUrl: '/api/document/warehouse/delete'
  67. },
  68. etc:{
  69. warehouse:{
  70. items:[{
  71. xtype:'hidden',
  72. name:'id'
  73. },{
  74. xtype:'textfield',
  75. fieldLabel: '仓库编号',
  76. name: 'wh_code',
  77. autoCode:true,
  78. allowBlank:false,
  79. maxLength: 20
  80. },{
  81. xtype:'textfield',
  82. fieldLabel: '仓库名称',
  83. name: 'wh_description',
  84. allowBlank:false,
  85. maxLength: 20
  86. },{
  87. xtype:'combo',
  88. fieldLabel: '仓库类型',
  89. name: 'wh_type',
  90. allowBlank:false,
  91. displayField : "display",
  92. editable:false,
  93. hideTrigger : false,
  94. maxLength : 100.0,
  95. minValue : null,
  96. positiveNum : false,
  97. queryMode : "local",
  98. valueField : "value",
  99. store:{
  100. fields: ['display', 'value'],
  101. data : [
  102. {"display":"良品仓", "value":'良品仓'},
  103. {"display":"不良品仓", "value":'不良品仓'}
  104. ]
  105. }
  106. },{
  107. readOnly:true,
  108. xtype:'textfield',
  109. fieldLabel: '仓库状态',
  110. name: 'wh_status',
  111. value:'已启用',
  112. maxLength: 20
  113. },{
  114. xtype:'hidden',
  115. fieldLabel: '仓库状态码',
  116. name: 'wh_statuscode',
  117. value:'ENABLE'
  118. }]
  119. }
  120. }
  121. });