FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchasein-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. /**放大镜新增demo*/
  8. "field[name=combo]":{
  9. beforerender:function(f){
  10. f.addHandler=me.addCombo;
  11. }
  12. },
  13. //放大镜赋值关系 以及 tpl模板
  14. 'dbfindtrigger[name=pi_vendname]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dataUrl:'/api/document/vendor/list',
  18. // dataUrl:'http://localhost:9480/vendor/list',
  19. addXtype: 'document-vendor-formpanel',
  20. addTitle: '供应商资料',
  21. defaultCondition:"ve_statuscode='OPEN'",
  22. dbfinds:[{
  23. from:'id',to:'pi_vendid',ignore:true
  24. },{
  25. from:'ve_code',to:'pi_vendcode'
  26. },{
  27. from:'ve_name',to:'pi_vendname'
  28. }],
  29. dbtpls:[{
  30. field:'ve_code',width:100
  31. },{
  32. field:'ve_name',width:100
  33. }],
  34. defaultCondition: "ve_statuscode='OPEN'",
  35. dbSearchFields:[{
  36. emptyText:'输入供应商编号或名称',
  37. xtype : "textfield",
  38. name : "search",
  39. getCondition: function(v) {
  40. return "(upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%')";
  41. },
  42. allowBlank : true,
  43. columnWidth : 0.25
  44. }],
  45. dbColumns:[{
  46. "text": "供应商ID",
  47. "hidden": true,
  48. "dataIndex": "id",
  49. "width": 100,
  50. "xtype": "numbercolumn"
  51. },{
  52. "text": "供应商编号",
  53. "dataIndex": "ve_code",
  54. "width": 200
  55. }, {
  56. "text": "供应商名称",
  57. "dataIndex": "ve_name",
  58. "width": 200
  59. }, {
  60. "text": "供应商类型",
  61. "dataIndex": "ve_type",
  62. "width": 180,
  63. "items": null
  64. }, {
  65. "text": "税率",
  66. "dataIndex": "ve_taxrate",
  67. "width": 100
  68. }, {
  69. "text": "承付天数",
  70. "dataIndex": "ve_promisedays",
  71. "width": 100
  72. }, {
  73. "text": "纳税人识别号",
  74. "dataIndex": "ve_bankaccount",
  75. "width": 150
  76. }, {
  77. "text": "开户银行",
  78. "dataIndex": "ve_bankaccount",
  79. "width": 100
  80. }, {
  81. "text": "银行账户",
  82. "dataIndex": "ve_bankcode",
  83. "width": 100
  84. }]
  85. }) ;
  86. }
  87. },
  88. //放大镜赋值关系 以及 tpl模板
  89. 'multidbfindtrigger[name=pd_prodcode]':{
  90. beforerender:function(f){
  91. Ext.apply(f,{
  92. dataUrl:'/api/document/product/list',
  93. // dataUrl:'http://localhost:9480/product/list',
  94. addXtype: 'document-product-formpanel',
  95. addTitle: '物料资料',
  96. dbfinds:[{
  97. from:'id',to:'pd_prodid',ignore:true
  98. },{
  99. from:'pr_code',to:'pd_prodcode'
  100. },{
  101. from:'pr_detail',to:'pr_detail'
  102. },{
  103. from:'pr_spec',to:'pr_spec'
  104. },{
  105. from:'pr_whid',to:'pd_whid'
  106. },{
  107. from:'pr_whcode',to:'pd_whcode'
  108. },{
  109. from:'pr_whname',to:'pd_whname'
  110. }],
  111. dbtpls:[{
  112. field:'pr_code',width:100
  113. },{
  114. field:'pr_detail',width:100
  115. },{
  116. field:'pr_spec',width:100
  117. }],
  118. defaultCondition: "pr_statuscode='OPEN'",
  119. dbSearchFields:[{
  120. emptyText:'输入物料编号、名称或规格',
  121. xtype : "textfield",
  122. name : "search",
  123. width: 200,
  124. getCondition: function(v) {
  125. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  126. },
  127. allowBlank : true,
  128. columnWidth : 0.25
  129. }],
  130. //窗口列设置
  131. dbColumns:[{
  132. "text": "物料ID",
  133. "hidden": true,
  134. "dataIndex": "id",
  135. }, {
  136. "text": "物料编号",
  137. "dataIndex": "pr_code",
  138. "width": 200,
  139. }, {
  140. "text": "物料名称",
  141. "width": 200,
  142. "dataIndex": "pr_detail",
  143. }, {
  144. "text": "规格",
  145. "dataIndex": "pr_spec",
  146. "width": 100,
  147. }, {
  148. "text": "单位",
  149. "dataIndex": "pr_unit",
  150. "width": 100,
  151. },{
  152. "text": "仓库id",
  153. "dataIndex": "pr_whid",
  154. "hidden": true,
  155. },{
  156. "text": "仓库编号",
  157. "dataIndex": "pr_whcode",
  158. "hidden": true,
  159. },{
  160. "text": "仓库",
  161. "dataIndex": "pr_whname",
  162. "width": 200,
  163. },{
  164. "text": "总库存数",
  165. "dataIndex": "po_onhand",
  166. "width": 100,
  167. },{
  168. "text": "类型",
  169. "dataIndex": "pr_kind",
  170. "width": 100,
  171. },{
  172. "text": "型号",
  173. "dataIndex": "pr_orispeccode",
  174. "width": 100,
  175. },{
  176. "text": "品牌",
  177. "dataIndex": "pr_brand",
  178. "width": 100,
  179. },{
  180. "text": "供应商",
  181. "dataIndex": "pr_vendname",
  182. "width": 100,
  183. },{
  184. "text": "最小包装",
  185. "dataIndex": "pr_zxbzs",
  186. "width": 100,
  187. },{
  188. "text": "L/T",
  189. "dataIndex": "pr_leadtime",
  190. "width": 100,
  191. }]
  192. });
  193. }
  194. },
  195. //放大镜赋值关系 以及 tpl模板
  196. 'dbfindtrigger[name=pd_whname]':{
  197. beforerender:function(f){
  198. Ext.apply(f,{
  199. dataUrl:'/api/document/warehouse/list',
  200. // dataUrl:'http://localhost:9480/warehouse/list',
  201. addXtype: 'other-warehouse',
  202. addTitle: '仓库资料',
  203. defaultCondition:"wh_statuscode='OPEN'",
  204. dbfinds:[{
  205. from:'id',to:'pd_whid',ignore:true
  206. },{
  207. from:'wh_code',to:'pd_whcode'
  208. },{
  209. from:'wh_description',to:'pd_whname'
  210. }],
  211. dbtpls:[{
  212. field:'pd_whcode',width:100
  213. },{
  214. field:'pd_whname',width:100
  215. }],
  216. dbSearchFields:[{
  217. emptyText:'输入仓库编号或名称',
  218. xtype : "textfield",
  219. name : "wh_code",
  220. allowBlank : true,
  221. columnWidth : 0.25,
  222. getCondition:function(v){
  223. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  224. }
  225. }],
  226. dbColumns:[{
  227. "text": "仓库ID",
  228. "flex": 0,
  229. "dataIndex": "id",
  230. "width": 0,
  231. "xtype": "",
  232. "items": null
  233. },{
  234. "text": "仓库编号",
  235. "flex": 1,
  236. "dataIndex": "wh_code",
  237. "width": 100,
  238. "xtype": "",
  239. "items": null
  240. }, {
  241. "text": "仓库名称",
  242. "flex": 1,
  243. "dataIndex": "wh_description",
  244. "xtype": "",
  245. "items": null
  246. }, {
  247. "text": "仓库类型",
  248. "flex": 1,
  249. "dataIndex": "wh_type",
  250. "xtype": "",
  251. "items": null
  252. }]
  253. }) ;
  254. }
  255. }
  256. });
  257. },
  258. addCombo:function(){
  259. var combo=this.ownerCmp;
  260. Ext.create('Ext.window.Window',{
  261. layout:'vbox',
  262. bodyPadding: 15,
  263. width:500,
  264. items:[{
  265. fieldLabel:'实际值',
  266. xtype:'textfield'
  267. },{
  268. fieldLabel:'显示值',
  269. xtype:'textfield'
  270. }],
  271. buttons:[{
  272. text:'确认',
  273. handler:function(b){
  274. combo.setValue('ok');
  275. b.up('window').close();
  276. }
  277. }],
  278. renderTo:this.ownerCmp.ownerCt.getEl()
  279. }).show();
  280. },
  281. turnOut: function() {
  282. var me = this,
  283. form = me.getView(),
  284. id = form.getForm().findField(form._idField);
  285. form.BaseUtil.request({
  286. url: form._turnOutUrl+id.value,
  287. method: 'POST',
  288. })
  289. .then(function(localJson) {
  290. if(localJson.success){
  291. var intValue = localJson.data.id,
  292. codeValue= localJson.data.code,
  293. name = localJson.data.name;
  294. openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  295. initId: intValue
  296. });
  297. showToast('转单成功');
  298. }
  299. })
  300. .catch(function(res) {
  301. console.error(res);
  302. showToast('转单失败: ' + res.message);
  303. });
  304. }
  305. });