FormPanelController.js 8.6 KB

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