From 087fd85019d97bc11b7613495229f35fb9585e26 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Mon, 16 Jan 2023 16:36:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E5=9C=B0=E5=9D=97=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/request.js | 4 +- components/form.vue | 30 +++++++---- components/search.vue | 45 ---------------- main.js | 2 - pages/home/index.vue | 48 ++++++++++++----- pages/massif/info.vue | 4 +- pages/massif/mana/plantPlan.vue | 34 +++++++++--- pages/massif/mana/recovery.vue | 19 ++++++- pages/massif/plant_plan.vue | 92 ++++++++++++++++++++++++--------- 9 files changed, 173 insertions(+), 105 deletions(-) delete mode 100644 components/search.vue diff --git a/common/request.js b/common/request.js index 4031491..c3e7e5b 100644 --- a/common/request.js +++ b/common/request.js @@ -3,8 +3,8 @@ import store from "@/store" export function host(host='default',suffix='/plant_manage'){ return( process.env.NODE_ENV === 'development'?{ - default:`http://f27zx4.natappfree.cc${suffix}` //陈 - // default:`http://jtsfcq.natappfree.cc${suffix}` //马 + // default:`http://10.0.0.217${suffix}` //陈 + default:`http://nrmmg7.natappfree.cc${suffix}` //马 }:{ default:`http://qv6mj8.natappfree.cc${suffix}` } diff --git a/components/form.vue b/components/form.vue index 647c9ac..1913d0d 100644 --- a/components/form.vue +++ b/components/form.vue @@ -146,7 +146,7 @@ - {{/^\d+$/.test(value)&&columns[0][value].label||placeholder||`请选择${label}`}} + {{pickerContent}} 添加照片 @@ -182,7 +182,7 @@ closeOnClickOverlay @close="show=false" @cancel="show=false" - @confirm="$emit('select',$event.indexs[0]);show=false" + @confirm="$emit('select',$event);show=false" @change="pickerChange"/> ({url:`${host(undefined,"/plant_manage/sys/common/static")}/${v}`,status:"success",index,type:'saved'})).concat(this.imgList.map((v,index)=>Object.assign(v,{index,type:'unsaved'}))) return [] - } + }, + pickerContent(){ + if(/^\d+$/.test(this.value[0])){ + if(/^\d+$/.test(this.value[1])){ + return this.columns[0][this.value[0]].children[this.value[1]].label + }else{ + this.columns[0][this.value[0]].label + } + }else{ + return this.placeholder||`请选择${this.label}` + } + }, }, created(){ - if(this.columns?.length>0){ + if(this.type=='select' && this.columns?.length>0){ this.$nextTick(()=>{ setPickerCol.bind(this.$refs.picker)(this.columns[0]||[],this.value,1) }) @@ -348,8 +360,8 @@ import request,{host} from '@/common/request' this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type]).join(',')) }, pickerChange(e){ - if(e.value[e.columnIndex].item){ - this.$refs.picker.setColumnValues(e.columnIndex+1,e.value[0].item) + if(e.value[e.columnIndex]?.children?.length>0){ + this.$refs.picker.setColumnValues(e.columnIndex+1,e.value[0].children) } }, }, diff --git a/components/search.vue b/components/search.vue deleted file mode 100644 index 6eb74da..0000000 --- a/components/search.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - \ No newline at end of file diff --git a/main.js b/main.js index 33d2112..5d5ab87 100644 --- a/main.js +++ b/main.js @@ -3,13 +3,11 @@ import App from './App' import store from './store' import uView from 'uview-ui'; import cuNavbar from './components/cu-navbar.vue' -import dSearch from './components/search.vue' import dForm from './components/form.vue' import {defineObj} from 'black-knight/lib/config/custom' Vue.use(uView) Vue.component("cuNavbar", cuNavbar) -Vue.component("dSearch", dSearch) Vue.component("dForm", dForm) Vue.prototype.$store=store diff --git a/pages/home/index.vue b/pages/home/index.vue index d42cc82..776178a 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -300,7 +300,7 @@ - 基地管理 切换基地 + 基地管理 切换基地 农事记录 @@ -318,7 +318,7 @@ - + @@ -329,22 +329,28 @@ import request from '@/common/request.js' return { mapContext:null, show:false, - baseList:[['东方红壹号基地','东方红贰号基地','东方红叁号基地']], - massif:{} + plantBase:[[]], + massif:{}, } }, + computed:{ + isAdmin(){ + return this.$store.getters.userInfo.roleCode=='companyAdmin' + }, + }, onLoad() { - this.getMassif() - this.getPurchase() + // this.getMassif() + // this.getPurchase() + this.isAdmin && this.getPlantBase() }, onShow(){ }, methods: { //获取地块信息 - async getMassif(){ + async getMassif(plantBaseId){ var res=await request("/api/plantIndex/queryPlot",{ - params:{companyId: this.$store.getters.userInfo.companyId} + params:{plantBaseId} }) if(res.statu){ this.massif=res.data @@ -356,11 +362,27 @@ import request from '@/common/request.js' }) } }, - //获取采购申请数据 - async getPurchase(){ - var res=await request("/purchaseMain/purchaseMain/listPlantPurchaseSubByMainId") - console.log(res,'------------res----------') - }, + // //获取采购申请数据 + // async getPurchase(){ + // var res=await request("/purchaseMain/purchaseMain/listPlantPurchaseSubByMainId") + // console.log(res,'------------res----------') + // }, + //获取基地列表 + async getPlantBase(){ + var res=await request("/api/plantPlot/getAllPlantBaseInfo",{ + params:{companyId:this.$store.getters.userInfo.companyId} + }) + if(res.statu){ + this.plantBase=[res.data] + this.getMassif(res.data[0].id) + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"获取基地列表失败!", + showCancel:false, + }) + } + } } } diff --git a/pages/massif/info.vue b/pages/massif/info.vue index 9298604..b9248d2 100644 --- a/pages/massif/info.vue +++ b/pages/massif/info.vue @@ -29,7 +29,7 @@ import request from '@/common/request' data(){ return{ fields:{ - plantBaseName:{label:"基地名称",type:"select",columns:[],value:[]}, + plantBaseName:{label:"基地名称",type:"select",columns:[[]],value:[null]}, plotNumber:{label:"地块编号"}, plotName:{label:"地块名称"}, drawArea:{label:"地块面积(亩)",type:'digit'}, @@ -129,7 +129,7 @@ import request from '@/common/request' if(res.statu){ this.formData=res.data this.fields.date.value=[res.data.beginTime, res.data.endTime] - this.fields.plantBaseName.value=this.fields.plantBaseName.columns[0].findIndex(v=>v.value==res.data.plantBaseName) + this.fields.plantBaseName.value=[this.fields.plantBaseName.columns[0].findIndex(v=>v.value==res.data.plantBaseName)] this.fields.image.value=res.data.image.join(',') }else{ uni.showModal({ diff --git a/pages/massif/mana/plantPlan.vue b/pages/massif/mana/plantPlan.vue index f25772f..15faf99 100644 --- a/pages/massif/mana/plantPlan.vue +++ b/pages/massif/mana/plantPlan.vue @@ -10,7 +10,7 @@ position:relative; border-radius: 20rpx; &:before{ - content:"蔬菜"; + content:attr(data-type); position:absolute; top:0; left:0; @@ -89,9 +89,9 @@ \ No newline at end of file diff --git a/pages/massif/mana/recovery.vue b/pages/massif/mana/recovery.vue index 067d540..024111e 100644 --- a/pages/massif/mana/recovery.vue +++ b/pages/massif/mana/recovery.vue @@ -87,12 +87,29 @@ \ No newline at end of file diff --git a/pages/massif/plant_plan.vue b/pages/massif/plant_plan.vue index f8a6036..86aaed6 100644 --- a/pages/massif/plant_plan.vue +++ b/pages/massif/plant_plan.vue @@ -12,7 +12,8 @@ \ No newline at end of file