From 22998ccaea8cec288ecb229b003b140148cdca26 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp <m13724205240@163.com> Date: Sun, 15 Jan 2023 14:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E4=BF=AE=E6=94=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/request.js | 2 +- components/form.vue | 5 +++-- pages/home/login.vue | 2 +- pages/massif/index.vue | 18 +++++++++++++++--- pages/massif/info.vue | 33 ++++++++++++++++++++++++++++++--- 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/common/request.js b/common/request.js index 62b81ef..61b2d92 100644 --- a/common/request.js +++ b/common/request.js @@ -3,7 +3,7 @@ import store from "@/store" export function host(host='default',suffix='/plant_manage'){ return( process.env.NODE_ENV === 'development'?{ - default:`http://m3df6f.natappfree.cc${suffix}` + default:`http://jtsfcq.natappfree.cc${suffix}` }:{ default:`http://qv6mj8.natappfree.cc${suffix}` } diff --git a/components/form.vue b/components/form.vue index b297672..d3113f8 100644 --- a/components/form.vue +++ b/components/form.vue @@ -194,6 +194,7 @@ :insert="false" lunar @confirm="$emit('input',$event.fulldate)"/> + </view> </template> @@ -301,7 +302,7 @@ import request,{host} from '@/common/request' this.imgList=this.imgList.filter(v=>!v==e.file[i]) } } - this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type])) + this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type]).join(',')) }, delImg({file}){ if(file.type=='unsaved'){ @@ -309,7 +310,7 @@ import request,{host} from '@/common/request' }else{ this.$emit("input",this.value.filter(v=>v.index!=file.index).map(v=>v.url)) } - this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type])) + this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type]).join(',')) }, }, } diff --git a/pages/home/login.vue b/pages/home/login.vue index e69be8d..af6d11f 100644 --- a/pages/home/login.vue +++ b/pages/home/login.vue @@ -85,7 +85,7 @@ export default { }) if(res.statu){ this.$store.commit("setUserInfo",res.data) - this.$u.route({type:'switchTab',url:'pages/home/index'}) + uni.switchTab({url:'/pages/home/index'}) }else{ uni.showModal({ title:"提示", diff --git a/pages/massif/index.vue b/pages/massif/index.vue index 31ce817..c5ce94b 100644 --- a/pages/massif/index.vue +++ b/pages/massif/index.vue @@ -77,7 +77,7 @@ <template> <view class="container flex"> <cu-navbar style="--bg:#10C176;--c:#fff;" text="地块管理"> - <text class="plant-xinjian" slot="right" @click="$u.route({url:'pages/massif/info'})"/> + <text class="plant-xinjian" slot="right" @click="toInfo"/> </cu-navbar> <d-search v-model="searchVal.search" @search="clean();search()"/> @@ -93,7 +93,7 @@ <text>{{v.usedArea}}</text> <text>(在用面积)</text> </view> <view class="btns"> - <text class="plant-xiugai">修改</text> + <text class="plant-xiugai" @click.stop="$u.route({url:'/pages/massif/info',params:{id:v.id}})">修改</text> <text class="plant-shanchu" @click.stop="del(k)">删除</text> <text class="plant-xinzeng" @click.stop="$u.route({url:'pages/massif/mana/index'})">地块管理</text> </view> @@ -122,6 +122,17 @@ import request from '@/common/request' this.search() }, methods:{ + toInfo(){ + uni.navigateTo({ + url:"/pages/massif/info", + events:{ + update:()=>{ + this.clean() + this.search() + } + }, + }) + }, clean(){ this.searchVal.pageNo=1 this.total=0 @@ -133,7 +144,7 @@ import request from '@/common/request' params: this.searchVal }) if(res.statu){ - this.list=res.data.records + this.list=this.list.concat(res.data.records) this.total=res.data.total }else{ uni.showModal({ @@ -155,6 +166,7 @@ import request from '@/common/request' this.list.splice(index,1) this.total-- }else{ + this.clean() this.search() } }else{ diff --git a/pages/massif/info.vue b/pages/massif/info.vue index 3c79673..197e02d 100644 --- a/pages/massif/info.vue +++ b/pages/massif/info.vue @@ -70,10 +70,13 @@ import dForm from '@/components/form.vue' else call() }, trigger:"change"} }, + eventChannel:null, } }, - onLoad(){ + onLoad(options){ this.init() + if(options.id)this.getDetail(options.id); + this.eventChannel=this.getOpenerEventChannel() }, methods:{ async init(){ @@ -108,10 +111,34 @@ import dForm from '@/components/form.vue' endTime:this.fields.date.value[1], } }) - console.log(res,'----------res------------') + if(res.statu){ + this.eventChannel.emit("update") + uni.navigateBack() + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"地块基地信息保存失败!", + showCancel:false, + }) + } } }) - } + }, + async getDetail(id){ + var res=await request('/api/plantPlot/queryById',{ + params:{id} + }) + if(res.statu){ + this.formData=res.data + this.fields.date.value=[res.data.beginTime, res.data.endTime] + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"获取详情失败!", + showCancel:false, + }) + } + }, }, } </script> \ No newline at end of file