Kind.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. defaultType:'',
  14. requires: [
  15. 'Ext.button.Segmented'
  16. ],
  17. tbar: [{
  18. xtype: 'segmentedbutton',
  19. reference: 'dataKind',
  20. value: 'customerkind',
  21. name : 'segmentedbutton',
  22. bind:'{segmented}',
  23. items: [{
  24. name:'customerkind',
  25. text: '客户',
  26. value: 'customerkind',
  27. typeText:'客户类型'
  28. }, {
  29. name:'vendorkind',
  30. text: '供应商',
  31. value: 'vendorkind',
  32. typeText:'供应商类型'
  33. }, {
  34. name:'productkind',
  35. text: '物料',
  36. value: 'productkind',
  37. typeText:'物料类型'
  38. }, {
  39. name:'inoutkind',
  40. text: '收支',
  41. value: 'inoutkind',
  42. typeText:'收支类别'
  43. }],
  44. listeners: {
  45. toggle: 'onKindToggle'
  46. }
  47. },'->',
  48. {
  49. xtype:'button',
  50. text:'新增',
  51. listeners: {
  52. click: 'onAdd'
  53. }
  54. },{
  55. xtype:'button',
  56. text:'刷新',
  57. listeners: {
  58. click: 'onRefresh'
  59. }
  60. }],
  61. items:[{
  62. xtype:'grid',
  63. reference: 'document-kind-Grid',
  64. margin: '10 0 0 0',
  65. flex: 1,
  66. frame:true,
  67. plugins: [{
  68. ptype: 'menuclipboard'
  69. }],
  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. inoutkind:{
  109. columns: [{
  110. text: '收支名称',
  111. dataIndex: 'ft_name',
  112. flex: 1
  113. },{
  114. text: '收支类别',
  115. dataIndex: 'ft_kind',
  116. flex: 1
  117. }],
  118. keyField:'id',
  119. reqUrl: '/api/document/fundinouttype/save',
  120. delUrl: '/api/document/fundinouttype/delete'
  121. }
  122. },
  123. refresh:function(){
  124. var me = this;
  125. var grid = me.items.items[0];
  126. var button = grid.ownerCt.dockedItems.items[0].down('[name='+grid.ownerCt.ownerCt.viewConfig+']');
  127. if(button&&button.xtype!="tbfill"){
  128. button.click();
  129. me.ownerCt.setTitle(button.typeText + '查询');
  130. }
  131. }
  132. })