diff --git a/pages/massif/mana/plantPlan.vue b/pages/massif/mana/plantPlan.vue index 4c9cf15..cc4636c 100644 --- a/pages/massif/mana/plantPlan.vue +++ b/pages/massif/mana/plantPlan.vue @@ -144,7 +144,7 @@ @@ -280,6 +280,34 @@ export default { } }) }, + async copy(id){ + uni.showModal({ + title:"提示", + content:"确定复制当前计划?", + success: async e=>{ + if(e.confirm){ + var res=await request("/api/plantPlan/copyPlan",{ + params:{id} + }) + if(res.statu){ + uni.navigateTo({ + url:`/pages/massif/plant_plan`, + event:{update:()=> {this.clean();this.search()} }, + success(e){ + e.eventChannel.emit("copy", res.data) + } + }) + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"复制失败!", + showCancel:false, + }) + } + } + } + }) + }, } } \ No newline at end of file diff --git a/pages/massif/plant_plan.vue b/pages/massif/plant_plan.vue index 0b2bf64..bbaeaf4 100644 --- a/pages/massif/plant_plan.vue +++ b/pages/massif/plant_plan.vue @@ -86,6 +86,12 @@ export default { }, async onLoad(options){ this.eventChannel=this.getOpenerEventChannel() + this.eventChannel.on("copy",e=>{ + this.formData=e + this.fields.images.value=e.images?.join?.(',')||'' + this.fields.plantType.value=e.plantType + this.formData.plantType=e.plantType[1] + }) await this.init() options.plotId && (this.formData.plotId=options.plotId)