Kind.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. name : 'segmentedbutton',
  25. bind:'{segmented}',
  26. items: [{
  27. text: '客户',
  28. value: 'customerkind',
  29. typeText:'客户类型'
  30. }, {
  31. text: '供应商',
  32. value: 'vendorkind',
  33. typeText:'供应商类型'
  34. }, {
  35. text: '物料',
  36. value: 'productkind',
  37. typeText:'物料类型'
  38. }, {
  39. text: '收支',
  40. value: 'inoutkind',
  41. typeText:'收支类别'
  42. }],
  43. listeners: {
  44. toggle: 'onKindToggle'
  45. }
  46. },'->',
  47. {
  48. xtype:'button',
  49. text:'新增',
  50. listeners: {
  51. click: 'onAdd'
  52. }
  53. },{
  54. xtype:'button',
  55. text:'刷新',
  56. listeners: {
  57. click: 'onRefresh'
  58. }
  59. }],
  60. items:[{
  61. xtype:'grid',
  62. reference: 'document-kind-Grid',
  63. margin: '10 0 0 0',
  64. flex: 1,
  65. frame:true,
  66. bind:{
  67. selection: '{selectedCompany}'
  68. },
  69. listeners:{
  70. render:'loadDefualt'
  71. }
  72. }],
  73. etc:{
  74. customerkind:{
  75. columns: [{
  76. text: '客户类型',
  77. dataIndex: 'ck_name',
  78. flex: 1
  79. }],
  80. keyField:'id',
  81. reqUrl:'/api/document/customerkind/save',
  82. delUrl:'/api/document/customerkind/delete'
  83. },
  84. vendorkind:{
  85. columns: [{
  86. text: '供应商类型',
  87. dataIndex: 'vk_name',
  88. flex: 1
  89. }],
  90. keyField:'id',
  91. reqUrl:'/api/document/vendorkind/save',
  92. delUrl:'/api/document/vendorkind/delete'
  93. },
  94. productkind:{
  95. columns: [{
  96. text: '物料类型',
  97. dataIndex: 'pt_name',
  98. flex: 1
  99. }],
  100. keyField:'id',
  101. reqUrl:'/api/document/producttype/save',
  102. delUrl:'/api/document/producttype/delete'
  103. },
  104. productbrand:{
  105. columns: [{
  106. text: '物料品牌',
  107. dataIndex: 'pb_name',
  108. flex: 1
  109. }],
  110. keyField:'id',
  111. reqUrl:'/api/document/productbrand/save',
  112. delUrl:'/api/document/productbrand/delete'
  113. },
  114. productunit:{
  115. columns: [{
  116. text: '计量单位',
  117. dataIndex: 'pu_name',
  118. flex: 1
  119. }],
  120. keyField:'id',
  121. reqUrl:'/api/document/productunit/save',
  122. delUrl:'/api/document/productunit/delete'
  123. },
  124. bankinformation:{
  125. columns: [{
  126. text: '账户编号',
  127. dataIndex: 'bk_bankcode',
  128. flex: 1
  129. },{
  130. text: '账户名称',
  131. dataIndex: 'bk_bankname',
  132. flex: 1
  133. },{
  134. xtype:'datecolumn',
  135. text: '建账日期',
  136. format:'Y-m-d H:i:s',
  137. dataIndex: 'bk_date',
  138. flex: 1
  139. },{
  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. refresh:function(){
  268. }
  269. })