|
@@ -1,4 +1,6 @@
|
|
|
-const _Http = getApp().globalData.http;
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ MFT = require("../../utils/matchingFeilType"),
|
|
|
+ CF = require("../../utils/checkFile");
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -18,7 +20,6 @@ Page({
|
|
|
editRichText: false, //编辑富文本
|
|
|
richTextFile: [],
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
@@ -34,22 +35,41 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- titleInput({
|
|
|
+ getFile({
|
|
|
detail
|
|
|
}) {
|
|
|
- this.setData({
|
|
|
- "content.title": detail.value.trim()
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "system.attachment.Attachment",
|
|
|
+ "method": "createFileLink",
|
|
|
+ "content": {
|
|
|
+ "ownertable": "SAT_SHAREMATERIAL",
|
|
|
+ "ownerid": this.data.detailsData.sat_sharematerialid,
|
|
|
+ "usetype": "default",
|
|
|
+ "attachmentids": detail
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ "detailsData.attinfos": this.data.detailsData.attinfos.concat(MFT.fileList(res.data))
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- notesInput({
|
|
|
+ titleInput({
|
|
|
detail
|
|
|
}) {
|
|
|
this.setData({
|
|
|
- "content.notes": detail.value.trim()
|
|
|
+ "content.title": detail.value.trim()
|
|
|
})
|
|
|
},
|
|
|
+ openFile(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ CF.checkFile(item);
|
|
|
+ },
|
|
|
/* 打开编辑富文本 */
|
|
|
openEditRichText() {
|
|
|
this.setData({
|
|
@@ -60,32 +80,47 @@ Page({
|
|
|
getRichText({
|
|
|
detail
|
|
|
}) {
|
|
|
- console.log("富文本", detail)
|
|
|
this.setData({
|
|
|
"content.content": detail
|
|
|
})
|
|
|
},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
-
|
|
|
- },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
+ deleteFile(e) {
|
|
|
+ const {
|
|
|
+ item,
|
|
|
+ index
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ const that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: "是否确认删除该文件?",
|
|
|
+ success: async s => {
|
|
|
+ if (!s.confirm) return;
|
|
|
+ let res = await that.handleDelete([item.linksid]);
|
|
|
+ if (res.msg != '成功') wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ });
|
|
|
+ let attinfos = that.data.detailsData.attinfos;
|
|
|
+ attinfos.splice(index, 1);
|
|
|
+ that.setData({
|
|
|
+ "detailsData.attinfos": attinfos
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {
|
|
|
-
|
|
|
+ handleDelete(linksids) {
|
|
|
+ return _Http.basic({
|
|
|
+ "classname": "system.attachment.Attachment",
|
|
|
+ "method": "deleteFileLink",
|
|
|
+ "content": {
|
|
|
+ linksids
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log('删除附件', res)
|
|
|
+ return res;
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
@@ -98,27 +133,14 @@ Page({
|
|
|
}
|
|
|
}).then(res => {
|
|
|
console.log("删除", res)
|
|
|
- })
|
|
|
+ });
|
|
|
+ let attinfos = this.data.detailsData.attinfos;
|
|
|
+ if (attinfos.length) {
|
|
|
+ let linksids = [];
|
|
|
+ for (let i = 0; i < attinfos.length; i++) {
|
|
|
+ linksids.push(attinfos[i].linksid)
|
|
|
+ };
|
|
|
+ this.handleDelete(linksids)
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
-
|
|
|
- }
|
|
|
})
|