Kind.js 8.2 KB

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