Window.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. 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(res) {
  59. console.error(res);
  60. saas.util.BaseUtil.showErrorToast('操作失败: ' + res.message);
  61. });
  62. }
  63. }]
  64. }],
  65. keyField:'id',
  66. reqUrl: '/api/document/warehouse/save',
  67. delUrl: '/api/document/warehouse/delete'
  68. },
  69. etc:{
  70. warehouse:{
  71. items:[{
  72. xtype:'hidden',
  73. name:'id'
  74. },{
  75. xtype:'textfield',
  76. fieldLabel: '仓库编号',
  77. name: 'wh_code',
  78. autoCode:true,
  79. allowBlank:false,
  80. maxLength: 20
  81. },{
  82. xtype:'textfield',
  83. fieldLabel: '仓库名称',
  84. name: 'wh_description',
  85. allowBlank:false,
  86. maxLength: 20
  87. },{
  88. xtype:'combo',
  89. fieldLabel: '仓库类型',
  90. name: 'wh_type',
  91. allowBlank:false,
  92. displayField : "display",
  93. editable:false,
  94. hideTrigger : false,
  95. maxLength : 100.0,
  96. minValue : null,
  97. positiveNum : false,
  98. queryMode : "local",
  99. valueField : "value",
  100. store:{
  101. fields: ['display', 'value'],
  102. data : [
  103. {"display":"良品仓", "value":'良品仓'},
  104. {"display":"不良品仓", "value":'不良品仓'}
  105. ]
  106. }
  107. },{
  108. readOnly:true,
  109. xtype:'textfield',
  110. fieldLabel: '仓库状态',
  111. name: 'wh_status',
  112. value:'已启用',
  113. maxLength: 20
  114. },{
  115. xtype:'hidden',
  116. fieldLabel: '仓库状态码',
  117. name: 'wh_statuscode',
  118. value:'ENABLE'
  119. }]
  120. }
  121. }
  122. });