Kind.js 7.9 KB

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