Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/dev-security' into dev-security

xiayu3 4 gadi atpakaļ
vecāks
revīzija
1ce75b1ef8

+ 1 - 1
security-protection-platform/src/api/system/index.js

@ -1,6 +1,6 @@
1 1
import http from '@/http'
2 2
import { keysMapping, keysMappingReverse } from '@/utils/keysMapping'
3
const { $default, $http } = http
3
const { $default } = http
4 4
5 5
const mapping = {
6 6
  scheduleId: 'workShiftId',

+ 7 - 1
security-protection-platform/src/api/videoSurveillance/index.js

@ -16,7 +16,7 @@ const api = {
16 16
    return $http.get('/videoSurveillance/getDistinguishData', params)
17 17
  },
18 18
  // 获取监控场景列表
19
  getMonitorScene() {
19
  getMonitorScene () {
20 20
    return $default.get('/sp/monitorSceneManagement/queryPageMonitorScene', 0)
21 21
  },
22 22
  // 视频回放
@ -25,6 +25,12 @@ const api = {
25 25
      resp.data = keysMappingReverse(resp.data, videoMapping)
26 26
      return resp
27 27
    }).catch((err) => { return err })
28
  },
29
  // 根据视频id/图片id查询地址
30
  getFileUrl (id) {
31
    return $default.get(`/sp/uploadFile/getFileUrl?fileName=${id}`).then(resp => {
32
      return resp
33
    }).catch((err) => { return err })
28 34
  }
29 35
}
30 36
export default api

+ 4 - 0
security-protection-platform/src/conf/axios.config.js

@ -40,7 +40,11 @@ const conf = {
40 40
  root: {
41 41
    default: {
42 42
      baseURL: 'http://10.19.90.34:8018'
43
    },
44
    picurl: {
45
      baseURL: 'http://10.19.90.34:19000/tool-image/'
43 46
    }
47
44 48
  }
45 49
}
46 50

+ 2 - 2
security-protection-platform/src/modules/aialarm/index.vue

@ -65,11 +65,11 @@
65 65
      </t-table-column>
66 66
      <t-table-column label="设备位置" prop="monitorSceneName" width="120">
67 67
      </t-table-column>
68
      <t-table-column label="报警时间" prop="aiIdenTime" width="148px">
68
      <t-table-column label="报警时间" prop="aiIdenTime" width="160px">
69 69
      </t-table-column>
70 70
      <t-table-column label="处理人" prop="workEmployeeRoleName" width="70">
71 71
      </t-table-column>
72
      <t-table-column label="处理时间" prop="processTime" width="148px">
72
      <t-table-column label="处理时间" prop="processTime" width="160px">
73 73
      </t-table-column>
74 74
      <t-table-column label="操作">
75 75
        <template slot-scope="scope">

+ 6 - 1
security-protection-platform/src/modules/dashboard/index.vue

@ -221,7 +221,12 @@ export default {
221 221
    },
222 222
    init24Top() {
223 223
      this.topData = dasapi.queryAlarmAnalysisTopList().then(res => {
224
        this.topData = res.data
224
        this.topData = []
225
        for (var i = 0; i < 4; i++) {
226
          if (res.data[i]) {
227
            this.topData.push(res.data[i])
228
          }
229
        }
225 230
      })
226 231
    },
