Kind.js 8.0 KB

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