yangfeng
2024-02-02 3a4b094461e11002287a667b8bea49b362a2fc6f
config配置修改、获取任务列表、设备列表、获取问题列表接口联调
4个文件已修改
86 ■■■■ 已修改文件
src/api/index.ts 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/components/DashboardTitle.vue 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.ts
@@ -36,7 +36,7 @@
 */
export function getTaskList(params: TaskListParams) {
  return request<BaseResponse<TasksGroupByChannel>>({
    url: '/v1/task/list',
    url: '/api-s/v1/reportWork/taskList',
    method: 'get',
    params
  })
@@ -111,7 +111,7 @@
 */
export function getDeviceList() {
  return request<BaseResponse<Devices>>({
    url: `/v1/device/list`,
    url: `/api-s/v1/reportWork/deviceList`,
    method: 'get'
  })
}
@@ -183,12 +183,12 @@
/**
 * 获取问题诊断问题列表
 */
export function apiGetProblemList() {
  return request<BaseResponse<Problem[]>>({
    url: '/v1/system/problemList',
    method: 'get'
  })
}
// export function apiGetProblemList() {
//   return request<BaseResponse<Problem[]>>({
//     url: '/v1/system/problemList',
//     method: 'get'
//   })
// }
export interface ReportingRecordListParams {
  page?: number
src/views/dashboard/components/DashboardTitle.vue
@@ -61,7 +61,7 @@
import IconCloudOff from '~icons/material-symbols-light/cloud-off-outline'
import IconSlider from '~icons/bx/slider'
import { useRequest } from 'vue-hooks-plus'
import { apiGetProblemList } from '@/api'
// import { apiGetProblemList } from '@/api'
import { PROBLEMS_POLLING_DURATION } from '@/common/constants'
import { Setting } from '@element-plus/icons-vue'
import DeliverParamsConfigModal from '@/views/dashboard/components/DeliverParamsConfigModal.vue'
@@ -101,7 +101,8 @@
// 问题诊断列表
const problemList = computed(() => {
  return problemsRes?.value?.data ?? []
  // return problemsRes?.value?.data ?? []
  return []
})
// 问题诊断icon状态, 问题列表中有一条异常即为红灯 否则是绿灯  true绿灯
const problemsIconStatus = computed(() => {
@@ -109,7 +110,8 @@
    // 默认绿灯, 拿到一次数据后才以接口为准
    return true
  }
  return !problemList.value.some((ele) => !ele.CheckResult)
  // return !problemList.value.some((ele) => !ele.CheckResult)
  return false
})
// 云端连接icon状态, 问题列表中有一条代表云端链接的, 异常即为红色云icon 否则是绿色  true绿云
const cloudConnectionIconStatus = computed(() => {
@@ -118,8 +120,9 @@
    return true
  }
  // 没数据就当是链接正常
  const cloudConnection = problemList.value.find((ele) => ele.ItemCode === 'cloud')
  return cloudConnection ? cloudConnection?.CheckResult : true
  // const cloudConnection = problemList.value.find((ele) => ele.ItemCode === 'cloud')
  // return cloudConnection ? cloudConnection?.CheckResult : true
  return false
})
// 配置下发参数弹窗
@@ -133,19 +136,19 @@
/**
 * 轮询问题诊断
 */
const {
  data: problemsRes,
  run: startProblemsPolling,
  cancel: cancelProblemsPolling
} = useRequest(apiGetProblemList, {
  manual: true,
  pollingInterval: PROBLEMS_POLLING_DURATION,
  pollingWhenHidden: false
})
startProblemsPolling()
onUnmounted(() => {
  cancelProblemsPolling()
})
// const {
//   data: problemsRes,
//   run: startProblemsPolling,
//   cancel: cancelProblemsPolling
// } = useRequest(apiGetProblemList, {
//   manual: true,
//   pollingInterval: PROBLEMS_POLLING_DURATION,
//   pollingWhenHidden: false
// })
// startProblemsPolling()
// onUnmounted(() => {
//   cancelProblemsPolling()
// })
const taskStore = useTasksStore()
src/views/dashboard/index.vue
@@ -75,7 +75,7 @@
      </div>
    </template>
    <template #rightBlock2>
      <DeviceStatusInfo :plc="plcStore.plcInfo" :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :device="deviceStore.deviceInfo" :type="2"></DeviceStatusInfo>
      <DeviceNumberInfo></DeviceNumberInfo>
    </template>
@@ -122,7 +122,7 @@
import TaskControl from '@/views/dashboard/components/TaskControl.vue'
import SubTitle from '@/views/dashboard/components/SubTitle.vue'
import DashboardTitle from '@/views/dashboard/components/DashboardTitle.vue'
import { usePLCStore } from '@/stores/plc'
// import { usePLCStore } from '@/stores/plc'
import { useDevicesStore } from '@/stores/devices'
import { useCraftModelStore } from '@/stores/craftModel'
import CraftDetailModal from '@/views/dashboard/components/CraftDetailModal.vue'
@@ -173,7 +173,7 @@
 */
function reloadChannel(task: Task) {
  tasksStore.reloadChannel(task.Channel).then(() => {
    plcStore.startPollingPLC()
    // plcStore.startPollingPLC()
  })
}
@@ -182,8 +182,8 @@
  location.reload()
}
// 启动plc 轮询
const plcStore = usePLCStore()
plcStore.startPollingPLC()
// const plcStore = usePLCStore()
// plcStore.startPollingPLC()
// 启动 设备 轮询
const deviceStore = useDevicesStore()
deviceStore.startPollingDevice()
vite.config.ts
@@ -16,9 +16,9 @@
export default defineConfig({
  server: {
    proxy: {
      '/v1/': {
      '/api-s/': {
        // http://192.168.20.119:8003 http://192.168.20.25:7010
        target: 'http://192.168.20.119:8003',
        target: 'http://192.168.20.120:9081',
        ws: true,
        changeOrigin: true
      }
@@ -27,14 +27,14 @@
  resolve: {
    alias: {
      '@': pathSrc
    },
    }
  },
  
  build: {
    minify:'terser',
    // ,'edge90','firefox90','safari15'
    target:['chrome52'],
    cssTarget:["chrome52"],
    cssTarget: ['chrome52']
  },
  css:{
      postcss:{
@@ -42,12 +42,11 @@
            require('postcss-pxtorem')({
              // ipad:1280-800
              rootValue:160.0, //换算的基数, 屏幕宽度/10
              propList:['*'],//需要转化的属性,*表示所有属性都需要转化
          propList: ['*'] //需要转化的属性,*表示所有属性都需要转化
              // unitPrecision:5
            })
          ]
    }
  },
  plugins: [
    vue(),
@@ -68,10 +67,10 @@
    }),
    // 开发环境兼容
    esbuild({
      target:"chrome64",
      target: 'chrome64',
      loaders:{
        ".vue":'js',
        ".ts":'js'
        '.vue': 'js',
        '.ts': 'js'
      }
    }),
    // 兼容低版本浏览器
@@ -113,8 +112,8 @@
    }),
    Icons({
      autoInstall: true
    }),
  ],
    })
  ]
  // configureWebpack:config=>{
  //   config.entry.app=['babel-polyfill','./src/main.js']
  // },