diff --git a/src/views/modules/kpi/kpisubpositiondetail.vue b/src/views/modules/kpi/kpisubpositiondetail.vue index 905d9f35..1f19cc8e 100644 --- a/src/views/modules/kpi/kpisubpositiondetail.vue +++ b/src/views/modules/kpi/kpisubpositiondetail.vue @@ -29,7 +29,7 @@ :limit=6 :on-preview="handlePictureCardPreview" :on-remove="handleRemove" - :on-success="handleAvatarSuccess" + :on-success="(res, file,fileList) => handleAvatarSuccess( res, file,fileList, index,index1,2)" :on-error="handelError" :before-upload="beforeAvatarUpload" style="width:480px"> @@ -49,7 +49,7 @@ :file-list="item1.files" :before-upload="beforeAvatarFileUpload" :on-remove="handleFileRemove" - :on-success="handleAvatarFileSuccess" + :on-success="(res, file,fileList) =>handleAvatarFileSuccess( res, file,fileList, index,index1,2)" :on-error="handelError" :on-preview="handleFileCardPreview" style="width:480px"> @@ -79,7 +79,7 @@ :limit=6 :on-preview="handlePictureCardPreview" :on-remove="handleRemove" - :on-success="handleAvatarSuccess" + :on-success="(res, file,fileList) => handleAvatarSuccess( res, file,fileList, index,0,1)" :on-error="handelError" :before-upload="beforeAvatarUpload" style="width:480px"> @@ -99,7 +99,7 @@ :file-list="item.files" :before-upload="beforeAvatarFileUpload" :on-remove="handleFileRemove" - :on-success="handleAvatarFileSuccess" + :on-success="(res, file,fileList) =>handleAvatarFileSuccess( res, file,fileList, index,0,1)" :on-error="handelError" :on-preview="handleFileCardPreview" style="width:480px"> @@ -186,8 +186,6 @@ export default { fileloading: false, checkDiction:[], status:'0', - //出身弹框列表 - trialVisible:false, } }, @@ -201,8 +199,8 @@ export default { created: function () { // this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/uploadImg?token=${Cookies.get('token')}` // this.uploadFileUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/uploadAllFile?token=${Cookies.get('token')}` - this.uploadUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadImg?token=${Cookies.get('token')}` - this.uploadFileUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadAllFile?token=${Cookies.get('token')}` + this.uploadUrl = `http://localhost:9094/epdc-api/oss/file/uploadImg?token=${Cookies.get('token')}` + this.uploadFileUrl = `http://localhost:9094/epdc-api/oss/file/uploadAllFile?token=${Cookies.get('token')}` this.getOptions(); this.init(); @@ -218,6 +216,8 @@ export default { methods: { init () { this.dataForm.id = this.$route.query.id + // 'e0ae6e8286ad0160b62023e030faa1d5' + // this.$route.query.id this.status = this.$route.query.status === undefined? '0':this.$route.query.status; if (this.status === '1'){ this.isAble = true; @@ -277,7 +277,7 @@ export default { return false } }, - handleAvatarSuccess (res, file) { + handleAvatarSuccess (res, file,fileList,index,index1,type) { this.loading = false this.isAble = false if (res === null || res.data === null || res.data.imgUrl === null) { @@ -285,7 +285,14 @@ export default { this.handleErrorRemove(file) return false } - this.dataForm.images.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 1, fileName: res.data.fileName }) + if (type ===2){ + this.checkDiction[index].childDiction[index1].images.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 1, fileName: res.data.fileName }) + }else { + this.checkDiction[index].images.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 1, fileName: res.data.fileName }) + } + + + this.hideUpload = this.dataForm.images.length >= 6 }, handelError () { @@ -328,14 +335,18 @@ export default { } this.isAutoRemoveFile = true }, - handleAvatarFileSuccess (res, file) { + handleAvatarFileSuccess (res, file,fileList,index,index1,type) { this.fileloading = false this.isAble = false if (res === null || res.data === null || res.data.imgUrl === null) { this.$message.error('文件上传失败!') return false } - this.dataForm.files.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 2, fileName: res.data.fileName, name: res.data.fileName }) + if (type ===2){ + this.checkDiction[index].childDiction[index1].files.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 2, fileName: res.data.fileName }) + }else { + this.checkDiction[index].files.push({ url: res.data.imgUrl, thumbnail: res.data.thumbnail, fileType: 2, fileName: res.data.fileName }) + } }, handleFileRemove (file, fileList) { for (var i = 0; i < this.dataForm.files.length; i++) { @@ -413,37 +424,32 @@ export default { //描述 console.log(j) let childDesribe = j.describe; - //图片 - let childUrl = j.images.url === undefined? [] :j.images.url; - //缩略图 - let thumbnail = j.images.thumbnail === undefined ? [] :j.images.thumbnail; //文件 - let childFile =j.files.name === undefined ? [] : j.files; + let childFile =j.files === [] ? [] : j.files; + //图片 + let childFileImage =j.images === [] ? [] : j.images; let littleId = j.id; let m = { id:j.infoId, pCheckItemName :bigId, checkItemName: littleId, desribe: childDesribe, - imageUrl: childUrl, - thumbnail:thumbnail, - files: childFile + files: childFile, + images:childFileImage } subChild.push(m) } }else { let childDesribe = i.describe; - let childUrl = i.images.url === undefined ?[]:i.images.url; - let thumbnail = i.images.thumbnail === undefined ? [] :j.images.thumbnail; - let childFile = i.files === undefined ?[]:i.files; + let childFile = i.files === [] ?[]:i.files; + let childFileImage =i.images === [] ? [] : i.images; let ai = { id:i.infoId, desribe:childDesribe, pCheckItemName :bigId, checkItemName: '', - imageUrl :childUrl, - thumbnail:thumbnail, - files:childFile + files:childFile, + images:childFileImage } subChild.push(ai) }