|
楼主 |
发表于 2018-6-14 17:18:12
|
显示全部楼层
我的解决办法:通过attachmentSimple组件,绑定对应图片路径字段,生成的图片路径类似于“[{"storeFileName":"C8066355DD40000176FB36701B60157C","realFileName":"1528966915196.jpg"}]”需要将生成的图片路径转换类型,代码如下:
// 图片路径转换 自定义方法
Model.prototype.getImageUrl = function(value, ownerID) {
debugger;
if (value) {
try {
var jsonList = eval("(" + value + ")");
if (jsonList instanceof Array) {
var realFileName = jsonList[0]["realFileName"];
var storeFileName = jsonList[0]["storeFileName"];
var operateType = "browse";
var url = this.actionUrl + '?realFileName=' + realFileName + '&storeFileName=' + storeFileName + '&ownerID=' + ownerID + '&operateType=' + operateType;
var imageUrl = require.toUrl(url);
return imageUrl;// 给图片字段赋转换完路径的值
}
} catch (e) {
console.log(e);
}
}
return "";
};
==============================================
点击按钮,触发点击事件:
// 点击事件 保存input框中数据
Model.prototype.button1Click = function(event) {
var self = this;
var input1 = this.comp("input1").val();
var pl_poldetail = this.comp("pl_poldetail");
var window = this.comp("window");
if (input1 === undefined || input1 === "") {
justep.Util.hint("填写原因!", {
position : "middle"
})
} else {
var ownerID = fID;
//alert(ownerID)
var value = pl_poldetail.val("PL_PICTURE");//PL_PICTURE为组件绑定图片路径字段
//alert(value)
var imgUrl = self.getImageUrl(value, ownerID);//调取自定义
//alert(imgUrl)
pl_poldetail.setValue("PL_PICTURE1", imgUrl);//PL_PICTURE1转换图片路径字段
pl_poldetail.setValue("PL_CAUSE", input1);
pl_poldetail.saveData();
justep.Util.hint("提交成功!", {
position : "middle"
})
this.comp("input1").clear();
window.close();
}
};
|
|