|
@@ -23,12 +23,13 @@ Page({
|
|
|
assessID: 0,
|
|
|
planIndex: [],
|
|
|
// 上传图标与附件
|
|
|
- img_fileList: [],
|
|
|
+ // img_fileList: [],
|
|
|
appendObj: {
|
|
|
append: '',
|
|
|
append_name: ''
|
|
|
},
|
|
|
isShowDetil: false,
|
|
|
+ append: [],
|
|
|
},
|
|
|
onLoad() {
|
|
|
that = this;
|
|
@@ -46,11 +47,17 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
showImg(e) {
|
|
|
- let img = e.target.dataset.img
|
|
|
- dd.previewImage({
|
|
|
- current: 0,
|
|
|
- urls: [img],
|
|
|
- });
|
|
|
+ let item = e.target.dataset.item
|
|
|
+ app.$get('api/drive/grant',{file_id:item.fileId}).then(res => {
|
|
|
+ dd.previewFileInDingTalk({
|
|
|
+ corpId: app.globalData.corpId,
|
|
|
+ spaceId:item.spaceId,
|
|
|
+ fileId: item.fileId,
|
|
|
+ fileName: item.fileName,
|
|
|
+ fileSize: item.fileSize,
|
|
|
+ fileType: item.fileType,
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
deleteList() {
|
|
|
dd.confirm({
|
|
@@ -121,22 +128,22 @@ Page({
|
|
|
app.globalData.showToast('请输入标题');
|
|
|
return;
|
|
|
}
|
|
|
- let images = [];
|
|
|
- this.data.img_fileList.forEach(item => {
|
|
|
- let str = item.split("/")
|
|
|
- images.push(
|
|
|
- { name: str[str.length - 1], url: item }
|
|
|
- )
|
|
|
- })
|
|
|
+ // let images = [];
|
|
|
+ // this.data.img_fileList.forEach(item => {
|
|
|
+ // let str = item.split("/")
|
|
|
+ // images.push(
|
|
|
+ // { name: str[str.length - 1], url: item }
|
|
|
+ // )
|
|
|
+ // })
|
|
|
let data = {
|
|
|
package_employee_id: this.data.packId,
|
|
|
index_id: this.data.apDetails.id,
|
|
|
title: this.data.titValue,
|
|
|
remark: this.data.messageVal,
|
|
|
dimension_xb: this.data.planIndex,
|
|
|
- images: JSON.stringify(images),
|
|
|
- append: '', //附件
|
|
|
- appendName: '' //附件名称
|
|
|
+ // images: JSON.stringify(images),
|
|
|
+ append: JSON.stringify(this.data.append), //附件
|
|
|
+ // appendName: '' //附件名称
|
|
|
};
|
|
|
if (this.data.arrlist) {
|
|
|
if (this.data.knowFrom == 'admnin') {
|
|
@@ -176,14 +183,14 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
deleteImg(e) {
|
|
|
- if (this.data.img_fileList.length == 1) {
|
|
|
+ if (this.data.append.length == 1) {
|
|
|
this.setData({
|
|
|
- img_fileList: []
|
|
|
+ append: []
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
this.setData({
|
|
|
- img_fileList: this.data.img_fileList.splice(e.target.dataset.index, 1)
|
|
|
+ append: this.data.append.splice(e.target.dataset.index-1, 1)
|
|
|
})
|
|
|
},
|
|
|
init() {
|
|
@@ -198,20 +205,7 @@ Page({
|
|
|
arrlist: true,
|
|
|
titValue: this.data.keyszb.title,
|
|
|
messageVal: this.data.keyszb.remark,
|
|
|
- appendObj: {
|
|
|
- append: this.data.keyszb.append,
|
|
|
- append_name: this.data.keyszb.append_name,
|
|
|
- }
|
|
|
- })
|
|
|
- let images = this.data.keyszb.images;
|
|
|
- let img_fileList = [];
|
|
|
- if (images.length > 0) {
|
|
|
- images.forEach(item => {
|
|
|
- img_fileList.push(item.url);
|
|
|
- })
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- img_fileList: img_fileList
|
|
|
+ append: this.data.keyszb.append,
|
|
|
})
|
|
|
} else {
|
|
|
this.setData({
|
|
@@ -267,6 +261,29 @@ Page({
|
|
|
},
|
|
|
//图片选择
|
|
|
openImg(e) {
|
|
|
+ let append = this.data.append;
|
|
|
+ app.$get('api/drive/info').then(res => {
|
|
|
+ let spaceId = res.data.data.space_id
|
|
|
+ dd.uploadAttachmentToDingTalk({
|
|
|
+ image: { multiple: true, compress: false, max: 5, spaceId: spaceId },
|
|
|
+ space: { spaceId: spaceId, isCopy: 1, max: 5 },
|
|
|
+ file: { spaceId: spaceId, max: 5 },
|
|
|
+ types: ["photo", "file", "space"],//PC端仅支持["photo","file","space"]
|
|
|
+ success: (res) => {
|
|
|
+ append.push(...res.data);
|
|
|
+ that.setData({
|
|
|
+ append: append
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return false
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var files = that.data.img_fileList;
|
|
|
if (files.length >= 3) {
|
|
|
app.globalData.showToast("只能上传三张");
|