cl il y a 1 an
Parent
commit
8a4bb211b9

+ 1 - 0
src/views/historyData/rain/index.vue

@@ -101,6 +101,7 @@ let dataCenter = reactive({
       defaultValue: 'H',
       componentProps: {
         options: [
+          { label: '实时', value: 'R' },
           { label: '小时', value: 'H' },
           { label: '日', value: 'D' },
           { label: '月', value: 'M' },

+ 1 - 0
src/views/historyData/regimen/index.vue

@@ -20,6 +20,7 @@
           <div> 时段类型: </div>
           <div>
             <a-radio-group @change="changeGroup" v-model:value="dataCenter.formData.step_size">
+              <a-radio value="R">实时</a-radio>
               <a-radio value="H">小时</a-radio>
               <a-radio value="D">日</a-radio>
               <a-radio value="M">月</a-radio>

+ 11 - 3
src/views/waterRegimen/multistation/index.vue

@@ -11,6 +11,7 @@
               :maxTagCount="2"
               :maxTagTextLength="4"
               mode="multiple"
+              @change="changeStid"
               v-model:value="dataCenter.formData.station"
               :options="dataCenter.st_options"
             />
@@ -227,6 +228,9 @@
       }
     }
   }
+  const changeStid = (e) => {
+    getDataAllElementsFn(e)
+  }
   // 查询所有站点
   async function getDataData() {
     await getRiverTree().then((res) => {
@@ -245,8 +249,12 @@
       }
       dataCenter.st_options = arr;
       dataCenter.formData.station = [dataCenter.st_options[0].value];
+      getDataAllElementsFn([dataCenter.st_options[0].value])
     });
-    await getDataAllElements().then((res) => {
+    
+  }
+  async function getDataAllElementsFn(ids) {
+    await getDataAllElements({station:ids}).then((res) => {
       res.data.forEach((element) => {
         element.label = element.dchar_name;
         element.value = element.dchar;
@@ -295,7 +303,7 @@
       },
       xAxis: {
         type: 'category',
-        boundaryGap: false,
+        boundaryGap: true,
         data: dataCenter.chartsData.time,
       },
       yAxis: {
@@ -325,7 +333,7 @@
     getDataData();
   }
   onMounted(async () => {
-    getDataData();
+    await getDataData();
   });
 </script>
 <style scoped lang="less">

+ 39 - 2
src/views/waterRegimen/single/index.vue

@@ -10,6 +10,7 @@
               placeholder="监测站点"
               :maxTagCount="2"
               :maxTagTextLength="4"
+              @change="changeStid"
               v-model:value="dataCenter.formData.stcd"
               :options="dataCenter.st_options"
             />
@@ -281,6 +282,7 @@ function queryData() {
 // }
 // 查询展示数据
 function getHistoryWaterData() {
+  dataCenter.chartsData = []
   dataCenter.formData.start_time = dataCenter.timeData.time[0];
   dataCenter.formData.end_time = dataCenter.timeData.time[1];
   getSingleStAnalyze(dataCenter.formData).then((res) => {
@@ -357,6 +359,34 @@ function setunit(name) {
   });
   return text;
 }
+function waterLevel(max, min) {
+  let maxValue = Math.ceil(max);
+  let minValue = Math.floor(min);
+  let interval = 0;
+  console.log((max - min) / 5);
+  if ((max - min) / 5 <= 0.2) {
+    interval = 0.2;
+    maxValue = Math.floor(maxValue);
+    maxValue = Math.ceil(maxValue);
+  } else if ((max - min) / 5 <= 0.5) {
+    interval = 0.5;
+    maxValue = Math.floor(maxValue);
+    maxValue = Math.ceil(maxValue);
+  } else if ((max - min) / 5 <= 1) {
+    interval = 0.5;
+    maxValue = Math.floor(maxValue);
+    maxValue = Math.ceil(maxValue);
+  } else {
+    // 获取余数
+    minValue = minValue - (5 - ((maxValue - minValue) % 5));
+    interval = (maxValue - minValue) / 5;
+  }
+  return {
+    interval: interval,
+    maxValue: maxValue,
+    minValue: minValue,
+  };
+}
 // 循环渲染数据
 function chartsArrBox(arr, dchar_type) {
   arr.forEach((element, index) => {
@@ -482,6 +512,7 @@ function chartsArrBox(arr, dchar_type) {
       },
       yAxis: {
         type: 'value',
+        scale:true,
       },
       series: [
         // {
@@ -521,8 +552,15 @@ async function getDataData() {
     }
     dataCenter.st_options = arr;
     dataCenter.formData.stcd = dataCenter.st_options[0].value;
+    getDataAllElementsFn([dataCenter.st_options[0].value])
   });
-  await getDataAllElements().then((res) => {
+  
+}
+const changeStid = (e) => {
+    getDataAllElementsFn([e])
+  }
+async function getDataAllElementsFn(ids) {
+  await getDataAllElements({station:ids}).then((res) => {
     res.data.forEach((element) => {
       element.label = element.dchar_name;
       element.value = element.dchar;
@@ -532,7 +570,6 @@ async function getDataData() {
   });
   getHistoryWaterData();
 }
-
 function resetting() {
   getDataData();
 }