潘志宝
2024-10-29 c4b4d2d8acf0ecd37a9cc6650f5c5d9f0343725b
PointChart
已修改5个文件
109 ■■■■ 文件已修改
src/api/data/da/point/daPointChart.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/dict.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/data/point/DaPointChart.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/data/point/DaPointForm.vue 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/data/point/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/data/da/point/daPointChart.ts
@@ -8,7 +8,7 @@
// 查询chart列表
export const getPointDaChart = (data: DaPointChartReqVO) => {
  return request.post({ url: '/data/api/data/point/history', data })
  return request.post({ url: '/data/api/query-points/chart', data })
}
//导出DaPointValue
src/utils/dict.ts
@@ -179,7 +179,7 @@
  COM_IS_INT = 'com_is_int',
  DATA_POINT_TYPE = 'data_point_type',
  MINFREQID = 'minfreqid',
  VALUETYPE = 'value_type',
  MEASURE_VALUE_TYPE = 'measure_value_type',
  NVR_ONLINE_STATUS = 'nvr_online_status',
  CAMERA_BRAND = 'camera_brand',
}
src/views/data/point/DaPointChart.vue
@@ -63,9 +63,9 @@
    endTime: undefined,
  });
  const queryParams = reactive({
    pointNo: "",
    start: undefined,
    end: undefined,
    codes: [],
    startDate: undefined,
    endDate: undefined,
  })
  function getYMDHMS() {
    let timestamp = new Date().getTime();
@@ -119,34 +119,27 @@
    visible.value = true;
    if (dataForm.value.id) {
      try {
        queryParams.pointNo=dataForm.value.pointNo;
        queryParams.start = dataForm.value.startTime;
        queryParams.end = dataForm.value.endTime;
        queryParams.codes=[dataForm.value.pointNo];
        queryParams.startDate = dataForm.value.startTime;
        queryParams.endDate = dataForm.value.endTime;
        const data = await DaPoint.getPointDaChart(queryParams)
        const dataList = [];
        const xAxisData = [];
        data[dataForm.value.pointNo].forEach(function (value) {
          // 判断数据是否为布尔型
          if (typeof value["value"] === "boolean") {
            value["value"] = value["value"]? 1 : 0;
          }
          dataList.push([value["time"], value["value"]]);
          xAxisData.push(value["time"]);
        });
        let seriesData = [];
        seriesData.push({
          name: "采集值",
          type: "line",
          data: dataList,
          showSymbol: false,
          smooth: false,
          lineStyle: {
            normal: {
              color: "#5B8FF9",
              width: 1,
        let seriesData = []
        data.series.forEach(item => {
          seriesData.push({
            name: item.name,
            type: "line",
            data: item.data,
            showSymbol: true,
            smooth: false,
            lineStyle: {
              normal: {
                color: "#5B8FF9",
                width: 1,
              },
            },
          },
        });
          });
        })
        myChart = echarts.init(chartDom.value);
        const option = {
          title: {
@@ -182,7 +175,7 @@
          xAxis: {
            type: "category",
            boundaryGap: false,
            data: xAxisData,
            data: data.categories,
          },
          yAxis: {
            type: "value",
@@ -194,7 +187,6 @@
          ],
          series: seriesData,
        };
        myChart.clear();
        myChart.setOption(option);
      } catch (error) {
        console.error(error)
src/views/data/point/DaPointForm.vue
@@ -1,5 +1,5 @@
<template>
  <Dialog v-model="dialogVisible" :title="dialogTitle" width="50%">
  <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
    <el-form
      ref="formRef"
      v-loading="formLoading"
@@ -137,14 +137,14 @@
      </el-row>
      <el-row v-if="formData.pointType === 'MEASURE'">
        <el-col :span="12">
          <el-form-item label="值类型" prop="valueType">
          <el-form-item label="测量值类型" prop="measurePoint.valueType">
            <el-select
              v-model="formData.measurePoint.valueType"
              clearable
              placeholder="请选择值类型"
            >
              <el-option
                v-for="dict in getDictOptions(DICT_TYPE.VALUETYPE)"
                v-for="dict in getDictOptions(DICT_TYPE.MEASURE_VALUE_TYPE)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
@@ -153,8 +153,10 @@
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="平滑尺度" prop="dimension">
            <el-input-number v-model="formData.measurePoint.dimension" style="width: 100%" :controls="false"/>
          <el-form-item label="平滑尺度(min)" prop="measurePoint.dimension">
            <el-input-number v-model="formData.measurePoint.dimension" style="width: 100%"
                             :min="0" :max="100"
                             :controls="false"/>
          </el-form-item>
        </el-col>
      </el-row>
@@ -166,11 +168,11 @@
              :data="expressionList"
              border
              style="width: 100%">
<!--              <el-table-column
              <el-table-column
                type="index"
                align="center"
                width="50"
                label="序号"/>-->
                width="60"
                label="序号"/>
              <el-table-column
                prop=""
                label="左括号"
@@ -194,6 +196,7 @@
              <el-table-column
                prop=""
                label="测点"
                min-width="160"
                align="center">
                <template #default="scope">
                  <el-select
@@ -211,6 +214,7 @@
              <el-table-column
                prop=""
                label="运算值"
                min-width="120"
                align="center">
                <template #default="scope">
                  <el-input
@@ -243,7 +247,7 @@
              <el-table-column
                prop=""
                label="运算符"
                width="120"
                width="100"
                align="center">
                <template #default="scope">
                  <el-select v-model="scope.row.operator" clearable>
@@ -258,19 +262,19 @@
              <el-table-column
                prop=""
                label="操作"
                width="140"
                width="120"
                align="center">
                <template #default="scope">
                  <el-button
                    @click="addExpressionRow(scope.$index, expressionList)"
                    type="text"
                    size="small">
                    size="mini">
                    添加
                  </el-button>
                  <el-button
                    @click="deleteExpressionRow(scope.$index, expressionList)"
                    type="text"
                    size="small">
                    size="mini">
                    删除
                  </el-button>
                </template>
@@ -345,6 +349,9 @@
  pointName: [{required: true, message: '测点名称不能为空', trigger: 'blur'}],
  pointType: [{required: true, message: '测点类型不能为空', trigger: 'blur'}],
  dataType: [{required: true, message: '数据类型不能为空', trigger: 'blur'}],
  minfreqid: [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
  "measurePoint.valueType": [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
  "measurePoint.dimension": [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
})
const formRef = ref() // 表单 Ref
@@ -438,8 +445,8 @@
    storeType: undefined,
    unit: undefined,
    unittransfactor: 1,
    defaultValue: 10,
    maxValue: 10000000,
    defaultValue: 0,
    maxValue: 100000000,
    minValue: 0,
    minfreqid: undefined,
    remark: undefined,
src/views/data/point/index.vue
@@ -77,7 +77,7 @@
  <!-- 列表 -->
  <ContentWrap>
    <el-table border stripe v-loading="loading" :data="list">
      <el-table-column fixed label="测点编码" header-align="center" align="left" min-width="100" prop="pointNo" />
      <el-table-column fixed label="测点编码" header-align="center" align="left" min-width="120" prop="pointNo" />
      <el-table-column label="测点名称" header-align="center" align="left" min-width="200" prop="pointName" />
      <el-table-column label="测点类型" align="center" prop="pointType" width="100">
        <template #default="scope">
@@ -94,12 +94,12 @@
          <dict-tag :type="DICT_TYPE.VALUETYPE" :value="scope.row.valueType" />
        </template>
      </el-table-column>
      <el-table-column label="测量单位" align="center" prop="unit" width="100"/>
      <el-table-column label="测量单位" align="center" prop="unit" width="80"/>
      <el-table-column label="单位转换" align="center" prop="unittransfactor" />
      <el-table-column label="默认值" align="center" prop="defaultValue" />
      <el-table-column label="默认值" align="center" prop="defaultValue" width="100"/>
      <el-table-column label="采集频率" align="center" prop="minfreqid" width="100"/>
      <el-table-column label="数据源类型" align="center" prop="sourceType" width="100"/>
      <el-table-column label="数据源名称" align="center" prop="sourceName" width="100"/>
      <el-table-column label="数据源类型" align="center" prop="sourceType" min-width="100"/>
      <el-table-column label="数据源名称" align="center" prop="sourceName" min-width="100"/>
      <el-table-column label="测点Tag" header-align="center" align="left" prop="tagNo" min-width="150"/>
      <el-table-column label="是否启用" align="center" prop="isEnable" width="100">
        <template #default="scope">
@@ -108,19 +108,21 @@
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" min-width="130" fixed="right" width="120">
      <el-table-column label="操作" align="center" min-width="130" fixed="right" width="160">
        <template #default="scope">
          <el-button
            link
            size="mini"
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['data:point:update']"
          >
            编辑
          </el-button>
          <el-button link type="primary" @click="chartHandle(scope.row)">数据查看</el-button>
          <el-button link size="mini" type="primary" @click="chartHandle(scope.row)">数据</el-button>
          <el-button
            link
            size="mini"
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['data:point:delete']"