Kind.js 6.5 KB

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