Window.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * Created by zhouy on 2018/10/18.
  3. */
  4. Ext.define('saas.view.document.warehouse.Window', {
  5. extend: 'saas.view.document.kind.ChildForm',
  6. xtype: 'document-warehouse-window',
  7. dataKind:'warehouse',//类型标识
  8. belong:{
  9. columns: [{
  10. text: '编号',
  11. dataIndex: 'wh_code',
  12. width: 150
  13. },{
  14. text: '仓库名称',
  15. dataIndex: 'wh_description',
  16. width: 200
  17. },{
  18. text: '类型',
  19. dataIndex: 'wh_type',
  20. width: 110
  21. },{
  22. text: '仓库状态码',
  23. dataIndex: 'wh_status',
  24. hidden:true,
  25. },{
  26. text: '仓库状态',
  27. dataIndex: 'wh_statuscode',
  28. width:90,
  29. xtype: 'actioncolumn',
  30. align : 'center',
  31. items: [{
  32. iconCls:'',
  33. getClass: function(v, meta, rec) {
  34. if(rec.get('wh_statuscode')=='ENABLE'){
  35. return 'x-grid-checkcolumn-checked-btn';
  36. }else{
  37. return 'x-grid-checkcolumn-btn';
  38. }
  39. },
  40. handler: function(view, rowIndex, colIndex) {
  41. var rec = view.getStore().getAt(rowIndex);
  42. var type=rec.get('wh_statuscode')=='ENABLE'?true:false;
  43. // 禁用/启用
  44. var form = this.ownerCt.ownerCt.ownerCt;
  45. var grid = this.ownerCt.ownerCt;
  46. saas.util.BaseUtil.request({
  47. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  48. params: '',
  49. method: 'POST',
  50. })
  51. .then(function(localJson) {
  52. if(localJson.success){
  53. saas.util.BaseUtil.showSuccessToast('操作成功');
  54. grid.store.load();
  55. }
  56. })
  57. .catch(function(res) {
  58. console.error(res);
  59. saas.util.BaseUtil.showErrorToast('操作失败: ' + res.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. });