riku
2025-07-16 c23ac06446a9a1edc41cc13723e5d0b8eabdfd63
2025.7.16 动态溯源新增合并异常
已修改4个文件
143 ■■■■ 文件已修改
src/api/index.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sourcetrace/SourceTrace.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sourcetrace/component/ClueRecordItem.vue 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sourcetrace/component/PollutedExceptionItem.vue 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js
@@ -13,10 +13,10 @@
}
if (debug) {
  // ip1 = 'http://192.168.0.103:8084/';
  ip1 = 'http://localhost:8084/';
  // ws = `192.168.0.103:9031`;
  ws = `localhost:9031`;
  ip1 = 'http://192.168.0.103:8084/';
  // ip1 = 'http://localhost:8084/';
  ws = `192.168.0.103:9031`;
  // ws = `localhost:9031`;
}
const $http = axios.create({
src/views/sourcetrace/SourceTrace.vue
@@ -7,7 +7,7 @@
    "
  >
    <el-col span="2" class="flex-col">
      <el-row justify="end">
      <el-row :justify="direction == 'left' ? 'end' : 'start'">
        <CardButton
          :direction="direction"
          name="动态溯源"
@@ -242,7 +242,7 @@
function dealMsg(data) {
  const { type, content } = websocketMsgParser.parseMsg(data);
  const obj = reactive(JSON.parse(content));
  if (obj[0].deviceCode == props.deviceCode) {
  if (obj.deviceCode == props.deviceCode) {
    obj._type = type;
    dealObj(obj);
  }
src/views/sourcetrace/component/ClueRecordItem.vue
@@ -30,7 +30,9 @@
            round
            class="m-r-4"
          >
            <div v-html="formatFactorName(item.pollutedData.factorName)"></div>
            <div
              v-html="formatFactorName(item.pollutedData.statisticMap)"
            ></div>
          </el-tag>
          <el-text type="info">
            {{ item.pollutedData.exception + ',' }}
@@ -100,7 +102,9 @@
            round
            class="m-r-4"
          >
            <div v-html="formatFactorName(item.pollutedData.factorName)"></div>
            <div
              v-html="formatFactorName(item.pollutedData.statisticMap)"
            ></div>
          </el-tag>
          <el-text type="info">{{ item.pollutedData.exception }}</el-text>
        </div>
@@ -119,22 +123,6 @@
          </div>
        </div>
      </el-col>
      <!-- <el-row justify="space-between">
        <el-space>
          <el-tag type="info" effect="dark" size="small">提醒</el-tag>
          <el-text type="info">{{
            item.pollutedData.startTime + ' - ' + item.pollutedData.endTime
          }}</el-text>
        </el-space>
        <el-link type="info" @click="emits('open', item)"> 详情 </el-link>
      </el-row>
      <el-col :span="24">
        <el-tag effect="plain" type="info" size="small" hit round class="m-r-4">
          <div v-html="formatFactorName(item.pollutedData.factorName)"></div>
        </el-tag>
        <el-text type="info">{{ item.pollutedData.exception }}</el-text>
      </el-col> -->
    </el-row>
  </div>
</template>
@@ -180,27 +168,33 @@
  }
}
function formatFactorName(name) {
  switch (name) {
    case 'PM25':
      return 'PM<sub>2.5</sub>';
    // return '<span>PM2.5</span>';
    case 'PM10':
      return 'PM<sub>10</sub>';
    case 'NO2':
      return 'NO<sub>2</sub>';
    case 'H2S':
      return 'H<sub>2</sub>S';
    case 'SO2':
      return 'SO<sub>2</sub>';
    case 'O3':
      return 'O<sub>3</sub>';
    case 'VOC':
      return 'VOC<sub>s</sub>';
    default:
      break;
function formatFactorName(statisticMap) {
  const mapName = (n) => {
    switch (n) {
      case 'PM25':
        return 'PM<sub>2.5</sub>';
      case 'PM10':
        return 'PM<sub>10</sub>';
      case 'NO2':
        return 'NO<sub>2</sub>';
      case 'H2S':
        return 'H<sub>2</sub>S';
      case 'SO2':
        return 'SO<sub>2</sub>';
      case 'O3':
        return 'O<sub>3</sub>';
      case 'VOC':
        return 'VOC<sub>s</sub>';
      default:
        return '';
    }
  };
  let name = [];
  for (const key in statisticMap) {
    const value = statisticMap[key];
    name.push(mapName(value.factorName));
  }
  return name.join('、');
}
function handleSetCenter(item, scene) {
src/views/sourcetrace/component/PollutedExceptionItem.vue
@@ -52,37 +52,36 @@
            异常类型:{{ item.pollutedData.exception }}
          </el-text>
        </div>
        <el-row style="border-top: 1px solid white">
          <el-col :span="6">
            <el-statistic
              title="突变因子"
              :value="item.pollutedData.factorName"
            />
          </el-col>
          <el-col :span="6">
            <el-statistic
              v-if="item.pollutedData.exceptionType == 4"
              title="变化幅度"
              :value="formatPercentage(item.pollutedData.avgPer)"
            />
            <el-statistic
              v-else-if="item.pollutedData.exceptionType == 9"
              title="变化速率"
              :value="formatChangeRate(item.pollutedData.avgRate)"
              suffix=""
            />
          </el-col>
          <el-col :span="6">
            <el-statistic title="发生次数" :value="item.pollutedData.times" />
          </el-col>
          <el-col :span="6">
            <el-statistic
              title="平均风速"
              :value="item.pollutedData.windSpeed"
              suffix="m/s"
            />
          </el-col>
        </el-row>
        <div v-for="s in item.pollutedData.statisticMap" :key="s">
          <el-row style="border-top: 1px solid white">
            <el-col :span="6">
              <el-statistic title="突变因子" :value="s.factorName" />
            </el-col>
            <el-col :span="6">
              <el-statistic
                v-if="item.pollutedData.exceptionType == 4"
                title="变化幅度"
                :value="formatPercentage(s.avgPer)"
              />
              <el-statistic
                v-else-if="item.pollutedData.exceptionType == 9"
                title="变化速率"
                :value="formatChangeRate(s.avgRate)"
                suffix=""
              />
            </el-col>
            <el-col :span="6">
              <el-statistic title="发生次数" :value="item.pollutedData.times" />
            </el-col>
            <el-col :span="6">
              <el-statistic
                title="平均风速"
                :value="item.pollutedData.windSpeed"
                suffix="m/s"
              />
            </el-col>
          </el-row>
        </div>
        <el-row justify="space-between">
          <!-- <el-link
                    type="info"