Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform-ui
Commits
4336e181
Commit
4336e181
authored
Apr 15, 2019
by
164003836@qq.con
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车辆信息管理:http调用地址相关逻辑
parent
f052b6e5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
278 deletions
+93
-278
dev.env.js
config/dev.env.js
+1
-1
index.js
config/index.js
+5
-2
prod.env.js
config/prod.env.js
+1
-1
package-lock.json
package-lock.json
+21
-0
index.js
src/api/base_info/branch_company/index.js
+7
-89
index.js
src/api/base_info/constant/index.js
+12
-2
index.js
src/api/base_info/region/index.js
+19
-4
index.js
src/api/vehicle/bookRecord/index.js
+6
-86
index.js
src/api/vehicle/vehicleInfo/index.js
+8
-91
fetch.js
src/utils/fetch.js
+1
-1
index.vue
src/views/baseInfo/branchCompany/index.vue
+12
-1
No files found.
config/dev.env.js
View file @
4336e181
module
.
exports
=
{
NODE_ENV
:
'"development"'
,
BASE_API
:
'"http://
10.5.52.2:8765
"'
,
BASE_API
:
'"http://
localhost:9527
"'
,
APP_ORIGIN
:
'"https://wallstreetcn.com"'
}
config/index.js
View file @
4336e181
...
...
@@ -8,7 +8,7 @@ module.exports = {
index
:
path
.
resolve
(
__dirname
,
'../dist/index.html'
),
assetsRoot
:
path
.
resolve
(
__dirname
,
'../dist'
),
assetsSubDirectory
:
'static'
,
assetsPublicPath
:
'.
/'
,
//请根据自己路径配置更改
assetsPublicPath
:
'
/'
,
//请根据自己路径配置更改
productionSourceMap
:
false
,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
...
...
@@ -41,7 +41,10 @@ module.exports = {
pathRewrite
:
{
'^/api'
:
'/api'
},
}
},
'/vehicle'
:
{
target
:
'http://10.5.52.2:8765'
},
},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
...
...
config/prod.env.js
View file @
4336e181
module
.
exports
=
{
NODE_ENV
:
'"production"'
,
BASE_API
:
'"https://api-prod
"'
,
BASE_API
:
'"http://10.5.52.2:9800
"'
,
APP_ORIGIN
:
'"https://wallstreetcn.com"'
};
package-lock.json
View file @
4336e181
...
...
@@ -10026,6 +10026,22 @@
"resolved"
:
"https://registry.npmjs.org/vuex/-/vuex-2.3.1.tgz"
,
"integrity"
:
"sha1-zejpl8H5lXcZvH3qFU+appHZgaY="
},
"vxe-utils"
:
{
"version"
:
"1.4.8"
,
"resolved"
:
"https://registry.npmjs.org/vxe-utils/-/vxe-utils-1.4.8.tgz"
,
"integrity"
:
"sha512-FHIf9tNhuIo/JerZiiaccnrab8BdIVqM/WneMGgjVs0UnNgANecBcwfsB3xsMQrMiOV5JKkndNdr7Ry2DqK8gg=="
,
"requires"
:
{
"vue"
:
"^2.5.22"
,
"xe-utils"
:
"^1.8.9"
},
"dependencies"
:
{
"vue"
:
{
"version"
:
"2.6.10"
,
"resolved"
:
"https://registry.npmjs.org/vue/-/vue-2.6.10.tgz"
,
"integrity"
:
"sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
}
}
},
"watchpack"
:
{
"version"
:
"1.4.0"
,
"resolved"
:
"https://registry.npm.taobao.org/watchpack/download/watchpack-1.4.0.tgz"
,
...
...
@@ -10585,6 +10601,11 @@
}
}
},
"xe-utils"
:
{
"version"
:
"1.8.19"
,
"resolved"
:
"https://registry.npmjs.org/xe-utils/-/xe-utils-1.8.19.tgz"
,
"integrity"
:
"sha512-XyAyb2xoz4WGZtYqr+S/B9eoFqYlhmqihRacS0+aJ9wAA8nJyl33BZbuRGzkCKTHnBatIrpv6rieysT1FrvNJQ=="
},
"xlsx"
:
{
"version"
:
"0.10.9"
,
"resolved"
:
"https://registry.npmjs.org/xlsx/-/xlsx-0.10.9.tgz"
,
...
...
src/api/base_info/branch_company/index.js
View file @
4336e181
import
axios
from
'axios'
;
import
rsCode
from
"../../../utils/rsCode"
;
import
store
from
"../../../store"
;
import
{
getToken
}
from
'utils/auth'
;
import
{
Message
,
MessageBox
}
from
"element-ui"
;
import
XEUtils
from
'xe-utils'
;
//加入常用工具类
import
VXEUtils
from
'vxe-utils'
;
//加入常用工具类
// 创建axios实例
const
fetch
=
axios
.
create
({
baseURL
:
'http://localhost:8091/vehicle'
,
// api的base_url
timeout
:
5000
// 请求超时时间
});
// request拦截器
fetch
.
interceptors
.
request
.
use
(
config
=>
{
// Do something before request is sent
if
(
store
.
getters
.
token
)
{
config
.
headers
[
'Authorization'
]
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
return
config
;
},
error
=>
{
// Do something with request error
console
.
log
(
error
);
// for debug
Promise
.
reject
(
error
);
})
// respone拦截器
fetch
.
interceptors
.
response
.
use
(
response
=>
{
/**
* 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页
* 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中
*/
const
res
=
response
.
data
;
if
(
response
.
status
===
401
||
res
.
status
===
40101
)
{
MessageBox
.
confirm
(
'你已被登出,可以取消继续留在该页面,或者重新登录'
,
'确定登出'
,
{
confirmButtonText
:
'重新登录'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
});
})
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40301
)
{
Message
({
message
:
'当前用户无相关操作权限!'
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40001
)
{
Message
({
message
:
'账户或密码错误!'
,
type
:
'warning'
});
return
Promise
.
reject
(
'error'
);
}
if
(
response
.
status
!==
200
&&
res
.
status
!==
200
)
{
Message
({
message
:
res
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
}
else
{
return
response
.
data
;
}
},
error
=>
{
// console.log(error); // for debug
Message
({
message
:
error
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
error
);
}
);
import
fetch
from
'utils/fetch'
;
export
function
page
(
query
)
{
return
fetch
({
url
:
'/branchCompany/page'
,
url
:
'/
vehicle/
branchCompany/page'
,
method
:
'get'
,
params
:
query
});
...
...
@@ -94,7 +12,7 @@ export function page(query) {
export
function
getObj
(
id
)
{
return
fetch
({
url
:
'/branchCompany/'
+
id
,
url
:
'/
vehicle/
branchCompany/'
+
id
,
method
:
'get'
});
}
...
...
@@ -102,7 +20,7 @@ export function getObj(id) {
export
function
addObj
(
obj
)
{
return
fetch
({
url
:
'/branchCompany/'
,
url
:
'/
vehicle/
branchCompany/'
,
method
:
'post'
,
data
:
obj
});
...
...
@@ -111,14 +29,14 @@ export function addObj(obj) {
export
function
delObj
(
id
)
{
return
fetch
({
url
:
'/branchCompany/'
+
id
,
url
:
'/
vehicle/
branchCompany/'
+
id
,
method
:
'delete'
})
}
export
function
putObj
(
obj
)
{
return
fetch
({
url
:
'/branchCompany'
,
url
:
'/
vehicle/
branchCompany'
,
method
:
'put'
,
data
:
obj
})
...
...
@@ -126,7 +44,7 @@ export function putObj(obj) {
export
function
getAll
()
{
return
fetch
({
url
:
'/branchCompany'
,
url
:
'/
vehicle/
branchCompany'
,
method
:
'get'
})
}
...
...
src/api/base_info/constant/index.js
View file @
4336e181
...
...
@@ -9,19 +9,29 @@ import {
VEHICLE_CONSTANT_USE_TYPE_UNKOWN
,
VEHICLE_CONSTANT_STATUS_NORMAL
}
from
'../../../store/modules/baseInfo'
;
import
{
BASE_API
}
from
"../../../../config/dev.env"
;
import
{
getToken
}
from
'utils/auth'
;
function
loadFromServer
(
type
)
{
if
(
!
type
)
{
console
.
error
(
' load constant with no type'
);
return
;
}
let
headerAuthorization
=
undefined
;
if
(
store
.
getters
.
token
)
{
headerAuthorization
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
// url : baseURL+"",//路径
let
rs
;
$
.
ajax
({
type
:
'get'
,
url
:
'http://localhost:8091
/vehicle/constant/type/'
+
type
,
url
:
process
.
env
.
BASE_API
+
'
/vehicle/constant/type/'
+
type
,
async
:
false
,
headers
:
{
Authorization
:
headerAuthorization
},
dataType
:
'json'
,
data
:
{},
success
:
function
(
result
)
{
...
...
src/api/base_info/region/index.js
View file @
4336e181
import
store
from
'../../../store'
;
import
rsCode
from
'../../../utils/rsCode'
;
import
baseInfo
from
"../../../store/modules/baseInfo"
;
import
{
getToken
}
from
'utils/auth'
;
function
loadFromServer
(
codes
)
{
if
(
!
codes
)
{
console
.
error
(
' load region with no code'
);
}
let
headerAuthorization
=
undefined
;
if
(
store
.
getters
.
token
)
{
headerAuthorization
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
// url : baseURL+"",//路径
let
rs
;
$
.
ajax
({
type
:
'get'
,
url
:
'http://localhost:8091
/vehicle/sysRegion'
,
url
:
process
.
env
.
BASE_API
+
'
/vehicle/sysRegion'
,
async
:
false
,
headers
:
{
Authorization
:
headerAuthorization
},
dataType
:
'json'
,
data
:
{
idListJson
:
JSON
.
stringify
(
codes
)
...
...
@@ -37,11 +45,18 @@ function loadSonsFromServer(code) {
if
(
!
code
)
{
console
.
error
(
' load region with no code'
);
}
let
headerAuthorization
=
undefined
;
if
(
store
.
getters
.
token
)
{
headerAuthorization
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
// url : baseURL+"",//路径
let
rs
;
$
.
ajax
({
type
:
'get'
,
url
:
'http://localhost:8091/vehicle/sysRegion/sons/'
+
code
,
url
:
process
.
env
.
BASE_API
+
'/vehicle/sysRegion/sons/'
+
code
,
headers
:
{
Authorization
:
headerAuthorization
},
async
:
false
,
data
:
{},
success
:
function
(
result
)
{
...
...
src/api/vehicle/bookRecord/index.js
View file @
4336e181
import
axios
from
'axios'
;
import
store
from
"../../../store"
;
import
{
getToken
}
from
'utils/auth'
;
import
{
Message
,
MessageBox
}
from
"element-ui"
;
// 创建axios实例
const
fetch
=
axios
.
create
({
baseURL
:
'http://localhost:8091/vehicle'
,
// api的base_url
timeout
:
5000
// 请求超时时间
});
// request拦截器
fetch
.
interceptors
.
request
.
use
(
config
=>
{
// Do something before request is sent
if
(
store
.
getters
.
token
)
{
config
.
headers
[
'Authorization'
]
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
return
config
;
},
error
=>
{
// Do something with request error
console
.
log
(
error
);
// for debug
Promise
.
reject
(
error
);
})
// respone拦截器
fetch
.
interceptors
.
response
.
use
(
response
=>
{
/**
* 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页
* 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中
*/
const
res
=
response
.
data
;
if
(
response
.
status
===
401
||
res
.
status
===
40101
)
{
MessageBox
.
confirm
(
'你已被登出,可以取消继续留在该页面,或者重新登录'
,
'确定登出'
,
{
confirmButtonText
:
'重新登录'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
});
})
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40301
)
{
Message
({
message
:
'当前用户无相关操作权限!'
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40001
)
{
Message
({
message
:
'账户或密码错误!'
,
type
:
'warning'
});
return
Promise
.
reject
(
'error'
);
}
if
(
response
.
status
!==
200
&&
res
.
status
!==
200
)
{
Message
({
message
:
res
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
}
else
{
return
response
.
data
;
}
},
error
=>
{
// console.log(error); // for debug
Message
({
message
:
error
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
error
);
}
);
import
fetch
from
'utils/fetch'
;
export
function
page
(
query
)
{
return
fetch
({
url
:
'/vehicleInfo/bookedRecord'
,
url
:
'/vehicle
/vehicle
Info/bookedRecord'
,
method
:
'get'
,
params
:
{
vehicleBookRecordQueryVoJson
:
JSON
.
stringify
(
query
)}
});
...
...
@@ -91,7 +11,7 @@ export function page(query) {
export
function
getObj
(
id
)
{
return
fetch
({
url
:
'/vehicleInfo/'
+
id
,
url
:
'/vehicle
/vehicle
Info/'
+
id
,
method
:
'get'
});
}
...
...
@@ -99,21 +19,21 @@ export function getObj(id) {
export
function
prove
(
id
)
{
return
fetch
({
url
:
'/vehicleInfo/book/4employee/prove/'
+
id
,
url
:
'/vehicle
/vehicle
Info/book/4employee/prove/'
+
id
,
method
:
'put'
});
}
export
function
reject
(
id
)
{
return
fetch
({
url
:
'/vehicleInfo/book/4employee/reject/'
+
id
,
url
:
'/vehicle
/vehicle
Info/book/4employee/reject/'
+
id
,
method
:
'put'
});
}
export
function
unbook
(
id
)
{
return
fetch
({
url
:
'/vehicleInfo/unbook/4employee/'
+
id
,
url
:
'/vehicle
/vehicle
Info/unbook/4employee/'
+
id
,
method
:
'delete'
});
}
src/api/vehicle/vehicleInfo/index.js
View file @
4336e181
import
axios
from
'axios'
;
import
store
from
"../../../store"
;
import
{
Message
,
MessageBox
}
from
"element-ui"
;
import
{
getToken
}
from
'utils/auth'
;
// 创建axios实例
const
fetch
=
axios
.
create
({
baseURL
:
'http://localhost:8091/vehicle'
,
// api的base_url
timeout
:
5000
// 请求超时时间
});
// request拦截器
fetch
.
interceptors
.
request
.
use
(
config
=>
{
// Do something before request is sent
if
(
store
.
getters
.
token
)
{
config
.
headers
[
'Authorization'
]
=
getToken
();
// 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
return
config
;
},
error
=>
{
// Do something with request error
console
.
log
(
error
);
// for debug
Promise
.
reject
(
error
);
})
// respone拦截器
fetch
.
interceptors
.
response
.
use
(
response
=>
{
/**
* 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页
* 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中
*/
const
res
=
response
.
data
;
if
(
response
.
status
===
401
||
res
.
status
===
40101
)
{
MessageBox
.
confirm
(
'你已被登出,可以取消继续留在该页面,或者重新登录'
,
'确定登出'
,
{
confirmButtonText
:
'重新登录'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
});
})
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40301
)
{
Message
({
message
:
'当前用户无相关操作权限!'
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
'error'
);
}
if
(
res
.
status
===
40001
)
{
Message
({
message
:
'账户或密码错误!'
,
type
:
'warning'
});
return
Promise
.
reject
(
'error'
);
}
if
(
response
.
status
!==
200
&&
res
.
status
!==
200
)
{
Message
({
message
:
res
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
}
else
{
return
response
.
data
;
}
},
error
=>
{
// console.log(error); // for debug
Message
({
message
:
error
.
message
,
type
:
'error'
,
duration
:
5
*
1000
});
return
Promise
.
reject
(
error
);
}
);
import
fetch
from
'utils/fetch'
;
export
function
page
(
query
)
{
return
fetch
({
url
:
'/vehicleInfo/page'
,
url
:
'/vehicle
/vehicle
Info/page'
,
method
:
'get'
,
params
:
{
vehiclePageQueryVoJson
:
query
}
});
...
...
@@ -93,7 +10,7 @@ export function page(query) {
export
function
getObj
(
id
)
{
return
fetch
({
url
:
'/vehicleInfo/'
+
id
,
url
:
'/vehicle
/vehicle
Info/'
+
id
,
method
:
'get'
});
}
...
...
@@ -101,7 +18,7 @@ export function getObj(id) {
export
function
addObj
(
obj
)
{
return
fetch
({
url
:
'/vehicleInfo'
,
url
:
'/vehicle
/vehicle
Info'
,
method
:
'post'
,
data
:
[
obj
]
});
...
...
@@ -109,7 +26,7 @@ export function addObj(obj) {
export
function
book
(
param
)
{
return
fetch
({
url
:
'/vehicleInfo/book/4employee'
,
url
:
'/vehicle
/vehicle
Info/book/4employee'
,
method
:
'post'
,
data
:
param
})
...
...
@@ -117,7 +34,7 @@ export function book(param) {
export
function
putObj
(
obj
)
{
return
fetch
({
url
:
'/vehicleInfo'
,
url
:
'/vehicle
/vehicle
Info'
,
method
:
'put'
,
data
:
[
obj
]
})
...
...
@@ -125,14 +42,14 @@ export function putObj(obj) {
export
function
getBookedInfoIn2Month
(
vehicleId
)
{
return
fetch
({
url
:
'/vehicleInfo/bookedInfo/'
+
vehicleId
,
url
:
'/vehicle
/vehicle
Info/bookedInfo/'
+
vehicleId
,
method
:
'get'
});
}
export
function
getBookedInfo
(
vehicleId
,
yearMonth
)
{
return
fetch
({
url
:
'/vehicleInfo/bookedInfo/'
+
vehicleId
+
'/'
+
yearMonth
,
url
:
'/vehicle
/vehicle
Info/bookedInfo/'
+
vehicleId
+
'/'
+
yearMonth
,
method
:
'get'
});
}
src/utils/fetch.js
View file @
4336e181
...
...
@@ -10,7 +10,7 @@ import {
// 创建axios实例
const
service
=
axios
.
create
({
//
baseURL: process.env.BASE_API, // api的base_url
baseURL
:
process
.
env
.
BASE_API
,
// api的base_url
timeout
:
5000
// 请求超时时间
});
...
...
src/views/baseInfo/branchCompany/index.vue
View file @
4336e181
...
...
@@ -304,7 +304,18 @@
this
.
listLoading
=
true
;
page
(
this
.
listQuery
)
.
then
(
response
=>
{
this
.
list
=
response
.
data
.
data
;
let
listTemp
=
response
.
data
.
data
;
//一次读入所有涉及地区,防止多次读取
if
(
!
this
.
$utils
.
isEmpty
(
listTemp
))
{
let
allRegions
=
new
Set
();
for
(
let
index
in
listTemp
)
{
allRegions
.
add
(
listTemp
[
index
].
addrProvince
);
allRegions
.
add
(
listTemp
[
index
].
addrCity
);
allRegions
.
add
(
listTemp
[
index
].
addrTown
);
}
getRegionByCodes
([...
allRegions
]);
}
this
.
list
=
listTemp
;
this
.
total
=
response
.
data
.
totalCount
;
this
.
listLoading
=
false
;
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment