Commit abe991d4 by 潘建波

Merge branch 'fanxing' of http://192.168.9.26/platform/fanxing_new into fanxing

# Conflicts:
#	package.json
#	public/index.html
#	src/App.vue
#	src/api/apiList.js
#	src/api/axios.js
#	src/api/index.js
#	src/api/install.js
#	src/api/login/index.js
#	src/api/login/urls.js
#	src/api/taskManage/urls.js
#	src/assets/resetElementCss/index.css
#	src/assets/scss/common.scss
#	src/main.js
#	src/router/index.js
#	src/store/actions.js
#	src/store/index.js
#	src/views/Home.vue
#	src/views/Login.vue
#	src/views/sceneManage/index.vue
#	vue.config.js
2 parents 23f6cdf0 4c917f85
import axios from "axios"; import axios from 'axios'
import store from "../store/index.js"; import store from '../store/index.js'
// 创建 axios 实例 // 创建 axios 实例
let service = axios.create({ let service = axios.create({
// headers: {'Content-Type': 'application/json'}, // headers: {'Content-Type': 'application/json'},
timeout: 60000 timeout: 60000
}); })
// 设置 post、put 默认 Content-Type // 设置 post、put 默认 Content-Type
service.defaults.headers.post["Content-Type"] = "application/json"; service.defaults.headers.post['Content-Type'] = 'application/json'
service.defaults.headers.put["Content-Type"] = "application/json"; service.defaults.headers.put['Content-Type'] = 'application/json'
// 添加请求拦截器 // 添加请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
config => { (config) => {
if (store.state.users.atoken) { if (store.state.users.atoken) { // 判断是否存在token,如果存在的话,则每个http header都加上token
// 判断是否存在token,如果存在的话,则每个http header都加上token
config.headers.authorization = store.state.users.atoken; config.headers.authorization = store.state.users.atoken;
} }
if (config.method == "post") { if (config.method == 'post') {
config.data = { config.data = {
...config.data, ...config.data,
_t: Date.parse(new Date()) / 1000 _t: Date.parse(new Date()) / 1000
}; }
} else if (config.method == "get") { } else if (config.method == 'get') {
config.params = { config.params = {
_t: Date.parse(new Date()) / 1000, _t: Date.parse(new Date()) / 1000,
...config.params ...config.params
};
} }
return config; }
return config
}, },
error => { (error) => {
// 请求错误处理 // 请求错误处理
return Promise.reject(error); return Promise.reject(error)
} }
); )
// 添加响应拦截器 // 添加响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { (response) => {
let { data } = response; let { data } = response
return data; return data
}, },
error => { (error) => {
console.log(error); console.log(error)
let info = {}; let info = {}
if (!error.response) { if (!error.response) {
info = { info = {
code: 5000, code: 5000,
msg: "Network Error" msg: 'Network Error'
}; }
} else { } else {
let { status, statusText, data } = error.response; let { status, statusText, data } = error.response
// 此处整理错误信息格式 // 此处整理错误信息格式
info = { info = {
code: status, code: status,
data: data, data: data,
msg: statusText msg: statusText
};
} }
return Promise.reject(error);
} }
); return Promise.reject(error)
}
)
/** /**
* 创建统一封装过的 axios 实例 * 创建统一封装过的 axios 实例
* @return {AxiosInstance} * @return {AxiosInstance}
*/ */
export default function() { export default function() {
return service; return service
} }
import axios from "./axios"; import axios from './axios'
let instance = axios(); let instance = axios()
export default { export default {
get(url, params, headers) { get(url, params, headers) {
let options = {}; let options = {}
if (params) { if (params) {
options.params = params; options.params = params
} }
if (headers) { if (headers) {
options.headers = headers; options.headers = headers
} }
return instance.get(url, options); return instance.get(url, options)
}, },
post(url, data, headers, params) { post(url,data,headers,params) {
let options = {}; let options = {}
if (params) { if (params) {
options.params = params; options.params = params
} }
if (headers) { if (headers) {
options.headers = headers; options.headers = headers
} }
return instance.post(url, data, options); return instance.post(url, data, options)
}, },
put(url, params, headers) { put(url, params, headers) {
let options = {}; let options = {}
if (headers) { if (headers) {
options.headers = headers; options.headers = headers
} }
return instance.put(url, params, options); return instance.put(url, params, options)
}, },
delete(url, params, headers) { delete(url, params, headers) {
let options = {}; let options = {}
if (params) { if (params) {
options.params = params; options.params = params
} }
if (headers) { if (headers) {
options.headers = headers; options.headers = headers
} }
return instance.delete(url, options); return instance.delete(url, options)
} }
}; }
import apiList from "./apiList"; import apiList from './apiList'
const install = function(Vue) { const install = function(Vue) {
if (install.installed) { if (install.installed) {
return; return
} }
install.installed = true; install.installed = true
Object.defineProperties(Vue.prototype, { Object.defineProperties(Vue.prototype, {
$api: { $api: {
get() { get() {
return apiList; return apiList
} }
} }
}); })
}; }
export default { export default {
install install
}; }
import api from "../index"; import api from '../index'
import urls from "./urls"; import urls from './urls'
export default { export default {
//登陆 //登陆
login(params, id) { login(params,id) {
return api.post(urls.login, params) return api.post(urls.login,params)
}, },
algocombs(params, id) { algocombs(params,id){
return api.get(urls.algocombs, params); return api.get(urls.algocombs,params)
}, },
storeconfs(params, id) { storeconfs(params,id){
return api.get(urls.storeconfs, params); return api.get(urls.storeconfs,params)
},
cates(params,id){
return api.get(urls.cates,params)
},
codes(params,id){
return api.get(urls.codes+id+'/codes',params)
} }
}; }
...@@ -2,5 +2,7 @@ import baseUrl from '../baseUrl' ...@@ -2,5 +2,7 @@ import baseUrl from '../baseUrl'
export default { export default {
login: baseUrl + '/api/v1/devconf_fx/users/login', login: baseUrl + '/api/v1/devconf_fx/users/login',
algocombs:baseUrl+'/api/v1/devconf_fx/algo_combs', algocombs:baseUrl+'/api/v1/devconf_fx/algo_combs',
storeconfs:baseUrl+'/api/v1/devconf_fx/store_confs' storeconfs:baseUrl+'/api/v1/devconf_fx/store_confs',
cates:baseUrl+'/api/v1/codes/traffic/cates',
codes:baseUrl+'/api/v1/codes/traffic/cates/',
} }
\ No newline at end of file \ No newline at end of file
import api from '../index'
import urls from './urls'
export default {
vehicleList(params) {
return api.get(urls.vehicleList, params)
},
detailImg(params,id) {
return api.get(urls.detailImg+id, params)
},
delVehicle(params,id) {
// return出去了一个promise
return api.delete(urls.delVehicle+id,params)
},
}
\ No newline at end of file \ No newline at end of file
import baseUrl from '../baseUrl'
export default {
vehicleList: baseUrl + '/api/v1/traffic/events',
detailImg: baseUrl + '/api/v1/web/pics/',
delVehicle: baseUrl + '/api/v1/traffic/events/',
}
\ No newline at end of file \ No newline at end of file
import baseUrl from "../baseUrl"; import baseUrl from '../baseUrl'
export default { export default {
tasks: baseUrl + "/api/v1/devconf_fx/tasks", tasks: baseUrl + '/api/v1/devconf_fx/tasks',
subtasks: baseUrl + "/api/v1/devconf_fx/tasks/" subtasks:baseUrl+'/api/v1/devconf_fx/tasks/',
}; }
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
} }
.el-popper[x-placement^=bottom]{ .el-popper[x-placement^=bottom]{
margin-top: 0; margin-top: 0;
left:0!important;
} }
.el-select-dropdown__list{ .el-select-dropdown__list{
padding: 4px 0; padding: 4px 0;
...@@ -182,3 +183,6 @@ ...@@ -182,3 +183,6 @@
left: 100%; left: 100%;
margin-left: -10px; margin-left: -10px;
} }
.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
margin-bottom: 4px;
}
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ $bodyback-color:#f5f7f9; ...@@ -6,6 +6,7 @@ $bodyback-color:#f5f7f9;
$border-color:#e5e5e5; $border-color:#e5e5e5;
$title-color:#f4f4f4; $title-color:#f4f4f4;
$title-backgroud:#f3f3f3; $title-backgroud:#f3f3f3;
$dialog-title:#3BB7FF;
body{ body{
margin: 0; margin: 0;
color: $font-color; color: $font-color;
...@@ -33,7 +34,10 @@ a:active{ ...@@ -33,7 +34,10 @@ a:active{
} }
.inputBox{ .inputBox{
display: inline-block; display: inline-block;
width: 200px; width: 150px;
}
.innnerBox{
padding: 10px;background: #FFFFFF;margin: 10px;
} }
.selectBox{ .selectBox{
width:150px; width:150px;
...@@ -84,4 +88,22 @@ a:active{ ...@@ -84,4 +88,22 @@ a:active{
padding: 12px; padding: 12px;
} }
} }
.detaiCon span{
display: inline-block;
width: 120px;
}
.arrow{
position: absolute;
font-size: 38px;
top: 43%;
cursor: pointer;
color:$dialog-title;
}
.leftArrow{
@extend .arrow;
left: -27px;
}
.rightArrow{
@extend .arrow;
right: -27px;
}
...@@ -9,11 +9,12 @@ import api from "./api/install"; ...@@ -9,11 +9,12 @@ import api from "./api/install";
import "./assets/css/public.css"; import "./assets/css/public.css";
import echarts from "echarts"; import echarts from "echarts";
import "./assets/icon/iconfont.css"; import "./assets/icon/iconfont.css";
import buildCode from "../src/assets/js/buildcodes";
import moment from "moment"; import moment from "moment";
Vue.prototype.$echarts = echarts; Vue.prototype.$echarts = echarts;
Vue.prototype.$moment = moment; Vue.prototype.$moment = moment;
Vue.prototype.$buildCode = buildCode;
Vue.prototype.oParse = new XML.ObjTree() Vue.prototype.oParse = new XML.ObjTree();
Vue.use(api); Vue.use(api);
Vue.use(ElementUI, { size: "small", zIndex: 3000 }); Vue.use(ElementUI, { size: "small", zIndex: 3000 });
Vue.use(resetCss); Vue.use(resetCss);
......
...@@ -7,24 +7,27 @@ const routes = [ ...@@ -7,24 +7,27 @@ const routes = [
{ {
path: "/", path: "/",
name: "home", name: "home",
component: resolve => require(["../views/Home.vue"], resolve), component: resolve => require(['../views/Home.vue'], resolve),
children: [ children:[
{ {
path: "/map", path: "/map",
name: "mapShow", name: "mapShow",
component: resolve => require(["../views/mapShow/index.vue"], resolve) component: resolve => require(['../views/mapShow/index.vue'], resolve),
}, },
{ {
path: "/task/sceneSet", path: "/task/sceneSet",
name: "sceneSet", name: "sceneSet",
component: resolve => component: resolve => require(['../views/sceneManage/index.vue'], resolve),
require(["../views/sceneManage/index.vue"], resolve)
}, },
{ {
path: "/task/taskSet", path: "/task/taskSet",
name: "taskSet", name: "taskSet",
component: resolve => component: resolve => require(['../views/taskManage/index.vue'], resolve),
require(["../views/taskManage/index.vue"], resolve) },
{
path: "/search/vehicleSearch",
name: "taskSet",
component: resolve => require(['../views/search/vehicleSearch.vue'], resolve),
} }
] ]
}, },
...@@ -34,7 +37,7 @@ const routes = [ ...@@ -34,7 +37,7 @@ const routes = [
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: resolve => require(["../views/Login.vue"], resolve) component: resolve => require(['../views/Login.vue'], resolve)
} }
]; ];
......
// 异步操作中需要用到 increment 方法,所以需要导入 types.js 文件 // 异步操作中需要用到 increment 方法,所以需要导入 types.js 文件
import types from "./types"; import types from './types'
const actions = { const actions= {
incrementAsync({ commit, state }) { incrementAsync({ commit, state }) {
// 异步操作 // 异步操作
var p = new Promise((resolve, reject) => { var p = new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
resolve(); resolve()
}, 3000); }, 3000);
}); });
p.then(() => { p.then(() => {
commit(types.INCREMENT); commit(types.INCREMENT);
}).catch(() => { }).catch(() => {
console.log("异步操作"); console.log('异步操作');
}); })
} }
}; }
// 最后导出 // 最后导出
export default actions; export default actions;
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<i class="el-icon-document"></i> <i class="el-icon-document"></i>
<span slot="title">智能检索</span> <span slot="title">智能检索</span>
</template> </template>
<el-menu-item index="/search/vehicleSearch"> <i class="el-icon-location"></i>过车记录检索</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="4"> <el-submenu index="4">
<template slot="title"> <template slot="title">
......
...@@ -63,6 +63,8 @@ import types from '../store/types.js' ...@@ -63,6 +63,8 @@ import types from '../store/types.js'
this.algoList(); this.algoList();
//存储配置列表 //存储配置列表
this.storeConfList(); this.storeConfList();
//code列表
this.getCodeList();
this.$router.push('/map') this.$router.push('/map')
} }
...@@ -90,6 +92,23 @@ import types from '../store/types.js' ...@@ -90,6 +92,23 @@ import types from '../store/types.js'
} }
}).catch((err) => { }).catch((err) => {
}) })
},
getCodeList(){
this.$api.login.cates().then(res => {
res.list_data.forEach(item=>{
this.$api.login.codes({
},item.cate_unid).then(res => {
// 存储code列表
window.localStorage.setItem(item.name,JSON.stringify(res.list_data))
// 存储单独code
res.list_data.forEach(chilItem=>{
window.localStorage.setItem(item.name+'-'+chilItem.code,chilItem.name)
})
}).catch((err) => {
})
})
}).catch((err) => {
})
} }
}, },
watch: {}, watch: {},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!