From 6950f3892609035e814b35fc3ba9e5772e95cb81 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 13 Oct 2022 17:45:01 +0800 Subject: [PATCH] clearImgShow --- pages/workSpace/opls/clear.vue | 45 ++++++++++++++++++++--- uview-ui/components/u-upload/u-upload.vue | 7 +++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/pages/workSpace/opls/clear.vue b/pages/workSpace/opls/clear.vue index 2e82817..84ad863 100644 --- a/pages/workSpace/opls/clear.vue +++ b/pages/workSpace/opls/clear.vue @@ -132,7 +132,10 @@ - 照片 + + + 照片 + @@ -160,10 +163,11 @@ return { formData: { id: "", + operation: "", + level:"", + cate: "", start_time: null, end_time: null, - operation: "", - cate: "", dept_do: '', charger: '', monitor: '', @@ -171,6 +175,7 @@ other_risk: '', risks_checked: [], measures_checked: [], + create_imgs:[], }, header: {}, oplId: null, @@ -233,6 +238,13 @@ this.formData.monitor = ids[0]; this.monitor_name = names; }, + imgUpSuccess(data,index,lists){ + debugger; + console.log(data) + console.log(index) + console.log(lists); + this.fileList=lists; + }, getHeader() { this.header = { Authorization: "Bearer " + this.vuex_token @@ -256,6 +268,16 @@ that.dept_do_name = res.dept_do_.name; that.charger_name = res.charger_.name; that.monitor_name = res.monitor_.name; + res.create_imgs_.forEach(item=>{ + that.fileList.push({ + url: that.vuex_host+item.path, + progress: 0, + id:item.id, + error: false, + file: item + }) + }) + this.getOplcates() }); @@ -382,13 +404,26 @@ }, edit(row) {}, saveSubmit() { - debugger; + // debugger; uni.showLoading({ title: '提交中' }); let that = this; let params = null; - console.log(this.formData); + that.formData.create_imgs = []; + that.fileList.forEach(item=>{ + debugger; + if(item.id){ + console.log(item.id); + that.formData.create_imgs.push(item.id) + }else{ + console.log(item.response.id) + that.formData.create_imgs.push(item.response.id) + } + // let imgId = item.response.id?item.response.id:item.id; + // that.formData.create_imgs.push(imgId) + }) + if (that.oplId !== null) { that.$u.api.oplUpdate(that.oplId, that.formData).then(res => { uni.hideLoading(); diff --git a/uview-ui/components/u-upload/u-upload.vue b/uview-ui/components/u-upload/u-upload.vue index f4d4b76..9f32ed5 100644 --- a/uview-ui/components/u-upload/u-upload.vue +++ b/uview-ui/components/u-upload/u-upload.vue @@ -265,6 +265,11 @@ export default { uploading: false }; }, + onShow() { + debugger; + console.log(this.fileList); + this.lists = this.fileList; + }, watch: { fileList: { immediate: true, @@ -277,7 +282,7 @@ export default { return val.url == value.url; }) // 如果内部没有这个图片(tmp为false),则添加到内部 - !tmp && this.lists.push({ url: value.url, error: false, progress: 100 }); + !tmp && this.lists.push({ url: value.url, error: false, progress: 100,id:value.id}); }); } },