FormController.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. Ext.define('saas.view.sale.sale.FormController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.sale-sale-formcontroller',
  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=sa_custcode]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dataUrl:'http://192.168.0.181:8570/api/document/customer/getCustomerByCondition',
  18. dbfinds:[{
  19. from:'cu_id',to:'sa_custid'
  20. },{
  21. from:'cu_code',to:'sa_custcode'
  22. },{
  23. from:'cu_name',to:'sa_custname'
  24. }],
  25. dbtpls:[{
  26. field:'cu_code',width:100
  27. },{
  28. field:'cu_name',width:100
  29. }],
  30. dbColumns:[{
  31. conditionCode:'cu_id',
  32. "text": "客户ID",
  33. "flex": 0,
  34. "dataIndex": "cu_id",
  35. "width": 0,
  36. "xtype": "",
  37. "items": null
  38. },{
  39. conditionCode:'cu_code',
  40. "text": "客户编号",
  41. "flex": 1,
  42. "dataIndex": "cu_code",
  43. "width": 100,
  44. "xtype": "",
  45. "items": null
  46. }, {
  47. conditionCode:'cu_name',
  48. "text": "客户名称",
  49. "flex": 1,
  50. "dataIndex": "cu_name",
  51. "xtype": "",
  52. "items": null
  53. }, {
  54. conditionCode:'cu_type',
  55. "text": "客户类型",
  56. "flex": 0,
  57. "dataIndex": "cu_type",
  58. "width": 200,
  59. "xtype": "",
  60. "items": null
  61. }]
  62. }) ;
  63. }
  64. },
  65. //放大镜赋值关系 以及 tpl模板
  66. 'dbfindtrigger[name=pd_prodcode]':{
  67. beforerender:function(f){
  68. Ext.apply(f,{
  69. conditionCode:'pr_code',
  70. dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
  71. dbfinds:[{
  72. from:'pr_code',to:'sd_prodcode'
  73. }],
  74. dbtpls:[{
  75. field:'pr_code',width:100
  76. },{
  77. field:'pr_detail',width:100
  78. }],
  79. dbColumns:[{
  80. "text": "物料ID",
  81. "flex": 0,
  82. "dataIndex": "pr_id",
  83. "width": 0,
  84. "xtype": "",
  85. "items": null
  86. },{
  87. "text": "物料编号",
  88. "flex": 1,
  89. "dataIndex": "pr_code",
  90. "width": 100,
  91. "xtype": "",
  92. "items": null
  93. }, {
  94. "text": "物料名称",
  95. "flex": 1,
  96. "dataIndex": "pr_detail",
  97. "xtype": "",
  98. "items": null
  99. }, {
  100. "text": "物料规格",
  101. "flex": 0,
  102. "dataIndex": "pr_spec",
  103. "width": 200,
  104. "xtype": "",
  105. "items": null
  106. }]
  107. }) ;
  108. }
  109. }
  110. });
  111. },
  112. addCombo:function(){
  113. var combo=this.ownerCmp;
  114. Ext.create('Ext.window.Window',{
  115. layout:'vbox',
  116. bodyPadding: 15,
  117. width:500,
  118. items:[{
  119. fieldLabel:'实际值',
  120. xtype:'textfield'
  121. },{
  122. fieldLabel:'显示值',
  123. xtype:'textfield'
  124. }],
  125. buttons:[{
  126. text:'确认',
  127. handler:function(b){
  128. combo.setValue('ok');
  129. b.up('window').close();
  130. }
  131. }],
  132. renderTo:this.ownerCmp.ownerCt.getEl()
  133. }).show();
  134. },
  135. turnOut: function() {
  136. var me = this,
  137. form = me.getView(),
  138. id = form.getForm().findField(form._idField);
  139. form.BaseUtil.request({
  140. url: form._turnOutUrl+id.value,
  141. method: 'GET',
  142. })
  143. .then(function(res) {
  144. var localJson = new Ext.decode(res.responseText);
  145. if(localJson.success){
  146. Ext.Msg.alert('提示','转单成功');
  147. }
  148. })
  149. .catch(function() {
  150. Ext.Msg.alert('提示','转单失败');
  151. });
  152. }
  153. });