diff --git a/common/request.js b/common/request.js index a741024..186d113 100644 --- a/common/request.js +++ b/common/request.js @@ -2,8 +2,9 @@ import store from "@/store" export function host(host='default',suffix='/plant_manage'){ var url=process.env.NODE_ENV === 'development'?{ - // default:`http://wmyrzw.natappfree.cc` //陈 - default:`http://czixnn.natappfree.cc` //马 + // default:`http://dtkswx.natappfree.cc` //陈 + // default:`http://czixnn.natappfree.cc` //马 + default:`http://usex4q.natappfree.cc` //何 // default:`http://192.168.0.116:8080` //孙 }:{ default:`` diff --git a/common/utils.js b/common/utils.js new file mode 100644 index 0000000..c778ace --- /dev/null +++ b/common/utils.js @@ -0,0 +1,20 @@ +export var computeArea=function(val){ + var longitude={ + min: Math.min(...val.map(v=>v.longitude)), + max: Math.max(...val.map(v=>v.longitude)), + } + var latitude={ + min: Math.min(...val.map(v=>v.latitude)), + max: Math.max(...val.map(v=>v.latitude)), + } + longitude.len=longitude.max-longitude.min + latitude.len=latitude.max-latitude.min + return { + longitude, + latitude, + center: { + longitude: longitude.min+longitude.len/2, + latitude: latitude.min+latitude.len/2, + } + } +} \ No newline at end of file diff --git a/main.js b/main.js index a179037..b89cab9 100644 --- a/main.js +++ b/main.js @@ -2,11 +2,12 @@ import Vue from 'vue' import App from './App' import store from './store' import uView from 'uview-ui'; -import {defineObj} from 'black-knight/lib/config/custom' +import {defineObj,defineArray} from 'black-knight/lib/config/custom' Vue.use(uView) Vue.prototype.$store=store +Vue.prototype.$defineArray=defineArray Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index d03381b..1000b7a 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -5,9 +5,9 @@ "requires": true, "packages": { "node_modules/black-knight": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/black-knight/-/black-knight-1.3.25.tgz", - "integrity": "sha512-cIUMwiGO4Gsn9cD/lXy5RHlxAxR9aLZp2S5RyD76sGLFGNqWsc5rSFutpTJolwC/mvO9EOfMETo/6iVPetUdxQ==" + "version": "1.3.26", + "resolved": "https://registry.npmjs.org/black-knight/-/black-knight-1.3.26.tgz", + "integrity": "sha512-7WWFooFRLdt337DyMfXqLcYCllYJslxT388tAdxtJtTd0gjsTGGEqG7Wi/Kt2gCj8Ip3s/mPblj4rvA0LByhjg==" }, "node_modules/callsites": { "version": "3.1.0", diff --git a/node_modules/uview-ui/components/u-navbar/u-navbar.vue b/node_modules/uview-ui/components/u-navbar/u-navbar.vue index 710a42c..2b206b7 100644 --- a/node_modules/uview-ui/components/u-navbar/u-navbar.vue +++ b/node_modules/uview-ui/components/u-navbar/u-navbar.vue @@ -5,7 +5,8 @@ v-if="fixed && placeholder" :style="{ height: $u.addUnit($u.getPx(height) + $u.sys().statusBarHeight,'px'), - }" > + }" + > + @tap="leftClick" + > + @tap="rightClick" + > 仓库管理 更多>> - - 东方红一号仓库 23㎡ + + {{v.warehouseName}} {{v.warehouseVolume}}㎡ - - 东方红一号仓库 23㎡ - - - 东方红一号仓库 23㎡ - - + @@ -357,6 +351,7 @@ import request from '@/common/request.js' massif:{}, baseInfo:{}, baseIndex:"", + stockList:[], } }, computed:{ @@ -373,6 +368,7 @@ import request from '@/common/request.js' "$store.state.plantBaseInfoId"(n){ this.getMassif(n) this.getBaseInfo(n) + this.getStock(n) } }, onLoad() { @@ -428,6 +424,21 @@ import request from '@/common/request.js' }) } }, + // 获取仓库 + async getStock(baseId){ + var res=await request("/api/plantIndex/queryWarehouse",{ + params:{baseId} + }) + if(res.statu){ + this.stockList=res.data + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"获取仓库信息失败!", + showCancel:false, + }) + } + }, } } diff --git a/pages/massif/info.vue b/pages/massif/info.vue index 4788435..10a56b3 100644 --- a/pages/massif/info.vue +++ b/pages/massif/info.vue @@ -38,7 +38,7 @@ import request from '@/common/request' realityArea:{label:"实际面积",type:'digit'}, image:{label:"地块图片",type:"upImg",num:3,value:''}, date:{label:"使用日期",type:"dateRange",value:[]}, - jw:{label:"经/纬度",type:"map",value:[]}, + longitude:{label:"经/纬度",type:"map",value:[]}, address:{label:"详细地址",type:"textarea"}, }, formData:{ @@ -133,7 +133,7 @@ import request from '@/common/request' this.fields.date.value=[res.data.beginTime, res.data.endTime] this.fields.plantBaseInfoId.value=[res.data.plantBaseInfoId] this.fields.image.value=res.data.image.join(',') - this.fields.jw.value=this.formData.jw.split("|").map(v=>{ + this.fields.longitude.value=this.formData.longitude.split("|").map(v=>{ var point=v.split(",") if(point.length==2){ return {longitude:point[0],latitude:point[1]} @@ -149,12 +149,12 @@ import request from '@/common/request' } }, editorMap(e){ - this.fields.jw.value=e - this.formData.jw=e.map(v=>`${v.longitude},${v.latitude}`).join('|') + this.fields.longitude.value=e + this.formData.longitude=e.map(v=>`${v.longitude},${v.latitude}`).join('|') }, }, onBackPress(e){ - var dForm=this.$refs.dForm.find(v=>v.field=='jw') + var dForm=this.$refs.dForm.find(v=>v.field=='longitude') if(dForm?.showMap){//是否开启地图 dForm.showMap=false return true diff --git a/pages/massif/mana/index.vue b/pages/massif/mana/index.vue index 1001f77..de20bc9 100644 --- a/pages/massif/mana/index.vue +++ b/pages/massif/mana/index.vue @@ -42,6 +42,8 @@ import plantPlan from './plantPlan.vue' import farmRecord from './farmRecord.vue' import recovery from './recovery.vue' +import request from '@/common/request.js' +import {computeArea} from '@/common/utils' export default { components:{plantPlan,farmRecord,recovery}, data(){ @@ -53,35 +55,58 @@ export default { {name:"采收记录",}, ], plotId:"", + + maps:null, } }, onLoad(options){ this.plotId=options.id }, - onReady(){ + async onReady(){ /* #ifdef APP-PLUS */ - var a=uni.createMapContext("amap",this) + var amap=uni.createMapContext("amap",this) + var points=await this.getDetail() - var maps=a.$getAppMap() - maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE) - maps.onclick=(e)=>{ - console.log(e,'-------maps--click---------') + this.maps=amap.$getAppMap() + this.maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE) + if(points.length>0){ + var bound=computeArea(points) + this.maps.centerAndZoom(new plus.maps.Point(bound.center.longitude, bound.center.latitude),10) + + var polygon=new plus.maps.Polygon( points.map(v=>new plus.maps.Point(v.longitude, v.latitude)) ) + polygon.setLineWidth(2) + polygon.setStrokeColor("#10C176") + polygon.setFillColor("#10C176") + polygon.setFillOpacity(0.3) + this.maps.addOverlay(polygon) + }else{ + this.maps.centerAndZoom(new plus.maps.Point(102.712251,25.040609),10) } - var polygon=new plus.maps.Polygon([ - new plus.maps.Point(116.39524,39.925301), - new plus.maps.Point(116.400444,39.925285), - new plus.maps.Point(116.400558,39.923282), - new plus.maps.Point(116.395502,39.923082), - ]) - polygon.setLineWidth(2) - polygon.setStrokeColor("#10C176") - polygon.setFillColor("#10C176") - polygon.setFillOpacity(0.3) - maps.addOverlay(polygon) + /* #endif */ }, methods:{ - + async getDetail(){ + var res=await request('/api/plantPlot/queryById',{ + params:{id:this.plotId} + }) + if(res.statu){ + return res.data.longitude.split("|").map(v=>{ + var point=v.split(",") + if(point.length==2){ + return {longitude:point[0],latitude:point[1]} + } + return null + }).filter(v=>v) + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"获取地块详情失败!", + showCancel:false, + }) + return[] + } + }, } } \ No newline at end of file diff --git a/pages/stock/mana.vue b/pages/stock/mana.vue index 6d013de..ae25c86 100644 --- a/pages/stock/mana.vue +++ b/pages/stock/mana.vue @@ -77,21 +77,34 @@ &>.btns{ margin-left:auto; button{ - background:transparent; - border:2rpx solid transparent; - color:var(--c); - font-weight: bold; - font-size:30rpx; - height:50rpx; - width:50rpx; + padding:0; + height:48rpx; + width: 96rpx; + font-size:24rpx; &:first-child{ - border-radius: 30rpx 0 0 30rpx; - border-color:var(--c); + color:#10C176; + background:rgba(16, 193, 119, 0.1); } &:nth-child(2){ - border-radius: 0 30rpx 30rpx 0; - border-color:var(--c); + margin-left:20rpx; + color:#fff; + background:#10C176; } + // background:transparent; + // border:2rpx solid transparent; + // color:var(--c); + // font-weight: bold; + // font-size:30rpx; + // height:50rpx; + // width:50rpx; + // &:first-child{ + // border-radius: 30rpx 0 0 30rpx; + // border-color:var(--c); + // } + // &:nth-child(2){ + // border-radius: 0 30rpx 30rpx 0; + // border-color:var(--c); + // } } } } @@ -127,8 +140,8 @@ 库存量:200kg - + diff --git a/pages/warehouse/detail.vue b/pages/warehouse/detail.vue index bbd040b..5e7f9e7 100644 --- a/pages/warehouse/detail.vue +++ b/pages/warehouse/detail.vue @@ -27,29 +27,53 @@ 基本信息 - - 仓库名称 东方红一号仓库 + + 仓库名称 {{detail.warehouseName}} - 仓库位置 东方红一号基地进门右边冷库 + 仓库位置 {{detail.warehouseAddress}} - 仓库容量 12 + 仓库容量 {{detail.warehouseVolume}} - 仓库类型 冷库 + 仓库类型 {{detail.warehouseType}} - 仓库管理员 张小红 + 仓库管理员 {{detail.warehouseKeeper}} - 库管员电话 12323443434 + 库管员电话 {{detail.warehouseKeeperTelephone}} diff --git a/pages/warehouse/mana.vue b/pages/warehouse/mana.vue index 4fc4be1..cb9668b 100644 --- a/pages/warehouse/mana.vue +++ b/pages/warehouse/mana.vue @@ -1,20 +1,14 @@ diff --git a/static/map_point_1.gif b/static/map_point_1.gif new file mode 100644 index 0000000..6b78d80 Binary files /dev/null and b/static/map_point_1.gif differ diff --git a/static/map_point_3.png b/static/map_point_3.png new file mode 100644 index 0000000..703b824 Binary files /dev/null and b/static/map_point_3.png differ diff --git a/static/map_point_4.png b/static/map_point_4.png new file mode 100644 index 0000000..76705af Binary files /dev/null and b/static/map_point_4.png differ diff --git a/store/index.js b/store/index.js index c0cc9c4..43769c6 100644 --- a/store/index.js +++ b/store/index.js @@ -23,9 +23,9 @@ export default new Vuex.Store({ outLogin(state){ state.userInfo={} state.token='' - uni.reLaunch({ - url:"/pages/home/login", - }) + // uni.reLaunch({ + // url:"/pages/home/login", + // }) }, setHeadImg(state,val){ state.userInfo.avatar=val @@ -35,6 +35,6 @@ export default new Vuex.Store({ }, }, actions:{ - + } }) \ No newline at end of file diff --git a/uni_modules/d-form/components/d-form/d-form.vue b/uni_modules/d-form/components/d-form/d-form.vue index 968648c..c9e4cb1 100644 --- a/uni_modules/d-form/components/d-form/d-form.vue +++ b/uni_modules/d-form/components/d-form/d-form.vue @@ -191,7 +191,7 @@ - {{value.length>0?value[0].join():"选择经纬度"}} + {{value.length>0?Object.values(value[0]).join():"选择经纬度"}} {{pickerContent}} @@ -258,6 +258,7 @@