接口对接修改
This commit is contained in:
@@ -56,12 +56,9 @@
|
||||
<uni-forms-item label="拓扑图" v-if="formData.projectId">
|
||||
<view style="display: flex">
|
||||
<view style="flex: 1">
|
||||
<image
|
||||
v-if="formData.topologyDiagramUrl"
|
||||
class="gplot"
|
||||
:src="formData.topologyDiagramUrl"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view v-if="formData.topologyDiagramUrl">
|
||||
<image :src="formData.topologyDiagramUrl" style="width: 100%" mode="widthFix" />
|
||||
</view>
|
||||
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图 </view>
|
||||
</view>
|
||||
<uni-icons
|
||||
@@ -85,17 +82,9 @@
|
||||
<uni-icons type="compose" color="#007aff" size="26" class="ml20"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="监测点" v-if="pointList.length">
|
||||
<view class="point-item center" v-for="(item, index) in pointList" :key="index">
|
||||
<view style="flex:1" class="center">{{ item.pointName }}</view>
|
||||
<uni-icons type="trash" color="#007aff" size="26" class="ml20"
|
||||
@click="deletePoint(index)"></uni-icons>
|
||||
<uni-icons type="compose" color="#007aff" size="26" class="ml20"
|
||||
@click="editPoint(index)"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item> -->
|
||||
</uni-forms>
|
||||
</view>
|
||||
<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>
|
||||
@@ -113,7 +102,8 @@
|
||||
:key="key"
|
||||
/>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap-item ml20" @click="closeDrawer"> 确定 </view>
|
||||
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
|
||||
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -161,7 +151,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { registerDevice, getModel, addDevice } from '@/common/api/device.js'
|
||||
import { registerDevice, getModel, addDevice, queryByTopoId } from '@/common/api/device.js'
|
||||
import { getProjectList, queryTopologyDiagramPage } from '@/common/api/project.js'
|
||||
export default {
|
||||
data() {
|
||||
@@ -176,14 +166,12 @@ export default {
|
||||
topologyDiagram: '',
|
||||
},
|
||||
projectRange: [],
|
||||
point: {
|
||||
x: 170,
|
||||
y: 100,
|
||||
},
|
||||
point: {},
|
||||
pointList: [],
|
||||
activeGplot: 0,
|
||||
positionList: [],
|
||||
imageList: [],
|
||||
isAdaptive: false, // 是否适应当前项目
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -219,8 +207,30 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
resize(){
|
||||
console.log(this.$refs['gplot-image']);
|
||||
},
|
||||
confirmGplot() {
|
||||
this.formData.topologyDiagramUrl = this.imageList[this.activeGplot].filePath
|
||||
this.formData.topologyDiagram = this.imageList[this.activeGplot].id
|
||||
this.pointList.forEach((item) => {
|
||||
console.log(item.position)
|
||||
this.imageList[this.activeGplot].csLineTopologyTemplateVOList.forEach((item3) => {
|
||||
console.log(item3.linePostion)
|
||||
if (item3.linePostion === item.position) {
|
||||
item.lat = item3.lat
|
||||
item.lng = item3.lng
|
||||
}
|
||||
})
|
||||
})
|
||||
console.log(this.pointList)
|
||||
this.$forceUpdate()
|
||||
this.closeDrawer()
|
||||
this.$nextTick(() => {
|
||||
this.resize()
|
||||
})
|
||||
},
|
||||
queryTopologyDiagramPage() {
|
||||
console.log(this.formData)
|
||||
setTimeout(() => {
|
||||
if (!this.formData.projectId) {
|
||||
return
|
||||
@@ -229,8 +239,8 @@ export default {
|
||||
projectId: this.formData.projectId,
|
||||
}).then((res) => {
|
||||
this.imageList = res.data.records
|
||||
this.formData.topologyDiagramUrl = res.data.records[0].filePath
|
||||
this.formData.topologyDiagram = res.data.records[0].id
|
||||
this.activeGplot = 0
|
||||
this.confirmGplot()
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
@@ -253,8 +263,7 @@ export default {
|
||||
if (!this.formData.nDid) {
|
||||
return this.$util.toast('请输入设备识别码')
|
||||
}
|
||||
registerDevice(this.formData.nDid).then(res=>{
|
||||
|
||||
registerDevice(this.formData.nDid).then((res) => {
|
||||
getModel(this.formData.nDid).then((res) => {
|
||||
console.log(res)
|
||||
this.pointList = res.data.map((item) => {
|
||||
@@ -285,9 +294,6 @@ export default {
|
||||
closeDrawer() {
|
||||
this.$refs.gplot.close()
|
||||
this.$refs.point.close()
|
||||
this.formData.topologyDiagramUrl = this.imageList[this.activeGplot].filePath
|
||||
this.formData.topologyDiagram = this.imageList[this.activeGplot].id
|
||||
this.$forceUpdate()
|
||||
},
|
||||
add() {
|
||||
this.$refs.point.open()
|
||||
@@ -315,6 +321,7 @@ export default {
|
||||
},
|
||||
editPoint(item, index) {
|
||||
this.point = item
|
||||
console.log(this.point)
|
||||
this.editIndex = index
|
||||
if (!this.point.alias) {
|
||||
let every = this.positionList.every((item) => item.name != this.point.name)
|
||||
@@ -466,4 +473,9 @@ export default {
|
||||
.point-item:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
.gplot-image {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
width: 375px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user