227 232
    initAttendanceData() {

+ 4 - 2
security-protection-platform/src/modules/system/monitor/HomePageSettings/Card.vue

@ -2,7 +2,7 @@
2 2
  <div :class="{ active: showConfirm, lock: loadingDelete }" class="masonry__item div-block">
3 3
    <div :style="{ width: gridWidth }" class="card card-has-shadowed">
4 4
      <div :style="{ height: gridHeight }" class="card-block" style="margin: 0px; padding: 0px">
5
        <img :style="{ height: gridHeight, width: gridWidth }" :src="data.pictureUrl" alt="" />
5
        <img :style="{ height: gridHeight, width: gridWidth }" :src="this.$picurl.defaults.baseURL+data.pictureUrl" alt="" />
6 6
      </div>
7 7
      <div class="opt">
8 8
        <div class="move">拖拽移动</div>
@ -28,6 +28,8 @@
28 28
29 29
<script>
30 30
import UpdateName from './UpdateName'
31
import http from '@/http'
32
const { $picurl } = http
31 33
export default {
32 34
  components: {
33 35
    UpdateName
@ -66,7 +68,7 @@ export default {
66 68
    }
67 69
  },
68 70
  mounted() {
69
71
    //  console.log(this.$picurl.defaults.baseURL)
70 72
  },
71 73
  methods: {
72 74
    handleChangeName: function (name) {

+ 3 - 3
security-protection-platform/src/modules/system/monitor/VideoMonitor/index.vue

@ -12,8 +12,8 @@
12 12
            >
13 13
              <t-option
14 14
                v-for="item in departmentList"
15
                :key="item.code"
16
                :value="item.code"
15
                :key="item.id"
16
                :value="item.id"
17 17
              >{{ item.name }}</t-option
18 18
              >
19 19
            </t-select>
@ -200,7 +200,7 @@ export default {
200 200
      sysapi.getDepartments().then((resp) => {
201 201
        this.departmentList = resp.data.data || []
202 202
        if (this.departmentList.length > 0) {
203
          this.currentWindPlaceValue = this.departmentList[0].code
203
          this.currentWindPlaceValue = this.departmentList[0].id
204 204
          this.getMonitorScene(this.currentWindPlaceValue)
205 205
        }
206 206
      })

+ 8 - 1
security-protection-platform/src/modules/system/monitor/components/ViewCard/index.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <div :class="{ active: showConfirm, lock: loadingDelete }" :style="{ width, height }" class="masonry__item div-block">
3 3
    <div class="card card-has-shadowed card-main">
4
      <div :style="`backgroundImage:url(${data.pictureUrl})`" class="card-bg" />
4
      <div :style="`backgroundImage:url(${this.$picurl.defaults.baseURL+data.pictureUrl})`" class="card-bg" />
5 5
      <div class="opt">
6 6
        <div class="move">拖拽移动</div>
7 7
        <t-button shape="round" icon="swap-outline" style="margin: 0px 2px 0px 2px" @click="handleEdit">替换</t-button>
@ -24,6 +24,9 @@
24 24
25 25
<script>
26 26
import UpdateName from './UpdateName'
27
import http from '@/http'
28
// eslint-disable-next-line no-unused-vars
29
const { $picurl } = http
27 30
export default {
28 31
  components: {
29 32
    UpdateName
@ -40,6 +43,10 @@ export default {
40 43
    height: {
41 44
      type: String,
42 45
      default: '100%'
46
    },
47
    monitorSceneTypeName: {
48
      type: String,
49
      require: true
43 50
    }
44 51
  },
45 52
  data() {

+ 33 - 54
security-protection-platform/src/modules/videoSurveillance/components/ReplayDialog/index.vue

@ -14,8 +14,8 @@
14 14
            <t-button @click="resetData">重置</t-button>
15 15
          </div>
16 16
        </div>
17
        <t-tabs v-model="currentTab" mode="scrollY" orientation="vertical" width="100%" @change="handleTabChange">
18
          <t-tab-panel v-for="item in list" :key="item.monitorVideoLogId" :label="item.fileName|formatDateTime" :panel-id="item.fileId" />
17
        <t-tabs v-if="isShow" v-model="currentTab" mode="scrollY" orientation="vertical" width="100%" @change="handleTabChange">
18
          <t-tab-panel v-for="item in list" :key="item.fileId" :label="item.fileName" :panel-id="item.fileId" />
19 19
        </t-tabs>
20 20
      </div>
21 21
@ -40,9 +40,12 @@ export default {
40 40
  },
41 41
  components: { VideoPlayer },
42 42
  props: {
43
    replayId: {
44
      type: String
43
    // 视频列表
44
    list: {
45
      type: Array,
46
      default: () => []
45 47
    },
48
    // 是否显示对话框
46 49
    visibled: {
47 50
      type: Boolean,
48 51
      default: false
@ -50,15 +53,18 @@ export default {
50 53
  },
51 54
  data () {
52 55
    return {
56
      // 当前的tab标签
53 57
      currentTab: null,
54 58
      loadVideo: false,
55
      list: [],
59
      // 视频列表
56 60
      videoList: [],
61
      // 视频播放器对象
57 62
      $player: null,
58
      // beginDay: formatDateTime(new Date(+new Date() - 10 * 60 * 1000), 'yyyy-MM-dd hh:mm:ss'),
59
      // endDay: formatDateTime(new Date(), 'yyyy-MM-dd hh:mm:ss')
60
      beginDay: '2020-12-18 17:19:00',
61
      endDay: '2020-12-18 17:19:59'
63
      // 开始时间
64
      beginDay: '2020-12-19 20:14:00',
65
      // 结束时间
66
      endDay: '2020-12-19 20:14:59',
67
      isShow: true
62 68
    }
63 69
  },
64 70
  computed: {
@ -71,13 +77,11 @@ export default {
71 77
    }
72 78
  },
73 79
  watch: {
74
    replayId (val) {
75
      this.replayId = val
76
      this.getData()
77
    },
78 80
    list: {
79 81
      handler (val) {
80 82
        this.list = val
83
        // 利用v-if刷新tab组件
84
        this.reload()
81 85
        console.warn(`list Change`)
82 86
        this.resetVideoList()
83 87
        if (val.length > 0) {
@ -89,34 +93,8 @@ export default {
89 93
      immediate: true
90 94
    }
91 95
  },
92
  mounted () {
93
    // this.list = [{
94
    //   fileName: '12月14日 16:55',
95
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165526.mp4',
96
    //   fileType: 'video/mp4'
97
    // }, {
98
    //   fileName: '12月14日 16:56',
99
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165527.mp4',
100
    //   fileType: 'video/mp4'
101
    // }, {
102
    //   fileName: '12月14日 16:57',
103
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165528.mp4',
104
    //   fileType: 'video/mp4'
105
    // }, {
106
    //   fileName: '12月14日 16:58',
107
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165529.mp4',
108
    //   fileType: 'video/mp4'
109
    // }, {
110
    //   fileName: '12月14日 16:59',
111
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165530.mp4',
112
    //   fileType: 'video/mp4'
113
    // }, {
114
    //   fileName: '12月14日 17:00',
115
    //   fileId: 'ai-video_5A02296PAKA885B-video20201214165531.mp4',
116
    //   fileType: 'video/mp4'
117
    // }]
118
  },
119 96
  methods: {
97
    // 初始化视频
120 98
    handlePlayerInited (player) {
121 99
      this.$player = player
122 100
      window.player = this
@ -133,7 +111,8 @@ export default {
133 111
    },
134 112
    resetVideoList () {
135 113
      const videoList = this.list.map((item, index) => {
136
        const { fileId, fileType } = item
114
        const { fileId } = item
115
        const fileType = 'video/' + item.fileType
137 116
        return {
138 117
          index,
139 118
          fileId,
@ -185,32 +164,32 @@ export default {
185 164
    /*
186 165
   * 获取真实视频地址
187 166
   */
188
    getOriVideoUrl (fileId) {
189
      console.log(`请求地址:${fileId}`)
167
    async getOriVideoUrl (fileId) {
168
      const res = await sysapi.getFileUrl(fileId)
190 169
      // fake
191 170
      return new Promise((resolve, reject) => {
192 171
        setTimeout(() => {
193
          const x = Math.random()
194
          const url = x > 0.5
195
            ? 'http://10.19.90.34:19000/tool-image/tool-image_7d359725fac4464fb248284caf321993.mp4'
196
            : 'http://10.19.90.34:19000/tool-image/tool-image_7fa1f7b30f0640f2a67ac8b4c2e0b574.mp4'
172
          const url = res.data.data.fileUrl
197 173
          resolve({
198 174
            url
199 175
          })
200 176
        }, 1000)
201 177
      })
202 178
    },
203
    async getData () {
204
      const res = await sysapi.queryMonitorVideoLog({ params: { id: this.replayId, beginDay: this.beginDay, endDay: this.endDay } })
205
      if (res.status === 200) {
206
        this.list = res.data.data
207
      } else {
208
        this.$Message.danger('视频列表数据获取失败!')
209
      }
179
    getData () {
180
      this.$emit('get-list', { beginDay: this.beginDay, endDay: this.endDay })
210 181
    },
211 182
    resetData () {
212 183
      this.beginDay = formatDateTime(new Date(+new Date() - 10 * 60 * 1000), 'yyyy-MM-dd hh:mm:ss')
213 184
      this.endDay = formatDateTime(new Date(), 'yyyy-MM-dd hh:mm:ss')
185
      // this.getData()
186
    },
187
    // 刷新组件
188
    reload () {
189
      this.isShow = false
190
      this.$nextTick(() => {
191
        this.isShow = true
192
      })
214 193
    }
215 194
  }
216 195
}

+ 13 - 19
security-protection-platform/src/modules/videoSurveillance/components/rtmpVideoPlay/index.vue

@ -4,13 +4,7 @@
4 4
      <t-loading v-model="loadVideo">
5 5
        <span class="text-md text-info">获取视频资源...</span>
6 6
      </t-loading>
7
      <video-player
8
        :sources="videoList"
9
        :autoadvance="0"
10
        :style="{opacity: loadVideo ? 0: 1}"
11
        @player-inited="handlePlayerInited"
12
        @playlistitem="handlePlayerCurrentChange"
13
      />
7
      <video-player :sources="videoList" :autoadvance="0" :style="{opacity: loadVideo ? 0: 1}" @player-inited="handlePlayerInited" @playlistitem="handlePlayerCurrentChange" />
14 8
    </div>
15 9
  </div>
16 10
</template>
@ -30,7 +24,7 @@ export default {
30 24
      default: false
31 25
    }
32 26
  },
33
  data() {
27
  data () {
34 28
    return {
35 29
      currentTab: null,
36 30
      loadVideo: false,
@ -40,8 +34,8 @@ export default {
40 34
  },
41 35
  computed: {
42 36
    visible: {
43
      get() { return this.visibled },
44
      set(val) {
37
      get () { return this.visibled },
38
      set (val) {
45 39
        if (!val) this.$player.pause()
46 40
        this.$emit('update:visibled', val)
47 41
      }
@ -49,7 +43,7 @@ export default {
49 43
  },
50 44
  watch: {
51 45
    list: {
52
      handler(val) {
46
      handler (val) {
53 47
        console.warn(`list Change`)
54 48
        this.resetVideoList()
55 49
        if (val.length > 0) {
@ -63,26 +57,26 @@ export default {
63 57
  },
64 58
  methods: {
65 59
    // 初始化
66
    handlePlayerInited(player) {
60
    handlePlayerInited (player) {
67 61
      this.$player = player
68 62
      window.player = this
69 63
      var myButton = player.controlBar.addChild('button')
70 64
      myButton.addClass('vjs-play-control')
71 65
      myButton.on('click', () => {
72
        this.$emit('videoReplay')
66
        this.$emit('videoReplay', this.list[0].id)
73 67
      })
74 68
    },
75
    async handleTabChange(name, index) {
69
    async handleTabChange (name, index) {
76 70
      this.$player.pause()
77 71
      await this.preloadOriVideoUrl(index)
78 72
      this.play(index)
79 73
    },
80
    handlePlayerCurrentChange(e, item) {
74
    handlePlayerCurrentChange (e, item) {
81 75
      const { index, fileId } = item
82 76
      this.currentTab = fileId
83 77
      this.preloadOriVideoUrl(index)
84 78
    },
85
    resetVideoList() {
79
    resetVideoList () {
86 80
      const videoList = this.list.map((item, index) => {
87 81
        const { fileId, fileType } = item
88 82
        return {
@ -95,7 +89,7 @@ export default {
95 89
96 90
      this.videoList = videoList
97 91
    },
98
    play(index) {
92
    play (index) {
99 93
      console.log(`播放:index=${index}`)
100 94
      // 调用额外的currentItem方法以避免currentItem在首次不生效
101 95
      // https://github.com/brightcove/videojs-playlist/blob/master/docs/api.md
@ -107,7 +101,7 @@ export default {
107 101
     *  从index开始预载videoList的视频地址
108 102
     *  此方法将在获取index对应的地址后就立即返回
109 103
     */
110
    preloadOriVideoUrl(index = 0, maxLength = 5) {
104
    preloadOriVideoUrl (index = 0, maxLength = 5) {
111 105
      return new Promise((resolve, reject) => {
112 106
        for (let i = index; i in this.videoList && i - index < maxLength; i++) {
113 107
          console.log(`预载地址:index=${i}`)
@ -136,7 +130,7 @@ export default {
136 130
    /*
137 131
     * 获取真实视频地址
138 132
     */
139
    getOriVideoUrl(fileId) {
133
    getOriVideoUrl (fileId) {
140 134
      console.log(`请求地址:${fileId}`)
141 135
      // fake
142 136
      return new Promise((resolve, reject) => {

+ 30 - 10
security-protection-platform/src/modules/videoSurveillance/index.vue

@ -1,10 +1,7 @@
1 1
<template>
2 2
  <div class="page-main">
3 3
    <t-button-group class="top-btn">
4
      <t-button v-for="(item,index) in sceneList" :key="index"
5
                :value="item.monitorSceneId"
6
                :color="item.monitorSceneId === selectedMonitorScene ? 'primary' : 'secondary'"
7
                @click="tabClick(item.monitorSceneId)">{{ item.monitorSceneName }}</t-button>
4
      <t-button v-for="(item,index) in sceneList" :key="index" :value="item.monitorSceneId" :color="item.monitorSceneId === selectedMonitorScene ? 'primary' : 'secondary'" @click="tabClick(item.monitorSceneId)">{{ item.monitorSceneName }}</t-button>
8 5
    </t-button-group>
9 6
    <div class="page-top">
10 7
      <span>风场:</span>
@ -18,7 +15,7 @@
18 15
      </div>
19 16
    </div>
20 17
    <t-pager :page-size="videoPageSize" :current="videoCurrent" :total="videoTotal" :sizer-range="[ 5, 10, 20, 30 ]" class="pager" show-elevator @on-change="onChangeGate"></t-pager>
21
    <replay-dialog :list="replayList" :visibled.sync="showReplayDialog"/>
18
    <replay-dialog :list="replayList" :visibled.sync="showReplayDialog" @get-list="queryMonitorVideoLog" />
22 19
  </div>
23 20
</template>
24 21
<script>
@ -26,6 +23,7 @@ import sysapi from '@/api/videoSurveillance'
26 23
import RtmpVideo from './components/rtmpVideoPlay'
27 24
import ReplayDialog from './components/ReplayDialog'
28 25
import VideoPlayer from '@/components/VideoPlayer'
26
import formatDateTime from '@/utils/formatDateTime.js'
29 27
import videojs from 'video.js'
30 28
window.videojs = videojs
31 29
@ -63,14 +61,18 @@ export default {
63 61
      selectedMonitorScene: '', // 当前选择场景
64 62
      videoPlayList: [],
65 63
      showReplayDialog: false,
66
      replayList: []
64
      replayList: [],
65
      beginDay: formatDateTime(new Date(+new Date() - 10 * 60 * 1000), 'yyyy-MM-dd hh:mm:ss'),
66
      endDay: formatDateTime(new Date(), 'yyyy-MM-dd hh:mm:ss')
67
      // beginDay: '2020-12-19 20:14:00',
68
      // endDay: '2020-12-19 20:14:00'
67 69
    }
68 70
  },
69 71
  mounted () {
70 72
    this.getWindFiledList() // 获取风场列表
71 73
  },
72 74
  methods: {
73
    getVideoPlayList(item) {
75
    getVideoPlayList (item) {
74 76
      return [{
75 77
        fileId: item.videoUrl,
76 78
        fileType: 'rtmp/flv',
@ -78,7 +80,7 @@ export default {
78 80
      }]
79 81
    },
80 82
    // 获取场景列表
81
    getSceneList() {
83
    getSceneList () {
82 84
      this.sceneList = []
83 85
      for (let i = 0; i < this.totalList.length; i++) {
84 86
        if (this.totalList[i].organizationId === this.gateFieldData) {
@ -86,7 +88,25 @@ export default {
86 88
        }
87 89
      }
88 90
    },
89
    async handleReview (id) {
91
    // 向服务器发送请求获取视频回放数据
92
    async queryMonitorVideoLog (data) {
93
      let res = []
94
      // console.log(this.beginDay, this.endDay)
95
      if (data) {
96
        res = await sysapi.queryMonitorVideoLog({ params: { id: this.replayId, ...data } })
97
      } else {
98
        res = await sysapi.queryMonitorVideoLog({ params: { id: this.replayId, beginDay: this.beginDay, endDay: this.endDay } })
99
      }
100
      if (res.status === 200) {
101
        this.replayList = res.data.data
102
      } else {
103
        this.$Message.danger('视频列表数据获取失败!')
104
      }
105
    },
106
    // 显示视频回放对话框
107
    handleReview (id) {
108
      this.replayId = id
109
      this.queryMonitorVideoLog()
90 110
      this.showReplayDialog = true
91 111
    },
92 112
    // 切换场景
@ -119,7 +139,7 @@ export default {
119 139
    // 获得风场大门数据
120 140
    getVideoSurveillanceData (id) {
121 141
      this.paramsObj.page = this.videoCurrent
122
      sysapi.getVideoSurveillanceData({ params: {monitorSceneId: id} }).then(res => {
142
      sysapi.getVideoSurveillanceData({ params: { monitorSceneId: id } }).then(res => {
123 143
        this.videoList = res.data.data
124 144
      })
125 145
    },