| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- detail: null,
- isFollow: false,
- isSubmit: true, //是否可以提交
- files: {
- images: [],
- viewImages: [],
- videos: [],
- viewVideos: [],
- files: []
- },
- },
- onLoad(options) {
- this.setData({
- detail: JSON.parse(options.data),
- isFollow: options.isFollow == 'true'
- });
- if (this.data.detail.attinfos.length != 0) this.selectComponent("#Yl_files").handleFiles(res.data)
- if (this.data.detail.notes != '' && this.data.isFollow) this.setData({
- isSubmit: false
- })
- },
- //文本域输入
- onInput(e) {
- this.setData({
- "detail.notes": e.detail.value
- })
- },
- /* 绑定媒体 */
- insertImgEdit({
- detail
- }) {
- _Http.basic({
- "classname": "system.attachment.Attachment",
- "method": "createFileLink",
- "content": {
- "ownertable": "sa_project_stagework",
- "ownerid": this.data.detail.sa_project_stageworkid,
- "usetype": "default",
- "attachmentids": detail
- }
- }).then(res => {
- console.log('跟进记录绑定附件', res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.selectComponent("#Yl_files").handleFiles(res.data)
- this.data.detail.attinfos.push(res.data[0])
- this.changeFile();
- })
- },
- /* 修改源文件附件 */
- changeFile() {
- let pages = getCurrentPages(),
- page = pages[pages.length - 2].selectComponent("#Task"),
- i = page.data.list[page.data.viewIndex].work.findIndex(v => v.sa_project_stageworkid == this.data.detail.sa_project_stageworkid);
- page.setData({
- [`list[${page.data.viewIndex}].work[${i}].attinfos`]: this.data.detail.attinfos
- })
- },
- /* 保存 */
- save() {
- _Http.basic({
- "id": 20221024160202,
- "content": {
- sa_project_stageworkid: this.data.detail.sa_project_stageworkid,
- notes: this.data.detail.notes,
- }
- }).then(res => {
- wx.showToast({
- title: res.msg == '成功' ? '保存成功' : res.data,
- icon: "none"
- });
- if (res.msg != '成功') return;
- this.setData({
- isSubmit: false
- })
- let pages = getCurrentPages(),
- page = pages[pages.length - 2].selectComponent("#Task"),
- i = page.data.list[page.data.viewIndex].work.findIndex(v => v.sa_project_stageworkid == this.data.detail.sa_project_stageworkid);
- page.setData({
- [`list[${page.data.viewIndex}].work[${i}].notes`]: this.data.detail.notes
- })
- })
- },
- /* 提交 */
- submit() {
- let that = this;
- wx.showModal({
- title: '提示',
- content: `是否提交该任务,提交后将计算分值(仅可提交一次)`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 20221024160302,
- "content": {
- "sa_project_stageworkid": that.data.detail.sa_project_stageworkid
- }
- }).then(res => {
- console.log("任务提交", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- let pages = getCurrentPages(),
- page = pages[pages.length - 2].selectComponent("#Task");
- pages[pages.length - 2].getDetail();
- page.getList();
- wx.showToast({
- title: '提交成功',
- icon: "none"
- });
- that.setData({
- "detail.finished": 1
- })
- })
- }
- })
- }
- })
|