Commit 5cfbf6d1 by 夏新然

修改bug

1 parent fad2f3bd
NODE_ENV = 'development'
VUE_APP_URL = 'http://192.168.9.133:20080'
\ No newline at end of file
VUE_APP_URL = 'http://vion-panda.51vip.biz:52510'
\ No newline at end of file
import axios from 'axios'
import store from '../store/index.js'
import {Message,Loading} from 'element-ui'
let loading;
//内存中正在请求的数量
let loadingNum=0;
function startLoading() {
if(loadingNum==0){
loading = Loading.service({
lock: true,
text: '拼命加载中...',
background:'rgba(255,255,255,0.5)',
})
}
//请求数量加1
loadingNum++;
}
function endLoading() {
//请求数量减1
loadingNum--
if(loadingNum<=0){
loading.close()
}
}
// 创建 axios 实例
let service = axios.create({
// headers: {'Content-Type': 'application/json'},
......@@ -21,23 +43,31 @@ service.interceptors.request.use(
...config.params
}
}
startLoading();
return config
},
(error) => {
(err) => {
// 请求错误处理
return Promise.reject(error)
return Promise.reject(err)
}
)
// 添加响应拦截器
service.interceptors.response.use(
(response) => {
endLoading();
let { data } = response
return data
},
(error) => {
console.log(error)
return Promise.reject(error)
(err) => {
endLoading();
if (err && err.response) {
Message.error({message: err.response.data.enote});
}else{
Message.error({message: '连接服务器失败!'});
}
return Promise.reject(err)
}
)
......
......@@ -3,7 +3,7 @@ import axios from "axios";
console.log(process.env.NODE_ENV);
switch (process.env.NODE_ENV) {
case "development":
baseUrl = "http://vion-panda.51vip.biz:52510"; // 测试环境url
baseUrl = "/api"; // 测试环境url
// baseUrl = "http://192.168.9.61:8086";
break;
case "pre":
......
......@@ -22,6 +22,9 @@ export default {
addRole(params){
return api.post(`${baseUrl}/api/v1/auth/roles`, params)
},
unbindRole(params,id,id2){
return api.delete(`${baseUrl}/api/v1/auth/users/${id}/roles/${id2}`, params)
},
logList(params){
return api.get(`${baseUrl}/api/v1/devconf_fx/logs`, params)
},
......
......@@ -42,6 +42,9 @@ export default {
editVideo(params,id,id2){
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/vchans/${id2}`, params)
},
addCamera(params,id){
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/vchans`, params)
},
editCamera(params,id,id2){
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/vchans/${id2}`, params)
},
......
......@@ -11,7 +11,7 @@
border-radius: 5px;
font-size: 16px;
}
#login .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{
#login .el-form-item--mini.el-form-item,#login .el-form-item--small.el-form-item{
margin-bottom: 28px!important;
}
.el-main{
......
......@@ -173,4 +173,13 @@ a:active{
margin-left: 0px!important;
margin-top: 6px!important;
}
// .treeWidth{
// display: inline-block;
// width: 50px;
// white-space: nowrap;
// text-overflow: ellipsis;
// overflow: hidden;
// word-break: break-all;
//
// }
}
\ No newline at end of file
......@@ -231,6 +231,13 @@ import types from '../store/types.js'
},
created() {
this.initHeight();
let _this=this;
document.onkeydown = function(e){
let _key = window.event.keyCode;
if(_key === 13){
_this.submitForm('ruleForm');
}
}
}
}
</script>
......
......@@ -82,7 +82,7 @@
@current-change="treeChange"
show-checkbox
ref="addTree"
node-key="unid"
node-key="perm_unid"
:props="defaultProps">
</el-tree>
</el-form-item>
......@@ -109,7 +109,7 @@
@current-change="treeChange"
show-checkbox
ref="editTree"
node-key="unid"
node-key="perm_unid"
:props="defaultProps">
</el-tree>
</el-form-item>
......@@ -227,7 +227,7 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.ops.delUser({},row.unid).then(res=>{
this.$api.ops.delUser({},row.role_unid).then(res=>{
if(res.ecode==200){
this.$message({
type: 'success',
......@@ -250,14 +250,15 @@
});
},
editUser(index,row){
this.editVisible=true;
this.$refs.editTree.setCheckedKeys([]);
this.$api.ops.getPerms({
},row.role_unid).then(res=>{
this.editForm.role_name=row.name;
res.list_data.forEach(item=>{
this.editForm.menu_unids.push(item.perm_unid)
this.$refs.editTree.setCheckedKeys([item.perm_unid]);
})
this.editUnid=row.role_unid;
this.editVisible=true;
})
},
openAddDialog(){
......@@ -267,6 +268,7 @@
this.addVisible=true;
},
addFun(formName){
this.addForm.menu_unids=[];
this.addForm.menu_unids=this.$refs.addTree.getCheckedKeys().sort((a, b) => { return a - b; });
this.$refs[formName].validate((valid) => {
if (valid) {
......@@ -302,6 +304,7 @@
},
editFun(formName){
this.editForm.menu_unids=[];
this.editForm.menu_unids=this.$refs.editTree.getCheckedKeys().sort((a, b) => { return a - b; });
this.$refs[formName].validate((valid) => {
if (valid) {
......@@ -313,7 +316,7 @@
type: 'success',
message: '修改成功!'
});
this.addVisible=false;
this.editVisible=false;
this.getTableList();
}else{
this.$message({
......
......@@ -183,6 +183,7 @@
editForm:{
role_unid:'',
},
editRoleUnid:'',
editUnid:'',
tableData: [],
addVisible:false,
......@@ -317,6 +318,7 @@
});
},
editUser(index,row){
this.editRoleUnid=row.roles[0].role_unid;
this.editForm.role_unid=row.roles[0].role_unid;
this.editUnid=row.user_unid;
this.editVisible=true;
......@@ -369,23 +371,25 @@
editFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.bindRole({
role_unid:this.editForm.role_unid
},this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
}
})
this.$api.ops.unbindRole({},this.editUnid,this.editRoleUnid).then(res=>{
this.$api.ops.bindRole({
role_unid:this.editForm.role_unid
},this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
}
})
})
} else {
return false;
}
......
......@@ -180,7 +180,8 @@
org_type:"address",
unid:this.addVideoParam.addr_unid
}
this.$parent.submitLaterGet(data)
this.$emit('getAllData',data)
// this.$parent.$parent.$parent.submitLaterGet(data)
this.cameraAddVisible=false;
}else{
this.$message.error(res.enote);
......@@ -206,7 +207,7 @@
org_type:"address",
unid:this.addVideoParam.addr_unid
}
this.$parent.submitLaterGet(data)
this.$emit('getData',data)
this.cameraAddVisible=false;
}else{
this.$message.error(res.enote);
......
......@@ -26,7 +26,7 @@
:visible.sync="addVisible"
width="450px">
<div>
<el-form label-position="left" label-width="120px" :model="formData">
<el-form label-position="left" label-width="120px" :model="formData" :rules="rules" ref="addForm" hide-required-asterisk >
<el-form-item label="添加目标类型">
<el-select v-model="formData.targetType" placeholder="请选择" :popper-append-to-body=false>
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in targetOpt"> </el-option>
......@@ -36,7 +36,7 @@
<el-form-item label="组织编号">
<el-input v-model="formData.code"></el-input>
</el-form-item>
<el-form-item label="组织名称">
<el-form-item label="组织名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
</div>
......@@ -44,7 +44,7 @@
<el-form-item label="地点编号">
<el-input v-model="formData.code"></el-input>
</el-form-item>
<el-form-item label="地点名称">
<el-form-item label="地点名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
</div>
......@@ -61,20 +61,20 @@
:visible.sync="editVisible"
width="450px">
<div>
<el-form label-position="left" label-width="120px" :model="editForm">
<el-form label-position="left" label-width="120px" :model="editForm" :rules="rules" hide-required-asterisk ref="editForm" >
<div v-if="editForm.targetType=='org'">
<el-form-item label="组织编号">
<el-input v-model="editForm.code" disabled></el-input>
</el-form-item>
<el-form-item label="组织名称">
<el-input v-model="editForm.name"></el-input>
<el-form-item label="组织名称" prop="name">
<el-input v-model="editForm.name" ></el-input>
</el-form-item>
</div>
<div v-else-if="editForm.targetType=='address'">
<el-form-item label="地点编号">
<el-input v-model="editForm.code" disabled></el-input>
</el-form-item>
<el-form-item label="地点名称">
<el-form-item label="地点名称" prop="name">
<el-input v-model="editForm.name"></el-input>
</el-form-item>
</div>
......@@ -85,7 +85,7 @@
<el-button type="primary" @click="editFinish">确 定</el-button>
</span>
</el-dialog>
<addCamera ref="addCamera"></addCamera>
<addCamera ref="addCamera" @getAllData="addCamareAfterGet"></addCamera>
</div>
</template>
......@@ -123,6 +123,13 @@
addVisible:false,
editVisible:false,
targetOpt:[],
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' },
{ min: 2, max: 9, message: '长度在 2 到 9 个字符', trigger: 'blur' }
],
},
dev_unid: sessionStorage.getItem('dev_unid'),
}
},
components:{
......@@ -147,6 +154,9 @@
}
},
methods:{
addCamareAfterGet(data){
this.$emit('getData',data)
},
handleNodeClick(data){
this.$emit('clickHandle',data,'camera');
},
......@@ -171,7 +181,7 @@
type: 'success',
message: '删除成功!'
});
this.$parent.$parent.getCameraTree();
this.$emit('getTree');
}
})
})
......@@ -190,32 +200,39 @@
this.editVisible=true;
},
editFinish(){
let cate_unid = this.getCustomCate('组织', 'residence');
this.$api.resource.getCode({
limit:9999
},cate_unid).then(res=>{
let editObj=[];
editObj=res.list_data.filter(item => item.code==this.editForm.code);
this.$api.resource.editCamera({
name:this.editForm.name,
code:this.editForm.code
},cate_unid,editObj[0].unid).then(data=>{
if(res.ecode) {
this.$message({
type: 'error',
message: res.enote
this.$refs['editForm'].validate((valid) => {
if (valid) {
let cate_unid = this.getCustomCate('组织', 'residence');
this.$api.resource.getCode({
limit:9999
},cate_unid).then(res=>{
let editObj=[];
editObj=res.list_data.filter(item => item.code==this.editForm.code);
this.$api.resource.editCamera({
name:this.editForm.name,
code:this.editForm.code
},cate_unid,editObj[0].unid).then(data=>{
if(res.ecode) {
this.$message({
type: 'error',
message: res.enote
})
} else {
this.editVisible=false;
this.$emit('getTree')
}
})
} else {
this.editVisible=false;
this.$parent.$parent.getCameraTree();
}
})
})
})
} else {
return false;
}
});
},
nodeAddClick(node,data){
if(data.org_type == 'address'){
//添加视频
this.$refs.addCamera.initDialog(node,'add',this.devsId)
this.$refs.addCamera.initDialog(node,'add',this.dev_unid)
}else{
//添加组织关系
this.currentNodeId=data.unid;
......@@ -252,23 +269,29 @@
return window.localStorage.getItem(localKey);
},
save(){
let cate_unid = this.getCustomCate('组织', 'residence');
// console.log('添加节点分类unid:', cate_unid);
if(cate_unid) {
this.$api.resource.addCode({
code: this.formData.code,
name: this.formData.name
},cate_unid).then(res=>{
if(res.ecode) {
this.$message({
type: 'error',
message: res.enote
this.$refs['addForm'].validate((valid) => {
if (valid) {
let cate_unid = this.getCustomCate('组织', 'residence');
// console.log('添加节点分类unid:', cate_unid);
if(cate_unid) {
this.$api.resource.addCode({
code: this.formData.code,
name: this.formData.name
},cate_unid).then(res=>{
if(res.ecode) {
this.$message({
type: 'error',
message: res.enote
})
} else {
this.orgServ(); // org service
}
})
} else {
this.orgServ(); // org service
}
})
}
}
} else {
return false;
}
});
},
orgServ() {
this.$api.resource.addNode({
......@@ -288,7 +311,7 @@
message: '添加成功!'
})
this.addVisible = false;
this.$parent.$parent.getCameraTree();
this.$emit('getTree')
}
})
......
<template>
<div class="innnerBox">
<el-row :gutter="12">
<el-col :span="4" class="treeBox minHeight">
<el-col :span="6" class="treeBox minHeight">
<el-input class="search-input" prefix-icon="el-icon-search" placeholder="请输入内容" v-model="searchText">
</el-input>
<cameraTree :filterText="searchText" :treeDatas="cameraTree" @clickHandle="getTable"></cameraTree>
<videoTree :filterText="searchText" :treeDatas="videoTree" :devsId="dev_unid" @clickHandle="getTable"></videoTree>
<cameraTree :filterText="searchText" :treeDatas="cameraTree" @clickHandle="getTable" @getTree="getCameraTree" @getData="submitLaterGet"></cameraTree>
<videoTree :filterText="searchText" :treeDatas="videoTree" :devsId="dev_unid" @clickHandle="getTable" @getTree="getVideoTree"></videoTree>
</el-col>
<el-col :span="20" >
<el-col :span="18" >
<el-table :data="formattterData" stripe border v-if="tableType=='camera'" :height="tableHeight">
<el-table-column prop="label" align="center" label="名称">
</el-table-column>
......@@ -47,7 +47,7 @@
</el-table-column>
</el-table>
</el-col>
<cameraDialog ref="editCamera"></cameraDialog>
<cameraDialog ref="editCamera" @getData="submitLaterGet"></cameraDialog>
<el-dialog
title="修改视频"
:visible.sync="videoEditVisible"
......
......@@ -25,7 +25,7 @@
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.plate_type" >
<el-option value="" label='全部'></el-option>
<!-- <el-option v-for='item in vehicleTypeList' :value="item.code" :key="item.code" :label='item.name'></el-option> -->
<el-option v-for='item in plateTypeList' :value="item.code" :key="item.code" :label='item.name'></el-option>
</el-select>
</span>
</el-form-item>
......@@ -268,6 +268,7 @@
vehicleTypeList:this.$buildCode.getCodeList('车辆类型'),
vehicleColorList:this.$buildCode.getCodeList('车身颜色'),
illegalList:this.$buildCode.getCodeList('违法类型'),
plateTypeList:this.$buildCode.getCodeList('号牌类型'),
tableData:[],
formattterData:[],
total:0,
......
......@@ -50,12 +50,17 @@
</el-select>
</span>
</el-form-item>
<el-form-item label="运营公司">
<el-form-item label="运营公司" v-show="conditions.event_type=='xcycle'">
<span class="inputBox">
<el-input placeholder="请输入公司名称" v-model="conditions.company"></el-input>
</span>
</el-form-item>
<el-form-item label="是否带盔">
<el-form-item label="车牌号码" v-show="conditions.event_type=='xcycle'">
<span class="inputBox">
<el-input placeholder="请输入车牌号码" v-model="conditions.plate"></el-input>
</span>
</el-form-item>
<el-form-item label="是否带盔" v-show="conditions.event_type=='xcycle'">
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.with_hats">
<el-option value="" label='全部'></el-option>
......@@ -65,7 +70,27 @@
</el-select>
</span>
</el-form-item>
<!-- <el-form-item label="上身颜色">
<el-form-item label="是否带帽" v-show="conditions.event_type=='pedestrian'">
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.with_hats">
<el-option value="" label='全部'></el-option>
<el-option :value="0" :key="0" label='不确定'></el-option>
<el-option :value="1" :key="1" label='带帽'></el-option>
<el-option :value="2" :key="2" label='不带帽'></el-option>
</el-select>
</span>
</el-form-item>
<el-form-item label="带口罩" v-show="conditions.event_type=='pedestrian'">
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.with_hats">
<el-option value="" label='全部'></el-option>
<el-option :value="0" :key="0" label='不确定'></el-option>
<el-option :value="1" :key="1" label='带口罩'></el-option>
<el-option :value="2" :key="2" label='不带口罩'></el-option>
</el-select>
</span>
</el-form-item>
<el-form-item label="上身颜色" v-show="conditions.event_type=='pedestrian'">
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.upbodyColor">
<el-option value="" label='全部'></el-option>
......@@ -73,19 +98,15 @@
</el-select>
</span>
</el-form-item>
<el-form-item label="下身颜色">
<el-form-item label="下身颜色" v-show="conditions.event_type=='pedestrian'">
<span class="selectBox">
<el-select placeholder="请选择" :popper-append-to-body=false v-model="conditions.lobodyColor">
<el-option value="" label='全部'></el-option>
<el-option v-for='item in bodyColorList' :value="item.value" :key="item.value" :label='item.label'></el-option>
</el-select>
</span>
</el-form-item> -->
<el-form-item label="车牌号码" >
<span class="inputBox">
<el-input placeholder="请输入车牌号码" v-model="conditions.plate"></el-input>
</span>
</el-form-item>
<el-form-item label="起始时间">
<span class="dateBox">
<el-date-picker
......@@ -133,16 +154,38 @@
label="性别">
</el-table-column>
<el-table-column
prop="driver_face_with_hats"
align="center"
label="是否带盔">
v-if="conditions.event_type=='xcycle'"
prop="driver_face_with_hats"
align="center"
label="是否带盔">
</el-table-column>
<el-table-column
prop="xcycle_plate_text"
align="center"
label="车牌号码">
<el-table-column
v-if="conditions.event_type=='pedestrian'"
prop="driver_face_with_hats"
align="center"
label="是否带帽">
</el-table-column>
<el-table-column
v-if="conditions.event_type=='pedestrian'"
prop="driver_face_upbody_text"
align="center"
label="上身颜色">
</el-table-column>
<el-table-column
v-if="conditions.event_type=='pedestrian'"
prop="driver_face_lobody_text"
align="center"
label="下身颜色">
</el-table-column>
<el-table-column
v-if="conditions.event_type=='xcycle'"
prop="xcycle_plate_text"
align="center"
label="车牌号码">
</el-table-column>
<el-table-column
v-if="conditions.event_type=='xcycle'"
prop="company"
align="center"
label="运营公司">
......@@ -286,7 +329,9 @@
sex:'',
company:'',
with_hats:'',
plate:''
plate:'',
upbodyColor:'',
lobodyColor:''
},
brandList:this.$buildCode.getCodeList('车辆品牌'),
vehicleTypeList:this.$buildCode.getCodeList('车辆类型'),
......@@ -347,7 +392,7 @@
Math.random() +
"&event_type=" +
this.conditions.event_type +
"event_dt__gte=" +
"&event_dt__gte=" +
this.$moment(this.conditions.start_dt).utc().format('YYYY-MM-DD HH:mm:ss') +
"&event_dt__lt=" +
this.$moment(this.conditions.end_dt).utc().format('YYYY-MM-DD HH:mm:ss') +
......@@ -381,12 +426,10 @@
this.conditions.task_id +
"&subtask_id=" +
this.conditions.subtask_id +
"&company_like=" +
this.conditions.company +
"&with_hats=" +
this.conditions.with_hats +
"&plate_number__like=" +
this.conditions.plate
'&upbodyColor='+this.conditions.upbodyColor+
'&lobodyColor='+this.conditions.lobodyColor
}
window.open(
encodeURI(url)
......@@ -476,12 +519,16 @@
subtask_id: this.conditions.subtask_id,
event_type: this.conditions.event_type,
sex: this.conditions.sex,
company_like:this.conditions.company,
with_hats: this.conditions.with_hats,
plate_number__like: this.conditions.plate
with_hats: this.conditions.with_hats
}
if( this.conditions.event_type=='xcycle'){
search_params.xcycle_type=this.conditions.xcycle_type;
search_params.company_like=this.conditions.company;
search_params.plate_number__like=this.conditions.plate;
}else{
search_params.upbodyColor=this.conditions.upbodyColor;
search_params.lobodyColor=this.conditions.lobodyColor;
}
this.$api.search.tableList(search_params
).then((res)=>{
......
......@@ -8,5 +8,18 @@ module.exports = {
prependData: '@import "@/assets/scss/common.scss";'
}
}
}
},
devServer:{
proxy: {
"/api": {
target: "http://vion-panda.51vip.biz:52510", // 要访问的接口域名
ws: true, // 是否启用websockets
changeOrigin: true, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
pathRewrite: {
"^/api": "" //这里理解成用'/api'代替target里面的地址,比如我要调用'http://40.00.100.100:3002/user/add',直接写'/api/user/add'即可
}
}
}
}
};
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!