|
@@ -0,0 +1,143 @@
|
|
|
+<template>
|
|
|
+ <div class="lm-config-page">
|
|
|
+ <div class="data-row">
|
|
|
+ <div>井名:</div><div style="color:#666">{{wellObj.wellName||'请在左侧选择一口井'}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="data-row">
|
|
|
+ <div>液面量液计算,需要满足如下条件:</div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="express-box" v-for="(condition,index) in configs" :key="index">
|
|
|
+ <div v-if="index>0">且</div>
|
|
|
+ <div v-else> </div>
|
|
|
+ <el-input v-model="condition.label" disabled style="width:100px;"></el-input>
|
|
|
+ <el-select v-model="condition.symbol" placeholder="比较" style="width: 80px">
|
|
|
+ <el-option label=">" value=">" />
|
|
|
+ <el-option label=">=" value=">=" />
|
|
|
+ <el-option label="=" value="=" />
|
|
|
+ <el-option label="<" value="<" />
|
|
|
+ <el-option label="<=" value="<=" />
|
|
|
+ <el-option label="!=" value="!=" />
|
|
|
+ </el-select>
|
|
|
+ <el-input-number
|
|
|
+ v-model="condition.val"
|
|
|
+ placeholder="阀值"
|
|
|
+ style="width:100px"
|
|
|
+ :controls="false"
|
|
|
+
|
|
|
+ >
|
|
|
+ </el-input-number>
|
|
|
+ <span style="color:#666">(m)</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="data-row">
|
|
|
+ <el-button type="primary" icon="Edit" @click="saveConfig">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+ import {reactive,ref,watch,isRef,toRaw,onMounted} from 'vue'
|
|
|
+ import {ElMessageBox,ElMessage} from 'element-plus'
|
|
|
+ import { storeToRefs } from 'pinia'
|
|
|
+ import { useHomeStore } from '../../store/home.js'
|
|
|
+
|
|
|
+ import api from "../../api/liquidMeasureConfig.js"
|
|
|
+
|
|
|
+ const wellObj=reactive({
|
|
|
+ wellId:null,
|
|
|
+ wellName:null
|
|
|
+ })
|
|
|
+
|
|
|
+ const defConfigs=[
|
|
|
+ {
|
|
|
+ label:'液面深度',
|
|
|
+ param:'liquidDepth',
|
|
|
+ symbol:'>',
|
|
|
+ val:null
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'液面深度',
|
|
|
+ param:'liquidDepth',
|
|
|
+ symbol:'<=',
|
|
|
+ val:null
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'液面深度',
|
|
|
+ param:'liquidDepth',
|
|
|
+ symbol:'!=',
|
|
|
+ val:null
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const configs=ref(defConfigs)
|
|
|
+
|
|
|
+ const cleanConfigs=()=>{
|
|
|
+ configs.value.forEach(config=>{
|
|
|
+ config.val=null
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const getConfig=(wellId)=>{
|
|
|
+ cleanConfigs()
|
|
|
+ api.getConfig(wellId).then(resp=>{
|
|
|
+ if(resp.code!=0){
|
|
|
+ ElMessage.error(resp.msg || '获取配置信息失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!resp.data){
|
|
|
+ ElMessage.error('未找到配置信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ configs.value=JSON.parse(resp.data.configExpress)
|
|
|
+
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const saveConfig=()=>{
|
|
|
+ let saveData={wellId:wellObj.wellId,configExpress:JSON.stringify(configs.value)}
|
|
|
+ api.saveConfig(saveData).then(resp=>{
|
|
|
+ if(resp.code!=0){
|
|
|
+ ElMessage.error(resp.msg || '保存配置信息失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ElMessage.success('保存配置成功')
|
|
|
+ }).catch(err=>{
|
|
|
+ ElMessage.error('保存配置信息出错')
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const store=useHomeStore()
|
|
|
+ const {currentTreeNode} = storeToRefs(store)
|
|
|
+ watch(currentTreeNode,(newNode, oldNode)=>{
|
|
|
+ if(newNode!=null && newNode.nodeType=='well'){
|
|
|
+ wellObj.wellId=newNode.id
|
|
|
+ wellObj.wellName=newNode.name
|
|
|
+ getConfig(newNode.id)
|
|
|
+ }
|
|
|
+
|
|
|
+ },{ immediate: true })
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .lm-config-page{
|
|
|
+ padding:10px 50px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .data-row{
|
|
|
+ padding:10px;
|
|
|
+ display: flex;
|
|
|
+ flex-flow:row nowrap;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .express-box{
|
|
|
+ padding:10px;
|
|
|
+ display: flex;
|
|
|
+ flex-flow:row nowrap;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+</style>
|