YangJian0701 2 years ago
parent
commit
ce451adc4b

BIN
dist.rar


+ 12 - 1
src/components/highcharts-h.vue

@@ -16,6 +16,7 @@ import { computed, onBeforeUnmount, reactive, watch, ref ,nextTick} from "vue";
 import { useMessage } from "naive-ui";
 import { useStore } from 'vuex'
 const message = useMessage()
+import { TimeData } from '@/plugin/timeFun';
 const popData = defineProps({
     dataList: {
         type: Array,
@@ -105,8 +106,18 @@ const chartOptions1 = reactive({
         useGPUTranslations: true
     },
 
+    // tooltip: {
+    //     xDateFormat: '%Y-%m-%d %H:%M:%S',
+    // },
     tooltip: {
-        xDateFormat: '%Y-%m-%d %H:%M:%S',
+        formatter: function () {
+            var s = TimeData(this.points[0].x)+'<br/>';
+            for (let i in this.points) {
+            s += '<br/>'+`<div style='color:${this.points[i].series.color}'>`+this.points[i].series.name + ': ' + (this.points[i].y).toFixed(1)+'Rh</div>';
+            }
+            return s;
+        },
+        shared: true
     },
     yAxis: {
         opposite: false, //设置y轴提示在左边

+ 39 - 21
src/components/highcharts-t.vue

@@ -3,6 +3,7 @@
         <Chart v-if="chartOptions1.series.length != 0" style="min-height: 600px;" :options="chartOptions1"
             constructor-type="stockChart">
         </Chart>
+        
         <div style="text-align: center;margin-top: 20px;">{{ computedData }}</div>
     </div>
 </template>
@@ -11,7 +12,7 @@
 import emitter from "@/plugin/bus";
 // const emit = defineEmits(['submit']);
 import { Chart } from 'highcharts-vue';
-import { computed, onBeforeUnmount, reactive, watch, ref ,nextTick} from "vue";
+import { computed, onBeforeUnmount, reactive, watch, ref, nextTick } from "vue";
 import { useMessage } from "naive-ui";
 import { useStore } from 'vuex'
 const message = useMessage()
@@ -21,7 +22,7 @@ const popData = defineProps({
         default: () => [],
     }
 })
-
+import { TimeData } from '@/plugin/timeFun';
 const plotLinesData = reactive({
     tBottom: null,
     tTop: null
@@ -29,21 +30,21 @@ const plotLinesData = reactive({
 const store = useStore()
 const plot = computed(() => store.state.plotLineList)
 
-nextTick(()=>{
+nextTick(() => {
     chartOptions1.yAxis.plotLines[0].value = plot.value.tTop
     chartOptions1.yAxis.plotLines[0].label.text = `上限(${plot.value.tTop}Rh)`, //标签的内容
-    chartOptions1.yAxis.plotLines[1].value = plot.value.tBottom
+        chartOptions1.yAxis.plotLines[1].value = plot.value.tBottom
     chartOptions1.yAxis.plotLines[1].label.text = `下限(${plot.value.tBottom}Rh)` //标签的内容
 })
 emitter.on("onFormData", (val) => {
-  console.log("打印11111:", val);
+    console.log("打印11111:", val);
 });
 //设置就展示
 emitter.on("onMessage", (val) => {
-    console.log('123',val)
+    console.log('123', val)
     chartOptions1.yAxis.plotLines[0].value = val.tTop
     chartOptions1.yAxis.plotLines[0].label.text = `上限(${val.tTop}Rh)`, //标签的内容
-    chartOptions1.yAxis.plotLines[1].value = val.tBottom
+        chartOptions1.yAxis.plotLines[1].value = val.tBottom
     chartOptions1.yAxis.plotLines[1].label.text = `下限(${val.tBottom}Rh)` //标签的内容
 });
 //关闭
@@ -81,13 +82,12 @@ const computedDataFun = () => {
 
     return `最大值${maxData},最小值${minData},平均值${pingjun}`
 }
-
 watch(() => popData.dataList, (newValue) => {
     chartOptions1.series = []
-    nextTick(()=>{
+    nextTick(() => {
         chartOptions1.series = newValue
     })
-    
+
 }, { deep: true, immediate: false })
 
 const emit = defineEmits(['setTimeFun']);
@@ -107,9 +107,21 @@ const chartOptions1 = reactive({
         useGPUTranslations: true
     },
 
+    // tooltip: {
+    //     xDateFormat: '%Y-%m-%d %H:%M:%S',
+        
+    // },
     tooltip: {
-        xDateFormat: '%Y-%m-%d %H:%M:%S',
+        formatter: function () {
+            var s = TimeData(this.points[0].x)+'<br/>';
+            for (let i in this.points) {
+            s += '<br/>'+`<div style='color:${this.points[i].series.color}'>`+this.points[i].series.name + ': ' + (this.points[i].y).toFixed(1)+'°C</div>';
+            }
+            return s;
+        },
+        shared: false
     },
+
     yAxis: {
         opposite: false, //设置y轴提示在左边
         title: {
@@ -147,11 +159,11 @@ const chartOptions1 = reactive({
             //     symbol: 'triangle' //曲线点类型:”circle”, “square”, “diamond”, “triangle”,”triangle-down”,默认是”circle”
             // }
             marker: {
-                enabled : true,
-                radius : 3,
+                enabled: true,
+                radius: 3,
                 // symbol: 'url(https://www.highcharts.com/samples/graphics/sun.png)'
             },
-           
+
         },
     },
 
@@ -163,10 +175,10 @@ const chartOptions1 = reactive({
         enabled: false,
     },
     rangeSelector: {
-            buttons: [], // 不显示左边的zoom
-            selected: 1,
-            inputEnabled: false // 不显示日期输入框
-        },
+        buttons: [], // 不显示左边的zoom
+        selected: 1,
+        inputEnabled: false // 不显示日期输入框
+    },
     boost: {
         useGPUTranslations: true,
         seriesThreshold: 5,
@@ -189,14 +201,15 @@ const chartOptions1 = reactive({
         },
         events: {
             selection(event) {
+                console.log('框选', event)
                 if (event.xAxis) {
                     // if (store.state.focuDatas!=null) {
                     //     chartOptions1.chart.zooming.type = ''
                     // }else{
                     //     chartOptions1.chart.zooming.type = 'x'
                     // }
-                    console.log('框选',store.state.focuDatas)
-                    emitter.emit("onSelectionTime",event.xAxis);
+
+                    emitter.emit("onSelectionTime", event.xAxis);
                     emit("setTimeFun", event.xAxis)
                 }
             },
@@ -206,4 +219,9 @@ const chartOptions1 = reactive({
     series: [],
 })
 
-</script>
+</script>
+<style>
+    .sc{
+        display: block;
+    }
+</style>

+ 1 - 0
src/views/data/edit/AddVue.vue

@@ -90,6 +90,7 @@ const showAddModal = () => {
 // 获取设备列表
 const addTask = async () => { 
   const sto = await inspect(formValue)
+  console.log('999',formValue)
   if(sto){
     Object.keys(formValue).forEach((key) => (formValue[key] += ''));
     const { data: res } = await addTaskData({

+ 10 - 4
src/views/data/edit/AverageCopy.vue

@@ -36,6 +36,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData:{
     type:Array,
     default: () => ([])
@@ -91,24 +95,26 @@ const rules = reactive({
 })
 
 const showModal = ref(false)
+
+
 const showImportModal = () => {
   Object.keys(model).forEach(item=>{
     console.log(item)
     model[item] = null
   })
-  if(props.checkData==null){
+  if( props.checkData==null || props.checkData.length==0){
     message.error('请选择需要复制的设备')
     return
   }else if(props.checkData.length!=2){
     message.error('平均复制到需要选择2项哦')
     return
-  }else if(props.queryObj.Time_start=='' && props.queryObj.Time_end==''){
+  }else if(props.pickleveTime==null){
     message.error('请选择复制时间')
     return
   }else{
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = new Date(props.queryObj.Time_start).getTime()
-    model.EndTime = new Date(props.queryObj.Time_end).getTime()
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
     console.log(model,props.queryObj,props.checkData)
     rules.selectSn.required = true
     T_sn_list.value = null

+ 51 - 0
src/views/data/edit/BesselCurve.vue

@@ -0,0 +1,51 @@
+<template>
+    <div>
+        <n-button @click="showImportModal">曲线生成</n-button>
+    </div>
+</template>
+<script setup>
+import {TimeDate} from '@/plugin/timeFun.js'
+import { useMessage } from 'naive-ui';
+const message = useMessage();
+const props = defineProps({
+    queryObj: {
+        type: Object,
+        default: () => ({}),
+    },
+    pickleveTime: {
+        type: Array,
+        default: () => ([])
+    },
+    checkData: {
+        type: Array,
+        default: () => ([])
+    },
+})
+const showImportModal = () => {
+    console.log(props.queryObj)
+    console.log(props.pickleveTime)
+
+    console.log(props.classList)
+
+    console.log(props.checkData)
+    // return
+    if(props.checkData==null){
+        message.error('请选择需要生成的设备')
+        return
+    }else if(props.checkData.length!=1){
+        message.error('请选择一项进行曲线生成')
+        return
+    }else if(props.pickleveTime==null){
+        message.error('请选择曲线生成时间')
+        return
+    }else{
+        let a_time = TimeDate(props.pickleveTime[0])
+        let b_time = TimeDate(props.pickleveTime[1])
+        let T_task_id = props.queryObj.T_task_id
+        let T_sn = props.checkData[0].T_sn
+        let T_id = props.checkData[0].T_id
+        window.open(`http://coldverifylocal.coldbaozhida.com/CurveEditing/index.html?a_time=${a_time}&b_time=${b_time}&T_task_id=${T_task_id}&T_sn=${T_sn}&T_id=${T_id}`, '_blank')
+    }
+}
+</script>
+<style></style>

+ 10 - 3
src/views/data/edit/ExportVue.vue

@@ -23,12 +23,17 @@
 <script setup>
 import { exportTaskData } from '@/api';
 import { useMessage } from 'naive-ui';
+import {TimeDate} from '@/plugin/timeFun.js'
 const message = useMessage();
 const props = defineProps({
   queryObj: {
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData: {
     type: Array,
     default: () => ([])
@@ -51,13 +56,15 @@ const formValue = reactive({
 
 // 显示导入
 const showImportModal = async () => {
-  if (props.checkData == null) {
+  console.log('sds',props.pickleveTime)
+  // return
+  if (props.checkData == null || props.checkData.length == 0) {
     message.error('请选择需要导出的设备')
     return
   } else {
     formValue.T_task_id = props.queryObj.T_task_id
-    formValue.Time_start = props.queryObj.Time_start;
-    formValue.Time_end = props.queryObj.Time_end;
+    formValue.Time_start = props.pickleveTime==null?'':TimeDate(props.pickleveTime[0])
+    formValue.Time_end = props.pickleveTime==null?'':TimeDate(props.pickleveTime[1])
     formValue.T_sn_list = exportTask(props.checkData);
 
     exportTaskData(formValue).then(res => {

+ 10 - 6
src/views/data/edit/editCopy.vue

@@ -37,6 +37,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData:{
     type:Array,
     default: () => ([])
@@ -93,24 +97,24 @@ const rules = reactive({
 
 const showModal = ref(false)
 const showImportModal = () => {
+  console.log('sdsd',props.pickleveTime,props.queryObj)
+  // return
   Object.keys(model).forEach(item=>{
-    console.log(item)
     model[item] = null
   })
-  if(props.checkData==null){
+  if( props.checkData==null || props.checkData.length==0){
     message.error('请选择需要复制的设备')
     return
   }else if(props.checkData.length!=1){
     message.error('复制只能选择一项哦')
     return
-  }else if(props.queryObj.Time_start=='' && props.queryObj.Time_end==''){
+  }else if(props.pickleveTime==null){
     message.error('请选择复制时间')
     return
   }else{
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = new Date(props.queryObj.Time_start).getTime()
-    model.EndTime = new Date(props.queryObj.Time_end).getTime()
-    console.log(model,props.queryObj,props.checkData)
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
     rules.selectSn.required = true
     T_sn_list.value = null
     showModal.value = true

+ 8 - 4
src/views/data/edit/editFixation.vue

@@ -39,6 +39,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData:{
     type:Array,
     default: () => ([])
@@ -66,16 +70,16 @@ const showImportModal = () => {
     console.log(item)
     model[item] = null
   })
-  if(props.checkData==null){
+  if( props.checkData==null || props.checkData.length==0){
     message.error('请选择需要设置固定偏移的设备')
     return
-  }else if(props.queryObj.Time_start=='' && props.queryObj.Time_end==''){
+  }else if(props.pickleveTime==null){
     message.error('请选择固定偏移时间')
     return
   }else{
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = props.queryObj.Time_start
-    model.EndTime = props.queryObj.Time_end
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
     
     showModal.value = true
   }

+ 8 - 4
src/views/data/edit/editLeak.vue

@@ -16,6 +16,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData: {
     type: Array,
     default: () => ([])
@@ -36,16 +40,16 @@ const model = reactive({
 
 const dialog = useDialog();
 const showImportModal = () => {
-  if (props.checkData == null) {
+  if ( props.checkData==null || props.checkData.length==0) {
     message.error('请选择需要补漏的设备')
     return
-  } else if (props.queryObj.Time_start == '' && props.queryObj.Time_end == '') {
+  } else if (props.pickleveTime==null) {
     message.error('请选择补漏的时间')
     return
   } else {
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = props.queryObj.Time_start
-    model.EndTime = props.queryObj.Time_end
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
 
     dialog.warning({
       title: '提示',

+ 8 - 4
src/views/data/edit/editMath.vue

@@ -52,6 +52,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData:{
     type:Array,
     default: () => ([])
@@ -81,16 +85,16 @@ const showImportModal = () => {
     console.log(item)
     model[item] = null
   })
-  if(props.checkData==null){
+  if( props.checkData==null || props.checkData.length==0){
     message.error('请选择需要设置随机偏移的设备')
     return
-  }else if(props.queryObj.Time_start=='' && props.queryObj.Time_end==''){
+  }else if(props.pickleveTime==null){
     message.error('请选择随机偏移时间')
     return
   }else{
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = props.queryObj.Time_start
-    model.EndTime = props.queryObj.Time_end
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
     
     showModal.value = true
   }

+ 9 - 3
src/views/data/edit/editSmooth.vue

@@ -39,6 +39,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData:{
     type:Array,
     default: () => ([])
@@ -66,7 +70,9 @@ const showImportModal = () => {
     console.log(item)
     model[item] = null
   })
-  if(props.checkData==null){
+  console.log('1111',props.checkData)
+  
+  if( props.checkData==null || props.checkData.length==0){
     message.error('请选择需要设置平滑的设备')
     return
   }else if(props.queryObj.Time_start=='' && props.queryObj.Time_end==''){
@@ -74,8 +80,8 @@ const showImportModal = () => {
     return
   }else{
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = props.queryObj.Time_start
-    model.EndTime = props.queryObj.Time_end
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
     
     showModal.value = true
   }

+ 8 - 4
src/views/data/edit/editTendency.vue

@@ -16,6 +16,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  pickleveTime:{
+    type:Array,
+    default: () => ([])
+  },
   checkData: {
     type: Array,
     default: () => ([])
@@ -36,16 +40,16 @@ const model = reactive({
 
 const dialog = useDialog();
 const showImportModal = () => {
-  if (props.checkData == null) {
+  if ( props.checkData==null || props.checkData.length==0) {
     message.error('请选择需要趋势的设备')
     return
-  } else if (props.queryObj.Time_start == '' && props.queryObj.Time_end == '') {
+  } else if (props.pickleveTime==null) {
     message.error('请选择趋势的时间')
     return
   } else {
     data.T_task_id = props.queryObj.T_task_id
-    model.StartTime = props.queryObj.Time_start
-    model.EndTime = props.queryObj.Time_end
+    model.StartTime = new Date(props.pickleveTime[0]).getTime()
+    model.EndTime = new Date(props.pickleveTime[1]).getTime()
 
     dialog.warning({
       title: '提示',

+ 15 - 12
src/views/data/edit/index.vue

@@ -67,20 +67,20 @@
               <n-button type="primary" @click=" renderFun(2) ">渲染</n-button>
             </n-input-group>
             <n-space>
-              <ExportVue :queryObj=" queryData " :checkData=" checkValues " />
+              <ExportVue :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
               <ImportVue :task=" task " />
               <ImportPlatform :task=" task " />
               <AddVue :class-list=" classList " :task=" task " />
               <SetVue />
-              <editCopy :queryObj=" queryData " :checkData=" checkValues " :classList=" classList " />
-              <AverageCopy :queryObj=" queryData " :checkData=" checkValues " :classList=" classList "></AverageCopy>
-              <editLeak :queryObj=" queryData " :checkData=" checkValues " />
-              <editTendency :queryObj=" queryData " :checkData=" checkValues " />
-
-              <editMath :queryObj=" queryData " :checkData=" checkValues " />
-              <editFixation :queryObj=" queryData " :checkData=" checkValues " />
-              <editSmooth :queryObj=" queryData " :checkData=" checkValues " />
-              <!-- <n-button type="primary" @click="goDataEd">数据编辑</n-button> -->
+              <editCopy :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " :classList=" classList " />
+              <AverageCopy :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " :classList=" classList "></AverageCopy>
+              <editLeak :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
+              <editTendency :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
+
+              <editMath :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
+              <editFixation :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
+              <editSmooth :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " />
+              <BesselCurve :queryObj=" queryData " :pickleveTime=" pickTimes.pickleveTime " :checkData=" checkValues " ></BesselCurve>
             </n-space>
           </n-space>
           <n-tabs type="segment" animated v-model:value=" tabChart " @update:value=" handleTabChange ">
@@ -162,6 +162,8 @@ import editTendency from './editTendency.vue';
 import editMath from './editMath.vue';
 import editFixation from './editFixation.vue';
 import editSmooth from './editSmooth.vue';
+import BesselCurve from './BesselCurve.vue';
+
 
 
 import { useWindowSize } from '@vueuse/core';
@@ -194,8 +196,8 @@ const setTimeFuns = (e) => {
     queryData.Time_start = '';
     queryData.Time_end = '';
   } else {
-    queryData.Time_start = value[0];
-    queryData.Time_end = value[1];
+    queryData.Time_start = e[0];
+    queryData.Time_end = e[1];
   }
 }
 const blurFun = () =>{
@@ -500,6 +502,7 @@ onMounted(() => {
     });
   }
 });
+
 </script>
 
 <style lang="scss" scoped></style>