|
@@ -1,9 +1,93 @@
|
|
<template>
|
|
<template>
|
|
- <div>单井数据</div>
|
|
|
|
|
|
+ <div class="page-container">
|
|
|
|
+ <LayoutEL v-for="(elModel,index) in tempConfig" :key="index" :elModel="elModel" :elData="elDataObj"/>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
|
|
|
+<script setup>
|
|
|
|
+ import {reactive,ref,watch,toRaw,onMounted,nextTick } from 'vue'
|
|
|
|
+ import Diagram from '../../components/diagram/Diagram.vue'
|
|
|
|
+ import LayoutEL from '../../components/layouttmp/LayoutEL.vue'
|
|
|
|
+ import wellPatrolAPI from '../../api/wellPatrol.js'
|
|
|
|
+ import { storeToRefs } from 'pinia'
|
|
|
|
+ import { useHomeStore } from '../../store/home.js'
|
|
|
|
+
|
|
|
|
+ import { directive, Contextmenu, ContextmenuItem } from 'v-contextmenu';
|
|
|
|
+ import 'v-contextmenu/dist/themes/default.css'
|
|
|
|
+ import {ElMessage} from 'element-plus'
|
|
|
|
+
|
|
|
|
+ const tempConfig=ref([])
|
|
|
|
+
|
|
|
|
+ const elDataObj=ref({})
|
|
|
|
+
|
|
|
|
+ const crtWell=reactive({})
|
|
|
|
+
|
|
|
|
+ const store=useHomeStore()
|
|
|
|
+ const {currentTreeNode} = storeToRefs(store)
|
|
|
|
+
|
|
|
|
+ //切换井时进行数据的重置
|
|
|
|
+ const resetPage=()=>{
|
|
|
|
+ tempConfig.value=[]
|
|
|
|
+ elDataObj.value={}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const getTemp=(wellId)=>{
|
|
|
|
+ resetPage()
|
|
|
|
+ wellPatrolAPI.getTemp(wellId).then(resp=>{
|
|
|
|
+ //console.log(resp)
|
|
|
|
+ if(resp.code==0&&resp.data){
|
|
|
|
+ tempConfig.value=resp.data //JSON.parse(resp.data.tempContent)
|
|
|
|
+ nextTick(()=>{
|
|
|
|
+ loadData(wellId)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ ElMessage.error('未找到模板数据')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }).catch(err=>{
|
|
|
|
+ ElMessage.error(err||'获取模板信息失败')
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const loadData=(wellId)=>{
|
|
|
|
+ wellPatrolAPI.loadData(wellId).then(resp=>{
|
|
|
|
+ console.log(resp)
|
|
|
|
+ if(resp.code!=0||!resp.data){
|
|
|
|
+ ElMessage.error(resp.msg||'未获取到实时数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.data.wellName=crtWell.name
|
|
|
|
+ Object.assign(elDataObj.value,resp.data)
|
|
|
|
+ }).catch(err=>{
|
|
|
|
+ ElMessage.error(err||'获取实时数据失败')
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onMounted(()=>{
|
|
|
|
+ if(!crtWell.id){
|
|
|
|
+ ElMessage.error('还未选择井')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ watch(currentTreeNode,(newNode, oldNode)=>{
|
|
|
|
+ if(newNode&&newNode.nodeType=='well'){
|
|
|
|
+ crtWell.id=newNode.id
|
|
|
|
+ crtWell.name=newNode.name
|
|
|
|
+ getTemp(newNode.id)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },{ immediate: true })
|
|
|
|
+
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
|
|
|
+<style scoped>
|
|
|
|
+ .page-container{
|
|
|
|
+ width:100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ padding:2px;
|
|
|
|
+ position: relative;
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|