Browse Source

联调 巡园接口

master
邓宏 11 months ago
parent
commit
a02d8d675f
  1. 9
      pages/patrolGarden/abnoReport.vue
  2. 107
      pages/patrolGarden/detail.vue
  3. 10
      pages/patrolGarden/info.vue
  4. 22
      pages/patrolGarden/record.vue
  5. BIN
      static/patrolGarden/handle.png
  6. BIN
      static/patrolGarden/unhandle.png

9
pages/patrolGarden/abnoReport.vue

@ -9,11 +9,12 @@
<view class="container">
<u-form class="card inline" errorType="toast" :model="formData" ref="form" :rules="rules" labelWidth="auto">
<d-form label="当前位置" type="map" @position="formData.lat=$event.latitude;formData.lng=$event.longitude"/>
<d-form label="位置详情" required field="position" v-model="formData.position"/>
<d-form label="凭证" required field="pic" :value="imgs" type="upImg" @imgs="formData.pic=$event"/>
<d-form label="描述" type="textarea" v-model="formData.remark"/>
<d-form label="是否处理" type="radio" :columns="[{label:'是',value:1},{label:'否',value:0}]" v-model="formData.flagDeal"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="sumbit">保存</button>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存</button>
</view>
</template>
<script>
@ -23,13 +24,15 @@ export default {
formData:{
lng:"",
lat:"",
position:"",
remark:"",
pic:'',
flagDeal:0,
},
imgs:[],
rules:{
pic:{required:true,message:"请上传凭证!",trigger:'blur'}
pic:{required:true,message:"请上传凭证!",trigger:'blur'},
position:{required:true,message:"请输入位置详情!",trigger:"blur"},
},
eventChannel:null,
}
@ -38,7 +41,7 @@ export default {
this.eventChannel=this.getOpenerEventChannel()
},
methods:{
sumbit(){
submit(){
this.$refs.form.validate().then(async valid=>{
if(valid){
this.eventChannel.emit('update',this.formData)

107
pages/patrolGarden/detail.vue

@ -62,7 +62,7 @@
}
map{
width:100%;
height:372rpx;
height:400rpx;
border-radius: 10rpx;
}
.cu-btn{
@ -84,83 +84,92 @@
</style>
<template>
<view class="container">
<view class="card handle">
<view class="card">
<view class="item">
<text class="label">位置</text>
<text class="val">壹号基地东南角</text>
<text class="label">基地名称</text>
<text class="val">{{detail.baseName}}</text>
</view>
<view class="item block">
<text class="label">凭证</text>
<view class="imgs">
<image v-for="i in 3" :key="i" src="https://alipic.lanhuapp.com/XDSlicePNGMAX19c3c750caf3b1448e14c56df8485f5ca6f3d6bbef600208f2d1156d5eaec38a.png"/>
<image v-for="(v,k) in detail.pic" :key="k" :src="`${host}/${v}`"/>
</view>
</view>
<u-read-more :showHeight="0" toggle closeText="展开" color="#777">
<view class="item block">
<text class="label">描述</text>
<text class="dec">这里是描述......</text>
</view>
<view class="item block">
<text class="label">经纬度</text>
<map id="amap" :longitude="102.722475" :latitude="25.077679"/>
</view>
<view class="item block">
<text class="label">是否处理</text>
<u-radio-group v-model="demo" activeColor="#10C176">
<u-radio label="是" name="1" :customStyle="{marginRight: '8px'}"/>
<u-radio label="否" name="0"/>
</u-radio-group>
<button class="cu-btn round bg-green shadow submit" @click="sumbit">保存修改</button>
</view>
</u-read-more>
<view class="item block">
<text class="label">描述</text>
<text class="dec">{{detail.remark||'无'}}</text>
</view>
<view class="item block">
<text class="label">经纬度</text>
<map id="amap" :longitude="102.712251" :latitude="25.040609"/>
</view>
</view>
<view class="card unhandle">
<view class="card" v-if="record" :class="({0:'unhandle',1:'handle'})[record.flagDeal]">
<view class="item">
<text class="label">位置</text>
<text class="val">壹号基地东南角</text>
<text class="val">{{record.position}}</text>
</view>
<view class="item block">
<text class="label">凭证</text>
<view class="imgs">
<image v-for="i in 3" :key="i" src="https://alipic.lanhuapp.com/XDSlicePNGMAX19c3c750caf3b1448e14c56df8485f5ca6f3d6bbef600208f2d1156d5eaec38a.png"/>
<image v-for="(v,k) in ((record.pic||'').split(',').filter(v=>v)||[])" :key="k" :src="`${host}/${v}`"/>
</view>
</view>
<u-read-more :showHeight="0" toggle closeText="展开">
<view class="item block">
<text class="label">描述</text>
<text class="dec">这里是描述......</text>
</view>
<view class="item block">
<text class="label">经纬度</text>
<map id="amap" :longitude="102.722475" :latitude="25.077679"/>
</view>
<view class="item block">
<text class="label">是否处理</text>
<u-radio-group v-model="demo" activeColor="#10C176">
<u-radio label="是" name="1" :customStyle="{marginRight: '8px'}"/>
<u-radio label="否" name="0"/>
</u-radio-group>
</view>
</u-read-more>
<view class="item block">
<text class="label">描述</text>
<text class="dec">{{record.remark}}</text>
</view>
<view class="item block">
<text class="label">是否处理</text>
<u-radio-group :value="record.flagDeal" activeColor="#10C176">
<u-radio label="是" name="1" :customStyle="{marginRight: '8px'}"/>
<u-radio label="否" name="0"/>
</u-radio-group>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存修改</button>
</view>
</view>
</view>
</template>
<script>
import {host} from '@/common/request'
export default {
data(){
return{
map:null,
demo:""
demo:"",
host:host('imgUrl'),
detail:{},
record:null,
eventChannel:null,
}
},
async onReady(){
this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail",e=>{
this.detail=e
/* #ifdef APP-PLUS */
if(this.detail.detailVos){
for(var i in this.detail.detailVos){
var marker=new plus.maps.Marker(new plus.maps.Point(this.detail.detailVos[i].lng, this.detail.detailVos[i].lat))
marker.setIcon(`/static/patrolGarden/${({0:'unhandle',1:'handle'})[this.detail.detailVos[i].flagDeal]}.png?i=${i}`)
marker.setLabel(`${this.detail.detailVos[i].lng},${this.detail.detailVos[i].lat}`)
marker.onclick=e=>{
this.record=this.detail.detailVos[e.icon.match(/i=(\d+)/)[1]]
}
this.maps.addOverlay(marker)
}
this.maps.setCenter(new plus.maps.Point(this.detail.detailVos[0].lng, this.detail.detailVos[0].lat))
}
/* #endif */
})
/* #ifdef APP-PLUS */
var amap=uni.createMapContext("amap",this)
this.map=amap.$getAppMap()
var marker=new plus.maps.Marker(new plus.maps.Point(102.722475, 25.077679))
marker.setLabel('asdasf')
this.maps.addOverlay(marker)
this.maps=uni.createMapContext("amap",this).$getAppMap()
/* #endif */
},
methods:{
submit(){},
}
}
</script>

10
pages/patrolGarden/info.vue

@ -67,20 +67,16 @@
<d-form label="是否异常" required type="radio" :columns="[{label:'是',value:1},{label:'否',value:0}]" v-model="formData.flagAbnormal"/>
<view class="handle" :class="{un:v.flagDeal==0}" v-for="(v,k) in formData.detailList" :key="k">
<image :src="`${host}/${(v.pic||'').split(',').filter(v=>v)[0]}`"/>
<view class="content" v-if="v.flagDeal==1">
<view class="content">
<view class="doubleLine" style="--n:3;">{{v.remark}}</view>
</view>
<view class="content" v-else>
<view class="doubleLine">{{v.remark}}</view>
<button class="cu-btn shadow">立即处理</button>
</view>
</view>
<button class="cu-btn round bg-green shadow add" v-if="formData.flagAbnormal==1" @click="toAbnormal">+{{formData.detailList.length>0?'继续':''}}添加异常</button>
<d-form label="凭证" :required="formData.flagAbnormal==0" field="pic" type="upImg" :value="imgs" @imgs="formData.pic=$event" :num="3"/>
<d-form label="备注" type="textarea" v-model="formData.remark"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="sumbit">保存</button>
<button class="cu-btn round bg-green shadow submit" @click="submit">保存</button>
</view>
</template>
<script>
@ -126,7 +122,7 @@ export default {
events:{update:e=>this.formData.detailList.push(e)}
})
},
sumbit(){
submit(){
this.$refs.form.validate().then(async valid=>{
if(valid){
var res=await request("/api/basetour/addBaseTourInfo",{

22
pages/patrolGarden/record.vue

@ -92,12 +92,13 @@
</d-navbar>
<d-search v-model="searchVal.search" @search="search('pageOne')"/>
<scroll-view scroll-y>
<view class="card" v-for="(v,k) in list" :key="k" @click="$u.route({url:'/pages/patrolGarden/detail'})">
<view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(v)">
<view class="title">
<text class="icon"/>
<text class="name over">{{v.baseName}}</text>
<text v-if="v.flagAbnormal==0" class="statu no">无异常</text>
<text v-else class="statu unusual">异常</text>
<text class="plant-youbian"/>
</view>
<view class="imgs">
<image v-for="(v1,k1) in v.pic.slice(0,4)" :style="{'--c':v.pic.length-4>0?`'+${v.pic.length-4}'`:''}" :key="k1" mode="aspectFill" :src="`${host}/${v1}`"/>
@ -108,17 +109,6 @@
<text>{{v.userName}}</text>
</view>
</view>
<!-- <view class="card" @click="$u.route({url:'/pages/patrolGarden/app'})">
<view class="title">
<text class="icon"/>
<text class="name over">一号基地</text>
<text class="statu unusual">异常</text>
<text class="plant-youbian"/>
</view>
<view class="imgs">
<image v-for="i in 4" :key="i" mode="aspectFit" src="https://alipic.lanhuapp.com/XDSlicePNGMAX3347bbbb56235edbfb4639fd8039bce3d3d9b375b7ead4bc95a9a6f3d4156935.png"/>
</view>
</view> -->
</scroll-view>
</view>
</template>
@ -174,6 +164,14 @@ export default {
events:{update:()=>this.search('pageOne')},
})
},
toDetail(e){
uni.navigateTo({
url:"/pages/patrolGarden/detail",
success:res=>{
res.eventChannel.emit('detail',e)
}
})
}
}
}
</script>

BIN
static/patrolGarden/handle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
static/patrolGarden/unhandle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Loading…
Cancel
Save