Kind.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. text: '备注',
  157. dataIndex: 'bk_remark',
  158. flex: 1
  159. }],
  160. keyField:'id',
  161. reqUrl: '/api/document/bankinformation/save',
  162. delUrl: '/api/document/bankinformation/delete'
  163. },
  164. inoutkind:{
  165. columns: [{
  166. text: '收支名称',
  167. dataIndex: 'ft_name',
  168. flex: 1
  169. },{
  170. text: '收支类别',
  171. dataIndex: 'ft_kind',
  172. flex: 1
  173. }],
  174. keyField:'id',
  175. reqUrl: '/api/document/fundinouttype/save',
  176. delUrl: '/api/document/fundinouttype/delete'
  177. },
  178. address:{
  179. columns: [{
  180. text: '地址名称',
  181. dataIndex: 'ad_address',
  182. flex: 1
  183. }],
  184. keyField:'id',
  185. reqUrl: '/api/document/address/save',
  186. delUrl: '/api/document/address/delete'
  187. },
  188. maxnumbers:{
  189. columns: [{
  190. text : "单据名称",
  191. width : 200.0,
  192. dataIndex : "mn_caller",
  193. xtype : "",
  194. },
  195. {
  196. text : "单据前缀",
  197. dataIndex : "mn_leadcode",
  198. width : 120.0,
  199. xtype : "",
  200. },
  201. {
  202. text : "单据规则",
  203. dataIndex : "mn_rule",
  204. width : 220.0,
  205. xtype : "",
  206. },{
  207. text : "流水长度",
  208. dataIndex : "mn_number",
  209. width : 120.0,
  210. xtype : "",
  211. }],
  212. keyField:'id',
  213. reqUrl:'/api/commons/number/save'
  214. },
  215. personpower:{
  216. columns: [ {
  217. text : "编号",
  218. dataIndex : "code",
  219. width : 120.0,
  220. xtype : "",
  221. },{
  222. text : "角色名称",
  223. width : 200.0,
  224. dataIndex : "name",
  225. xtype : "",
  226. },
  227. {
  228. text : "角色描述",
  229. dataIndex : "description",
  230. width : 120.0,
  231. xtype : "",
  232. }
  233. ],
  234. keyField:'id',
  235. reqUrl:'/api/account/role/save',
  236. updateUrl:'/api/account/role/update',
  237. },
  238. warehouse:{
  239. columns: [{
  240. text: '仓库编号',
  241. dataIndex: 'wh_code',
  242. width: 200
  243. },{
  244. text: '仓库名称',
  245. dataIndex: 'wh_description',
  246. width: 200
  247. },{
  248. text: '仓库类型',
  249. dataIndex: 'wh_type',
  250. width: 200
  251. },{
  252. text: '仓库状态码',
  253. dataIndex: 'wh_status',
  254. hidden:true,
  255. },{
  256. text: '仓库状态',
  257. dataIndex: 'wh_statuscode',
  258. width:90,
  259. xtype: 'actioncolumn',
  260. align : 'center',
  261. items: [{
  262. iconCls:'',
  263. getClass: function(v, meta, rec) {
  264. if(rec.get('wh_statuscode')=='OPEN'){
  265. return 'x-grid-checkcolumn-checked-btn';
  266. }else{
  267. return 'x-grid-checkcolumn-btn';
  268. }
  269. },
  270. handler: function(view, rowIndex, colIndex) {
  271. var rec = view.getStore().getAt(rowIndex);
  272. var type=rec.get('wh_statuscode')=='OPEN'?true:false;
  273. // 禁用/启用
  274. var form = this.ownerCt.ownerCt.ownerCt;
  275. var grid = this.ownerCt.ownerCt;
  276. form.BaseUtil.request({
  277. url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
  278. params: '',
  279. method: 'POST',
  280. })
  281. .then(function(localJson) {
  282. if(localJson.success){
  283. showToast('操作成功');
  284. grid.store.load();
  285. }
  286. })
  287. .catch(function(res) {
  288. console.error(res);
  289. showToast('操作失败: ' + res.message);
  290. });
  291. }
  292. }]
  293. }],
  294. keyField:'id',
  295. reqUrl: '/api/document/warehouse/save',
  296. delUrl: '/api/document/warehouse/delete'
  297. }
  298. },
  299. refresh:function(){
  300. var me = this;
  301. var grid = me.items.items[0];
  302. var button = grid.ownerCt.dockedItems.items[0].down('[name='+grid.ownerCt.ownerCt.viewConfig+']');
  303. if(button&&button.xtype!="tbfill"){
  304. button.click();
  305. me.ownerCt.setTitle(button.typeText + '查询');
  306. }
  307. }
  308. })