Kind.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. //工具类
  14. FormUtil: Ext.create('saas.util.FormUtil'),
  15. BaseUtil: Ext.create('saas.util.BaseUtil'),
  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:'/api/document/customerkind/save',
  77. delUrl:'/api/document/customerkind/delete'
  78. },
  79. vendorkind:{
  80. columns: [{
  81. text: '供应商类型',
  82. dataIndex: 'vk_name',
  83. flex: 1
  84. }],
  85. keyField:'id',
  86. reqUrl:'/api/document/vendorkind/save',
  87. delUrl:'/api/document/vendorkind/delete'
  88. },
  89. productkind:{
  90. columns: [{
  91. text: '物料类型',
  92. dataIndex: 'pt_name',
  93. flex: 1
  94. }],
  95. keyField:'id',
  96. reqUrl:'/api/document/producttype/save',
  97. delUrl:'/api/document/producttype/delete'
  98. },
  99. productbrand:{
  100. columns: [{
  101. text: '物料品牌',
  102. dataIndex: 'pb_name',
  103. flex: 1
  104. }],
  105. keyField:'id',
  106. reqUrl:'/api/document/productbrand/save',
  107. delUrl:'/api/document/productbrand/delete'
  108. },
  109. productunit:{
  110. columns: [{
  111. text: '计量单位',
  112. dataIndex: 'pu_name',
  113. flex: 1
  114. }],
  115. keyField:'id',
  116. reqUrl:'/api/document/productunit/save',
  117. delUrl:'/api/document/productunit/delete'
  118. },
  119. bankinformation:{
  120. columns: [{
  121. text: '账户编号',
  122. dataIndex: 'bk_bankcode',
  123. flex: 1
  124. },{
  125. text: '账户名称',
  126. dataIndex: 'bk_bankname',
  127. flex: 1
  128. },{
  129. xtype:'datecolumn',
  130. text: '日期',
  131. dataIndex: 'bk_date',
  132. flex: 1
  133. },{
  134. text: '账户类型',
  135. dataIndex: 'bk_type',
  136. flex: 1
  137. },{
  138. text: '账户期初金额',
  139. dataIndex: 'bk_beginamount',
  140. flex: 1
  141. },{
  142. text: '账户期末余额',
  143. dataIndex: 'bk_thisamount',
  144. flex: 1
  145. }],
  146. keyField:'id',
  147. reqUrl: '/api/document/bankinformation/save',
  148. delUrl: '/api/document/bankinformation/delete'
  149. },
  150. inoutkind:{
  151. columns: [{
  152. text: '收支类型',
  153. dataIndex: 'ft_name',
  154. flex: 1
  155. }],
  156. keyField:'id',
  157. reqUrl: '/api/document/fundinouttype/save',
  158. delUrl: '/api/document/fundinouttype/delete'
  159. },
  160. address:{
  161. columns: [{
  162. text: '地址名称',
  163. dataIndex: 'ad_address',
  164. flex: 1
  165. }],
  166. keyField:'id',
  167. reqUrl: '/api/document/address/save',
  168. delUrl: '/api/document/address/delete'
  169. },
  170. maxnumbers:{
  171. columns: [{
  172. text : "单据caller",
  173. width : 200.0,
  174. dataIndex : "mn_caller",
  175. xtype : "",
  176. },
  177. {
  178. text : "单据前缀",
  179. dataIndex : "mn_leadcode",
  180. width : 120.0,
  181. xtype : "",
  182. },
  183. {
  184. text : "单据规则",
  185. dataIndex : "mn_rule",
  186. width : 220.0,
  187. xtype : "",
  188. },{
  189. text : "流水长度",
  190. dataIndex : "mn_number",
  191. width : 120.0,
  192. xtype : "",
  193. }],
  194. keyField:'id',
  195. reqUrl:'http://192.168.253.31:8920/number/save'
  196. },
  197. warehouse:{
  198. columns: [{
  199. text: '仓库编号',
  200. dataIndex: 'wh_code',
  201. width: 200
  202. },{
  203. text: '仓库名称',
  204. dataIndex: 'wh_description',
  205. width: 200
  206. },{
  207. text: '仓库状态码',
  208. dataIndex: 'wh_status',
  209. width: 0
  210. },{
  211. text: '仓库状态',
  212. dataIndex: 'wh_statuscode',
  213. width:90,
  214. xtype: 'actioncolumn',
  215. align : 'center',
  216. items: [{
  217. tooltip: '锁定',
  218. iconCls:'',
  219. getClass: function(v, meta, rec) {
  220. if(rec.get('wh_statuscode')=='OPEN'){
  221. this.items[0].tooltip = '不启用';
  222. return 'x-grid-checkcolumn-checked';
  223. }else{
  224. this.items[0].tooltip = '启用';
  225. return 'x-grid-checkcolumn';
  226. }
  227. },
  228. handler: function(view, rowIndex, colIndex) {
  229. var rec = view.getStore().getAt(rowIndex);
  230. var type=rec.get('wh_statuscode')=='OPEN'?true:false;
  231. // 禁用/启用
  232. var form = this.ownerCt.ownerCt.ownerCt;
  233. var grid = this.ownerCt.ownerCt;
  234. form.BaseUtil.request({
  235. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  236. params: '',
  237. method: 'POST',
  238. })
  239. .then(function(localJson) {
  240. if(localJson.success){
  241. showToast('操作成功');
  242. grid.store.load();
  243. }
  244. })
  245. .catch(function(res) {
  246. console.error(res);
  247. showToast('操作失败: ' + res.message);
  248. });
  249. }
  250. }]
  251. }],
  252. keyField:'id',
  253. reqUrl: '/api/document/warehouse/save',
  254. delUrl: '/api/document/warehouse/delete'
  255. }
  256. }
  257. })