Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
video-monitoring
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
刘怀志
video-monitoring
Commits
9aa070f4
Commit
9aa070f4
authored
Aug 06, 2024
by
拾柒
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-sunyu'
parents
f413bd43
2951a6d9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
534 additions
and
443 deletions
+534
-443
index.vue
src/components/TopNav/index.vue
+18
-31
index.js
src/router/index.js
+121
-124
request.js
src/utils/request.js
+17
-10
index.vue
src/views/employee/index.vue
+69
-111
index.vue
src/views/history/index.vue
+237
-94
vue.config.js
vue.config.js
+72
-73
No files found.
src/components/TopNav/index.vue
View file @
9aa070f4
...
...
@@ -6,42 +6,29 @@
@
select=
"handleSelect"
style=
"margin-right: 120px"
>
<template>
<el-menu-item
class=
"menuStyle"
style=
"font-size: small;background-color: #F6F6FA;border-top-right-radius: 15px;border-top-left-radius: 15px;text-align: center;margin-left: 1px"
index=
"/monitoring/video"
<template
v-for=
"(item, index) in newTopNev"
>
<el-menu-item
class=
"menuStyle"
style=
"font-size: small;background-color: #F6F6FA;border-top-right-radius: 15px;border-top-left-radius: 15px;text-align: center;margin-left: 1px"
:index=
"item.path"
:key=
"index"
>
<i
style=
"width: 10px;height: 10px;margin-top: -12px"
></i>
首页
</el-menu-item
>
<el-menu-item
class=
"menuStyle"
style=
"font-size: small;background-color: #F6F6FA;border-top-right-radius: 15px;border-top-left-radius: 15px;text-align: center;margin-left: 1px"
index=
"/employee/employee"
>
<i
style=
"width: 10px;height: 10px;margin-top: -12px"
></i>
员工信息
</el-menu-item
>
<el-menu-item
class=
"menuStyle"
style=
"font-size: small;background-color: #F6F6FA;border-top-right-radius: 15px;border-top-left-radius: 15px;text-align: center;margin-left: 1px"
index=
"/monitoringhistory/history"
>
<i
style=
"width: 10px;height: 10px;margin-top: -12px"
></i>
历史记录
</el-menu-item
<i
:class=
"item.icon"
style=
"width: 10px;height: 10px;margin-top: -12px"
></i>
{{
item
.
name
}}
</el-menu-item
>
</
template
>
<!-- 顶部菜单超出数量折叠 -->
<!-- <el-submenu :style="{'--theme': theme}" index="more" v-if="topMenus.length > visibleNumber">-->
<!-- <template slot="title">更多菜单</template>-->
<!-- <template v-for="(item, index) in topMenus">-->
<!-- <el-menu-item-->
<!-- :index="item.path"-->
<!-- :key="index"-->
<!-- v-if="index >= visibleNumber">-->
<!-- <svg-icon-->
<!-- v-if="item.meta && item.meta.icon && item.meta.icon !== '#'"-->
<!-- :icon-class="item.meta.icon"/>-->
<!-- {{ item.meta.title }}-->
<!-- </el-menu-item>-->
<!-- </template>-->
<!-- </el-submenu>-->
<!-- <el-submenu :style="{'--theme': theme}" index="more" v-if="topMenus.length > visibleNumber">-->
<!-- <template slot="title">更多菜单</template>-->
<!-- <template v-for="(item, index) in topMenus">-->
<!-- <el-menu-item-->
<!-- :index="item.path"-->
<!-- :key="index"-->
<!-- v-if="index >= visibleNumber">-->
<!-- <svg-icon-->
<!-- v-if="item.meta && item.meta.icon && item.meta.icon !== '#'"-->
<!-- :icon-class="item.meta.icon"/>-->
<!-- {{ item.meta.title }}-->
<!-- </el-menu-item>-->
<!-- </template>-->
<!-- </el-submenu>-->
</el-menu>
</template>
...
...
src/router/index.js
View file @
9aa070f4
import
Vue
from
'vue'
import
Router
from
'vue-router'
import
Vue
from
"vue"
;
import
Router
from
"vue-router"
;
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
;
/* Layout */
import
Layout
from
'@/layout'
import
Layout
from
"@/layout"
;
/**
* Note: 路由配置项
...
...
@@ -31,213 +31,210 @@ import Layout from '@/layout'
// 公共路由
export
const
constantRoutes
=
[
{
path
:
'/redirect'
,
path
:
"/redirect"
,
component
:
Layout
,
hidden
:
true
,
children
:
[
{
path
:
'/redirect/:path(.*)'
,
component
:
()
=>
import
(
'@/views/redirect'
)
}
]
path
:
"/redirect/:path(.*)"
,
component
:
()
=>
import
(
"@/views/redirect"
),
}
,
]
,
},
{
path
:
'/login'
,
component
:
()
=>
import
(
'@/views/login'
),
hidden
:
true
path
:
"/login"
,
component
:
()
=>
import
(
"@/views/login"
),
hidden
:
true
,
},
{
path
:
'/register'
,
component
:
()
=>
import
(
'@/views/register'
),
hidden
:
true
path
:
"/register"
,
component
:
()
=>
import
(
"@/views/register"
),
hidden
:
true
,
},
{
path
:
'/404'
,
component
:
()
=>
import
(
'@/views/error/404'
),
hidden
:
true
path
:
"/404"
,
component
:
()
=>
import
(
"@/views/error/404"
),
hidden
:
true
,
},
{
path
:
'/401'
,
component
:
()
=>
import
(
'@/views/error/401'
),
hidden
:
true
path
:
"/401"
,
component
:
()
=>
import
(
"@/views/error/401"
),
hidden
:
true
,
},
{
path
:
''
,
path
:
""
,
component
:
Layout
,
redirect
:
'index'
,
redirect
:
"index"
,
children
:
[
{
path
:
'index'
,
component
:
()
=>
import
(
'@/views/video/index'
),
name
:
'Index'
,
meta
:
{
title
:
'首页'
,
icon
:
'dashboard'
,
affix
:
true
}
}
]
path
:
"index"
,
component
:
()
=>
import
(
"@/views/video/index"
),
name
:
"Index"
,
meta
:
{
title
:
"首页"
,
icon
:
"dashboard"
,
affix
:
true
},
}
,
]
,
},
{
path
:
'/user'
,
path
:
"/user"
,
component
:
Layout
,
hidden
:
true
,
redirect
:
'noredirect'
,
redirect
:
"noredirect"
,
children
:
[
{
path
:
'profile'
,
component
:
()
=>
import
(
'@/views/system/user/profile/index'
),
name
:
'Profile'
,
meta
:
{
title
:
'个人中心'
,
icon
:
'user'
}
}
]
path
:
"profile"
,
component
:
()
=>
import
(
"@/views/system/user/profile/index"
),
name
:
"Profile"
,
meta
:
{
title
:
"个人中心"
,
icon
:
"user"
},
},
],
},
{
path
:
'/monitoring'
,
path
:
"/monitoring"
,
component
:
Layout
,
hidden
:
false
,
redirect
:
'/monitoring/video'
,
redirect
:
"/monitoring/video"
,
children
:
[
{
path
:
'video'
,
component
:
()
=>
import
(
'@/views/video/index'
),
name
:
'Video'
,
meta
:
{
title
:
'视频监控'
,
icon
:
'user'
}
}
]
path
:
"video"
,
component
:
()
=>
import
(
"@/views/video/index"
),
name
:
"Video"
,
meta
:
{
title
:
"视频监控"
,
icon
:
"user"
},
}
,
]
,
},
{
path
:
'/monitoringPlayback'
,
path
:
"/monitoringPlayback"
,
component
:
Layout
,
hidden
:
false
,
redirect
:
'monitoringPlayback/playback'
,
redirect
:
"monitoringPlayback/playback"
,
children
:
[
{
path
:
'playback'
,
component
:
()
=>
import
(
'@/views/video/playback'
),
name
:
'Playback'
,
meta
:
{
title
:
'视频回放'
,
icon
:
'user'
}
}
]
path
:
"playback"
,
component
:
()
=>
import
(
"@/views/video/playback"
),
name
:
"Playback"
,
meta
:
{
title
:
"视频回放"
,
icon
:
"user"
},
}
,
]
,
},
{
path
:
'/monitoringhistory'
,
path
:
"/monitoringhistory"
,
component
:
Layout
,
hidden
:
false
,
redirect
:
'monitoringhistory/history'
,
redirect
:
"monitoringhistory/history"
,
children
:
[
{
path
:
'history'
,
component
:
()
=>
import
(
'@/views/history/index'
),
name
:
'History'
,
meta
:
{
title
:
'历史记录'
,
icon
:
'user'
}
}
]
path
:
"history"
,
component
:
()
=>
import
(
"@/views/history/index"
),
name
:
"History"
,
meta
:
{
title
:
"历史记录"
,
icon
:
"user"
},
}
,
]
,
},
{
path
:
'/employee'
,
path
:
"/employee"
,
component
:
Layout
,
hidden
:
false
,
redirect
:
'employee'
,
redirect
:
"employee"
,
children
:
[
{
path
:
'employee'
,
component
:
()
=>
import
(
'@/views/employee/index'
),
name
:
'employee'
,
meta
:
{
title
:
'员工信息'
,
icon
:
'user'
}
}
]
}
]
path
:
"employee"
,
component
:
()
=>
import
(
"@/views/employee/index"
),
name
:
"employee"
,
meta
:
{
title
:
"员工信息"
,
icon
:
"user"
},
},
],
},
];
// 动态路由,基于用户权限动态去加载
export
const
dynamicRoutes
=
[
{
path
:
'/system/user-auth'
,
path
:
"/system/user-auth"
,
component
:
Layout
,
hidden
:
true
,
permissions
:
[
'system:user:edit'
],
permissions
:
[
"system:user:edit"
],
children
:
[
{
path
:
'role/:userId(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/system/user/authRole'
),
name
:
'AuthRole'
,
meta
:
{
title
:
'分配角色'
,
activeMenu
:
'/system/user'
}
}
]
path
:
"role/:userId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/system/user/authRole"
),
name
:
"AuthRole"
,
meta
:
{
title
:
"分配角色"
,
activeMenu
:
"/system/user"
},
}
,
]
,
},
{
path
:
'/system/role-auth'
,
path
:
"/system/role-auth"
,
component
:
Layout
,
hidden
:
true
,
permissions
:
[
'system:role:edit'
],
permissions
:
[
"system:role:edit"
],
children
:
[
{
path
:
'user/:roleId(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/system/role/authUser'
),
name
:
'AuthUser'
,
meta
:
{
title
:
'分配用户'
,
activeMenu
:
'/system/role'
}
}
]
path
:
"user/:roleId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/system/role/authUser"
),
name
:
"AuthUser"
,
meta
:
{
title
:
"分配用户"
,
activeMenu
:
"/system/role"
},
}
,
]
,
},
{
path
:
'/system/dict-data'
,
path
:
"/system/dict-data"
,
component
:
Layout
,
hidden
:
true
,
permissions
:
[
'system:dict:list'
],
permissions
:
[
"system:dict:list"
],
children
:
[
{
path
:
'index/:dictId(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/system/dict/data'
),
name
:
'Data'
,
meta
:
{
title
:
'字典数据'
,
activeMenu
:
'/system/dict'
}
}
]
path
:
"index/:dictId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/system/dict/data"
),
name
:
"Data"
,
meta
:
{
title
:
"字典数据"
,
activeMenu
:
"/system/dict"
},
}
,
]
,
},
{
path
:
'/monitor/job-log'
,
path
:
"/monitor/job-log"
,
component
:
Layout
,
hidden
:
true
,
permissions
:
[
'monitor:job:list'
],
permissions
:
[
"monitor:job:list"
],
children
:
[
{
path
:
'index/:jobId(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/monitor/job/log'
),
name
:
'JobLog'
,
meta
:
{
title
:
'调度日志'
,
activeMenu
:
'/monitor/job'
}
}
]
path
:
"index/:jobId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/monitor/job/log"
),
name
:
"JobLog"
,
meta
:
{
title
:
"调度日志"
,
activeMenu
:
"/monitor/job"
},
}
,
]
,
},
{
path
:
'/tool/gen-edit'
,
path
:
"/tool/gen-edit"
,
component
:
Layout
,
hidden
:
true
,
permissions
:
[
'tool:gen:edit'
],
permissions
:
[
"tool:gen:edit"
],
children
:
[
{
path
:
'index/:tableId(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/tool/gen/editTable'
),
name
:
'GenEdit'
,
meta
:
{
title
:
'修改生成配置'
,
activeMenu
:
'/tool/gen'
}
}
]
}
]
path
:
"index/:tableId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/tool/gen/editTable"
),
name
:
"GenEdit"
,
meta
:
{
title
:
"修改生成配置"
,
activeMenu
:
"/tool/gen"
},
}
,
]
,
}
,
]
;
// 防止连续点击多次路由报错
let
routerPush
=
Router
.
prototype
.
push
;
let
routerReplace
=
Router
.
prototype
.
replace
;
// push
Router
.
prototype
.
push
=
function
push
(
location
)
{
return
routerPush
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
return
routerPush
.
call
(
this
,
location
).
catch
(
(
err
)
=>
err
);
}
;
// replace
Router
.
prototype
.
replace
=
function
push
(
location
)
{
return
routerReplace
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
return
routerReplace
.
call
(
this
,
location
).
catch
(
(
err
)
=>
err
);
}
;
export
default
new
Router
({
mode
:
'history'
,
// 去掉url中的#
mode
:
"history"
,
// 去掉url中的#
scrollBehavior
:
()
=>
({
y
:
0
}),
routes
:
constantRoutes
})
routes
:
constantRoutes
,
})
;
src/utils/request.js
View file @
9aa070f4
...
...
@@ -124,29 +124,36 @@ service.interceptors.response.use(res => {
// 通用下载方法
export
function
download
(
url
,
params
,
filename
,
config
)
{
downloadLoadingInstance
=
Loading
.
service
({
text
:
"正在下载数据,请稍候"
,
spinner
:
"el-icon-loading"
,
background
:
"rgba(0, 0, 0, 0.7)"
,
})
downloadLoadingInstance
=
Loading
.
service
({
text
:
"正在下载数据,请稍候"
,
spinner
:
"el-icon-loading"
,
background
:
"rgba(0, 0, 0, 0.7)"
});
return
service
.
post
(
url
,
params
,
{
transformRequest
:
[(
params
)
=>
{
return
tansParams
(
params
)
}],
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
transformRequest
:
[
function
(
data
)
{
return
JSON
.
stringify
(
data
);
// 将参数转换为 JSON 字符串
}],
headers
:
{
'Content-Type'
:
'application/json'
},
// 设置 Content-Type 为 application/json
responseType
:
'blob'
,
...
config
}).
then
(
async
(
data
)
=>
{
const
isBlob
=
blobValidate
(
data
);
if
(
isBlob
)
{
const
blob
=
new
Blob
([
data
])
saveAs
(
blob
,
filename
)
const
blob
=
new
Blob
([
data
])
;
saveAs
(
blob
,
filename
)
;
}
else
{
const
resText
=
await
data
.
text
();
const
rspObj
=
JSON
.
parse
(
resText
);
const
errMsg
=
errorCode
[
rspObj
.
code
]
||
rspObj
.
msg
||
errorCode
[
'default'
]
const
errMsg
=
errorCode
[
rspObj
.
code
]
||
rspObj
.
msg
||
errorCode
[
'default'
]
;
Message
.
error
(
errMsg
);
}
downloadLoadingInstance
.
close
();
}).
catch
((
r
)
=>
{
console
.
error
(
r
)
Message
.
error
(
'下载文件出现错误,请联系管理员!'
)
}).
catch
((
erro
r
)
=>
{
console
.
error
(
error
);
Message
.
error
(
'下载文件出现错误,请联系管理员!'
)
;
downloadLoadingInstance
.
close
();
})
})
;
}
export
default
service
src/views/employee/index.vue
View file @
9aa070f4
...
...
@@ -43,15 +43,34 @@
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!--
</el-form-item>
-->
<el-form-item
prop=
"userName"
>
<el-input
v-model=
"queryParams.userName"
placeholder=
"请输入账号"
clearable
style=
"width: 200px"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
prop=
"nickName"
>
<el-input
v-model=
"queryParams.nickName"
placeholder=
"请输入员工姓名"
clearable
style=
"width: 200px"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
prop=
"phonenumber"
>
<el-input
v-model=
"queryParams.phonenumber"
placeholder=
"请输入
账号/员工姓名/
手机号码"
placeholder=
"请输入手机号码"
clearable
style=
"width: 2
4
0px"
style=
"width: 2
0
0px"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
...
...
@@ -81,7 +100,7 @@
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"
2
"
>
<el-col
:span=
"
1.5
"
>
<el-button
style=
"background-color: #0D8EEE; color: #F6F6FA"
plain
...
...
@@ -90,7 +109,7 @@
@
click=
"handleAdd"
>
新增人员
</el-button>
</el-col>
<el-col
:span=
"
2
"
>
<el-col
:span=
"
1.5
"
>
<el-button
plain
icon=
"el-icon-top-right"
...
...
@@ -98,7 +117,7 @@
@
click=
"handleSelectAll"
>
选择全部
</el-button>
</el-col>
<el-col
:span=
"
2
"
>
<el-col
:span=
"
1.5
"
>
<el-button
plain
icon=
"el-icon-top-left"
...
...
@@ -115,7 +134,7 @@
@
click=
"handleImport"
>
批量导入
</el-button>
</el-col>
-->
<el-col
:span=
"
2
"
>
<el-col
:span=
"
1.5
"
>
<el-button
plain
icon=
"el-icon-download"
...
...
@@ -123,10 +142,10 @@
@
click=
"handleExport"
>
批量导出
</el-button>
</el-col>
<el-col
:span=
"1
4
"
class=
"text-right"
>
<el-col
:span=
"1
7
"
class=
"text-right"
>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
</el-col>
<el-col
:span=
"
2
"
class=
"text-right"
>
<el-col
:span=
"
1
"
class=
"text-right"
>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-col>
<!--
...
...
@@ -141,7 +160,7 @@
<el-table-column
label=
"员工姓名"
align=
"center"
key=
"nickName"
prop=
"nickName"
width=
"190"
v-if=
"columns[2].visible"
:show-overflow-tooltip=
"true"
/>
<!--
<el-table-column
label=
"部门"
align=
"center"
key=
"deptName"
prop=
"dept.deptName"
v-if=
"columns[3].visible"
:show-overflow-tooltip=
"true"
/>
-->
<el-table-column
label=
"手机号码"
align=
"center"
key=
"phonenumber"
prop=
"phonenumber"
width=
"190"
v-if=
"columns[4].visible"
/>
<el-table-column
label=
"权重"
align=
"center"
key=
"weightNum"
prop=
"weightNum"
width=
"1
9
0"
v-if=
"columns[8].visible"
/>
<el-table-column
label=
"权重"
align=
"center"
key=
"weightNum"
prop=
"weightNum"
width=
"1
5
0"
v-if=
"columns[8].visible"
/>
<el-table-column
label=
"创建人"
align=
"center"
key=
"createBy"
prop=
"createBy"
width=
"190"
v-if=
"columns[7].visible"
/>
<el-table-column
label=
"创建时间"
align=
"center"
key=
"createTime"
prop=
"createTime"
width=
"190"
v-if=
"columns[6].visible"
>
<template
slot-scope=
"scope"
>
...
...
@@ -158,37 +177,28 @@
<el-table-column
label=
"操作"
align=
"center"
width=
"
19
2"
width=
"
23
2"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
v-if=
"scope.row.userId !== 1"
>
<!-- 查看-->
<!--
<el-button
size=
"mini"
<el-button
size=
"medium"
style=
"border: transparent"
icon=
"el-icon-view"
></el-button>
-->
icon=
"el-icon-refresh"
@
click=
"handleResetPwd(scope.row)"
></el-button>
<el-button
size=
"m
ini
"
size=
"m
edium
"
style=
"border: transparent"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
></el-button>
<el-button
size=
"m
ini
"
style=
"border: transparent"
size=
"m
edium
"
style=
"border: transparent
"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
></el-button>
<!--
<el-dropdown
size=
"mini"
@
command=
"(command) => handleCommand(command, scope.row)"
v-hasPermi=
"['system:user:resetPwd', 'system:user:edit']"
>
-->
<!--
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-d-arrow-right"
>
更多
</el-button>
-->
<!--
<el-dropdown-menu
slot=
"dropdown"
>
-->
<!--
<el-dropdown-item
command=
"handleResetPwd"
icon=
"el-icon-key"
--
>
<!-- v-hasPermi="['system:user:resetPwd']">重置密码
</el-dropdown-item>
-->
<!--
<el-dropdown-item
command=
"handleAuthRole"
icon=
"el-icon-circle-check"
--
>
<!-- v-hasPermi="['system:user:edit']">分配角色
</el-dropdown-item>
-->
<!--
</el-dropdown-menu>
-->
<!--
</el-dropdown>
-->
</
template
>
</el-table-column>
</el-table>
...
...
@@ -249,68 +259,9 @@
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"权重"
>
<el-input-number
v-model=
"form.weightNum"
controls-position=
"right"
:min=
"0"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>
<el-col :span="12">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>-->
<!-- </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择岗位">
<el-option
v-for="item in postOptions"
:key="item.postId"
:label="item.postName"
:value="item.postId"
:disabled="item.status == 1"
></el-option>
</el-select>
<el-input-number
v-model=
"form.weightNum"
controls-position=
"right"
:min=
"1"
></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>-->
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"创建账号"
>
<el-input
v-model=
"form.createBy"
maxlength=
"11"
></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="创建时间" >
<el-date-picker
v-model="form.createTime"
type="datetime"
placeholder="选择日期和时间">
</el-date-picker>
</el-form-item>
</el-col>-->
</el-row>
<el-row>
<el-col
:span=
"24"
>
...
...
@@ -331,18 +282,18 @@
<div
class=
"form-header"
>
<h3><span
class=
"blue-square"
></span>
用户详细信息
</h3>
</div>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"
update
rules"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"账号"
prop=
"userName"
>
<el-input
v-model=
"form.userName"
placeholder=
"请输入用户名称"
maxlength=
"10px"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<!--
<el-col :span="12">
<el-form-item label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
</el-form-item>
</el-col>
</el-col>
-->
</el-row>
<el-row>
<el-col
:span=
"12"
>
...
...
@@ -482,7 +433,6 @@ import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUs
import
{
getToken
}
from
"@/utils/auth"
;
import
Treeselect
from
"@riophae/vue-treeselect"
;
import
"@riophae/vue-treeselect/dist/vue-treeselect.css"
;
import
{
update
}
from
"script-ext-html-webpack-plugin/lib/elements"
;
export
default
{
name
:
"User"
,
...
...
@@ -530,8 +480,12 @@ export default {
roleOptions
:
[],
// 表单参数
form
:
{
createBy
:
''
,
// 创建账号
createTime
:
''
,
// 创建时间
// 创建账号
createBy
:
''
,
// 创建时间
createTime
:
''
,
// 默认排序
weightNum
:
1
,
},
defaultProps
:
{
children
:
"children"
,
...
...
@@ -557,6 +511,7 @@ export default {
pageNum
:
1
,
pageSize
:
10
,
userName
:
undefined
,
nickName
:
undefined
,
phonenumber
:
undefined
,
status
:
undefined
,
deptId
:
undefined
,
...
...
@@ -577,6 +532,16 @@ export default {
{
key
:
8
,
label
:
'权重'
,
visible
:
true
}
],
// 表单校验
updaterules
:{
userName
:
[
{
required
:
true
,
message
:
"账号不能为空"
,
trigger
:
"blur"
},
{
min
:
2
,
max
:
20
,
message
:
'账号长度必须介于 2 和 20 之间'
,
trigger
:
'blur'
}
],
nickName
:
[
{
required
:
true
,
message
:
"姓名不能为空"
,
trigger
:
"blur"
}
],
},
rules
:
{
userName
:
[
{
required
:
true
,
message
:
"账号不能为空"
,
trigger
:
"blur"
},
...
...
@@ -696,7 +661,7 @@ export default {
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
selectedRowKeys
=
selection
.
map
(
row
=>
row
.
userId
);
this
.
ids
=
selection
.
map
(
item
=>
item
.
i
d
);
this
.
ids
=
selection
.
map
(
item
=>
item
.
userI
d
);
this
.
single
=
selection
.
length
!==
1
;
this
.
multiple
=
selection
.
length
>
1
;
},
...
...
@@ -776,20 +741,14 @@ export default {
},
/** 重置密码按钮操作 */
handleResetPwd
(
row
)
{
this
.
$
prompt
(
'请输入"'
+
row
.
userName
+
'"的新密码
'
,
"提示"
,
{
this
.
$
confirm
(
'是否重置"'
+
row
.
nickName
+
'"密码为123456
'
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
closeOnClickModal
:
false
,
inputPattern
:
/^.
{5,20}
$/
,
inputErrorMessage
:
"用户密码长度必须介于 5 和 20 之间"
,
inputValidator
:
(
value
)
=>
{
if
(
/<|>|"|'|
\|
|
\\
/
.
test
(
value
))
{
return
"不能包含非法字符:< >
\"
'
\\\
|"
}
},
}).
then
(({
value
})
=>
{
resetUserPwd
(
row
.
userId
,
value
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功,新密码是:"
+
value
);
}).
then
(({})
=>
{
const
newPassword
=
"123456"
;
resetUserPwd
(
row
.
userId
,
newPassword
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"成功将"
+
row
.
nickName
+
"的密码重置为:"
+
newPassword
);
});
}).
catch
(()
=>
{});
},
...
...
@@ -802,13 +761,15 @@ export default {
submitForm
:
function
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
userId
!=
undefined
)
{
if
(
this
.
form
.
userId
!==
undefined
)
{
// 更新现有记录
updateUser
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
// 添加新记录
addUser
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
...
...
@@ -821,7 +782,7 @@ export default {
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
userIds
=
row
.
userId
||
this
.
ids
;
this
.
$modal
.
confirm
(
'是否确认删除
用户编号为"'
+
userIds
+
'"的数据项?
'
).
then
(
function
()
{
this
.
$modal
.
confirm
(
'是否确认删除
该用户
'
).
then
(
function
()
{
return
delUser
(
userIds
);
}).
then
(()
=>
{
this
.
getList
();
...
...
@@ -832,10 +793,7 @@ export default {
handleExport
()
{
// 获取选中的用户 ID
const
userIds
=
this
.
ids
;
this
.
download
(
'system/user/export'
,
{
...
this
.
queryParams
,
userIds
,
// 将用户 ID 传递给服务器
},
`user_
${
new
Date
().
getTime
()}
.xlsx`
)
this
.
download
(
'system/user/export'
,
userIds
,
`user_
${
new
Date
().
getTime
()}
.xlsx`
);
},
/** 导入按钮操作 */
handleImport
()
{
...
...
src/views/history/index.vue
View file @
9aa070f4
<
template
>
<div
class=
"app-container"
>
<div
style=
"background-color: white;height: 95vh;padding-left: 30px;padding-right: 30px"
>
<div
style=
"
background-color: white;
height: 95vh;
padding-left: 30px;
padding-right: 30px;
"
>
<div>
<span
style=
"display: flex;justify-content: flex-start;align-items: center;"
><div
style=
"border: 1px solid #116FBB;width: 2px;height: 20px;margin-right: 5px"
></div><h5
style=
"color: #116FBB;font-weight: bolder"
>
历史记录
</h5></span>
<span
style=
"
display: flex;
justify-content: flex-start;
align-items: center;
"
><div
style=
"
border: 1px solid #116fbb;
width: 2px;
height: 20px;
margin-right: 5px;
"
></div>
<h5
style=
"color: #116fbb; font-weight: bolder"
>
历史记录
</h5></span
>
</div>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"100px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"100px"
>
<el-form-item
prop=
"monitoringName"
>
<el-
inpu
t
v-model
.
trim
=
"queryParams.monitoringName"
<el-
selec
t
v-model=
"queryParams.monitoringName"
placeholder=
"请输入监控点名称"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
>
<el-option
value=
"01"
>
Camera 01
</el-option>
<el-option
value=
"02"
>
Camera 02
</el-option>
<el-option
value=
"03"
>
Camera 03
</el-option>
<el-option
value=
"04"
>
Camera 04
</el-option>
</el-select>
</el-form-item>
<el-form-item
prop=
"monitorState"
>
<el-select
v-model=
"queryParams.monitorState"
placeholder=
"请选择监控状态"
clearable
>
<el-select
v-model=
"queryParams.monitorState"
placeholder=
"请选择监控状态"
clearable
>
<el-option
value=
"0"
>
进行中
</el-option>
<el-option
value=
"1"
>
已完成
</el-option>
</el-select>
</el-form-item>
<el-form-item
prop=
"monitorTime"
>
<el-date-picker
placeholder=
"请选择监控时间"
value-format=
"yyyy-MM-dd"
v-model=
"queryParams.monitorTime"
type=
"datetimerange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
v-model=
"queryParams.monitoringStarttime"
type=
"date"
>
</el-date-picker>
<!--
<el-date-picker
clearable--
>
...
...
@@ -50,76 +81,143 @@
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!--
</el-form-item>
-->
<div
style=
"margin-left: 92%"
>
<div
style=
"margin-left: 90%"
>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button
>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button
>
</el-form-item>
</div>
</el-form>
<!--
<el-table
v-loading=
"loading"
:data=
"histableList"
@
selection-change=
"handleSelectionChange"
>
-->
<el-table
:data=
"histableList"
@
selection-change=
"handleSelectionChange"
style=
"min-height: 650px"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"序号"
align=
"center"
width=
"100"
prop=
"id"
/>
<el-table
:data=
"histableList"
@
selection-change=
"handleSelectionChange"
style=
"min-height: 650px"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"序号"
align=
"center"
width=
"100"
>
<template
slot-scope=
"scope"
>
<span>
{{
calculateIndex
(
scope
.
$index
)
}}
</span>
</
template
>
</el-table-column>
<!-- <template slot-scope="scope">-->
<!-- <span>{{ (scope.$index+1)+(queryParams.pageNum-1)*queryParams.pageSize }}</span>-->
<!-- </template>-->
<el-table-column
label=
"监控点名称"
align=
"center"
prop=
"monitoringName"
/>
<el-table-column
label=
"监控开始时间"
align=
"center"
prop=
"monitoringStarttime"
width=
"300"
>
<el-table-column
label=
"监控点名称"
align=
"center"
prop=
"monitoringName"
/>
<el-table-column
label=
"监控开始时间"
align=
"center"
prop=
"monitoringStarttime"
width=
"300"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
monitoringStarttime
,
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
'
)
}}
<
/span
>
<span>
{{
parseTime
(
scope
.
row
.
monitoringStarttime
,
"{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
"
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"监控结束时间"
align
=
"center"
prop
=
"monitoringFinallytime"
width
=
"500"
>
<
el
-
table
-
column
label
=
"监控结束时间"
align
=
"center"
prop
=
"monitoringFinallytime"
width
=
"350"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
parseTime
(
scope
.
row
.
monitoringFinallytime
,
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
'
)
}}
<
/span
>
<
span
>
{{
parseTime
(
scope
.
row
.
monitoringFinallytime
,
"{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
"
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"监控时间"
align
=
"center"
prop
=
"monitorTime"
width
=
"180"
>
<
el
-
table
-
column
label
=
"监控时间"
align
=
"center"
prop
=
"monitorTime"
width
=
"180"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
formatHoursAsHMS
(
scope
.
row
.
monitorTime
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"监控状态"
align
=
"center"
prop
=
"monitorState"
width
=
"500"
>
<
el
-
table
-
column
label
=
"监控状态"
align
=
"center"
prop
=
"monitorState"
width
=
"200"
>
<
template
slot
-
scope
=
"scope"
>
<
span
:
class
=
"scope.row.monitorState === '0' ? 'green-text' : 'black-text'"
>
{{
scope
.
row
.
monitorState
===
'0'
?
'·进行中'
:
'·已完成'
}}
<
/span
>
<
span
:
class
=
"
scope.row.monitorState === '0' ? 'green-text' : 'black-text'
"
>
{{
scope
.
row
.
monitorState
===
"0"
?
"·进行中"
:
"·已完成"
}}
<
/spa
n
>
<!--
<
dict
-
tag
:
options
=
"dict.type.history_state"
:
value
=
"scope.row.monitorState"
/>-->
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
button
style
=
"border: transparent;background-color: transparent;color: green;font-size: 20px"
style
=
"
border: transparent;
background-color: transparent;
color: green;
font-size: 20px;
"
size
=
"mini"
plain
icon
=
"el-icon-view"
class
=
"green-icon"
@
click
=
"handleUpdate(scope.row)"
><
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
style
=
"display: flex;align-items: center;justify-content: center;"
style
=
"display: flex; align-items: center; justify-content: center"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
:
current
-
page
.
sync
=
"currentPage"
:
page
-
size
=
"pageSize"
@
size
-
change
=
"handleSizeChange"
@
current
-
change
=
"handleCurrentChange"
@
pagination
=
"getList"
/>
<!--
添加或修改
history
对话框
-->
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"500px"
append
-
to
-
body
>
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"500px"
append
-
to
-
body
>
<
el
-
form
ref
=
"form"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"80px"
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
...
...
@@ -132,21 +230,27 @@
<
/template
>
<
script
>
import
{
listHistable
,
getHistable
,
delHistable
,
addHistable
,
updateHistable
}
from
"@/api/system/histable"
;
import
{
parseTime
}
from
"../../utils/ruoyi"
;
import
{
listHistable
,
getHistable
,
delHistable
,
addHistable
,
updateHistable
,
}
from
"@/api/system/histable"
;
import
{
parseTime
}
from
"../../utils/ruoyi"
;
export
default
{
name
:
"Histable"
,
dicts
:
[
'history_state'
],
dicts
:
[
"history_state"
],
data
()
{
return
{
carryRowCode
:{
id
:
""
,
monitoringName
:
""
,
carryRowCode
:
{
id
:
""
,
monitoringName
:
""
,
monitoringStarttime
:
""
,
monitoringFinallytime
:
""
,
monitorState
:
""
,
monitorTime
:
""
,
monitorState
:
""
,
monitorTime
:
""
,
}
,
// 遮罩层
loading
:
true
,
...
...
@@ -162,6 +266,9 @@ export default {
total
:
0
,
// history表格数据
histableList
:
[],
currentPage
:
1
,
pageSize
:
10
,
currentPageData
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
...
...
@@ -170,27 +277,62 @@ export default {
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
monitoringName
:
null
,
monitorTime
:
null
,
monitorState
:
null
,
id
:
null
,
monitoringName
:
undefined
,
monitorTime
:
undefined
,
monitorState
:
undefined
,
id
:
undefined
,
}
,
// 表单参数
form
:
{
}
,
// 表单校验
rules
:
{
}
rules
:
{
}
,
}
;
}
,
created
()
{
this
.
getList
();
this
.
updateCurrentPageData
();
}
,
computed
:
{
startIndexOfPage
()
{
return
(
this
.
currentPage
-
1
)
*
this
.
total
;
}
,
}
,
methods
:
{
handleSizeChange
(
val
)
{
this
.
total
=
val
;
this
.
updateCurrentPageData
();
}
,
handleCurrentChange
(
val
)
{
this
.
currentPage
=
val
;
this
.
updateCurrentPageData
();
}
,
updateCurrentPageData
()
{
const
startIndex
=
(
this
.
currentPage
-
1
)
*
this
.
total
;
const
endIndex
=
startIndex
+
this
.
total
;
this
.
currentPageData
=
this
.
histableList
.
slice
(
startIndex
,
endIndex
);
}
,
calculateIndex
(
index
)
{
return
this
.
startIndexOfPage
+
index
+
1
;
}
,
prevPage
()
{
if
(
this
.
currentPage
>
1
)
{
this
.
currentPage
--
;
}
}
,
nextPage
()
{
const
maxPage
=
Math
.
ceil
(
this
.
items
.
length
/
this
.
total
);
if
(
this
.
currentPage
<
maxPage
)
{
this
.
currentPage
++
;
}
}
,
formatHoursAsHMS
(
hours
)
{
// 确保小时数为整数
const
intHours
=
Math
.
floor
(
hours
);
// 使用 padStart 方法确保小时数始终有两位数字
const
hoursStr
=
intHours
.
toString
().
padStart
(
2
,
'0'
);
const
hoursStr
=
intHours
.
toString
().
padStart
(
2
,
"0"
);
// 返回格式化的字符串
return
`${hoursStr
}
:00:00`
;
...
...
@@ -199,12 +341,11 @@ export default {
/** 查询history列表 */
getList
()
{
this
.
loading
=
true
;
listHistable
(
this
.
queryParams
).
then
(
response
=>
{
listHistable
(
this
.
queryParams
).
then
(
(
response
)
=>
{
this
.
histableList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
);
}
,
// 取消按钮
cancel
()
{
...
...
@@ -214,17 +355,12 @@ export default {
// 表单重置
reset
()
{
this
.
form
=
{
ID
:
null
,
monitoringName
:
null
,
monitoringStarttime
:
null
,
monitoringFinallytime
:
null
,
monitorTime
:
null
,
monitorState
:
null
,
CREATETIME
:
null
,
CREATEBY
:
null
,
UPDATETIME
:
null
,
UPDATEBY
:
null
,
delFlag
:
null
ID
:
undefined
,
monitoringName
:
undefined
,
monitoringStarttime
:
undefined
,
monitoringFinallytime
:
undefined
,
monitorTime
:
undefined
,
monitorState
:
undefined
,
}
;
this
.
resetForm
(
"form"
);
}
,
...
...
@@ -240,9 +376,9 @@ export default {
}
,
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
ID
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
this
.
ids
=
selection
.
map
(
(
item
)
=>
item
.
ID
);
this
.
single
=
selection
.
length
!==
1
;
this
.
multiple
=
!
selection
.
length
;
}
,
/** 新增按钮操作 */
handleAdd
()
{
...
...
@@ -252,27 +388,27 @@ export default {
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
carryRowCode
=
row
;
this
.
carryRowCode
=
row
;
// 查看详情页面(把id换成code)
this
.
$router
.
push
({
path
:
'/monitoringPlayback/playback'
,
this
.
$router
.
push
({
path
:
"/monitoringPlayback/playback"
,
query
:
{
carryRowCode
:
this
.
carryRowCode
}
}
)
carryRowCode
:
this
.
carryRowCode
,
}
,
}
);
}
,
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
this
.
$refs
[
"form"
].
validate
(
(
valid
)
=>
{
if
(
valid
)
{
if
(
this
.
form
.
ID
!=
null
)
{
updateHistable
(
this
.
form
).
then
(
response
=>
{
updateHistable
(
this
.
form
).
then
(
(
response
)
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
}
);
}
else
{
addHistable
(
this
.
form
).
then
(
response
=>
{
addHistable
(
this
.
form
).
then
(
(
response
)
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
...
...
@@ -284,21 +420,28 @@ export default {
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
IDs
=
row
.
ID
||
this
.
ids
;
this
.
$modal
.
confirm
(
'是否确认删除history编号为"'
+
IDs
+
'"的数据项?'
).
then
(
function
()
{
this
.
$modal
.
confirm
(
'是否确认删除history编号为"'
+
IDs
+
'"的数据项?'
)
.
then
(
function
()
{
return
delHistable
(
IDs
);
}
).
then
(()
=>
{
}
)
.
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}
).
catch
(()
=>
{
}
);
}
)
.
catch
(()
=>
{
}
);
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'system/histable/export'
,
{
...
this
.
queryParams
}
,
`histable_${new Date().getTime()
}
.xlsx`
)
}
}
this
.
download
(
"system/histable/export"
,
{
...
this
.
queryParams
,
}
,
`histable_${new Date().getTime()
}
.xlsx`
);
}
,
}
,
}
;
<
/script
>
<
style
scoped
>
...
...
vue.config.js
View file @
9aa070f4
'use strict'
const
path
=
require
(
'path'
)
"use strict"
;
const
path
=
require
(
"path"
);
function
resolve
(
dir
)
{
return
path
.
join
(
__dirname
,
dir
)
return
path
.
join
(
__dirname
,
dir
)
;
}
const
CompressionPlugin
=
require
(
'compression-webpack-plugin'
)
const
CompressionPlugin
=
require
(
"compression-webpack-plugin"
);
const
name
=
process
.
env
.
VUE_APP_TITLE
||
'若依管理系统'
// 网页标题
const
name
=
process
.
env
.
VUE_APP_TITLE
||
"若依管理系统"
;
// 网页标题
const
port
=
process
.
env
.
port
||
process
.
env
.
npm_config_port
||
80
// 端口
const
port
=
process
.
env
.
port
||
process
.
env
.
npm_config_port
||
80
;
// 端口
// vue.config.js 配置说明
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
...
...
@@ -20,16 +20,16 @@ module.exports = {
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath
:
process
.
env
.
NODE_ENV
===
"production"
?
"/"
:
"/"
,
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir
:
'dist'
,
outputDir
:
"dist"
,
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir
:
'static'
,
assetsDir
:
"static"
,
// 是否开启eslint保存检测,有效值:ture | false | 'error'
lintOnSave
:
process
.
env
.
NODE_ENV
===
'development'
,
lintOnSave
:
process
.
env
.
NODE_ENV
===
"development"
,
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap
:
false
,
// webpack-dev-server 相关配置
devServer
:
{
host
:
'0.0.0.0'
,
host
:
"0.0.0.0"
,
port
:
port
,
open
:
true
,
proxy
:
{
...
...
@@ -38,93 +38,92 @@ module.exports = {
target
:
`http://106.3.99.64:20004`
,
changeOrigin
:
true
,
pathRewrite
:
{
[
'^'
+
process
.
env
.
VUE_APP_BASE_API
]:
''
}
}
[
"^"
+
process
.
env
.
VUE_APP_BASE_API
]:
""
,
},
disableHostCheck
:
true
},
},
disableHostCheck
:
true
,
},
css
:
{
loaderOptions
:
{
sass
:
{
sassOptions
:
{
outputStyle
:
"expanded"
}
}
}
sassOptions
:
{
outputStyle
:
"expanded"
}
,
}
,
}
,
},
configureWebpack
:
{
name
:
name
,
resolve
:
{
alias
:
{
'@'
:
resolve
(
'src'
)
}
"@"
:
resolve
(
"src"
),
}
,
},
plugins
:
[
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
new
CompressionPlugin
({
cache
:
false
,
// 不启用文件缓存
test
:
/
\.(
js|css|html|jpe
?
g|png|gif|svg
)?
$/i
,
// 压缩文件格式
filename
:
'[path][base].gz[query]'
,
// 压缩后的文件名
algorithm
:
'gzip'
,
// 使用gzip压缩
filename
:
"[path][base].gz[query]"
,
// 压缩后的文件名
algorithm
:
"gzip"
,
// 使用gzip压缩
minRatio
:
0.8
,
// 压缩比例,小于 80% 的文件不会被压缩
deleteOriginalAssets
:
false
// 压缩后删除原文件
})
deleteOriginalAssets
:
false
,
// 压缩后删除原文件
})
,
],
},
chainWebpack
(
config
)
{
config
.
plugins
.
delete
(
'preload'
)
// TODO: need test
config
.
plugins
.
delete
(
'prefetch'
)
// TODO: need test
config
.
plugins
.
delete
(
"preload"
);
// TODO: need test
config
.
plugins
.
delete
(
"prefetch"
);
// TODO: need test
// set svg-sprite-loader
config
.
module
.
rule
(
"svg"
).
exclude
.
add
(
resolve
(
"src/assets/icons"
)).
end
();
config
.
module
.
rule
(
'svg'
)
.
exclude
.
add
(
resolve
(
'src/assets/icons'
))
.
end
()
config
.
module
.
rule
(
'icons'
)
.
rule
(
"icons"
)
.
test
(
/
\.
svg$/
)
.
include
.
add
(
resolve
(
'src/assets/icons'
))
.
include
.
add
(
resolve
(
"src/assets/icons"
))
.
end
()
.
use
(
'svg-sprite-loader'
)
.
loader
(
'svg-sprite-loader'
)
.
use
(
"svg-sprite-loader"
)
.
loader
(
"svg-sprite-loader"
)
.
options
({
symbolId
:
'icon-[name]'
symbolId
:
"icon-[name]"
,
})
.
end
()
.
end
()
;
config
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
config
=>
{
config
.
when
(
process
.
env
.
NODE_ENV
!==
"development"
,
(
config
)
=>
{
config
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
after
(
'html'
)
.
use
(
'script-ext-html-webpack-plugin'
,
[{
.
plugin
(
"ScriptExtHtmlWebpackPlugin"
)
.
after
(
"html"
)
.
use
(
"script-ext-html-webpack-plugin"
,
[
{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline
:
/runtime
\.
.*
\.
js$/
}])
.
end
()
inline
:
/runtime
\.
.*
\.
js$/
,
},
])
.
end
();
config
.
optimization
.
splitChunks
({
chunks
:
'all'
,
chunks
:
"all"
,
cacheGroups
:
{
libs
:
{
name
:
'chunk-libs'
,
name
:
"chunk-libs"
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
10
,
chunks
:
'initial'
// only package third parties that are initially dependent
chunks
:
"initial"
,
// only package third parties that are initially dependent
},
elementUI
:
{
name
:
'chunk-elementUI'
,
// split elementUI into a single package
name
:
"chunk-elementUI"
,
// split elementUI into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
,
// in order to adapt to cnpm
priority
:
20
// the weight needs to be larger than libs and app or it will be packaged into libs or app
priority
:
20
,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
},
commons
:
{
name
:
'chunk-commons'
,
test
:
resolve
(
'src/components'
),
// can customize your rules
name
:
"chunk-commons"
,
test
:
resolve
(
"src/components"
),
// can customize your rules
minChunks
:
3
,
// minimum common number
priority
:
5
,
reuseExistingChunk
:
true
}
}
})
config
.
optimization
.
runtimeChunk
(
'single'
)
})
}
}
reuseExistingChunk
:
true
,
},
},
});
config
.
optimization
.
runtimeChunk
(
"single"
);
})
;
}
,
}
;
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