diff --git a/pages/investigation/components/investigation-item2.vue b/pages/investigation/components/investigation-item2.vue index 1d749a7..330aff8 100644 --- a/pages/investigation/components/investigation-item2.vue +++ b/pages/investigation/components/investigation-item2.vue @@ -10,28 +10,29 @@ style="width: 96%; padding: 0"> - + - + - + + @delete="(e) => deletePic(e, item)" name="1" :maxCount="10"> @@ -43,8 +44,9 @@ - + @@ -113,35 +115,41 @@ } switch ( item.type - // case "1": - // item.standar = 0 - // break; - // case "2": - // item.standar = '' - // break; - // case "3": - // item.standar = false - // break; - // case "4": - // item.fileList = [ - // // { - // // "id": "20229a8c-db46-4447-be3e-6731665f7bd0", - // // "type": "image", - // // "url": "https://img-blog.csdnimg.cn/20210823085628540.jpeg", - // // "thumb": "blob:http://localhost:8080/4343e24a-edc5-4693-8fbd-f99647ea3bd5", - // // "size": 11600, - // // "name": "静态人流量统计.png", - // // "status": "success", - // // "message": "", - // // "result": { - // // "code": 200, - // // "message": "操作成功", - // // "result": "https://img-blog.csdnimg.cn/20210823085628540.jpeg" - // // } - // // } - // ] - // break; + ) { + // case "1": + // item.standar = 0 + // break; + // case "2": + // item.standar = '' + // break; + // case "3": + // item.standar = false + // break; + case "4": + item.fileList = [] + let arr=item.standar.split(',') + for(let itm of arr){ + item.fileList.push({url:itm,name:''}) + } + // item.fileList = [ + // // { + // // "id": "20229a8c-db46-4447-be3e-6731665f7bd0", + // // "type": "image", + // // "url": "https://img-blog.csdnimg.cn/20210823085628540.jpeg", + // // "thumb": "blob:http://localhost:8080/4343e24a-edc5-4693-8fbd-f99647ea3bd5", + // // "size": 11600, + // // "name": "静态人流量统计.png", + // // "status": "success", + // // "message": "", + // // "result": { + // // "code": 200, + // // "message": "操作成功", + // // "result": "https://img-blog.csdnimg.cn/20210823085628540.jpeg" + // // } + // // } + // ] + break; } return item; }); @@ -149,6 +157,22 @@ this.getData(); } if (this.json.checkedSelect) { + console.log(this.json.checkedSelect.hdPic, 11111) + if (this.json.checkedSelect.hdPic) { + this.fileList = []; + let arr = [] + try { + arr = this.json.checkedSelect.hdPic.split(',') + } catch (error) { + console.error(error) + } + console.log(arr, 4343242342423) + for (let item of arr) { + this.fileList.push({ url: item, name: '' }) + } + } else { + this.fileList = []; + } this.formData = { hdPic: this.json.checkedSelect.hdPic || "", hdDesc: this.json.checkedSelect.hdDesc || "", @@ -188,18 +212,20 @@ status: "uploading", message: "上传中", }); - const result = await this.uploadFilePromise(item.fileList[0].url); + const result = await this.uploadFilePromise(event.file.url); const resultInfo = JSON.parse(result); const index = item.fileList.findIndex((v) => v.id === id); if (resultInfo.code == 200) { item.fileList.splice( index, 1, - Object.assign(item.fileList[index], { + Object.assign(event.file, { status: "success", message: "", result: resultInfo, + // url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg', url: resultInfo.result, + }) ); } else { @@ -207,10 +233,7 @@ item.fileList.splice( index, 1, - Object.assign(item.fileList[index], { - status: "error", - message: "失败", - }) + ); } }, @@ -245,18 +268,20 @@ status: "uploading", message: "上传中", }); - const result = await this.uploadFilePromise(this[key][0].url); + console.log(event.file) + const result = await this.uploadFilePromise(event.file.url); const resultInfo = JSON.parse(result); const index = this[key].findIndex((v) => v.id === id); if (resultInfo.code == 200) { this[key].splice( index, 1, - Object.assign(this[key][index], { + Object.assign(event.file, { status: "success", message: "", result: resultInfo, url: resultInfo.result, + // url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg', }) ); } else { @@ -264,16 +289,18 @@ this[key].splice( index, 1, - Object.assign(this[key][index], { - status: "error", - message: "失败", - }) + ); } - this.formData.hdPic = this[key] - .filter((item) => item.status === "success") - .map((item) => item.url) - .toString(); + let arr = [] + for (let i = 0; i < this[key].length; i++) { + arr.push(this[key][i].url) + } + this.formData.hdPic = arr.toString(); + // this.formData.hdPic = this[key] + // .filter((item) => item.status === "success") + // .map((item) => item.url) + // .toString(); this.changeEmit(); }, changeEmit() { @@ -362,10 +389,24 @@ // this.$emit('select', this.investigationSelect, this.investigationList[index]) }, investigationDetailHandle() { + + let investigationDetailList = JSON.parse(JSON.stringify(this.investigationDetailList)) + for (let items of investigationDetailList) { + if (items.type == '4') { + let arr = [] + let standar = '' + for (let item of items.fileList) { + arr.push(item.url) + } + items.standar = arr.toString() + } + } + // console.log(investigationDetailList) + this.$emit("select", { ...this.json, checkedSelect: this.formData, - extraConfigs: this.investigationDetailList, + extraConfigs: investigationDetailList, }); }, }, diff --git a/pages/investigation/task.vue b/pages/investigation/task.vue index f388f3b..4df08f1 100644 --- a/pages/investigation/task.vue +++ b/pages/investigation/task.vue @@ -234,7 +234,7 @@ - @@ -661,7 +661,7 @@ // r = v; // } // }); - console.log(v) + // console.log(v) this.showInvestigation2Item = {}; this.showInvestigation2 = false; this.troubleshootingData.map(r => { @@ -1099,7 +1099,7 @@ }); }, async afterRead(event, key) { - console.log(key) + // console.log(key) // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 const id = this.uuid(); this[key].push({ @@ -1108,6 +1108,7 @@ status: "uploading", message: "上传中", }); + console.log(event.file) const result = await this.uploadFilePromise(event.file.url); const resultInfo = JSON.parse(result); const index = this[key].findIndex((v) => v.id === id); @@ -1120,6 +1121,7 @@ message: "", result: resultInfo, url: resultInfo.result, + }) ); console.log(this[key]) @@ -1144,12 +1146,18 @@ checkedArr.map((r) => { if (!r.extraConfigs) return r.extraConfigs.map((s) => { + // let arr = [] + // let standar='' + // for (let i = 0; i < s.fileList.length; i++) { + // arr.push(s.fileList[i].url) + // } s.scenesId = r.nid; s.dangerId = r.id; - if (s.type == 4) { - s.standar = - s.fileList && s.fileList.length > 0 ? s.fileList[0].url : ""; - } + // if (s.type == 4) { + // s.standar=arr.toString(); + // // s.standar = + // // s.fileList && s.fileList.length > 0 ? s.fileList[0].url : ""; + // } delete s.fileList; delete s.nid; extraConfigs.push(s); @@ -1216,7 +1224,7 @@ hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '', pcType: 1 } - console.log(obj, 111111) + // console.log(obj, 111111) describe[foundIndex] = obj; // 如果找到匹配的hdTerm,替换describe中的对应项 // describe[foundIndex] = { hdTerm: idToFind };