首页修改
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<uni-forms>
|
||||
<uni-forms-item label="设备识别码">
|
||||
<view style="display: flex">
|
||||
<uni-easyinput type="text" v-model="formData.nDid" placeholder="请输入设备识别码" />
|
||||
<uni-easyinput type="text" v-model="formData.nDid" placeholder="请输入设备识别码"/>
|
||||
<uni-icons
|
||||
type="camera"
|
||||
color="#007aff"
|
||||
@@ -18,7 +18,7 @@
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap-item" @click="register"> 发起注册 </view>
|
||||
<view class="btn-wrap-item" @click="register"> 发起注册</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -41,17 +41,17 @@
|
||||
<view style="display: flex">
|
||||
<view style="flex: 1">
|
||||
<view v-if="formData.topologyDiagramUrl">
|
||||
<image :src="formData.topologyDiagramUrl" style="width: 100%" mode="widthFix" />
|
||||
<image :src="formData.topologyDiagramUrl" style="width: 100%" mode="widthFix"/>
|
||||
</view>
|
||||
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图 </view>
|
||||
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图</view>
|
||||
</view>
|
||||
<!-- <uni-icons
|
||||
<uni-icons
|
||||
type="image"
|
||||
color="#007aff"
|
||||
size="26"
|
||||
class="ml20"
|
||||
@click="chooseGplot"
|
||||
></uni-icons> -->
|
||||
></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="监测点" v-if="pointList.length && formData.topologyDiagramUrl">
|
||||
@@ -68,10 +68,10 @@
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<image class="gplot-image" ref="gplot-image" :src="formData.topologyDiagramUrl" mode="widthFix" />
|
||||
<image class="gplot-image" ref="gplot-image" :src="formData.topologyDiagramUrl" mode="widthFix"/>
|
||||
<view class="btn-wrap">
|
||||
<!-- <view class="btn-wrap-item" @click="add"> 添加监测点 </view> -->
|
||||
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
||||
<view class="btn-wrap-item" @click="submit"> 提交</view>
|
||||
</view>
|
||||
<uni-drawer ref="gplot" mode="right" :mask-click="false">
|
||||
<scroll-view style="height: 100%" scroll-y="true">
|
||||
@@ -86,8 +86,8 @@
|
||||
:key="key"
|
||||
/>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
|
||||
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view>
|
||||
<view class="btn-wrap-item" @click="closeDrawer"> 取消</view>
|
||||
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -96,7 +96,7 @@
|
||||
<scroll-view style="height: 100%" scroll-y="true">
|
||||
<view style="background: #fff">
|
||||
<view class="map-pin-box">
|
||||
<image class="gplot" mode="widthFix" :src="formData.topologyDiagramUrl" />
|
||||
<image class="gplot" mode="widthFix" :src="formData.topologyDiagramUrl"/>
|
||||
|
||||
<movable-area class="map-pin-box-area">
|
||||
<movable-view :x="point.lat" :y="point.lng" direction="all" @change="dragPoint">
|
||||
@@ -125,8 +125,8 @@
|
||||
/>
|
||||
</uni-forms>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
|
||||
<view class="btn-wrap-item ml20" @click="addPoint"> 确定 </view>
|
||||
<view class="btn-wrap-item" @click="closeDrawer"> 取消</view>
|
||||
<view class="btn-wrap-item ml20" @click="addPoint"> 确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -135,8 +135,9 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { registerDevice, getModel, addDevice, queryByTopoId, updateDevice } from '@/common/api/device.js'
|
||||
import { getProjectList, queryTopologyDiagramPage } from '@/common/api/project.js'
|
||||
import {registerDevice, getModel, addDevice, queryByTopoId, updateDevice} from '@/common/api/device.js'
|
||||
import {getProjectList, queryTopologyDiagramPage} from '@/common/api/project.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -170,6 +171,8 @@ export default {
|
||||
position: item.linePostion,
|
||||
}
|
||||
})
|
||||
console.log(this.pointList, 'this.poinitList')
|
||||
this.queryTopologyDiagramPage()
|
||||
},
|
||||
created() {
|
||||
let engineering = uni.getStorageSync(this.$cacheKey.engineering)
|
||||
@@ -236,8 +239,9 @@ export default {
|
||||
projectId: this.formData.projectId,
|
||||
}).then((res) => {
|
||||
this.imageList = res.data.records
|
||||
this.activeGplot = 0
|
||||
this.confirmGplot()
|
||||
this.activeGplot = this.imageList.findIndex(item => {
|
||||
return item.id === this.deviceInfo.id
|
||||
})
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
@@ -247,7 +251,8 @@ export default {
|
||||
positionChange(e) {
|
||||
this.point.name = this.positionList.find((item) => item.id == e).name
|
||||
},
|
||||
projectChange(e) {},
|
||||
projectChange(e) {
|
||||
},
|
||||
scanCode() {
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
@@ -309,6 +314,8 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
this.point.lat = this.point.coordinate.x
|
||||
this.point.lng = this.point.coordinate.y
|
||||
this.pointList[this.editIndex] = this.point
|
||||
console.log(this.pointList)
|
||||
this.closeDrawer()
|
||||
@@ -317,6 +324,7 @@ export default {
|
||||
this.pointList.splice(index, 1)
|
||||
},
|
||||
editPoint(item, index) {
|
||||
console.log(item)
|
||||
this.point = item
|
||||
console.log(this.point)
|
||||
this.editIndex = index
|
||||
@@ -334,15 +342,22 @@ export default {
|
||||
},
|
||||
dragPoint(e) {
|
||||
console.log(e)
|
||||
this.point.lat = e.detail.x
|
||||
this.point.lng = e.detail.y
|
||||
this.point.coordinate = {
|
||||
x: e.detail.x,
|
||||
y: e.detail.y,
|
||||
}
|
||||
// this.point.lat = e.detail.x
|
||||
// this.point.lng = e.detail.y
|
||||
},
|
||||
submit() {
|
||||
updateDevice(this.pointList).then((res) => {
|
||||
updateDevice({
|
||||
pointList: this.pointList,
|
||||
id: this.imageList[this.activeGplot].id
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
this.$util.toast('提交成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 2 })
|
||||
uni.navigateBack({delta: 2})
|
||||
}, 1500)
|
||||
})
|
||||
},
|
||||
@@ -383,6 +398,7 @@ export default {
|
||||
width: 100%;
|
||||
height: 188rpx;
|
||||
}
|
||||
|
||||
.gplot-empty {
|
||||
margin: 0 auto;
|
||||
border: 1px dashed #dcdfe6;
|
||||
@@ -460,6 +476,7 @@ export default {
|
||||
.point-item:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.gplot-image {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
|
||||
Reference in New Issue
Block a user