|
@@ -66,19 +66,16 @@
|
|
|
<ImportVue :task="task" />
|
|
|
<ImportPlatform :task="task" />
|
|
|
<AddVue :class-list="classList" :task="task" />
|
|
|
- <SetVue @submit="handleSet" />
|
|
|
+ <SetVue/>
|
|
|
<n-button type="primary" @click="goDataEd">数据编辑</n-button>
|
|
|
</n-space>
|
|
|
</n-space>
|
|
|
<n-tabs type="segment" animated v-model:value="tabChart" @update:value="handleTabChange">
|
|
|
<n-tab-pane name="温度" tab="温度">
|
|
|
- <!-- <Chart :style="{ minHeight: `${height - 300}px` }" ref="chart1" constructor-type="stockChart"
|
|
|
- :options="chartOptions1"></Chart> -->
|
|
|
<highchartsT :dataList="dataList"></highchartsT>
|
|
|
</n-tab-pane>
|
|
|
<n-tab-pane name="湿度" tab="湿度">
|
|
|
- <Chart :style="{ minHeight: `${height - 300}px` }" ref="chart2" constructor-type="stockChart"
|
|
|
- :options="chartOptions2"></Chart>
|
|
|
+ <highchartsH :dataList="dataList"></highchartsH>
|
|
|
</n-tab-pane>
|
|
|
</n-tabs>
|
|
|
</div>
|
|
@@ -125,6 +122,8 @@
|
|
|
|
|
|
import { Chart } from 'highcharts-vue';
|
|
|
import highchartsT from '@/components/highcharts-t.vue'
|
|
|
+import highchartsH from '@/components/highcharts-h.vue'
|
|
|
+
|
|
|
import {
|
|
|
deleteTaskData,
|
|
|
editTaskData,
|
|
@@ -146,6 +145,7 @@ import DeleteClass from './DeleteTaskClass.vue';
|
|
|
import { dateFormat } from 'highcharts';
|
|
|
import { TimeDate } from '@/plugin/timeFun';
|
|
|
import { useMessage } from "naive-ui";
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
|
const formatted = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
@@ -159,8 +159,6 @@ const task = window.sessionStorage.getItem('task')
|
|
|
? JSON.parse(window.sessionStorage.getItem('task'))
|
|
|
: {};
|
|
|
|
|
|
-const chart1 = ref(null);
|
|
|
-const chart2 = ref(null);
|
|
|
|
|
|
// Modal 数据源
|
|
|
const modal = reactive({
|
|
@@ -209,10 +207,13 @@ const queryData = reactive({
|
|
|
T_task_id: task.T_task_id,
|
|
|
T_sn: '',
|
|
|
T_id: '',
|
|
|
- Time_start: '2023-04-18 07:14:00',
|
|
|
- Time_end: '2023-04-18 07:25:00',
|
|
|
- // Time_start: '',
|
|
|
- // Time_end: '',
|
|
|
+ // Time_start: '2023-04-18 07:14:00',
|
|
|
+ // Time_end: '2023-04-18 07:25:00',
|
|
|
+ // Time_start: '2023-04-06 23:50:00',
|
|
|
+ // Time_end: '2023-04-07 00:00:00',
|
|
|
+
|
|
|
+ Time_start: '',
|
|
|
+ Time_end: '',
|
|
|
page: 1,
|
|
|
page_z: 9999,
|
|
|
});
|
|
@@ -225,7 +226,7 @@ const getClassList = async () => {
|
|
|
};
|
|
|
getClassList();
|
|
|
|
|
|
-
|
|
|
+const resData = ref()
|
|
|
//渲染按钮
|
|
|
const renderFun = async () => {
|
|
|
if(checkValues.value==null){
|
|
@@ -238,7 +239,7 @@ const renderFun = async () => {
|
|
|
queryData.T_id = checkValues.value[i].T_id;
|
|
|
queryData.T_sn = checkValues.value[i].T_sn;
|
|
|
const resIt = await getDataList();
|
|
|
- console.log('/*/*/',resIt)
|
|
|
+ resData.value = resIt
|
|
|
arr.push(convertDataFun(resIt.data.Data.List))
|
|
|
}
|
|
|
dataList.value = arr
|
|
@@ -262,7 +263,8 @@ const deleteTask = async () => {
|
|
|
|
|
|
// 编辑
|
|
|
const editTask = async () => {
|
|
|
- console.log(tabValue.value, dataInfo.value)
|
|
|
+ console.log('88',tabValue.value, dataInfo.value,formValue.T_t,formValue.T_rh)
|
|
|
+ // return
|
|
|
const { data: res } = await editTaskData({
|
|
|
T_task_id: queryData.T_task_id,
|
|
|
Id: dataInfo.value[5],
|
|
@@ -283,10 +285,17 @@ const convertDataFun = (array) => {
|
|
|
data: [],
|
|
|
events: {
|
|
|
click(e) {
|
|
|
- formValue.T_t = e.point.y
|
|
|
+ console.log('点击',e.point.x)
|
|
|
+ time.value = e.point.x
|
|
|
+ if(tabChart.value == '温度'){
|
|
|
+ formValue.T_t = e.point.y
|
|
|
+ }else{
|
|
|
+ formValue.T_rh = e.point.y
|
|
|
+ }
|
|
|
+ // formValue.T_t = e.point.y
|
|
|
modal.showModal = true
|
|
|
queryData.T_id = e.point.series.name;
|
|
|
- modal.title = '温度';
|
|
|
+ modal.title = tabChart.value == '温度'?'温度':'湿度';
|
|
|
let serName = e.point.series.name
|
|
|
const b = dataList.value.find(item => item.name == serName)
|
|
|
dataInfo.value = b.data[e.point.index];
|
|
@@ -297,7 +306,7 @@ const convertDataFun = (array) => {
|
|
|
let arr = array.reverse()
|
|
|
objData.name = arr[0].T_sn
|
|
|
arr.forEach(item => {
|
|
|
- objData.data.push([new Date(item.T_time).getTime(), item.T_t, item.T_rh, item.T_sn, item.T_id, item.ID])
|
|
|
+ objData.data.push([new Date(item.T_time).getTime(), tabChart.value=='温度'?item.T_t:item.T_rh, tabChart.value=='温度'?item.T_rh:item.T_t, item.T_sn, item.T_id, item.ID])
|
|
|
});
|
|
|
} else {
|
|
|
objData.data = []
|
|
@@ -359,171 +368,18 @@ const checkValues = ref(null);
|
|
|
// tab
|
|
|
const tabChart = ref('温度');
|
|
|
|
|
|
-const handleTabChange = (value) => {
|
|
|
- tabValue.value = value
|
|
|
- checkValues.value = [];
|
|
|
- checked.value = false;
|
|
|
-};
|
|
|
-
|
|
|
-//
|
|
|
-const handleSet = (data) => {
|
|
|
- if (tabChart.value === '温度') {
|
|
|
- chart1.value.chart.yAxis[0].addPlotLine({
|
|
|
- color: 'red',
|
|
|
- width: 2,
|
|
|
- value: data.tTop,
|
|
|
- label: {
|
|
|
- text: `上限(${data.tTop})`,
|
|
|
- },
|
|
|
- });
|
|
|
- chart1.value.chart.yAxis[0].addPlotLine({
|
|
|
- color: 'red',
|
|
|
- width: 2,
|
|
|
- value: data.tBottom,
|
|
|
- label: {
|
|
|
- text: `下限(${data.tBottom})`,
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- chart2.value.chart.yAxis[0].addPlotLine({
|
|
|
- color: 'red',
|
|
|
- width: 2,
|
|
|
- value: data.hTop,
|
|
|
- label: {
|
|
|
- text: `上限(${data.hTop})`,
|
|
|
- },
|
|
|
- });
|
|
|
- chart2.value.chart.yAxis[0].addPlotLine({
|
|
|
- color: 'red',
|
|
|
- width: 2,
|
|
|
- value: data.hBottom,
|
|
|
- label: {
|
|
|
- text: `下限(${data.hBottom})`,
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
+const handleTabChange = (e) => {
|
|
|
+ tabValue.value = e
|
|
|
+ // console.log('切换',resData.value,tabValue.value,e)
|
|
|
+ renderFun()
|
|
|
+
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
-const selectedValue = ref([]);
|
|
|
-
|
|
|
|
|
|
const temporalInterval = ref('');
|
|
|
|
|
|
-// 图表配置
|
|
|
-const chartOptions1 = {
|
|
|
- xAxis: {
|
|
|
- labels: {
|
|
|
- format: '{value:%Y-%m-%d %H:%M:%S}',
|
|
|
- },
|
|
|
- },
|
|
|
- time: {
|
|
|
- useUTC: false
|
|
|
- },
|
|
|
- boost: {
|
|
|
- useGPUTranslations: true
|
|
|
- },
|
|
|
-
|
|
|
- tooltip: {
|
|
|
- xDateFormat: '%Y-%m-%d %H:%M:%S',
|
|
|
- // headerFormat: '<small class="headerFormat">{.key}:{point.stackTotal}</small><table>',
|
|
|
- // valueDecimals: 0 //会导致提示框内容显示错误
|
|
|
-
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- labels: {
|
|
|
- format: '{text}℃',
|
|
|
- },
|
|
|
- plotLines: [],
|
|
|
- },
|
|
|
-
|
|
|
- legend: {
|
|
|
- enabled: true,
|
|
|
- },
|
|
|
-
|
|
|
- accessibility: {
|
|
|
- enabled: false,
|
|
|
- },
|
|
|
-
|
|
|
- boost: {
|
|
|
- useGPUTranslations: true,
|
|
|
- seriesThreshold: 5,
|
|
|
- },
|
|
|
-
|
|
|
- scrollbar: {
|
|
|
- enabled: false,
|
|
|
- },
|
|
|
-
|
|
|
- // tooltip: {
|
|
|
- // formatter() {
|
|
|
- // return `${this.y} ${dateFormat('%Y-%m-%d %H:%M:%S', this.x)}`;
|
|
|
- // },
|
|
|
- // },
|
|
|
-
|
|
|
- chart: {
|
|
|
- zooming: {
|
|
|
- singleTouch: true,
|
|
|
- resetButton: {},
|
|
|
- type: 'xy',
|
|
|
- },
|
|
|
- events: {
|
|
|
- selection(event) {
|
|
|
- // console.log(
|
|
|
- // dateFormat('%Y-%m-%d %H:%M', event.xAxis[0].min),
|
|
|
- // dateFormat('%Y-%m-%d %H:%M', event.xAxis[0].max)
|
|
|
- // );
|
|
|
- if (event.xAxis) {
|
|
|
- console.log('时间区间选择', event.xAxis)
|
|
|
- temporalInterval.value = [
|
|
|
- dateFormat('%Y-%m-%d %H:%M', event.xAxis[0].min),
|
|
|
- dateFormat('%Y-%m-%d %H:%M', event.xAxis[0].max),
|
|
|
- ];
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- series: [],
|
|
|
-};
|
|
|
-const chartOptions2 = {
|
|
|
- xAxis: {
|
|
|
- labels: {
|
|
|
- format: '{value:%Y-%m-%d %H:%M:%S}',
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- yAxis: {
|
|
|
- labels: {
|
|
|
- format: '{text}%',
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- legend: {
|
|
|
- enabled: true,
|
|
|
- },
|
|
|
-
|
|
|
- accessibility: {
|
|
|
- enabled: false,
|
|
|
- },
|
|
|
-
|
|
|
- boost: {
|
|
|
- useGPUTranslations: true,
|
|
|
- seriesThreshold: 5,
|
|
|
- },
|
|
|
-
|
|
|
- scrollbar: {
|
|
|
- enabled: false,
|
|
|
- },
|
|
|
-
|
|
|
- chart: {
|
|
|
- zoomType: 'xy',
|
|
|
- },
|
|
|
-
|
|
|
- series: [],
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
|