Commit 8d8608ac by T

现场版本代码

parent 4ad2494c
import request from '@/utils/request'
import { transform } from '@/utils/index'
import axios from 'axios'
export function getListWarehouse(data) {
return request({
......@@ -98,3 +99,42 @@ export function enableChannelReadEquById(data) {
data: transform(data)
})
}
//新增或编辑视频
export function addOrUpdateCamera(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Warehouse/AddOrUpdateCamera',
method: 'post',
data: transform(data)
})
}
//根据组织机构id获取视频配置列表
export function getCameraByOrgId(data) {
return request({
url: window._CONFIG['serviceURL'] + '/api/Warehouse/GetCameraByOrgId',
method: 'post',
data: data
})
}
//删除监控视频配置
export function deleteCamera(data) {
return request({
method: 'POST',
url: window._CONFIG['serviceURL'] + '/api/Warehouse/DeleteCamera',
data: transform(data)
})
}
//获取回放视频
export function getStartHls(data) {
return request({
method: 'POST',
url: window._CONFIG['videoURL'] + '/hls/startHls',
data: data,
})
}
......@@ -171,27 +171,27 @@
* @param {*} data
* @returns
*/
export function transform(data) {
let k = {
appKey: 'N1JOsoM/x25Mj1VUaJATBw==',
orgId: '',
version: '1.0',
timestamp: parseInt(new Date().getTime()/1000),
body: escape(JSON.stringify(data)),
sign: md5('37524eb2833fc76e4c8f555468901307'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
}
return k;
// let k = {
// appKey: '8EV3FnNIVaKp8zekBwxpdw==',
// orgId: '',
// version: '1.0',
// timestamp: parseInt(new Date().getTime()/1000),
// body: escape(JSON.stringify(data)),
// sign: md5('f0457716734855a2a9f337a4070c6977'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
// }
// return k;
//统一加密处理--开关
export function transform(data) {
//isEncryption为0---加密,1----不加密
let isEncryption =0;
}
if(isEncryption == 0){
let k = {
appKey: 'N1JOsoM/x25Mj1VUaJATBw==',
orgId: '',
version: '1.0',
timestamp: parseInt(new Date().getTime()/1000),
body: escape(JSON.stringify(data)),
sign: md5('37524eb2833fc76e4c8f555468901307'+parseInt(new Date().getTime()/1000)+'1.0'+escape(JSON.stringify(data)))
}
return k;
}
if(isEncryption == 1){
return data
}
}
export function downloadFile(obj, name, suffix) {
const url = window.URL.createObjectURL(new Blob([obj]))
......
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" title="监控视频配置" width="500px" height='600px'>
<!-- <el-button @click="addField" type="primary" size="small" style="float: right;">
添加视频配置组
</el-button> -->
<div v-for="(item, index) in fields" :key="index" style="margin-top: 50px; " >
<!-- <div class="dialog-footer">
<el-button type="danger" size="small" style="float: right;" plain @click="removeField(index)">删除</el-button>
</div> -->
<el-divider >{{ item.title }}</el-divider>
<el-form :model="videos" :rules="rules" label-width="90px">
<!-- <el-form-item label="id" >
<el-input v-model="videos.id" placeholder=""></el-input>
</el-form-item> -->
<el-form-item label="视频名称" prop="name">
<el-input v-model="videos.name" placeholder="请输入视频名称"></el-input>
</el-form-item>
<el-form-item label="视频URL" prop="url">
<el-input v-model="videos.url" placeholder="请输入视频URL"></el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="info" plain @click="cancel">关闭</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { addOrUpdateCamera } from '@/api/warehouse'
export default {
data() {
return {
loading: false, dialog: false, visible: false,
orgId : this.$store.state.user.user.baseJpOrganization.id,
videos:
{
id:'',
name:'',
url:''
}
,
form:{
Id : "",
orgId : "",
channelName: "",
src: ""
},
fields: [
{
title: '视频1',
value1: '',
value2: '',
value3: '',
}
],
rules: {
name: [
{ required: true, message: '请输入视频名称', trigger: 'blur' },
],
url: [
{ required: true, message: '请输入视频URL', trigger: 'blur' },
],}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit(){
// updateHumid(this.form)
// controlDev(this.form).then(res => {
// if (res.code == '10000') {
// this.dialog = false
// this.$notify({
// title: '设置成功',
// type: 'success',
// duration: 2500
// })
// this.$emit('controlDev')
// } else {
// this.$message.error(res.msg)
// }
// })
this.form ={
Id : this.videos.id,
orgId : this.$store.state.user.user.baseJpOrganization.id,
channelName: this.videos.name,
src: this.videos.url
}
addOrUpdateCamera(this.form).then(res => {
//console.log(this.$store.state.user.user.baseJpOrganization.id)
if (res.code == '10000') {
this.dialog = false
this.$notify({
title: '操作成功',
type: 'success',
duration: 2500
})
//this.$emit('controlDev')
} else {
this.$message.error(res.msg)
}
})
},
resetForm() {
this.dialog = false
//this.$refs['form'].resetFields()
},
addField() {
this.fields.push({
title: `视频${this.fields.length + 1}`,
value1: '',
value2: '',
value3: '',
});
},
removeField(index) {
this.fields.splice(index, 1);
},
}
}
</script>
<style lang="less" scoped>
/deep/ .el-input-number .el-input__inner {
text-align: left;
}
.form-table{
/deep/&.el-table{
overflow: visible;
.el-table__body-wrapper{
overflow: visible;
.cell{
overflow: visible;
}
}
}
}
</style>
......@@ -16,9 +16,9 @@
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" style="width: 370px;" placeholder="请输入联系电话"/>
</el-form-item>
<el-form-item label="视频地址">
<!-- <el-form-item label="视频地址">
<el-input v-model="form.cameraUrl" style="width: 370px;" placeholder="请输入安装视频服务的Ip"/>
</el-form-item>
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" type="info" plain>关闭</el-button>
......
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增监控配置' : '编辑监控配置'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form-item label="监控视频名称" prop="channelName">
<el-input v-model="form.channelName" style="width: 300px;"/>
</el-form-item>
<el-form-item label="监控视频地址" prop="src">
<el-input v-model="form.src" style="width: 300px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { addOrUpdateCamera } from '@/api/warehouse'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
components: { Treeselect },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false, visible: false,
videos:
{
id:'',
name:'',
url:''
}
,
form:{
Id : "",
orgId : "",
channelName: "",
src: ""
},
rules: {
channelName: [
{ required: true, message: '请输入监控视频名称', trigger: 'blur' }
],
src: [
{ required: true, message: '请输入监控视频地址', trigger: 'blur' }
],
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
}
})
},
doAdd() {
//this.form.orgId =this.orgId
console.log(this.form.orgId)
addOrUpdateCamera(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.$parent.initPost()
} else {
this.loading = false
this.$message.error(res.msg)
}
}).catch(err => {
this.loading = false
// console.log(err.response.data.message)
})
},
doEdit() {
//this.form.orgId = this.$store.state.user.user.baseJpOrganization.id
//this.form.orgId =this.id
console.log('5555'+this.form)
addOrUpdateCamera(this.form).then(res => {
if (res.code === '10000') {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.$parent.initPost()
} else {
this.loading = false
this.$message.error(res.msg)
}
}).catch(err => {
this.loading = false
// console.log(err.response.data.message)
})
},
initWarehouseById(id) {
// 获取仓库列表
// getListOrgWarehouse({orgizationId: id}).then(res =>{
// this.warehouses = res.data
// })
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
channelName: '',
src:'',
orgId:''
}
},
isvalidIp(str) {
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return reg.test(str)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-input-number .el-input__inner {
text-align: left;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论