FormPanelController.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. Ext.define('saas.view.purchase.purchase.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchase-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. // 主表-供应商名称
  8. 'dbfindtrigger[name=pu_vendname]':{
  9. beforerender:function(f){
  10. Ext.apply(f,{
  11. //数据接口
  12. dataUrl:'/api/document/vendor/list',
  13. addXtype: 'document-vendor-formpanel',
  14. addTitle: '供应商资料',
  15. defaultCondition:"ve_statuscode='OPEN'",
  16. //赋值
  17. dbfinds:[{
  18. from:'id',to:'pu_vendid',ignore:true
  19. },{
  20. from:'ve_code',to:'pu_vendcode'
  21. },{
  22. from:'ve_name',to:'pu_vendname'
  23. }],
  24. //联想设置
  25. dbtpls:[{
  26. field:'ve_code',width:100
  27. },{
  28. field:'ve_name',width:100
  29. }],
  30. defaultCondition: "ve_statuscode='OPEN'",
  31. dbSearchFields:[{
  32. emptyText:'输入供应商编号或名称',
  33. xtype : "textfield",
  34. name : "search",
  35. getCondition: function(v) {
  36. return "(upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%')";
  37. },
  38. allowBlank : true,
  39. columnWidth : 0.25
  40. }],
  41. //放大镜窗口列表
  42. dbColumns:[{
  43. "text": "供应商ID",
  44. "hidden": true,
  45. "dataIndex": "id",
  46. "width": 100,
  47. "xtype": "numbercolumn"
  48. },{
  49. "text": "供应商编号",
  50. "flex": 1,
  51. "dataIndex": "ve_code",
  52. "width": 100
  53. }, {
  54. "text": "供应商名称",
  55. "flex": 1,
  56. "dataIndex": "ve_name",
  57. "width": 100
  58. }, {
  59. "text": "供应商类型",
  60. "flex": 0,
  61. "dataIndex": "ve_type",
  62. "width": 200,
  63. "items": null
  64. }, {
  65. "text": "税率",
  66. "flex": 1,
  67. "dataIndex": "ve_taxrate",
  68. "width": 100
  69. }, {
  70. "text": "承付天数",
  71. "flex": 1,
  72. "dataIndex": "ve_promisedays",
  73. "width": 100
  74. }, {
  75. "text": "纳税人识别号",
  76. "flex": 1,
  77. "dataIndex": "ve_bankaccount",
  78. "width": 100
  79. }, {
  80. "text": "开户银行",
  81. "flex": 1,
  82. "dataIndex": "ve_bankaccount",
  83. "width": 100
  84. }, {
  85. "text": "银行账户",
  86. "flex": 1,
  87. "dataIndex": "ve_bankcode",
  88. "width": 100
  89. }]
  90. }) ;
  91. }
  92. },
  93. // 主表-采购员名称
  94. 'dbfindtrigger[name=pu_buyername]':{
  95. beforerender:function(f){
  96. Ext.apply(f,{
  97. }) ;
  98. }
  99. },
  100. //从表多选放大镜赋值关系 以及 tpl模板
  101. 'multidbfindtrigger[name=pd_prodcode]':{
  102. beforerender:function(f){
  103. Ext.apply(f,{
  104. //数据接口
  105. // dataUrl:'http://192.168.253.31:9480/product/getProductsByCondition',
  106. // dataUrl:'http://localhost:9480/product/list',
  107. dataUrl: '/api/document/product/list',
  108. addXtype: 'document-product-formpanel',
  109. addTitle: '物料资料',
  110. //放大镜赋值设置
  111. dbfinds:[{
  112. from:'id',to:'pd_prodid'
  113. },{
  114. from:'pr_code',to:'pd_prodcode'
  115. },{
  116. from:'pr_detail',to:'pr_detail'
  117. },{
  118. from:'pr_spec',to:'pr_spec'
  119. }],
  120. //联想设置
  121. dbtpls:[{
  122. field:'pr_code',width:100
  123. },{
  124. field:'pr_detail',width:100
  125. }],
  126. defaultCondition: "pr_statuscode='OPEN'",
  127. dbSearchFields:[{
  128. emptyText:'输入物料编号、名称或规格',
  129. xtype : "textfield",
  130. name : "search",
  131. allowBlank : true,
  132. columnWidth : 0.25,
  133. getCondition:function(v){
  134. return "(upper(pr_code) like '%" + v.toUpperCase() + "%' or upper(pr_detail) like '%"+ v.toUpperCase() +"%' or upper(pr_spec) like '%"+ v.toUpperCase() +"%')";
  135. }
  136. }],
  137. //窗口列设置
  138. dbColumns:[{
  139. "text": "物料ID",
  140. "hidden": true,
  141. "dataIndex": "id",
  142. }, {
  143. "text": "物料编号",
  144. "dataIndex": "pr_code",
  145. "width": 200,
  146. }, {
  147. "text": "物料名称",
  148. "width": 200,
  149. "dataIndex": "pr_detail",
  150. }, {
  151. "text": "规格",
  152. "dataIndex": "pr_spec",
  153. "width": 100,
  154. }, {
  155. "text": "单位",
  156. "dataIndex": "pr_spec",
  157. "width": 100,
  158. },{
  159. "text": "仓库id",
  160. "dataIndex": "pr_whid",
  161. "hidden": true,
  162. },{
  163. "text": "仓库编号",
  164. "dataIndex": "pr_whcode",
  165. "hidden": true,
  166. },{
  167. "text": "仓库",
  168. "dataIndex": "pr_whname",
  169. "width": 200,
  170. },{
  171. "text": "总库存数",
  172. "dataIndex": "po_onhand",
  173. "width": 100,
  174. },{
  175. "text": "类型",
  176. "dataIndex": "pr_kind",
  177. "width": 100,
  178. },{
  179. "text": "型号",
  180. "dataIndex": "pr_orispeccode",
  181. "width": 100,
  182. },{
  183. "text": "品牌",
  184. "dataIndex": "pr_brand",
  185. "width": 100,
  186. },{
  187. "text": "供应商",
  188. "dataIndex": "pr_vendname",
  189. "width": 100,
  190. },{
  191. "text": "最小包装",
  192. "dataIndex": "pr_zxbzs",
  193. "width": 100,
  194. },{
  195. "text": "L/T",
  196. "dataIndex": "pr_leadtime",
  197. "width": 100,
  198. }]
  199. }) ;
  200. }
  201. }
  202. });
  203. },
  204. turnIn: function() {
  205. var me = this,
  206. form = me.getView(),
  207. id = form.getForm().findField(form._idField);
  208. form.BaseUtil.request({
  209. url: form._turnInUrl+id.value,
  210. method: 'POST',
  211. })
  212. .then(function(localJson) {
  213. if(localJson.success){
  214. var intValue = localJson.data.id,
  215. codeValue= localJson.data.code,
  216. name = localJson.data.name;
  217. openTab('purchase-purchasein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  218. initId: intValue
  219. });
  220. showToast('转单成功');
  221. }
  222. })
  223. .catch(function(res) {
  224. console.error(res);
  225. showToast('转单失败: ' + res.message);
  226. });
  227. }
  228. });