FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. from:'pr_purcprice',to:'pd_orderprice'
  112. }],
  113. dbtpls:[{
  114. field:'pr_code',width:100
  115. },{
  116. field:'pr_detail',width:100
  117. },{
  118. field:'pr_spec',width:100
  119. }],
  120. defaultCondition: "pr_statuscode='OPEN'",
  121. dbSearchFields:[{
  122. emptyText:'输入物料编号、名称或规格',
  123. xtype : "textfield",
  124. name : "search",
  125. width: 200,
  126. getCondition: function(v) {
  127. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  128. },
  129. allowBlank : true,
  130. columnWidth : 0.25
  131. }],
  132. //窗口列设置
  133. dbColumns:[{
  134. "text": "物料ID",
  135. "hidden": true,
  136. "dataIndex": "id",
  137. }, {
  138. "text": "物料编号",
  139. "dataIndex": "pr_code",
  140. "width": 200,
  141. }, {
  142. "text": "物料名称",
  143. "width": 200,
  144. "dataIndex": "pr_detail",
  145. }, {
  146. "text": "规格",
  147. "dataIndex": "pr_spec",
  148. "width": 100,
  149. }, {
  150. "text": "单位",
  151. "dataIndex": "pr_unit",
  152. "width": 100,
  153. },{
  154. "text": "仓库id",
  155. "dataIndex": "pr_whid",
  156. "hidden": true,
  157. },{
  158. "text": "仓库编号",
  159. "dataIndex": "pr_whcode",
  160. "hidden": true,
  161. },{
  162. "text": "仓库",
  163. "dataIndex": "pr_whname",
  164. "width": 200,
  165. },{
  166. "text": "总库存数",
  167. "dataIndex": "po_onhand",
  168. "width": 100,
  169. },{
  170. "text": "类型",
  171. "dataIndex": "pr_kind",
  172. "width": 100,
  173. },{
  174. "text": "型号",
  175. "dataIndex": "pr_orispeccode",
  176. "width": 100,
  177. },{
  178. "text": "品牌",
  179. "dataIndex": "pr_brand",
  180. "width": 100,
  181. },{
  182. "text": "供应商",
  183. "dataIndex": "pr_vendname",
  184. "width": 100,
  185. },{
  186. "text": "最小包装",
  187. "dataIndex": "pr_zxbzs",
  188. "width": 100,
  189. },{
  190. "text": "L/T",
  191. "dataIndex": "pr_leadtime",
  192. "width": 100,
  193. }]
  194. });
  195. }
  196. },
  197. //放大镜赋值关系 以及 tpl模板
  198. 'dbfindtrigger[name=pd_whname]':{
  199. beforerender:function(f){
  200. Ext.apply(f,{
  201. dataUrl:'/api/document/warehouse/list',
  202. // dataUrl:'http://localhost:9480/warehouse/list',
  203. addXtype: 'other-warehouse',
  204. addTitle: '仓库资料',
  205. defaultCondition:"wh_statuscode='OPEN'",
  206. dbfinds:[{
  207. from:'id',to:'pd_whid',ignore:true
  208. },{
  209. from:'wh_code',to:'pd_whcode'
  210. },{
  211. from:'wh_description',to:'pd_whname'
  212. }],
  213. dbtpls:[{
  214. field:'pd_whcode',width:100
  215. },{
  216. field:'pd_whname',width:100
  217. }],
  218. dbSearchFields:[{
  219. emptyText:'输入仓库编号或名称',
  220. xtype : "textfield",
  221. name : "wh_code",
  222. allowBlank : true,
  223. columnWidth : 0.25,
  224. getCondition:function(v){
  225. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  226. }
  227. }],
  228. dbColumns:[{
  229. "text": "仓库ID",
  230. "flex": 0,
  231. "dataIndex": "id",
  232. "width": 0,
  233. "xtype": "",
  234. "items": null
  235. },{
  236. "text": "仓库编号",
  237. "flex": 1,
  238. "dataIndex": "wh_code",
  239. "width": 100,
  240. "xtype": "",
  241. "items": null
  242. }, {
  243. "text": "仓库名称",
  244. "flex": 1,
  245. "dataIndex": "wh_description",
  246. "xtype": "",
  247. "items": null
  248. }, {
  249. "text": "仓库类型",
  250. "flex": 1,
  251. "dataIndex": "wh_type",
  252. "xtype": "",
  253. "items": null
  254. }]
  255. }) ;
  256. }
  257. }
  258. });
  259. },
  260. addCombo:function(){
  261. var combo=this.ownerCmp;
  262. Ext.create('Ext.window.Window',{
  263. layout:'vbox',
  264. bodyPadding: 15,
  265. width:500,
  266. items:[{
  267. fieldLabel:'实际值',
  268. xtype:'textfield'
  269. },{
  270. fieldLabel:'显示值',
  271. xtype:'textfield'
  272. }],
  273. buttons:[{
  274. text:'确认',
  275. handler:function(b){
  276. combo.setValue('ok');
  277. b.up('window').close();
  278. }
  279. }],
  280. renderTo:this.ownerCmp.ownerCt.getEl()
  281. }).show();
  282. },
  283. turnOut: function() {
  284. var me = this,
  285. form = me.getView(),
  286. id = form.getForm().findField(form._idField);
  287. form.BaseUtil.request({
  288. url: form._turnOutUrl+id.value,
  289. method: 'POST',
  290. })
  291. .then(function(localJson) {
  292. if(localJson.success){
  293. var intValue = localJson.data.id,
  294. codeValue= localJson.data.code,
  295. name = localJson.data.name;
  296. openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  297. initId: intValue
  298. });
  299. showToast('转单成功');
  300. }
  301. })
  302. .catch(function(res) {
  303. console.error(res);
  304. showToast('转单失败: ' + res.message);
  305. });
  306. }
  307. });