linqilong 6 ヶ月 前
コミット
884ae96e51

+ 18 - 7
src/api/nanshui.ts

@@ -25,7 +25,7 @@ export function getEnvStatus() {
  */
 export function getDeviceStatus() {
   // return request({
-  //   url: '/nanshui_api/station-status',
+  //   url: '/tsq_api/station-status',
   //   method: 'post'
   // })
   return Promise.resolve({
@@ -196,7 +196,7 @@ export function getDeviceStatus() {
  */
 export function setDeviceStatus(devid: string, cmd = true) {
   // return request({
-  //   url: '/nanshui_api/dev-exec',
+  //   url: '/tsq_api/dev-exec',
   //   method: 'post',
   //   data: {
   //     devid,
@@ -216,9 +216,9 @@ export function setDeviceStatus(devid: string, cmd = true) {
  * 查看现在的定时任务
  * @param stcd 站码
  */
-export function getTaskRead(stcd: string) {
+export function getTaskRead(stcd: any) {
   return request({
-    url: '/nanshui_api/task-read?taskid=SZCD',
+    url: '/tsq_api/task-read?taskid=SZCD',
     method: 'post',
   })
   // .then(res => {
@@ -243,9 +243,9 @@ export function getTaskRead(stcd: string) {
  * @param stcd 站码
  * @param hour 小时数组
  */
-export function setTaskRead(stcd: string, hour: Number[]) {
+export function setTaskRead(stcd: any, hour: Number[]) {
   return request({
-    url: `/nanshui_api/task-edit?taskid=SZCD&hour=${hour.join(',')}&minute=0&pretype=hour`,
+    url: `/tsq_api/task-edit?taskid=SZCD&hour=${hour.join(',')}&minute=0&pretype=hour`,
     method: 'post',
   })
 }
@@ -257,7 +257,18 @@ export function setTaskRead(stcd: string, hour: Number[]) {
  */
 export function getWaterQualityData(stcd: any) {
   return request({
-    url: `/nanshui_api/get-data`,
+    url: `/tsq_api/get-data`,
+    method: 'post',
+  })
+}
+
+/**
+ * 启动水质监测
+ * @param stcd 站码
+ */
+export function runTest(stcd: any) {
+  return request({
+    url: `/tsq_api/work-flow-start?wfid=SZCD`,
     method: 'post',
   })
 }

+ 4 - 0
src/assets/styles/element/index.scss

@@ -103,3 +103,7 @@ $--card: (
 .el-radio-button:first-child .el-radio-button__inner {
   border-left: 1px solid var(--el-border-color-light);
 }
+
+.el-message-box {
+  background-color: var(--el-bg-color-overlay);
+}

+ 8 - 0
src/components/StationRightButtonGroup.vue

@@ -292,6 +292,14 @@ bus.on('handle_ue_response', (data) => {
     }
   }
 })
+
+watch(() => riverRoamStatus.value, (value) => {
+  bus.emit("roam", value !== 0)
+})
+watch(() => stationRoamStatus.value, (value) => {
+  bus.emit("roam", value !== 0)
+})
+
 </script>
 <template>
   <div class="right-btn-container">

+ 1 - 1
src/components/TimeScrollbar.vue

@@ -69,7 +69,7 @@ onUnmounted(() => {
       <RefreshLeft v-if="value > 0" @click="refresh"></RefreshLeft>
     </div>
     <div class="time-slider-container">
-      <el-slider ref="sliderRef" v-model="value" :format-tooltip="formatTooltip" :marks="props.marks"
+      <el-slider ref="sliderRef" v-model="value" :format-tooltip="props.formatTooltip" :marks="props.marks"
                  :max="props.max"
                  style="width: 100%;" tooltip-class="show-tooltip"></el-slider>
     </div>

+ 2 - 2
src/components/UePlayer.vue

@@ -18,8 +18,8 @@ onMounted(() => {
     initialSettings: {
       // ss: "ws://192.168.0.136:85",
       // ss: "ws://192.168.0.120:85",
-      // ss: "ws://192.168.0.121:85",
-      ss: "ws://10.8.48.235:85",
+      ss: "ws://192.168.0.121:85",
+      // ss: "ws://10.8.48.235:85",
       AutoConnect: true,
       AutoPlayVideo: true,
       StartVideoMuted: false,

+ 6 - 3
src/components/Video/video.ts

@@ -60,9 +60,12 @@ const videoCode = [
 ]
 
 export function getVideoCodeByMark(stcd: string, mark: string) {
-  const videos = videoCode.find(v => v.stcd === stcd)
-  const video = videos?.children.find(v => v.mark === mark)
-  return video?.code || null
+  // const videos = videoCode.find(v => v.stcd === stcd)
+  // const video = videos?.children.find(v => v.mark === mark)
+  // return video?.code || null
+  const index = Math.floor(Math.random() * 4)
+  console.log(index)
+  return ['33042106531322001000', '33041106531322000100', '32050906531322002500', '33041106531322000300'][index]
 }
 
 function encryptPwd() {

+ 15 - 7
src/components/tag/DataTag.vue

@@ -1,29 +1,37 @@
 <script lang="ts" setup>
 import {getCurrentInstance, ref, watch} from 'vue'
 import {getWaterQualityAssessment} from "@/api/gx";
+import {useRoute} from "vue-router";
 
 defineProps({
   data: {type: Object, default: () => ({})}
 })
 
+const route = useRoute()
 const {props} = getCurrentInstance()
 const imgSrc = ref(new URL('@/assets/images/szpj.png', import.meta.url).href)
 const szpjTitleSrc = ref(new URL('@/assets/images/szpj_title.png', import.meta.url).href)
 const tempImg = ref(new URL('@/assets/images/temperature.png', import.meta.url).href)
 
 watch(() => props.data, (val) => {
-  if (val && val.length > 0) {
-    const waterQuery = Object.keys(val.wqdata).reduce((acc, key) => {
-      acc[key.toLowerCase()] = val.wqdata[key];
+  if (val && Object.keys(val).length > 0) {
+    const waterQuery = Object.keys(val).reduce((acc, key) => {
+      if (val[key]) {
+        acc[key.toUpperCase()] = val[key];
+      }
       return acc;
     }, {});
-
+    waterQuery['STCD'] = route.params.stcd
     getWaterQualityAssessment([waterQuery]).then(res => {
-      debugger
-    })
+      console.log(res)
+      if (res.result) {
+
+      }
 
+
+    })
   }
-}, {deep: true})
+}, {deep: true, immediate: true})
 </script>
 
 <template>

+ 1 - 0
src/utils/request.ts

@@ -19,6 +19,7 @@ service.interceptors.request.use(
       !config.url.startsWith("/tbazmw_api") &&
       !config.url.startsWith("/gx_api") &&
       !config.url.startsWith("/szybh_api") &&
+      !config.url.startsWith("/tsq_api") &&
       !config.url.startsWith("/lantai_api") &&
       !config.url.startsWith("/nmc_api") &&
       !config.url.startsWith("/video_api") &&

+ 34 - 31
src/views/Device.vue

@@ -1,22 +1,22 @@
 <script lang="ts" setup>
-import { computed, onMounted, onUnmounted, ref } from 'vue'
-import { useRoute } from 'vue-router'
+import {computed, onMounted, onUnmounted, ref} from 'vue'
+import {useRoute} from 'vue-router'
 import RightFrame from '@/components/RightFrame.vue'
 import Card01 from '@/components/card/Card01.vue'
 import StripeTable from '@/components/StripeTable.vue'
-import { getDeviceByName, getDeviceTypeByName } from '@/utils/device'
+import {getDeviceByName, getDeviceTypeByName} from '@/utils/device'
 import Chart from '@/components/Chart.vue'
 import StationRightButtonGroup from '@/components/StationRightButtonGroup.vue'
 
-import { Label, View } from '@/utils/tdInstruction'
+import {Label, View} from '@/utils/tdInstruction'
 import GwVideo from '@/components/Video/index.vue'
-import { getVideoCodeByMark } from '@/components/Video/video'
+import {getVideoCodeByMark} from '@/components/Video/video'
 import WaterQualityAnalysis from '@/components/DeviceComponent/WaterQualityAnalysis.vue'
 import WaterLevel from '@/components/DeviceComponent/WaterLevel.vue'
 import Rainfall from '@/components/DeviceComponent/Rainfall.vue'
 import AdcpFlow from '@/components/DeviceComponent/AdcpFlow.vue'
 import WaterFlow from '@/components/DeviceComponent/WaterFlow.vue'
-import { getMaintenanceScheduleTask, getMaintenanceTaskLog, getSparePart } from '@/api/device'
+import {getMaintenanceScheduleTask, getMaintenanceTaskLog, getSparePart} from '@/api/device'
 import moment from 'moment'
 import DeviceIntroduce from '@/components/DeviceIntroduce.vue'
 
@@ -32,20 +32,20 @@ const videoCode = ref(getVideoCodeByMark(route.params.stcd + '', '室外'))
 
 
 const deviceStatusColumns = [
-  { label: '维护信息', prop: 'deviceName', width: '100' },
-  { label: '维护人员', prop: 'woker', width: '90' },
-  { label: '维护日期‌', prop: 'updateTm' },
-  { label: '状态', prop: 'status', width: '70' }
+  {label: '维护信息', prop: 'deviceName', width: '100'},
+  {label: '维护人员', prop: 'woker', width: '90'},
+  {label: '维护日期‌', prop: 'updateTm'},
+  {label: '状态', prop: 'status', width: '70'}
 ]
 // const deviceStatusData = ref([])
 const deviceStatusData = [
-  { deviceName: '总磷分析仪', woker: '陈标', updateTm: '11-20 15:00:00', status: '正常' },
-  { deviceName: '总氮分析仪', woker: '于奇', updateTm: '11-20 15:00:00', status: '正常' },
-  { deviceName: '水位计', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常' },
-  { deviceName: '氨氮分析仪', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常' }
+  {deviceName: '总磷分析仪', woker: '陈标', updateTm: '11-20 15:00:00', status: '正常'},
+  {deviceName: '总氮分析仪', woker: '于奇', updateTm: '11-20 15:00:00', status: '正常'},
+  {deviceName: '水位计', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常'},
+  {deviceName: '氨氮分析仪', woker: '张孝荣', updateTm: '11-20 15:00:00', status: '正常'}
 ]
 const accessoriesColumns = [
-  { label: '耗材名称', prop: 'partName', width: '110' },
+  {label: '耗材名称', prop: 'partName', width: '110'},
   {
     label: '剩余有效期', prop: 'warranty', width: '110', convertFn: (data) => {
       var formatDate = 'yyyy-MM-DD'
@@ -67,15 +67,15 @@ const accessoriesData = ref([])
 //   // { name: '瓶子', days: 102, warranty: '11-20 15:00:00' }
 // ]
 const reagentColumns = [
-  { label: '试剂名称', prop: 'name' },
-  { label: '添加体积', prop: 'volume', width: '110' },
-  { label: '更换时间', prop: 'updateTm', width: '110' }
+  {label: '试剂名称', prop: 'name'},
+  {label: '添加体积', prop: 'volume', width: '110'},
+  {label: '更换时间', prop: 'updateTm', width: '110'}
 ]
 const reagentData = [
-  { name: '硫酸溶液', volume: 2, updateTm: '11-20 15:00:00' },
-  { name: '高锰酸钾溶液', volume: 1, updateTm: '11-20 15:00:00' },
-  { name: '草酸钠溶液', volume: 3, updateTm: '11-20 15:00:00' },
-  { name: '去离子水', volume: 2, updateTm: '11-20 15:00:00' }
+  {name: '硫酸溶液', volume: 2, updateTm: '11-20 15:00:00'},
+  {name: '高锰酸钾溶液', volume: 1, updateTm: '11-20 15:00:00'},
+  {name: '草酸钠溶液', volume: 3, updateTm: '11-20 15:00:00'},
+  {name: '去离子水', volume: 2, updateTm: '11-20 15:00:00'}
 ]
 // function reloadRight3(list) {
 //   if (!list || list.length === 0) {
@@ -215,7 +215,7 @@ async function reloadRight3() {
       axisLabel: { // 坐标轴刻度标签的相关设置
         color: '#02cacf'
       },
-      axisTick: { show: false },
+      axisTick: {show: false},
       data: sparePart.value['xdata']
     }],
     yAxis: [{
@@ -243,7 +243,7 @@ async function reloadRight3() {
       name: '数量',
       type: 'bar',
       itemStyle: {
-        color: function(params) {
+        color: function (params) {
           // 根据params的
           const colorsMap = [
             '#4768ec',
@@ -279,7 +279,7 @@ function getMaintainRecordData() {
   getMaintenanceTaskLog(data).then(res => {
     if (res.status == 200) {
       if (res.data.length != 0) {
-        maintainRecord.value = res.data.records[0]
+        maintainRecord.value = res.data.records[0] || {}
       }
     }
   })
@@ -350,7 +350,7 @@ onUnmounted(() => {
 <template>
   <right-frame>
     <template #leftModule>
-      <template v-if="['rainfall', 'flow','waterLevel'].includes(deviceType)">
+      <template v-if="['rainfall','waterLevel'].includes(deviceType)">
         <card01 :title="device.deviceName" style="height: 65%">
           <device-introduce></device-introduce>
           <h4 style="color: #00ccff">维护记录</h4>
@@ -405,8 +405,11 @@ onUnmounted(() => {
       </template>
       <template v-if="deviceType=== 'flow'">
         <card01 style="height: 36%" title="流量监测">
-          <adcp-flow v-if="device.ueDeviceName === '无人船'" />
-          <water-flow v-else />
+          <adcp-flow v-if="device.ueDeviceName === '无人船'"/>
+          <water-flow v-else/>
+        </card01>
+        <card01 style="height: 40%" title="设备维护情况">
+          <stripe-table :columns="deviceStatusColumns" :data="deviceStatusData"></stripe-table>
         </card01>
       </template>
       <template v-if="deviceType=== 'waterQuality'">
@@ -416,10 +419,10 @@ onUnmounted(() => {
         <card01 style="height: 33%" title="配件运维信息">
           <stripe-table :columns="accessoriesColumns" :data="accessoriesData"></stripe-table>
         </card01>
-        <card01 style="height: 33%" title="耗材余量监控">
-          <chart ref="right3Ref"></chart>
-        </card01>
       </template>
+      <card01 v-show="deviceType=== 'waterQuality'" style="height: 33%" title="耗材余量监控">
+        <chart ref="right3Ref"></chart>
+      </card01>
     </template>
     <template #btnGroup>
       <station-right-button-group></station-right-button-group>

+ 1 - 1
src/views/IntellOper.vue

@@ -249,7 +249,7 @@ function handleDeviceClick(row) {
   const device = getDeviceByName(row.deviceName, 'deviceName')
   if (device) {
     if (device['deviceType'] === '水质测验设备') {
-      View.changeDeviceView('打开模型', route.params.stcd, device.ueDeviceName)
+      // View.changeDeviceView('打开模型', route.params.stcd, device.ueDeviceName)
     } else {
       View.changeView(`${route.params.stcd}_${device.ueDeviceName}`)
     }

+ 0 - 1
src/views/Situational.vue

@@ -205,7 +205,6 @@ async function reloadLeft3() {
 }
 
 async function reloadRight1() {
-  debugger
   const curDay = new Date(new Date().getTime() + 1 * 24 * 60 * 60 * 1000)
   const sevenDayAgo = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
   const rainfallData = await getRainfallListOfPageByStcd({

+ 18 - 4
src/views/Station.vue

@@ -14,6 +14,7 @@ import TimeScrollbar from "@/components/TimeScrollbar.vue";
 import {Label, Operate, Setting, View} from "@/utils/tdInstruction";
 import {getRainfallLatest, getWaterLevelAndFlowLatest} from "@/api/gx";
 import {getRainfallLevel} from "@/utils/rainfall";
+import bus from "@/utils/bus";
 
 const route = useRoute()
 const stationStore = useStationStore()
@@ -33,17 +34,27 @@ const eventData = ref([])
 // 时间戳
 const max = ref(100)
 const marks = ref({})
+const typicalEventTimeScrollbarShow = ref(true)
 
 const handleEventChange = async (name: string) => {
   event.value = typicalEvents.value.find(t => t.name === name)
   eventData.value = await getTypicalData(route.params.stcd, event.value.id)
-  max.value = eventData.value?.lenght || 100
+  max.value = eventData.value ? eventData.value.length : 100
 }
 
 function sliderlTooltip(val) {
   if (eventData.value && eventData.value.length > 0) {
     const data = eventData.value[val]
     Operate.setWaterLevel(route.params.stcd, data.z, (data.q * 4).toFixed(2))
+    let weather = "晴"
+    if (data.z >= 3.6) {
+      weather = "大雨"
+    } else if (data.z >= 3.4) {
+      weather = "中雨"
+    } else if (data.z >= 3.3) {
+      weather = "小雨"
+    }
+    Setting.setWeather(weather)
     return `${data.tm}\n 水位: ${data.z}m\n 流量: ${data.q}m³/s\n 平均流速: ${data.smv}m³/s\n`
   }
   return ''
@@ -51,7 +62,6 @@ function sliderlTooltip(val) {
 
 function handleTimeChange(status) {
   if (status) {
-    Setting.setWeather("中雨")
     View.changeView(station.value.stnm + '近')
     stationStore.setLabelState2('测站主页', true)
     stationStore.setLabelState2('仪器运维', false)
@@ -87,6 +97,10 @@ onMounted(() => {
   // 获取最新水雨情数据,更新大屏
   handleSetLED()
 })
+
+bus.on("roam", roaming => {
+  typicalEventTimeScrollbarShow.value = !roaming
+})
 </script>
 <template>
   <div class="station-wrapper">
@@ -99,7 +113,7 @@ onMounted(() => {
         </card01>
         <card01 style="height: 30%" title="现场监控">
           <!--  34102206531322000100 这是有视频的CODE  -->
-          <gw-video :code="videoCode" :imageSrc="jiankong"></gw-video>
+          <gw-video :imageSrc="jiankong" :code="videoCode"></gw-video>
         </card01>
       </template>
       <template #rightModule>
@@ -127,7 +141,7 @@ onMounted(() => {
         <station-right-button-group></station-right-button-group>
       </template>
     </right-frame>
-    <div class="typical-event-time-scrollbar">
+    <div v-if="typicalEventTimeScrollbarShow" class="typical-event-time-scrollbar">
       <time-scrollbar :formatTooltip="sliderlTooltip" :marks="marks" :max="max"
                       @change="handleTimeChange"></time-scrollbar>
     </div>

+ 50 - 7
src/views/StationHouse.vue

@@ -13,11 +13,12 @@ import StationRightButtonGroup from "@/components/StationRightButtonGroup.vue";
 import GwVideo from "@/components/Video/index.vue";
 import {getVideoCodeByMark} from "@/components/Video/video";
 import {Operate} from "@/utils/tdInstruction";
-import {getWaterQualityData} from "@/api/nanshui";
+import {getTaskRead, getWaterQualityData, runTest, setTaskRead} from "@/api/nanshui";
 import {HexToRgb} from "@/utils/color";
 import bus from "@/utils/bus";
 import DataTag from "@/components/tag/DataTag.vue";
 import {Timer, VideoPlay} from '@element-plus/icons-vue'
+import {ElMessage, ElMessageBox} from 'element-plus'
 
 const route = useRoute()
 const videoSrc = ref(new URL('@/assets/images/video.png', import.meta.url).href)
@@ -38,7 +39,7 @@ const RGB_RED = HexToRgb(RED)
 // 浅红色
 const LIGHT_RED = `rgba(${RGB_RED[0]}, ${RGB_RED[1]}, ${RGB_RED[2]}, 0.3)`
 
-const frequency = ref([2, 8])
+const frequency = ref([])
 const wqData = ref({})
 // 水质测验模拟 0:结束 1:播放 2:暂停
 const testSimulationStatus = ref(0)
@@ -204,9 +205,50 @@ async function reloadLeft1() {
   left1Ref.value.loadChart(option)
 }
 
+function getFrequency() {
+  getTaskRead(route.params.stcd).then(res => {
+    frequency.value = res.data.hour.split(',')
+  })
+}
+
+function handleFrequencyChange(value) {
+  ElMessageBox.confirm('是否要修改监测频率?', '修改检测频率',
+    {
+      confirmButtonText: '确认',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
+  )
+    .then(() => setTaskRead(route.params.stcd, value))
+    .then(() => {
+      ElMessage({type: 'success', message: '检测频率修改成功'})
+    })
+    .catch(() => {
+      ElMessage({type: 'info', message: '检测频率修改失败',})
+    })
+}
+
+function handleRunTest() {
+  ElMessageBox.confirm('是否要运行水质测验?水质测验需要2小时.', '执行水质测验',
+    {
+      confirmButtonText: '确认',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
+  )
+    .then(() => runTest(route.params.stcd))
+    .then(() => {
+      ElMessage({type: 'success', message: '运行水质测验成功'})
+    })
+    .catch(() => {
+      ElMessage({type: 'info', message: '运行水质测验失败',})
+    })
+}
+
 onMounted(() => {
   reloadLeft1()
   getAlarmList()
+  getFrequency()
   getLatestWaterQuality()
 })
 
@@ -255,16 +297,17 @@ bus.on('test_simulation', (data) => {
         <el-form label-width="auto">
           <el-form-item label="检测频率">
             <div style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
-              <el-select v-model="frequency" multiple placeholder="Select" style="width: 200px">
+              <el-select v-model="frequency" multiple placeholder="Select" style="width: 200px"
+                         @blur="handleFrequencyChange">
                 <el-option v-for="item in 24" :key="item" :label="item + '时'" :value="item"></el-option>
                 <template #tag>
-                  <el-tag v-for="color in frequency" :key="color" color="#4167F0" style="color: #fff;">{{
-                      color + '时'
-                    }}
+                  <el-tag v-for="color in frequency" :key="color" color="#4167F0" style="color: #fff;">
+                    {{ color + '时' }}
                   </el-tag>
                 </template>
               </el-select>
-              <el-button :icon="VideoPlay" style="margin-left: 10px;width: 6rem;" type="primary" @click="">水质测验
+              <el-button :icon="VideoPlay" style="margin-left: 10px;width: 6rem;" type="primary" @click="handleRunTest">
+                水质测验
               </el-button>
             </div>
           </el-form-item>

+ 0 - 1
src/views/Zhyw.vue

@@ -19,7 +19,6 @@ onMounted(async () => {
   const srcType = route.params.type
 
   const token = localStorage.getItem('Authorization')
-  debugger
   iframeUrl.value = `${urlMap[srcType]}?code=${token}&stcd=${stcd}`
 })
 </script>

+ 1 - 1
vite.config.ts

@@ -57,7 +57,7 @@ export default defineConfig({
         rewrite: path => path.replace(/^\/video_api/, '')
       },
       '/tsq_api': {
-        // 地听视频
+        // 南水太师桥
         target: 'http://10.8.251.166:8001/',
         changeOrigin: true,
         rewrite: path => path.replace(/^\/tsq_api/, '')