zxl
2026-03-20 155dbc01da52ccee7a968bfe7297b5fc0357e6bb
Merge remote-tracking branch 'origin/show-demo' into show_demo
4个文件已修改
145 ■■■■■ 已修改文件
src/components/menu/index.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/Analysis.vue 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/jyz/CameraList.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/menu/index.js
@@ -112,6 +112,7 @@
      return null
    },
    renderMenuItem(menu) {
      // === 注释掉机构类型限制,只要配置了权限就能看到菜单 ===
      let userDepartCategory = JSON.parse(localStorage.getItem("userDepartInfo")).orgCategory
      if(userDepartCategory==3){
        if(menu.meta.title=='运营分析(机构)'||menu.meta.title=='告警分析(机构)'){
@@ -131,6 +132,7 @@
          menu = Object.assign(menu, { hidden: true })
        }
      }
      // === 机构类型限制注释结束 ===
      const target = menu.meta.target || null
      let tag = target && 'a' || 'router-link'
      let props = { to: { name: menu.name } }
@@ -169,7 +171,7 @@
          this.selectedKeys=this.chooseKeys.length?this.chooseKeys:['/dashboard/analysis']
        }, 100);
      }
    },
    renderSubMenu(menu) {
      const itemArr = []
src/views/dashboard/Analysis.vue
@@ -17,7 +17,7 @@
            placeholder="请选择终端设备"
            style="width: 200px"
            v-model="selectCameraCode"
            @change="alarmLogInit"
            @change="onCameraChange"
          >
            <a-select-option :value="''" :key="''">全部</a-select-option>
            <a-select-option :value="item.code" v-for="item in cameraList" :key="item.code">
@@ -111,7 +111,7 @@
    AnalysisDetailModal,
  },
  data() {
    data() {
    return {
      selectOrg: '',
      show: false,
@@ -122,16 +122,14 @@
      cameraList: [],
      selectCameraCode: '',
      videoConfig: {
        variable: 'player', //播放函数名称,该属性必需设置,值等于下面的new ckplayer()的对象
        // live: true,
        variable: 'player',
        backLive: false,
        track: null, //字幕
        track: null,
        crossorigin: '',
        playbackrateOpen: true,
        autoplay: true,
        loop: true, //是否需要循环播放
        video: 'https://ckplayer-video.oss-cn-shanghai.aliyuncs.com/mp4/1_640x480.mp4', //视频地址,
        // loaded: "loadedHandler", //播放器加载完成后调用该函数
        loop: true,
        video: '',
      },
      categoryOptions: [
        {
@@ -160,6 +158,8 @@
      url: {
        list: '/jyz/oilEvent/eventList',
        eventPopup: '/jyz/oilEvent/eventPopup',
        localVideoRandom: '/jyz/video/random',
        randomImages: '/jyz/video/random-images',
      },
    }
  },
@@ -176,25 +176,56 @@
  mounted() {
    // this.one_video_ckplayera()
    this.getCameraList()
    this.getLocalVideo()
    this.timer = setInterval(this.playAudio, 30000)
  },
  methods: {
    // 获取本地随机视频
    getLocalVideo() {
      getAction(this.url.localVideoRandom).then((res) => {
        if (res.code === 200 && res.result) {
          this.hasVideo = true
          this.eventVideoPlay(res.result)
        }
      })
    },
    assignRandomImages(recordList) {
      if (!recordList || !recordList.length) {
        return Promise.resolve([])
      }
      return getAction(this.url.randomImages, { count: recordList.length })
        .then((imageRes) => {
          if (imageRes.code === 200 && Array.isArray(imageRes.result) && imageRes.result.length) {
            return recordList.map((item, index) => {
              return {
                ...item,
                imgPath: imageRes.result[index % imageRes.result.length],
              }
            })
          }
          return recordList
        })
        .catch(() => recordList)
    },
    // Alarm Log 告警记录
    alarmLogInit(isFirst) {
      getAction(this.url.list, { limit: 20, cameraCode: this.selectCameraCode }).then((res) => {
        if (res.code === 200) {
          this.takeList = res.result
          if (res.result.length > 0 && isFirst) {
            if (res.result[0].videoPath) {
              this.hasVideo = true
              this.eventVideoPlay(res.result[0].videoPath)
            } else {
              this.hasVideo = false
              this.player && this.player.remove()
          const sourceList = Array.isArray(res.result) ? res.result : []
          this.assignRandomImages(sourceList).then((finalList) => {
            this.takeList = finalList
            if (finalList.length > 0 && isFirst) {
              if (finalList[0].videoPath) {
                this.hasVideo = true
                this.eventVideoPlay(finalList[0].videoPath)
              } else {
                this.hasVideo = false
                this.player && this.player.remove()
              }
            }
          }
          })
        } else {
          this.$message.error('获取失败!')
        }
@@ -230,12 +261,16 @@
      this.videoConfig.video = video
      this.player && this.player.remove()
      var videoObject = {
        ...this.videoConfig, // 通用配置
        container: '.one_video', //“#”代表容器的ID,“.”或“”代表容器的class
        ...this.videoConfig,
        container: '.one_video',
      }
      this.player = new ckplayer(videoObject) //初始化播放器
      this.player = new ckplayer(videoObject)
    },
    handleScroll() {},
    onCameraChange() {
      this.alarmLogInit(false)
      this.getLocalVideo()
    },
    onTreeNodeSelect(id, node) {
      this.selectOrg = node.selectedNodes[0].data.props.orgCode
      console.log(id, this.selectOrg)
src/views/jyz/CameraList.vue
@@ -31,35 +31,8 @@
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-space>
                <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                <!--<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
                <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
                <!--<a-button type="primary" icon="download" @click="handleExportXls('Camera')">导出</a-button>-->
                <!--<a-button type="primary" icon="upload" @click="showImport">导入</a-button>-->
                <!--<j-import-modal ref="importModal" :url="url.importXlsUrl" @ok="handleImportExcel"></j-import-modal>-->
                <!--<a-upload-->
                <!--name="file"-->
                <!--:showUploadList="false"-->
                <!--:headers="tokenHeader"-->
                <!--:action="getImportXlsUrl"-->
                <!--@change="handleImportExcel"-->
                <!--&gt;-->
                <!--<a-button type="primary" icon="upload">-->
                <!--批量导入-->
                <!--</a-button>-->
                <!--</a-upload>-->
                <!--<a-dropdown v-if="selectedRowKeys.length > 0">-->
                <!--<a-menu slot="overlay">-->
                <!--<a-menu-item key="1" @click="batchDel">-->
                <!--<a-icon type="delete" />-->
                <!--删除-->
                <!--</a-menu-item>-->
                <!--</a-menu>-->
                <!--<a-button style="margin-left: 8px">-->
                <!--批量操作-->
                <!--<a-icon type="down" />-->
                <!--</a-button>-->
                <!--</a-dropdown>-->
                <a-button type="primary" @click="handleAdd" icon="plus">新增</a-button>
                <a-button type="primary" icon="download" @click="handleExportXls('Camera')">导出</a-button>
              </a-space>
            </a-col>
          </span>
vue.config.js
@@ -1,6 +1,7 @@
const path = require('path')
const CompressionPlugin = require('compression-webpack-plugin')
const GenerateFilePlugin = require('generate-file-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
function resolve(dir) {
  return path.join(__dirname, dir)
@@ -20,6 +21,15 @@
  // 打包app时放开该配置
  // publicPath:'./',
  configureWebpack: config => {
    // 复制 video-test 文件夹到 public 目录 (已注释,不再自动复制)
    // config.plugins.push(
    //   new CopyWebpackPlugin([{
    //     from: path.resolve(__dirname, '../video-test'),
    //     to: 'video-test',
    //     ignore: ['.*']
    //   }])
    // )
    // 生产环境取消 console.log
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
@@ -101,18 +111,17 @@
  devServer: {
    port: 10086,
    open: true,
    host:"0.0.0.0"
    // public: '25.30.13.141:3000'
    // proxy: {
    //   '/cube': {
    //     target: 'http://localhost:8080', // 请求本地 cube后台项目
    //     ws: false,
    //     changeOrigin: true,
    //     pathRewrite: {
    //       '/cube': '' // 默认所有请求都加了cube前缀,需要去掉
    //     }
    //   }
    // }
    host:"0.0.0.0",
    proxy: {
      '/cube': {
        target: 'http://localhost:8080',
        ws: false,
        changeOrigin: true,
        pathRewrite: {
          '/cube': ''
        }
      }
    }
  },
  lintOnSave: undefined