diff --git a/App.vue b/App.vue index 02b7e7e..d904710 100644 --- a/App.vue +++ b/App.vue @@ -40,4 +40,7 @@ uni-toast{ background: linear-gradient( 135deg, #5282CC 0%, #1246B3 100%); color: #ffffff; } + .uni-system-preview-image{ + z-index: 1000000!important; + } diff --git a/manifest.json b/manifest.json index 9d44709..98c10e0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "隐患排查", - "appid" : "__UNI__CAFA804", + "appid" : "__UNI__68B38F3", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", @@ -65,33 +65,33 @@ }, "icons" : { "android" : { - "hdpi" : "unpackage/res/icons/72x72.png", - "xhdpi" : "unpackage/res/icons/96x96.png", - "xxhdpi" : "unpackage/res/icons/144x144.png", - "xxxhdpi" : "unpackage/res/icons/192x192.png" + "hdpi" : "", + "xhdpi" : "", + "xxhdpi" : "", + "xxxhdpi" : "" }, "ios" : { - "appstore" : "unpackage/res/icons/1024x1024.png", + "appstore" : "", "ipad" : { - "app" : "unpackage/res/icons/76x76.png", - "app@2x" : "unpackage/res/icons/152x152.png", - "notification" : "unpackage/res/icons/20x20.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "proapp@2x" : "unpackage/res/icons/167x167.png", - "settings" : "unpackage/res/icons/29x29.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "spotlight" : "unpackage/res/icons/40x40.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png" + "app" : "", + "app@2x" : "", + "notification" : "", + "notification@2x" : "", + "proapp@2x" : "", + "settings" : "", + "settings@2x" : "", + "spotlight" : "", + "spotlight@2x" : "" }, "iphone" : { - "app@2x" : "unpackage/res/icons/120x120.png", - "app@3x" : "unpackage/res/icons/180x180.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "notification@3x" : "unpackage/res/icons/60x60.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "settings@3x" : "unpackage/res/icons/87x87.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png", - "spotlight@3x" : "unpackage/res/icons/120x120.png" + "app@2x" : "", + "app@3x" : "", + "notification@2x" : "", + "notification@3x" : "", + "settings@2x" : "", + "settings@3x" : "", + "spotlight@2x" : "", + "spotlight@3x" : "" } } } diff --git a/pages/investigation/components/investigation-item.vue b/pages/investigation/components/investigation-item.vue index 907ef57..7dfb5ab 100644 --- a/pages/investigation/components/investigation-item.vue +++ b/pages/investigation/components/investigation-item.vue @@ -167,6 +167,7 @@ sid }, 'GET').then(res => { if (res.code == 200) { + console.log(res.result) this.investigationDetailList = res.result.map(item => { switch (item.type) { 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 5f03cb9..4df08f1 100644 --- a/pages/investigation/task.vue +++ b/pages/investigation/task.vue @@ -234,7 +234,7 @@ - @@ -247,7 +247,8 @@ - + @@ -579,6 +580,11 @@ if (this.checked.includes(v.id)) { this.showInvestigation2 = true; this.showInvestigation2Item = v + for (let item of this.hiddenDangerList) { + if (v.id == item.hdTerm) { + this.$set(this.showInvestigation2Item, 'checkedSelect', item) + } + } } }, @@ -655,7 +661,7 @@ // r = v; // } // }); - console.log(v) + // console.log(v) this.showInvestigation2Item = {}; this.showInvestigation2 = false; this.troubleshootingData.map(r => { @@ -706,7 +712,7 @@ this.fileList = []; let arr = [] try { - arr=v.hdPic.split(',') + arr = v.hdPic.split(',') } catch (error) { console.error(error) } @@ -800,16 +806,32 @@ .then((res) => { if (res.code === 200) { // todo 无数据结构 + for (let items of res.result) { + for (let item of items.dangerItems) { + item.nid = items.nid + } + } + // console.log(res.result,11111) this.investigationSelectList = res.result; this.investigationSelectList.map((r) => { - this.troubleshootingData = [...this.troubleshootingData, ...r.dangerItems] }); + // console.log(this.troubleshootingData, 11111) this.checked = this.troubleshootingData.map(r => { if (r.checked == 1) { return r.id } }) + this.checked = this.checked.filter(item => item !== undefined); + for (let i in this.troubleshootingData) { + if (this.troubleshootingData[i].checked == 1) { + // alert(111) + + this.initTroubleshootingData(this.troubleshootingData[i].id, i) + } + + } + // console.log(this.troubleshootingData) // this.$request // .globalRequest( // "/hiddenDanger/highDanger/getImportDangerDisplayDetail", { @@ -857,10 +879,10 @@ ) .then((res) => { if (res.code === 200) { - console.log(res.result); - this.hiddenDangerList = res.result; + this.hiddenDangerList.push(...res.result) } }); + this.$request .globalRequest( "/hiddenDanger/highDanger/getDangerItems", { @@ -886,9 +908,68 @@ JSON.stringify(this.hiddenDangerList3) ); } - console.log(this.hiddenDangerList2) }, + initCheckedSelect() { + this.$request + .globalRequest( + "/hiddenDanger/highDanger/getUserHiddenDangerList", { + nuserid: this.$.getData("token"), + pcType: 1, + businessId: this.businessId + }, + "GET" + ) + .then((res) => { + if (res.code === 200) { + this.hiddenDangerList.push(...res.result) + console.log(this.troubleshootingData, 123) + console.log(res.result, 321) + + for (let i in this.troubleshootingData) { + for (let j in res.result) { + if (this.troubleshootingData[i].id == res.result[j].hdTerm) { + this.$set(this.troubleshootingData[i], "checkedSelect", { + hdInfo: res.result[j].hdInfo, + hdPic: res.result[j].hdPic, + hdDesc: res.result[j].hdDesc, + hdTerm: res.result[j].hdTerm, + pcType: 1 + }) + } + } + } + } + }); + }, + initTroubleshootingData(id, index) { + this.troubleshootingData[index].extraConfigs = [] + this.$request + .globalRequest( + "/hiddenDanger/highDanger/getImportDangerDisplayDetail", + { + dangerId: id, + businessId: this.businessId, + }, + "GET" + ) + .then((res) => { + if (res.code == 200) { + this.troubleshootingData[index].extraConfigs.push(...res.result) + } + if (this.checked.length - 1 == index) { + // alert(1111) + this.initCheckedSelect(index) + + } + + }); + // this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { + // if (res.code == 200) { + // this.investigationList = res.result + // } + // }) + }, select(v) { this.hiddenDangerList3 = v; }, @@ -1018,7 +1099,7 @@ }); }, async afterRead(event, key) { - console.log(key) + // console.log(key) // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 const id = this.uuid(); this[key].push({ @@ -1027,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); @@ -1039,6 +1121,7 @@ message: "", result: resultInfo, url: resultInfo.result, + }) ); console.log(this[key]) @@ -1057,24 +1140,32 @@ return uni.navigateBack(); } let checkedArr = this.troubleshootingData.filter(r => this.checked.includes(r.id)) - console.log(checkedArr) + // console.log(11111111, checkedArr) let extraConfigs = []; 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); }); }); + let describe = JSON.parse(JSON.stringify(this.hiddenDangerList)) + console.log(describe) try { for (let item of describe) { if (item.nid) { @@ -1094,37 +1185,108 @@ } catch (e) { //TODO handle the exception } + setTimeout(() => { + // let describe = [{ hdTerm: 1 }, { hdTerm: 2 }, { hdTerm: 3 }]; + // let checkedArr = [{ id: 1 }, { hdTerm: 5 }, { hdTerm: 3 }]; + + // 用于存储不存在于checkedArr.id中的describe元素的副本 + let notFoundIncheckedArr = []; + + // 用于记录describe和checkedArr中元素的索引 + let indexes = []; + if (describe.length <= 0) { + checkedArr.map(r => { + describe.push({ + hdTerm: r.id, + hdDesc: r.checkedSelect ? r.checkedSelect.hdDesc : '', + hdPic: r.checkedSelect ? r.checkedSelect.hdPic : '', + hdInfo: r.checkedSelect ? r.checkedSelect.hdInfo : '', + pcType: 1 + }) + }) + } else { + checkedArr.forEach((item2, index2) => { + let idToFind = item2.id; + let foundIndex = describe.findIndex(item1 => item1.hdTerm === idToFind); - checkedArr.map(r => { - describe.push({ - hdTerm: r.id, - hdDesc: r.checkedSelect ? r.checkedSelect.hdDesc : '', - hdPic: r.checkedSelect ? r.checkedSelect.hdPic : '', - hdInfo: r.checkedSelect ? r.checkedSelect.hdInfo : '', - pcType: 1 - }) - }) - console.log(this.investigationSelectList); - console.log(this.troubleshootingData); - console.log({ - ...this.formData, - businessId: this.businessId, - extraConfigs: extraConfigs, - describe: describe, - }); - this.extraConfigs = extraConfigs - this.describeArr = describe - this.temporary = temporary - console.log(this.extraConfigs, this.describeArr) - if (!temporary) { - this.postSaveManualInvestigation() - return - } - if (this.extraConfigs.length <= 0 || this.describeArr.length <= 0) { - this.modalShow = true - } else { - this.postSaveManualInvestigation() - } + if (foundIndex === -1) { + if (item2.checkedSelect) { + describe.push({ ...item2.checkedSelect, pcType: 1, hdTerm: item2.id, }); + } + // 如果在describe中找不到对应的hdTerm,将item2添加到describe中 + + // console.log(`添加: ${idToFind} 到 describe`); + } else { + let obj = { + hdTerm: item2.id, + hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '', + hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '', + hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '', + pcType: 1 + } + // console.log(obj, 111111) + describe[foundIndex] = obj; + // 如果找到匹配的hdTerm,替换describe中的对应项 + // describe[foundIndex] = { hdTerm: idToFind }; + // console.log(`替换: describe[${foundIndex}] = ${idToFind}`); + } + + // console.log(`describe:`, describe); + }); + // describe.forEach((item1, index1) => { + // let found = false; + // checkedArr.forEach((item2, index2) => { + // if (item1.hdTerm === item2.id) { + // found = true; + // let obj = { + // hdTerm: item2.id, + // hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '', + // hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '', + // hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '', + // pcType: 1 + // } + // describe.splice(index1, 1, obj); + // // indexes.push({ describeIndex: index1, checkedArrIndex: index2 }); + // } + // if (!found) { + // // 注意:这里不直接push到arr1,而是到notFoundIncheckedArr + // describe.push({ ...item2 }); // 创建副本以避免直接修改arr1 + // } + // }); + + // }); + } + + console.log("Not found in checkedArr:", notFoundIncheckedArr); + console.log("Indexes of matching elements:", indexes); + + // 如果确实需要将这些元素添加到arr1(虽然通常不推荐),可以这样做: + // arr1.push(...notFoundInArr2); // 但这里我们没有做,因为可能改变原始意图 + + // console.log(describe) + // return false + // console.log(this.investigationSelectList); + // console.log(this.troubleshootingData); + // console.log({ + // ...this.formData, + // businessId: this.businessId, + // extraConfigs: extraConfigs, + // describe: describe, + // }); + this.extraConfigs = extraConfigs + this.describeArr = describe + this.temporary = temporary + console.log(this.extraConfigs, this.describeArr) + if (!temporary) { + this.postSaveManualInvestigation() + return + } + if (this.extraConfigs.length <= 0 || this.describeArr.length <= 0) { + this.modalShow = true + } else { + this.postSaveManualInvestigation() + } + }, 1); }, postSaveManualInvestigation() { @@ -1158,11 +1320,11 @@ } else { this.$.toast("暂存成功"); } - // setTimeout(() => { - // uni.navigateBack({ - // delta: 2, // 默认值是1,表示返回的页面层数 - // }); - // }, 1000); + setTimeout(() => { + uni.navigateBack({ + delta: 2, // 默认值是1,表示返回的页面层数 + }); + }, 1000); // this.data = res.result; // this.rname = this.data[0].name; diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 14d369d..2e2a79e 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -264,7 +264,7 @@ .u-cell-group { margin: 0 32rpx; padding: 15rpx 20rpx; - background-color: rgba(255, 255, 255, 0.6); + background-color: rgba(255, 255, 255, 0.75); border-radius: 13rpx; @@ -314,7 +314,7 @@ .logout { width: 690rpx; - background-color: rgba(255, 255, 255, 0.6); + background-color: rgba(255, 255, 255, 0.75); text-align: center; margin-top: 20rpx; margin-left: 30rpx;