|
|
@@ -1,7 +1,6 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
data: {
|
|
|
- isNew: false, //是否为新增
|
|
|
ownerid: null,
|
|
|
ownertable: null,
|
|
|
sys_datafollowupid: 0, //数据ID
|
|
|
@@ -50,21 +49,27 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
|
- this.initTemplate()
|
|
|
+ // this.initTemplate()
|
|
|
}
|
|
|
+
|
|
|
+ //getFiles
|
|
|
},
|
|
|
+
|
|
|
/* 绑定媒体 */
|
|
|
insertImgEdit({
|
|
|
detail
|
|
|
}) {
|
|
|
+ this.handleFileLink(detail)
|
|
|
+ },
|
|
|
+ handleFileLink(attachmentids, ownertable = "temporary", ownerid = 1, data) {
|
|
|
_Http.basic({
|
|
|
"classname": "system.attachment.Attachment",
|
|
|
"method": "createFileLink",
|
|
|
"content": {
|
|
|
- "ownertable": "sys_datafollowup",
|
|
|
- "ownerid": this.data.sys_datafollowupid,
|
|
|
- "usetype": "default",
|
|
|
- "attachmentids": detail
|
|
|
+ ownertable,
|
|
|
+ ownerid,
|
|
|
+ usetype: 'default',
|
|
|
+ attachmentids
|
|
|
}
|
|
|
}).then(res => {
|
|
|
console.log('跟进记录绑定附件', res)
|
|
|
@@ -72,25 +77,15 @@ Page({
|
|
|
title: res.msg,
|
|
|
icon: "none"
|
|
|
})
|
|
|
- this.selectComponent("#Yl_files").handleFiles(res.data)
|
|
|
- })
|
|
|
- },
|
|
|
- /* 初始化模板 */
|
|
|
- initTemplate() {
|
|
|
- _Http.basic({
|
|
|
- "id": 20220930121601,
|
|
|
- content: {
|
|
|
- type: "",
|
|
|
- content: this.data.content,
|
|
|
- ownerid: this.data.ownerid,
|
|
|
- ownertable: this.data.ownertable,
|
|
|
- sys_datafollowupid: this.data.sys_datafollowupid
|
|
|
+ if (ownertable == 'temporary') {
|
|
|
+ this.selectComponent("#Yl_files").handleFiles(res.data)
|
|
|
+ } else {
|
|
|
+ if (res.data.length) data.attinfos = res.data;
|
|
|
+ // this.changeItem(data)
|
|
|
+ /* setTimeout(() => {
|
|
|
+ wx.navigateBack()
|
|
|
+ }, 500) */
|
|
|
}
|
|
|
- }).then(res => {
|
|
|
- this.setData({
|
|
|
- sys_datafollowupid: res.data.sys_datafollowupid,
|
|
|
- isNew: true
|
|
|
- })
|
|
|
})
|
|
|
},
|
|
|
//开始选择跟进方式
|
|
|
@@ -129,6 +124,7 @@ Page({
|
|
|
sys_datafollowupid: this.data.sys_datafollowupid
|
|
|
};
|
|
|
if (!content.content) return;
|
|
|
+ console.log(this.selectComponent("#Yl_files").getFiles())
|
|
|
_Http.basic({
|
|
|
"id": 20220930121601,
|
|
|
content
|
|
|
@@ -140,11 +136,11 @@ Page({
|
|
|
});
|
|
|
wx.showToast({
|
|
|
title: '保存成功',
|
|
|
- icon: "none"
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
});
|
|
|
- this.setData({
|
|
|
- isNew: false
|
|
|
- })
|
|
|
+ let attachmentids = this.selectComponent("#Yl_files").getFiles().attachmentids;
|
|
|
+ if (attachmentids.length) this.handleFileLink(attachmentids, 'sys_datafollowup', res.data.sys_datafollowupid, res.data);
|
|
|
setTimeout(() => {
|
|
|
getCurrentPages().forEach(v => {
|
|
|
//详情界面更新数据
|
|
|
@@ -181,16 +177,5 @@ Page({
|
|
|
});
|
|
|
}, 300)
|
|
|
})
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
- if (this.data.isNew) _Http.basic({
|
|
|
- "id": 20220930121701,
|
|
|
- "content": {
|
|
|
- "sys_datafollowupid": this.data.sys_datafollowupid,
|
|
|
- "deletereason": "系统删除"
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("初始化模板后未保存删除", res)
|
|
|
- })
|
|
|
}
|
|
|
})
|