[update] 打包项目列表接口,到账开票接口,收入合同关联工作组项目加合同id,图片上传组件修改

This commit is contained in:
zhaoxiao
2021-09-10 19:00:54 +08:00
parent 9c23800c8e
commit 2d35ab113c
6 changed files with 53 additions and 24 deletions
+43 -10
View File
@@ -103,7 +103,8 @@
},
watch:{
value: {
handler(val) {
handler() {
let val = this.value
if (val instanceof Array) {
this.initFileList(val.join(','))
} else {
@@ -122,25 +123,57 @@
this.headers = {'X-Access-Token':token}
},
methods:{
initFileList(paths){
async initFileList(paths){
if(!paths || paths.length === 0){
this.fileList = []
return
}
this.picUrl = true
let arr = paths.split(',')
console.log(this.fileList)
let fileList = []
for(var a=0;a<arr.length;a++){
this.fileList.forEach((item)=>{
if(this.returnId){
item.url = this.getImgUrl(item.response.result.id,item.name)
}
if (item.url === arr[a]){
item.uid = uidGenerator()
item.response.status = 'history'
// 通过文件id获取文件信息
const fileObj = await this.getFileInfo(arr[a])
// 获取图片路径
const url = getFileAccessHttpUrl(fileObj.url)
fileList.push({
uid: uidGenerator(),
name: (fileObj || {}).fileName,
status: 'done',
url: url,
response: {
status: 'history',
message: arr[a],
result: fileObj
}
})
}
this.fileList = [...fileList]
this.fileList.forEach((item)=>{
if(this.returnId){
item.url = this.getImgUrl(item.response.result.id,item.name)
}
if (item.url === arr[a]){
item.uid = uidGenerator()
item.response.status = 'history'
}
})
},
/**
* 通过文件的id获取文件的相关信息
* @param id
*/
getFileInfo(id) {
return new Promise(resolve => {
let result = {}
getFileInfo({id: id}).then(res => {
if (res.success) {
result = res.result
}
}).finally(() => {
resolve(result)
})
})
},
beforeUpload: function(file){
var fileType = file.type