Dffiltri 发表于 2022-3-18 17:41:48

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

本帖最后由 Dffiltri 于 2022-3-18 17:45 编辑

我有一个弹出框,从主表单传入数据在弹出框上标题上显示出来了,但是弹出框内输入框怎样赋值传入的数据,以及怎样把填好的合格数和不合格数传出到主表单?怎样封装result数据和把数据传出?if (callback) callback.apply(this, );没有看懂,请老师指导。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, );

         
          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)
})


论坛管理员 发表于 2022-3-22 10:25:54

本帖最后由 论坛管理员 于 2022-3-22 10:28 编辑

直接就可以回传的,在最外面定义一下this,避免作用域的问题,如下图:
页: [1]
查看完整版本: 弹出框数据传入和传出请指导