From 8caf427556921d82c53fb1d54bcf150e79d3def7 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 20 三月 2026 15:23:35 +0800
Subject: [PATCH] 调整

---
 vue.config.js                    |   33 +++++++----
 src/views/jyz/CameraList.vue     |   31 ---------
 src/views/dashboard/Analysis.vue |   77 ++++++++++++++++++-------
 src/components/menu/index.js     |    4 +
 4 files changed, 82 insertions(+), 63 deletions(-)

diff --git a/src/components/menu/index.js b/src/components/menu/index.js
index 7e8a1d3..3c7d629 100644
--- a/src/components/menu/index.js
+++ b/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 = []
diff --git a/src/views/dashboard/Analysis.vue b/src/views/dashboard/Analysis.vue
index 8233f34..4f60f26 100644
--- a/src/views/dashboard/Analysis.vue
+++ b/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)
diff --git a/src/views/jyz/CameraList.vue b/src/views/jyz/CameraList.vue
index a173bd2..8274b77 100644
--- a/src/views/jyz/CameraList.vue
+++ b/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>
diff --git a/vue.config.js b/vue.config.js
index ebe8e06..e3d3c50 100644
--- a/vue.config.js
+++ b/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

--
Gitblit v1.8.0