FormPanelController.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Ext.define('saas.view.sale.saleIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.sale-salein-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=pd_prodcode]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. conditionCode:'pr_code',
  18. dataUrl:basePath+'document/product/getProductsByCondition',
  19. dbfinds:[{
  20. from:'pr_id',to:'pd_prodid'
  21. },{
  22. from:'pr_code',to:'pd_prodcode'
  23. },{
  24. from:'pr_detail',to:'pr_detail'
  25. },{
  26. from:'pr_unit',to:'pd_unit'
  27. }
  28. ],
  29. dbtpls:[{
  30. field:'pr_code',width:100
  31. },{
  32. field:'pr_detail',width:100
  33. },{
  34. field:'pr_unit',width:100
  35. }],
  36. dbColumns:[{
  37. "text": "物料ID",
  38. "flex": 0,
  39. "dataIndex": "pr_id",
  40. "width": 0,
  41. "xtype": "",
  42. "items": null
  43. },{
  44. "text": "物料编号",
  45. "flex": 1,
  46. "dataIndex": "pr_code",
  47. "width": 100,
  48. "xtype": "",
  49. "items": null
  50. }, {
  51. "text": "物料名称",
  52. "flex": 1,
  53. "dataIndex": "pr_detail",
  54. "xtype": "",
  55. "items": null
  56. }, {
  57. "text": "物料规格",
  58. "flex": 0,
  59. "dataIndex": "pr_spec",
  60. "width": 200,
  61. "xtype": "",
  62. "items": null
  63. }, {
  64. "text": "物料单位",
  65. "flex": 0,
  66. "dataIndex": "pr_unit",
  67. "width": 200,
  68. "xtype": "",
  69. "items": null
  70. }]
  71. }) ;
  72. }
  73. }
  74. });
  75. },
  76. addCombo:function(){
  77. var combo=this.ownerCmp;
  78. Ext.create('Ext.window.Window',{
  79. layout:'vbox',
  80. bodyPadding: 15,
  81. width:500,
  82. items:[{
  83. fieldLabel:'实际值',
  84. xtype:'textfield'
  85. },{
  86. fieldLabel:'显示值',
  87. xtype:'textfield'
  88. }],
  89. buttons:[{
  90. text:'确认',
  91. handler:function(b){
  92. combo.setValue('ok');
  93. b.up('window').close();
  94. }
  95. }],
  96. renderTo:this.ownerCmp.ownerCt.getEl()
  97. }).show();
  98. },
  99. turnOut: function() {
  100. var me = this,
  101. form = me.getView(),
  102. id = form.getForm().findField(form._idField);
  103. form.BaseUtil.request({
  104. url: form._turnOutUrl+id.value,
  105. method: 'GET',
  106. })
  107. .then(function(res) {
  108. var localJson = new Ext.decode(res.responseText);
  109. if(localJson.success){
  110. Ext.Msg.alert('提示','转单成功');
  111. }
  112. })
  113. .catch(function() {
  114. Ext.Msg.alert('提示','转单失败');
  115. });
  116. }
  117. });