|
|
@@ -1,317 +0,0 @@
|
|
|
-<template>
|
|
|
- <wrapper
|
|
|
- fill
|
|
|
- margin
|
|
|
- padding
|
|
|
- background
|
|
|
- >
|
|
|
- <el-tabs
|
|
|
- :value="active"
|
|
|
- class="c-tabs has-bottom-padding"
|
|
|
- @tab-click="onTabClick"
|
|
|
- >
|
|
|
- <el-tab-pane
|
|
|
- label="人流量监测"
|
|
|
- name="2"
|
|
|
- />
|
|
|
- <el-tab-pane
|
|
|
- label="LED屏监测"
|
|
|
- name="1"
|
|
|
- />
|
|
|
- </el-tabs>
|
|
|
- <grid-table
|
|
|
- ref="table"
|
|
|
- :schema="schema"
|
|
|
- size="large"
|
|
|
- >
|
|
|
- <grid-table-item v-slot="item">
|
|
|
- <camera-player
|
|
|
- v-if="isActivated"
|
|
|
- :key="item.identifier"
|
|
|
- :camera="item"
|
|
|
- controls
|
|
|
- @fullscreen="onFullScreen(item)"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="c-sibling-item el-icon-edit has-active u-pointer"
|
|
|
- @click.stop="onEdit(item)"
|
|
|
- />
|
|
|
- <i
|
|
|
- class="c-sibling-item el-icon-delete has-active u-pointer"
|
|
|
- @click.stop="onDel(item)"
|
|
|
- />
|
|
|
- </camera-player>
|
|
|
- </grid-table-item>
|
|
|
- </grid-table>
|
|
|
- <confirm-dialog
|
|
|
- ref="editDialog"
|
|
|
- :title="dialogTitle"
|
|
|
- @confirm="onConfirm"
|
|
|
- >
|
|
|
- <div class="c-grid-form u-align-self--center">
|
|
|
- <span class="c-grid-form__label required">设备名称</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="camera.name"
|
|
|
- placeholder="最多50个字符"
|
|
|
- maxlength="50"
|
|
|
- clearable
|
|
|
- />
|
|
|
- <span class="c-grid-form__label required">设备标识</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="camera.identifier"
|
|
|
- placeholder="最多50个字符"
|
|
|
- maxlength="50"
|
|
|
- :disabled="isEdit"
|
|
|
- clearable
|
|
|
- />
|
|
|
- <span class="c-grid-form__label required">账号</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="camera.username"
|
|
|
- placeholder="最多50个字符"
|
|
|
- maxlength="50"
|
|
|
- :disabled="isEdit"
|
|
|
- />
|
|
|
- <template v-if="!isEdit">
|
|
|
- <span class="c-grid-form__label required">密码</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="camera.password"
|
|
|
- class="o-password"
|
|
|
- placeholder="最多50个字符"
|
|
|
- maxlength="50"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <span class="c-grid-form__label">备注</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="camera.remark"
|
|
|
- type="textarea"
|
|
|
- maxlength="100"
|
|
|
- :rows="3"
|
|
|
- show-word-limit
|
|
|
- />
|
|
|
- </div>
|
|
|
- </confirm-dialog>
|
|
|
- <el-dialog
|
|
|
- class="c-dialog--full"
|
|
|
- :visible="detailing"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- fullscreen
|
|
|
- >
|
|
|
- <camera-detail
|
|
|
- v-if="detailing"
|
|
|
- :camera="targetCamera"
|
|
|
- autoplay
|
|
|
- @close="onClose"
|
|
|
- />
|
|
|
- </el-dialog>
|
|
|
- <!-- <el-dialog
|
|
|
- class="c-dialog--full"
|
|
|
- :visible="fullscreen"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- fullscreen
|
|
|
- >
|
|
|
- <fullscreen
|
|
|
- v-if="fullscreen"
|
|
|
- :info="fullscreenOptions"
|
|
|
- @close="onClose"
|
|
|
- />
|
|
|
- </el-dialog> -->
|
|
|
- </wrapper>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import {
|
|
|
- getCameras,
|
|
|
- addCamera,
|
|
|
- updateCamera,
|
|
|
- deleteCamera
|
|
|
-} from '@/api/camera'
|
|
|
-import { Camera } from '@/constant'
|
|
|
-// import Fullscreen from './components/Fullscreen'
|
|
|
-
|
|
|
-export default {
|
|
|
- name: 'Cameras',
|
|
|
- // components: {
|
|
|
- // Fullscreen
|
|
|
- // },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- active: `${Camera.TRAFFIC}`,
|
|
|
- schema: {
|
|
|
- pageSize: 6,
|
|
|
- condition: { name: '' },
|
|
|
- list: this.getCameras,
|
|
|
- buttons: [
|
|
|
- { type: 'add', on: this.onAdd }/* ,
|
|
|
- { label: '全部', icon: 'el-icon-menu', on: this.onAll } */
|
|
|
- ],
|
|
|
- filters: [
|
|
|
- { key: 'searchname', type: 'search', placeholder: '设备名称' }
|
|
|
- ]
|
|
|
- },
|
|
|
- camera: {},
|
|
|
- detailing: false,
|
|
|
- fullscreen: false,
|
|
|
- targetCamera: null,
|
|
|
- fullscreenOptions: null
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapGetters(['isSuperAdmin']),
|
|
|
- cameraType () {
|
|
|
- return Number(this.active)
|
|
|
- },
|
|
|
- isTraffic () {
|
|
|
- return this.cameraType === Camera.TRAFFIC
|
|
|
- },
|
|
|
- isEdit () {
|
|
|
- return !!this.camera.id
|
|
|
- },
|
|
|
- dialogTitle () {
|
|
|
- const type = this.isTraffic ? '人流量监测摄像头' : 'LED屏监测摄像头'
|
|
|
- if (this.isEdit) {
|
|
|
- return `编辑${type}`
|
|
|
- }
|
|
|
- return `新增${type}`
|
|
|
- },
|
|
|
- isActivated () {
|
|
|
- return !this.detailing && !this.fullscreen
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- onTabClick ({ name: active }) {
|
|
|
- if (this.active !== active) {
|
|
|
- this.active = active
|
|
|
- this.$refs.table.pageTo(1)
|
|
|
- }
|
|
|
- },
|
|
|
- getCameras (params) {
|
|
|
- return getCameras({
|
|
|
- ...params,
|
|
|
- cameraType: this.cameraType
|
|
|
- })
|
|
|
- },
|
|
|
- onAdd () {
|
|
|
- this.camera = {
|
|
|
- name: '',
|
|
|
- identifier: '',
|
|
|
- username: '',
|
|
|
- password: '',
|
|
|
- remark: ''
|
|
|
- }
|
|
|
- this.$refs.editDialog.show()
|
|
|
- },
|
|
|
- onEdit (camera) {
|
|
|
- this.camera = {
|
|
|
- id: camera.id,
|
|
|
- name: camera.name,
|
|
|
- identifier: camera.identifier,
|
|
|
- username: camera.username,
|
|
|
- remark: camera.remark
|
|
|
- }
|
|
|
- this.$refs.editDialog.show()
|
|
|
- },
|
|
|
- onConfirm (done) {
|
|
|
- if (!this.camera.name) {
|
|
|
- this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '请填写设备名称'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.camera.name) {
|
|
|
- this.$message({
|
|
|
- type: 'identifier',
|
|
|
- message: '请填写设备标识'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.isEdit) {
|
|
|
- this.editCamera(done)
|
|
|
- } else {
|
|
|
- this.addCamera(done)
|
|
|
- }
|
|
|
- },
|
|
|
- addCamera (done) {
|
|
|
- if (!this.camera.username) {
|
|
|
- this.$message({
|
|
|
- type: 'identifier',
|
|
|
- message: '请填写账号'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.camera.password) {
|
|
|
- this.$message({
|
|
|
- type: 'identifier',
|
|
|
- message: '请填写密码'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- addCamera({
|
|
|
- cameraType: this.cameraType,
|
|
|
- ...this.camera
|
|
|
- }).then(() => {
|
|
|
- this.$refs.table.resetCondition({ name: this.camera.name })
|
|
|
- done()
|
|
|
- })
|
|
|
- },
|
|
|
- editCamera (done) {
|
|
|
- updateCamera({
|
|
|
- cameraType: this.cameraType,
|
|
|
- ...this.camera
|
|
|
- }).then(() => {
|
|
|
- this.$refs.table.pageTo()
|
|
|
- done()
|
|
|
- })
|
|
|
- },
|
|
|
- onDel (camera) {
|
|
|
- deleteCamera({ id: camera.id, name: camera.name }).then(() => {
|
|
|
- this.$refs.table.decrease(1)
|
|
|
- })
|
|
|
- },
|
|
|
- onFullScreen (camera) {
|
|
|
- if (camera.onlineStatus) {
|
|
|
- this.targetCamera = camera
|
|
|
- this.detailing = true
|
|
|
- }
|
|
|
- },
|
|
|
- onAll () {
|
|
|
- const { totalCount, ...params } = this.$refs.table.info()
|
|
|
- if (totalCount > params.pageSize) {
|
|
|
- this.fullscreenOptions = {
|
|
|
- params: {
|
|
|
- ...params,
|
|
|
- cameraType: this.cameraType,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: totalCount
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.fullscreenOptions = {
|
|
|
- list: this.$refs.table.getData()
|
|
|
- }
|
|
|
- }
|
|
|
- this.fullscreen = true
|
|
|
- },
|
|
|
- onClose () {
|
|
|
- this.detailing = false
|
|
|
- this.fullscreen = false
|
|
|
- this.fullscreenOptions = null
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
-.o-botton--white {
|
|
|
- color: #8e929c;
|
|
|
- border: 1px solid #d5d9e4;
|
|
|
- background-color: #fff;
|
|
|
-}
|
|
|
-
|
|
|
-.o-password {
|
|
|
- -webkit-text-security: disc;
|
|
|
-}
|
|
|
-</style>
|