riku
2024-09-09 dc4ba8076aebd30f33282121a414262b4d4919f4
1. 编写设备匹配功能
已修改4个文件
已添加4个文件
111 ■■■■■ 文件已修改
.env 补丁 | 查看 | 原始文档 | blame | 历史
.env.development 补丁 | 查看 | 原始文档 | blame | 历史
.env.production 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/search-option/FYSearchBar.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/constants/menu.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/config/DeviceMatch.vue 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env
.env.development
.env.production
src/api/index.js
@@ -13,7 +13,7 @@
if (debug) {
  ip1 = 'http://192.168.0.138:8082/';
  // ip1_file = 'http://47.100.191.150:9005/';
  // ip2 = 'http://192.168.0.138:8080/';
  ip2 = 'http://192.168.0.138:8080/';
  // ip2_file = 'https://fyami.com.cn/';
}
@@ -38,17 +38,21 @@
  i.interceptors.request.use(
    function (config) {
      // åœ¨å‘送请求之前做些什么
      if (import.meta.env.DEV) {
      console.log('==>请求开始');
      console.log(`${config.baseURL}${config.url}`);
      if (config.data) {
        console.log('==>请求数据', config.data);
      }
      }
      return config;
    },
    function (error) {
      // å¯¹è¯·æ±‚错误做些什么
      if (import.meta.env.DEV) {
      console.log('==>请求开始');
      console.log(error);
      }
      ElMessage({
        message: error,
        type: 'error'
@@ -62,8 +66,10 @@
    function (response) {
      // 2xx èŒƒå›´å†…的状态码都会触发该函数。
      // å¯¹å“åº”数据做点什么
      if (import.meta.env.DEV) {
      console.log(response);
      console.log('==>请求结束');
      }
      if (response.status == 200) {
        if (response.data.success != undefined && response.data.success != null) {
          if (response.data.success == true) {
@@ -85,8 +91,10 @@
    function (error) {
      // è¶…出 2xx èŒƒå›´çš„状态码都会触发该函数。
      // å¯¹å“åº”错误做点什么
      if (import.meta.env.DEV) {
      console.log(error);
      console.log('==>请求结束');
      }
      ElMessage({
        message: error,
        type: 'error'
src/components/search-option/FYSearchBar.vue
@@ -2,7 +2,7 @@
  <el-form :inline="true">
    <slot name="options"></slot>
    <el-form-item>
      <el-button icon="Search" type="primary" @click="search">{{ btnText }}</el-button>
      <el-button icon="Search" type="primary" :loading="loading" @click="search">{{ btnText }}</el-button>
      <slot name="buttons"></slot>
    </el-form-item>
  </el-form>
@@ -14,13 +14,14 @@
    btnText: {
      type: String,
      default: '查询'
    }
    },
    loading: Boolean
  },
  emits: ['search'],
  methods: {
    search() {
      this.$emit('search')
      this.$emit('search');
    }
  }
}
};
</script>
src/constants/menu.js
@@ -54,6 +54,11 @@
        icon: 'List',
        name: '监管问题',
      },
      {
        path: '/fysp/config/deviceMatch',
        icon: 'List',
        name: '设备匹配',
      },
    ],
  },
  {
src/router/index.js
@@ -78,6 +78,12 @@
    component: () => import('@/views/fysp/config/ProblemType.vue')
  },
  {
    //设备匹配
    name: 'fyspDeviceMatch',
    path: '/fysp/config/deviceMatch',
    component: () => import('@/views/fysp/config/DeviceMatch.vue')
  },
  {
    //评估数据源
    name: 'fyspEvalutationTask',
    path: '/fysp/evaluation/evalutationTask',
src/views/fysp/config/DeviceMatch.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
<template>
  <FYTable @search="onSearch" :pagination="true" ref="tableRef">
    <template #options>
      <!-- åŒºåŽ¿ -->
      <FYOptionLocation
        :allOption="false"
        :level="3"
        :checkStrictly="false"
        v-model:value="formSearch.locations"
      ></FYOptionLocation>
      <!-- åœºæ™¯ç±»åž‹ -->
      <FYOptionScene
        :allOption="false"
        :type="2"
        v-model:value="formSearch.scenetype"
      ></FYOptionScene>
      <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime>
    </template>
    <template #buttons> </template>
    <template #options-expand>
      <el-form :inline="true">
        <CompQuickSet @quick-set="setOptions"></CompQuickSet>
      </el-form>
    </template>
    <template #table-column>
      <el-table-column prop="sceneName" :show-overflow-tooltip="true" label="名称">
      </el-table-column>
    </template>
  </FYTable>
</template>
<script setup>
/**
 * ç›‘测设备和场景匹配记录管理
 */
import dayjs from 'dayjs';
import { ref, reactive, computed, getCurrentInstance } from 'vue';
import userMapApi from '@/api/fysp/userMapApi';
import CompQuickSet from '@/views/fysp/evaluation/components/CompQuickSet.vue';
const { $fm } = getCurrentInstance().appContext.config.globalProperties;
const tableRef = ref();
const formSearch = reactive({
  locations: {},
  scenetype: {},
  time: dayjs().add(-1, 'M').date(1).toDate()
});
const area = computed(() => {
  return {
    provincecode: formSearch.locations.pCode,
    provincename: formSearch.locations.pName,
    citycode: formSearch.locations.cCode,
    cityname: formSearch.locations.cName,
    districtcode: formSearch.locations.dCode,
    districtname: formSearch.locations.dName,
    towncode: formSearch.locations.tCode,
    townname: formSearch.locations.tName,
    starttime: $fm.formatYMDH(formSearch.time),
    scensetypeid: formSearch.scenetype.value,
    online: true,
    // æ­¤å¤„数据来源固定为飞羽监管系统
    sourceType: 2
  };
});
function onSearch(page, func) {
  userMapApi.fetchDeviceMap(area.value).then((res) => {
    func({ data: res.data });
  });
}
function setOptions(param) {
  formSearch.locations = param.locations;
  formSearch.scenetype = param.scenetype;
  // formSearch.sourceType = param.sourceType;
  tableRef.value.onSearch();
}
</script>