Kind.js 8.4 KB

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