Kind.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /**
  2. * Created by zhouy on 2018/10/18.
  3. */
  4. Ext.define('saas.view.document.kind.Kind', {
  5. extend: 'Ext.panel.Panel',
  6. xtype: 'document-kind',
  7. autoScroll: true,
  8. layout:'fit',
  9. controller:'document-kind',
  10. viewModel: {
  11. type: 'document-kind'
  12. },
  13. defaultType:'',
  14. requires: [
  15. 'Ext.button.Segmented'
  16. ],
  17. tbar: [{
  18. xtype: 'segmentedbutton',
  19. reference: 'dataKind',
  20. value: 'customerkind',
  21. bind:'{segmented}',
  22. items: [{
  23. text: '客户',
  24. value: 'customerkind'
  25. }, {
  26. text: '供应商',
  27. value: 'vendorkind'
  28. }, {
  29. text: '商品',
  30. value: 'productkind'
  31. }, {
  32. text: '收支',
  33. value: 'inoutkind'
  34. }],
  35. listeners: {
  36. toggle: 'onKindToggle'
  37. }
  38. },'->',
  39. {
  40. xtype:'button',
  41. text:'新增',
  42. listeners: {
  43. click: 'onAdd'
  44. }
  45. },{
  46. xtype:'button',
  47. text:'刷新',
  48. listeners: {
  49. click: 'onRefresh'
  50. }
  51. }],
  52. items:[{
  53. xtype:'grid',
  54. reference: 'document-kind-Grid',
  55. margin: '10 0 0 0',
  56. flex: 1,
  57. frame:true,
  58. bind:{
  59. selection: '{selectedCompany}'
  60. },
  61. listeners:{
  62. render:'loadDefualt'
  63. }
  64. }],
  65. etc:{
  66. customerkind:{
  67. columns: [{
  68. text: '客户类型',
  69. dataIndex: 'ck_name',
  70. flex: 1
  71. }],
  72. keyField:'id',
  73. reqUrl:basePath + 'document/customerkind/save',
  74. delUrl:basePath + 'document/customerkind/delete'
  75. },
  76. vendorkind:{
  77. columns: [{
  78. text: '供应商类型',
  79. dataIndex: 'vk_name',
  80. flex: 1
  81. }],
  82. keyField:'id',
  83. reqUrl:basePath + 'document/vendorkind/save',
  84. delUrl:basePath + 'document/vendorkind/delete'
  85. },
  86. productkind:{
  87. columns: [{
  88. text: '物料类型',
  89. dataIndex: 'pt_name',
  90. flex: 1
  91. }],
  92. keyField:'id',
  93. reqUrl:basePath + 'document/producttype/save',
  94. delUrl:basePath + 'document/producttype/delete'
  95. },
  96. productbrand:{
  97. columns: [{
  98. text: '物料品牌',
  99. dataIndex: 'pb_name',
  100. flex: 1
  101. }],
  102. keyField:'id',
  103. reqUrl:basePath + 'document/productbrand/save',
  104. delUrl:basePath + 'document/productbrand/delete'
  105. },
  106. bankinformation:{
  107. columns: [{
  108. text: '账户编号',
  109. dataIndex: 'bk_bankcode',
  110. flex: 1
  111. },{
  112. text: '账户名称',
  113. dataIndex: 'bk_bankname',
  114. flex: 1
  115. },{
  116. xtype:'datecolumn',
  117. text: '日期',
  118. dataIndex: 'bk_date',
  119. flex: 1
  120. },{
  121. text: '账户类型',
  122. dataIndex: 'bk_type',
  123. flex: 1
  124. },{
  125. text: '账户期初金额',
  126. dataIndex: 'bk_beginamount',
  127. flex: 1
  128. },{
  129. text: '账户期末余额',
  130. dataIndex: 'bk_thisamount',
  131. flex: 1
  132. }],
  133. keyField:'id',
  134. reqUrl: basePath + 'document/bankinformation/save',
  135. delUrl: basePath + 'document/bankinformation/delete'
  136. },
  137. inoutkind:{
  138. columns: [{
  139. text: '收支类型',
  140. dataIndex: 'ft_name',
  141. flex: 1
  142. }],
  143. keyField:'id',
  144. reqUrl: basePath + 'document/fundinouttype/save',
  145. delUrl: basePath + 'document/fundinouttype/delete'
  146. },
  147. storeinformation:{
  148. columns: [{
  149. text: '仓库编号',
  150. dataIndex: 'wh_code',
  151. width: 200
  152. },{
  153. text: '仓库名称',
  154. dataIndex: 'wh_description',
  155. width: 200
  156. },{
  157. text: '仓库状态码',
  158. dataIndex: 'wh_status',
  159. width: 0
  160. },{
  161. text: '仓库状态',
  162. dataIndex: 'wh_statuscode',
  163. width:90,
  164. xtype: 'actioncolumn',
  165. align : 'center',
  166. items: [{
  167. icon:basePath + 'resource/images/16/lock_bg.png',
  168. tooltip: '锁定',
  169. iconCls:'',
  170. getClass: function(v, meta, rec) {
  171. if(rec.get('wh_statuscode')=='OPEN'){
  172. this.items[0].tooltip = '不启用';
  173. return 'x-grid-checkcolumn-checked';
  174. }else{
  175. this.items[0].tooltip = '启用';
  176. return 'x-grid-checkcolumn';
  177. }
  178. },
  179. handler: function(view, rowIndex, colIndex) {
  180. var rec = view.getStore().getAt(rowIndex);
  181. var type=rec.get('wh_statuscode')=='OPEN'?true:false;
  182. // 禁用/启用
  183. var form = this.ownerCt.ownerCt.ownerCt;
  184. var grid = this.ownerCt.ownerCt;
  185. form.BaseUtil.request({
  186. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  187. params: '',
  188. method: 'POST',
  189. })
  190. .then(function(localJson) {
  191. if(localJson.success){
  192. showToast('操作成功');
  193. grid.store.load();
  194. }
  195. })
  196. .catch(function(res) {
  197. console.error(res);
  198. showToast('操作失败: ' + res.message);
  199. });
  200. }
  201. }]
  202. }],
  203. keyField:'id',
  204. reqUrl: basePath + 'document/warehouse/save',
  205. delUrl: basePath + 'document/warehouse/delete'
  206. }
  207. }
  208. })