Kind.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. hidden:true,
  134. xtype:'datecolumn',
  135. text: '日期',
  136. dataIndex: 'bk_date',
  137. flex: 1
  138. },{
  139. hidden:true,
  140. text: '账户类型',
  141. dataIndex: 'bk_type',
  142. flex: 1
  143. },{
  144. text: '账户期初金额',
  145. dataIndex: 'bk_beginamount',
  146. flex: 1
  147. },{
  148. text: '账户期末余额',
  149. dataIndex: 'bk_thisamount',
  150. flex: 1
  151. }],
  152. keyField:'id',
  153. reqUrl: '/api/document/bankinformation/save',
  154. delUrl: '/api/document/bankinformation/delete'
  155. },
  156. inoutkind:{
  157. columns: [{
  158. text: '收支类别',
  159. dataIndex: 'ft_name',
  160. flex: 1
  161. }],
  162. keyField:'id',
  163. reqUrl: '/api/document/fundinouttype/save',
  164. delUrl: '/api/document/fundinouttype/delete'
  165. },
  166. address:{
  167. columns: [{
  168. text: '地址名称',
  169. dataIndex: 'ad_address',
  170. flex: 1
  171. }],
  172. keyField:'id',
  173. reqUrl: '/api/document/address/save',
  174. delUrl: '/api/document/address/delete'
  175. },
  176. maxnumbers:{
  177. columns: [{
  178. text : "单据名称",
  179. width : 200.0,
  180. dataIndex : "mn_caller",
  181. xtype : "",
  182. },
  183. {
  184. text : "单据前缀",
  185. dataIndex : "mn_leadcode",
  186. width : 120.0,
  187. xtype : "",
  188. },
  189. {
  190. text : "单据规则",
  191. dataIndex : "mn_rule",
  192. width : 220.0,
  193. xtype : "",
  194. },{
  195. text : "流水长度",
  196. dataIndex : "mn_number",
  197. width : 120.0,
  198. xtype : "",
  199. }],
  200. keyField:'id',
  201. reqUrl:'/api/commons/number/save'
  202. },
  203. warehouse:{
  204. columns: [{
  205. text: '仓库编号',
  206. dataIndex: 'wh_code',
  207. width: 200
  208. },{
  209. text: '仓库名称',
  210. dataIndex: 'wh_description',
  211. width: 200
  212. },{
  213. text: '仓库类型',
  214. dataIndex: 'wh_type',
  215. width: 200
  216. },{
  217. text: '仓库状态码',
  218. dataIndex: 'wh_status',
  219. hidden:true,
  220. },{
  221. text: '仓库状态',
  222. dataIndex: 'wh_statuscode',
  223. width:90,
  224. xtype: 'actioncolumn',
  225. align : 'center',
  226. items: [{
  227. tooltip: '锁定',
  228. iconCls:'',
  229. getClass: function(v, meta, rec) {
  230. if(rec.get('wh_statuscode')=='OPEN'){
  231. this.items[0].tooltip = '不启用';
  232. return 'x-grid-checkcolumn-checked';
  233. }else{
  234. this.items[0].tooltip = '启用';
  235. return 'x-grid-checkcolumn';
  236. }
  237. },
  238. handler: function(view, rowIndex, colIndex) {
  239. var rec = view.getStore().getAt(rowIndex);
  240. var type=rec.get('wh_statuscode')=='OPEN'?true:false;
  241. // 禁用/启用
  242. var form = this.ownerCt.ownerCt.ownerCt;
  243. var grid = this.ownerCt.ownerCt;
  244. form.BaseUtil.request({
  245. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  246. params: '',
  247. method: 'POST',
  248. })
  249. .then(function(localJson) {
  250. if(localJson.success){
  251. showToast('操作成功');
  252. grid.store.load();
  253. }
  254. })
  255. .catch(function(res) {
  256. console.error(res);
  257. showToast('操作失败: ' + res.message);
  258. });
  259. }
  260. }]
  261. }],
  262. keyField:'id',
  263. reqUrl: '/api/document/warehouse/save',
  264. delUrl: '/api/document/warehouse/delete'
  265. }
  266. }
  267. })