查看: 11966|回复: 1

弹出框数据传入和传出请指导

升级   5.48%

34

主题

74

回帖

548

积分

注册会员

Rank: 2

积分
548
发表于 2022-3-18 17:41:48 | 显示全部楼层 |阅读模式
本帖最后由 Dffiltri 于 2022-3-18 17:45 编辑

我有一个弹出框,从主表单传入数据在弹出框上标题上显示出来了,但是弹出框内输入框怎样赋值传入的数据,以及怎样把填好的合格数和不合格数传出到主表单?怎样封装result数据和把数据传出?if (callback) callback.apply(this, [result]);  没有看懂,请老师指导。qty是合格数,rej是不合格数,seq是工序号
this.form.get("subform").node.show();
this.data.seq = this.target.getData();
this.data.cost = this.target.parentLine.getModule("wages").getData();
// this.form.get('flag').setText('您选择的是:' + this.target.parentLine.getModule("wc").getData() + '工序,请填写报工数量');
var title = this.target.getData() + '工序(' + this.target.parentLine.getModule("wc").getData() + ')报工数量输入';

function callback(result){
  console.log(this);
  this.data.seq = result.seq;
  this.data.qty = result.qty;
  this.data.rej = result.rej;
  alert(JSON.stringify(result));
}

var dialog = o2.DL.open({
  "style" : "o2",
  "title": title,
  "width": "400",
  "height" : "300",
  "isMax": false,
  "isClose": false,
  "isResize": false,
  "isMove": false,
  "isTitle": true,
  "offset": {"x":-200, "y": -100},
  "mask": true,
  "content": this.form.get("subform").node,
  "container": this.form.node(),
//   "duration": 200,
  "buttonList": [
    {
      "text": "确定",
      "action": function(){
          var result = [{"seq":this.data.seq,"qty":this.data.subform_qty1,"rej":this.data.subform_rej1}];
          // if (callback) callback.apply(this, [result]);  


         
          if(callback){
            callback.apply(this, result);

          };
          console.log(dialog);
          dialog.close();
      }.bind(this)
    },
    {
      "text": "取消",
      "action": function(){
            dialog.close();
      }.bind(this)
    }
  ],
  "onQueryClose": function(){
        console.log("-onQueryClose-");
  }.bind(this),
  "onPostClose": function(){
        console.log("-onPostClose-");

  }.bind(this),
  "onQueryLoad":function(){
      console.log("-onQueryLoad-");
  },
  "onPostLoad": function(){
     console.log("-onPostLoad-");
    //  new Element("div",{text:"这是内容区域"}).inject(this.content);
     // ...code...
  },
  "onQueryShow": function(){
       console.log("-onQueryshow-");
  },
  "onPostShow": function(){
      console.log("-onPostShow-");
  }.bind(this)
})


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

升级   100%

139

主题

1万

回帖

4万

积分

超级版主

Rank: 8Rank: 8

积分
41458
发表于 2022-3-22 10:25:54 | 显示全部楼层
本帖最后由 论坛管理员 于 2022-3-22 10:28 编辑

直接就可以回传的,在最外面定义一下this,避免作用域的问题,如下图:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread