code
stringlengths 1
1.05M
| repo_name
stringlengths 6
83
| path
stringlengths 3
242
| language
stringclasses 222
values | license
stringclasses 20
values | size
int64 1
1.05M
|
|---|---|---|---|---|---|
package com.example.roller.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
|
2301_82325581/exp4
|
roller2/app/src/main/java/com/example/roller/ui/theme/Color.kt
|
Kotlin
|
unknown
| 282
|
package com.example.roller.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun RollerTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}
|
2301_82325581/exp4
|
roller2/app/src/main/java/com/example/roller/ui/theme/Theme.kt
|
Kotlin
|
unknown
| 1,692
|
package com.example.roller.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
|
2301_82325581/exp4
|
roller2/app/src/main/java/com/example/roller/ui/theme/Type.kt
|
Kotlin
|
unknown
| 987
|
package com.example.roller
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
|
2301_82325581/exp4
|
roller2/app/src/test/java/com/example/roller/ExampleUnitTest.kt
|
Kotlin
|
unknown
| 342
|
import requests
import json
def register():
url = "http://127.0.0.1:5000/api/users"
data = {
"username": "user",
"password": "123456",
"role": "user"
}
response = requests.post(url, json=data)
print(response.json())
'''
"username": "root"
"password": "cyz123"
'''
def login():
url = "http://127.0.0.1:5000/api/users/login"
data = {
"username": "user",
"password": "123456"
}
response = requests.post(url, json=data)
print(response.json())
return response.json()['token']
def Info(token):
url = "http://localhost:5000/api/users/me"
headers = {
'Authorization': f'Bearer {token}' # 使用 "Bearer" 前缀和空格
}
response = requests.get(url, headers=headers)
try:
response_data = response.json()
if response.status_code == 200:
print("用户信息:", response_data)
else:
print("错误:", response_data)
except json.decoder.JSONDecodeError:
print(f"响应不是有效的 JSON,状态码: {response.status_code}")
print("原始响应内容:", response.text)
if __name__ == "__main__":
# register()
token = login()
Info(token)
|
2303_76403688/Flask-based_inventory_management_system
|
posttest.py
|
Python
|
unknown
| 1,233
|
from app import create_app
app = create_app()
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
|
2303_76403688/Flask-based_inventory_management_system
|
run.py
|
Python
|
unknown
| 123
|
cjc main.cj api.cj values.cj -LC:\Windows\System32 -lgdi32 -o main.exe
|
2302_81918214/Cangjie-Examples
|
CFFI-Windows/compile.bat
|
Batchfile
|
apache-2.0
| 70
|
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>Hello Cangjie!</div>
<p></p>
<script>
let xhr = new XMLHttpRequest()
xhr.open("POST", "/Hello", true)
xhr.onreadystatechange = () => {
if(xhr.readyState == 4 && xhr.status == 200){
let res = JSON.parse(xhr.responseText)
document.body.innerHTML += `<div>${res.msg}</div>`
}
}
xhr.send(JSON.stringify({
name: "Chen",
age: 999
}))
</script>
</body>
</html>
|
2302_81918214/Cangjie-Examples
|
HTTPServer/index.html
|
HTML
|
apache-2.0
| 687
|
/* 数据导出页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button-group {
display: flex;
gap: 12px;
}
/* 主要内容区 */
.main-content {
padding: 0 24px;
}
/* 导出配置区域 */
.export-config-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.config-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.config-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
.config-form {
max-width: 100%;
}
.config-form .el-form-item {
margin-bottom: 20px;
}
.config-form .el-checkbox-group {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
/* 数据预览区域 */
.data-preview-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.preview-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.preview-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
.preview-content {
min-height: 400px;
border: 1px solid #e5e7eb;
border-radius: 8px;
overflow: hidden;
}
.preview-placeholder {
height: 400px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #9ca3af;
}
.preview-placeholder i {
font-size: 48px;
margin-bottom: 16px;
}
.preview-data {
padding: 16px;
}
/* 导出历史列表 */
.history-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
/* 表格样式 */
.el-table {
margin-bottom: 20px;
}
.el-table th {
background-color: #f9fafb !important;
color: #374151;
font-weight: 600;
}
.el-table td {
color: #4b5563;
}
/* 分页容器 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button-group {
width: 100%;
}
.header-right .el-button {
flex: 1;
}
.main-content {
padding: 0 16px;
}
.config-form .el-checkbox-group {
flex-direction: column;
gap: 8px;
}
.section-header {
flex-direction: column;
gap: 16px;
align-items: stretch;
}
.section-header .el-input {
width: 100%;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.export-config-section,
.data-preview-section,
.history-section {
background: #1f2937;
}
.header-left h1,
.config-header h3,
.preview-header h3,
.section-header h3 {
color: #f9fafb;
}
.preview-content {
border-color: #374151;
}
.el-table th {
background-color: #111827 !important;
color: #f9fafb;
}
.el-table td {
color: #d1d5db;
}
.preview-placeholder {
color: #6b7280;
}
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/data-export.css
|
CSS
|
unknown
| 4,180
|
/* 数据概览页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button-group {
display: flex;
gap: 12px;
}
/* 主要内容区 */
.main-content {
padding: 0 24px;
}
/* 时间范围选择 */
.time-range-section {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 16px;
}
/* 数据概览卡片 */
.overview-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin-bottom: 24px;
}
.overview-card {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
gap: 16px;
transition: all 0.3s ease;
}
.overview-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.card-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 20px;
}
.card-content {
flex: 1;
}
.card-title {
font-size: 14px;
color: #6b7280;
margin-bottom: 4px;
}
.card-value {
font-size: 24px;
font-weight: 700;
color: #1f2937;
margin-bottom: 8px;
}
.card-trend {
font-size: 12px;
font-weight: 500;
display: flex;
align-items: center;
gap: 4px;
}
.card-trend.up {
color: #10b981;
}
.card-trend.down {
color: #f56c6c;
}
/* 图表区域 */
.charts-section {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 20px;
margin-bottom: 24px;
}
.chart-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.chart-header {
padding: 20px 24px;
border-bottom: 1px solid #f3f4f6;
display: flex;
justify-content: space-between;
align-items: center;
}
.chart-header h3 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
.chart-content {
padding: 24px;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
}
.chart-placeholder {
text-align: center;
color: #9ca3af;
}
.chart-placeholder i {
font-size: 48px;
margin-bottom: 12px;
display: block;
}
/* 数据表格区域 */
.data-table-section {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h3 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
/* 表格样式 */
.el-table {
margin-bottom: 20px;
}
.el-table th {
background-color: #f9fafb !important;
color: #374151;
font-weight: 600;
}
.el-table td {
color: #4b5563;
}
/* 分页容器 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.charts-section {
grid-template-columns: 1fr;
}
.overview-cards {
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
}
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button-group {
width: 100%;
}
.header-right .el-button {
flex: 1;
}
.main-content {
padding: 0 16px;
}
.time-range-section {
flex-direction: column;
align-items: stretch;
}
.time-range-section .el-date-picker {
width: 100%;
}
.chart-content {
height: 200px;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.time-range-section,
.overview-card,
.chart-card,
.data-table-section {
background: #1f2937;
}
.header-left h1,
.chart-header h3,
.section-header h3 {
color: #f9fafb;
}
.card-title {
color: #9ca3af;
}
.card-value {
color: #f9fafb;
}
.el-table th {
background-color: #111827 !important;
color: #f9fafb;
}
.el-table td {
color: #d1d5db;
}
.chart-header {
border-color: #374151;
}
.chart-placeholder {
color: #6b7280;
}
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/data-overview.css
|
CSS
|
unknown
| 5,172
|
/* 数据报表页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button-group {
display: flex;
gap: 12px;
}
/* 主要内容区 */
.main-content {
padding: 0 24px;
}
/* 报表配置区域 */
.report-config-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.config-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.config-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
.config-form {
max-width: 100%;
}
.config-form .el-form-item {
margin-bottom: 20px;
}
.config-form .el-checkbox-group {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
/* 报表预览区域 */
.report-preview-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.preview-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.preview-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
.preview-content {
min-height: 400px;
border: 1px solid #e5e7eb;
border-radius: 8px;
overflow: hidden;
}
.preview-placeholder {
height: 400px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #9ca3af;
}
.preview-placeholder i {
font-size: 48px;
margin-bottom: 16px;
}
.preview-document {
padding: 24px;
}
.report-header {
text-align: center;
margin-bottom: 32px;
padding-bottom: 16px;
border-bottom: 1px solid #e5e7eb;
}
.report-header h2 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.report-header p {
color: #6b7280;
font-size: 14px;
}
.preview-charts {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
margin-bottom: 32px;
}
.chart-item {
background: #f9fafb;
padding: 16px;
border-radius: 8px;
}
.chart-title {
font-size: 16px;
font-weight: 500;
color: #374151;
margin-bottom: 16px;
}
.chart-placeholder {
height: 200px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #9ca3af;
}
.chart-placeholder i {
font-size: 32px;
margin-bottom: 8px;
}
.preview-table {
margin-top: 24px;
}
/* 历史报表列表 */
.history-section {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
/* 表格样式 */
.el-table {
margin-bottom: 20px;
}
.el-table th {
background-color: #f9fafb !important;
color: #374151;
font-weight: 600;
}
.el-table td {
color: #4b5563;
}
/* 分页容器 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.preview-charts {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button-group {
width: 100%;
}
.header-right .el-button {
flex: 1;
}
.main-content {
padding: 0 16px;
}
.config-form .el-checkbox-group {
flex-direction: column;
gap: 8px;
}
.section-header {
flex-direction: column;
gap: 16px;
align-items: stretch;
}
.section-header .el-input {
width: 100%;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.report-config-section,
.report-preview-section,
.history-section {
background: #1f2937;
}
.header-left h1,
.config-header h3,
.preview-header h3,
.section-header h3,
.report-header h2 {
color: #f9fafb;
}
.preview-content {
border-color: #374151;
}
.report-header {
border-color: #374151;
}
.chart-item {
background: #111827;
}
.chart-title {
color: #f9fafb;
}
.el-table th {
background-color: #111827 !important;
color: #f9fafb;
}
.el-table td {
color: #d1d5db;
}
.preview-placeholder,
.chart-placeholder {
color: #6b7280;
}
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/data-report.css
|
CSS
|
unknown
| 5,391
|
/* /* 智驭安行系统管理平台样式 */
/* 全局样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
background: #f5f7fa;
color: #333;
line-height: 1.6;
overflow-x: hidden;
}
/* 加载遮罩 */
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.loading-content {
text-align: center;
color: white;
}
.loading-spinner {
font-size: 32px;
animation: spin 1s linear infinite;
margin-bottom: 16px;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* 主布局 */
.admin-layout {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* 顶部导航栏 */
.admin-header {
height: 64px;
background: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
position: relative;
z-index: 100;
}
.header-left {
display: flex;
align-items: center;
gap: 32px;
}
.logo-section {
display: flex;
align-items: center;
gap: 12px;
}
.logo-container {
margin-bottom: 30px;
display: flex;
justify-content: center;
align-items: center;
height: 100px;
}
.logo-container img,
.header-logo {
height: 48px;
max-width: none;
width: auto;
object-fit: contain;
transition: transform 0.3s;
}
.logo-container img:hover {
transform: scale(1.08);
}
.system-title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.breadcrumb-section .el-breadcrumb {
font-size: 14px;
}
.header-right {
display: flex;
align-items: center;
gap: 20px;
}
.notification-badge {
cursor: pointer;
}
.notification-badge .el-button {
font-size: 18px;
color: #6b7280;
padding: 8px;
}
.notification-badge .el-button:hover {
color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
.user-dropdown {
cursor: pointer;
}
.user-info {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-radius: 8px;
transition: all 0.3s ease;
}
.user-info:hover {
background: rgba(102, 126, 234, 0.1);
}
.username {
font-weight: 500;
color: #1f2937;
font-size: 14px;
}
/* 主内容区 */
.admin-main {
display: flex;
flex: 1;
min-height: calc(100vh - 64px);
}
/* 侧边栏 */
.admin-sidebar {
width: 240px;
background: white;
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
position: relative;
transition: width 0.3s ease;
z-index: 50;
}
.admin-sidebar.collapsed {
width: 64px;
}
.sidebar-toggle {
position: absolute;
top: 16px;
right: -12px;
width: 24px;
height: 24px;
background: white;
border: 1px solid #e5e7eb;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.sidebar-toggle:hover {
background: #667eea;
color: white;
border-color: #667eea;
}
.sidebar-menu {
height: 100%;
border: none;
padding-top: 20px;
}
.sidebar-menu .el-menu-item,
.sidebar-menu .el-submenu__title {
height: 48px;
line-height: 48px;
border-radius: 0 24px 24px 0;
margin: 2px 12px 2px 0;
color: #6b7280;
transition: all 0.3s ease;
}
.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-submenu__title:hover {
background: rgba(102, 126, 234, 0.1);
color: #667eea;
}
.sidebar-menu .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.sidebar-menu .el-submenu .el-menu-item {
margin: 1px 12px 1px 0;
border-radius: 0 20px 20px 0;
background: transparent;
}
.sidebar-menu .el-submenu .el-menu-item:hover {
background: rgba(102, 126, 234, 0.08);
}
/* 内容区域 */
.admin-content {
flex: 1;
padding: 24px;
background: #f5f7fa;
overflow-y: auto;
}
/* 仪表盘内容 */
.dashboard-content {
display: flex;
flex-direction: column;
gap: 24px;
}
/* 欢迎卡片 */
.welcome-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 32px;
border-radius: 16px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
overflow: hidden;
}
.welcome-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><circle cx="900" cy="100" r="100" fill="rgba(255,255,255,0.1)"/><circle cx="100" cy="900" r="150" fill="rgba(255,255,255,0.05)"/></svg>') no-repeat;
background-size: cover;
pointer-events: none;
}
.welcome-info {
position: relative;
z-index: 2;
}
.welcome-info h2 {
font-size: 24px;
font-weight: 600;
margin-bottom: 8px;
}
.welcome-info p {
font-size: 16px;
opacity: 0.9;
margin-bottom: 16px;
}
.user-stats {
display: flex;
gap: 24px;
}
.stat-item {
font-size: 14px;
opacity: 0.8;
}
.welcome-actions {
position: relative;
z-index: 2;
display: flex;
gap: 12px;
}
.welcome-actions .el-button {
border-radius: 8px;
padding: 12px 24px;
font-weight: 500;
}
/* 天气预报模块样式 */
.weather-module {
background: white;
border-radius: 16px;
padding: 24px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
margin-bottom: 24px;
overflow: hidden;
position: relative;
}
.weather-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid #f3f4f6;
}
.weather-header h3 {
font-size: 18px;
color: #1f2937;
margin: 0;
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
}
.weather-header h3 i {
color: #667eea;
font-size: 20px;
}
.current-weather {
display: flex;
align-items: center;
gap: 12px;
}
.current-temp {
font-size: 28px;
font-weight: 700;
color: #667eea;
}
.current-desc {
font-size: 14px;
color: #6b7280;
background: #f3f4f6;
padding: 4px 12px;
border-radius: 20px;
}
/* 7天天气预报 */
.weather-forecast {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 8px;
margin-bottom: 24px;
}
.forecast-item {
background: #f9fafb;
border: 2px solid transparent;
border-radius: 12px;
padding: 16px 8px;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.forecast-item::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
opacity: 0;
transition: opacity 0.3s ease;
}
.forecast-item:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
border-color: rgba(102, 126, 234, 0.3);
}
.forecast-item:hover::before {
opacity: 1;
}
.forecast-item.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-color: #667eea;
color: white;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}
.forecast-item.active::before {
opacity: 0;
}
.forecast-date {
margin-bottom: 8px;
position: relative;
z-index: 2;
}
.day-name {
display: block;
font-size: 12px;
font-weight: 600;
margin-bottom: 2px;
}
.month-day {
display: block;
font-size: 11px;
opacity: 0.8;
}
.forecast-item.active .month-day {
opacity: 0.9;
}
.forecast-icon {
font-size: 24px;
margin: 8px 0;
position: relative;
z-index: 2;
}
.forecast-temps {
display: flex;
flex-direction: column;
gap: 2px;
margin-bottom: 6px;
position: relative;
z-index: 2;
}
.temp-max {
font-size: 14px;
font-weight: 600;
}
.temp-min {
font-size: 12px;
opacity: 0.7;
}
.forecast-desc {
font-size: 11px;
opacity: 0.8;
position: relative;
z-index: 2;
}
.forecast-item.active .forecast-desc {
opacity: 0.9;
}
/* 天气详情 */
.weather-details {
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
border-radius: 16px;
padding: 24px;
border: 1px solid #e2e8f0;
position: relative;
overflow: hidden;
}
.weather-details::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(102, 126, 234, 0.03) 0%, transparent 50%);
pointer-events: none;
}
.details-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 24px;
position: relative;
z-index: 2;
}
.detail-title-section {
flex: 1;
}
.details-header h4 {
font-size: 18px;
color: #1f2937;
margin: 0 0 12px 0;
font-weight: 600;
}
.weather-summary {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.main-weather {
font-size: 24px;
}
.weather-desc {
font-size: 14px;
color: #6b7280;
background: white;
padding: 4px 12px;
border-radius: 20px;
border: 1px solid #e5e7eb;
}
.temp-range {
font-size: 14px;
font-weight: 600;
color: #667eea;
background: rgba(102, 126, 234, 0.1);
padding: 4px 12px;
border-radius: 20px;
}
.refresh-btn {
color: #6b7280;
padding: 8px;
border-radius: 8px;
transition: all 0.3s ease;
}
.refresh-btn:hover {
color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
/* 核心指标 */
.weather-metrics {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
margin-bottom: 24px;
position: relative;
z-index: 2;
}
.metric-item {
background: white;
padding: 16px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
border: 1px solid #f1f5f9;
transition: all 0.3s ease;
}
.metric-item:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
border-color: rgba(102, 126, 234, 0.2);
}
.metric-item {
display: flex;
align-items: center;
gap: 12px;
}
.metric-icon {
width: 36px;
height: 36px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(102, 126, 234, 0.1);
font-size: 16px;
flex-shrink: 0;
}
.metric-content {
flex: 1;
min-width: 0;
}
.metric-label {
display: block;
font-size: 12px;
color: #6b7280;
margin-bottom: 4px;
}
.metric-value {
display: block;
font-size: 14px;
font-weight: 600;
color: #1f2937;
margin-bottom: 6px;
}
.metric-progress {
width: 100%;
height: 4px;
background: #f1f5f9;
border-radius: 2px;
overflow: hidden;
}
.progress-bar {
height: 100%;
border-radius: 2px;
transition: width 0.8s ease;
}
/* 生活指数 */
.life-tips {
margin-bottom: 24px;
position: relative;
z-index: 2;
}
.life-tips h5 {
font-size: 16px;
color: #1f2937;
margin: 0 0 16px 0;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
}
.life-tips h5 i {
color: #667eea;
}
.tips-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
}
.tip-item {
background: white;
padding: 16px;
border-radius: 12px;
border: 1px solid #f1f5f9;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 12px;
}
.tip-item:hover {
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
border-color: rgba(102, 126, 234, 0.2);
}
.tip-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 14px;
flex-shrink: 0;
}
.tip-content {
flex: 1;
min-width: 0;
}
.tip-name {
display: block;
font-size: 13px;
color: #1f2937;
font-weight: 500;
margin-bottom: 2px;
}
.tip-level {
display: inline-block;
font-size: 11px;
padding: 2px 6px;
border-radius: 10px;
font-weight: 500;
margin-bottom: 4px;
}
.tip-level.excellent,
.tip-level.good,
.tip-level.comfortable {
background: #dcfce7;
color: #166534;
}
.tip-level.moderate {
background: #fef3c7;
color: #92400e;
}
.tip-level.poor,
.tip-level.warm,
.tip-level.strong {
background: #fecaca;
color: #991b1b;
}
.tip-desc {
display: block;
font-size: 11px;
color: #6b7280;
line-height: 1.3;
}
/* 温馨提示 */
.weather-alerts {
margin-bottom: 20px;
position: relative;
z-index: 2;
}
.weather-alerts h5 {
font-size: 16px;
color: #1f2937;
margin: 0 0 16px 0;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
}
.weather-alerts h5 i {
color: #667eea;
}
.alert-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.alert-item {
background: white;
padding: 12px 16px;
border-radius: 8px;
border-left: 4px solid #e5e7eb;
display: flex;
align-items: flex-start;
gap: 10px;
font-size: 13px;
line-height: 1.5;
transition: all 0.3s ease;
}
.alert-item:hover {
background: #f9fafb;
transform: translateX(2px);
}
.alert-item i {
margin-top: 1px;
flex-shrink: 0;
}
.alert-item.info {
border-left-color: #3b82f6;
color: #1e40af;
}
.alert-item.info i {
color: #3b82f6;
}
.alert-item.warning {
border-left-color: #f59e0b;
color: #92400e;
}
.alert-item.warning i {
color: #f59e0b;
}
.alert-item.success {
border-left-color: #10b981;
color: #065f46;
}
.alert-item.success i {
color: #10b981;
}
/* 月相信息 */
.moon-phase {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 12px;
padding: 16px;
color: white;
position: relative;
z-index: 2;
}
.moon-info {
display: flex;
align-items: center;
gap: 12px;
}
.moon-icon {
font-size: 24px;
animation: moonGlow 3s ease-in-out infinite alternate;
}
@keyframes moonGlow {
from {
opacity: 0.7;
}
to {
opacity: 1;
}
}
.moon-details {
flex: 1;
}
.moon-phase-name {
display: block;
font-size: 14px;
font-weight: 600;
margin-bottom: 4px;
}
.moon-desc {
display: block;
font-size: 12px;
opacity: 0.9;
}
/* 统计卡片网格 */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
}
.stat-card {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
gap: 16px;
transition: all 0.3s ease;
border-left: 4px solid transparent;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 20px;
}
.stat-content h3 {
font-size: 24px;
font-weight: 700;
color: #1f2937;
margin-bottom: 4px;
}
.stat-content p {
font-size: 14px;
color: #6b7280;
margin-bottom: 8px;
}
.stat-trend {
font-size: 12px;
font-weight: 500;
display: flex;
align-items: center;
gap: 4px;
}
.stat-trend.up {
color: #10b981;
}
.stat-trend.down {
color: #f56c6c;
}
/* 快速链接 */
.quick-links {
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.quick-links h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin-bottom: 20px;
}
.links-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 16px;
}
.quick-link {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px 16px;
border-radius: 8px;
background: #f9fafb;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
position: relative;
border: 1px solid #e5e7eb;
}
.quick-link:hover {
background: rgba(102, 126, 234, 0.1);
transform: translateY(-2px);
border-color: #667eea;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}
.quick-link i {
font-size: 24px;
color: #667eea;
margin-bottom: 8px;
}
.quick-link span {
font-size: 14px;
color: #374151;
font-weight: 500;
margin-bottom: 8px;
}
/* 最新动态 */
.activity-feed {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.activity-feed h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin-bottom: 20px;
}
.activity-list {
display: flex;
flex-direction: column;
gap: 16px;
}
.activity-item {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 12px;
border-radius: 8px;
transition: background 0.3s ease;
}
.activity-item:hover {
background: #f9fafb;
}
.activity-icon {
width: 32px;
height: 32px;
border-radius: 50%;
background: #f3f4f6;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.activity-content p {
font-size: 14px;
color: #374151;
margin-bottom: 4px;
}
.activity-time {
font-size: 12px;
color: #9ca3af;
}
/* 页面占位内容 */
.page-content {
display: flex;
align-items: center;
justify-content: center;
min-height: 400px;
}
.page-placeholder {
text-align: center;
color: #6b7280;
}
.page-placeholder i {
font-size: 64px;
margin-bottom: 16px;
display: block;
color: #d1d5db;
}
.page-placeholder h3 {
font-size: 20px;
margin-bottom: 8px;
color: #374151;
}
.page-placeholder p {
font-size: 14px;
margin-bottom: 24px;
}
/* 通知抽屉 */
.notification-list {
padding: 16px;
}
.notification-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 16px 0;
border-bottom: 1px solid #f3f4f6;
}
.notification-item:last-child {
border-bottom: none;
}
.notification-content h4 {
font-size: 14px;
font-weight: 600;
color: #1f2937;
margin-bottom: 4px;
}
.notification-content p {
font-size: 13px;
color: #6b7280;
margin-bottom: 8px;
line-height: 1.5;
}
.notification-time {
font-size: 12px;
color: #9ca3af;
}
/* Element UI 样式覆盖 */
.el-menu {
border-right: none;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner {
color: #667eea;
font-weight: 500;
}
.el-dropdown-menu {
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-badge__content {
background: #f56c6c;
border: none;
font-size: 10px;
}
.el-drawer {
border-radius: 16px 0 0 16px;
}
.el-drawer__header {
padding: 20px 24px;
border-bottom: 1px solid #f3f4f6;
margin-bottom: 0;
}
/* 动画效果 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.stats-grid {
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.weather-forecast {
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
.forecast-item {
padding: 14px 8px;
}
.weather-metrics {
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.tips-grid {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
}
@media (max-width: 768px) {
.admin-header {
padding: 0 16px;
}
.header-left {
gap: 16px;
}
.system-title {
display: none;
}
.admin-sidebar {
position: fixed;
left: -240px;
top: 64px;
height: calc(100vh - 64px);
z-index: 1000;
}
.admin-sidebar.show {
left: 0;
}
.admin-content {
padding: 16px;
}
.welcome-card {
flex-direction: column;
align-items: flex-start;
gap: 20px;
}
.welcome-actions {
width: 100%;
}
.welcome-actions .el-button {
flex: 1;
}
.stats-grid {
grid-template-columns: 1fr;
}
.links-grid {
grid-template-columns: repeat(2, 1fr);
}
.user-stats {
flex-direction: column;
gap: 8px;
}
.weather-module {
padding: 16px;
}
.weather-header {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.weather-forecast {
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.forecast-item {
padding: 12px 6px;
}
.forecast-icon {
font-size: 20px;
}
.current-temp {
font-size: 24px;
}
.weather-details {
padding: 16px;
}
.details-header {
flex-direction: column;
gap: 12px;
}
.weather-summary {
order: 2;
}
.refresh-btn {
align-self: flex-end;
order: 1;
}
.weather-metrics {
grid-template-columns: 1fr;
gap: 12px;
}
.tips-grid {
grid-template-columns: 1fr;
gap: 10px;
}
.tip-item {
padding: 12px;
}
}
@media (max-width: 480px) {
.admin-content {
padding: 12px;
}
.welcome-card {
padding: 20px;
}
.stat-card {
padding: 16px;
}
.quick-links,
.activity-feed {
padding: 16px;
}
.links-grid {
grid-template-columns: 1fr;
}
.weather-forecast {
grid-template-columns: repeat(2, 1fr);
}
.forecast-item {
padding: 10px 4px;
}
.day-name {
font-size: 11px;
}
.month-day {
font-size: 10px;
}
.forecast-icon {
font-size: 18px;
margin: 6px 0;
}
.temp-max {
font-size: 13px;
}
.temp-min {
font-size: 11px;
}
.forecast-desc {
font-size: 10px;
}
.weather-details {
padding: 12px;
}
.details-header h4 {
font-size: 16px;
}
.weather-summary {
flex-wrap: wrap;
gap: 8px;
}
.main-weather {
font-size: 20px;
}
.weather-desc,
.temp-range {
font-size: 12px;
padding: 3px 8px;
}
.metric-item {
padding: 12px;
}
.metric-icon {
width: 32px;
height: 32px;
font-size: 14px;
}
.metric-value {
font-size: 13px;
}
.life-tips h5,
.weather-alerts h5 {
font-size: 14px;
}
.tip-item {
padding: 10px;
gap: 8px;
}
.tip-icon {
width: 28px;
height: 28px;
font-size: 12px;
}
.tip-name {
font-size: 12px;
}
.tip-desc {
font-size: 10px;
}
.alert-item {
padding: 10px 12px;
font-size: 12px;
gap: 8px;
}
.moon-phase {
padding: 12px;
}
.moon-icon {
font-size: 20px;
}
.moon-phase-name {
font-size: 13px;
}
.moon-desc {
font-size: 11px;
}
}
/* 深色模式支持(可选) */
@media (prefers-color-scheme: dark) {
body {
background: #111827;
color: #f9fafb;
}
.admin-header,
.admin-sidebar,
.stat-card,
.quick-links,
.activity-feed,
.weather-module {
background: #1f2937;
color: #f9fafb;
}
.system-title {
color: #f9fafb;
}
.weather-details {
background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
border-color: #4b5563;
}
.metric-item,
.tip-item,
.alert-item {
background: #374151;
border-color: #4b5563;
}
.weather-desc {
background: #374151;
border-color: #4b5563;
color: #d1d5db;
}
}
.login-container {
display: flex;
width: 100%;
max-width: 1100px;
/* 稍微收窄,避免太宽 */
min-height: 520px;
background: white;
border-radius: 16px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
overflow: hidden;
position: relative;
z-index: 1;
animation: slideUp 0.6s ease-out;
margin: 0 auto;
/* 居中 */
}
.login-banner {
flex: 0 0 40%;
/* 左侧占40% */
padding: 40px 40px;
}
.login-form {
flex: 0 0 60%;
/* 右侧占60% */
padding: 60px 60px;
}
/* 天气图标样式 */
.weather-sunny {
color: #f59e0b;
}
.weather-cloudy {
color: #6b7280;
}
.weather-rainy {
color: #3b82f6;
}
.weather-snowy {
color: #93c5fd;
}
.weather-foggy {
color: #9ca3af;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/index.css
|
CSS
|
unknown
| 22,884
|
/* 智驭安行登录页面样式 */
/* 全局样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
position: relative;
overflow-x: hidden;
}
/* 背景装饰 */
body::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="60" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="30" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="90" r="1" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
animation: float 20s ease-in-out infinite;
pointer-events: none;
}
@keyframes float {
0%,
100% {
transform: translateY(0px) rotate(0deg);
}
50% {
transform: translateY(-20px) rotate(180deg);
}
}
/* 主容器 */
.login-container {
display: flex;
width: 100%;
max-width: 1300px;
min-height: 500px;
background: white;
border-radius: 16px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
overflow: hidden;
position: relative;
z-index: 1;
animation: slideUp 0.6s ease-out;
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 左侧横幅 */
.login-banner {
flex: 1;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
padding: 40px 60px;
position: relative;
overflow: hidden;
}
.login-banner::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><polygon fill="rgba(255,255,255,0.05)" points="0,1000 1000,800 1000,1000"/></svg>') no-repeat;
background-size: cover;
}
.banner-content {
position: relative;
z-index: 2;
text-align: center;
}
.logo-container {
margin-bottom: 30px;
display: flex;
justify-content: center;
align-items: center;
height: 120px;
}
.logo-container img {
height: 100px;
max-width: 220px;
width: auto;
object-fit: contain;
transition: transform 0.3s;
}
.logo-container img:hover {
transform: scale(1.08);
}
.banner-title {
font-size: 32px;
font-weight: 700;
margin-bottom: 12px;
line-height: 1.2;
letter-spacing: 1px;
white-space: nowrap;
}
.banner-subtitle {
font-size: 16px;
opacity: 0.9;
margin-bottom: 30px;
font-weight: 300;
}
.banner-features {
list-style: none;
text-align: left;
}
.banner-features li {
padding: 8px 0;
font-size: 14px;
opacity: 0.8;
position: relative;
padding-left: 20px;
}
.banner-features li::before {
content: '✓';
position: absolute;
left: 0;
color: #4ade80;
font-weight: bold;
}
/* 右侧表单 */
.login-form {
flex: 1;
padding: 50px 80px;
display: flex;
flex-direction: column;
justify-content: center;
background: #fafbfc;
position: relative;
}
.form-header {
text-align: center;
margin-bottom: 40px;
}
.form-title {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.form-subtitle {
font-size: 14px;
color: #6b7280;
}
.login-form-container {
width: 100%;
}
/* 表单样式增强 */
.form-item {
margin-bottom: 24px;
}
.form-item.has-error .el-input__inner {
border-color: #f56c6c;
box-shadow: 0 0 0 2px rgba(245, 108, 108, 0.2);
}
.el-input {
position: relative;
}
.el-input__inner {
height: 48px;
border-radius: 8px;
border: 2px solid #e5e7eb;
font-size: 14px;
transition: all 0.3s ease;
background: white;
}
.el-input__inner:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.el-input__inner::placeholder {
color: #9ca3af;
}
.el-input__prefix {
color: #6b7280;
}
/* 记住登录选项 */
.login-options {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
font-size: 14px;
}
.remember-me {
display: flex;
align-items: center;
gap: 8px;
color: #6b7280;
}
.forgot-password {
color: #667eea;
text-decoration: none;
transition: color 0.3s ease;
}
.forgot-password:hover {
color: #5a67d8;
text-decoration: underline;
}
/* 登录按钮 */
.login-button {
width: 100%;
height: 48px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
transition: all 0.3s cubic-bezier(.4,1.4,.6,1), box-shadow 0.3s;
margin-bottom: 20px;
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
letter-spacing: 1px;
position: relative;
overflow: hidden;
}
.login-button::after {
content: '';
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: linear-gradient(120deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
pointer-events: none;
transition: opacity 0.3s;
opacity: 0.7;
border-radius: 8px;
}
.login-button:hover:not(:disabled) {
transform: scale(1.04);
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
.login-button:active:not(:disabled) {
transform: scale(0.98);
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.18);
}
.login-button:disabled {
opacity: 0.7;
cursor: not-allowed;
}
/* 其他链接 */
.other-actions {
text-align: center;
padding-top: 20px;
border-top: 1px solid #e5e7eb;
}
.other-actions p {
color: #6b7280;
font-size: 14px;
margin-bottom: 12px;
}
.action-links {
display: flex;
justify-content: center;
gap: 24px;
}
.action-links a {
color: #667eea;
text-decoration: none;
font-size: 14px;
transition: color 0.3s ease;
}
.action-links a:hover {
color: #5a67d8;
text-decoration: underline;
}
/* 版权信息 */
.copyright {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
color: #9ca3af;
text-align: center;
white-space: nowrap;
}
/* 错误提示样式 */
.error-message {
color: #f56c6c;
font-size: 12px;
margin-top: 4px;
display: flex;
align-items: center;
gap: 4px;
}
/* 加载状态 */
.loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.9);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
border-radius: 16px;
}
.loading-content {
text-align: center;
color: #667eea;
}
.loading-spinner {
font-size: 24px;
animation: spin 1s linear infinite;
margin-bottom: 8px;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* 动画效果 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
/* 自定义复选框 */
.custom-checkbox {
display: inline-flex;
align-items: center;
cursor: pointer;
user-select: none;
}
.custom-checkbox input {
display: none;
}
.custom-checkbox .checkmark {
width: 16px;
height: 16px;
border: 2px solid #d1d5db;
border-radius: 3px;
margin-right: 8px;
position: relative;
transition: all 0.3s ease;
}
.custom-checkbox input:checked+.checkmark {
background: #667eea;
border-color: #667eea;
}
.custom-checkbox input:checked+.checkmark::after {
content: '✓';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 10px;
font-weight: bold;
}
/* 响应式设计 */
@media (max-width: 768px) {
body {
padding: 10px;
}
.login-container {
flex-direction: column;
max-width: 400px;
min-height: auto;
}
.login-banner {
padding: 30px 20px;
min-height: 200px;
}
.banner-title {
font-size: 24px;
}
.banner-subtitle {
font-size: 14px;
}
.banner-features {
display: none;
}
.login-form {
padding: 30px 20px;
}
.form-title {
font-size: 20px;
}
.copyright {
position: static;
transform: none;
margin-top: 20px;
}
}
@media (max-width: 480px) {
.login-container {
margin: 0;
border-radius: 0;
min-height: 100vh;
}
.login-form {
padding: 20px;
}
.action-links {
flex-direction: column;
gap: 12px;
}
}
/* Element UI 样式覆盖 */
.el-form-item__error {
color: #f56c6c;
font-size: 12px;
padding-top: 4px;
}
.el-button--primary {
background-color: #667eea;
border-color: #667eea;
}
.el-button--primary:hover {
background-color: #5a67d8;
border-color: #5a67d8;
}
.el-button--primary:focus {
background-color: #5a67d8;
border-color: #5a67d8;
}
/* 消息提示样式优化 */
.el-message {
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.el-message--success {
background-color: #f0f9ff;
border-color: #10b981;
color: #065f46;
}
.el-message--error {
background-color: #fef2f2;
border-color: #f87171;
color: #991b1b;
}
.el-message--info {
background-color: #f0f9ff;
border-color: #3b82f6;
color: #1e3a8a;
}
.register-row {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
margin-top: 20px;
font-size: 14px;
color: #6b7280;
}
.register-row a {
color: #667eea;
text-decoration: none;
margin-left: 4px;
transition: color 0.3s;
font-weight: 500;
}
.register-row a:hover {
color: #5a67d8;
text-decoration: underline;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/login.css
|
CSS
|
unknown
| 9,457
|
/* 系统管理页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button-group {
display: flex;
gap: 12px;
}
/* 主要内容区 */
.main-content {
padding: 0 24px;
}
/* 功能导航 */
.function-nav {
background: white;
padding: 0 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.function-nav .el-tabs__nav {
border: none;
}
.function-nav .el-tabs__item {
height: 56px;
line-height: 56px;
font-size: 15px;
}
.function-nav .el-tabs__item i {
margin-right: 8px;
font-size: 16px;
}
/* 标签页内容 */
.tab-content {
background: white;
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.content-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.search-box {
width: 300px;
}
/* 用户管理 */
.user-list {
margin-bottom: 20px;
}
.delete-btn {
color: #f56c6c;
}
.delete-btn:hover {
color: #f78989;
}
/* 角色权限 */
.role-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-top: 20px;
}
.role-card {
transition: all 0.3s ease;
}
.role-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.role-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.role-header h3 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
.role-description {
color: #6b7280;
font-size: 14px;
margin-bottom: 16px;
}
.role-permissions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.permission-tag {
background: #f3f4f6;
border: none;
}
/* 系统配置 */
.settings-form {
max-width: 800px;
}
.settings-card {
margin-bottom: 24px;
}
.settings-card:last-child {
margin-bottom: 0;
}
.settings-card .el-card__header {
padding: 16px 20px;
border-bottom: 1px solid #f3f4f6;
}
.settings-card .el-card__header span {
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
.logo-uploader {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
width: 178px;
height: 178px;
display: flex;
justify-content: center;
align-items: center;
}
.logo-uploader:hover {
border-color: #409eff;
}
.logo-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.logo {
width: 178px;
height: 178px;
display: block;
object-fit: contain;
}
.unit {
margin-left: 8px;
color: #6b7280;
}
/* 日志管理 */
.log-list {
margin-bottom: 20px;
}
/* 表格样式 */
.el-table {
margin-bottom: 20px;
}
.el-table th {
background-color: #f9fafb !important;
color: #374151;
font-weight: 600;
}
.el-table td {
color: #4b5563;
}
/* 分页容器 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button-group {
width: 100%;
}
.header-right .el-button {
flex: 1;
}
.main-content {
padding: 0 16px;
}
.content-header {
flex-direction: column;
gap: 16px;
align-items: stretch;
}
.search-box {
width: 100%;
}
.role-list {
grid-template-columns: 1fr;
}
.settings-form {
max-width: 100%;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.function-nav,
.tab-content {
background: #1f2937;
}
.header-left h1,
.function-nav .el-tabs__item,
.role-header h3,
.settings-card .el-card__header span {
color: #f9fafb;
}
.role-description {
color: #9ca3af;
}
.permission-tag {
background: #374151;
color: #f9fafb;
}
.logo-uploader {
border-color: #4b5563;
}
.logo-uploader-icon {
color: #6b7280;
}
.unit {
color: #9ca3af;
}
.el-table th {
background-color: #111827 !important;
color: #f9fafb;
}
.el-table td {
color: #d1d5db;
}
.settings-card .el-card__header {
border-bottom-color: #374151;
}
}
.header-logo {
height: 48px;
width: auto;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/system-management.css
|
CSS
|
unknown
| 5,351
|
/* 预警管理页面样式 */
/* 主布局样式 */
.admin-main {
display: flex;
min-height: calc(100vh - 64px);
}
/* 内容区样式 */
.alert-container {
flex: 1;
padding: 24px;
background: #f5f7fa;
overflow-y: auto;
}
/* 容器样式 */
.alert-container {
padding: 20px;
}
/* 预警概览卡片样式 */
.alert-overview {
margin-bottom: 24px;
}
.alert-stat-card {
background: white;
border-radius: 12px;
padding: 24px;
display: flex;
align-items: center;
gap: 16px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
}
.alert-stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
color: white;
}
.stat-icon.warning {
background: linear-gradient(135deg, #f6b73c 0%, #eb8d00 100%);
}
.stat-icon.processing {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.stat-icon.success {
background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}
.stat-icon.info {
background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}
.stat-info h3 {
font-size: 24px;
font-weight: 600;
color: #1a202c;
margin: 0 0 4px 0;
}
.stat-info p {
font-size: 14px;
color: #718096;
margin: 0;
}
/* 工具栏样式 */
.alert-toolbar {
background: white;
border-radius: 12px;
padding: 16px 24px;
margin-bottom: 24px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.toolbar-left {
display: flex;
gap: 12px;
}
.toolbar-right {
display: flex;
gap: 16px;
align-items: center;
}
.search-input {
width: 240px;
}
/* 预警列表样式 */
.alert-list {
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.el-table {
margin-bottom: 20px;
}
/* 分页容器样式 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 对话框样式 */
.el-dialog {
border-radius: 12px;
}
.el-dialog__header {
padding: 20px 24px;
border-bottom: 1px solid #e2e8f0;
}
.el-dialog__body {
padding: 24px;
}
.el-dialog__footer {
padding: 16px 24px;
border-top: 1px solid #e2e8f0;
}
/* 表单样式优化 */
.el-form-item__label {
font-weight: 500;
}
.el-input__inner,
.el-textarea__inner {
border-radius: 8px;
}
/* 标签样式 */
.el-tag {
border-radius: 6px;
padding: 4px 8px;
}
/* 按钮样式 */
.el-button {
border-radius: 8px;
font-weight: 500;
}
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--danger {
background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
border: none;
}
.el-button--danger:hover {
background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}
/* 响应式布局 */
@media (max-width: 1200px) {
.toolbar-right {
flex-wrap: wrap;
gap: 12px;
}
.search-input {
width: 200px;
}
}
@media (max-width: 768px) {
.alert-container {
padding: 12px;
}
.alert-toolbar {
flex-direction: column;
gap: 16px;
}
.toolbar-left,
.toolbar-right {
width: 100%;
}
.toolbar-right {
flex-direction: column;
}
.search-input,
.el-select,
.el-date-picker {
width: 100% !important;
}
.el-button {
width: 100%;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.alert-stat-card,
.alert-toolbar,
.alert-list {
background: #1f2937;
}
.stat-info h3 {
color: #f9fafb;
}
.stat-info p {
color: #9ca3af;
}
.el-table {
background-color: #1f2937;
color: #f9fafb;
}
.el-table th,
.el-table tr {
background-color: #1f2937;
}
.el-table--striped .el-table__body tr.el-table__row--striped td {
background-color: #374151;
}
.el-dialog,
.el-dialog__header,
.el-dialog__footer {
background-color: #1f2937;
border-color: #374151;
}
.el-input__inner,
.el-textarea__inner {
background-color: #374151;
border-color: #4b5563;
color: #f9fafb;
}
}
/* 侧边栏样式 */
.admin-sidebar {
width: 240px;
background: white;
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
position: relative;
transition: width 0.3s ease;
z-index: 50;
}
.admin-sidebar.collapsed {
width: 64px;
}
.sidebar-toggle {
position: absolute;
top: 16px;
right: -12px;
width: 24px;
height: 24px;
background: white;
border: 1px solid #e5e7eb;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.sidebar-toggle:hover {
background: #667eea;
color: white;
border-color: #667eea;
}
.sidebar-menu {
height: 100%;
border: none;
padding-top: 20px;
}
.sidebar-menu .el-menu-item,
.sidebar-menu .el-submenu__title {
height: 48px;
line-height: 48px;
border-radius: 0 24px 24px 0;
margin: 2px 12px 2px 0;
color: #6b7280;
transition: all 0.3s ease;
}
.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-submenu__title:hover {
background: rgba(102, 126, 234, 0.1) !important;
color: #667eea !important;
}
.sidebar-menu .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}
.sidebar-menu .el-submenu .el-menu-item {
margin: 1px 12px 1px 0;
border-radius: 0 20px 20px 0;
background: transparent;
}
.sidebar-menu .el-submenu .el-menu-item:hover {
background: rgba(102, 126, 234, 0.08) !important;
}
.header-logo {
height: 48px;
width: auto;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/traffic-alert.css
|
CSS
|
unknown
| 6,308
|
/* 交通数据分析页面样式 */
/* 继承全局样式 */
@import url('./index.css');
/* 顶部导航栏样式 */
.admin-header {
height: 64px;
background: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
position: relative;
z-index: 100;
}
.header-left {
display: flex;
align-items: center;
gap: 32px;
}
.logo-section {
display: flex;
align-items: center;
gap: 12px;
}
.header-logo {
height: 48px;
width: auto;
object-fit: contain;
}
.system-title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.breadcrumb-section .el-breadcrumb {
font-size: 14px;
}
.header-right {
display: flex;
align-items: center;
gap: 20px;
}
.notification-badge {
cursor: pointer;
}
.notification-badge .el-button {
font-size: 18px;
color: #6b7280;
padding: 8px;
}
.notification-badge .el-button:hover {
color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
.user-dropdown {
cursor: pointer;
}
.user-info {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-radius: 8px;
transition: all 0.3s ease;
}
.user-info:hover {
background: rgba(102, 126, 234, 0.1);
}
.username {
font-weight: 500;
color: #1f2937;
font-size: 14px;
}
/* 侧边栏菜单选中状态 */
.sidebar-menu .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.sidebar-menu .el-menu-item,
.sidebar-menu .el-submenu__title {
height: 48px;
line-height: 48px;
border-radius: 0 24px 24px 0;
margin: 2px 12px 2px 0;
color: #6b7280;
transition: all 0.3s ease;
}
.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-submenu__title:hover {
background: rgba(102, 126, 234, 0.1);
color: #667eea;
}
/* 分析页面主容器 */
.analysis-container {
padding: 24px;
display: flex;
flex-direction: column;
gap: 16px;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 分析头部 */
.analysis-header {
background: white;
padding: 16px;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
margin-bottom: 16px;
transition: all 0.3s ease;
}
.analysis-header:hover {
box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}
.header-title {
font-size: 18px;
font-weight: 600;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 12px;
}
.filter-section {
display: flex;
gap: 12px;
flex-wrap: wrap;
align-items: center;
}
.filter-section .el-button {
transition: all 0.3s ease;
}
.filter-section .el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}
.filter-section .el-button--primary:hover {
transform: translateY(-1px);
box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}
/* 分析卡片网格 */
.analysis-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 16px;
margin-bottom: 16px;
}
.analysis-card {
background: white;
border-radius: 12px;
padding: 16px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.analysis-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
border-color: rgba(102, 126, 234, 0.2);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.card-title {
font-size: 16px;
font-weight: 600;
color: #1f2937;
}
/* 图表容器 */
.chart-container {
height: 200px;
position: relative;
background: linear-gradient(to bottom, rgba(102, 126, 234, 0.02), transparent);
border-radius: 8px;
overflow: hidden;
}
/* 图例样式 */
.chart-legend {
display: flex;
gap: 16px;
margin-top: 12px;
flex-wrap: wrap;
padding: 8px;
background: rgba(102, 126, 234, 0.05);
border-radius: 6px;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: #6b7280;
transition: all 0.3s ease;
}
.legend-item:hover {
color: #1f2937;
}
.legend-color {
width: 12px;
height: 12px;
border-radius: 2px;
transition: all 0.3s ease;
}
.legend-item:hover .legend-color {
transform: scale(1.2);
}
/* 数据对比卡片 */
.comparison-card {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
background: linear-gradient(to right, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
border-radius: 8px;
margin-top: 12px;
transition: all 0.3s ease;
}
.comparison-card:hover {
background: linear-gradient(to right, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}
.comparison-icon {
width: 32px;
height: 32px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
background: white;
color: #667eea;
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}
.comparison-data {
flex: 1;
}
.comparison-value {
font-size: 18px;
font-weight: 600;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 2px;
}
.comparison-label {
font-size: 12px;
color: #6b7280;
}
/* 详细数据表格 */
.data-table-section {
background: white;
border-radius: 12px;
padding: 16px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.data-table-section:hover {
box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
border-color: rgba(102, 126, 234, 0.2);
}
.table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.table-title {
font-size: 16px;
font-weight: 600;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.table-actions {
display: flex;
gap: 8px;
}
/* 数据标签 */
.data-tag {
display: inline-flex;
align-items: center;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
transition: all 0.3s ease;
}
.tag-success {
background: rgba(103, 194, 58, 0.1);
color: #67c23a;
}
.tag-warning {
background: rgba(230, 162, 60, 0.1);
color: #e6a23c;
}
.tag-danger {
background: rgba(245, 108, 108, 0.1);
color: #f56c6c;
}
/* Element UI 组件样式覆盖 */
.el-table {
margin-bottom: 12px;
}
.el-table th {
background: linear-gradient(to right, rgba(102, 126, 234, 0.05), transparent);
font-weight: 600;
}
.el-table--striped .el-table__body tr.el-table__row--striped td {
background: rgba(102, 126, 234, 0.02);
}
.el-table__row:hover > td {
background: rgba(102, 126, 234, 0.05) !important;
}
.el-pagination {
margin-top: 12px;
text-align: right;
}
.el-select:hover .el-input__inner {
border-color: #667eea;
}
.el-select .el-input.is-focus .el-input__inner {
border-color: #667eea;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.analysis-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.analysis-container {
padding: 16px;
}
.analysis-grid {
grid-template-columns: 1fr;
}
.filter-section {
flex-direction: column;
align-items: stretch;
}
.filter-section .el-select,
.filter-section .el-button {
width: 100%;
}
}
/* 加载状态 */
.loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.9);
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
/* 空状态 */
.empty-state {
text-align: center;
padding: 40px;
color: #6b7280;
}
.empty-state i {
font-size: 48px;
margin-bottom: 16px;
display: block;
}
/* 工具提示 */
.info-tooltip {
margin-left: 4px;
color: #667eea;
cursor: help;
transition: all 0.3s ease;
}
.info-tooltip:hover {
transform: scale(1.1);
color: #764ba2;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/traffic-analysis.css
|
CSS
|
unknown
| 8,899
|
/* 公共交通安全监控系统样式 */
/* 继承全局样式 */
@import url('./index.css');
/* 颜色变量 */
:root {
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--primary-color: #667eea;
--primary-hover: #764ba2;
--success-color: #67C23A;
--warning-color: #E6A23C;
--danger-color: #F56C6C;
--info-color: #909399;
--text-primary: #303133;
--text-regular: #606266;
--text-secondary: #909399;
--border-color: #EBEEF5;
--background-color: #f5f7fa;
}
/* 监控页面特有样式 */
/* 侧边栏菜单样式 */
.sidebar-menu .el-menu-item,
.sidebar-menu .el-submenu__title {
height: 48px;
line-height: 48px;
border-radius: 0 24px 24px 0;
margin: 2px 12px 2px 0;
color: #6b7280;
transition: all 0.3s ease;
}
.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-submenu__title:hover {
background: rgba(102, 126, 234, 0.1) !important;
color: #667eea !important;
}
.sidebar-menu .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}
.sidebar-menu .el-menu-item.is-active i,
.el-menu--popup .el-menu-item.is-active i {
color: white !important;
}
.sidebar-menu .el-submenu .el-menu-item {
margin: 1px 12px 1px 0;
border-radius: 0 20px 20px 0;
background: transparent;
}
.sidebar-menu .el-submenu .el-menu-item:hover {
background: rgba(102, 126, 234, 0.08) !important;
}
/* Element UI 菜单样式覆盖 */
.el-menu {
border-right: none;
}
.el-menu--popup {
min-width: 200px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.el-menu--popup .el-menu-item {
height: 40px;
line-height: 40px;
padding: 0 20px;
}
.el-menu--popup .el-menu-item:hover {
background: rgba(102, 126, 234, 0.1) !important;
color: #667eea !important;
}
.el-menu--popup .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}
/* 监控区域样式 */
.camera-section, .alert-list {
background: #fff;
border-radius: 8px;
margin: 20px;
padding: 20px;
box-shadow: 0 2px 12px 0 rgba(102, 126, 234, 0.1);
}
.section-header, .alert-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h3, .alert-header h3 {
margin: 0;
font-size: 18px;
color: var(--text-primary);
font-weight: 600;
}
.section-filters, .alert-filters {
display: flex;
align-items: center;
}
.section-filters .el-radio-group,
.alert-filters .el-radio-group {
display: flex;
border: none;
background: #fff;
}
.section-filters .el-radio-button,
.alert-filters .el-radio-button {
margin-right: 10px;
}
.section-filters .el-radio-button:last-child,
.alert-filters .el-radio-button:last-child {
margin-right: 0;
}
.section-filters .el-radio-button__inner,
.alert-filters .el-radio-button__inner {
border: 1px solid #DCDFE6;
border-radius: 4px !important;
padding: 8px 15px;
height: auto;
line-height: 1;
font-size: 14px;
color: var(--text-regular);
background: #fff;
}
.section-filters .el-radio-button:first-child .el-radio-button__inner,
.alert-filters .el-radio-button:first-child .el-radio-button__inner {
border-radius: 4px !important;
border-left: 1px solid #DCDFE6;
}
.section-filters .el-radio-button:last-child .el-radio-button__inner,
.alert-filters .el-radio-button:last-child .el-radio-button__inner {
border-radius: 4px !important;
}
/* 选中状态 */
.section-filters .el-radio-button__orig-radio:checked + .el-radio-button__inner,
.alert-filters .el-radio-button__orig-radio:checked + .el-radio-button__inner {
background-color: #7B68EE;
border-color: #7B68EE;
color: #fff;
box-shadow: none;
}
/* 悬停状态 */
.section-filters .el-radio-button__inner:hover,
.alert-filters .el-radio-button__inner:hover {
color: #7B68EE;
border-color: #7B68EE;
}
.section-filters .el-radio-button__orig-radio:checked + .el-radio-button__inner:hover,
.alert-filters .el-radio-button__orig-radio:checked + .el-radio-button__inner:hover {
color: #fff;
}
/* 底部查看更多按钮 */
.section-footer, .alert-footer {
text-align: center;
padding-top: 15px;
margin-top: 15px;
border-top: 1px solid var(--border-color);
}
.section-footer .el-button,
.alert-footer .el-button {
font-size: 14px;
color: var(--primary-color);
}
.section-footer .el-button:hover,
.alert-footer .el-button:hover {
color: var(--primary-hover);
}
.section-footer .el-button i,
.alert-footer .el-button i {
margin-right: 5px;
}
/* 监控视频网格 */
.camera-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 0;
}
.camera-card {
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 12px 0 rgba(102, 126, 234, 0.1);
transition: all 0.3s ease;
}
.camera-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 16px 0 rgba(102, 126, 234, 0.2);
}
.camera-feed {
position: relative;
/* height: 200px; */
background: #000;
display: flex;
align-items: center;
justify-content: center;
}
.camera-feed video {
width: 100%;
height: 100%;
object-fit: contain;
background: #000;
}
.camera-overlay {
position: absolute;
top: 10px;
right: 10px;
z-index: 1;
}
.alert-badge {
padding: 4px 8px;
border-radius: 4px;
color: #fff;
font-size: 12px;
}
.alert-badge.warning {
background: var(--warning-color);
}
.alert-badge.danger {
background: var(--danger-color);
}
.camera-info {
padding: 15px;
}
.camera-title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.camera-details {
margin: 10px 0;
}
.detail-item {
display: flex;
align-items: center;
margin-bottom: 5px;
color: var(--text-regular);
font-size: 13px;
}
.detail-item i {
margin-right: 5px;
color: var(--primary-color);
}
.camera-status {
display: flex;
align-items: center;
font-size: 13px;
}
.status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 5px;
}
.status-normal {
background-color: var(--success-color);
}
.status-warning {
background-color: var(--warning-color);
}
.status-danger {
background-color: var(--danger-color);
}
/* 告警列表 */
.alert-item {
border-left: 4px solid var(--info-color);
margin-bottom: 15px;
padding: 15px;
background: var(--background-color);
border-radius: 0 4px 4px 0;
transition: all 0.3s ease;
}
.alert-item:hover {
background: #f0f2f5;
}
.alert-item.alert-warning {
border-left-color: var(--warning-color);
}
.alert-item.alert-danger {
border-left-color: var(--danger-color);
}
.alert-item .alert-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.alert-title {
display: flex;
align-items: center;
}
.alert-title i {
margin-right: 8px;
font-size: 16px;
color: var(--primary-color);
}
.alert-time {
color: var(--text-secondary);
font-size: 12px;
}
.alert-description {
color: var(--text-regular);
margin-bottom: 10px;
}
.alert-details {
display: flex;
flex-wrap: wrap;
gap: 15px;
font-size: 13px;
color: var(--text-secondary);
}
.alert-details span {
display: flex;
align-items: center;
}
.alert-details span i {
margin-right: 5px;
color: var(--primary-color);
}
.alert-actions {
margin-top: 10px;
display: flex;
gap: 15px;
}
.alert-actions .el-button--text {
color: var(--primary-color);
}
.alert-actions .el-button--text:hover {
color: var(--primary-hover);
}
/* 响应式设计 */
@media (max-width: 1200px) {
.camera-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
.camera-grid {
grid-template-columns: 1fr;
}
.section-header, .alert-header {
flex-direction: column;
align-items: flex-start;
gap: 15px;
}
.section-filters, .alert-filters {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
width: 100%;
}
.section-filters .el-radio-button,
.alert-filters .el-radio-button {
margin-right: 0;
}
.section-filters .el-radio-button__inner,
.alert-filters .el-radio-button__inner {
width: 100%;
text-align: center;
}
.alert-details {
flex-direction: column;
gap: 8px;
}
.section-footer .el-button,
.alert-footer .el-button {
width: 100%;
justify-content: center;
}
}
@media (max-width: 480px) {
.camera-grid {
grid-template-columns: 1fr;
}
.stats-grid {
grid-template-columns: 1fr;
}
.alert-header {
flex-direction: column;
align-items: flex-start;
}
.alert-header span {
margin-top: 4px;
}
}
/* Element UI 组件样式覆盖 */
.el-radio-button__inner {
background: transparent;
border-color: var(--primary-color);
color: var(--primary-color);
}
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
background: var(--primary-gradient);
border-color: transparent;
box-shadow: -1px 0 0 0 var(--primary-color);
}
.el-button--primary {
background: var(--primary-gradient);
border: none;
}
.el-button--primary:hover,
.el-button--primary:focus {
background: linear-gradient(135deg, #7b93ff 0%, #8b5db9 100%);
border: none;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/traffic-monitor.css
|
CSS
|
unknown
| 9,217
|
/* 车辆列表页面样式 */
/* 继承全局样式 */
@import url('./index.css');
/* 顶部导航栏样式 */
.admin-header {
height: 64px;
background: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
position: relative;
z-index: 100;
}
.header-left {
display: flex;
align-items: center;
gap: 32px;
}
.logo-section {
display: flex;
align-items: center;
gap: 12px;
}
.header-logo {
height: 48px;
width: auto;
object-fit: contain;
}
.system-title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
.breadcrumb-section .el-breadcrumb {
font-size: 14px;
}
.header-right {
display: flex;
align-items: center;
gap: 20px;
}
.notification-badge {
cursor: pointer;
}
.notification-badge .el-button {
font-size: 18px;
color: #6b7280;
padding: 8px;
}
.notification-badge .el-button:hover {
color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
.user-dropdown {
cursor: pointer;
}
.user-info {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-radius: 8px;
transition: all 0.3s ease;
}
.user-info:hover {
background: rgba(102, 126, 234, 0.1);
}
.username {
font-weight: 500;
color: #1f2937;
font-size: 14px;
}
/* 侧边栏菜单选中状态 */
.sidebar-menu .el-menu-item.is-active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.sidebar-menu .el-menu-item,
.sidebar-menu .el-submenu__title {
height: 48px;
line-height: 48px;
border-radius: 0 24px 24px 0;
margin: 2px 12px 2px 0;
color: #6b7280;
transition: all 0.3s ease;
}
.sidebar-menu .el-menu-item:hover,
.sidebar-menu .el-submenu__title:hover {
background: rgba(102, 126, 234, 0.1);
color: #667eea;
}
/* 车辆概览卡片 */
.vehicle-overview {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 24px;
padding: 0 20px;
}
.overview-card {
background: white;
border-radius: 8px;
padding: 20px;
display: flex;
align-items: center;
gap: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.overview-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 24px;
}
.stat-info h3 {
font-size: 24px;
font-weight: 600;
color: #333;
margin: 0 0 4px 0;
}
.stat-info p {
font-size: 14px;
color: #666;
margin: 0;
}
/* 主要内容区 */
.main-content {
display: flex;
flex-direction: column;
gap: 24px;
}
/* 筛选区域 */
.filter-section {
background: white;
border-radius: 8px;
padding: 20px;
margin: 0 20px 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.filter-form {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.filter-form .el-form-item {
margin-bottom: 0;
}
/* 车辆列表区域 */
.vehicle-list-section {
background: white;
border-radius: 12px;
padding: 24px;
margin: 0 24px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
/* 表格样式 */
.el-table {
margin-bottom: 24px;
border-radius: 8px;
overflow: hidden;
}
.el-table th {
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
color: #1f2937 !important;
font-weight: 600 !important;
padding: 16px 0 !important;
}
.el-table td {
padding: 16px 0 !important;
}
/* 标签样式 */
.el-tag {
border-radius: 6px;
padding: 0 12px;
height: 28px;
line-height: 28px;
font-weight: 500;
}
/* 分页容器 */
.pagination-container {
margin-top: 20px;
display: flex;
justify-content: flex-end;
}
/* 车辆详情对话框 */
.vehicle-details {
padding: 20px;
}
.details-header {
margin-bottom: 24px;
padding-bottom: 16px;
border-bottom: 1px solid #e5e7eb;
}
.vehicle-info {
display: flex;
align-items: center;
gap: 12px;
}
.vehicle-info h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
.vehicle-details .el-descriptions {
margin-bottom: 24px;
}
.vehicle-details .el-timeline {
padding: 20px;
}
/* 通知列表 */
.notification-list {
padding: 20px;
}
.notification-item {
padding: 15px;
border-bottom: 1px solid #EBEEF5;
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.notification-content {
flex: 1;
}
.notification-content h4 {
margin: 0 0 8px;
font-size: 16px;
color: #303133;
}
.notification-content p {
margin: 0 0 8px;
color: #606266;
font-size: 14px;
}
.notification-time {
color: #909399;
font-size: 12px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.vehicle-overview {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button {
width: 100%;
}
.filter-form {
flex-direction: column;
}
.filter-form .el-form-item {
margin-right: 0;
}
.vehicle-overview {
grid-template-columns: 1fr;
}
.el-table {
width: 100%;
overflow-x: auto;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.overview-card,
.filter-section,
.vehicle-list-section {
background: #1f2937;
border: none;
}
.page-header {
background: #1f2937;
}
.header-right .el-button {
background: linear-gradient(135deg, #4f46e5 0%, #7e22ce 100%);
border: none;
}
.header-right .el-button:hover {
background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}
.stat-info h3,
.vehicle-info h3 {
color: #f3f4f6;
}
.el-table th {
background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
color: #f3f4f6 !important;
}
.el-table td {
background-color: #1f2937 !important;
color: #f3f4f6 !important;
border-bottom-color: #374151 !important;
}
.el-input__inner,
.el-textarea__inner {
background-color: #111827;
border-color: #374151;
color: #f9fafb;
}
.el-input__inner:focus,
.el-textarea__inner:focus {
border-color: #667eea;
}
.el-timeline-item__content {
color: #f9fafb;
}
.el-timeline-item__timestamp {
color: #9ca3af;
}
}
/* 动画效果 */
.fade-enter-active, .fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin: 0 20px 24px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-left {
display: flex;
align-items: center;
}
.header-left h1 {
font-size: 16px;
font-weight: 600;
color: #333;
margin: 0;
}
.header-right {
display: flex;
gap: 12px;
}
/* 分析头部 */
.analysis-header {
margin-bottom: 24px;
padding: 0 20px;
}
.header-title {
font-size: 16px;
font-weight: 600;
color: #333;
margin: 0 0 16px 0;
}
.filter-section {
background: white;
border-radius: 8px;
padding: 20px;
margin: 0 20px 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header-right .el-button {
padding: 12px 24px;
height: auto;
border-radius: 8px;
font-weight: 500;
transition: all 0.3s ease;
}
.header-right .el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.header-right .el-button--primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.header-right .el-button i {
margin-right: 4px;
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/vehicle-list.css
|
CSS
|
unknown
| 8,337
|
/* 车辆维护记录页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button {
padding: 12px 20px;
}
/* 主要内容区 */
.main-content {
padding: 0 24px;
}
/* 筛选区域 */
.filter-section {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 24px;
}
.filter-form {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.filter-form .el-form-item {
margin-bottom: 0;
margin-right: 0;
}
/* 维护记录列表 */
.maintenance-list {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
/* 表格样式 */
.el-table {
margin-bottom: 20px;
}
.el-table th {
background-color: #f9fafb !important;
color: #374151;
font-weight: 600;
}
.el-table td {
color: #4b5563;
}
.delete-btn {
color: #f56c6c;
}
.delete-btn:hover {
color: #f56c6c;
background-color: rgba(245, 108, 108, 0.1);
}
/* 分页容器 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding-top: 20px;
}
/* 对话框样式 */
.el-dialog {
border-radius: 12px;
overflow: hidden;
}
.el-dialog__header {
padding: 20px 24px;
border-bottom: 1px solid #e5e7eb;
margin: 0;
}
.el-dialog__title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
}
.el-dialog__body {
padding: 24px;
}
.el-dialog__footer {
padding: 16px 24px;
border-top: 1px solid #e5e7eb;
}
/* 表单样式 */
.el-form-item__label {
font-weight: 500;
color: #374151;
}
.el-input__inner,
.el-textarea__inner {
border-radius: 6px;
}
.el-input__inner:focus,
.el-textarea__inner:focus {
border-color: #667eea;
}
/* 维护详情样式 */
.maintenance-details {
padding: 20px;
}
.maintenance-details .el-descriptions {
margin-bottom: 32px;
}
.maintenance-details .el-descriptions__label {
font-weight: 500;
color: #374151;
}
.maintenance-details .el-descriptions__content {
color: #4b5563;
}
/* 维护进度时间线 */
.maintenance-timeline {
margin-top: 32px;
padding-top: 32px;
border-top: 1px solid #e5e7eb;
}
.maintenance-timeline h3 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin-bottom: 20px;
}
.el-timeline-item__content {
color: #4b5563;
}
.el-timeline-item__timestamp {
color: #6b7280;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.filter-form {
gap: 12px;
}
}
@media (max-width: 768px) {
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button {
width: 100%;
}
.main-content {
padding: 0 16px;
}
.filter-section,
.maintenance-list {
padding: 16px;
}
.filter-form {
flex-direction: column;
}
.filter-form .el-form-item {
width: 100%;
}
.el-table {
width: 100%;
overflow-x: auto;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.filter-section,
.maintenance-list {
background: #1f2937;
}
.header-left h1,
.el-dialog__title,
.maintenance-timeline h3 {
color: #f9fafb;
}
.el-table th {
background-color: #111827 !important;
color: #f9fafb;
}
.el-table td {
color: #d1d5db;
}
.el-form-item__label {
color: #f9fafb;
}
.el-input__inner,
.el-textarea__inner {
background-color: #111827;
border-color: #374151;
color: #f9fafb;
}
.el-input__inner:focus,
.el-textarea__inner:focus {
border-color: #667eea;
}
.el-dialog {
background: #1f2937;
}
.el-dialog__header,
.el-dialog__footer {
border-color: #374151;
}
.maintenance-details .el-descriptions__label {
color: #f9fafb;
}
.maintenance-details .el-descriptions__content {
color: #d1d5db;
}
.maintenance-timeline {
border-color: #374151;
}
.el-timeline-item__content {
color: #d1d5db;
}
.el-timeline-item__timestamp {
color: #9ca3af;
}
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/vehicle-maintenance.css
|
CSS
|
unknown
| 4,957
|
/* 车辆追踪页面样式 */
/* 页面头部 */
.page-header {
background: white;
padding: 20px 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-left h1 {
font-size: 24px;
font-weight: 600;
color: #1f2937;
margin-bottom: 8px;
}
.header-right .el-button-group {
display: flex;
gap: 8px;
}
/* 主要内容区 */
.main-content {
display: grid;
grid-template-columns: 320px 1fr;
gap: 24px;
height: calc(100vh - 140px);
}
/* 左侧车辆列表面板 */
.vehicle-list-panel {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-header {
padding: 20px;
border-bottom: 1px solid #e5e7eb;
}
.panel-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin-bottom: 16px;
}
.vehicle-list {
flex: 1;
overflow-y: auto;
padding: 12px;
}
.vehicle-item {
padding: 16px;
border-radius: 8px;
background: #f9fafb;
margin-bottom: 12px;
cursor: pointer;
transition: all 0.3s ease;
border: 1px solid #e5e7eb;
}
.vehicle-item:hover {
background: #f3f4f6;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.vehicle-item.active {
background: rgba(102, 126, 234, 0.1);
border-color: #667eea;
}
.vehicle-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.vehicle-info h4 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
.vehicle-details {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 13px;
color: #6b7280;
}
.vehicle-details span {
display: flex;
align-items: center;
gap: 6px;
}
.vehicle-details i {
font-size: 14px;
}
/* 右侧地图和详情面板 */
.map-details-panel {
display: flex;
flex-direction: column;
gap: 24px;
}
/* 地图容器 */
.map-container {
flex: 1;
background: #f3f4f6;
border-radius: 12px;
overflow: hidden;
position: relative;
}
/* 车辆详情卡片 */
.vehicle-details-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.card-header h3 {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0;
}
/* 运行轨迹 */
.tracking-history {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #e5e7eb;
}
.tracking-history h4 {
font-size: 16px;
font-weight: 600;
color: #1f2937;
margin-bottom: 16px;
}
.el-timeline {
padding: 0;
}
.el-timeline-item__content {
color: #374151;
}
.el-timeline-item__timestamp {
color: #6b7280;
}
/* 表单样式 */
.el-form-item__label {
font-weight: 500;
color: #374151;
}
.el-input__inner,
.el-select {
width: 100%;
}
/* 按钮样式 */
.el-button--primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.el-button--primary:hover {
background: linear-gradient(135deg, #5a67d8 0%, #6d4c98 100%);
}
.el-button--success {
background: #10b981;
border: none;
}
.el-button--success:hover {
background: #059669;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 280px 1fr;
}
}
@media (max-width: 768px) {
.main-content {
grid-template-columns: 1fr;
height: auto;
}
.vehicle-list-panel {
height: 400px;
}
.map-container {
height: 400px;
}
.page-header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.header-right {
width: 100%;
}
.header-right .el-button-group {
width: 100%;
}
.header-right .el-button {
flex: 1;
}
}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
.page-header,
.vehicle-list-panel,
.vehicle-details-card {
background: #1f2937;
}
.header-left h1,
.panel-header h3,
.card-header h3,
.tracking-history h4,
.vehicle-info h4 {
color: #f9fafb;
}
.vehicle-item {
background: #111827;
border-color: #374151;
}
.vehicle-item:hover {
background: #1f2937;
}
.vehicle-item.active {
background: rgba(102, 126, 234, 0.2);
}
.vehicle-details {
color: #9ca3af;
}
.map-container {
background: #111827;
}
.el-timeline-item__content {
color: #f9fafb;
}
.el-timeline-item__timestamp {
color: #9ca3af;
}
.el-form-item__label {
color: #f9fafb;
}
.el-input__inner,
.el-textarea__inner {
background-color: #111827;
border-color: #374151;
color: #f9fafb;
}
.el-input__inner:focus,
.el-textarea__inner:focus {
border-color: #667eea;
}
}
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
css/vehicle-tracking.css
|
CSS
|
unknown
| 5,197
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据导出 - 智驭安行系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/data-export.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>数据导出</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>数据统计</el-breadcrumb-item>
<el-breadcrumb-item>数据导出</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button-group>
<el-button type="primary" @click="startExport">
<i class="el-icon-download"></i> 开始导出
</el-button>
<el-button type="success" @click="batchExport">
<i class="el-icon-folder-add"></i> 批量导出
</el-button>
</el-button-group>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 导出配置区域 -->
<div class="export-config-section">
<div class="config-header">
<h3>导出配置</h3>
<el-button type="text" @click="saveConfig">
<i class="el-icon-star-off"></i> 保存配置
</el-button>
</div>
<el-form :model="exportConfig" label-width="100px" class="config-form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="数据类型">
<el-select v-model="exportConfig.dataType" placeholder="请选择数据类型">
<el-option label="交通流量数据" value="traffic"></el-option>
<el-option label="安全事件数据" value="safety"></el-option>
<el-option label="车辆运行数据" value="vehicle"></el-option>
<el-option label="系统日志数据" value="log"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="时间范围">
<el-date-picker
v-model="exportConfig.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="导出格式">
<el-radio-group v-model="exportConfig.format">
<el-radio label="csv">CSV</el-radio>
<el-radio label="excel">Excel</el-radio>
<el-radio label="json">JSON</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据编码">
<el-select v-model="exportConfig.encoding" placeholder="请选择编码格式">
<el-option label="UTF-8" value="utf8"></el-option>
<el-option label="GBK" value="gbk"></el-option>
<el-option label="GB2312" value="gb2312"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="导出字段">
<el-checkbox-group v-model="exportConfig.fields">
<el-checkbox label="timestamp">时间戳</el-checkbox>
<el-checkbox label="location">位置信息</el-checkbox>
<el-checkbox label="value">数值</el-checkbox>
<el-checkbox label="status">状态</el-checkbox>
<el-checkbox label="description">描述</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="导出说明">
<el-input
type="textarea"
v-model="exportConfig.description"
:rows="3"
placeholder="请输入导出说明">
</el-input>
</el-form-item>
</el-form>
</div>
<!-- 数据预览区域 -->
<div class="data-preview-section">
<div class="preview-header">
<h3>数据预览</h3>
<div class="preview-actions">
<el-button-group>
<el-button size="mini" @click="refreshPreview">
<i class="el-icon-refresh"></i> 刷新
</el-button>
<el-button size="mini" @click="downloadSample">
<i class="el-icon-download"></i> 下载样例
</el-button>
</el-button-group>
</div>
</div>
<div class="preview-content" v-loading="previewLoading">
<div class="preview-placeholder" v-if="!hasPreview">
<i class="el-icon-document"></i>
<p>请配置导出参数并点击预览</p>
</div>
<div class="preview-data" v-else>
<el-table :data="previewData" style="width: 100%" height="400">
<el-table-column prop="timestamp" label="时间戳" width="180"></el-table-column>
<el-table-column prop="location" label="位置" width="150"></el-table-column>
<el-table-column prop="value" label="数值" width="120"></el-table-column>
<el-table-column prop="status" label="状态" width="100"></el-table-column>
<el-table-column prop="description" label="描述"></el-table-column>
</el-table>
</div>
</div>
</div>
<!-- 导出历史列表 -->
<div class="history-section">
<div class="section-header">
<h3>导出历史</h3>
<el-input
placeholder="搜索导出记录"
v-model="searchQuery"
prefix-icon="el-icon-search"
style="width: 200px">
</el-input>
</div>
<el-table :data="exportHistory" style="width: 100%">
<el-table-column prop="fileName" label="文件名" width="200"></el-table-column>
<el-table-column prop="dataType" label="数据类型" width="120"></el-table-column>
<el-table-column prop="exportTime" label="导出时间" width="180"></el-table-column>
<el-table-column prop="format" label="格式" width="100"></el-table-column>
<el-table-column prop="size" label="大小" width="100"></el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" @click="downloadFile(scope.row)">下载</el-button>
<el-button type="text" @click="deleteFile(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 导出配置
exportConfig: {
dataType: '',
dateRange: [],
format: 'excel',
encoding: 'utf8',
fields: ['timestamp', 'location', 'value'],
description: ''
},
// 预览状态
previewLoading: false,
hasPreview: false,
// 预览数据
previewData: [
{
timestamp: '2024-03-20 10:00:00',
location: '重庆市渝中区',
value: '1234',
status: '正常',
description: '交通流量数据'
},
{
timestamp: '2024-03-20 10:05:00',
location: '重庆市江北区',
value: '1567',
status: '正常',
description: '交通流量数据'
}
],
// 导出历史
exportHistory: [
{
fileName: 'traffic_data_20240320.xlsx',
dataType: '交通流量数据',
exportTime: '2024-03-20 14:30',
format: 'Excel',
size: '2.5MB'
},
{
fileName: 'safety_events_20240319.csv',
dataType: '安全事件数据',
exportTime: '2024-03-19 16:45',
format: 'CSV',
size: '1.8MB'
}
],
// 搜索
searchQuery: '',
// 分页
currentPage: 1,
pageSize: 10,
total: 0
}
},
methods: {
// 开始导出
startExport() {
this.$message.success('开始导出数据...');
// TODO: 实现导出逻辑
},
// 批量导出
batchExport() {
this.$message.info('批量导出功能开发中...');
// TODO: 实现批量导出逻辑
},
// 保存配置
saveConfig() {
this.$message.success('导出配置保存成功');
// TODO: 实现配置保存逻辑
},
// 刷新预览
refreshPreview() {
this.previewLoading = true;
setTimeout(() => {
this.hasPreview = true;
this.previewLoading = false;
this.$message.success('预览已刷新');
}, 1000);
},
// 下载样例
downloadSample() {
this.$message.success('样例文件下载中...');
// TODO: 实现样例下载逻辑
},
// 下载文件
downloadFile(file) {
this.$message.success(`下载文件:${file.fileName}`);
// TODO: 实现文件下载逻辑
},
// 删除文件
deleteFile(file) {
this.$confirm(`确定要删除文件"${file.fileName}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('文件已删除');
// TODO: 实现文件删除逻辑
});
},
// 处理分页大小变化
handleSizeChange(val) {
this.pageSize = val;
// TODO: 重新加载数据
},
// 处理页码变化
handleCurrentChange(val) {
this.currentPage = val;
// TODO: 重新加载数据
}
},
mounted() {
// 初始化数据
this.total = this.exportHistory.length;
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
data-export.html
|
HTML
|
unknown
| 10,067
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据概览 - 智驭安行系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/data-overview.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>数据概览</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>数据统计</el-breadcrumb-item>
<el-breadcrumb-item>数据概览</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button-group>
<el-button type="primary" @click="refreshData">
<i class="el-icon-refresh"></i> 刷新数据
</el-button>
<el-button type="success" @click="exportData">
<i class="el-icon-download"></i> 导出数据
</el-button>
</el-button-group>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 时间范围选择 -->
<div class="time-range-section">
<el-radio-group v-model="timeRange" @change="handleTimeRangeChange">
<el-radio-button label="today">今日</el-radio-button>
<el-radio-button label="week">本周</el-radio-button>
<el-radio-button label="month">本月</el-radio-button>
<el-radio-button label="custom">自定义</el-radio-button>
</el-radio-group>
<el-date-picker
v-if="timeRange === 'custom'"
v-model="customDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleCustomDateChange">
</el-date-picker>
</div>
<!-- 数据概览卡片 -->
<div class="overview-cards">
<div class="overview-card" v-for="card in overviewCards" :key="card.id">
<div class="card-icon" :style="{ backgroundColor: card.color }">
<i :class="card.icon"></i>
</div>
<div class="card-content">
<div class="card-title">{{ card.title }}</div>
<div class="card-value">{{ card.value }}</div>
<div class="card-trend" :class="card.trend">
<i :class="card.trend === 'up' ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
{{ card.change }}
</div>
</div>
</div>
</div>
<!-- 图表区域 -->
<div class="charts-section">
<!-- 交通流量趋势 -->
<div class="chart-card">
<div class="chart-header">
<h3>交通流量趋势</h3>
<el-dropdown @command="handleTrafficChartAction">
<el-button size="mini">
操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="export">导出数据</el-dropdown-item>
<el-dropdown-item command="refresh">刷新图表</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="chart-content" id="trafficChart">
<div class="chart-placeholder">
<i class="el-icon-data-line"></i>
<p>交通流量趋势图表</p>
</div>
</div>
</div>
<!-- 安全事件分布 -->
<div class="chart-card">
<div class="chart-header">
<h3>安全事件分布</h3>
<el-dropdown @command="handleSafetyChartAction">
<el-button size="mini">
操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="export">导出数据</el-dropdown-item>
<el-dropdown-item command="refresh">刷新图表</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="chart-content" id="safetyChart">
<div class="chart-placeholder">
<i class="el-icon-pie-chart"></i>
<p>安全事件分布图表</p>
</div>
</div>
</div>
</div>
<!-- 数据明细表格 -->
<div class="data-table-section">
<div class="section-header">
<h3>数据明细</h3>
<el-button type="text" @click="exportTableData">
<i class="el-icon-download"></i> 导出表格
</el-button>
</div>
<el-table :data="tableData" style="width: 100%" v-loading="tableLoading">
<el-table-column prop="date" label="日期" width="180"></el-table-column>
<el-table-column prop="trafficVolume" label="交通流量" width="120"></el-table-column>
<el-table-column prop="safetyEvents" label="安全事件" width="120"></el-table-column>
<el-table-column prop="averageSpeed" label="平均速度" width="120"></el-table-column>
<el-table-column prop="congestionLevel" label="拥堵程度" width="120">
<template slot-scope="scope">
<el-tag :type="getCongestionType(scope.row.congestionLevel)">
{{ scope.row.congestionLevel }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="remarks" label="备注"></el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 时间范围
timeRange: 'today',
customDateRange: [],
// 数据概览卡片
overviewCards: [
{
id: 1,
title: '总交通流量',
value: '1,234,567',
icon: 'el-icon-data-line',
color: '#667eea',
trend: 'up',
change: '+12.5%'
},
{
id: 2,
title: '安全事件数',
value: '23',
icon: 'el-icon-warning',
color: '#f56c6c',
trend: 'down',
change: '-8.3%'
},
{
id: 3,
title: '平均车速',
value: '45 km/h',
icon: 'el-icon-speedometer',
color: '#67c23a',
trend: 'up',
change: '+5.2%'
},
{
id: 4,
title: '拥堵指数',
value: '2.3',
icon: 'el-icon-data-analysis',
color: '#e6a23c',
trend: 'down',
change: '-3.1%'
}
],
// 表格数据
tableData: [
{
date: '2024-03-20',
trafficVolume: '123,456',
safetyEvents: '5',
averageSpeed: '45 km/h',
congestionLevel: '轻度拥堵',
remarks: '早高峰期间交通流量较大'
},
{
date: '2024-03-19',
trafficVolume: '118,234',
safetyEvents: '3',
averageSpeed: '48 km/h',
congestionLevel: '畅通',
remarks: '交通状况良好'
}
],
// 分页
currentPage: 1,
pageSize: 10,
total: 0,
// 加载状态
tableLoading: false
}
},
methods: {
// 刷新数据
refreshData() {
this.$message.success('数据刷新中...');
// TODO: 实现数据刷新逻辑
},
// 导出数据
exportData() {
this.$message.success('数据导出中...');
// TODO: 实现数据导出逻辑
},
// 处理时间范围变化
handleTimeRangeChange(value) {
// TODO: 根据时间范围更新数据
this.refreshData();
},
// 处理自定义日期变化
handleCustomDateChange(value) {
// TODO: 根据自定义日期范围更新数据
this.refreshData();
},
// 处理交通流量图表操作
handleTrafficChartAction(command) {
if (command === 'export') {
this.$message.success('导出交通流量数据...');
} else if (command === 'refresh') {
this.$message.info('刷新交通流量图表...');
}
},
// 处理安全事件图表操作
handleSafetyChartAction(command) {
if (command === 'export') {
this.$message.success('导出安全事件数据...');
} else if (command === 'refresh') {
this.$message.info('刷新安全事件图表...');
}
},
// 导出表格数据
exportTableData() {
this.$message.success('导出表格数据...');
// TODO: 实现表格数据导出逻辑
},
// 获取拥堵程度标签类型
getCongestionType(level) {
const typeMap = {
'畅通': 'success',
'轻度拥堵': 'warning',
'中度拥堵': 'danger',
'严重拥堵': 'danger'
};
return typeMap[level] || 'info';
},
// 处理分页大小变化
handleSizeChange(val) {
this.pageSize = val;
this.refreshData();
},
// 处理页码变化
handleCurrentChange(val) {
this.currentPage = val;
this.refreshData();
}
},
mounted() {
// 初始化数据
this.total = this.tableData.length;
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
data-overview.html
|
HTML
|
unknown
| 9,434
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>报表生成 - 智驭安行系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/data-report.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>报表生成</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>数据统计</el-breadcrumb-item>
<el-breadcrumb-item>报表生成</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button-group>
<el-button type="primary" @click="generateReport">
<i class="el-icon-document-add"></i> 生成报表
</el-button>
<el-button type="success" @click="exportReport">
<i class="el-icon-download"></i> 导出报表
</el-button>
</el-button-group>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 报表配置区域 -->
<div class="report-config-section">
<div class="config-header">
<h3>报表配置</h3>
<el-button type="text" @click="saveTemplate">
<i class="el-icon-star-off"></i> 保存为模板
</el-button>
</div>
<el-form :model="reportConfig" label-width="100px" class="config-form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报表类型">
<el-select v-model="reportConfig.type" placeholder="请选择报表类型">
<el-option label="交通流量报表" value="traffic"></el-option>
<el-option label="安全事件报表" value="safety"></el-option>
<el-option label="车辆运行报表" value="vehicle"></el-option>
<el-option label="综合统计报表" value="comprehensive"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="时间范围">
<el-date-picker
v-model="reportConfig.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报表格式">
<el-radio-group v-model="reportConfig.format">
<el-radio label="excel">Excel</el-radio>
<el-radio label="pdf">PDF</el-radio>
<el-radio label="word">Word</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据粒度">
<el-select v-model="reportConfig.granularity" placeholder="请选择数据粒度">
<el-option label="小时" value="hour"></el-option>
<el-option label="天" value="day"></el-option>
<el-option label="周" value="week"></el-option>
<el-option label="月" value="month"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="报表内容">
<el-checkbox-group v-model="reportConfig.content">
<el-checkbox label="trafficFlow">交通流量</el-checkbox>
<el-checkbox label="safetyEvents">安全事件</el-checkbox>
<el-checkbox label="vehicleStatus">车辆状态</el-checkbox>
<el-checkbox label="congestionLevel">拥堵程度</el-checkbox>
<el-checkbox label="statistics">统计分析</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="备注说明">
<el-input
type="textarea"
v-model="reportConfig.remarks"
:rows="3"
placeholder="请输入报表备注说明">
</el-input>
</el-form-item>
</el-form>
</div>
<!-- 报表预览区域 -->
<div class="report-preview-section">
<div class="preview-header">
<h3>报表预览</h3>
<div class="preview-actions">
<el-button-group>
<el-button size="mini" @click="refreshPreview">
<i class="el-icon-refresh"></i> 刷新
</el-button>
<el-button size="mini" @click="printPreview">
<i class="el-icon-printer"></i> 打印
</el-button>
</el-button-group>
</div>
</div>
<div class="preview-content" v-loading="previewLoading">
<div class="preview-placeholder" v-if="!hasPreview">
<i class="el-icon-document"></i>
<p>请配置报表参数并点击生成报表</p>
</div>
<div class="preview-document" v-else>
<!-- 报表预览内容 -->
<div class="report-header">
<h2>{{ reportConfig.type }}报表</h2>
<p>生成时间:{{ currentTime }}</p>
</div>
<div class="report-body">
<!-- 这里将根据报表类型显示不同的预览内容 -->
<div class="preview-charts">
<div class="chart-item">
<div class="chart-title">交通流量趋势</div>
<div class="chart-placeholder">
<i class="el-icon-data-line"></i>
<p>交通流量趋势图表</p>
</div>
</div>
<div class="chart-item">
<div class="chart-title">安全事件分布</div>
<div class="chart-placeholder">
<i class="el-icon-pie-chart"></i>
<p>安全事件分布图表</p>
</div>
</div>
</div>
<div class="preview-table">
<el-table :data="previewData" style="width: 100%">
<el-table-column prop="date" label="日期" width="180"></el-table-column>
<el-table-column prop="trafficVolume" label="交通流量" width="120"></el-table-column>
<el-table-column prop="safetyEvents" label="安全事件" width="120"></el-table-column>
<el-table-column prop="congestionLevel" label="拥堵程度" width="120"></el-table-column>
<el-table-column prop="remarks" label="备注"></el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
<!-- 历史报表列表 -->
<div class="history-section">
<div class="section-header">
<h3>历史报表</h3>
<el-input
placeholder="搜索报表"
v-model="searchQuery"
prefix-icon="el-icon-search"
style="width: 200px">
</el-input>
</div>
<el-table :data="historyReports" style="width: 100%">
<el-table-column prop="name" label="报表名称" width="200"></el-table-column>
<el-table-column prop="type" label="报表类型" width="120"></el-table-column>
<el-table-column prop="createTime" label="生成时间" width="180"></el-table-column>
<el-table-column prop="format" label="格式" width="100"></el-table-column>
<el-table-column prop="size" label="大小" width="100"></el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" @click="viewReport(scope.row)">查看</el-button>
<el-button type="text" @click="downloadReport(scope.row)">下载</el-button>
<el-button type="text" @click="deleteReport(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 报表配置
reportConfig: {
type: '',
dateRange: [],
format: 'excel',
granularity: 'day',
content: ['trafficFlow', 'safetyEvents'],
remarks: ''
},
// 预览状态
previewLoading: false,
hasPreview: false,
currentTime: new Date().toLocaleString(),
// 预览数据
previewData: [
{
date: '2024-03-20',
trafficVolume: '123,456',
safetyEvents: '5',
congestionLevel: '轻度拥堵',
remarks: '早高峰期间交通流量较大'
},
{
date: '2024-03-19',
trafficVolume: '118,234',
safetyEvents: '3',
congestionLevel: '畅通',
remarks: '交通状况良好'
}
],
// 历史报表
historyReports: [
{
name: '3月交通流量报表',
type: '交通流量报表',
createTime: '2024-03-20 14:30',
format: 'Excel',
size: '2.5MB'
},
{
name: '3月安全事件报表',
type: '安全事件报表',
createTime: '2024-03-19 16:45',
format: 'PDF',
size: '1.8MB'
}
],
// 搜索
searchQuery: '',
// 分页
currentPage: 1,
pageSize: 10,
total: 0
}
},
methods: {
// 生成报表
generateReport() {
this.previewLoading = true;
setTimeout(() => {
this.hasPreview = true;
this.previewLoading = false;
this.$message.success('报表生成成功');
}, 1500);
},
// 导出报表
exportReport() {
this.$message.success('报表导出中...');
// TODO: 实现报表导出逻辑
},
// 保存模板
saveTemplate() {
this.$message.success('报表模板保存成功');
// TODO: 实现模板保存逻辑
},
// 刷新预览
refreshPreview() {
this.previewLoading = true;
setTimeout(() => {
this.previewLoading = false;
this.$message.success('预览已刷新');
}, 1000);
},
// 打印预览
printPreview() {
this.$message.info('准备打印...');
// TODO: 实现打印功能
},
// 查看报表
viewReport(report) {
this.$message.info(`查看报表:${report.name}`);
// TODO: 实现报表查看逻辑
},
// 下载报表
downloadReport(report) {
this.$message.success(`下载报表:${report.name}`);
// TODO: 实现报表下载逻辑
},
// 删除报表
deleteReport(report) {
this.$confirm(`确定要删除报表"${report.name}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('报表已删除');
// TODO: 实现报表删除逻辑
});
},
// 处理分页大小变化
handleSizeChange(val) {
this.pageSize = val;
// TODO: 重新加载数据
},
// 处理页码变化
handleCurrentChange(val) {
this.currentPage = val;
// TODO: 重新加载数据
}
},
mounted() {
// 初始化数据
this.total = this.historyReports.length;
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
data-report.html
|
HTML
|
unknown
| 11,438
|
<!-- 111111-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公共交通异常检测系统 - 系统管理平台</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<!-- 主框架 -->
<div class="admin-layout" v-show="!loading">
<!-- 顶部导航栏 -->
<header class="admin-header">
<div class="header-left">
<div class="logo-section">
<img :src="logoUrl" alt="公共交通异常检测系统" class="header-logo" @error="handleLogoError">
<h1 class="system-title">公共交通异常检测系统</h1>
</div>
<div class="breadcrumb-section">
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>{{ currentPage }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
<div class="header-right">
<!-- 通知 -->
<el-badge :value="notificationCount" class="notification-badge">
<el-button type="text" @click="showNotifications">
<i class="el-icon-bell"></i>
</el-button>
</el-badge>
<!-- 用户菜单 -->
<el-dropdown @command="handleUserCommand" class="user-dropdown">
<div class="user-info">
<el-avatar :size="32" :src="userInfo.avatar || './img/myphoto2.jpg'"
icon="el-icon-user-solid"></el-avatar>
<span class="username">{{ userInfo.username }}</span>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">
<i class="el-icon-user"></i> 个人信息
</el-dropdown-item>
<el-dropdown-item command="settings">
<i class="el-icon-setting"></i> 系统设置
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<i class="el-icon-switch-button"></i> 退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
<!-- 主内容区 -->
<div class="admin-main">
<!-- 侧边导航 -->
<aside class="admin-sidebar" :class="{ 'collapsed': sidebarCollapsed }">
<div class="sidebar-toggle" @click="toggleSidebar">
<i :class="sidebarCollapsed ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<el-menu :default-active="activeMenu" :collapse="sidebarCollapsed" @select="handleMenuSelect"
class="sidebar-menu">
<el-menu-item index="dashboard">
<i class="el-icon-data-board"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="traffic">
<template slot="title">
<i class="el-icon-location"></i>
<span>交通监控</span>
</template>
<el-menu-item index="traffic-monitor">实时监控</el-menu-item>
<el-menu-item index="traffic-analysis">数据分析</el-menu-item>
<el-menu-item index="traffic-alert">预警管理</el-menu-item>
</el-submenu>
<el-submenu index="vehicle">
<template slot="title">
<i class="el-icon-truck"></i>
<span>车辆管理</span>
</template>
<el-menu-item index="vehicle-list">车辆列表</el-menu-item>
<el-menu-item index="vehicle-tracking">车辆追踪</el-menu-item>
<el-menu-item index="vehicle-maintenance">维护记录</el-menu-item>
</el-submenu>
<el-submenu index="data">
<template slot="title">
<i class="el-icon-pie-chart"></i>
<span>数据统计</span>
</template>
<el-menu-item index="data-overview">数据概览</el-menu-item>
<el-menu-item index="data-report">报表生成</el-menu-item>
<el-menu-item index="data-export">数据导出</el-menu-item>
</el-submenu>
<el-menu-item index="system">
<i class="el-icon-setting"></i>
<span slot="title">系统管理</span>
</el-menu-item>
</el-menu>
</aside>
<!-- 内容区域 -->
<main class="admin-content">
<!-- 仪表盘内容 -->
<div v-if="activeMenu === 'dashboard'" class="dashboard-content">
<!-- 欢迎信息 -->
<div class="welcome-card">
<div class="welcome-info">
<h2>欢迎回来,{{ userInfo.username }}!</h2>
<p>{{ getWelcomeMessage() }}</p>
<div class="user-stats">
<span class="stat-item">角色:{{ userInfo.role }}</span>
<span class="stat-item">登录时间:{{ formatLoginTime() }}</span>
</div>
</div>
<div class="welcome-actions">
<el-button type="primary" @click="startQuickAction">快速操作</el-button>
<el-button @click="viewHelp">使用帮助</el-button>
</div>
</div>
<!-- 天气预报模块 -->
<div class="weather-module">
<div class="weather-header">
<h3>
<i class="el-icon-cloudy"></i>
天气预报({{ weather.location }})
</h3>
<div class="weather-tips">
<div class="current-weather">
<span class="current-temp">{{ weather.temperature }}°</span>
<span class="current-desc">{{ weather.description }}</span>
</div>
</div>
</div>
<!-- 7天天气预报 -->
<div class="weather-forecast">
<div v-for="(day, idx) in weather.forecast" :key="idx" class="forecast-item"
:class="{ 'active': selectedWeatherDay === idx }"
@click="selectWeatherDay(idx)">
<div class="forecast-date">
<span class="day-name">{{ getDayName(day.date, idx) }}</span>
<span class="month-day">{{ getMonthDay(day.date) }}</span>
</div>
<div class="forecast-icon">{{ getWeatherEmoji(day.text) }}</div>
<div class="forecast-temps">
<span class="temp-max">{{ day.max }}°</span>
<span class="temp-min">{{ day.min }}°</span>
</div>
<div class="forecast-desc">{{ day.text }}</div>
</div>
</div>
<!-- 选中日期的详细信息 -->
<div v-if="selectedWeatherInfo" class="weather-details">
<div class="details-header">
<div class="detail-title-section">
<h4>{{ getDetailDateTitle(selectedWeatherInfo.date) }} 详细信息</h4>
<div class="weather-summary">
<span
class="main-weather">{{ getWeatherEmoji(selectedWeatherInfo.text) }}</span>
<span class="weather-desc">{{ selectedWeatherInfo.text }}</span>
<span class="temp-range">{{ selectedWeatherInfo.min }}°C ~
{{ selectedWeatherInfo.max }}°C</span>
</div>
</div>
<el-button type="text" @click="refreshWeatherDetails" class="refresh-btn"
:loading="refreshing">
<i class="el-icon-refresh"></i>
</el-button>
</div>
<!-- 核心指标 -->
<div class="weather-metrics">
<div class="metric-item"
v-for="metric in getWeatherMetrics(selectedWeatherInfo)" :key="metric.id">
<div class="metric-icon" :style="{ color: metric.color }">
<i :class="metric.icon"></i>
</div>
<div class="metric-content">
<span class="metric-label">{{ metric.label }}</span>
<span class="metric-value">{{ metric.value }}</span>
<div class="metric-progress" v-if="metric.progress">
<div class="progress-bar"
:style="{ width: metric.progress + '%', backgroundColor: metric.color }">
</div>
</div>
</div>
</div>
</div>
<!-- 生活指数 -->
<div class="life-tips">
<h5>
<i class="el-icon-star-off"></i>
生活指数
</h5>
<div class="tips-grid">
<div class="tip-item" v-for="tip in getLifeTips(selectedWeatherInfo)"
:key="tip.id" @click="showTipDetail(tip)">
<div class="tip-icon" :style="{ backgroundColor: tip.color }">
<i :class="tip.icon"></i>
</div>
<div class="tip-content">
<span class="tip-name">{{ tip.name }}</span>
<span class="tip-level"
:class="tip.level">{{ tip.levelText }}</span>
<span class="tip-desc">{{ tip.description }}</span>
</div>
</div>
</div>
</div>
<!-- 温馨提示 */
<div class="weather-alerts">
<h5>
<i class="el-icon-bell"></i>
温馨提示
</h5>
<div class="alert-list">
<div
class="alert-item"
v-for="alert in getWeatherAlerts(selectedWeatherInfo)"
:key="alert.id"
:class="alert.type"
>
<i :class="alert.icon"></i>
<span>{{ alert.message }}</span>
</div>
</div>
</div>
<!-- 月相信息 -->
<div class="moon-phase" v-if="selectedWeatherDay === 0">
<div class="moon-info">
<div class="moon-icon">🌙</div>
<div class="moon-details">
<span class="moon-phase-name">{{ getCurrentMoonPhase() }}</span>
<span class="moon-desc">月相变化影响潮汐和情绪</span>
</div>
</div>
</div>
</div>
</div>
<!-- 统计卡片 -->
<div class="stats-grid">
<div class="stat-card" v-for="stat in statsData" :key="stat.id">
<div class="stat-icon" :style="{ backgroundColor: stat.color }">
<i :class="stat.icon"></i>
</div>
<div class="stat-content">
<h3>{{ stat.value }}</h3>
<p>{{ stat.label }}</p>
<span class="stat-trend" :class="stat.trend">
<i
:class="stat.trend === 'up' ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
{{ stat.change }}
</span>
</div>
</div>
</div>
<!-- 快速链接 -->
<div class="quick-links">
<h3>快速功能</h3>
<div class="links-grid">
<div class="quick-link" v-for="link in quickLinks" :key="link.id"
@click="handleQuickLink(link)">
<i :class="link.icon"></i>
<span>{{ link.title }}</span>
</div>
</div>
</div>
<!-- 最新动态 -->
<div class="activity-feed">
<h3>系统动态</h3>
<div class="activity-list">
<div class="activity-item" v-for="activity in recentActivities" :key="activity.id">
<div class="activity-icon">
<i :class="activity.icon" :style="{ color: activity.color }"></i>
</div>
<div class="activity-content">
<p>{{ activity.content }}</p>
<span class="activity-time">{{ activity.time }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- 其他页面内容占位 -->
<div v-else class="page-content">
<div class="page-placeholder">
<i class="el-icon-document"></i>
<h3>{{ getPageTitle() }}</h3>
<p>{{ getPageDescription() }}</p>
<el-button type="primary" @click="backToDashboard">返回仪表盘</el-button>
</div>
</div>
</main>
</div>
</div>
<!-- 通知抽屉 -->
<el-drawer title="系统通知" :visible.sync="notificationDrawer" direction="rtl" size="400px">
<div class="notification-list">
<div class="notification-item" v-for="notification in notifications" :key="notification.id">
<div class="notification-content">
<h4>{{ notification.title }}</h4>
<p>{{ notification.content }}</p>
<span class="notification-time">{{ notification.time }}</span>
</div>
<el-button type="text" @click="markAsRead(notification.id)">
<i class="el-icon-check"></i>
</el-button>
</div>
</div>
</el-drawer>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 加载状态
loading: true,
loadingText: '正在加载系统...',
// 用户信息
userInfo: {
username: '',
role: '',
avatar: './img/myphoto2.jpg',
loginTime: ''
},
// 界面状态
sidebarCollapsed: false,
activeMenu: 'dashboard',
currentPage: '仪表盘',
// 通知相关
notificationCount: 3,
notificationDrawer: false,
notifications: [{
id: 1,
title: '系统更新通知',
content: '系统将在今晚23:00进行维护更新,预计耗时2小时',
time: '2025-05-26 14:30',
read: false
},
{
id: 2,
title: '交通预警',
content: '检测到重庆主城区交通流量异常,请及时关注',
time: '2025-05-26 13:15',
read: false
},
{
id: 3,
title: '数据备份完成',
content: '系统数据已成功备份至云端存储',
time: '2025-05-26 12:00',
read: false
}
],
// Logo
logoUrl: './img/logo_nobackground.png',
// 统计数据
statsData: [{
id: 1,
label: '在线车辆',
value: '26',
icon: 'el-icon-truck',
color: '#667eea',
trend: 'up',
change: '+12%'
},
{
id: 2,
label: '安全事件',
value: '8',
icon: 'el-icon-warning',
color: '#f56c6c',
trend: 'down',
change: '-8%'
},
{
id: 3,
label: '路段监控',
value: '156',
icon: 'el-icon-location-outline',
color: '#67c23a',
trend: 'up',
change: '+5%'
},
{
id: 4,
label: '数据处理',
value: '96%',
icon: 'el-icon-data-analysis',
color: '#e6a23c',
trend: 'up',
change: '+2%'
}
],
// 快速链接
quickLinks: [{
id: 1,
title: '车辆追踪',
icon: 'el-icon-location',
action: 'vehicle-tracking',
status: 'planned'
},
{
id: 2,
title: '数据分析',
icon: 'el-icon-pie-chart',
action: 'data-analysis',
status: 'planned'
},
{
id: 3,
title: '预警处理',
icon: 'el-icon-bell',
action: 'alert-handling',
status: 'planned'
},
{
id: 4,
title: '系统设置',
icon: 'el-icon-setting',
action: 'system-settings',
status: 'planned'
},
{
id: 5,
title: '用户管理',
icon: 'el-icon-user',
action: 'user-management',
status: 'planned'
},
{
id: 6,
title: '帮助中心',
icon: 'el-icon-question',
action: 'help-center',
status: 'planned'
}
],
// 最新动态
recentActivities: [{
id: 1,
content: '用户ts登录了系统',
icon: 'el-icon-user',
color: '#67c23a',
time: '5分钟前'
},
{
id: 2,
content: '用户ts登录了系统',
icon: 'el-icon-success',
color: '#67c23a',
time: '12分钟前'
},
{
id: 3,
content: '交通数据同步完成',
icon: 'el-icon-refresh',
color: '#409eff',
time: '15分钟前'
},
{
id: 4,
content: '检测到异常交通流量',
icon: 'el-icon-warning',
color: '#f56c6c',
time: '30分钟前'
},
{
id: 5,
content: '系统备份任务执行成功',
icon: 'el-icon-success',
color: '#67c23a',
time: '1小时前'
}
],
// 天气相关
weather: {
temperature: 0,
description: '获取中...',
location: '正在定位...',
iconClass: '',
forecast: []
},
// 天气预报选中状态
selectedWeatherDay: 0,
refreshing: false,
// 默认位置坐标 (重庆)
defaultCoords: {
latitude: 29.4316,
longitude: 106.9123
}
};
},
computed: {
// 获取选中日期的天气信息
selectedWeatherInfo() {
return this.weather.forecast[this.selectedWeatherDay] || null;
}
},
mounted() {
this.initSystem();
this.getCurrentLocation();
},
methods: {
// 系统初始化
async initSystem() {
try {
// 检查登录状态
const authToken = localStorage.getItem('authToken');
const userInfoStr = localStorage.getItem('userInfo');
if (!authToken || !userInfoStr) {
this.$message.warning('请先登录系统');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
return;
}
// 解析用户信息
this.userInfo = JSON.parse(userInfoStr);
this.userInfo.loginTime = localStorage.getItem('loginTime') || new Date().toISOString();
// 更新最新动态中的用户名
if (this.recentActivities.length > 1) {
this.recentActivities[1].content = `用户 ${this.userInfo.username} 登录了系统`;
}
// 模拟加载过程
await this.simulateLoading();
// 加载完成
this.loading = false;
this.$message.success(`欢迎回来,${this.userInfo.username}!`);
} catch (error) {
console.error('System initialization error:', error);
this.$message.error('系统初始化失败');
setTimeout(() => {
window.location.href = './login.html';
}, 2000);
}
},
// 模拟加载过程
simulateLoading() {
const steps = [{
text: '验证用户身份...',
duration: 800
},
{
text: '加载系统配置...',
duration: 600
},
{
text: '初始化数据...',
duration: 700
},
{
text: '准备界面...',
duration: 500
}
];
return new Promise((resolve) => {
let currentStep = 0;
const processStep = () => {
if (currentStep < steps.length) {
this.loadingText = steps[currentStep].text;
setTimeout(() => {
currentStep++;
processStep();
}, steps[currentStep]?.duration || 0);
} else {
resolve();
}
};
processStep();
});
},
// 获取欢迎消息
getWelcomeMessage() {
const hour = new Date().getHours();
if (hour < 6) return '夜深了,注意休息!';
if (hour < 12) return '早上好,新的一天开始了!';
if (hour < 18) return '下午好,工作进展如何?';
return '晚上好,今天辛苦了!';
},
// 格式化登录时间
formatLoginTime() {
if (!this.userInfo.loginTime) return '';
return new Date(this.userInfo.loginTime).toLocaleString('zh-CN');
},
// 侧边栏切换
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
// 菜单选择
handleMenuSelect(index) {
// 页面跳转映射配置
const pageRoutes = {
// 交通监控模块
'traffic-monitor': './traffic-monitor.html',
'traffic-analysis': './traffic-analysis.html',
'traffic-alert': './traffic-alert.html',
// 车辆管理模块
'vehicle-list': './vehicle-list.html',
'vehicle-tracking': './vehicle-tracking.html',
'vehicle-maintenance': './vehicle-maintenance.html',
// 数据统计模块
'data-overview': './data-overview.html',
'data-report': './data-report.html',
'data-export': './data-export.html',
// 系统管理模块
'system': './system-management.html'
};
// 已完成的页面列表
const completedPages = [
'traffic-monitor',
'traffic-analysis',
'vehicle-tracking',
'vehicle-maintenance',
'data-overview',
'data-report',
'data-export',
'system'
];
// 检查是否需要跳转到专门页面
if (pageRoutes[index]) {
// 预警管理直接跳转
if (index === 'traffic-alert') {
window.location.href = pageRoutes[index];
return;
}
if (completedPages.includes(index)) {
// 已完成的页面直接跳转
window.location.href = pageRoutes[index];
} else {
// 未完成的页面显示提示
this.$confirm(
`${this.getMenuTitle(index)}页面正在开发中,是否前往查看?`,
'页面开发状态', {
confirmButtonText: '前往查看',
cancelButtonText: '留在当前页',
type: 'info',
customClass: 'dev-status-dialog'
}
).then(() => {
// 用户确认后跳转(即使页面可能不存在)
window.location.href = pageRoutes[index];
}).catch(() => {
// 用户取消,停留在仪表盘
this.activeMenu = 'dashboard';
this.currentPage = '仪表盘';
});
}
return;
}
// 仪表盘或其他不需要跳转的页面
this.activeMenu = index;
this.currentPage = this.getMenuTitle(index);
},
// 获取菜单标题
getMenuTitle(index) {
const titles = {
'dashboard': '首页',
'traffic-monitor': '实时监控',
'traffic-analysis': '数据分析',
'traffic-alert': '预警管理',
'vehicle-list': '车辆列表',
'vehicle-tracking': '车辆追踪',
'vehicle-maintenance': '维护记录',
'data-overview': '数据概览',
'data-report': '报表生成',
'data-export': '数据导出',
'system': '系统管理'
};
return titles[index] || '未知页面';
},
// 用户命令处理
handleUserCommand(command) {
switch (command) {
case 'profile':
this.$message.info('个人信息功能开发中');
break;
case 'settings':
this.$message.info('系统设置功能开发中');
break;
case 'logout':
this.handleLogout();
break;
}
},
// 退出登录
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 清除登录状态
localStorage.removeItem('authToken');
localStorage.removeItem('userInfo');
localStorage.removeItem('loginTime');
this.$message.success('已安全退出');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
});
},
// 显示通知
showNotifications() {
this.notificationDrawer = true;
},
// 标记为已读
markAsRead(id) {
const notification = this.notifications.find(n => n.id === id);
if (notification && !notification.read) {
notification.read = true;
this.notificationCount = Math.max(0, this.notificationCount - 1);
this.$message.success('已标记为已读');
}
},
// 快速链接处理
handleQuickLink(link) {
// 快速链接到页面的映射
const quickLinkRoutes = {
'vehicle-tracking': './vehicle-tracking.html', // 车辆追踪
'data-analysis': './traffic-analysis.html', // 数据分析
'alert-handling': './traffic-alert.html', // 报警处理
'system-settings': './system-management.html', // 系统设置
'user-management': './system-management.html', // 用户管理
'help-center': './help-center.html' // 帮助中心
};
if (quickLinkRoutes[link.action]) {
if (link.action === 'vehicle-tracking' || link.action === 'data-analysis' ||
link.action === 'alert-handling' || link.action === 'system-settings' ||
link.action === 'user-management') {
// 大部分功能页面都在开发中
this.$confirm(
`${link.title}功能正在开发中,是否前往查看?`,
'功能开发状态', {
confirmButtonText: '前往查看',
cancelButtonText: '取消',
type: 'info'
}
).then(() => {
window.location.href = quickLinkRoutes[link.action];
});
} else {
// 其他页面直接跳转
window.location.href = quickLinkRoutes[link.action];
}
} else {
this.$message.info(`${link.title}功能开发中...`);
}
},
// 页面标题和描述
getPageTitle() {
return this.getMenuTitle(this.activeMenu);
},
getPageDescription() {
const descriptions = {
// 交通监控模块
'traffic-monitor': '✅ 已完成 - 实时监控交通状况,查看路段流量和异常情况',
'traffic-analysis': '✅ 已完成 - 分析交通数据,生成趋势报告和预测模型',
'traffic-alert': '🔄 待开发 - 管理交通预警规则和处理异常事件',
// 车辆管理模块
'vehicle-list': '🔄 待开发 - 查看和管理所有车辆的基础信息和状态',
'vehicle-tracking': '✅ 已完成 - 实时追踪车辆位置和运行状态',
'vehicle-maintenance': '✅ 已完成 - 记录和管理车辆维护保养信息',
// 数据统计模块
'data-overview': '✅ 已完成 - 查看系统数据概览和关键指标统计',
'data-report': '✅ 已完成 - 生成各类数据报表和分析图表',
'data-export': '✅ 已完成 - 导出系统数据和生成报告文件',
// 系统管理模块
'system': '✅ 已完成 - 系统配置、用户管理和权限设置'
};
return descriptions[this.activeMenu] || '该功能正在开发中,敬请期待';
},
// 返回仪表盘
backToDashboard() {
this.activeMenu = 'dashboard';
this.currentPage = '仪表盘';
},
// 其他功能方法
startQuickAction() {
this.$message.info('快速操作功能开发中');
},
viewHelp() {
this.$message.info('使用帮助功能开发中');
},
// Logo错误处理
handleLogoError() {
this.logoUrl =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjNjY3ZWVhIiByeD0iOCIvPgo8cGF0aCBkPSJNMjAgOEwxMCAxNGwyIDZsMCA4IDIwIDEyIDIwIDhabTAgMkwxMiAxNGwxIDNMMjAgMTVsNiAyTDE2IDE0TDIwIDEwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+';
},
// 获取开发状态样式类
getStatusClass(status) {
const classMap = {
'completed': 'completed',
'in-progress': 'in-progress',
'planned': 'planned'
};
return classMap[status] || 'planned';
},
// 获取开发状态文本
getStatusText(status) {
const textMap = {
'completed': '✅ 已完成',
'in-progress': '🔄 开发中',
'planned': '📋 待开发'
};
return textMap[status] || '📋 待开发';
},
// 获取当前位置
getCurrentLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
console.log('位置获取成功:', latitude, longitude);
this.fetchWeatherData(longitude, latitude);
},
(error) => {
console.error('位置获取失败:', error);
// 使用默认位置(重庆)
this.weather.location = '重庆';
this.fetchWeatherData(this.defaultCoords.longitude, this.defaultCoords.latitude);
}
);
} else {
console.error('浏览器不支持地理位置');
// 使用默认位置
this.weather.location = '重庆';
this.fetchWeatherData(this.defaultCoords.longitude, this.defaultCoords.latitude);
}
},
// 获取天气数据
fetchWeatherData(longitude, latitude) {
const key = "f9cdb27cda63499499f0ee396e308620";
// 实况天气
fetch(
`https://k2487qk85a.re.qweatherapi.com/v7/weather/now?location=${longitude},${latitude}&key=${key}`)
.then(res => res.json())
.then(data => {
if (data.code === '200') {
const now = data.now;
this.weather.temperature = now.temp;
this.weather.description = now.text;
this.setWeatherIconClass(now.text, now.icon);
this.getCityInfo(longitude, latitude, key);
}
});
// 7天天气预报
fetch(
`https://k2487qk85a.re.qweatherapi.com/v7/weather/7d?location=${longitude},${latitude}&key=${key}`)
.then(res => res.json())
.then(data => {
if (data.code === '200' && data.daily) {
this.weather.forecast = data.daily.slice(0, 7).map(item => ({
date: item.fxDate,
min: item.tempMin,
max: item.tempMax,
text: item.textDay,
windDir: item.windDirDay,
windScale: item.windScaleDay,
humidity: item.humidity,
sunrise: item.sunrise,
sunset: item.sunset,
vis: item.vis
}));
}
});
},
// 获取城市信息
getCityInfo(longitude, latitude, key) {
fetch(
`https://k2487qk85a.re.qweatherapi.com/geo/v2/city/lookup?location=${longitude},${latitude}&key=${key}`)
.then(res => res.json())
.then(data => {
console.log('城市信息结果:', data);
if (data.code === '200' && data.location && data.location.length > 0) {
const locationInfo = data.location[0];
this.weather.location = locationInfo.name || locationInfo.adm2 || locationInfo
.adm1;
} else {
this.weather.location = '未知位置';
this.$message.error('获取城市信息失败');
}
})
.catch(err => {
console.error('城市信息请求失败:', err);
this.weather.location = '未知位置';
this.$message.error('城市信息请求失败');
});
},
// 设置天气图标类
setWeatherIconClass(text, iconCode) {
if (text.includes('晴')) {
this.weather.iconClass = 'weather-sunny';
} else if (text.includes('多云') || text.includes('阴')) {
this.weather.iconClass = 'weather-cloudy';
} else if (text.includes('雨')) {
this.weather.iconClass = 'weather-rainy';
} else if (text.includes('雪')) {
this.weather.iconClass = 'weather-snowy';
} else if (text.includes('雾') || text.includes('霾')) {
this.weather.iconClass = 'weather-foggy';
} else {
// 根据和风天气的图标代码进行判断
const iconNumber = parseInt(iconCode);
if (iconNumber >= 100 && iconNumber <= 103) {
this.weather.iconClass = 'weather-sunny';
} else if (iconNumber >= 104 && iconNumber <= 104) {
this.weather.iconClass = 'weather-cloudy';
} else if (iconNumber >= 300 && iconNumber <= 399) {
this.weather.iconClass = 'weather-rainy';
} else if (iconNumber >= 400 && iconNumber <= 499) {
this.weather.iconClass = 'weather-snowy';
} else if (iconNumber >= 500 && iconNumber <= 599) {
this.weather.iconClass = 'weather-foggy';
} else {
this.weather.iconClass = 'weather-sunny'; // 默认
}
}
},
getWeatherEmoji(text) {
if (text.includes('晴')) return '☀️';
if (text.includes('多云')) return '⛅';
if (text.includes('阴')) return '☁️';
if (text.includes('雨')) return '🌧️';
if (text.includes('雪')) return '❄️';
if (text.includes('雾') || text.includes('霾')) return '🌫️';
if (text.includes('雷')) return '⛈️';
return '🌈';
},
// 天气预报相关方法
selectWeatherDay(index) {
this.selectedWeatherDay = index;
},
getDayName(date, index) {
const dayNames = ['今天', '明天', '后天'];
if (index < 3) {
return dayNames[index];
}
const dayOfWeek = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const dateObj = new Date(date);
return dayOfWeek[dateObj.getDay()];
},
getMonthDay(date) {
const dateObj = new Date(date);
return `${dateObj.getMonth() + 1}/${dateObj.getDate()}`;
},
getDetailDateTitle(date) {
const dateObj = new Date(date);
const today = new Date();
const diffTime = dateObj.getTime() - today.getTime();
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays === 0) return '今天';
if (diffDays === 1) return '明天';
if (diffDays === 2) return '后天';
const dayOfWeek = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return `${dateObj.getMonth() + 1}月${dateObj.getDate()}日 ${dayOfWeek[dateObj.getDay()]}`;
},
// 天气详情相关方法
refreshWeatherDetails() {
this.refreshing = true;
setTimeout(() => {
this.refreshing = false;
this.$message.success('天气信息已更新');
}, 1000);
},
getWeatherMetrics(weatherInfo) {
return [{
id: 'humidity',
label: '湿度',
value: weatherInfo.humidity + '%',
icon: 'el-icon-water',
color: '#3b82f6',
progress: parseInt(weatherInfo.humidity)
},
{
id: 'wind',
label: '风向风力',
value: `${weatherInfo.windDir} ${weatherInfo.windScale}级`,
icon: 'el-icon-position',
color: '#10b981',
progress: parseInt(weatherInfo.windScale) * 10
},
{
id: 'visibility',
label: '能见度',
value: (weatherInfo.vis || '15') + 'km',
icon: 'el-icon-view',
color: '#f59e0b',
progress: Math.min(parseInt(weatherInfo.vis || 15) * 5, 100)
},
{
id: 'sunrise',
label: '日出时间',
value: weatherInfo.sunrise,
icon: 'el-icon-sunrise',
color: '#f97316'
},
{
id: 'sunset',
label: '日落时间',
value: weatherInfo.sunset,
icon: 'el-icon-sunset',
color: '#8b5cf6'
},
/* {
id: 'uvindex',
label: '紫外线指数',
value: this.getRandomUVIndex(),
icon: 'el-icon-sunny',
color: '#ef4444',
progress: this.getRandomUVIndex() * 10
} */
];
},
getLifeTips(weatherInfo) {
const tips = [];
const temp = parseInt((parseInt(weatherInfo.min) + parseInt(weatherInfo.max)) / 2);
const humidity = parseInt(weatherInfo.humidity);
const isRainy = weatherInfo.text.includes('雨');
const isSunny = weatherInfo.text.includes('晴');
// 穿衣指数
let clothingLevel = '';
let clothingColor = '';
let clothingDesc = '';
if (temp >= 25) {
clothingLevel = 'comfortable';
clothingColor = '#10b981';
clothingDesc = '薄衣物,注意防晒';
} else if (temp >= 15) {
clothingLevel = 'moderate';
clothingColor = '#f59e0b';
clothingDesc = '长袖衣物较舒适';
} else {
clothingLevel = 'warm';
clothingColor = '#ef4444';
clothingDesc = '需要厚衣物保暖';
}
tips.push({
id: 'clothing',
name: '穿衣指数',
icon: 'el-icon-user',
level: clothingLevel,
levelText: temp >= 25 ? '薄衣' : temp >= 15 ? '适中' : '厚衣',
color: clothingColor,
description: clothingDesc
});
// 运动指数
let sportLevel = '';
let sportColor = '';
let sportDesc = '';
if (isRainy) {
sportLevel = 'poor';
sportColor = '#ef4444';
sportDesc = '不适宜户外运动';
} else if (isSunny && temp <= 30) {
sportLevel = 'excellent';
sportColor = '#10b981';
sportDesc = '适宜各种运动';
} else {
sportLevel = 'moderate';
sportColor = '#f59e0b';
sportDesc = '适度运动较好';
}
tips.push({
id: 'sport',
name: '运动指数',
icon: 'el-icon-bicycle',
level: sportLevel,
levelText: sportLevel === 'excellent' ? '优' : sportLevel === 'moderate' ? '良' : '差',
color: sportColor,
description: sportDesc
});
// 洗车指数
tips.push({
id: 'carwash',
name: '洗车指数',
icon: 'el-icon-truck',
level: isRainy ? 'poor' : 'good',
levelText: isRainy ? '不宜' : '适宜',
color: isRainy ? '#ef4444' : '#10b981',
description: isRainy ? '雨天不宜洗车' : '天气较好,适宜洗车'
});
// 紫外线指数
tips.push({
id: 'uv',
name: '紫外线',
icon: 'el-icon-sunny',
level: isSunny ? 'strong' : 'weak',
levelText: isSunny ? '强' : '弱',
color: isSunny ? '#ef4444' : '#10b981',
description: isSunny ? '注意防晒护肤' : '紫外线较弱'
});
return tips;
},
getWeatherAlerts(weatherInfo) {
const alerts = [];
const temp = parseInt((parseInt(weatherInfo.min) + parseInt(weatherInfo.max)) / 2);
const humidity = parseInt(weatherInfo.humidity);
const isRainy = weatherInfo.text.includes('雨');
const windScale = parseInt(weatherInfo.windScale);
// 基础提示
alerts.push({
id: 'basic',
type: 'info',
icon: 'el-icon-info',
message: `预计${this.getDetailDateTitle(weatherInfo.date)}气温${weatherInfo.min}°C~${weatherInfo.max}°C,${weatherInfo.text}。`
});
// 温度相关提示
if (temp >= 30) {
alerts.push({
id: 'hot',
type: 'warning',
icon: 'el-icon-warning',
message: '气温较高,外出请注意防暑降温,多补充水分。'
});
} else if (temp <= 5) {
alerts.push({
id: 'cold',
type: 'warning',
icon: 'el-icon-warning',
message: '气温较低,请注意保暖,预防感冒。'
});
}
// 降水提示
if (isRainy) {
alerts.push({
id: 'rain',
type: 'info',
icon: 'el-icon-umbrella',
message: '有降水,出行请携带雨具,注意交通安全。'
});
}
// 湿度提示
if (humidity >= 80) {
alerts.push({
id: 'humid',
type: 'success',
icon: 'el-icon-water',
message: '湿度较高,空气湿润,适合护肤但要注意通风。'
});
} else if (humidity <= 30) {
alerts.push({
id: 'dry',
type: 'warning',
icon: 'el-icon-warning',
message: '空气干燥,请注意补水,使用加湿器改善环境。'
});
}
// 风力提示
if (windScale >= 4) {
alerts.push({
id: 'windy',
type: 'warning',
icon: 'el-icon-position',
message: '风力较大,外出注意安全,避免高处作业。'
});
}
return alerts;
},
showTipDetail(tip) {
this.$message({
message: `${tip.name}:${tip.description}`,
type: tip.level === 'excellent' || tip.level === 'good' ? 'success' : tip.level ===
'moderate' || tip.level === 'comfortable' ? 'warning' : 'error',
duration: 3000
});
},
getCurrentMoonPhase() {
const phases = ['新月', '娥眉月', '上弦月', '盈凸月', '满月', '亏凸月', '下弦月', '残月'];
const today = new Date();
const phaseIndex = Math.floor((today.getDate() % 29.5) / 3.7);
return phases[phaseIndex] || '新月';
},
getRandomUVIndex() {
// 模拟紫外线指数 0-10
return Math.floor(Math.random() * 10) + 1;
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
index.html
|
HTML
|
unknown
| 41,113
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公共交通异常检测系统 - 用户登录</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/login.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<div class="login-container">
<!-- 左侧横幅 -->
<div class="login-banner">
<div class="banner-content">
<div class="logo-container">
<img :src="logoUrl" alt="公共交通异常检测系统" @error="handleLogoError">
</div>
<h1 class="banner-title">智行天下,安达万家</h1>
<p class="banner-subtitle">Smart Travel, Safe and Secure</p>
<ul class="banner-features">
<li>实时交通监控与预警</li>
<li>智能数据分析平台</li>
<li>全方位安全保障</li>
<li>高效运营管理</li>
</ul>
</div>
</div>
<!-- 右侧登录表单 -->
<div class="login-form">
<div class="form-header">
<h2 class="form-title">欢迎回来</h2>
<p class="form-subtitle">请登录您的账户以继续使用</p>
</div>
<div class="login-form-container">
<el-form :model="loginForm" :rules="loginRules" ref="loginForm"
@submit.native.prevent="handleLogin">
<!-- 用户名输入框 -->
<el-form-item prop="username" class="form-item">
<el-input v-model="loginForm.username" placeholder="请输入用户名" prefix-icon="el-icon-user"
clearable @keyup.enter.native="handleLogin" :disabled="loading">
</el-input>
</el-form-item>
<!-- 密码输入框 -->
<el-form-item prop="password" class="form-item">
<el-input v-model="loginForm.password" type="password" placeholder="请输入密码"
prefix-icon="el-icon-lock" show-password clearable @keyup.enter.native="handleLogin"
:disabled="loading">
</el-input>
</el-form-item>
<!-- 登录选项 -->
<div class="login-options">
<label class="custom-checkbox remember-me">
<input type="checkbox" v-model="rememberMe" :disabled="loading">
<span class="checkmark"></span>
记住用户名
</label>
<a href="#" class="forgot-password" @click.prevent="handleForgotPassword">忘记密码?</a>
</div>
<!-- 登录按钮 -->
<el-button type="primary" class="login-button" :loading="loading" :disabled="!isFormValid"
@click="handleLogin">
{{ loading ? loadingText : '登录' }}
</el-button>
</el-form>
<!-- 其他操作 -->
<div class="other-actions">
<div class="register-row">
<span>还没有账户?</span>
<a href="#" @click.prevent="handleRegister">立即注册</a>
</div>
</div>
</div>
<!-- 版权信息 -->
<div class="copyright">
© {{ currentYear }} 公共交通异常检测系统 · 重庆市北碚区西南大学
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
// 自定义验证函数
const validateUsername = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入用户名'));
} else if (value.length < 3) {
callback(new Error('用户名至少3个字符'));
} else if (value.length > 20) {
callback(new Error('用户名不能超过20个字符'));
} else {
callback();
}
};
const validatePassword = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入密码'));
} else if (value.length < 6) {
callback(new Error('密码至少6个字符'));
} else if (value.length > 50) {
callback(new Error('密码不能超过50个字符'));
} else {
callback();
}
};
return {
// 表单数据
loginForm: {
username: '',
password: ''
},
// 表单验证规则
loginRules: {
username: [{
validator: validateUsername,
trigger: 'blur'
}],
password: [{
validator: validatePassword,
trigger: 'blur'
}]
},
// 状态管理
loading: false,
loadingText: '登录中...',
rememberMe: false,
// Logo路径
logoUrl: './img/logo_nobackground.png',
// 当前年份
currentYear: new Date().getFullYear(),
// 预设账户用于演示
demoAccounts: [
{
username: 'admin',
password: '123456',
role: '管理员'
},
{
username: 'user',
password: '123456',
role: '普通用户'
},
{
username: 'nzp123456',
password: 'nzp123123',
role: '普通用户'
},
{
username: 'ts123456',
password: 'ts123123',
role: '普通用户'
}
]
}
},
computed: {
isFormValid() {
return this.loginForm.username.length >= 3 &&
this.loginForm.password.length >= 6;
}
},
mounted() {
this.initPage();
},
methods: {
// 页面初始化
initPage() {
// 检查是否记住了用户名
const savedUsername = localStorage.getItem('rememberedUsername');
if (savedUsername) {
this.loginForm.username = savedUsername;
this.rememberMe = true;
}
},
// 处理登录
async handleLogin() {
// 表单验证
const valid = await this.validateForm();
if (!valid) return;
this.loading = true;
this.loadingText = '验证中...';
try {
// 模拟登录请求
const result = await this.performLogin();
if (result.success) {
this.loadingText = '登录成功,正在跳转...';
// 保存登录状态
this.saveLoginState(result.data);
// 显示成功消息
this.$message.success(`欢迎回来,${result.data.username}!`);
// 延迟跳转到主页
setTimeout(() => {
window.location.href = './index.html';
}, 1500);
} else {
this.loading = false;
this.$message.error(result.message || '登录失败,请检查用户名和密码');
}
} catch (error) {
this.loading = false;
this.$message.error('登录过程中发生错误,请稍后重试');
console.error('Login error:', error);
}
},
// 表单验证
validateForm() {
return new Promise((resolve) => {
this.$refs.loginForm.validate((valid) => {
if (!valid) {
this.$message.error('请检查表单输入');
}
resolve(valid);
});
});
},
// 执行登录逻辑
performLogin() {
return new Promise((resolve) => {
// 模拟网络延迟
setTimeout(() => {
const {
username,
password
} = this.loginForm;
// 检查预设账户
const account = this.demoAccounts.find(acc =>
acc.username === username && acc.password === password
);
if (account) {
resolve({
success: true,
data: {
username: account.username,
role: account.role,
token: this.generateToken(),
loginTime: new Date().toISOString()
}
});
} else {
resolve({
success: false,
message: '用户名或密码错误'
});
}
}, 1000 + Math.random() * 1000); // 1-2秒随机延迟
});
},
// 保存登录状态
saveLoginState(userData) {
// 保存认证令牌
localStorage.setItem('authToken', userData.token);
localStorage.setItem('userInfo', JSON.stringify(userData));
localStorage.setItem('loginTime', userData.loginTime);
// 处理记住用户名
if (this.rememberMe) {
localStorage.setItem('rememberedUsername', userData.username);
} else {
localStorage.removeItem('rememberedUsername');
}
},
// 生成模拟令牌
generateToken() {
return 'token_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
},
// 处理忘记密码
handleForgotPassword() {
this.$alert('请联系系统管理员重置密码<br>邮箱:admin@zhiyuanxing.com<br>电话:023-1234567', '忘记密码', {
dangerouslyUseHTMLString: true,
confirmButtonText: '我知道了'
});
},
// 处理注册
handleRegister() {
this.$message.info('注册功能开发中,请联系管理员开通账户');
},
// 处理Logo加载错误
handleLogoError() {
console.warn('Logo image failed to load');
// 可以设置一个默认的logo或者隐藏logo容器。.
this.logoUrl =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDEyMCAxMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiBmaWxsPSIjNjY3ZWVhIiByeD0iMTAiLz4KPHN2ZyB4PSIzMCIgeT0iMzAiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0xMiAyTDIgN2wzIDlsMCE0IDEyIDIxIDEyIDJabTAgMkw0IDhsMS40IDQuMkwxMiAxMGw2LjYgMi4yTDIwIDhMMTIgNFoiLz4KPC9zdmc+Cjwvc3ZnPgo=';
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
login.html
|
HTML
|
unknown
| 9,973
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公共交通异常检测系统 - 系统管理</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/system-management.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>系统管理</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>系统管理</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button-group>
<el-button type="primary" @click="saveSettings">
<i class="el-icon-check"></i> 保存设置
</el-button>
<el-button type="success" @click="backupSystem">
<i class="el-icon-upload2"></i> 系统备份
</el-button>
</el-button-group>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 功能导航 -->
<div class="function-nav">
<el-tabs v-model="activeTab" @tab-click="handleTabClick">
<el-tab-pane label="用户管理" name="users">
<template slot="label">
<i class="el-icon-user"></i> 用户管理
</template>
</el-tab-pane>
<el-tab-pane label="角色权限" name="roles">
<template slot="label">
<i class="el-icon-lock"></i> 角色权限
</template>
</el-tab-pane>
<el-tab-pane label="系统配置" name="settings">
<template slot="label">
<i class="el-icon-setting"></i> 系统配置
</template>
</el-tab-pane>
<el-tab-pane label="日志管理" name="logs">
<template slot="label">
<i class="el-icon-document"></i> 日志管理
</template>
</el-tab-pane>
</el-tabs>
</div>
<!-- 用户管理 -->
<div v-show="activeTab === 'users'" class="tab-content">
<div class="content-header">
<div class="search-box">
<el-input
placeholder="搜索用户"
v-model="userSearchQuery"
prefix-icon="el-icon-search"
clearable>
</el-input>
</div>
<el-button type="primary" @click="addUser">
<i class="el-icon-plus"></i> 添加用户
</el-button>
</div>
<el-table :data="userList" style="width: 100%">
<el-table-column prop="username" label="用户名" width="120"></el-table-column>
<el-table-column prop="realName" label="姓名" width="120"></el-table-column>
<el-table-column prop="role" label="角色" width="120"></el-table-column>
<el-table-column prop="department" label="部门" width="150"></el-table-column>
<el-table-column prop="email" label="邮箱" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.status === '启用' ? 'success' : 'danger'">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" @click="editUser(scope.row)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" class="delete-btn" @click="deleteUser(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleUserSizeChange"
@current-change="handleUserCurrentChange"
:current-page="userCurrentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="userPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="userTotal">
</el-pagination>
</div>
</div>
<!-- 角色权限 -->
<div v-show="activeTab === 'roles'" class="tab-content">
<div class="content-header">
<el-button type="primary" @click="addRole">
<i class="el-icon-plus"></i> 添加角色
</el-button>
</div>
<div class="role-list">
<el-card v-for="role in roleList" :key="role.id" class="role-card">
<div class="role-header">
<h3>{{ role.name }}</h3>
<div class="role-actions">
<el-button type="text" @click="editRole(role)">编辑</el-button>
<el-button type="text" class="delete-btn" @click="deleteRole(role)">删除</el-button>
</div>
</div>
<div class="role-description">{{ role.description }}</div>
<div class="role-permissions">
<el-tag v-for="perm in role.permissions" :key="perm" size="small" class="permission-tag">
{{ perm }}
</el-tag>
</div>
</el-card>
</div>
</div>
<!-- 系统配置 -->
<div v-show="activeTab === 'settings'" class="tab-content">
<el-form :model="systemSettings" label-width="120px" class="settings-form">
<el-card class="settings-card">
<div slot="header">
<span>基本设置</span>
</div>
<el-form-item label="系统名称">
<el-input v-model="systemName"></el-input>
</el-form-item>
<el-form-item label="系统Logo">
<el-upload
class="logo-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeLogoUpload">
<img v-if="systemSettings.logo" :src="systemSettings.logo" class="logo">
<i v-else class="el-icon-plus logo-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="系统主题">
<el-radio-group v-model="systemSettings.theme">
<el-radio label="light">浅色</el-radio>
<el-radio label="dark">深色</el-radio>
<el-radio label="auto">跟随系统</el-radio>
</el-radio-group>
</el-form-item>
</el-card>
<el-card class="settings-card">
<div slot="header">
<span>安全设置</span>
</div>
<el-form-item label="密码策略">
<el-checkbox-group v-model="systemSettings.passwordPolicy">
<el-checkbox label="uppercase">必须包含大写字母</el-checkbox>
<el-checkbox label="lowercase">必须包含小写字母</el-checkbox>
<el-checkbox label="number">必须包含数字</el-checkbox>
<el-checkbox label="special">必须包含特殊字符</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="密码有效期">
<el-input-number v-model="systemSettings.passwordExpiry" :min="30" :max="365"></el-input-number>
<span class="unit">天</span>
</el-form-item>
<el-form-item label="登录失败锁定">
<el-input-number v-model="systemSettings.loginAttempts" :min="3" :max="10"></el-input-number>
<span class="unit">次</span>
</el-form-item>
</el-card>
<el-card class="settings-card">
<div slot="header">
<span>通知设置</span>
</div>
<el-form-item label="邮件通知">
<el-switch v-model="systemSettings.emailNotification"></el-switch>
</el-form-item>
<el-form-item label="短信通知">
<el-switch v-model="systemSettings.smsNotification"></el-switch>
</el-form-item>
<el-form-item label="系统通知">
<el-switch v-model="systemSettings.systemNotification"></el-switch>
</el-form-item>
</el-card>
</el-form>
</div>
<!-- 日志管理 -->
<div v-show="activeTab === 'logs'" class="tab-content">
<div class="content-header">
<div class="search-box">
<el-input
placeholder="搜索日志"
v-model="logSearchQuery"
prefix-icon="el-icon-search"
clearable>
</el-input>
</div>
<el-button-group>
<el-button type="primary" @click="exportLogs">
<i class="el-icon-download"></i> 导出日志
</el-button>
<el-button type="danger" @click="clearLogs">
<i class="el-icon-delete"></i> 清空日志
</el-button>
</el-button-group>
</div>
<el-table :data="logList" style="width: 100%">
<el-table-column prop="timestamp" label="时间" width="180"></el-table-column>
<el-table-column prop="level" label="级别" width="100">
<template slot-scope="scope">
<el-tag :type="getLogLevelType(scope.row.level)">
{{ scope.row.level }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="user" label="用户" width="120"></el-table-column>
<el-table-column prop="action" label="操作" width="150"></el-table-column>
<el-table-column prop="description" label="描述"></el-table-column>
<el-table-column prop="ip" label="IP地址" width="140"></el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleLogSizeChange"
@current-change="handleLogCurrentChange"
:current-page="logCurrentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="logPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="logTotal">
</el-pagination>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 当前激活的标签页
activeTab: 'users',
// 用户管理
userSearchQuery: '',
userList: [
{
username: 'admin',
realName: '管理员',
role: '超级管理员',
department: '系统部',
email: 'admin@example.com',
status: '启用'
},
{
username: 'user1',
realName: '张三',
role: '普通用户',
department: '运营部',
email: 'user1@example.com',
status: '启用'
}
],
userCurrentPage: 1,
userPageSize: 10,
userTotal: 0,
// 角色权限
roleList: [
{
id: 1,
name: '超级管理员',
description: '系统最高权限,可以管理所有功能',
permissions: ['用户管理', '角色管理', '系统配置', '日志查看']
},
{
id: 2,
name: '普通用户',
description: '基础功能使用权限',
permissions: ['数据查看', '报表导出']
}
],
// 系统配置
systemSettings: {
systemName: '公共交通异常检测系统',
logo: '',
theme: 'light',
passwordPolicy: ['uppercase', 'number'],
passwordExpiry: 90,
loginAttempts: 5,
emailNotification: true,
smsNotification: false,
systemNotification: true
},
// 日志管理
logSearchQuery: '',
logList: [
{
timestamp: '2024-03-20 10:00:00',
level: 'INFO',
user: 'admin',
action: '登录系统',
description: '用户登录成功',
ip: '192.168.1.1'
},
{
timestamp: '2024-03-20 10:05:00',
level: 'WARNING',
user: 'user1',
action: '修改配置',
description: '尝试修改系统配置',
ip: '192.168.1.2'
}
],
logCurrentPage: 1,
logPageSize: 10,
logTotal: 0
}
},
methods: {
// 标签页切换
handleTabClick(tab) {
this.activeTab = tab.name;
},
// 保存设置
saveSettings() {
this.$message.success('系统设置保存成功');
},
// 系统备份
backupSystem() {
this.$message.success('系统备份开始...');
},
// 用户管理
addUser() {
this.$message.info('添加用户功能开发中...');
},
editUser(user) {
this.$message.info(`编辑用户:${user.username}`);
},
resetPassword(user) {
this.$confirm(`确定要重置用户"${user.username}"的密码吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('密码重置成功');
});
},
deleteUser(user) {
this.$confirm(`确定要删除用户"${user.username}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('用户删除成功');
});
},
handleUserSizeChange(val) {
this.userPageSize = val;
},
handleUserCurrentChange(val) {
this.userCurrentPage = val;
},
// 角色管理
addRole() {
this.$message.info('添加角色功能开发中...');
},
editRole(role) {
this.$message.info(`编辑角色:${role.name}`);
},
deleteRole(role) {
this.$confirm(`确定要删除角色"${role.name}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('角色删除成功');
});
},
// 系统配置
beforeLogoUpload(file) {
const isImage = file.type.startsWith('image/');
if (!isImage) {
this.$message.error('只能上传图片文件!');
return false;
}
return false; // 阻止自动上传
},
// 日志管理
exportLogs() {
this.$message.success('日志导出中...');
},
clearLogs() {
this.$confirm('确定要清空所有日志吗?此操作不可恢复!', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('日志清空成功');
});
},
getLogLevelType(level) {
const typeMap = {
'INFO': 'info',
'WARNING': 'warning',
'ERROR': 'danger'
};
return typeMap[level] || 'info';
},
handleLogSizeChange(val) {
this.logPageSize = val;
},
handleLogCurrentChange(val) {
this.logCurrentPage = val;
}
},
mounted() {
// 初始化数据
this.userTotal = this.userList.length;
this.logTotal = this.logList.length;
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
system-management.html
|
HTML
|
unknown
| 14,574
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
system.html
|
HTML
|
unknown
| 107
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公共交通异常检测系统 - 预警管理</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./css/traffic-alert.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<div class="admin-layout" v-show="!loading">
<!-- 顶部导航栏 -->
<header class="admin-header">
<div class="header-left">
<div class="logo-section">
<img src="./img/logo_nobackground.png" alt="公共交通异常检测系统" class="header-logo">
<h1 class="system-title">公共交通异常检测系统</h1>
</div>
<div class="breadcrumb-section">
<el-breadcrumb separator="/">
<el-breadcrumb-item>交通监控</el-breadcrumb-item>
<el-breadcrumb-item>预警管理</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
<div class="header-right">
<el-badge :value="notificationCount" class="notification-badge">
<el-button type="text" @click="showNotifications">
<i class="el-icon-bell"></i>
</el-button>
</el-badge>
<el-dropdown @command="handleUserCommand" class="user-dropdown">
<div class="user-info">
<el-avatar :size="32" :src="userAvatar" icon="el-icon-user-solid"></el-avatar>
<span class="username">{{ username }}</span>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">
<i class="el-icon-user"></i> 个人信息
</el-dropdown-item>
<el-dropdown-item command="settings">
<i class="el-icon-setting"></i> 系统设置
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<i class="el-icon-switch-button"></i> 退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
<!-- 主内容区 -->
<div class="admin-main">
<!-- 侧边导航 -->
<aside class="admin-sidebar" :class="{ 'collapsed': sidebarCollapsed }">
<div class="sidebar-toggle" @click="toggleSidebar">
<i :class="sidebarCollapsed ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<el-menu :default-active="activeMenu" :collapse="sidebarCollapsed" @select="handleMenuSelect"
class="sidebar-menu">
<el-menu-item index="dashboard">
<i class="el-icon-data-board"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="traffic">
<template slot="title">
<i class="el-icon-location"></i>
<span>交通监控</span>
</template>
<el-menu-item index="traffic-monitor">实时监控</el-menu-item>
<el-menu-item index="traffic-analysis">数据分析</el-menu-item>
<el-menu-item index="traffic-alert">预警管理</el-menu-item>
</el-submenu>
<el-submenu index="vehicle">
<template slot="title">
<i class="el-icon-truck"></i>
<span>车辆管理</span>
</template>
<el-menu-item index="vehicle-list">车辆列表</el-menu-item>
<el-menu-item index="vehicle-tracking">车辆追踪</el-menu-item>
<el-menu-item index="vehicle-maintenance">维护记录</el-menu-item>
</el-submenu>
<el-submenu index="data">
<template slot="title">
<i class="el-icon-pie-chart"></i>
<span>数据统计</span>
</template>
<el-menu-item index="data-overview">数据概览</el-menu-item>
<el-menu-item index="data-report">报表生成</el-menu-item>
<el-menu-item index="data-export">数据导出</el-menu-item>
</el-submenu>
<el-menu-item index="system">
<i class="el-icon-setting"></i>
<span slot="title">系统管理</span>
</el-menu-item>
</el-menu>
</aside>
<!-- 预警管理内容 -->
<div class="alert-container">
<!-- 预警概览卡片 -->
<div class="alert-overview">
<el-row :gutter="20">
<el-col :span="6">
<div class="alert-stat-card">
<div class="stat-icon warning">
<i class="el-icon-warning"></i>
</div>
<div class="stat-info">
<h3>{{ stats.pending }}</h3>
<p>待处理预警</p>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="alert-stat-card">
<div class="stat-icon processing">
<i class="el-icon-loading"></i>
</div>
<div class="stat-info">
<h3>{{ stats.processing }}</h3>
<p>处理中</p>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="alert-stat-card">
<div class="stat-icon success">
<i class="el-icon-success"></i>
</div>
<div class="stat-info">
<h3>{{ stats.resolved }}</h3>
<p>已解决</p>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="alert-stat-card">
<div class="stat-icon info">
<i class="el-icon-data-line"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total }}</h3>
<p>总计预警</p>
</div>
</div>
</el-col>
</el-row>
</div>
<!-- 预警管理工具栏 -->
<div class="alert-toolbar">
<div class="toolbar-left">
<el-button type="primary" @click="createAlert">
<i class="el-icon-plus"></i> 新建预警
</el-button>
<el-button type="success" @click="exportAlerts">
<i class="el-icon-download"></i> 导出数据
</el-button>
</div>
<div class="toolbar-right">
<el-input
placeholder="搜索预警信息"
v-model="searchQuery"
prefix-icon="el-icon-search"
clearable
@clear="handleSearchClear"
class="search-input">
</el-input>
<el-select v-model="filterStatus" placeholder="状态筛选" clearable>
<el-option label="待处理" value="pending"></el-option>
<el-option label="处理中" value="processing"></el-option>
<el-option label="已解决" value="resolved"></el-option>
</el-select>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd">
</el-date-picker>
</div>
</div>
<!-- 预警列表 -->
<div class="alert-list">
<el-table
:data="alertList"
style="width: 100%"
:header-cell-style="{ background: '#f5f7fa' }"
v-loading="tableLoading">
<el-table-column prop="level" label="预警等级" width="120">
<template slot-scope="scope">
<el-tag :type="getAlertLevelTag(scope.row.level)">
{{ scope.row.level }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="vehicleInfo" label="车辆信息" width="150"></el-table-column>
<el-table-column prop="abnormal" label="异常情况" width="250"></el-table-column>
<el-table-column prop="location" label="位置信息" width="250"></el-table-column>
<el-table-column prop="status" label="状态" width="120">
<template slot-scope="scope">
<el-tag :type="getStatusTag(scope.row.status)">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="200"></el-table-column>
<el-table-column label="操作" min-width="180">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="handleEdit(scope.row)">处理</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</div>
</div>
<!-- 预警处理对话框 -->
<el-dialog
:title="dialogTitle"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleDialogClose">
<el-form :model="alertForm" :rules="alertRules" ref="alertForm" label-width="100px">
<el-form-item label="预警类型" prop="type">
<el-select v-model="alertForm.type" placeholder="请选择预警类型">
<el-option label="交通拥堵" value="congestion"></el-option>
<el-option label="事故" value="accident"></el-option>
<el-option label="天气" value="weather"></el-option>
<el-option label="设备故障" value="device"></el-option>
</el-select>
</el-form-item>
<el-form-item label="位置信息" prop="location">
<el-input v-model="alertForm.location" placeholder="请输入位置信息"></el-input>
</el-form-item>
<el-form-item label="预警描述" prop="description">
<el-input type="textarea" v-model="alertForm.description" rows="4" placeholder="请输入预警描述"></el-input>
</el-form-item>
<el-form-item label="处理状态" prop="status">
<el-select v-model="alertForm.status" placeholder="请选择处理状态">
<el-option label="待处理" value="pending"></el-option>
<el-option label="处理中" value="processing"></el-option>
<el-option label="已解决" value="resolved"></el-option>
</el-select>
</el-form-item>
<el-form-item label="处理备注" prop="remark">
<el-input type="textarea" v-model="alertForm.remark" rows="3" placeholder="请输入处理备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitAlert">确 定</el-button>
</span>
</el-dialog>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 加载状态
loading: true,
loadingText: '正在加载预警管理系统...',
tableLoading: false,
// 侧边栏状态
sidebarCollapsed: false,
activeMenu: 'traffic-alert',
// 用户信息
username: '管理员',
userAvatar: './img/myphoto2.jpg',
notificationCount: 3,
// 统计数据
stats: {
pending: 15,
processing: 8,
resolved: 45,
total: 68
},
// 搜索和筛选
searchQuery: '',
filterStatus: '',
dateRange: '',
// 表格数据
alertList: [
{
level: '一般',
vehicleInfo: '105路公交车',
abnormal: '疲劳驾驶预警',
location: '大学城美院-区门诊',
status: '待处理',
createTime: '2025-05-28 10:32:26',
driver: '张师傅',
plateNumber: '渝BW2273'
},
{
level: '一般',
vehicleInfo: '132路公交车',
abnormal: '运行正常',
location: '重庆市北碚区天生路',
status: '已解决',
createTime: '2025-05-28 09:15:26',
driver: '龚师傅',
plateNumber: '渝BW7542'
},
{
level: '一般',
vehicleInfo: '曹操出行网约车1',
abnormal: '运行正常',
location: '重庆市北碚区英华路',
status: '已解决',
createTime: '2025-05-28 08:45:41',
driver: '王师傅',
plateNumber: '渝CB9125'
},
{
level: '一般',
vehicleInfo: '滴滴出行网约车1',
abnormal: '运行正常',
location: '重庆市北碚区龙凤大道',
status: '已解决',
createTime: '2025-05-28 08:15:25',
driver: '杨师傅',
plateNumber: '渝A2057M'
},
{
level: '紧急',
vehicleInfo: '滴滴出行网约车014',
abnormal: '乘客身体状况疑似异常',
location: '重庆市北碚区学宛路',
status: '已解决',
createTime: '2025-04-27 14:11:25'
},
{
level: '一般',
vehicleInfo: '公交009',
abnormal: '乘客疑似发生争吵',
location: '重庆市北碚区融会中路',
status: '已解决',
createTime: '2025-04-22 21:15:57'
},
{
level: '一般',
vehicleInfo: '公交074',
abnormal: '司机疑似疲劳驾驶',
location: '重庆市北碚区龙凤大道',
status: '已解决',
createTime: '2025-04-15 20:58:10'
},
{
level: '一般',
vehicleInfo: '公交105',
abnormal: '乘客疑似发生争吵',
location: '重庆市北碚区北泉路',
status: '已解决',
createTime: '2025-04-02 18:28:40'
}
],
currentPage: 1,
pageSize: 10,
total: 0,
// 对话框
dialogVisible: false,
dialogTitle: '新建预警',
alertForm: {
type: '',
location: '',
description: '',
status: '',
remark: ''
},
alertRules: {
type: [{ required: true, message: '请选择预警类型', trigger: 'change' }],
location: [{ required: true, message: '请输入位置信息', trigger: 'blur' }],
description: [{ required: true, message: '请输入预警描述', trigger: 'blur' }],
status: [{ required: true, message: '请选择处理状态', trigger: 'change' }]
}
};
},
mounted() {
this.initSystem();
},
methods: {
// 系统初始化
async initSystem() {
try {
await this.simulateLoading();
this.loading = false;
this.fetchAlertList();
} catch (error) {
console.error('System initialization error:', error);
this.$message.error('系统初始化失败');
}
},
// 模拟加载过程
simulateLoading() {
return new Promise(resolve => {
setTimeout(resolve, 1500);
});
},
// 获取预警列表
fetchAlertList() {
this.tableLoading = true;
// 模拟API调用
setTimeout(() => {
this.alertList = [
{
level: '一般',
vehicleInfo: '公交072',
abnormal: '司机疑似疲劳驾驶',
location: '重庆市北碚区奔月路',
status: '待处理',
createTime: '2025-05-12 15:28:26'
},
{
level: '一般',
vehicleInfo: '公交048',
abnormal: '乘客疑似发生争吵',
location: '重庆市北碚区天生路',
status: '处理中',
createTime: '2025-05-11 10:47:14'
},
{
level: '一般',
vehicleInfo: '曹操出行网约车002',
abnormal: '司机疑似疲劳驾驶',
location: '重庆市北碚区天生路',
status: '已解决',
createTime: '2025-05-02 08:45:41'
},
{
level: '紧急',
vehicleInfo: '滴滴出行网约车014',
abnormal: '乘客身体状况疑似异常',
location: '重庆市北碚区学宛路',
status: '已解决',
createTime: '2025-04-27 14:11:25'
},
{
level: '一般',
vehicleInfo: '公交009',
abnormal: '乘客疑似发生争吵',
location: '重庆市北碚区融会中路',
status: '已解决',
createTime: '2025-04-22 21:15:57'
},
{
level: '一般',
vehicleInfo: '公交074',
abnormal: '司机疑似疲劳驾驶',
location: '重庆市北碚区龙凤大道',
status: '已解决',
createTime: '2025-04-15 20:58:10'
},
{
level: '一般',
vehicleInfo: '公交105',
abnormal: '乘客疑似发生争吵',
location: '重庆市北碚区北泉路',
status: '已解决',
createTime: '2025-04-02 18:28:40'
}
];
this.total = this.alertList.length;
this.tableLoading = false;
}, 1000);
},
// 状态标签样式
getStatusTag(status) {
const tags = {
'待处理': 'warning',
'处理中': 'primary',
'已解决': 'success'
};
return tags[status] || 'info';
},
// 获取预警类型标签样式
getAlertTypeTag(type) {
const tags = {
'交通拥堵': 'warning',
'事故': 'danger',
'天气': 'info'
};
return tags[type] || 'info';
},
// 获取预警等级标签样式
getAlertLevelTag(level) {
const tags = {
'紧急': 'danger',
'一般': 'warning'
};
return tags[level] || 'info';
},
// 创建预警
createAlert() {
this.dialogTitle = '新建预警';
this.alertForm = {
type: '',
location: '',
description: '',
status: 'pending',
remark: ''
};
this.dialogVisible = true;
},
// 编辑预警
handleEdit(row) {
this.dialogTitle = '处理预警';
this.alertForm = { ...row };
this.dialogVisible = true;
},
// 删除预警
handleDelete(row) {
this.$confirm('确认删除该预警记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.$message.success('删除成功');
this.fetchAlertList();
}).catch(() => {});
},
// 提交预警表单
submitAlert() {
this.$refs.alertForm.validate((valid) => {
if (valid) {
this.$message.success('操作成功');
this.dialogVisible = false;
this.fetchAlertList();
}
});
},
// 导出数据
exportAlerts() {
this.$message.success('数据导出中...');
},
// 分页处理
handleSizeChange(val) {
this.pageSize = val;
this.fetchAlertList();
},
handleCurrentChange(val) {
this.currentPage = val;
this.fetchAlertList();
},
// 搜索处理
handleSearchClear() {
this.fetchAlertList();
},
// 对话框关闭处理
handleDialogClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
// 用户相关操作
showNotifications() {
this.$message.info('通知功能开发中');
},
handleUserCommand(command) {
switch (command) {
case 'profile':
this.$message.info('个人信息功能开发中');
break;
case 'settings':
this.$message.info('系统设置功能开发中');
break;
case 'logout':
this.$confirm('确定要退出登录吗?', '提示', {
type: 'warning'
}).then(() => {
window.location.href = './login.html';
});
break;
}
},
// 侧边栏切换
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
// 菜单选择处理
handleMenuSelect(index) {
// 页面跳转映射配置
const pageRoutes = {
'dashboard': './index.html',
'traffic-monitor': './traffic-monitor.html',
'traffic-analysis': './traffic-analysis.html',
'traffic-alert': './traffic-alert.html',
'vehicle-list': './vehicle-list.html',
'vehicle-tracking': './vehicle-tracking.html',
'vehicle-maintenance': './vehicle-maintenance.html',
'data-overview': './data-overview.html',
'data-report': './data-report.html',
'data-export': './data-export.html',
'system': './system-management.html'
};
if (pageRoutes[index]) {
window.location.href = pageRoutes[index];
}
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
traffic-alert.html
|
HTML
|
unknown
| 24,276
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>交通数据分析 - 公共交通异常检测系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/traffic-analysis.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
<style>
/* 在head标签内添加样式 */
.analysis-container {
padding: 0 24px;
}
.analysis-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
margin: 24px 0;
}
.analysis-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
padding: 15px;
height: 320px;
display: flex;
flex-direction: column;
}
.analysis-header {
background: #fff;
border-radius: 8px;
padding: 20px 24px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
}
.data-table-section {
background: #fff;
border-radius: 8px;
padding: 20px 24px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
height: 20px;
}
.card-title {
font-size: 16px;
color: #333;
margin: 0;
}
.chart-container {
width: 100%;
flex: 1;
min-height: 220px; /* 调整为适中的最小高度 */
margin-bottom: 0;
}
.chart-legend {
margin-top: 0; /* 移除顶部边距 */
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
padding: 4px 5px;
font-size: 11px;
line-height: 1.3;
background-color: #f8f9fa;
border-radius: 4px;
position: relative; /* 添加相对定位 */
top: -5px; /* 向上移动 */
}
.legend-item {
display: flex;
align-items: center;
color: #666;
min-width: 60px;
padding: 2px 0; /* 增加上下内边距 */
}
.legend-color {
width: 8px; /* 减小图例颜色块大小 */
height: 8px;
border-radius: 2px;
margin-right: 4px; /* 减小右边距 */
}
.comparison-card {
display: flex;
align-items: center;
padding: 8px 12px;
background: #f8f9fa;
border-radius: 6px;
margin-top: -20px; /* 增加负边距使其更往上移 */
position: relative;
z-index: 1;
}
.comparison-icon {
font-size: 20px;
color: #409EFF;
margin-right: 12px;
}
.comparison-data {
flex: 1;
}
.comparison-value {
font-size: 20px;
font-weight: bold;
color: #409EFF;
line-height: 1.2;
}
.comparison-label {
font-size: 12px;
color: #666;
margin-top: 2px;
}
@media (max-width: 1200px) {
.analysis-grid {
grid-template-columns: repeat(2, 1fr);
padding: 0 15px;
}
}
@media (max-width: 768px) {
.analysis-grid {
grid-template-columns: 1fr;
padding: 0 10px;
}
}
</style>
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<!-- 主框架 -->
<div class="admin-layout" v-show="!loading">
<!-- 顶部导航栏 -->
<header class="admin-header">
<div class="header-left">
<div class="logo-section">
<img :src="logoUrl" alt="公共交通异常检测系统" class="header-logo" @error="handleLogoError">
<h1 class="system-title">公共交通异常检测系统</h1>
</div>
<div class="breadcrumb-section">
<el-breadcrumb separator="/">
<el-breadcrumb-item>交通监控</el-breadcrumb-item>
<el-breadcrumb-item>数据分析</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
<div class="header-right">
<el-badge :value="notificationCount" class="notification-badge">
<el-button type="text" @click="showNotifications">
<i class="el-icon-bell"></i>
</el-button>
</el-badge>
<el-dropdown @command="handleUserCommand" class="user-dropdown">
<div class="user-info">
<el-avatar :size="32" :src="userInfo.avatar" icon="el-icon-user-solid"></el-avatar>
<span class="username">{{ userInfo.username }}</span>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">
<i class="el-icon-user"></i> 个人信息
</el-dropdown-item>
<el-dropdown-item command="settings">
<i class="el-icon-setting"></i> 系统设置
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<i class="el-icon-switch-button"></i> 退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
<!-- 主内容区 -->
<div class="admin-main">
<!-- 侧边导航 -->
<aside class="admin-sidebar" :class="{ 'collapsed': sidebarCollapsed }">
<div class="sidebar-toggle" @click="toggleSidebar">
<i :class="sidebarCollapsed ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<el-menu :default-active="activeMenu" :collapse="sidebarCollapsed" @select="handleMenuSelect"
:default-openeds="['traffic']" class="sidebar-menu">
<el-menu-item index="dashboard">
<i class="el-icon-data-board"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="traffic">
<template slot="title">
<i class="el-icon-location"></i>
<span>交通监控</span>
</template>
<el-menu-item index="traffic-monitor">实时监控</el-menu-item>
<el-menu-item index="traffic-analysis">数据分析</el-menu-item>
<el-menu-item index="traffic-alert">预警管理</el-menu-item>
</el-submenu>
<el-submenu index="vehicle">
<template slot="title">
<i class="el-icon-truck"></i>
<span>车辆管理</span>
</template>
<el-menu-item index="vehicle-list">车辆列表</el-menu-item>
<el-menu-item index="vehicle-tracking">车辆追踪</el-menu-item>
<el-menu-item index="vehicle-maintenance">维护记录</el-menu-item>
</el-submenu>
<el-submenu index="data">
<template slot="title">
<i class="el-icon-pie-chart"></i>
<span>数据统计</span>
</template>
<el-menu-item index="data-overview">数据概览</el-menu-item>
<el-menu-item index="data-report">报表生成</el-menu-item>
<el-menu-item index="data-export">数据导出</el-menu-item>
</el-submenu>
<el-menu-item index="system">
<i class="el-icon-setting"></i>
<span slot="title">系统管理</span>
</el-menu-item>
</el-menu>
</aside>
<!-- 分析内容区域 -->
<main class="admin-content">
<div class="analysis-container">
<!-- 分析头部 -->
<div class="analysis-header">
<h2 class="header-title">公共交通异常检测分析</h2>
<div class="filter-section">
<el-select v-model="selectedVehicleType" placeholder="车辆类型">
<el-option v-for="type in vehicleTypes" :key="type.value" :label="type.label"
:value="type.value">
</el-option>
</el-select>
<el-select v-model="selectedEventType" placeholder="异常类型">
<el-option v-for="type in eventTypes" :key="type.value" :label="type.label"
:value="type.value">
</el-option>
</el-select>
<el-select v-model="selectedTimeRange" placeholder="时间范围">
<el-option v-for="range in timeRanges" :key="range.value" :label="range.label"
:value="range.value">
</el-option>
</el-select>
<el-button type="primary" @click="refreshAnalysis">
<i class="el-icon-refresh"></i> 刷新数据
</el-button>
<el-button @click="exportData">
<i class="el-icon-download"></i> 导出分析
</el-button>
</div>
</div>
<!-- 分析卡片网格 -->
<div class="analysis-grid">
<!-- 司机状态分析 -->
<div class="analysis-card">
<div class="card-header">
<h3 class="card-title">司机状态分析</h3>
<el-tooltip content="展示司机疲劳驾驶、情绪异常等状态监测数据" placement="top">
<i class="el-icon-info info-tooltip"></i>
</el-tooltip>
</div>
<div class="chart-container" id="driverStatusChart">
<div v-if="loading" class="loading-overlay">
<i class="el-icon-loading"></i>
</div>
</div>
<div class="chart-legend">
<div class="legend-item">
<div class="legend-color" style="background-color: #667eea"></div>
<span>疲劳驾驶</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #764ba2"></div>
<span>情绪异常</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #F56C9D"></div>
<span>行为违规</span>
</div>
</div>
</div>
<!-- 乘客异常事件分析 -->
<div class="analysis-card">
<div class="card-header">
<h3 class="card-title">乘客异常事件分析</h3>
<el-tooltip content="展示乘客冲突、突发疾病等异常事件统计" placement="top">
<i class="el-icon-info info-tooltip"></i>
</el-tooltip>
</div>
<div class="chart-container" id="passengerEventChart"></div>
</div>
<!-- 车辆类型异常分布 -->
<div class="analysis-card">
<div class="card-header">
<h3 class="card-title">车辆类型异常分布</h3>
<el-tooltip content="展示不同类型车辆(公交车、出租车、网约车)的异常事件分布" placement="top">
<i class="el-icon-info info-tooltip"></i>
</el-tooltip>
</div>
<div class="chart-container" id="vehicleTypeChart"></div>
<div class="comparison-card">
<div class="comparison-icon">
<i class="el-icon-warning"></i>
</div>
<div class="comparison-data">
<div class="comparison-value">-15%</div>
<div class="comparison-label">较上周期异常事件减少</div>
</div>
</div>
</div>
</div>
<!-- 详细数据表格 -->
<div class="data-table-section">
<div class="table-header">
<h3 class="table-title">详细数据</h3>
<div class="table-actions">
<el-button size="small" @click="refreshTable">
<i class="el-icon-refresh"></i> 刷新
</el-button>
<el-button size="small" type="primary" @click="exportTable">
<i class="el-icon-download"></i> 导出
</el-button>
</div>
</div>
<el-table :data="tableData" style="width: 100%" v-loading="tableLoading">
<el-table-column prop="time" label="时间" width="180"></el-table-column>
<el-table-column prop="vehicleType" label="车辆类型" width="120"></el-table-column>
<el-table-column prop="vehicleId" label="车辆编号" width="120"></el-table-column>
<el-table-column prop="eventType" label="异常类型" width="150">
<template slot-scope="scope">
<el-tag :type="getEventType(scope.row.eventType)" size="small">
{{ scope.row.eventType }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="location" label="发生位置" width="180"></el-table-column>
<el-table-column prop="status" label="处理状态">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.status)" size="small">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="action" label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleDetail(scope.row)">
查看详情
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container" style="margin-top: 20px; text-align: right;">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="currentPage" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
</div>
</div>
</main>
</div>
</div>
<!-- 通知抽屉 -->
<el-drawer title="系统通知" :visible.sync="notificationDrawer" direction="rtl" size="400px">
<div class="notification-list">
<div class="notification-item" v-for="notification in notifications" :key="notification.id">
<div class="notification-content">
<h4>{{ notification.title }}</h4>
<p>{{ notification.content }}</p>
<span class="notification-time">{{ notification.time }}</span>
</div>
<el-button type="text" @click="markAsRead(notification.id)">
<i class="el-icon-check"></i>
</el-button>
</div>
</div>
</el-drawer>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 系统状态
loading: true,
loadingText: '正在加载数据分析模块...',
sidebarCollapsed: false,
activeMenu: 'traffic-analysis',
// 用户信息
userInfo: {
username: '',
role: '',
avatar: './img/myphoto2.jpg',
loginTime: ''
},
// Logo
logoUrl: './img/logo_nobackground.png',
// 通知
notificationCount: 3,
notificationDrawer: false,
notifications: [{
id: 1,
title: '系统更新通知',
content: '系统将在今晚23:00进行维护更新,预计耗时2小时',
time: '2025-05-26 14:30',
read: false
}],
// 分析筛选
selectedVehicleType: 'all',
selectedEventType: 'all',
selectedTimeRange: 'day',
vehicleTypes: [{
value: 'all',
label: '全部车辆'
}, {
value: 'bus',
label: '公交车'
}, {
value: 'taxi',
label: '出租车'
}, {
value: 'ride',
label: '网约车'
}],
eventTypes: [{
value: 'all',
label: '全部异常'
}, {
value: 'fatigue',
label: '疲劳驾驶'
}, {
value: 'emotional',
label: '情绪异常'
}, {
value: 'passenger',
label: '乘客异常'
}],
timeRanges: [{
value: 'day',
label: '今日'
}, {
value: 'week',
label: '本周'
}, {
value: 'month',
label: '本月'
}],
// 表格数据
tableData: [],
tableLoading: false,
currentPage: 1,
pageSize: 10,
total: 0
};
},
mounted() {
this.initSystem();
this.initCharts();
this.loadTableData();
},
methods: {
// 系统初始化
async initSystem() {
try {
// 检查登录状态
const authToken = localStorage.getItem('authToken');
const userInfoStr = localStorage.getItem('userInfo');
if (!authToken || !userInfoStr) {
this.$message.warning('请先登录系统');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
return;
}
// 解析用户信息
this.userInfo = JSON.parse(userInfoStr);
this.loading = false;
} catch (error) {
console.error('System initialization error:', error);
this.$message.error('系统初始化失败');
}
},
// 图表初始化
initCharts() {
this.$nextTick(() => {
// 初始化司机状态分析图表
const driverChart = echarts.init(document.getElementById('driverStatusChart'));
const driverOption = {
backgroundColor: '#ffffff',
title: {
text: '司机异常状态统计',
left: 'center',
top: 0,
textStyle: {
fontSize: 14,
fontWeight: 'normal',
color: '#333'
},
padding: [0, 0, 2, 0]
},
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255,255,255,0.9)',
borderColor: '#e6e6e6',
borderWidth: 1,
textStyle: {
color: '#666'
}
},
grid: {
left: '8%',
right: '4%',
bottom: '8%', /* 减小底部空间 */
top: '15%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00'],
axisLine: {
lineStyle: {
color: '#e6e6e6'
}
},
axisTick: {
show: false
}
},
yAxis: {
type: 'value',
name: '异常次数',
nameTextStyle: {
color: '#666',
padding: [0, 0, 0, 5]
},
splitLine: {
lineStyle: {
type: 'dashed',
color: '#e6e6e6'
}
},
axisLine: {
show: false
},
axisTick: {
show: false
}
},
series: [{
name: '疲劳驾驶',
type: 'line',
smooth: true,
symbolSize: 8,
itemStyle: {
color: '#409EFF'
},
lineStyle: {
width: 3
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: 'rgba(64,158,255,0.2)'
}, {
offset: 1,
color: 'rgba(64,158,255,0)'
}]
}
},
data: [5, 8, 3, 4, 6, 7]
}, {
name: '情绪异常',
type: 'line',
smooth: true,
symbolSize: 8,
itemStyle: {
color: '#8B6DFF'
},
lineStyle: {
width: 3
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: 'rgba(139,109,255,0.2)'
}, {
offset: 1,
color: 'rgba(139,109,255,0)'
}]
}
},
data: [3, 4, 2, 3, 4, 5]
}, {
name: '行为违规',
type: 'line',
smooth: true,
symbolSize: 8,
itemStyle: {
color: '#F56C9D'
},
lineStyle: {
width: 3
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0,
color: 'rgba(245,108,157,0.2)'
}, {
offset: 1,
color: 'rgba(245,108,157,0)'
}]
}
},
data: [4, 5, 3, 5, 4, 6]
}]
};
driverChart.setOption(driverOption);
// 初始化乘客异常事件分析图表
const passengerChart = echarts.init(document.getElementById('passengerEventChart'));
const passengerOption = {
backgroundColor: '#ffffff',
title: {
text: '乘客异常事件类型',
left: 'center',
top: 10,
textStyle: {
fontSize: 16,
fontWeight: 'normal',
color: '#333'
},
padding: [0, 0, 10, 0]
},
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(255,255,255,0.9)',
borderColor: '#e6e6e6',
borderWidth: 1,
textStyle: {
color: '#666'
},
formatter: '{b}: {c}次 ({d}%)'
},
grid: {
left: '3%',
right: '4%',
bottom: '10%',
top: '25%',
containLabel: true
},
series: [{
name: '异常类型',
type: 'pie',
radius: ['35%', '65%'], // 减小饼图半径
center: ['50%', '55%'], // 调整中心点位置
avoidLabelOverlap: true,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: true,
position: 'outside',
formatter: '{b}\n{c}次',
fontSize: 12,
color: '#666',
padding: [0, 0, 0, 0],
lineHeight: 16,
distanceToLabelLine: 5
},
labelLine: {
length: 12, // 减小引导线长度
length2: 8, // 减小第二段引导线长度
smooth: true,
maxSurfaceAngle: 80
},
emphasis: {
label: {
fontSize: 14,
fontWeight: 'bold'
},
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0,0,0,0.2)'
}
},
data: [{
value: 35,
name: '乘客冲突',
itemStyle: { color: '#409EFF' }
}, {
value: 20,
name: '突发疾病',
itemStyle: { color: '#8B6DFF' }
}, {
value: 15,
name: '违规行为',
itemStyle: { color: '#F56C9D' }
}, {
value: 10,
name: '其他',
itemStyle: { color: '#909399' }
}]
}]
};
passengerChart.setOption(passengerOption);
// 初始化车辆类型异常分布图表
const vehicleChart = echarts.init(document.getElementById('vehicleTypeChart'));
const vehicleOption = {
backgroundColor: '#ffffff',
title: {
text: '车辆类型异常分布',
left: 'center',
top: 0,
textStyle: {
fontSize: 14,
fontWeight: 'normal',
color: '#333'
},
padding: [0, 0, 2, 0]
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
backgroundColor: 'rgba(255,255,255,0.9)',
borderColor: '#e6e6e6',
borderWidth: 1,
textStyle: {
color: '#666'
}
},
grid: {
left: '8%',
right: '4%',
bottom: '18%', /* 增加底部空间 */
top: '15%',
containLabel: true
},
xAxis: {
type: 'category',
data: ['公交车', '出租车', '网约车'],
axisLine: {
lineStyle: {
color: '#e6e6e6'
}
},
axisTick: {
show: false
},
axisLabel: {
color: '#666',
fontSize: 12
}
},
yAxis: {
type: 'value',
name: '异常次数',
nameTextStyle: {
color: '#666',
padding: [0, 0, 0, 5]
},
splitLine: {
lineStyle: {
type: 'dashed',
color: '#e6e6e6'
}
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: '#666',
fontSize: 12
}
},
series: [{
name: '疲劳驾驶',
type: 'bar',
stack: 'total',
barWidth: '40%',
itemStyle: {
color: '#409EFF',
borderRadius: [4, 4, 0, 0]
},
label: {
show: true,
position: 'inside',
color: '#fff',
fontSize: 12
},
emphasis: {
itemStyle: {
opacity: 0.8
}
},
data: [15, 10, 8]
}, {
name: '情绪异常',
type: 'bar',
stack: 'total',
itemStyle: {
color: '#8B6DFF',
borderRadius: [0, 0, 0, 0]
},
label: {
show: true,
position: 'inside',
color: '#fff',
fontSize: 12
},
emphasis: {
itemStyle: {
opacity: 0.8
}
},
data: [8, 12, 10]
}, {
name: '行为违规',
type: 'bar',
stack: 'total',
itemStyle: {
color: '#F56C9D',
borderRadius: [0, 0, 4, 4]
},
label: {
show: true,
position: 'inside',
color: '#fff',
fontSize: 12
},
emphasis: {
itemStyle: {
opacity: 0.8
}
},
data: [12, 8, 15]
}]
};
vehicleChart.setOption(vehicleOption);
// 监听窗口大小变化,调整图表大小
window.addEventListener('resize', function() {
driverChart.resize();
passengerChart.resize();
vehicleChart.resize();
});
});
},
// 刷新分析数据
refreshAnalysis() {
this.$message.success('数据刷新成功');
},
// 导出分析数据
exportData() {
this.$message.success('分析数据导出中...');
},
// 表格相关方法
loadTableData() {
this.tableLoading = true;
// 模拟加载数据
setTimeout(() => {
this.tableData = [{
time: '2025-05-26 15:00',
vehicleType: '公交车',
vehicleId: '012',
eventType: '疲劳驾驶',
location: '重庆主城区',
status: '正常'
}];
this.total = 100;
this.tableLoading = false;
}, 1000);
},
handleSizeChange(val) {
this.pageSize = val;
this.loadTableData();
},
handleCurrentChange(val) {
this.currentPage = val;
this.loadTableData();
},
// 状态样式
getStatusType(status) {
const types = {
'待处理': 'warning',
'处理中': 'info',
'已解决': 'success',
'需关注': 'danger'
};
return types[status] || 'info';
},
getEventType(eventType) {
const types = {
'疲劳驾驶': 'success',
'情绪异常': 'warning',
'乘客异常': 'danger'
};
return types[eventType] || 'info';
},
// 通用方法
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
handleMenuSelect(index) {
if (index === this.activeMenu) return;
window.location.href = index === 'dashboard' ? 'index.html' : `${index}.html`;
},
handleUserCommand(command) {
switch (command) {
case 'profile':
this.$message.info('个人信息功能开发中');
break;
case 'settings':
this.$message.info('系统设置功能开发中');
break;
case 'logout':
this.handleLogout();
break;
}
},
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
localStorage.removeItem('authToken');
localStorage.removeItem('userInfo');
localStorage.removeItem('loginTime');
this.$message.success('已安全退出');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
});
},
showNotifications() {
this.notificationDrawer = true;
},
markAsRead(id) {
const notification = this.notifications.find(n => n.id === id);
if (notification && !notification.read) {
notification.read = true;
this.notificationCount = Math.max(0, this.notificationCount - 1);
this.$message.success('已标记为已读');
}
},
handleLogoError() {
this.logoUrl = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjNjY3ZWVhIiByeD0iOCIvPgo8cGF0aCBkPSJNMjAgOEwxMCAxNGwyIDZsMCA4IDIwIDEyIDIwIDhabTAgMkwxMiAxNGwxIDNMMjAgMTVsNiAyTDE2IDE0TDIwIDEwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+';
},
handleDetail(row) {
// 实现查看详情功能
console.log('查看详情:', row);
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
traffic-analysis.html
|
HTML
|
unknown
| 47,712
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>实时监控 - 公共交通异常检测系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./css/traffic-monitor.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<!-- 主框架 -->
<div class="admin-layout" v-show="!loading">
<!-- 顶部导航栏 -->
<header class="admin-header">
<div class="header-left">
<div class="logo-section">
<img :src="logoUrl" alt="公共交通异常检测系统" class="header-logo" @error="handleLogoError">
<h1 class="system-title">公共交通异常检测系统</h1>
</div>
<div class="breadcrumb-section">
<el-breadcrumb separator="/">
<el-breadcrumb-item>交通监控</el-breadcrumb-item>
<el-breadcrumb-item>实时监控</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
<div class="header-right">
<el-badge :value="notificationCount" class="notification-badge">
<el-button type="text" @click="showNotifications">
<i class="el-icon-bell"></i>
</el-button>
</el-badge>
<el-dropdown @command="handleUserCommand" class="user-dropdown">
<div class="user-info">
<el-avatar :size="32" :src="userInfo.avatar || './img/myphoto2.jpg'" icon="el-icon-user-solid"></el-avatar>
<span class="username">{{ userInfo.username }}</span>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">
<i class="el-icon-user"></i> 个人信息
</el-dropdown-item>
<el-dropdown-item command="settings">
<i class="el-icon-setting"></i> 系统设置
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<i class="el-icon-switch-button"></i> 退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
<!-- 主内容区 -->
<div class="admin-main">
<!-- 侧边导航 -->
<aside class="admin-sidebar" :class="{ 'collapsed': sidebarCollapsed }">
<div class="sidebar-toggle" @click="toggleSidebar">
<i :class="sidebarCollapsed ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<el-menu :default-active="activeMenu" :collapse="sidebarCollapsed" @select="handleMenuSelect"
:default-openeds="['traffic']" class="sidebar-menu">
<el-menu-item index="dashboard">
<i class="el-icon-data-board"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="traffic">
<template slot="title">
<i class="el-icon-location"></i>
<span>交通监控</span>
</template>
<el-menu-item index="traffic-monitor">实时监控</el-menu-item>
<el-menu-item index="traffic-analysis">数据分析</el-menu-item>
<el-menu-item index="traffic-alert">预警管理</el-menu-item>
</el-submenu>
<el-submenu index="vehicle">
<template slot="title">
<i class="el-icon-truck"></i>
<span>车辆管理</span>
</template>
<el-menu-item index="vehicle-list">车辆列表</el-menu-item>
<el-menu-item index="vehicle-tracking">车辆追踪</el-menu-item>
<el-menu-item index="vehicle-maintenance">维护记录</el-menu-item>
</el-submenu>
<el-submenu index="data">
<template slot="title">
<i class="el-icon-pie-chart"></i>
<span>数据统计</span>
</template>
<el-menu-item index="data-overview">数据概览</el-menu-item>
<el-menu-item index="data-report">报表生成</el-menu-item>
<el-menu-item index="data-export">数据导出</el-menu-item>
</el-submenu>
<el-menu-item index="system">
<i class="el-icon-setting"></i>
<span slot="title">系统管理</span>
</el-menu-item>
</el-menu>
</aside>
<!-- 监控内容区域 -->
<main class="admin-content">
<!-- 监控视频网格 -->
<div class="camera-section">
<div class="section-header">
<h3>实时监控</h3>
<div class="section-filters">
<el-radio-group v-model="vehicleFilter" size="small">
<el-radio-button label="all">全部</el-radio-button>
<el-radio-button label="bus">公交车</el-radio-button>
<el-radio-button label="metro">地铁</el-radio-button>
<el-radio-button label="taxi">出租车/网约车</el-radio-button>
</el-radio-group>
</div>
</div>
<div class="camera-grid">
<div class="camera-card" v-for="camera in filteredCameras" :key="camera.id">
<div class="camera-feed">
<video :src="camera.streamUrl" autoplay loop muted style="width: 100%; height: 100%; object-fit: contain; background: #000;">
您的浏览器不支持视频播放
</video>
<div class="camera-overlay" v-if="camera.alert">
<div class="alert-badge" :class="camera.alert.type">
{{ camera.alert.message }}
</div>
</div>
</div>
<div class="camera-info">
<div class="camera-title">
<span>{{ camera.name }}</span>
<el-tag size="mini" :type="camera.vehicleType === 'bus' ? 'success' : 'warning'">
{{ camera.vehicleType === 'bus' ? '公交车' : '出租车' }}
</el-tag>
</div>
<div class="camera-details">
<div class="detail-item">
<i class="el-icon-user"></i>
<span>驾驶员:{{ camera.driverName }}</span>
</div>
<div class="detail-item">
<i class="el-icon-location"></i>
<span>车牌号:{{ camera.plateNumber }}</span>
</div>
</div>
<div class="camera-status">
<span class="status-indicator" :class="'status-' + camera.status"></span>
{{ getStatusText(camera.status) }}
</div>
</div>
</div>
</div>
<div class="section-footer">
<el-button type="text" @click="handleViewMore">
<i class="el-icon-more"></i> 查看更多监控
</el-button>
</div>
</div>
<!-- 实时告警列表 -->
<div class="alert-list">
<div class="alert-header">
<h3>实时告警</h3>
<div class="alert-filters">
<el-radio-group v-model="alertFilter" size="small">
<el-radio-button label="all">全部</el-radio-button>
<el-radio-button label="bus">公交车</el-radio-button>
<el-radio-button label="metro">地铁</el-radio-button>
<el-radio-button label="taxi">出租车/网约车</el-radio-button>
</el-radio-group>
</div>
</div>
<div v-for="alert in displayedAlerts" :key="alert.id"
class="alert-item"
:class="'alert-' + alert.level">
<div class="alert-header">
<div class="alert-title">
<i :class="getAlertIcon(alert.vehicleType)"></i>
<strong>{{ alert.title }}</strong>
</div>
<span class="alert-time">{{ alert.time }}</span>
</div>
<div class="alert-body">
<div class="alert-description">{{ alert.description }}</div>
<div class="alert-details">
<span>
<i :class="getVehicleIcon(alert.vehicleType)"></i>
车辆:{{ alert.vehicle }}
</span>
<span>
<i class="el-icon-location"></i>
位置:{{ alert.location }}
</span>
<span>
<i class="el-icon-user"></i>
驾驶员:{{ alert.driver }}
</span>
</div>
</div>
<div class="alert-actions">
<el-button type="text" size="small" @click="handleAlert(alert.id)">
<i class="el-icon-video-camera"></i> 查看监控
</el-button>
<el-button type="text" size="small" @click="handleEmergency(alert.id)">
<i class="el-icon-warning"></i> 应急处置
</el-button>
</div>
</div>
<div class="alert-footer" v-if="hasMoreAlerts">
<el-button type="text" @click="handleViewMoreAlerts">
<i class="el-icon-more"></i> 查看更多告警
</el-button>
</div>
</div>
</main>
</div>
</div>
<!-- 通知抽屉 -->
<el-drawer title="系统通知" :visible.sync="notificationDrawer" direction="rtl" size="400px">
<div class="notification-list">
<div class="notification-item" v-for="notification in notifications" :key="notification.id">
<div class="notification-content">
<h4>{{ notification.title }}</h4>
<p>{{ notification.content }}</p>
<span class="notification-time">{{ notification.time }}</span>
</div>
<el-button type="text" @click="markAsRead(notification.id)">
<i class="el-icon-check"></i>
</el-button>
</div>
</div>
</el-drawer>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 系统状态
loading: true,
loadingText: '正在加载实时监控数据...',
sidebarCollapsed: false,
activeMenu: 'traffic-monitor',
// 用户信息
userInfo: {
username: '管理员',
role: 'admin',
avatar: './img/myphoto2.jpg'
},
// Logo
logoUrl: './img/logo_nobackground.png',
// 通知
notificationCount: 3,
notificationDrawer: false,
notifications: [{
id: 1,
title: '系统更新通知',
content: '系统将在今晚23:00进行维护更新,预计耗时2小时',
time: '2025-05-26 14:30',
read: false
}],
// 统计数据
stats: {},
// 添加车辆类型过滤器
vehicleFilter: 'all',
// 修改监控摄像头数据
cameras: [
{
id: 1,
name: '105路公交车',
streamUrl: './img/公交车1.mp4',
status: 'warning',
vehicleType: 'bus',
driverName: '张师傅',
plateNumber: '渝BW2273',
alert: {
type: 'warning',
//message: '疲劳驾驶预警'
}
},
{
id: 2,
name: '132路公交车',
streamUrl: './img/公交车2.mp4',
status: 'normal',
vehicleType: 'bus',
driverName: '龚师傅',
plateNumber: '渝BW7542',
alert: null
},
{
id: 3,
name: '曹操出行网约车1',
streamUrl: './img/网约车1.mp4',
status: 'normal',
vehicleType: 'taxi',
driverName: '王师傅',
plateNumber: '渝CB9125',
alert: null
},
{
id: 4,
name: '滴滴出行网约车1',
streamUrl: './img/网约车2.mp4',
status: 'normal',
vehicleType: 'taxi',
driverName: '杨师傅',
plateNumber: '渝A2057M',
alert: null
}
],
// 告警过滤器
alertFilter: 'all',
// 告警数据
alerts: [
{
id: 1,
vehicleType: 'bus',
title: '疲劳驾驶预警',
description: '系统检测到驾驶员连续驾驶时间超过3小时,存在疲劳驾驶风险',
time: '2025-05-26 15:30',
level: 'warning',
vehicle: '渝BW2273 (105路公交车)',
location: '大学城美院 - 区门诊',
driver: '张师傅'
},
/* {
id: 2,
vehicleType: 'metro',
title: '乘客冲突事件',
description: '3号线列车内检测到乘客发生言语冲突,可能存在肢体冲突风险',
time: '2025-05-26 15:25',
level: 'danger',
vehicle: 'MT3001 (3号线地铁)',
location: '观音桥站',
driver: '李师傅'
},
{
id: 3,
vehicleType: 'taxi',
title: '异常行为检测',
description: '检测到乘客有可疑的异常行为,建议驾驶员注意',
time: '2025-05-26 15:20',
level: 'warning',
vehicle: '渝B98765 (网约车)',
location: '解放碑',
driver: '赵师傅'
} */
]
};
},
computed: {
// 添加过滤后的摄像头列表
filteredCameras() {
if (this.vehicleFilter === 'all') {
return this.cameras;
}
return this.cameras.filter(camera => camera.vehicleType === this.vehicleFilter);
},
filteredAlerts() {
if (this.alertFilter === 'all') {
return this.alerts;
}
return this.alerts.filter(alert => alert.vehicleType === this.alertFilter);
},
displayedAlerts() {
return this.filteredAlerts.slice(0, 2);
},
hasMoreAlerts() {
return this.filteredAlerts.length > 2;
}
},
mounted() {
this.initSystem();
},
methods: {
// 系统初始化
async initSystem() {
try {
// 检查登录状态
const authToken = localStorage.getItem('authToken');
const userInfoStr = localStorage.getItem('userInfo');
if (!authToken || !userInfoStr) {
this.$message.warning('请先登录系统');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
return;
}
// 解析用户信息
const userInfo = JSON.parse(userInfoStr);
this.userInfo = userInfo;
// 模拟加载数据
setTimeout(() => {
this.loading = false;
}, 1000);
} catch (error) {
console.error('System initialization error:', error);
this.$message.error('系统初始化失败');
}
},
// 获取状态文本
getStatusText(status) {
const statusMap = {
normal: '正常',
warning: '警告',
danger: '异常'
};
return statusMap[status] || '未知';
},
// 通用方法
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
handleMenuSelect(index) {
if (index === this.activeMenu) return;
window.location.href = index === 'dashboard' ? 'index.html' : `${index}.html`;
},
handleUserCommand(command) {
switch (command) {
case 'profile':
this.$message.info('个人信息功能开发中');
break;
case 'settings':
this.$message.info('系统设置功能开发中');
break;
case 'logout':
this.handleLogout();
break;
}
},
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
localStorage.removeItem('authToken');
localStorage.removeItem('userInfo');
this.$message.success('已安全退出');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
});
},
showNotifications() {
this.notificationDrawer = true;
},
markAsRead(id) {
const notification = this.notifications.find(n => n.id === id);
if (notification && !notification.read) {
notification.read = true;
this.notificationCount = Math.max(0, this.notificationCount - 1);
this.$message.success('已标记为已读');
}
},
handleLogoError() {
this.logoUrl = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjNjY3ZWVhIiByeD0iOCIvPgo8cGF0aCBkPSJNMjAgOEwxMCAxNGwyIDZsMCA4IDIwIDEyIDIwIDhabTAgMkwxMiAxNGwxIDNMMjAgMTVsNiAyTDE2IDE0TDIwIDEwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+';
},
getAlertIcon(type) {
const iconMap = {
bus: 'el-icon-warning',
metro: 'el-icon-bell',
taxi: 'el-icon-message'
};
return iconMap[type] || 'el-icon-info';
},
getVehicleIcon(type) {
const iconMap = {
bus: 'el-icon-truck',
metro: 'el-icon-train',
taxi: 'el-icon-car'
};
return iconMap[type] || 'el-icon-location-information';
},
handleAlert(alertId) {
this.$message.info(`正在调取告警 ${alertId} 的监控画面`);
},
handleEmergency(alertId) {
this.$confirm('是否确认启动应急处置流程?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('已启动应急处置流程');
});
},
// 添加查看更多方法
handleViewMore() {
this.$message.info('正在开发更多监控画面功能');
},
handleViewMoreAlerts() {
this.$router.push('/traffic-alert');
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
traffic-monitor.html
|
HTML
|
unknown
| 17,661
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>车辆列表 - 公共交通异常检测系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./css/vehicle-list.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 加载遮罩 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<div class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<div>{{ loadingText }}</div>
</div>
</div>
</transition>
<!-- 主框架 -->
<div class="admin-layout" v-show="!loading">
<!-- 顶部导航栏 -->
<header class="admin-header">
<div class="header-left">
<div class="logo-section">
<img :src="logoUrl" alt="公共交通异常检测系统" class="header-logo" @error="handleLogoError">
<h1 class="system-title">公共交通异常检测系统</h1>
</div>
<div class="breadcrumb-section">
<el-breadcrumb separator="/">
<el-breadcrumb-item><a href="index.html">首页</a></el-breadcrumb-item>
<el-breadcrumb-item>车辆管理</el-breadcrumb-item>
<el-breadcrumb-item>车辆列表</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
<div class="header-right">
<!-- 通知 -->
<el-badge :value="notificationCount" class="notification-badge">
<el-button type="text" @click="showNotifications">
<i class="el-icon-bell"></i>
</el-button>
</el-badge>
<!-- 用户菜单 -->
<el-dropdown @command="handleUserCommand" class="user-dropdown">
<div class="user-info">
<el-avatar :size="32" :src="userInfo.avatar" icon="el-icon-user-solid"></el-avatar>
<span class="username">{{ userInfo.username }}</span>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">
<i class="el-icon-user"></i> 个人信息
</el-dropdown-item>
<el-dropdown-item command="settings">
<i class="el-icon-setting"></i> 系统设置
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<i class="el-icon-switch-button"></i> 退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</header>
<!-- 主内容区 -->
<div class="admin-main">
<!-- 侧边导航 -->
<aside class="admin-sidebar" :class="{ 'collapsed': sidebarCollapsed }">
<div class="sidebar-toggle" @click="toggleSidebar">
<i :class="sidebarCollapsed ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<el-menu :default-active="activeMenu" :collapse="sidebarCollapsed" @select="handleMenuSelect"
class="sidebar-menu">
<el-menu-item index="dashboard">
<i class="el-icon-data-board"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="traffic">
<template slot="title">
<i class="el-icon-location"></i>
<span>交通监控</span>
</template>
<el-menu-item index="traffic-monitor">实时监控</el-menu-item>
<el-menu-item index="traffic-analysis">数据分析</el-menu-item>
<el-menu-item index="traffic-alert">预警管理</el-menu-item>
</el-submenu>
<el-submenu index="vehicle">
<template slot="title">
<i class="el-icon-truck"></i>
<span>车辆管理</span>
</template>
<el-menu-item index="vehicle-list">车辆列表</el-menu-item>
<el-menu-item index="vehicle-tracking">车辆追踪</el-menu-item>
<el-menu-item index="vehicle-maintenance">维护记录</el-menu-item>
</el-submenu>
<el-submenu index="data">
<template slot="title">
<i class="el-icon-pie-chart"></i>
<span>数据统计</span>
</template>
<el-menu-item index="data-overview">数据概览</el-menu-item>
<el-menu-item index="data-report">报表生成</el-menu-item>
<el-menu-item index="data-export">数据导出</el-menu-item>
</el-submenu>
<el-menu-item index="system">
<i class="el-icon-setting"></i>
<span slot="title">系统管理</span>
</el-menu-item>
</el-menu>
</aside>
<!-- 内容区域 -->
<main class="admin-content">
<!-- 页面头部 -->
<div class="page-header">
<div class="header-left">
<h1>车辆列表</h1>
</div>
<div class="header-right">
<el-button type="primary" @click="addVehicle">
<i class="el-icon-plus"></i>
添加车辆
</el-button>
</div>
</div>
<!-- 车辆概览卡片 -->
<div class="vehicle-overview">
<div class="overview-card" v-for="stat in vehicleStats" :key="stat.id">
<div class="stat-icon" :style="{ backgroundColor: stat.color }">
<i :class="stat.icon"></i>
</div>
<div class="stat-info">
<h3>{{ stat.value }}</h3>
<p>{{ stat.label }}</p>
</div>
</div>
</div>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 搜索和筛选 -->
<div class="filter-section">
<el-form :inline="true" :model="filterForm" class="filter-form">
<el-form-item label="车牌号">
<el-input v-model="filterForm.plateNumber" placeholder="请输入车牌号"></el-input>
</el-form-item>
<el-form-item label="车辆类型">
<el-select v-model="filterForm.vehicleType" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option label="公交车" value="bus"></el-option>
<el-option label="出租车" value="taxi"></el-option>
<el-option label="网约车" value="ride-hailing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="运行状态">
<el-select v-model="filterForm.status" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option label="正常运行" value="normal"></el-option>
<el-option label="已检测异常" value="abnormal"></el-option>
<el-option label="暂停服务" value="suspended"></el-option>
</el-select>
</el-form-item>
<el-form-item label="异常类型">
<el-select v-model="filterForm.abnormalType" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option label="司机疲劳" value="driver-fatigue"></el-option>
<el-option label="乘客冲突" value="passenger-conflict"></el-option>
<el-option label="超载" value="overload"></el-option>
<el-option label="异常停靠" value="abnormal-stop"></el-option>
<el-option label="危险驾驶" value="dangerous-driving"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button>
<el-button @click="resetFilter">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 车辆列表 -->
<div class="vehicle-list-section">
<el-table :data="vehicleList" style="width: 100%" v-loading="tableLoading">
<el-table-column prop="plateNumber" label="车牌号" width="120"></el-table-column>
<el-table-column prop="vehicleType" label="车辆类型" width="100">
<template slot-scope="scope">
<el-tag :type="getVehicleTypeTag(scope.row.vehicleType)">
{{ getVehicleTypeName(scope.row.vehicleType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="line" label="线路/区域" width="120"></el-table-column>
<el-table-column prop="status" label="运行状态" width="100">
<template slot-scope="scope">
<el-tag :type="getStatusTag(scope.row.status)">
{{ getStatusName(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="abnormalType" label="异常类型" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.abnormalType" :type="getAbnormalTypeTag(scope.row.abnormalType)">
{{ getAbnormalTypeName(scope.row.abnormalType) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="lastLocation" label="最后位置" width="180"></el-table-column>
<el-table-column prop="lastUpdate" label="最后更新" width="180"></el-table-column>
<el-table-column prop="driver" label="当前驾驶员" width="120"></el-table-column>
<el-table-column label="操作" width="250" fixed="right">
<template slot-scope="scope">
<el-button size="mini" @click="viewDetails(scope.row)">详情</el-button>
<el-button size="mini" type="warning" @click="handleAlert(scope.row)" v-if="scope.row.status === 'abnormal'">处理异常</el-button>
<el-button size="mini" type="primary" @click="editVehicle(scope.row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</main>
</div>
</div>
<!-- 通知抽屉 -->
<el-drawer title="系统通知" :visible.sync="notificationDrawer" direction="rtl" size="400px">
<div class="notification-list">
<div class="notification-item" v-for="notification in notifications" :key="notification.id">
<div class="notification-content">
<h4>{{ notification.title }}</h4>
<p>{{ notification.content }}</p>
<span class="notification-time">{{ notification.time }}</span>
</div>
<el-button type="text" @click="markAsRead(notification.id)">
<i class="el-icon-check"></i>
</el-button>
</div>
</div>
</el-drawer>
<!-- 添加/编辑车辆对话框 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px">
<el-form :model="vehicleForm" :rules="rules" ref="vehicleForm" label-width="100px">
<el-form-item label="车牌号" prop="plateNumber">
<el-input v-model="vehicleForm.plateNumber"></el-input>
</el-form-item>
<el-form-item label="车辆类型" prop="vehicleType">
<el-select v-model="vehicleForm.vehicleType" placeholder="请选择">
<el-option label="小型车" value="small"></el-option>
<el-option label="中型车" value="medium"></el-option>
<el-option label="大型车" value="large"></el-option>
</el-select>
</el-form-item>
<el-form-item label="品牌型号" prop="brand">
<el-input v-model="vehicleForm.brand"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="vehicleForm.status" placeholder="请选择">
<el-option label="在线" value="online"></el-option>
<el-option label="离线" value="offline"></el-option>
<el-option label="维修中" value="maintenance"></el-option>
</el-select>
</el-form-item>
<el-form-item label="当前驾驶员" prop="driver">
<el-input v-model="vehicleForm.driver"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</span>
</el-dialog>
<!-- 车辆详情对话框 -->
<el-dialog title="车辆详情" :visible.sync="detailsVisible" width="800px">
<div class="vehicle-details" v-if="currentVehicle">
<div class="details-header">
<div class="vehicle-info">
<h3>{{ currentVehicle.plateNumber }}</h3>
<el-tag :type="getVehicleTypeTag(currentVehicle.vehicleType)">
{{ currentVehicle.vehicleType }}
</el-tag>
<el-tag :type="getStatusTag(currentVehicle.status)">
{{ currentVehicle.status }}
</el-tag>
</div>
</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="基本信息" name="basic">
<el-descriptions :column="2" border>
<el-descriptions-item label="品牌型号">{{ currentVehicle.brand }}</el-descriptions-item>
<el-descriptions-item label="当前驾驶员">{{ currentVehicle.driver }}</el-descriptions-item>
<el-descriptions-item label="最后位置">{{ currentVehicle.lastLocation }}</el-descriptions-item>
<el-descriptions-item label="最后更新">{{ currentVehicle.lastUpdate }}</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="运行记录" name="records">
<el-timeline>
<el-timeline-item
v-for="(record, index) in vehicleRecords"
:key="index"
:timestamp="record.time"
:type="record.type">
{{ record.content }}
</el-timeline-item>
</el-timeline>
</el-tab-pane>
<el-tab-pane label="维护记录" name="maintenance">
<el-table :data="maintenanceRecords" style="width: 100%">
<el-table-column prop="date" label="维护日期" width="180"></el-table-column>
<el-table-column prop="type" label="维护类型" width="120"></el-table-column>
<el-table-column prop="description" label="维护内容"></el-table-column>
<el-table-column prop="cost" label="费用" width="120"></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</el-dialog>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 加载状态
loading: true,
loadingText: '正在加载系统...',
tableLoading: false,
// 用户信息
userInfo: {
username: '',
role: '',
avatar: './img/myphoto2.jpg',
loginTime: ''
},
// 界面状态
sidebarCollapsed: false,
activeMenu: 'vehicle-list',
logoUrl: './img/logo_nobackground.png',
// 通知相关
notificationCount: 3,
notificationDrawer: false,
notifications: [{
id: 1,
title: '系统更新通知',
content: '系统将在今晚23:00进行维护更新,预计耗时2小时',
time: '2024-03-15 14:30',
read: false
}],
// 车辆统计
vehicleStats: [{
id: 1,
label: '车辆总数',
value: '156',
icon: 'el-icon-truck',
color: '#409EFF'
},
{
id: 2,
label: '正常运行',
value: '128',
icon: 'el-icon-success',
color: '#67C23A'
},
{
id: 3,
label: '已检测异常',
value: '15',
icon: 'el-icon-warning',
color: '#E6A23C'
},
{
id: 4,
label: '暂停服务',
value: '13',
icon: 'el-icon-circle-close',
color: '#F56C6C'
}],
// 筛选表单
filterForm: {
plateNumber: '',
vehicleType: '',
status: '',
abnormalType: ''
},
// 车辆列表数据
vehicleList: [{
plateNumber: '渝A12345',
vehicleType: 'bus',
line: '103路',
status: 'abnormal',
abnormalType: 'driver-fatigue',
lastLocation: '重庆市渝中区解放碑',
lastUpdate: '2024-03-15 10:30:00',
driver: '王建国'
},
{
plateNumber: '渝A67890',
vehicleType: 'bus',
line: '262路',
status: 'normal',
abnormalType: '',
lastLocation: '重庆市北碚区天生路',
lastUpdate: '2024-03-15 10:35:00',
driver: '李志强'
},
{
plateNumber: '渝B12345',
vehicleType: 'taxi',
line: '北碚区域',
status: 'abnormal',
abnormalType: 'passenger-conflict',
lastLocation: '重庆市北碚区北碚文化中心',
lastUpdate: '2024-03-15 10:32:00',
driver: '张明华'
},
{
plateNumber: '渝A78901',
vehicleType: 'bus',
line: '188路',
status: 'normal',
abnormalType: '',
lastLocation: '重庆市北碚区北碚图书馆',
lastUpdate: '2024-03-15 10:38:00',
driver: '陈永康'
},
{
plateNumber: '渝B23456',
vehicleType: 'taxi',
line: '北碚区域',
status: 'suspended',
abnormalType: 'dangerous-driving',
lastLocation: '重庆市北碚区北碚体育馆',
lastUpdate: '2024-03-15 10:25:00',
driver: '刘德华'
},
{
plateNumber: 'DIDI78901',
vehicleType: 'ride-hailing',
line: '北碚区域',
status: 'abnormal',
abnormalType: 'overload',
lastLocation: '重庆市北碚区北碚火车站',
lastUpdate: '2024-03-15 10:40:00',
driver: '赵小川'
},
{
plateNumber: '渝A89012',
vehicleType: 'bus',
line: '168路',
status: 'normal',
abnormalType: '',
lastLocation: '重庆市北碚区北碚步行街',
lastUpdate: '2024-03-15 10:42:00',
driver: '周长江'
},
{
plateNumber: 'DIDI89012',
vehicleType: 'ride-hailing',
line: '北碚区域',
status: 'abnormal',
abnormalType: 'abnormal-stop',
lastLocation: '重庆市北碚区天生丽街',
lastUpdate: '2024-03-15 10:36:00',
driver: '杨光明'
},
{
plateNumber: '渝A90123',
vehicleType: 'bus',
line: '268路',
status: 'normal',
abnormalType: '',
lastLocation: '重庆市北碚区北碚中学',
lastUpdate: '2024-03-15 10:45:00',
driver: '吴成龙'
},
{
plateNumber: '渝B34567',
vehicleType: 'taxi',
line: '北碚区域',
status: 'abnormal',
abnormalType: 'driver-fatigue',
lastLocation: '重庆市北碚区北碚科技大学',
lastUpdate: '2024-03-15 10:33:00',
driver: '郑家辉'
}],
// 分页相关
currentPage: 1,
pageSize: 10,
total: 100,
// 对话框控制
dialogVisible: false,
detailsVisible: false,
dialogTitle: '添加车辆',
currentVehicle: null,
activeTab: 'basic',
// 表单数据
vehicleForm: {
plateNumber: '',
vehicleType: '',
brand: '',
status: '',
driver: ''
},
// 表单验证规则
rules: {
plateNumber: [
{ required: true, message: '请输入车牌号', trigger: 'blur' }
],
vehicleType: [
{ required: true, message: '请选择车辆类型', trigger: 'change' }
],
brand: [
{ required: true, message: '请输入品牌型号', trigger: 'blur' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
]
},
// 运行记录
vehicleRecords: [{
time: '2024-03-15 10:30:00',
type: 'success',
content: '车辆启动'
}],
// 维护记录
maintenanceRecords: [{
date: '2024-03-15',
type: '常规保养',
description: '更换机油、机滤',
cost: '¥800'
}]
}
},
mounted() {
this.initSystem();
},
methods: {
// 系统初始化
async initSystem() {
try {
// 检查登录状态
const authToken = localStorage.getItem('authToken');
const userInfoStr = localStorage.getItem('userInfo');
if (!authToken || !userInfoStr) {
this.$message.warning('请先登录系统');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
return;
}
// 解析用户信息
this.userInfo = JSON.parse(userInfoStr);
this.userInfo.loginTime = localStorage.getItem('loginTime') || new Date().toISOString();
// 模拟加载过程
await this.simulateLoading();
// 加载完成
this.loading = false;
} catch (error) {
console.error('System initialization error:', error);
this.$message.error('系统初始化失败');
}
},
// 模拟加载过程
simulateLoading() {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, 1000);
});
},
// 侧边栏切换
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
// 菜单选择
handleMenuSelect(index) {
if (index === 'dashboard') {
window.location.href = './index.html';
} else if (index === 'traffic-monitor') {
window.location.href = './traffic-monitor.html';
} else if (index === 'traffic-analysis') {
window.location.href = './traffic-analysis.html';
} else if (index === 'traffic-alert') {
window.location.href = './traffic-alert.html';
} else if (index === 'vehicle-tracking') {
window.location.href = './vehicle-tracking.html';
} else if (index === 'vehicle-maintenance') {
window.location.href = './vehicle-maintenance.html';
} else if (index === 'data-overview') {
window.location.href = './data-overview.html';
} else if (index === 'data-report') {
window.location.href = './data-report.html';
} else if (index === 'data-export') {
window.location.href = './data-export.html';
} else if (index === 'system') {
window.location.href = './system-management.html';
}
},
// 用户命令处理
handleUserCommand(command) {
switch (command) {
case 'profile':
this.$message.info('个人信息功能开发中');
break;
case 'settings':
this.$message.info('系统设置功能开发中');
break;
case 'logout':
this.handleLogout();
break;
}
},
// 退出登录
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
localStorage.removeItem('authToken');
localStorage.removeItem('userInfo');
localStorage.removeItem('loginTime');
this.$message.success('已安全退出');
setTimeout(() => {
window.location.href = './login.html';
}, 1000);
});
},
// 显示通知
showNotifications() {
this.notificationDrawer = true;
},
// 标记为已读
markAsRead(id) {
const notification = this.notifications.find(n => n.id === id);
if (notification && !notification.read) {
notification.read = true;
this.notificationCount = Math.max(0, this.notificationCount - 1);
this.$message.success('已标记为已读');
}
},
// Logo错误处理
handleLogoError() {
this.logoUrl = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjNjY3ZWVhIiByeD0iOCIvPgo8cGF0aCBkPSJNMjAgOEwxMCAxNGwyIDZsMCA4IDIwIDEyIDIwIDhabTAgMkwxMiAxNGwxIDNMMjAgMTVsNiAyTDE2IDE0TDIwIDEwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+';
},
// 获取车辆类型名称
getVehicleTypeName(type) {
const typeMap = {
'bus': '公交车',
'taxi': '出租车',
'ride-hailing': '网约车'
};
return typeMap[type] || type;
},
// 获取车辆类型标签样式
getVehicleTypeTag(type) {
const typeMap = {
'bus': 'primary',
'taxi': 'success',
'ride-hailing': 'info'
};
return typeMap[type] || 'info';
},
// 获取状态名称
getStatusName(status) {
const statusMap = {
'normal': '正常运行',
'abnormal': '已检测异常',
'suspended': '暂停服务'
};
return statusMap[status] || status;
},
// 获取状态标签样式
getStatusTag(status) {
const statusMap = {
'normal': 'success',
'abnormal': 'warning',
'suspended': 'danger'
};
return statusMap[status] || 'info';
},
// 获取异常类型名称
getAbnormalTypeName(type) {
const typeMap = {
'driver-fatigue': '司机疲劳',
'passenger-conflict': '乘客冲突',
'overload': '超载',
'abnormal-stop': '异常停靠',
'dangerous-driving': '危险驾驶'
};
return typeMap[type] || type;
},
// 获取异常类型标签样式
getAbnormalTypeTag(type) {
const typeMap = {
'driver-fatigue': 'danger',
'passenger-conflict': 'warning',
'overload': 'warning',
'abnormal-stop': 'info',
'dangerous-driving': 'danger'
};
return typeMap[type] || 'info';
},
// 处理异常
handleAlert(row) {
this.$alert(`正在处理 ${row.plateNumber} 的异常情况:${this.getAbnormalTypeName(row.abnormalType)}`, '处理异常', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'success',
message: '异常处理完成'
});
}
});
},
// 搜索
handleSearch() {
this.tableLoading = true;
setTimeout(() => {
this.tableLoading = false;
this.$message.success('搜索完成');
}, 1000);
},
// 重置筛选
resetFilter() {
this.filterForm = {
plateNumber: '',
vehicleType: '',
status: '',
abnormalType: ''
};
},
// 添加车辆
addVehicle() {
this.dialogTitle = '添加车辆';
this.vehicleForm = {
plateNumber: '',
vehicleType: '',
brand: '',
status: '',
driver: ''
};
this.dialogVisible = true;
},
// 编辑车辆
editVehicle(row) {
this.dialogTitle = '编辑车辆';
this.vehicleForm = { ...row };
this.dialogVisible = true;
},
// 查看详情
viewDetails(row) {
this.currentVehicle = row;
this.detailsVisible = true;
},
// 提交表单
submitForm() {
this.$refs.vehicleForm.validate((valid) => {
if (valid) {
this.$message.success('保存成功');
this.dialogVisible = false;
}
});
},
// 分页相关方法
handleSizeChange(val) {
this.pageSize = val;
this.loadVehicleList();
},
handleCurrentChange(val) {
this.currentPage = val;
this.loadVehicleList();
},
// 加载车辆列表
loadVehicleList() {
this.tableLoading = true;
setTimeout(() => {
this.tableLoading = false;
}, 500);
}
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
vehicle-list.html
|
HTML
|
unknown
| 31,494
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>维护记录 - 智驭安行系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/vehicle-maintenance.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>维护记录</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>车辆管理</el-breadcrumb-item>
<el-breadcrumb-item>维护记录</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button type="primary" @click="showAddDialog">
<i class="el-icon-plus"></i> 添加维护记录
</el-button>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 筛选区域 -->
<div class="filter-section">
<el-form :inline="true" :model="filterForm" class="filter-form">
<el-form-item label="车牌号">
<el-input v-model="filterForm.plateNumber" placeholder="请输入车牌号"></el-input>
</el-form-item>
<el-form-item label="维护类型">
<el-select v-model="filterForm.maintenanceType" placeholder="请选择维护类型">
<el-option label="常规保养" value="regular"></el-option>
<el-option label="故障维修" value="repair"></el-option>
<el-option label="零件更换" value="replacement"></el-option>
</el-select>
</el-form-item>
<el-form-item label="维护状态">
<el-select v-model="filterForm.status" placeholder="请选择状态">
<el-option label="待处理" value="pending"></el-option>
<el-option label="进行中" value="in-progress"></el-option>
<el-option label="已完成" value="completed"></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间范围">
<el-date-picker
v-model="filterForm.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleFilter">查询</el-button>
<el-button @click="resetFilter">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 维护记录列表 -->
<div class="maintenance-list">
<el-table :data="maintenanceRecords" style="width: 100%" v-loading="loading">
<el-table-column prop="plateNumber" label="车牌号" width="120"></el-table-column>
<el-table-column prop="maintenanceType" label="维护类型" width="120">
<template slot-scope="scope">
<el-tag :type="getMaintenanceTypeTag(scope.row.maintenanceType)">
{{ getMaintenanceTypeText(scope.row.maintenanceType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="description" label="维护内容"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.status)">
{{ getStatusText(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="startDate" label="开始时间" width="180"></el-table-column>
<el-table-column prop="endDate" label="完成时间" width="180"></el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="viewDetails(scope.row)">查看</el-button>
<el-button type="text" @click="editRecord(scope.row)">编辑</el-button>
<el-button type="text" class="delete-btn" @click="deleteRecord(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
<!-- 添加/编辑维护记录对话框 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px">
<el-form :model="maintenanceForm" :rules="rules" ref="maintenanceForm" label-width="100px">
<el-form-item label="车牌号" prop="plateNumber">
<el-select v-model="maintenanceForm.plateNumber" placeholder="请选择车辆">
<el-option
v-for="vehicle in vehicles"
:key="vehicle.plateNumber"
:label="vehicle.plateNumber"
:value="vehicle.plateNumber">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="维护类型" prop="maintenanceType">
<el-select v-model="maintenanceForm.maintenanceType" placeholder="请选择维护类型">
<el-option label="常规保养" value="regular"></el-option>
<el-option label="故障维修" value="repair"></el-option>
<el-option label="零件更换" value="replacement"></el-option>
</el-select>
</el-form-item>
<el-form-item label="维护内容" prop="description">
<el-input type="textarea" v-model="maintenanceForm.description" rows="3"></el-input>
</el-form-item>
<el-form-item label="维护状态" prop="status">
<el-select v-model="maintenanceForm.status" placeholder="请选择状态">
<el-option label="待处理" value="pending"></el-option>
<el-option label="进行中" value="in-progress"></el-option>
<el-option label="已完成" value="completed"></el-option>
</el-select>
</el-form-item>
<el-form-item label="开始时间" prop="startDate">
<el-date-picker
v-model="maintenanceForm.startDate"
type="datetime"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="完成时间" prop="endDate">
<el-date-picker
v-model="maintenanceForm.endDate"
type="datetime"
placeholder="选择完成时间">
</el-date-picker>
</el-form-item>
<el-form-item label="维护费用" prop="cost">
<el-input-number v-model="maintenanceForm.cost" :min="0" :precision="2"></el-input-number>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" v-model="maintenanceForm.remarks" rows="2"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</div>
</el-dialog>
<!-- 维护详情对话框 -->
<el-dialog title="维护详情" :visible.sync="detailsVisible" width="800px">
<div v-if="selectedRecord" class="maintenance-details">
<el-descriptions :column="2" border>
<el-descriptions-item label="车牌号">{{ selectedRecord.plateNumber }}</el-descriptions-item>
<el-descriptions-item label="维护类型">
<el-tag :type="getMaintenanceTypeTag(selectedRecord.maintenanceType)">
{{ getMaintenanceTypeText(selectedRecord.maintenanceType) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="维护内容" :span="2">
{{ selectedRecord.description }}
</el-descriptions-item>
<el-descriptions-item label="维护状态">
<el-tag :type="getStatusType(selectedRecord.status)">
{{ getStatusText(selectedRecord.status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="维护费用">
{{ selectedRecord.cost }} 元
</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ selectedRecord.startDate }}</el-descriptions-item>
<el-descriptions-item label="完成时间">{{ selectedRecord.endDate }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ selectedRecord.remarks }}</el-descriptions-item>
</el-descriptions>
<!-- 维护进度时间线 -->
<div class="maintenance-timeline">
<h3>维护进度</h3>
<el-timeline>
<el-timeline-item
v-for="(activity, index) in selectedRecord.timeline"
:key="index"
:timestamp="activity.time"
:type="activity.type">
{{ activity.content }}
</el-timeline-item>
</el-timeline>
</div>
</div>
</el-dialog>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 筛选表单
filterForm: {
plateNumber: '',
maintenanceType: '',
status: '',
dateRange: []
},
// 维护记录列表
maintenanceRecords: [
{
id: 1,
plateNumber: '渝A12345',
maintenanceType: 'regular',
description: '更换机油、机油滤芯、空气滤芯',
status: 'completed',
startDate: '2024-03-10 09:00:00',
endDate: '2024-03-10 11:30:00',
cost: 580.00,
remarks: '常规保养完成',
timeline: [
{
time: '2024-03-10 09:00:00',
content: '开始维护工作',
type: 'primary'
},
{
time: '2024-03-10 10:30:00',
content: '更换机油和滤芯',
type: 'success'
},
{
time: '2024-03-10 11:30:00',
content: '维护完成,车辆检查正常',
type: 'success'
}
]
},
{
id: 2,
plateNumber: '渝B67890',
maintenanceType: 'repair',
description: '修复制动系统故障',
status: 'in-progress',
startDate: '2024-03-15 14:00:00',
endDate: '',
cost: 0.00,
remarks: '等待配件到货',
timeline: [
{
time: '2024-03-15 14:00:00',
content: '开始故障诊断',
type: 'primary'
},
{
time: '2024-03-15 15:30:00',
content: '确认制动系统故障,等待配件',
type: 'warning'
}
]
}
],
// 车辆列表
vehicles: [
{ plateNumber: '渝A12345' },
{ plateNumber: '渝B67890' }
],
// 分页
currentPage: 1,
pageSize: 10,
total: 0,
// 加载状态
loading: false,
// 对话框
dialogVisible: false,
dialogTitle: '添加维护记录',
detailsVisible: false,
selectedRecord: null,
// 表单数据
maintenanceForm: {
plateNumber: '',
maintenanceType: '',
description: '',
status: '',
startDate: '',
endDate: '',
cost: 0,
remarks: ''
},
// 表单验证规则
rules: {
plateNumber: [
{ required: true, message: '请选择车牌号', trigger: 'change' }
],
maintenanceType: [
{ required: true, message: '请选择维护类型', trigger: 'change' }
],
description: [
{ required: true, message: '请输入维护内容', trigger: 'blur' }
],
status: [
{ required: true, message: '请选择维护状态', trigger: 'change' }
],
startDate: [
{ required: true, message: '请选择开始时间', trigger: 'change' }
]
}
}
},
methods: {
// 获取维护类型标签样式
getMaintenanceTypeTag(type) {
const typeMap = {
'regular': 'success',
'repair': 'warning',
'replacement': 'info'
};
return typeMap[type] || 'info';
},
// 获取维护类型文本
getMaintenanceTypeText(type) {
const textMap = {
'regular': '常规保养',
'repair': '故障维修',
'replacement': '零件更换'
};
return textMap[type] || type;
},
// 获取状态标签样式
getStatusType(status) {
const typeMap = {
'pending': 'info',
'in-progress': 'warning',
'completed': 'success'
};
return typeMap[status] || 'info';
},
// 获取状态文本
getStatusText(status) {
const textMap = {
'pending': '待处理',
'in-progress': '进行中',
'completed': '已完成'
};
return textMap[status] || status;
},
// 处理筛选
handleFilter() {
this.loading = true;
// TODO: 实现筛选逻辑
setTimeout(() => {
this.loading = false;
}, 500);
},
// 重置筛选
resetFilter() {
this.filterForm = {
plateNumber: '',
maintenanceType: '',
status: '',
dateRange: []
};
this.handleFilter();
},
// 显示添加对话框
showAddDialog() {
this.dialogTitle = '添加维护记录';
this.maintenanceForm = {
plateNumber: '',
maintenanceType: '',
description: '',
status: 'pending',
startDate: '',
endDate: '',
cost: 0,
remarks: ''
};
this.dialogVisible = true;
},
// 查看详情
viewDetails(record) {
this.selectedRecord = record;
this.detailsVisible = true;
},
// 编辑记录
editRecord(record) {
this.dialogTitle = '编辑维护记录';
this.maintenanceForm = { ...record };
this.dialogVisible = true;
},
// 删除记录
deleteRecord(record) {
this.$confirm('确认删除该维护记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// TODO: 实现删除逻辑
this.$message.success('删除成功');
}).catch(() => {});
},
// 提交表单
submitForm() {
this.$refs.maintenanceForm.validate((valid) => {
if (valid) {
// TODO: 实现提交逻辑
this.$message.success('保存成功');
this.dialogVisible = false;
}
});
},
// 处理分页大小变化
handleSizeChange(val) {
this.pageSize = val;
this.handleFilter();
},
// 处理页码变化
handleCurrentChange(val) {
this.currentPage = val;
this.handleFilter();
}
},
mounted() {
// 初始化数据
this.total = this.maintenanceRecords.length;
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
vehicle-maintenance.html
|
HTML
|
unknown
| 14,904
|
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>车辆追踪 - 智驭安行系统</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="./css/vehicle-tracking.css">
<link rel="icon" href="./img/logo_nobackground.png" type="image/png">
<!-- 添加高德地图 API -->
<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=f877ddba0080f921415dfd6f89b979fe"></script>
</head>
<body>
<div id="app">
<!-- 页面头部 -->
<header class="page-header">
<div class="header-left">
<h1>车辆追踪</h1>
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>车辆管理</el-breadcrumb-item>
<el-breadcrumb-item>车辆追踪</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="header-right">
<el-button-group>
<el-button type="primary" @click="refreshData">
<i class="el-icon-refresh"></i> 刷新数据
</el-button>
<el-button type="success" @click="exportData">
<i class="el-icon-download"></i> 导出数据
</el-button>
</el-button-group>
</div>
</header>
<!-- 主要内容区 -->
<div class="main-content">
<!-- 左侧车辆列表 -->
<div class="vehicle-list-panel">
<div class="panel-header">
<h3>车辆列表</h3>
<el-input
v-model="searchQuery"
placeholder="搜索车牌号"
prefix-icon="el-icon-search"
clearable>
</el-input>
</div>
<div class="vehicle-list">
<div v-for="vehicle in filteredVehicles"
:key="vehicle.id"
class="vehicle-item"
:class="{ active: selectedVehicle?.id === vehicle.id }"
@click="selectVehicle(vehicle)">
<div class="vehicle-info">
<h4>{{ vehicle.plateNumber }}</h4>
<el-tag size="small" :type="getStatusType(vehicle.status)">
{{ vehicle.status }}
</el-tag>
</div>
<div class="vehicle-details">
<span><i class="el-icon-location"></i> {{ vehicle.location }}</span>
<span><i class="el-icon-time"></i> {{ vehicle.lastUpdate }}</span>
</div>
</div>
</div>
</div>
<!-- 右侧地图和详情 -->
<div class="map-details-panel">
<!-- 地图容器 -->
<div class="map-container" id="mapContainer">
<!-- 地图将通过JavaScript加载 -->
</div>
<!-- 车辆详情卡片 -->
<div class="vehicle-details-card" v-if="selectedVehicle">
<div class="card-header">
<h3>{{ selectedVehicle.plateNumber }}</h3>
<el-tag :type="getStatusType(selectedVehicle.status)">
{{ selectedVehicle.status }}
</el-tag>
</div>
<el-descriptions :column="1" border>
<el-descriptions-item label="当前位置">
{{ selectedVehicle.location }}
</el-descriptions-item>
<el-descriptions-item label="最后更新">
{{ selectedVehicle.lastUpdate }}
</el-descriptions-item>
<el-descriptions-item label="当前速度">
{{ selectedVehicle.speed }} km/h
</el-descriptions-item>
<el-descriptions-item label="当前驾驶员">
{{ selectedVehicle.driver }}
</el-descriptions-item>
</el-descriptions>
<!-- 运行轨迹 -->
<div class="tracking-history">
<h4>运行轨迹</h4>
<el-timeline>
<el-timeline-item
v-for="(track, index) in selectedVehicle.trackingHistory"
:key="index"
:timestamp="track.time"
:type="track.type">
{{ track.location }}
</el-timeline-item>
</el-timeline>
</div>
</div>
</div>
</div>
<!-- 实时监控设置对话框 -->
<el-dialog title="监控设置" :visible.sync="settingsVisible" width="500px">
<el-form :model="monitorSettings" label-width="120px">
<el-form-item label="刷新间隔">
<el-select v-model="monitorSettings.refreshInterval">
<el-option label="5秒" value="5"></el-option>
<el-option label="10秒" value="10"></el-option>
<el-option label="30秒" value="30"></el-option>
<el-option label="1分钟" value="60"></el-option>
</el-select>
</el-form-item>
<el-form-item label="显示轨迹">
<el-switch v-model="monitorSettings.showTrack"></el-switch>
</el-form-item>
<el-form-item label="轨迹时长">
<el-select v-model="monitorSettings.trackDuration" :disabled="!monitorSettings.showTrack">
<el-option label="最近1小时" value="1"></el-option>
<el-option label="最近3小时" value="3"></el-option>
<el-option label="最近6小时" value="6"></el-option>
<el-option label="最近12小时" value="12"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="settingsVisible = false">取消</el-button>
<el-button type="primary" @click="saveSettings">确定</el-button>
</span>
</el-dialog>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data() {
return {
// 搜索查询
searchQuery: '',
// 选中的车辆
selectedVehicle: null,
// 车辆列表数据
vehicles: [
{
id: 1,
plateNumber: '渝AW2475',
status: '在线',
location: '重庆市渝中区解放碑',
lastUpdate: '2025-05-12 15:25:17',
speed: 45,
driver: '张师傅',
trackingHistory: [
{
time: '10:30:00',
location: '重庆市渝中区解放碑',
type: 'success'
},
{
time: '10:25:00',
location: '重庆市渝中区较场口',
type: 'info'
}
]
},
{
id: 2,
plateNumber: '渝BW7785',
status: '离线',
location: '重庆市江北区观音桥',
lastUpdate: '2024-03-15 09:15:00',
speed: 0,
driver: '李四',
trackingHistory: [
{
time: '09:15:00',
location: '重庆市江北区观音桥',
type: 'warning'
}
]
}
],
// 监控设置
settingsVisible: false,
monitorSettings: {
refreshInterval: '10',
showTrack: true,
trackDuration: '1'
},
// 用户自己的定位点
userLocationMarker: null
}
},
computed: {
// 过滤后的车辆列表
filteredVehicles() {
if (!this.searchQuery) return this.vehicles;
return this.vehicles.filter(vehicle =>
vehicle.plateNumber.toLowerCase().includes(this.searchQuery.toLowerCase())
);
}
},
methods: {
// 获取状态类型
getStatusType(status) {
const typeMap = {
'在线': 'success',
'离线': 'info',
'维修中': 'warning'
};
return typeMap[status] || 'info';
},
// 选择车辆
selectVehicle(vehicle) {
this.selectedVehicle = vehicle;
if (vehicle.position) {
this.map.setCenter(vehicle.position);
this.map.setZoom(15);
}
},
// 刷新数据
refreshData() {
this.$message.success('数据已刷新');
// TODO: 实现数据刷新逻辑
},
// 导出数据
exportData() {
this.$message.success('数据导出中...');
// TODO: 实现数据导出逻辑
},
// 保存设置
saveSettings() {
this.$message.success('设置已保存');
this.settingsVisible = false;
// 更新刷新间隔
clearInterval(this.refreshInterval);
this.startAutoRefresh();
},
// 初始化地图
initMap() {
// 先初始化地图,默认重庆
this.map = new AMap.Map('mapContainer', {
zoom: 11,
center: [106.551556, 29.563009], // 默认重庆
viewMode: '3D'
});
// 添加地图控件
this.map.addControl(new AMap.Scale());
this.map.addControl(new AMap.ToolBar());
this.map.addControl(new AMap.MapType());
// 调用高德IP定位接口
fetch('https://restapi.amap.com/v3/ip?key=f877ddba0080f921415dfd6f89b979fe')
.then(res => res.json())
.then(data => {
console.log('IP定位返回:', data); // 调试用
if (data.status === '1' && data.rectangle) {
const [leftBottom, rightTop] = data.rectangle.split(';');
const [lng1, lat1] = leftBottom.split(',').map(Number);
const [lng2, lat2] = rightTop.split(',').map(Number);
const centerLng = (lng1 + lng2) / 2;
const centerLat = (lat1 + lat2) / 2;
this.map.setCenter([centerLng, centerLat]);
this.map.setZoom(15); // 强制放大
// 标注用户自己的定位点
if (!this.userLocationMarker) {
this.userLocationMarker = new AMap.Marker({
position: [centerLng, centerLat],
icon: new AMap.Icon({
size: new AMap.Size(36, 36),
image: 'https://webapi.amap.com/theme/v1.3/markers/n/loc.png',
imageSize: new AMap.Size(36, 36)
}),
title: '我的位置',
offset: new AMap.Pixel(-18, -36)
});
this.map.add(this.userLocationMarker);
} else {
this.userLocationMarker.setPosition([centerLng, centerLat]);
}
console.log('已添加定位点', centerLng, centerLat);
} else {
this.$message.warning('定位失败,已使用默认城市');
}
})
.catch(() => {
this.$message.warning('定位失败,已使用默认城市');
});
},
// 更新车辆位置
updateVehiclePosition(vehicle) {
if (!vehicle.marker) {
// 创建车辆标记
vehicle.marker = new AMap.Marker({
position: vehicle.position,
icon: new AMap.Icon({
size: new AMap.Size(32, 32),
image: './img/car-icon.png',
imageSize: new AMap.Size(32, 32)
}),
angle: vehicle.angle || 0,
offset: new AMap.Pixel(-16, -16)
});
this.map.add(vehicle.marker);
} else {
// 更新现有标记位置
vehicle.marker.setPosition(vehicle.position);
vehicle.marker.setAngle(vehicle.angle || 0);
}
// 如果显示轨迹
if (this.monitorSettings.showTrack) {
if (!vehicle.polyline) {
vehicle.polyline = new AMap.Polyline({
path: [vehicle.position],
strokeColor: '#667eea',
strokeWeight: 4,
strokeOpacity: 0.8
});
this.map.add(vehicle.polyline);
} else {
const path = vehicle.polyline.getPath();
path.push(vehicle.position);
vehicle.polyline.setPath(path);
}
}
},
// 开始自动刷新
startAutoRefresh() {
this.refreshInterval = setInterval(() => {
this.refreshVehiclePositions();
}, this.monitorSettings.refreshInterval * 1000);
},
// 刷新车辆位置
refreshVehiclePositions() {
// 模拟获取实时位置数据
this.vehicles.forEach(vehicle => {
// 这里应该替换为实际的API调用
const randomOffset = () => (Math.random() - 0.5) * 0.01;
vehicle.position = [
106.551556 + randomOffset(),
29.563009 + randomOffset()
];
vehicle.angle = Math.random() * 360;
this.updateVehiclePosition(vehicle);
});
}
},
mounted() {
// 初始化地图
this.initMap();
// 启动定时刷新
this.startAutoRefresh();
}
});
</script>
</body>
</html>
|
2301_77385112/C_R_A_I_C___zhi_yu_an_xing
|
vehicle-tracking.html
|
HTML
|
unknown
| 11,949
|
#!/bin/bash
# 定义下载地址和文件名
DOWNLOAD_URL="https://cangjie-lang.cn/v1/files/auth/downLoad?nsId=142267&fileName=Cangjie-0.53.13-linux_x64.tar.gz&objectKey=6719f1eb3af6947e3c6af327"
FILE_NAME="Cangjie-0.53.13-linux_x64.tar.gz"
# 检查 cangjie 工具链是否已安装
echo "确保 cangjie 工具链已安装..."
if ! command -v cjc -v &> /dev/null
then
echo "cangjie工具链 未安装,尝试进行安装..."
# 下载文件
echo "Downloading Cangjie compiler..."
curl -L -o "$FILE_NAME" "$DOWNLOAD_URL"
# 检查下载是否成功
if [ $? -eq 0 ]; then
echo "Download completed successfully."
else
echo "Download failed."
exit 1
fi
# 解压文件
echo "Extracting $FILE_NAME..."
tar -xvf "$FILE_NAME"
# 检查解压是否成功
if [ $? -eq 0 ]; then
echo "Extraction completed successfully."
else
echo "Extraction failed."
exit 1
fi
# 检查 envsetup.sh 是否存在并进行 source
if [[ -f "cangjie/envsetup.sh" ]]; then
echo "envsetup.sh found!"
source cangjie/envsetup.sh
else
echo "envsetup.sh not found!"
exit 1
fi
fi
# 检查 openEuler 防火墙状态
echo "检查 openEuler 防火墙状态..."
if systemctl status firewalld | grep "active (running)" &> /dev/null; then
echo "防火墙已开启,尝试开放 21 端口..."
firewall-cmd --zone=public --add-port=21/tcp --permanent
firewall-cmd --reload
echo "21 端口已开放。"
else
echo "防火墙未开启,无需开放端口。"
fi
# 编译ftp_server
echo "正在编译 ftp_server..."
cjpm build
# 检查编译是否成功
if [ $? -eq 0 ]; then
echo "编译成功."
else
echo "编译失败."
exit 1
fi
# 运行 ftp_server
echo "正在启动 ftp 服务器..."
cjpm run
|
2302_81918214/Cangjie-Examples_4105
|
FTP/run-ftp.sh
|
Shell
|
apache-2.0
| 1,967
|
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>Hello Cangjie!</div>
<p></p>
<script>
let xhr = new XMLHttpRequest()
xhr.open("POST", "/Hello", true)
xhr.onreadystatechange = () => {
if(xhr.readyState == 4 && xhr.status == 200){
let res = JSON.parse(xhr.responseText)
document.body.innerHTML += `<div>${res.msg}</div>`
}
}
xhr.send(JSON.stringify({
name: "Chen",
age: 999
}))
</script>
</body>
</html>
|
2302_81918214/Cangjie-Examples_4105
|
HTTPServer/index.html
|
HTML
|
apache-2.0
| 687
|
#include "head.h"
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0])) // 计算数组长度的宏定义
// 模块1:演示基本数据类型和运算符
int demonstrate_basic_operations(int a, int b)
{
//printf("%d + %d = %d\n", a, b, a + b);
return a + b;
}
// 模块2:演示指针操作
int demonstrate_pointer_operations(int *ptr)
{
int a = 10;
ptr = &a;
//printf("Pointer value: %d\n", *ptr);
return *ptr;
}
// 模块3:演示数组和指针
int demonstrate_array_and_pointer(int arrs[5],int *ptr)
{
ptr = arrs;
return *(ptr + 2);
// printf("Array element via pointer: %d\n", *(numbers + 2));
}
// 模块4:演示条件判断和循环
void demonstrate_conditions_and_loops()
{
int a = 10;
if (a > 5)
{
printf("a is greater than 5\n");
}
int numbers[] = {1, 2, 3};
for (int i = 0; i < ARRAY_LEN(numbers); i++)
{
printf("Number %d: %d\n", i, numbers[i]);
}
}
// 模块5:演示指针数组
char* demonstrate_pointer_array(char *names[3])
{
names[0] = "Tom";
names[1] = "Jerry";
names[2] = "Spike";
return names[0];
}
void show(char *str)
{
printf("%s\n", str);
}
|
2302_81918214/Cangjie-Examples_4105
|
cjCLI/src/C/examples.c
|
C
|
apache-2.0
| 1,184
|
#ifndef HEAD_H
#define HEAD_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
|
2302_81918214/Cangjie-Examples_4105
|
cjCLI/src/C/head.h
|
C
|
apache-2.0
| 97
|
#include "head.h"
// 全局变量定义
int STUNUM = 0;
int INDEX = 0;
// 结构体声明
typedef struct {
char name[50];
int age;
float score;
} Student;
Student* createStudent(){
Student* student = (Student*)malloc(sizeof(Student));
return student;
}
// 1.学生信息初始化
void initStudent(Student* s, const char* name, int age, float score) {
strncpy(s->name, name, sizeof(s->name) - 1);
s->name[sizeof(s->name) - 1] = '\0'; // 确保字符串终止
s->age = age;
s->score = score;
STUNUM++; // 每次初始化学生信息时,学生数量+1
}
// 2.打印学生信息
char* toString(Student* s) {
static char buffer[100];
snprintf(buffer, sizeof(buffer), "Name: %s, Age: %d, Score: %.2f", s->name, s->age, s->score);
return buffer;
}
// 3.创建学生数组
Student** createStudentArray(int size) {
Student** students = (Student**)malloc(size * sizeof(Student*));
for (int i = 0; i < size; i++) {
students[i] = createStudent();
}
return students;
}
// 将学生信息添加到学生数组中
void addStudentToArray(Student** students, Student* student) {
if (INDEX < 0 || INDEX >= STUNUM) {
printf("Index out of bounds\n");
return;
}
students[INDEX] = student; // 将学生信息添加到数组中
INDEX++;
}
// 5.获取学生信息
void printStudentArray(Student** students) {
for (int i = 0; i < INDEX; i++) {
printf("%s\n", toString(students[i]));
}
}
// 4.释放学生数组
void freeStudentArray(Student** students, int size) {
for (int i = 0; i < size; i++) {
free(students[i]);
}
free(students);
}
// 8.获取学生数量
int getStudentCount() {
return STUNUM;
}
|
2302_81918214/Cangjie-Examples_4105
|
cjCLI/src/C/struct.c
|
C
|
apache-2.0
| 1,741
|
module.exports = {
parserPreset: "conventional-changelog-conventionalcommits",
rules: {
"subject-empty": [2, "never"],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
"patch",
],
],
},
};
|
2302_79757062/hrms
|
commitlint.config.js
|
JavaScript
|
agpl-3.0
| 407
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, viewport-fit=cover maximum-scale=1.0, user-scalable=no"
/>
<title>Frappe HR</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Frappe HR" />
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
<!-- required for setting the status bar bg as white -->
<meta name="theme-color" content="#fff" />
<!-- PWA -->
<link
rel="icon"
type="image/png"
sizes="196x196"
href="/assets/hrms/manifest/favicon-196.png"
/>
<link
rel="apple-touch-icon"
href="/assets/hrms/manifest/apple-icon-180.png"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2048-2732.jpg"
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2732-2048.jpg"
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1668-2388.jpg"
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2388-1668.jpg"
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1536-2048.jpg"
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2048-1536.jpg"
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1668-2224.jpg"
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2224-1668.jpg"
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1620-2160.jpg"
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2160-1620.jpg"
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1290-2796.jpg"
media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2796-1290.jpg"
media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1179-2556.jpg"
media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2556-1179.jpg"
media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1284-2778.jpg"
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2778-1284.jpg"
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1170-2532.jpg"
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2532-1170.jpg"
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1125-2436.jpg"
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2436-1125.jpg"
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1242-2688.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2688-1242.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-828-1792.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1792-828.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1242-2208.jpg"
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-2208-1242.jpg"
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-750-1334.jpg"
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1334-750.jpg"
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-640-1136.jpg"
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/assets/hrms/manifest/apple-splash-1136-640.jpg"
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
</head>
<body class="antialiased">
<div id="app"></div>
<div id="modals"></div>
<div id="popovers"></div>
<script>
window.csrf_token = "{{ csrf_token }}"
window.site_name = '{{ site_name }}'
if (!window.frappe) window.frappe = {}
frappe.boot = {{ boot }}
</script>
<script type="module" src="/src/main.js"></script>
</body>
</html>
|
2302_79757062/hrms
|
frontend/index.html
|
HTML
|
agpl-3.0
| 8,070
|
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
|
2302_79757062/hrms
|
frontend/postcss.config.js
|
JavaScript
|
agpl-3.0
| 76
|
import { initializeApp } from "firebase/app"
import {
getMessaging,
getToken,
isSupported,
deleteToken,
onMessage as onFCMMessage,
} from "firebase/messaging"
class FrappePushNotification {
static get relayServerBaseURL() {
return window.frappe?.boot.push_relay_server_url
}
// Type definitions
/**
* Web Config
* FCM web config to initialize firebase app
*
* @typedef {object} webConfigType
* @property {string} projectId
* @property {string} appId
* @property {string} apiKey
* @property {string} authDomain
* @property {string} messagingSenderId
*/
/**
* Constructor
*
* @param {string} projectName
*/
constructor(projectName) {
// client info
this.projectName = projectName
/** @type {webConfigType | null} */
this.webConfig = null
this.vapidPublicKey = ""
this.token = null
// state
this.initialized = false
this.messaging = null
/** @type {ServiceWorkerRegistration | null} */
this.serviceWorkerRegistration = null
// event handlers
this.onMessageHandler = null
}
/**
* Initialize notification service client
*
* @param {ServiceWorkerRegistration} serviceWorkerRegistration - Service worker registration object
* @returns {Promise<void>}
*/
async initialize(serviceWorkerRegistration) {
if (this.initialized) {
return
}
this.serviceWorkerRegistration = serviceWorkerRegistration
const config = await this.fetchWebConfig()
this.messaging = getMessaging(initializeApp(config))
this.onMessage(this.onMessageHandler)
this.initialized = true
}
/**
* Append config to service worker URL
*
* @param {string} url - Service worker URL
* @param {string} parameter_name - Parameter name to add config
* @returns {Promise<string>} - Service worker URL with config
*/
async appendConfigToServiceWorkerURL(url, parameter_name = "config") {
let config = await this.fetchWebConfig()
const encode_config = encodeURIComponent(JSON.stringify(config))
return `${url}?${parameter_name}=${encode_config}`
}
/**
* Fetch web config of the project
*
* @returns {Promise<webConfigType>}
*/
async fetchWebConfig() {
if (this.webConfig !== null && this.webConfig !== undefined) {
return this.webConfig
}
try {
let url = `${FrappePushNotification.relayServerBaseURL}/api/method/notification_relay.api.get_config?project_name=${this.projectName}`
let response = await fetch(url)
let response_json = await response.json()
this.webConfig = response_json.config
return this.webConfig
} catch (e) {
throw new Error(
"Push Notification Relay is not configured properly on your site."
)
}
}
/**
* Fetch VAPID public key
*
* @returns {Promise<string>}
*/
async fetchVapidPublicKey() {
if (this.vapidPublicKey !== "") {
return this.vapidPublicKey
}
try {
let url = `${FrappePushNotification.relayServerBaseURL}/api/method/notification_relay.api.get_config?project_name=${this.projectName}`
let response = await fetch(url)
let response_json = await response.json()
this.vapidPublicKey = response_json.vapid_public_key
return this.vapidPublicKey
} catch (e) {
throw new Error(
"Push Notification Relay is not configured properly on your site."
)
}
}
/**
* Register on message handler
*
* @param {function(
* {
* data:{
* title: string,
* body: string,
* click_action: string|null,
* }
* }
* )} callback - Callback function to handle message
*/
onMessage(callback) {
if (callback == null) return
this.onMessageHandler = callback
if (this.messaging == null) return
onFCMMessage(this.messaging, this.onMessageHandler)
}
/**
* Check if notification is enabled
*
* @returns {boolean}
*/
isNotificationEnabled() {
return localStorage.getItem(`firebase_token_${this.projectName}`) !== null
}
/**
* Enable notification
* This will return notification permission status and token
*
* @returns {Promise<{permission_granted: boolean, token: string}>}
*/
async enableNotification() {
if (!(await isSupported())) {
throw new Error("Push notifications are not supported on your device")
}
// Return if token already presence in the instance
if (this.token != null) {
return {
permission_granted: true,
token: this.token,
}
}
// ask for permission
const permission = await Notification.requestPermission()
if (permission !== "granted") {
return {
permission_granted: false,
token: "",
}
}
// check in local storage for old token
let oldToken = localStorage.getItem(`firebase_token_${this.projectName}`)
const vapidKey = await this.fetchVapidPublicKey()
let newToken = await getToken(this.messaging, {
vapidKey: vapidKey,
serviceWorkerRegistration: this.serviceWorkerRegistration,
})
// register new token if token is changed
if (oldToken !== newToken) {
// unsubscribe old token
if (oldToken) {
await this.unregisterTokenHandler(oldToken)
}
// subscribe push notification and register token
let isSubscriptionSuccessful = await this.registerTokenHandler(newToken)
if (isSubscriptionSuccessful === false) {
throw new Error("Failed to subscribe to push notification")
}
// save token to local storage
localStorage.setItem(`firebase_token_${this.projectName}`, newToken)
}
this.token = newToken
return {
permission_granted: true,
token: newToken,
}
}
/**
* Disable notification
* This will delete token from firebase and unsubscribe from push notification
*
* @returns {Promise<void>}
*/
async disableNotification() {
if (this.token == null) {
// try to fetch token from local storage
this.token = localStorage.getItem(`firebase_token_${this.projectName}`)
if (this.token == null || this.token === "") {
return
}
}
// delete old token from firebase
try {
await deleteToken(this.messaging)
} catch (e) {
console.error("Failed to delete token from firebase")
console.error(e)
}
try {
await this.unregisterTokenHandler(this.token)
} catch {
console.error("Failed to unsubscribe from push notification")
console.error(e)
}
// remove token
localStorage.removeItem(`firebase_token_${this.projectName}`)
this.token = null
}
/**
* Register Token Handler
*
* @param {string} token - FCM token returned by {@link enableNotification} method
* @returns {promise<boolean>}
*/
async registerTokenHandler(token) {
try {
let response = await fetch(
"/api/method/frappe.push_notification.subscribe?fcm_token=" +
token +
"&project_name=" +
this.projectName,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
)
return response.status === 200
} catch (e) {
console.error(e)
return false
}
}
/**
* Unregister Token Handler
*
* @param {string} token - FCM token returned by `enableNotification` method
* @returns {promise<boolean>}
*/
async unregisterTokenHandler(token) {
try {
let response = await fetch(
"/api/method/frappe.push_notification.unsubscribe?fcm_token=" +
token +
"&project_name=" +
this.projectName,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
)
return response.status === 200
} catch (e) {
console.error(e)
return false
}
}
}
export default FrappePushNotification
|
2302_79757062/hrms
|
frontend/public/frappe-push-notification.js
|
JavaScript
|
agpl-3.0
| 7,425
|
<template>
<ion-app>
<ion-router-outlet id="main-content" />
<Toasts />
<InstallPrompt />
</ion-app>
</template>
<script setup>
import { onMounted } from "vue"
import { IonApp, IonRouterOutlet } from "@ionic/vue"
import { Toasts } from "frappe-ui"
import InstallPrompt from "@/components/InstallPrompt.vue"
import { showNotification } from "@/utils/pushNotifications"
onMounted(() => {
window?.frappePushNotification?.onMessage((payload) => {
showNotification(payload)
})
})
</script>
|
2302_79757062/hrms
|
frontend/src/App.vue
|
Vue
|
agpl-3.0
| 502
|
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 100;
font-display: swap;
src: url("Inter-Thin.woff2?v=3.12") format("woff2"),
url("Inter-Thin.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 100;
font-display: swap;
src: url("Inter-ThinItalic.woff2?v=3.12") format("woff2"),
url("Inter-ThinItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 200;
font-display: swap;
src: url("Inter-ExtraLight.woff2?v=3.12") format("woff2"),
url("Inter-ExtraLight.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 200;
font-display: swap;
src: url("Inter-ExtraLightItalic.woff2?v=3.12") format("woff2"),
url("Inter-ExtraLightItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("Inter-Light.woff2?v=3.12") format("woff2"),
url("Inter-Light.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 300;
font-display: swap;
src: url("Inter-LightItalic.woff2?v=3.12") format("woff2"),
url("Inter-LightItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("Inter-Regular.woff2?v=3.12") format("woff2"),
url("Inter-Regular.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("Inter-Italic.woff2?v=3.12") format("woff2"),
url("Inter-Italic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("Inter-Medium.woff2?v=3.12") format("woff2"),
url("Inter-Medium.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 500;
font-display: swap;
src: url("Inter-MediumItalic.woff2?v=3.12") format("woff2"),
url("Inter-MediumItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("Inter-SemiBold.woff2?v=3.12") format("woff2"),
url("Inter-SemiBold.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 600;
font-display: swap;
src: url("Inter-SemiBoldItalic.woff2?v=3.12") format("woff2"),
url("Inter-SemiBoldItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("Inter-Bold.woff2?v=3.12") format("woff2"),
url("Inter-Bold.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 700;
font-display: swap;
src: url("Inter-BoldItalic.woff2?v=3.12") format("woff2"),
url("Inter-BoldItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 800;
font-display: swap;
src: url("Inter-ExtraBold.woff2?v=3.12") format("woff2"),
url("Inter-ExtraBold.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 800;
font-display: swap;
src: url("Inter-ExtraBoldItalic.woff2?v=3.12") format("woff2"),
url("Inter-ExtraBoldItalic.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("Inter-Black.woff2?v=3.12") format("woff2"),
url("Inter-Black.woff?v=3.12") format("woff");
}
@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 900;
font-display: swap;
src: url("Inter-BlackItalic.woff2?v=3.12") format("woff2"),
url("Inter-BlackItalic.woff?v=3.12") format("woff");
}
|
2302_79757062/hrms
|
frontend/src/assets/Inter/inter.css
|
CSS
|
agpl-3.0
| 3,808
|
<template>
<ion-page>
<ion-header class="ion-no-border">
<div class="w-full sm:w-96">
<div class="flex flex-col bg-white shadow-sm p-4">
<div class="flex flex-row justify-between items-center">
<div class="flex flex-row items-center gap-2">
<h2 class="text-xl font-bold text-gray-900">
{{ props.pageTitle }}
</h2>
</div>
<div class="flex flex-row items-center gap-3 ml-auto">
<router-link
:to="{ name: 'Notifications' }"
v-slot="{ navigate }"
class="flex flex-col items-center"
>
<span class="relative inline-block" @click="navigate">
<FeatherIcon name="bell" class="h-6 w-6" />
<span
v-if="unreadNotificationsCount.data"
class="absolute top-0 right-0.5 inline-block w-2 h-2 bg-red-600 rounded-full border border-white"
>
</span>
</span>
</router-link>
<router-link
:to="{ name: 'Profile' }"
class="flex flex-col items-center"
>
<Avatar
:image="user.data.user_image"
:label="user.data.first_name"
size="xl"
/>
</router-link>
</div>
</div>
</div>
</div>
</ion-header>
<ion-content class="ion-no-padding">
<div class="flex flex-col h-screen w-screen sm:w-96">
<slot name="body"></slot>
</div>
</ion-content>
</ion-page>
</template>
<script setup>
import { IonHeader, IonContent, IonPage } from "@ionic/vue"
import { FeatherIcon, Avatar } from "frappe-ui"
import { unreadNotificationsCount } from "@/data/notifications"
import { inject } from "vue"
const user = inject("$user")
const props = defineProps({
pageTitle: {
type: String,
required: false,
default: "Frappe HR",
},
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/BaseLayout.vue
|
Vue
|
agpl-3.0
| 1,786
|
<template>
<ion-tab-bar
slot="bottom"
class="bg-white shadow-md sm:w-96 py-2 pb-2 standalone:pb-safe-bottom"
>
<ion-tab-button
v-for="item in tabItems"
:key="item.title"
:tab="item.title"
:href="item.route"
:class="[
'bg-white text-xs space-y-1.5 !hover:border-gray-300 !hover:text-gray-700 transition active:scale-95',
route.path === item.route
? 'border-gray-900 text-gray-800 font-semibold'
: 'text-gray-600 font-normal',
]"
>
<component :is="item.icon" class="h-5 w-5" />
<div>{{ item.title }}</div>
</ion-tab-button>
</ion-tab-bar>
</template>
<script setup>
import { useRoute } from "vue-router"
import { IonTabBar, IonTabButton, IonLabel } from "@ionic/vue"
import HomeIcon from "@/components/icons/HomeIcon.vue"
import LeaveIcon from "@/components/icons/LeaveIcon.vue"
import ExpenseIcon from "@/components/icons/ExpenseIcon.vue"
import SalaryIcon from "@/components/icons/SalaryIcon.vue"
const route = useRoute()
const tabItems = [
{
icon: HomeIcon,
title: "Home",
route: "/home",
},
{
icon: LeaveIcon,
title: "Leaves",
route: "/dashboard/leaves",
},
{
icon: ExpenseIcon,
title: "Expenses",
route: "/dashboard/expense-claims",
},
{
icon: SalaryIcon,
title: "Salary",
route: "/dashboard/salary-slips",
},
]
</script>
|
2302_79757062/hrms
|
frontend/src/components/BottomTabs.vue
|
Vue
|
agpl-3.0
| 1,317
|
<template>
<div class="flex flex-col bg-white rounded w-full py-6 px-4 border-none">
<h2 class="text-lg font-bold text-gray-900">Hey, {{ employee?.data?.first_name }} 👋</h2>
<template v-if="settings.data?.allow_employee_checkin_from_mobile_app">
<div class="font-medium text-sm text-gray-500 mt-1.5" v-if="lastLog">
Last {{ lastLogType }} was at {{ lastLogTime }}
</div>
<Button
class="mt-4 mb-1 drop-shadow-sm py-5 text-base"
id="open-checkin-modal"
@click="handleEmployeeCheckin"
>
<template #prefix>
<FeatherIcon
:name="nextAction.action === 'IN' ? 'arrow-right-circle' : 'arrow-left-circle'"
class="w-4"
/>
</template>
{{ nextAction.label }}
</Button>
</template>
<div v-else class="font-medium text-sm text-gray-500 mt-1.5">
{{ dayjs().format("ddd, D MMMM, YYYY") }}
</div>
</div>
<ion-modal
v-if="settings.data?.allow_employee_checkin_from_mobile_app"
ref="modal"
trigger="open-checkin-modal"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
>
<div class="h-120 w-full flex flex-col items-center justify-center gap-5 p-4 mb-5">
<div class="flex flex-col gap-1.5 mt-2 items-center justify-center">
<div class="font-bold text-xl">
{{ dayjs(checkinTimestamp).format("hh:mm:ss a") }}
</div>
<div class="font-medium text-gray-500 text-sm">
{{ dayjs().format("D MMM, YYYY") }}
</div>
</div>
<template v-if="settings.data?.allow_geolocation_tracking">
<span v-if="locationStatus" class="font-medium text-gray-500 text-sm">
{{ locationStatus }}
</span>
<div class="rounded border-4 translate-z-0 block overflow-hidden w-full h-170">
<iframe
width="100%"
height="170"
frameborder="0"
scrolling="no"
marginheight="0"
marginwidth="0"
style="border: 0"
:src="`https://maps.google.com/maps?q=${latitude},${longitude}&hl=en&z=15&output=embed`"
>
</iframe>
</div>
</template>
<Button variant="solid" class="w-full py-5 text-sm" @click="submitLog(nextAction.action)">
Confirm {{ nextAction.label }}
</Button>
</div>
</ion-modal>
</template>
<script setup>
import { createResource, createListResource, toast, FeatherIcon } from "frappe-ui"
import { computed, inject, ref, onMounted, onBeforeUnmount } from "vue"
import { IonModal, modalController } from "@ionic/vue"
const DOCTYPE = "Employee Checkin"
const socket = inject("$socket")
const employee = inject("$employee")
const dayjs = inject("$dayjs")
const checkinTimestamp = ref(null)
const latitude = ref(0)
const longitude = ref(0)
const locationStatus = ref("")
const settings = createResource({
url: "hrms.api.get_hr_settings",
auto: true,
})
const checkins = createListResource({
doctype: DOCTYPE,
fields: ["name", "employee", "employee_name", "log_type", "time", "device_id"],
filters: {
employee: employee.data.name,
},
orderBy: "time desc",
})
checkins.reload()
const lastLog = computed(() => {
if (checkins.list.loading || !checkins.data) return {}
return checkins.data[0]
})
const lastLogType = computed(() => {
return lastLog?.value?.log_type === "IN" ? "check-in" : "check-out"
})
const nextAction = computed(() => {
return lastLog?.value?.log_type === "IN"
? { action: "OUT", label: "Check Out" }
: { action: "IN", label: "Check In" }
})
const lastLogTime = computed(() => {
const timestamp = lastLog?.value?.time
const formattedTime = dayjs(timestamp).format("hh:mm a")
if (dayjs(timestamp).isToday()) return formattedTime
else if (dayjs(timestamp).isYesterday()) return `${formattedTime} yesterday`
else if (dayjs(timestamp).isSame(dayjs(), "year"))
return `${formattedTime} on ${dayjs(timestamp).format("D MMM")}`
return `${formattedTime} on ${dayjs(timestamp).format("D MMM, YYYY")}`
})
function handleLocationSuccess(position) {
latitude.value = position.coords.latitude
longitude.value = position.coords.longitude
locationStatus.value = `
Latitude: ${Number(latitude.value).toFixed(5)}°,
Longitude: ${Number(longitude.value).toFixed(5)}°
`
}
function handleLocationError(error) {
locationStatus.value = "Unable to retrieve your location"
if (error) locationStatus.value += `: ERROR(${error.code}): ${error.message}`
}
const fetchLocation = () => {
if (!navigator.geolocation) {
locationStatus.value = "Geolocation is not supported by your current browser"
} else {
locationStatus.value = "Locating..."
navigator.geolocation.getCurrentPosition(handleLocationSuccess, handleLocationError)
}
}
const handleEmployeeCheckin = () => {
checkinTimestamp.value = dayjs().format("YYYY-MM-DD HH:mm:ss")
if (settings.data?.allow_geolocation_tracking) {
fetchLocation()
}
}
const submitLog = (logType) => {
const action = logType === "IN" ? "Check-in" : "Check-out"
checkins.insert.submit(
{
employee: employee.data.name,
log_type: logType,
time: checkinTimestamp.value,
latitude: latitude.value,
longitude: longitude.value,
},
{
onSuccess() {
modalController.dismiss()
toast({
title: "Success",
text: `${action} successful!`,
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
},
onError() {
toast({
title: "Error",
text: `${action} failed!`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
},
}
)
}
onMounted(() => {
socket.emit("doctype_subscribe", DOCTYPE)
socket.on("list_update", (data) => {
if (data.doctype == DOCTYPE) {
checkins.reload()
}
})
})
onBeforeUnmount(() => {
socket.emit("doctype_unsubscribe", DOCTYPE)
socket.off("list_update")
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/CheckInPanel.vue
|
Vue
|
agpl-3.0
| 5,706
|
<template>
<ion-modal
ref="modal"
:trigger="trigger"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
:backdrop-breakpoint="1"
:is-open="isOpen"
@willPresent="showModalBackdrop = true"
@willDismiss="showModalBackdrop = false"
@didDismiss="() => emit('did-dismiss')"
>
<slot name="actionSheet"></slot>
</ion-modal>
<!-- backdrop -->
<div
v-if="showModalBackdrop"
class="fixed inset-0 z-[10000] !mt-0 bg-black opacity-30 cursor-pointer"
@click="() => modalController.dismiss()"
></div>
</template>
<script setup>
/**
* Problem: ion-modal traps focus inside the modal making controls like autocomplete unusable inside it
* @see https://github.com/ionic-team/ionic-framework/issues/24646
* This custom ion-modal disables backdrop using backdrop-breakpoint=1 and we add a custom backdrop
*/
import { ref } from "vue"
import { IonModal, modalController } from "@ionic/vue"
const props = defineProps({
trigger: {
type: String,
required: false,
},
isOpen: {
type: Boolean,
required: false,
},
})
const emit = defineEmits(["did-dismiss"])
const showModalBackdrop = ref(false)
</script>
|
2302_79757062/hrms
|
frontend/src/components/CustomIonModal.vue
|
Vue
|
agpl-3.0
| 1,125
|
<template>
<div
class="flex flex-col bg-white rounded mt-5 overflow-auto"
v-if="props.items?.length"
>
<router-link
v-for="link in props.items"
:key="link.name"
:to="{ name: 'EmployeeAdvanceDetailView', params: { id: link.name } }"
class="flex flex-row p-3.5 items-center justify-between border-b cursor-pointer"
>
<EmployeeAdvanceItem :doc="link" />
</router-link>
<router-link
:to="{ name: 'EmployeeAdvanceFormView' }"
v-slot="{ navigate }"
>
<div class="flex flex-col bg-white w-full py-5 px-3.5 mt-0 border-none">
<Button @click="navigate" variant="subtle" class="py-5 text-base">
Request an Advance
</Button>
</div>
</router-link>
</div>
<EmptyState message="You have no advances" v-else />
</template>
<script setup>
import EmployeeAdvanceItem from "@/components/EmployeeAdvanceItem.vue"
const props = defineProps({
items: {
type: Array,
},
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/EmployeeAdvanceBalance.vue
|
Vue
|
agpl-3.0
| 927
|
<template>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<EmployeeAdvanceIcon class="h-5 w-5 mt-[3px] text-gray-500" />
<div class="flex flex-col items-start gap-1">
<div
v-if="props.doc.balance_amount"
class="text-lg font-bold text-gray-800 leading-6"
>
{{ `${currency} ${props.doc.balance_amount} /` }}
<span class="text-gray-600">
{{ `${currency} ${props.doc.paid_amount}` }}
</span>
</div>
<div v-else class="text-lg font-bold text-gray-800 leading-6">
{{ `${currency} ${props.doc.advance_amount}` }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ props.doc.purpose }}
</span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap">
{{ postingDate }}
</span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<Badge
variant="outline"
:theme="colorMap[status]"
:label="status"
size="md"
/>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
<div
v-if="props.isTeamRequest"
class="flex flex-row items-center gap-2 pl-8"
>
<EmployeeAvatar :employeeID="props.doc.employee" />
<div class="text-sm text-gray-600 grow">
{{ props.doc.employee_name }}
</div>
</div>
</div>
</template>
<script setup>
import { FeatherIcon, Badge } from "frappe-ui"
import { computed, inject } from "vue"
import { getCurrencySymbol } from "@/data/currencies"
import EmployeeAvatar from "@/components/EmployeeAvatar.vue"
import EmployeeAdvanceIcon from "@/components/icons/EmployeeAdvanceIcon.vue"
const dayjs = inject("$dayjs")
const props = defineProps({
doc: {
type: Object,
},
isTeamRequest: {
type: Boolean,
default: false,
},
workflowStateField: {
type: String,
required: false,
},
})
const colorMap = {
Paid: "green",
Unpaid: "orange",
Claimed: "blue",
Returned: "gray",
"Partly Claimed and Returned": "orange",
}
const currency = computed(() => getCurrencySymbol(props.doc.currency))
const postingDate = computed(() => {
return dayjs(props.doc.posting_date).format("D MMM")
})
const status = computed(() => {
return props.workflowStateField
? props.doc[props.workflowStateField]
: props.doc.status
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/EmployeeAdvanceItem.vue
|
Vue
|
agpl-3.0
| 2,460
|
<template>
<div v-if="showLabel" class="flex flex-row items-center gap-2">
<Avatar
v-if="employee"
:label="employee?.employee_name"
:image="employee?.image"
:size="props.size"
/>
<div class="text-base text-gray-800 grow">
{{ employee?.employee_name }}
</div>
</div>
<Avatar
v-else
:label="employee?.employee_name"
:image="employee?.image"
:size="props.size"
/>
</template>
<script setup>
import { computed } from "vue"
import { Avatar } from "frappe-ui"
import { getEmployeeInfo, getEmployeeInfoByUserID } from "@/data/employees"
const props = defineProps({
employeeID: {
type: String,
required: false,
},
userID: {
type: String,
required: false,
},
size: {
type: String,
default: "sm",
},
showLabel: {
type: Boolean,
default: false,
},
})
const employee = computed(() => {
if (props.employeeID) {
return getEmployeeInfo(props.employeeID)
} else if (props.userID) {
return getEmployeeInfoByUserID(props.userID)
}
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/EmployeeAvatar.vue
|
Vue
|
agpl-3.0
| 996
|
<template>
<div
class="flex flex-col items-center rounded p-5 text-sm text-gray-600"
:class="[
props.isTableField ? 'border-2 border-dashed border-gray-300 mt-5' : '',
]"
>
{{ props.message }}
</div>
</template>
<script setup>
const props = defineProps({
message: { type: String },
isTableField: { type: Boolean, default: false },
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/EmptyState.vue
|
Vue
|
agpl-3.0
| 361
|
<template>
<div class="flex flex-row justify-between items-center">
<h2 class="text-base font-semibold text-gray-800">
Settle against Advances
</h2>
</div>
<div class="flex flex-col gap-2.5" v-if="expenseClaim.advances?.length">
<!-- Advance Card -->
<div
v-for="advance in expenseClaim.advances"
:key="advance.name"
class="flex flex-col bg-white border shadow-sm rounded p-3.5"
:class="[
advance.selected ? 'border-gray-500' : '',
isReadOnly ? '' : 'cursor-pointer',
]"
@click="toggleAdvanceSelection(advance)"
>
<div class="flex flex-row justify-between items-center">
<div class="flex flex-row items-start gap-3">
<FormControl
type="checkbox"
class="mt-[0.5px]"
v-model="advance.selected"
:disabled="isReadOnly"
/>
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-semibold text-gray-800">
{{ advance.purpose || advance.employee_advance }}
</div>
<div class="flex flex-row items-center gap-3 justify-between">
<div class="text-xs font-normal text-gray-500">
Unclaimed Amount:
{{ formatCurrency(advance.unclaimed_amount, currency) }}
</div>
</div>
</div>
</div>
<div class="flex flex-row items-center gap-2">
<span class="text-normal">
{{ currencySymbol }}
</span>
<Input
type="number"
class="w-20"
v-model="advance.allocated_amount"
@input="(v) => (advance.selected = v)"
@click.stop
:disabled="isReadOnly"
:max="advance.unclaimed_amount"
min="0"
/>
</div>
</div>
</div>
</div>
<EmptyState v-else message="No advances found" :isTableField="true" />
</template>
<script setup>
import { computed } from "vue"
import { getCurrencySymbol } from "@/data/currencies"
import { formatCurrency } from "@/utils/formatters"
const props = defineProps({
expenseClaim: {
type: Object,
required: true,
},
currency: {
type: String,
required: true,
},
isReadOnly: {
type: Boolean,
default: false,
},
})
const currencySymbol = computed(() => getCurrencySymbol(props.currency))
function toggleAdvanceSelection(advance) {
if (props.isReadOnly) return
advance.selected = !advance.selected
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpenseAdvancesTable.vue
|
Vue
|
agpl-3.0
| 2,283
|
<template>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<ExpenseIcon class="h-5 w-5 text-gray-500" />
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ claimTitle }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ formatCurrency(props.doc.total_claimed_amount, currency) }}
</span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap">
{{ claimDates }}
</span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<Badge
variant="outline"
:theme="statusMap[status]"
:label="status"
size="md"
/>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
<div
v-if="props.isTeamRequest"
class="flex flex-row items-center gap-2 pl-8"
>
<EmployeeAvatar :employeeID="props.doc.employee" />
<div class="text-sm text-gray-600 grow">
{{ props.doc.employee_name }}
</div>
</div>
</div>
</template>
<script setup>
import { FeatherIcon, Badge } from "frappe-ui"
import { computed, inject } from "vue"
import EmployeeAvatar from "@/components/EmployeeAvatar.vue"
import ExpenseIcon from "@/components/icons/ExpenseIcon.vue"
import { getCompanyCurrency } from "@/data/currencies"
import { formatCurrency } from "@/utils/formatters"
const dayjs = inject("$dayjs")
const props = defineProps({
doc: {
type: Object,
},
isTeamRequest: {
type: Boolean,
default: false,
},
workflowStateField: {
type: String,
required: false,
},
})
const statusMap = {
Draft: "gray",
Submitted: "blue",
Cancelled: "red",
Paid: "green",
Unpaid: "orange",
"Approved & Draft": "gray",
"Approved & Unpaid": "orange",
"Approved & Submitted": "blue",
Rejected: "red",
}
const status = computed(() => {
if (props.workflowStateField) {
return props.doc[props.workflowStateField]
} else if (
props.doc.approval_status === "Approved" &&
["Draft", "Unpaid", "Submitted"].includes(props.doc.status)
) {
return `${props.doc.approval_status} & ${props.doc.status}`
} else if (props.doc.approval_status === "Rejected") {
return "Rejected"
}
return props.doc.status
})
const claimTitle = computed(() => {
let title = props.doc.expense_type
if (props.doc.total_expenses > 1) {
title += ` & ${props.doc.total_expenses - 1} more`
}
return title
})
const claimDates = computed(() => {
if (!props.doc.from_date && !props.doc.to_date)
return dayjs(props.doc.posting_date).format("D MMM")
if (props.doc.from_date === props.doc.to_date) {
return dayjs(props.doc.from_date).format("D MMM")
} else {
return `${dayjs(props.doc.from_date).format("D MMM")} - ${dayjs(
props.doc.to_date
).format("D MMM")}`
}
})
const currency = computed(() => getCompanyCurrency(props.doc.company))
const approvalStatus = computed(() => {
return props.doc.approval_status === "Draft"
? "Pending"
: props.doc.approval_status
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpenseClaimItem.vue
|
Vue
|
agpl-3.0
| 3,155
|
<template>
<div class="flex flex-col w-full gap-5" v-if="summary.data">
<div class="text-lg text-gray-800 font-bold">Expense Claim Summary</div>
<div
class="flex flex-col gap-4 bg-white py-3 px-3.5 rounded-lg border-none"
>
<div class="flex flex-col gap-1.5">
<span class="text-gray-600 text-base font-medium leading-5">
Total Expense Amount
</span>
<span class="text-gray-800 text-lg font-bold leading-6">
{{ formatCurrency(total_claimed_amount, company_currency) }}
</span>
</div>
<div class="flex flex-row justify-between">
<div class="flex flex-col gap-1">
<div class="flex flex-row gap-1 items-center">
<span class="text-gray-600 text-sm font-medium leading-5">
Pending
</span>
<FeatherIcon name="alert-circle" class="text-yellow-500 h-3 w-3" />
</div>
<span class="text-gray-800 text-base font-semibold leading-6">
{{
formatCurrency(
summary.data?.total_pending_amount,
company_currency
)
}}
</span>
</div>
<div class="flex flex-col gap-1">
<div class="flex flex-row gap-1 items-center">
<span class="text-gray-600 text-sm font-medium leading-5">
Approved
</span>
<FeatherIcon name="check-circle" class="text-green-500 h-3 w-3" />
</div>
<span class="text-gray-800 text-base font-semibold leading-6">
{{
formatCurrency(
summary.data?.total_approved_amount,
company_currency
)
}}
</span>
</div>
<div class="flex flex-col gap-1">
<div class="flex flex-row gap-1 items-center">
<span class="text-gray-600 text-sm font-medium leading-5">
Rejected
</span>
<FeatherIcon name="x-circle" class="text-red-500 h-3 w-3" />
</div>
<span class="text-gray-800 text-base font-semibold leading-6">
{{
formatCurrency(
summary.data?.total_rejected_amount,
company_currency
)
}}
</span>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { FeatherIcon } from "frappe-ui"
import { computed } from "vue"
import { expenseClaimSummary as summary } from "@/data/claims"
import { formatCurrency } from "@/utils/formatters"
const total_claimed_amount = computed(() => {
return (
summary.data?.total_pending_amount +
summary.data?.total_approved_amount +
summary.data?.total_rejected_amount
)
})
const company_currency = computed(() => summary.data?.currency)
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpenseClaimSummary.vue
|
Vue
|
agpl-3.0
| 2,511
|
<template>
<!-- Table -->
<div
v-if="doc?.expenses"
class="flex flex-col bg-white mt-5 rounded border overflow-auto"
>
<div
class="flex flex-row p-3.5 items-center justify-between cursor-pointer"
v-for="(item, idx) in doc?.expenses"
:key="idx"
>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ item.expense_type }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ `Sanctioned: ${currency} ${item.sanctioned_amount || 0}` }}
</span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap" v-if="item.expense_date">
{{ dayjs(item.expense_date).format("D MMM") }}
</span>
</div>
</div>
</div>
<span class="text-gray-700 font-normal rounded text-base">
{{ `${currency} ${item.amount}` }}
</span>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { computed, inject } from "vue"
import { getCompanyCurrencySymbol } from "@/data/currencies"
const props = defineProps({
doc: {
type: Object,
required: true,
},
})
const dayjs = inject("$dayjs")
const currency = computed(() => getCompanyCurrencySymbol(props.doc.company))
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpenseItems.vue
|
Vue
|
agpl-3.0
| 1,473
|
<template>
<template v-if="expenseClaim.expenses">
<div class="flex flex-row justify-between items-center pt-4">
<h2 class="text-base font-semibold text-gray-800">Taxes & Charges</h2>
<div class="flex flex-row gap-3 items-center">
<span class="text-base font-semibold text-gray-800">
{{ formatCurrency(expenseClaim.total_taxes_and_charges, currency) }}
</span>
<Button
v-if="!isReadOnly"
id="add-taxes-modal"
class="text-sm"
icon="plus"
variant="subtle"
@click="openModal()"
/>
</div>
</div>
<div
v-if="expenseClaim.taxes?.length"
class="flex flex-col bg-white mt-5 rounded border overflow-auto"
>
<div
class="flex flex-row p-3.5 items-center justify-between border-b cursor-pointer"
v-for="(item, idx) in expenseClaim.taxes"
:key="item.name"
@click="openModal(item, idx)"
>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ item.account_head }}
</div>
<div class="text-xs font-normal text-gray-500">
<span> Rate: {{ formatCurrency(item.rate, currency) }} </span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap">
Amount: {{ formatCurrency(item.tax_amount, currency) }}
</span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<span class="text-gray-700 font-normal rounded text-base">
{{ formatCurrency(item.total, currency) }}
</span>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
</div>
</div>
</div>
<EmptyState v-else message="No taxes added" :isTableField="true" />
<CustomIonModal :isOpen="isModalOpen" @didDismiss="resetSelectedItem()">
<template #actionSheet>
<!-- Add Expense Tax Action Sheet -->
<div
class="bg-white w-full flex flex-col items-center justify-center pb-5"
>
<div class="w-full pt-8 pb-5 border-b text-center">
<span class="text-gray-900 font-bold text-xl">
{{ modalTitle }}
</span>
</div>
<div
class="w-full flex flex-col items-center justify-center gap-5 p-4"
>
<div class="flex flex-col w-full space-y-4">
<FormField
v-for="field in taxesTableFields.data"
:key="field.fieldname"
class="w-full"
:label="field.label"
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
:options="field.options"
:linkFilters="field.linkFilters"
:hidden="field.hidden"
:reqd="field.reqd"
:readOnly="field.read_only || isReadOnly"
:default="field.default"
v-model="expenseTax[field.fieldname]"
/>
</div>
<div
v-if="!isReadOnly"
class="flex w-full flex-row items-center justify-between gap-3"
>
<Button
v-if="editingIdx !== null"
class="border-red-600 text-red-600 py-5 text-sm"
variant="outline"
theme="red"
@click="deleteExpenseTax()"
>
<template #prefix>
<FeatherIcon name="trash" class="w-4" />
</template>
Delete
</Button>
<Button
variant="solid"
class="w-full py-5 text-sm disabled:bg-gray-700 disabled:text-white"
@click="updateExpenseTax()"
:disabled="addButtonDisabled"
>
<template #prefix>
<FeatherIcon
:name="editingIdx === null ? 'plus' : 'check'"
class="w-4"
/>
</template>
{{ editingIdx === null ? "Add Tax" : "Update Tax" }}
</Button>
</div>
</div>
</div>
</template>
</CustomIonModal>
</template>
</template>
<script setup>
import { FeatherIcon, createResource } from "frappe-ui"
import { computed, ref, watch } from "vue"
import FormField from "@/components/FormField.vue"
import EmptyState from "@/components/EmptyState.vue"
import CustomIonModal from "@/components/CustomIonModal.vue"
import { formatCurrency } from "@/utils/formatters"
const props = defineProps({
expenseClaim: {
type: Object,
required: true,
},
currency: {
type: String,
required: true,
},
isReadOnly: {
type: Boolean,
default: false,
},
})
const emit = defineEmits([
"add-expense-tax",
"update-expense-tax",
"delete-expense-tax",
])
const expenseTax = ref({})
const editingIdx = ref(null)
const isModalOpen = ref(false)
const openModal = async (item, idx) => {
if (item) {
expenseTax.value = { ...item }
editingIdx.value = idx
}
isModalOpen.value = true
}
const deleteExpenseTax = () => {
emit("delete-expense-tax", editingIdx.value)
resetSelectedItem()
}
const updateExpenseTax = () => {
if (editingIdx.value === null) {
emit("add-expense-tax", expenseTax.value)
} else {
emit("update-expense-tax", expenseTax.value, editingIdx.value)
}
resetSelectedItem()
}
function resetSelectedItem() {
isModalOpen.value = false
expenseTax.value = {}
editingIdx.value = null
}
const taxesTableFields = createResource({
url: "hrms.api.get_doctype_fields",
params: { doctype: "Expense Taxes and Charges" },
transform(data) {
const excludeFields = ["description_sb"]
return data
.map((field) => {
if (field.fieldname === "account_head") {
field.linkFilters = {
company: props.expenseClaim.company,
account_type: [
"in",
[
"Tax",
"Chargeable",
"Income Account",
"Expenses Included In Valuation",
],
],
}
}
return field
})
.filter((field) => !excludeFields.includes(field.fieldname))
},
})
taxesTableFields.reload()
const modalTitle = computed(() => {
if (props.isReadOnly) return "Expense Tax"
return editingIdx.value === null ? "New Expense Tax" : "Edit Expense Tax"
})
const addButtonDisabled = computed(() => {
return taxesTableFields.data?.some((field) => {
if (field.reqd && !expenseTax.value[field.fieldname]) {
return true
}
})
})
// child table scripts
watch(
() => expenseTax.value.account_head,
(value) => {
// set description from account head
expenseTax.value.description = value?.split(" - ").slice(0, -1).join(" - ")
}
)
watch(
() => expenseTax.value.rate,
(newVal, oldVal) => {
if (editingIdx.value && newVal && !oldVal) return
expenseTax.value.tax_amount =
parseFloat(props.expenseClaim.total_sanctioned_amount) *
(parseFloat(newVal) / 100)
calculateTotalTax()
}
)
watch(
() => expenseTax.value.tax_amount,
(_value) => {
calculateTotalTax()
}
)
function calculateTotalTax() {
expenseTax.value.total =
parseFloat(props.expenseClaim.total_sanctioned_amount) +
parseFloat(expenseTax.value.tax_amount)
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpenseTaxesTable.vue
|
Vue
|
agpl-3.0
| 6,967
|
<template>
<!-- Header -->
<div class="flex flex-row justify-between items-center mt-2">
<h2 class="text-base font-semibold text-gray-800">Expenses</h2>
<div class="flex flex-row gap-3 items-center">
<span class="text-base font-semibold text-gray-800">
{{ formatCurrency(expenseClaim.total_claimed_amount, currency) }}
</span>
<Button
v-if="!isReadOnly"
id="add-expense-modal"
class="text-sm"
icon="plus"
variant="subtle"
@click="openModal()"
/>
</div>
</div>
<!-- Table -->
<div
v-if="expenseClaim.expenses"
class="flex flex-col bg-white mt-5 rounded border overflow-auto"
>
<div
class="flex flex-row p-3.5 items-center justify-between border-b cursor-pointer"
v-for="(item, idx) in expenseClaim.expenses"
:key="idx"
@click="openModal(item, idx)"
>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ item.expense_type }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>
Sanctioned:
{{ formatCurrency(item.sanctioned_amount, currency) }}
</span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap" v-if="item.expense_date">
{{ dayjs(item.expense_date).format("D MMM") }}
</span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<span class="text-gray-700 font-normal rounded text-base">
{{ formatCurrency(item.amount, currency) }}
</span>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
</div>
</div>
</div>
<EmptyState v-else message="No expenses added" :isTableField="true" />
<CustomIonModal :isOpen="isModalOpen" @didDismiss="resetSelectedItem()">
<template #actionSheet>
<!-- Add Expense Action Sheet -->
<div
class="bg-white w-full flex flex-col items-center justify-center pb-5"
>
<div class="w-full pt-8 pb-5 border-b text-center">
<span class="text-gray-900 font-bold text-lg">
{{ modalTitle }}
</span>
</div>
<div class="w-full flex flex-col items-center justify-center gap-5 p-4">
<div class="flex flex-col w-full space-y-4">
<FormField
v-for="field in expensesTableFields.data"
:key="field.fieldname"
class="w-full"
:label="field.label"
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
:options="field.options"
:hidden="field.hidden"
:reqd="field.reqd"
:default="field.default"
:readOnly="field.read_only || isReadOnly"
v-model="expenseItem[field.fieldname]"
/>
</div>
<div
v-if="!isReadOnly"
class="flex w-full flex-row items-center justify-between gap-3"
>
<Button
v-if="editingIdx !== null"
class="border-red-600 text-red-600 py-5 text-sm"
variant="outline"
theme="red"
@click="deleteExpenseItem()"
>
<template #prefix>
<FeatherIcon name="trash" class="w-4" />
</template>
Delete
</Button>
<Button
variant="solid"
class="w-full py-5 text-sm disabled:bg-gray-700 disabled:text-white"
@click="updateExpenseItem()"
:disabled="addButtonDisabled"
>
<template #prefix>
<FeatherIcon
:name="editingIdx === null ? 'plus' : 'check'"
class="w-4"
/>
</template>
{{ editingIdx === null ? "Add Expense" : "Update Expense" }}
</Button>
</div>
</div>
</div>
</template>
</CustomIonModal>
</template>
<script setup>
import { FeatherIcon, createResource } from "frappe-ui"
import { computed, ref, watch, inject } from "vue"
import FormField from "@/components/FormField.vue"
import EmptyState from "@/components/EmptyState.vue"
import CustomIonModal from "@/components/CustomIonModal.vue"
import { claimTypesByID } from "@/data/claims"
import { formatCurrency } from "@/utils/formatters"
const props = defineProps({
expenseClaim: {
type: Object,
required: true,
},
currency: {
type: String,
required: true,
},
isReadOnly: {
type: Boolean,
default: false,
},
})
const emit = defineEmits([
"add-expense-item",
"update-expense-item",
"delete-expense-item",
])
const dayjs = inject("$dayjs")
const expenseItem = ref({})
const editingIdx = ref(null)
const isModalOpen = ref(false)
const isFirstRender = ref(false)
const openModal = async (item, idx) => {
if (item) {
expenseItem.value = { ...item }
editingIdx.value = idx
}
isFirstRender.value = true
isModalOpen.value = true
}
const deleteExpenseItem = () => {
emit("delete-expense-item", editingIdx.value)
resetSelectedItem()
}
const updateExpenseItem = () => {
if (editingIdx.value === null) {
emit("add-expense-item", expenseItem.value)
} else {
emit("update-expense-item", expenseItem.value, editingIdx.value)
}
resetSelectedItem()
}
function resetSelectedItem() {
isFirstRender.value = false
isModalOpen.value = false
expenseItem.value = {}
editingIdx.value = null
}
const expensesTableFields = createResource({
url: "hrms.api.get_doctype_fields",
params: { doctype: "Expense Claim Detail" },
transform(data) {
const excludeFields = ["description_sb", "amounts_sb"]
return data.filter((field) => !excludeFields.includes(field.fieldname))
},
})
expensesTableFields.reload()
const modalTitle = computed(() => {
if (props.isReadOnly) return "Expense Item"
return editingIdx.value === null ? "New Expense Item" : "Edit Expense Item"
})
const addButtonDisabled = computed(() => {
return expensesTableFields.data?.some((field) => {
if (field.reqd && !expenseItem.value[field.fieldname]) {
return true
}
})
})
// child table form scripts
watch(
() => expenseItem.value.expense_type,
(value) => {
if (!expenseItem.value.description) {
expenseItem.value.description = claimTypesByID[value]?.description
}
expenseItem.value.cost_center = props.expenseClaim.cost_center
}
)
watch(
() => expenseItem.value.amount,
(value) => {
if (!isFirstRender.value) {
expenseItem.value.sanctioned_amount = parseFloat(value)
} else {
isFirstRender.value = false
}
}
)
</script>
|
2302_79757062/hrms
|
frontend/src/components/ExpensesTable.vue
|
Vue
|
agpl-3.0
| 6,457
|
<template>
<ion-header>
<ion-toolbar>
<ion-title>{{ filename }} - File Preview</ion-title>
<ion-buttons slot="end">
<ion-button @click="modalController.dismiss()">Close</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="bg-white h-full w-full overflow-auto touch-pinch-zoom">
<img v-if="isImageFile" :src="src" class="h-auto image-preview" />
<iframe v-else :src="src" class="w-full h-full"></iframe>
</div>
</ion-content>
</template>
<script setup>
import { computed, onBeforeUnmount } from "vue"
import {
IonHeader,
IonToolbar,
IonContent,
IonButtons,
IonTitle,
IonButton,
modalController,
} from "@ionic/vue"
const props = defineProps({
file: {
type: Object,
required: true,
},
})
const filename = computed(() => {
return props.file.file_name || props.file.name
})
const src = computed(() => {
return props.file.file_url
? props.file.file_url
: URL.createObjectURL(props.file)
})
const isImageFile = computed(() => {
return /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(filename.value)
})
onBeforeUnmount(() => {
URL.revokeObjectURL(src.value)
})
</script>
<style scoped>
.image-preview {
image-orientation: from-image;
}
</style>
|
2302_79757062/hrms
|
frontend/src/components/FilePreviewModal.vue
|
Vue
|
agpl-3.0
| 1,219
|
<template>
<div class="flex flex-col gap-3 py-4">
<label class="file-select">
<h2 class="text-base font-semibold text-gray-800 pb-4">Attachments</h2>
<div class="select-button cursor-pointer">
<div
class="flex flex-col w-full border shadow-sm items-center rounded p-3 gap-2"
>
<FeatherIcon name="upload" class="h-6 w-6 text-gray-700" />
<span class="block text-sm font-normal leading-5 text-gray-700">
Upload images or documents
</span>
</div>
<input
class="hidden"
ref="input"
type="file"
multiple
accept="*"
@change="(e) => emit('handle-file-select', e)"
/>
</div>
</label>
<div v-if="modelValue.length" class="w-full">
<ul class="w-full flex flex-col items-center gap-2">
<li
class="bg-gray-100 rounded p-2 w-full"
v-for="(file, index) in modelValue"
:key="index"
>
<div
class="flex flex-row items-center justify-between text-gray-700 text-sm"
>
<span class="grow" @click="showFilePreview(file)">
{{ file.file_name || file.name }}
</span>
<FeatherIcon
name="x"
class="h-4 w-4 cursor-pointer text-gray-700"
@click="() => confirmDeleteAttachment(file)"
/>
</div>
</li>
</ul>
<Dialog v-model="showDialog">
<template #body-title>
<h2 class="text-lg font-bold">Delete Attachment</h2>
</template>
<template #body-content>
<p>
Are you sure you want to delete the attachment
<span class="font-bold">{{ selectedFile.file_name }}</span>
?
</p>
</template>
<template #actions>
<div class="flex flex-row gap-4">
<Button
variant="outline"
class="py-5 w-full"
@click="showDialog = false"
>
Cancel
</Button>
<Button
variant="solid"
theme="red"
@click="handleFileDelete"
class="py-5 w-full"
>
Delete
</Button>
</div>
</template>
</Dialog>
<!-- File Preview Modal -->
<ion-modal
ref="modal"
:is-open="showPreviewModal"
@didDismiss="showPreviewModal = false"
>
<FilePreviewModal :file="selectedFile" />
</ion-modal>
</div>
</div>
</template>
<script setup>
import { FeatherIcon, Dialog } from "frappe-ui"
import { ref } from "vue"
import { IonModal } from "@ionic/vue"
import FilePreviewModal from "@/components/FilePreviewModal.vue"
const props = defineProps({
modelValue: {
type: Object,
required: true,
},
})
let showDialog = ref(false)
let showPreviewModal = ref(false)
let selectedFile = ref({})
const emit = defineEmits(["handle-file-select", "handle-file-delete"])
function showFilePreview(fileObj) {
selectedFile.value = fileObj
showPreviewModal.value = true
}
function confirmDeleteAttachment(fileObj) {
selectedFile.value = fileObj
showDialog.value = true
}
function handleFileDelete() {
emit("handle-file-delete", selectedFile.value)
showDialog.value = false
}
</script>
<style scoped>
ion-modal {
--height: 100%;
}
</style>
|
2302_79757062/hrms
|
frontend/src/components/FileUploaderView.vue
|
Vue
|
agpl-3.0
| 3,046
|
<template>
<div v-if="showField" class="flex flex-col gap-1.5">
<!-- Label -->
<span
v-if="
!['Check', 'Section Break', 'Column Break'].includes(props.fieldtype)
"
:class="[
// mark field as mandatory
props.reqd ? `after:content-['_*'] after:text-red-600` : ``,
`block text-sm leading-5 text-gray-700`,
]"
>
{{ props.label }}
</span>
<!-- Select or Link field with predefined options -->
<Autocomplete
v-if="props.fieldtype === 'Select' || props.documentList"
:class="isReadOnly ? 'pointer-events-none' : ''"
:placeholder="`Select ${props.label}`"
:options="selectionList"
:modelValue="modelValue"
v-bind="$attrs"
:disabled="isReadOnly"
@update:modelValue="(v) => emit('update:modelValue', v?.value)"
/>
<!-- Link field -->
<Link
v-else-if="props.fieldtype === 'Link'"
:doctype="props.options"
:modelValue="modelValue"
:filters="props.linkFilters"
:disabled="isReadOnly"
@update:modelValue="(v) => emit('update:modelValue', v)"
/>
<!-- Text -->
<Input
v-else-if="
['Text Editor', 'Small Text', 'Text', 'Long Text'].includes(
props.fieldtype
)
"
type="textarea"
:value="modelValue"
:placeholder="`Enter ${props.label}`"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
class="h-15"
/>
<!-- Check -->
<Input
v-else-if="props.fieldtype === 'Check'"
type="checkbox"
:label="props.label"
:value="modelValue"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
class="rounded-sm text-gray-800"
/>
<!-- Data field -->
<Input
v-else-if="props.fieldtype === 'Data'"
type="text"
:value="modelValue"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
/>
<!-- Read only currency field -->
<Input
v-else-if="props.fieldtype === 'Currency' && isReadOnly"
type="text"
:value="modelValue"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
/>
<!-- Float/Int field -->
<Input
v-else-if="isNumberType"
type="number"
:value="modelValue"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
/>
<!-- Section Break -->
<div
v-else-if="props.fieldtype === 'Section Break'"
:class="props.addSectionPadding ? 'mt-2' : ''"
>
<h2
v-if="props.label"
class="text-base font-semibold text-gray-800"
:class="props.addSectionPadding ? 'pt-4' : ''"
>
{{ props.label }}
</h2>
</div>
<!-- Date -->
<!-- FIXME: default datepicker has poor UI -->
<Input
v-else-if="props.fieldtype === 'Date'"
type="date"
v-model="date"
:value="modelValue"
:placeholder="`Select ${props.label}`"
:formatValue="(val) => dayjs(val).format('DD-MM-YYYY')"
@input="(v) => emit('update:modelValue', v)"
@change="(v) => emit('change', v)"
v-bind="$attrs"
:disabled="isReadOnly"
:min="props.minDate"
:max="props.maxDate"
/>
<!-- Time -->
<!-- Datetime -->
<ErrorMessage :message="props.errorMessage" />
</div>
</template>
<script setup>
import { Autocomplete, ErrorMessage } from "frappe-ui"
import { ref, computed, onMounted, inject } from "vue"
import Link from "@/components/Link.vue"
const props = defineProps({
fieldtype: String,
fieldname: String,
modelValue: [String, Number, Boolean, Array, Object],
default: [String, Number, Boolean, Array, Object],
label: String,
options: [String, Array],
linkFilters: Object,
documentList: Array,
readOnly: [Boolean, Number],
reqd: [Boolean, Number],
hidden: {
type: [Boolean, Number],
default: false,
},
errorMessage: String,
minDate: String,
maxDate: String,
addSectionPadding: {
type: Boolean,
default: true,
},
})
const emit = defineEmits(["change", "update:modelValue"])
const dayjs = inject("$dayjs")
let date = ref(null)
const showField = computed(() => {
if (props.readOnly && !isLayoutField.value && !props.modelValue) return false
return props.fieldtype !== "Table" && !props.hidden
})
const isNumberType = computed(() => {
return ["Int", "Float", "Currency"].includes(props.fieldtype)
})
const isLayoutField = computed(() => {
return ["Section Break", "Column Break"].includes(props.fieldtype)
})
const isReadOnly = computed(() => {
return Boolean(props.readOnly)
})
const selectionList = computed(() => {
if (props.fieldtype === "Link" && props.documentList) {
return props.documentList
} else if (props.fieldtype == "Select" && props.options) {
const options = props.options.split("\n")
return options.map((option) => ({
label: option,
value: option,
}))
}
return []
})
function setDefaultValue() {
// set default values
if (props.modelValue) return
if (props.default) {
if (props.fieldtype === "Check") {
emit("update:modelValue", props.default === "1" ? true : false)
} else if (props.fieldtype === "Date" && props.default === "Today") {
emit("update:modelValue", dayjs().format("YYYY-MM-DD"))
} else if (isNumberType.value) {
emit("update:modelValue", parseFloat(props.default || 0))
} else {
emit("update:modelValue", props.default)
}
} else {
props.fieldtype === "Check"
? emit("update:modelValue", false)
: emit("update:modelValue", "")
}
}
onMounted(() => {
setDefaultValue()
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/FormField.vue
|
Vue
|
agpl-3.0
| 5,587
|
<template>
<div class="flex flex-col h-full w-full" v-if="isFormReady">
<div class="w-full h-full bg-white sm:w-96 flex flex-col">
<header
class="flex flex-row bg-white shadow-sm py-4 px-3 items-center sticky top-0 z-[1000]"
>
<Button
variant="ghost"
class="!pl-0 hover:bg-white"
@click="router.back()"
>
<FeatherIcon name="chevron-left" class="h-5 w-5" />
</Button>
<div
v-if="id"
class="flex flex-row items-center gap-2 overflow-hidden grow"
>
<h2
class="text-xl font-semibold text-gray-900 whitespace-nowrap overflow-hidden text-ellipsis"
>
{{ doctype }}
</h2>
<Badge
:label="id"
class="whitespace-nowrap text-[8px]"
variant="outline"
/>
<Badge
v-if="status"
:label="status"
:theme="statusColor"
class="whitespace-nowrap text-[8px]"
/>
<Dropdown
class="ml-auto"
:options="[
{
label: 'Delete',
condition: showDeleteButton,
onClick: () => (showDeleteDialog = true),
},
{ label: 'Reload', onClick: () => reloadDoc() },
]"
:button="{
label: 'Menu',
icon: 'more-horizontal',
variant: 'ghost',
}"
/>
</div>
<h2 v-else class="text-2xl font-semibold text-gray-900">
{{ `New ${doctype}` }}
</h2>
</header>
<!-- Form -->
<div class="bg-white grow overflow-y-auto">
<!-- Tabs -->
<template v-if="tabbedView">
<div
class="px-4 sticky top-0 z-[100] bg-white text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700"
>
<ul class="flex -mb-px overflow-auto hide-scrollbar">
<li class="mr-2 whitespace-nowrap" v-for="tab in tabs">
<button
@click="activeTab = tab.name"
class="inline-block py-4 px-2 border-b-2 border-transparent rounded-t-lg"
:class="[
activeTab === tab.name
? '!text-gray-800 !border-gray-800'
: 'hover:text-gray-600 hover:border-gray-300',
]"
>
{{ tab.name }}
</button>
</li>
</ul>
</div>
<template v-for="(fieldList, tabName, index) in tabFields">
<div
v-show="tabName === activeTab"
class="flex flex-col space-y-4 p-4"
>
<template v-for="field in fieldList" :key="field.fieldname">
<slot
v-if="field.fieldtype == 'Table'"
:name="field.fieldname"
:isFormReadOnly="isFormReadOnly"
></slot>
<FormField
v-else
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
v-model="formModel[field.fieldname]"
:default="field.default"
:label="field.label"
:options="field.options"
:linkFilters="field.linkFilters"
:documentList="field.documentList"
:readOnly="isFieldReadOnly(field)"
:reqd="Boolean(field.reqd)"
:hidden="Boolean(field.hidden)"
:errorMessage="field.error_message"
:minDate="field.minDate"
:maxDate="field.maxDate"
:addSectionPadding="fieldList[0].name !== field.name"
/>
</template>
<!-- Attachment upload -->
<div
class="flex flex-row gap-2 items-center justify-center p-5"
v-if="isFileUploading"
>
<LoadingIndicator class="w-3 h-3 text-gray-800" />
<span class="text-gray-900 text-sm">Uploading...</span>
</div>
<FileUploaderView
v-else-if="showAttachmentView && index === 0"
v-model="fileAttachments"
@handleFileSelect="handleFileSelect"
@handleFileDelete="handleFileDelete"
/>
</div>
</template>
</template>
<div class="flex flex-col space-y-4 p-4" v-else>
<FormField
v-for="field in props.fields"
:key="field.name"
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
v-model="formModel[field.fieldname]"
:default="field.default"
:label="field.label"
:options="field.options"
:linkFilters="field.linkFilters"
:documentList="field.documentList"
:readOnly="isFieldReadOnly(field)"
:reqd="Boolean(field.reqd)"
:hidden="Boolean(field.hidden)"
:errorMessage="field.error_message"
:minDate="field.minDate"
:maxDate="field.maxDate"
/>
<!-- Attachment upload -->
<div
class="flex flex-row gap-2 items-center justify-center p-5"
v-if="isFileUploading"
>
<LoadingIndicator class="w-3 h-3 text-gray-800" />
<span class="text-gray-900 text-sm">Uploading...</span>
</div>
<FileUploaderView
v-else-if="showAttachmentView"
v-model="fileAttachments"
@handleFileSelect="handleFileSelect"
@handleFileDelete="handleFileDelete"
/>
</div>
</div>
<!-- Form Primary/Secondary Button -->
<!-- custom form button eg: Download button in salary slips -->
<div
v-if="!showFormButton"
class="px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg"
>
<slot name="formButton"></slot>
</div>
<!-- workflow actions -->
<WorkflowActionSheet
v-else-if="!isFormDirty && workflow?.hasWorkflow"
:doc="documentResource.doc"
:workflow="workflow"
@workflowApplied="reloadDoc()"
/>
<!-- save/submit/cancel -->
<div
v-else-if="isFormDirty || (!workflow?.hasWorkflow && formButton)"
class="px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg"
>
<ErrorMessage
class="mb-2"
:message="
formErrorMessage ||
docList?.insert?.error ||
documentResource?.setValue?.error
"
/>
<Button
class="w-full rounded py-5 text-base disabled:bg-gray-700 disabled:text-white"
:class="formButton === 'Cancel' ? 'shadow' : ''"
@click="formButton === 'Save' ? saveForm() : submitOrCancelForm()"
:variant="formButton === 'Cancel' ? 'subtle' : 'solid'"
:loading="
docList.insert.loading || documentResource?.setValue?.loading
"
>
{{ formButton }}
</Button>
</div>
</div>
</div>
<!-- Confirmation Dialogs -->
<Dialog v-model="showDeleteDialog">
<template #body-title>
<h2 class="text-xl font-bold">Delete {{ props.doctype }}</h2>
</template>
<template #body-content>
<p>
Are you sure you want to delete the {{ props.doctype }}
<span class="font-bold">{{ formModel.name }}</span>
?
</p>
</template>
<template #actions>
<div class="flex flex-row gap-4">
<Button
variant="outline"
class="py-5 w-full"
@click="showDeleteDialog = false"
>
Cancel
</Button>
<Button
variant="solid"
theme="red"
@click="handleDocDelete"
class="py-5 w-full"
>
Delete
</Button>
</div>
</template>
</Dialog>
<Dialog v-model="showSubmitDialog">
<template #body-title>
<h2 class="text-xl font-bold">Confirm</h2>
</template>
<template #body-content>
<p>
Permanently submit {{ props.doctype }}
<span class="font-bold">{{ formModel.name }}</span>
?
</p>
</template>
<template #actions>
<div class="flex flex-row gap-4">
<Button
variant="outline"
class="py-5 w-full"
@click="showSubmitDialog = false"
>
No
</Button>
<Button
variant="solid"
@click="handleDocUpdate('submit')"
class="py-5 w-full"
>
Yes
</Button>
</div>
</template>
</Dialog>
<Dialog v-model="showCancelDialog">
<template #body-title>
<h2 class="text-xl font-bold">Confirm</h2>
</template>
<template #body-content>
<p>
Permanently cancel {{ props.doctype }}
<span class="font-bold">{{ formModel.name }}</span
>?
</p>
</template>
<template #actions>
<div class="flex flex-row gap-4">
<Button
variant="outline"
class="py-5 w-full"
@click="showCancelDialog = false"
>
No
</Button>
<Button
variant="solid"
@click="handleDocUpdate('cancel')"
class="py-5 w-full"
>
Yes
</Button>
</div>
</template>
</Dialog>
</template>
<script setup>
import { computed, nextTick, onMounted, ref, watch } from "vue"
import { useRouter } from "vue-router"
import {
ErrorMessage,
Badge,
FeatherIcon,
createListResource,
createDocumentResource,
toast,
createResource,
Dropdown,
Dialog,
LoadingIndicator,
} from "frappe-ui"
import FormField from "@/components/FormField.vue"
import FileUploaderView from "@/components/FileUploaderView.vue"
import WorkflowActionSheet from "@/components/WorkflowActionSheet.vue"
import { FileAttachment, guessStatusColor } from "@/composables"
import useWorkflow from "@/composables/workflow"
import { getCompanyCurrency } from "@/data/currencies"
import { formatCurrency } from "@/utils/formatters"
const props = defineProps({
doctype: {
type: String,
required: true,
},
modelValue: {
type: Object,
required: true,
},
isSubmittable: {
type: Boolean,
required: false,
default: false,
},
fields: {
type: Array,
required: true,
},
id: {
type: String,
required: false,
},
tabbedView: {
type: Boolean,
required: false,
default: false,
},
tabs: {
type: Array,
required: false,
},
showAttachmentView: {
type: Boolean,
required: false,
default: false,
},
showFormButton: {
type: Boolean,
required: false,
default: true,
},
})
const emit = defineEmits(["validateForm", "update:modelValue"])
const router = useRouter()
let activeTab = ref(props.tabs?.[0].name)
let fileAttachments = ref([])
let statusColor = ref("")
let formErrorMessage = ref("")
let isFormDirty = ref(false)
let isFormUpdated = ref(false)
let showDeleteDialog = ref(false)
let showSubmitDialog = ref(false)
let showCancelDialog = ref(false)
let isFileUploading = ref(false)
let workflow = ref(null)
const formModel = computed({
get() {
return props.modelValue
},
set(newValue) {
emit("update:modelValue", newValue)
},
})
const status = computed(() => {
if (!props.id) return ""
if (workflow.value) {
const stateField = workflow.value.getWorkflowStateField()
if (stateField) return formModel.value[stateField]
}
return formModel.value.status || formModel.value.approval_status
})
watch(
() => formModel.value,
() => {
if (!props.id) return
if (isFormReady.value && !isFormUpdated.value) {
isFormDirty.value = true
} else if (isFormUpdated.value) {
isFormUpdated.value = false
}
},
{ deep: true }
)
watch(
() => status.value,
async (value) => {
if (!value) return
statusColor.value = await guessStatusColor(props.doctype, status.value)
},
{ immediate: true }
)
const tabFields = computed(() => {
let fieldsByTab = {}
let fieldList = []
let firstFieldIndex = 0
let lastFieldIndex = 0
props.tabs?.forEach((tab) => {
lastFieldIndex = props.fields.findIndex(
(field) => field.fieldname === tab.lastField
)
fieldList = props.fields.slice(firstFieldIndex, lastFieldIndex + 1)
fieldsByTab[tab.name] = fieldList
firstFieldIndex = lastFieldIndex + 1
})
return fieldsByTab
})
const attachedFiles = createResource({
url: "hrms.api.get_attachments",
params: {
dt: props.doctype,
dn: props.id,
},
transform(data) {
return data.map((file) => (file.uploaded = true))
},
onSuccess(data) {
fileAttachments.value = data
},
})
const handleFileSelect = (e) => {
if (props.id) {
uploadAllAttachments(props.doctype, props.id, [...e.target.files])
} else {
fileAttachments.value.push(...e.target.files)
}
}
const handleFileDelete = async (fileObj) => {
if (fileObj.uploaded) {
const fileAttachment = new FileAttachment(fileObj)
await fileAttachment.delete()
await attachedFiles.reload()
} else {
fileAttachments.value = fileAttachments.value.filter(
(file) => file.name !== fileObj.name
)
}
}
async function uploadAllAttachments(documentType, documentName, attachments) {
isFileUploading.value = true
const uploadPromises = attachments.map((attachment) => {
const fileAttachment = new FileAttachment(attachment)
return fileAttachment
.upload(documentType, documentName, "")
.then((fileDoc) => {
fileDoc.uploaded = true
if (props.id) {
fileAttachments.value.push(fileDoc)
}
})
})
await Promise.allSettled(uploadPromises)
isFileUploading.value = false
}
// CRUD for doc
const docList = createListResource({
doctype: props.doctype,
insert: {
async onSuccess(data) {
toast({
title: "Success",
text: `${props.doctype} created successfully!`,
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
await uploadAllAttachments(data.doctype, data.name, fileAttachments.value)
router.replace({
name: `${props.doctype.replace(/\s+/g, "")}DetailView`,
params: { id: data.name },
})
},
onError() {
toast({
title: "Error",
text: `Error creating ${props.doctype}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
console.log(`Error creating ${props.doctype}`)
},
},
})
const documentResource = createDocumentResource({
doctype: props.doctype,
name: props.id,
fields: "*",
setValue: {
onSuccess() {
toast({
title: "Success",
text: `${props.doctype} updated successfully!`,
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
},
onError() {
toast({
title: "Error",
text: `Error updating ${props.doctype}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
console.log(`Error updating ${props.doctype}`)
},
},
delete: {
onSuccess() {
router.back()
toast({
title: "Success",
text: `${props.doctype} deleted successfully!`,
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
},
onError() {
toast({
title: "Error",
text: `Error deleting ${props.doctype}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
console.log(`Error deleting ${props.doctype}`)
},
},
})
const docPermissions = createResource({
url: "frappe.client.get_doc_permissions",
params: { doctype: props.doctype, docname: props.id },
})
const permittedWriteFields = createResource({
url: "hrms.api.get_permitted_fields_for_write",
params: { doctype: props.doctype },
})
const formButton = computed(() => {
if (!props.showFormButton) return
if (props.id && props.isSubmittable && !isFormDirty.value) {
if (formModel.value.docstatus === 0 && hasPermission("submit")) {
return "Submit"
} else if (formModel.value.docstatus === 1 && hasPermission("cancel")) {
return "Cancel"
}
} else if (formModel.value.docstatus !== 2) {
return "Save"
}
})
function showDeleteButton() {
return props.id && formModel.value.docstatus !== 1 && hasPermission("delete")
}
function hasPermission(action) {
return docPermissions.data?.permissions[action]
}
function isFieldReadOnly(field) {
return (
Boolean(field.read_only)
|| isFormReadOnly.value
|| (props.id && !permittedWriteFields.data?.includes(field.fieldname))
)
}
function handleDocInsert() {
if (!validateMandatoryFields()) return
docList.insert.submit(formModel.value)
}
function validateMandatoryFields() {
const errorFields = props.fields
.filter(
(field) =>
field.reqd && !field.hidden && !formModel.value[field.fieldname]
)
.map((field) => field.label)
if (errorFields.length) {
formErrorMessage.value = `${errorFields.join(", ")} ${
errorFields.length > 1 ? "fields are mandatory" : "field is mandatory"
}`
return false
} else {
formErrorMessage.value = ""
return true
}
}
async function handleDocUpdate(action) {
if (documentResource.doc) {
let params = { ...formModel.value }
if (!validateMandatoryFields()) return
if (action == "submit") {
params.docstatus = 1
} else if (action == "cancel") {
params.docstatus = 2
}
await documentResource.setValue.submit(params)
await documentResource.get.promise
resetForm()
}
if (action === "submit") showSubmitDialog.value = false
else if (action === "cancel") showCancelDialog.value = false
}
function saveForm() {
emit("validateForm")
if (props.id) {
handleDocUpdate()
} else {
handleDocInsert()
}
}
function submitOrCancelForm() {
if (isFormDirty.value) return
if (formModel.value.docstatus === 0) {
emit("validateForm")
showSubmitDialog.value = true
} else if (formModel.value.docstatus === 1) {
showCancelDialog.value = true
}
}
function handleDocDelete() {
documentResource.delete.submit()
showDeleteDialog.value = false
}
async function reloadDoc() {
await documentResource.reload()
resetForm()
}
function resetForm() {
formModel.value = { ...documentResource.doc }
nextTick(() => {
isFormDirty.value = false
isFormUpdated.value = true
})
}
async function setFormattedCurrency() {
const companyCurrency = await getCompanyCurrency(formModel.value.company)
props.fields.forEach((field) => {
if (field.fieldtype !== "Currency") return
if (!(field.readOnly || isFormReadOnly.value)) return
if (field.options === "currency") {
formModel.value[field.fieldname] = formatCurrency(
formModel.value[field.fieldname],
formModel.value.currency
)
} else {
formModel.value[field.fieldname] = formatCurrency(
formModel.value[field.fieldname],
companyCurrency
)
}
})
}
const isFormReadOnly = computed(() => {
if (!isFormReady.value) return true
if (!props.id) return false
// submitted & cancelled docs are read only
if (formModel.value.docstatus !== 0) return true
// read only due to workflow based on current user's roles
if (workflow.value?.isReadOnly(formModel.value)) return true
})
const isFormReady = computed(() => {
if (!props.id) return true
return !documentResource.get.loading && documentResource.doc
})
onMounted(async () => {
if (props.id) {
await documentResource.get.promise
formModel.value = { ...documentResource.doc }
await docPermissions.reload()
await permittedWriteFields.reload()
await attachedFiles.reload()
await setFormattedCurrency()
// workflow
workflow.value = useWorkflow(props.doctype)
isFormDirty.value = false
}
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/FormView.vue
|
Vue
|
agpl-3.0
| 18,459
|
<template>
<div v-if="!props.value" class="text-gray-600 text-base">-</div>
<Badge
v-else-if="props.fieldtype === 'Select'"
variant="outline"
:theme="colorMap[props.value]"
:label="props.value"
size="md"
/>
<div v-else-if="props.fieldtype === 'Date'" class="text-gray-900 text-base">
{{ dayjs(props.value).format("D MMM YYYY") }}
</div>
<Input
v-else-if="props.fieldtype === 'Check'"
type="checkbox"
label=""
v-model="props.value"
:disabled="true"
class="rounded-sm text-gray-800"
/>
<div
v-else-if="['Small Text', 'Text', 'Long Text'].includes(props.fieldtype)"
class="text-gray-900 text-base bg-gray-100 rounded py-3 pl-3 mt-2"
>
{{ props.value }}
</div>
<EmployeeAvatar
v-else-if="
props.fieldtype === 'Link' &&
['employee', 'reports_to'].includes(props.fieldname)
"
:employeeID="props.value"
:showLabel="true"
/>
<div v-else class="text-gray-900 text-base">{{ props.value }}</div>
</template>
<script setup>
import { inject } from "vue"
import { Badge, FormControl, Input } from "frappe-ui"
import EmployeeAvatar from "@/components/EmployeeAvatar.vue"
const dayjs = inject("$dayjs")
const props = defineProps({
value: [String, Number, Boolean, Array, Object],
fieldtype: String,
fieldname: String,
})
const colorMap = {
Approved: "green",
Rejected: "red",
Open: "orange",
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/FormattedField.vue
|
Vue
|
agpl-3.0
| 1,362
|
<template>
<div class="flex flex-col gap-5 w-full">
<div class="flex flex-row justify-between items-center">
<div class="text-lg text-gray-800 font-bold">Upcoming Holidays</div>
<div
v-if="holidays?.data?.length"
id="open-holiday-list"
class="text-sm text-gray-800 font-semibold cursor-pointer underline underline-offset-2"
>
View All
</div>
</div>
<div class="flex flex-col bg-white rounded" v-if="upcomingHolidays?.length">
<div
class="flex flex-row flex-start p-4 items-center justify-between border-b"
v-for="holiday in upcomingHolidays"
:key="holiday.holiday_date"
>
<div class="flex flex-row items-center gap-3 grow">
<FeatherIcon name="calendar" class="h-5 w-5 text-gray-500" />
<div class="text-base font-normal text-gray-800">
{{ holiday.description }}
</div>
</div>
<div class="text-base font-bold text-gray-800">
{{ holiday.formatted_holiday_date }}
</div>
</div>
</div>
<EmptyState message="You have no upcoming holidays" v-else />
</div>
<ion-modal
ref="modal"
v-if="holidays?.data?.length"
trigger="open-holiday-list"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
>
<div class="bg-white w-full flex flex-col items-center justify-center pb-5">
<div class="w-full pt-8 pb-5 border-b text-center">
<span class="text-gray-900 font-bold text-lg">Holiday List</span>
</div>
<div class="w-full flex flex-col items-center justify-center gap-5 p-4">
<div
v-for="holiday in holidays.data"
:key="holiday.holiday_date"
class="flex flex-row items-center justify-between w-full"
>
<div class="flex flex-row items-center gap-3 grow">
<FeatherIcon name="calendar" class="h-5 w-5 text-gray-500" />
<div class="text-base font-normal text-gray-800">
{{ holiday.description }}
</div>
</div>
<div
:class="[
'text-base font-bold',
holiday.is_upcoming ? 'text-gray-800' : 'text-gray-500',
]"
>
{{ holiday.formatted_holiday_date }}
</div>
</div>
</div>
</div>
</ion-modal>
</template>
<script setup>
import { inject, computed } from "vue"
import { IonModal } from "@ionic/vue"
import { FeatherIcon, createResource } from "frappe-ui"
const employee = inject("$employee")
const dayjs = inject("$dayjs")
const holidays = createResource({
url: "hrms.api.get_holidays_for_employee",
params: {
employee: employee.data.name,
},
auto: true,
transform: (data) => {
return data.map((holiday) => {
const holidayDate = dayjs(holiday.holiday_date)
holiday.is_upcoming = holidayDate.isAfter(dayjs())
holiday.formatted_holiday_date = holidayDate.format("ddd, D MMM YYYY")
return holiday
})
},
})
const upcomingHolidays = computed(() => {
const filteredHolidays = holidays.data?.filter(
(holiday) => holiday.is_upcoming
)
// show only 5 upcoming holidays
return filteredHolidays?.slice(0, 5)
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/Holidays.vue
|
Vue
|
agpl-3.0
| 2,962
|
<template>
<!-- Install PWA dialog -->
<Dialog v-model="showDialog">
<template #body-title>
<h2 class="text-lg font-bold">Install Frappe HR</h2>
</template>
<template #body-content>
<p>Get the app on your device for easy access & a better experience!</p>
</template>
<template #actions>
<Button variant="solid" @click="() => install()" class="py-5 w-full">
<template #prefix><FeatherIcon name="download" class="w-4" /></template>
Install
</Button>
</template>
</Dialog>
<!-- iOS installation info message -->
<Popover :show="iosInstallMessage" placement="bottom">
<template #body>
<div
class="mt-[calc(100vh-15rem)] flex flex-col gap-3 mx-2 rounded py-5 bg-blue-100 drop-shadow-xl"
>
<div
class="flex flex-row text-center items-center justify-between mb-1 px-3"
>
<span class="text-base text-gray-900 font-bold">
Install Frappe HR
</span>
<span class="inline-flex items-baseline">
<FeatherIcon
name="x"
class="ml-auto h-4 w-4 text-gray-700"
@click="iosInstallMessage = false"
/>
</span>
</div>
<div class="text-xs text-gray-800 px-3">
<span class="flex flex-col gap-2">
<span>
Get the app on your iPhone for easy access & a better experience
</span>
<span class="inline-flex items-start whitespace-nowrap">
<span>Tap </span>
<FeatherIcon name="share" class="h-4 w-4 text-blue-600" />
<span> and then "Add to Home Screen"</span>
</span>
</span>
</div>
</div>
</template>
</Popover>
</template>
<script setup>
import { ref } from "vue"
import { Dialog, Popover, FeatherIcon } from "frappe-ui"
// Initialize deferredPrompt for use later to show browser install prompt.
const deferredPrompt = ref(null)
const showDialog = ref(false)
const iosInstallMessage = ref(false)
const isIos = () => {
// Detects if device is on iOS
const userAgent = window.navigator.userAgent.toLowerCase()
return /iphone|ipad|ipod/.test(userAgent)
}
// Detects if device is in standalone mode
const isInStandaloneMode = () =>
"standalone" in window.navigator && window.navigator.standalone
// Checks if should display install popup notification:
if (isIos() && !isInStandaloneMode()) {
iosInstallMessage.value = true
}
window.addEventListener("beforeinstallprompt", (e) => {
// Prevent the mini-infobar from appearing on mobile
e.preventDefault()
// Stash the event so it can be triggered later.
deferredPrompt.value = e
if (isIos() && !isInStandaloneMode()) {
iosInstallMessage.value = true
} else {
showDialog.value = true
}
// Optionally, send analytics event that PWA install promo was shown.
console.log(`'beforeinstallprompt' event was fired.`)
})
window.addEventListener("appinstalled", () => {
showDialog.value = false
deferredPrompt.value = null
})
async function install() {
deferredPrompt.value.prompt()
showDialog.value = false
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/InstallPrompt.vue
|
Vue
|
agpl-3.0
| 2,967
|
<template>
<div class="flex flex-col w-full">
<div class="flex flex-row justify-between items-center px-4">
<div class="text-lg text-gray-800 font-bold">Leave Balance</div>
<router-link
:to="{ name: 'LeaveApplicationListView' }"
v-slot="{ navigate }"
v-if="leaveBalance.data"
>
<div
@click="navigate"
class="text-sm text-gray-800 font-semibold cursor-pointer underline underline-offset-2"
>
View Leave History
</div>
</router-link>
</div>
<!-- Leave Balance Dashboard -->
<div
class="flex flex-row gap-4 overflow-x-auto py-2 mt-3"
v-if="leaveBalance.data"
>
<div
v-for="(allocation, leave_type, index) in leaveBalance.data"
:key="leave_type"
class="flex flex-col bg-white border-none rounded-lg drop-shadow-md gap-2 p-4 items-start first:ml-4"
>
<SemicircleChart
:percentage="allocation.balance_percentage"
:colorClass="getChartColor(index)"
/>
<div class="text-gray-800 font-bold text-base">
{{ `${allocation.balance_leaves}/${allocation.allocated_leaves}` }}
</div>
<div class="text-gray-600 font-normal text-sm w-24 leading-4">
{{ `${leave_type} balance` }}
</div>
</div>
</div>
<EmptyState message="You have no leaves allocated" v-else />
</div>
</template>
<script setup>
import SemicircleChart from "@/components/SemicircleChart.vue"
import { leaveBalance } from "@/data/leaves"
const getChartColor = (index) => {
// note: tw colors - rose-400, pink-400 & purple-500 of the old frappeui palette #918ef5
const chartColors = ["text-[#fb7185]", "text-[#f472b6]", "text-[#918ef5]"]
return chartColors[index % chartColors.length]
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/LeaveBalance.vue
|
Vue
|
agpl-3.0
| 1,689
|
<template>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<LeaveIcon class="h-5 w-5 text-gray-500" />
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ props.doc.leave_type }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>{{ props.doc.leave_dates || getLeaveDates(props.doc) }}</span>
<span class="whitespace-pre"> · </span>
<span class="whitespace-nowrap">{{
`${props.doc.total_leave_days}d`
}}</span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<Badge
variant="outline"
:theme="colorMap[status]"
:label="status"
size="md"
/>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
<div
v-if="props.isTeamRequest"
class="flex flex-row items-center gap-2 pl-8"
>
<EmployeeAvatar :employeeID="props.doc.employee" />
<div class="text-sm text-gray-600 grow">
{{ props.doc.employee_name }}
</div>
</div>
</div>
</template>
<script setup>
import { computed } from "vue"
import { FeatherIcon, Badge } from "frappe-ui"
import EmployeeAvatar from "@/components/EmployeeAvatar.vue"
import LeaveIcon from "@/components/icons/LeaveIcon.vue"
import { getLeaveDates } from "@/data/leaves"
const props = defineProps({
doc: {
type: Object,
},
isTeamRequest: {
type: Boolean,
default: false,
},
workflowStateField: {
type: String,
required: false,
},
})
const status = computed(() => {
return props.workflowStateField
? props.doc[props.workflowStateField]
: props.doc.status
})
const colorMap = {
Approved: "green",
Rejected: "red",
Open: "orange",
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/LeaveRequestItem.vue
|
Vue
|
agpl-3.0
| 1,871
|
<template>
<Autocomplete
ref="autocompleteRef"
size="sm"
v-model="value"
:placeholder="`Select ${doctype}`"
:options="options.data"
:class="disabled ? 'pointer-events-none' : ''"
:disabled="disabled"
@update:query="handleQueryUpdate"
/>
</template>
<script setup>
import { createResource, Autocomplete, debounce } from "frappe-ui"
import { ref, computed, watch } from "vue"
const props = defineProps({
doctype: {
type: String,
required: true,
},
modelValue: {
type: String,
required: false,
default: "",
},
filters: {
type: Object,
default: {},
},
disabled: {
type: Boolean,
default: false,
},
})
const emit = defineEmits(["update:modelValue"])
const autocompleteRef = ref(null)
const searchText = ref("")
const value = computed({
get: () => props.modelValue,
set: (val) => {
emit("update:modelValue", val?.value || "")
},
})
const options = createResource({
url: "frappe.desk.search.search_link",
params: {
doctype: props.doctype,
txt: searchText.value,
filters: props.filters,
},
method: "POST",
transform: (data) => {
return data.map((doc) => {
const title = doc?.description?.split(",")?.[0]
return {
label: title ? `${title} : ${doc.value}` : doc.value,
value: doc.value,
}
})
},
})
const reloadOptions = (searchTextVal) => {
options.update({
params: {
txt: searchTextVal,
doctype: props.doctype,
},
})
options.reload()
}
const handleQueryUpdate = debounce((newQuery) => {
const val = newQuery || ""
if (searchText.value === val) return
searchText.val = val
reloadOptions(val)
}, 300)
watch(
() => props.doctype,
() => {
if (!props.doctype || props.doctype === options.doctype) return
reloadOptions("")
},
{ immediate: true }
)
</script>
|
2302_79757062/hrms
|
frontend/src/components/Link.vue
|
Vue
|
agpl-3.0
| 1,758
|
<template>
<!-- Filter Action Sheet -->
<div
class="bg-white w-full flex flex-col items-center justify-center pb-5 max-h-[calc(100vh-5rem)]"
>
<div class="w-full pt-8 pb-5 border-b text-center sticky top-0 z-[100]">
<span class="text-gray-900 font-bold text-lg">Filters</span>
</div>
<div class="w-full p-4 overflow-auto">
<div class="flex flex-col gap-5 items-center justify-center">
<div
v-for="filter in filterConfig"
:key="filter.fieldname"
class="flex flex-col w-full gap-1"
>
<!-- Status filter -->
<div
class="flex flex-col gap-1.5"
v-if="['status', 'approval_status'].includes(filter.fieldname)"
>
<div class="text-gray-800 font-semibold text-base">
{{ filter.label }}
</div>
<div class="flex flex-row gap-2 mt-2 flex-wrap">
<Button
v-for="option in filter.options"
variant="outline"
@click="setStatusFilter(filter.fieldname, option)"
class="text-sm text-gray-800"
:class="[
option === filters[filter.fieldname].value
? '!border !border-gray-800 !text-gray-900 !bg-gray-50 !font-medium'
: '!font-normal',
]"
>
{{ option }}
</Button>
</div>
</div>
<!-- Field filters -->
<div v-else class="flex flex-col gap-2">
<div class="text-gray-800 font-semibold text-base">
{{ filter.label }}
</div>
<div class="flex flex-row items-center gap-3">
<Autocomplete
v-if="filterConditionMap[filter.fieldtype]"
class="mt-1 w-[75px]"
:options="filterConditionMap[filter.fieldtype]"
v-model="filters[filter.fieldname].condition"
/>
<FormField
class="w-full"
:fieldtype="filter.fieldtype"
:fieldname="filter.fieldname"
:options="filter.options"
v-model="filters[filter.fieldname].value"
/>
</div>
</div>
</div>
</div>
</div>
<!-- Filter Buttons -->
<div
class="flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t p-4 z[100]"
>
<Button
@click="emit('clear-filters')"
variant="outline"
class="w-full py-5 text-sm"
>
Clear All
</Button>
<Button
@click="emit('apply-filters')"
variant="solid"
class="w-full py-5 text-sm"
>
Apply Filters
</Button>
</div>
</div>
</template>
<script setup>
import { computed } from "vue"
import FormField from "@/components/FormField.vue"
import { Autocomplete } from "frappe-ui"
const props = defineProps({
filterConfig: {
type: Array,
required: true,
},
filters: {
type: Object,
required: true,
},
})
const emit = defineEmits(["apply-filters", "clear-filters", "update:filters"])
const numberOperators = [
{ label: "=", value: "=" },
{ label: ">", value: ">" },
{ label: "<", value: "<" },
{ label: ">=", value: ">=" },
{ label: "<=", value: "<=" },
]
const filterConditionMap = {
Date: numberOperators,
Currency: numberOperators,
}
const filters = computed({
get() {
return props.filters
},
set(value) {
emit("update:filters", value)
},
})
function setStatusFilter(fieldname, value) {
if (filters.value[fieldname].value === value) {
filters.value[fieldname].value = ""
} else {
filters.value[fieldname].value = value
}
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/ListFiltersActionSheet.vue
|
Vue
|
agpl-3.0
| 3,347
|
<template>
<ion-header class="ion-no-border">
<div class="w-full sm:w-96">
<div
class="flex flex-row bg-white shadow-sm py-4 px-3 items-center justify-between border-b"
>
<div class="flex flex-row items-center">
<Button
variant="ghost"
class="!pl-0 hover:bg-white"
@click="router.back()"
>
<FeatherIcon name="chevron-left" class="h-5 w-5" />
</Button>
<h2 class="text-xl font-semibold text-gray-900">{{ pageTitle }}</h2>
</div>
<div class="flex flex-row gap-2">
<Button
id="show-filter-modal"
icon="filter"
variant="subtle"
:class="[
areFiltersApplied
? '!border !border-gray-800 !bg-white !text-gray-900 !font-semibold'
: '',
]"
/>
<router-link :to="{ name: formViewRoute }" v-slot="{ navigate }">
<Button variant="solid" class="mr-2" @click="navigate">
<template #prefix>
<FeatherIcon name="plus" class="w-4" />
</template>
New
</Button>
</router-link>
</div>
</div>
</div>
</ion-header>
<ion-content>
<ion-refresher slot="fixed" @ionRefresh="handleRefresh($event)">
<ion-refresher-content></ion-refresher-content>
</ion-refresher>
<div
class="flex flex-col items-center mb-7 p-4 h-full w-full sm:w-96 overflow-y-auto"
ref="scrollContainer"
@scroll="() => handleScroll()"
>
<div class="w-full mt-5">
<TabButtons
:buttons="[{ label: tabButtons[0] }, { label: tabButtons[1] }]"
v-model="activeTab"
/>
<div
class="flex flex-col bg-white rounded mt-5"
v-if="!documents.loading && documents.data?.length"
>
<div
class="p-3.5 items-center justify-between border-b cursor-pointer"
v-for="link in documents.data"
:key="link.name"
>
<router-link
:to="{ name: detailViewRoute, params: { id: link.name } }"
v-slot="{ navigate }"
>
<component
:is="listItemComponent[doctype]"
:doc="link"
:isTeamRequest="isTeamRequest"
:workflowStateField="workflowStateField"
@click="navigate"
/>
</router-link>
</div>
</div>
<EmptyState
:message="`No ${props.doctype?.toLowerCase()}s found`"
v-else-if="!documents.loading"
/>
<!-- Loading Indicator -->
<div
v-if="documents.loading"
class="flex mt-2 items-center justify-center"
>
<LoadingIndicator class="w-8 h-8 text-gray-800" />
</div>
</div>
</div>
<CustomIonModal trigger="show-filter-modal">
<!-- Filter Action Sheet -->
<template #actionSheet>
<ListFiltersActionSheet
:filterConfig="filterConfig"
@applyFilters="applyFilters"
@clearFilters="clearFilters"
v-model:filters="filterMap"
/>
</template>
</CustomIonModal>
</ion-content>
</template>
<script setup>
import { useRouter } from "vue-router"
import { inject, ref, markRaw, watch, computed, reactive, onMounted } from "vue"
import {
modalController,
IonHeader,
IonContent,
IonRefresher,
IonRefresherContent,
} from "@ionic/vue"
import {
FeatherIcon,
createResource,
LoadingIndicator,
debounce,
} from "frappe-ui"
import TabButtons from "@/components/TabButtons.vue"
import LeaveRequestItem from "@/components/LeaveRequestItem.vue"
import ExpenseClaimItem from "@/components/ExpenseClaimItem.vue"
import EmployeeAdvanceItem from "@/components/EmployeeAdvanceItem.vue"
import ListFiltersActionSheet from "@/components/ListFiltersActionSheet.vue"
import CustomIonModal from "@/components/CustomIonModal.vue"
import useWorkflow from "@/composables/workflow"
import { useListUpdate } from "@/composables/realtime"
const props = defineProps({
doctype: {
type: String,
required: true,
},
fields: {
type: Array,
required: true,
},
groupBy: {
type: String,
required: false,
},
filterConfig: {
type: Array,
required: true,
},
tabButtons: {
type: Array,
required: true,
},
pageTitle: {
type: String,
required: true,
},
})
const listItemComponent = {
"Leave Application": markRaw(LeaveRequestItem),
"Expense Claim": markRaw(ExpenseClaimItem),
"Employee Advance": markRaw(EmployeeAdvanceItem),
}
const router = useRouter()
const socket = inject("$socket")
const employee = inject("$employee")
const filterMap = reactive({})
const activeTab = ref(props.tabButtons[0])
const areFiltersApplied = ref(false)
const appliedFilters = ref([])
const workflowStateField = ref(null)
// infinite scroll
const scrollContainer = ref(null)
const hasNextPage = ref(true)
const listOptions = ref({
doctype: props.doctype,
fields: props.fields,
group_by: props.groupBy,
order_by: `\`tab${props.doctype}\`.modified desc`,
page_length: 50,
})
// computed properties
const isTeamRequest = computed(() => {
return activeTab.value === props.tabButtons[1]
})
const formViewRoute = computed(() => {
return `${props.doctype.replace(/\s+/g, "")}FormView`
})
const detailViewRoute = computed(() => {
return `${props.doctype.replace(/\s+/g, "")}DetailView`
})
const defaultFilters = computed(() => {
const filters = []
if (isTeamRequest.value) {
filters.push([props.doctype, "employee", "!=", employee.data.name])
} else {
filters.push([props.doctype, "employee", "=", employee.data.name])
}
return filters
})
// resources
const documents = createResource({
url: "frappe.desk.reportview.get",
onSuccess: (data) => {
if (data.values?.length < listOptions.value.page_length) {
hasNextPage.value = false
}
},
transform(data) {
if (data.length === 0) {
return []
}
// convert keys and values arrays to docs object
const fields = data["keys"]
const values = data["values"]
const docs = values.map((value) => {
const doc = {}
fields.forEach((field, index) => {
doc[field] = value[index]
})
return doc
})
let pagedData
if (!documents.params.start || documents.params.start === 0) {
pagedData = docs
} else {
pagedData = documents.data.concat(docs)
}
return pagedData
},
})
// helper functions
function initializeFilters() {
props.filterConfig.forEach((filter) => {
filterMap[filter.fieldname] = {
condition: "=",
value: null,
}
})
appliedFilters.value = []
}
initializeFilters()
function prepareFilters() {
let condition = ""
let value = ""
appliedFilters.value = []
for (const fieldname in filterMap) {
condition = filterMap[fieldname].condition
// accessing .value because autocomplete returns an object instead of value
if (typeof condition === "object" && condition !== null) {
condition = condition.value
}
value = filterMap[fieldname].value
if (condition && value)
appliedFilters.value.push([props.doctype, fieldname, condition, value])
}
}
function applyFilters() {
prepareFilters()
fetchDocumentList()
modalController.dismiss()
areFiltersApplied.value = appliedFilters.value.length ? true : false
}
function clearFilters() {
initializeFilters()
fetchDocumentList()
modalController.dismiss()
areFiltersApplied.value = false
}
function fetchDocumentList(start = 0) {
if (start === 0) {
hasNextPage.value = true
}
const filters = [[props.doctype, "docstatus", "!=", "2"]]
filters.push(...defaultFilters.value)
if (appliedFilters.value) filters.push(...appliedFilters.value)
if (workflowStateField.value) {
listOptions.value.fields.push(workflowStateField.value)
}
documents.submit({
...listOptions.value,
start: start || 0,
filters: filters,
})
}
const handleScroll = debounce(() => {
if (!hasNextPage.value) return
const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value
const scrollPercentage = (scrollTop / (scrollHeight - clientHeight)) * 100
if (scrollPercentage >= 90) {
const start = documents.params.start + listOptions.value.page_length
fetchDocumentList(start)
}
}, 500)
const handleRefresh = (event) => {
setTimeout(() => {
fetchDocumentList()
event.target.complete()
}, 500)
}
watch(
() => activeTab.value,
(_value) => {
fetchDocumentList()
}
)
onMounted(async () => {
const workflow = useWorkflow(props.doctype)
await workflow.workflowDoc.promise
workflowStateField.value = workflow.getWorkflowStateField()
fetchDocumentList()
useListUpdate(socket, props.doctype, () => fetchDocumentList())
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/ListView.vue
|
Vue
|
agpl-3.0
| 8,304
|
<template>
<div
class="bg-white w-full flex flex-col items-center justify-center pb-5 max-h-[calc(100vh-5rem)]"
>
<!-- Header -->
<div
class="w-full flex flex-row gap-2 pt-8 pb-5 border-b justify-center items-center sticky top-0 z-[100]"
>
<span class="text-gray-900 font-bold text-lg text-center">
{{ title }}
</span>
</div>
<div class="w-full flex flex-col items-center justify-center gap-4 p-4">
<div
v-for="item in data"
:key="item.fieldname"
class="flex flex-row items-center justify-between w-full"
>
<div class="text-gray-600 text-base">{{ item.label }}</div>
<FormattedField
:value="item.value"
:fieldtype="item.fieldtype"
:fieldname="item.fieldname"
/>
</div>
</div>
</div>
</template>
<script setup>
import { FeatherIcon } from "frappe-ui"
import FormattedField from "@/components/FormattedField.vue"
const props = defineProps({
title: {
type: String,
required: true,
},
data: {
type: Array,
required: true,
},
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/ProfileInfoModal.vue
|
Vue
|
agpl-3.0
| 1,027
|
<template>
<div class="flex flex-col gap-5 my-4 w-full">
<div class="text-lg font-medium text-gray-900">{{ title }}</div>
<div class="flex flex-col bg-white rounded">
<router-link
class="flex flex-row flex-start p-4 items-center justify-between border-b"
v-for="link in props.items"
:key="link.title"
:to="{ name: link.route }"
>
<div class="flex flex-row items-center gap-3 grow">
<component :is="link.icon" class="h-5 w-5 text-gray-500" />
<div class="text-base font-normal text-gray-800">
{{ link.title }}
</div>
</div>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</router-link>
</div>
</div>
</template>
<script setup>
import { FeatherIcon } from "frappe-ui"
const props = defineProps({
title: {
type: String,
required: false,
default: "Quick Links",
},
items: {
type: Array,
required: true,
},
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/QuickLinks.vue
|
Vue
|
agpl-3.0
| 917
|
<template>
<div
v-if="document?.doc"
class="bg-white w-full flex flex-col items-center justify-center pb-5 max-h-[calc(100vh-5rem)]"
>
<!-- Header -->
<div
class="w-full flex flex-row gap-2 pt-8 pb-5 border-b justify-center items-center sticky top-0 z-[100]"
>
<span class="text-gray-900 font-bold text-lg text-center">
{{ document?.doctype }}
</span>
<FeatherIcon
name="external-link"
class="h-4 w-4 text-gray-500 cursor-pointer"
@click="openFormView"
/>
</div>
<!-- Request Summary -->
<div class="w-full p-4 overflow-auto">
<div class="flex flex-col items-center justify-center gap-5">
<div
v-for="field in fieldsWithValues"
:key="field.fieldname"
:class="[
['Small Text', 'Text', 'Long Text', 'Table'].includes(
field.fieldtype
)
? 'flex-col'
: 'flex-row items-center justify-between',
'flex w-full',
]"
>
<div class="text-gray-600 text-base">{{ field.label }}</div>
<component
v-if="field.fieldtype === 'Table'"
:is="field.component"
:doc="document?.doc"
/>
<FormattedField
v-else
:value="field.value"
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
/>
</div>
<!-- Attachments -->
<div
class="flex flex-col gap-2 w-full"
v-if="attachedFiles?.data?.length"
>
<div class="text-gray-600 text-base">Attachments</div>
<ul class="w-full flex flex-col items-center gap-2">
<li
class="bg-gray-100 rounded p-2 w-full"
v-for="(file, index) in attachedFiles.data"
:key="index"
>
<div
class="flex flex-row items-center justify-between text-gray-700 text-sm"
>
<span class="grow" @click="showFilePreview(file)">
{{ file.file_name || file.name }}
</span>
</div>
</li>
</ul>
</div>
</div>
</div>
<!-- Actions -->
<WorkflowActionSheet
v-if="workflow?.hasWorkflow"
:doc="document.doc"
:workflow="workflow"
view="actionSheet"
/>
<div
v-else-if="['Open', 'Draft'].includes(document?.doc?.[approvalField]) && hasPermission('approval')"
class="flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t z-[100] p-4"
>
<Button
@click="updateDocumentStatus({ status: 'Rejected' })"
class="w-full py-5"
variant="subtle"
theme="red"
>
<template #prefix>
<FeatherIcon name="x" class="w-4" />
</template>
Reject
</Button>
<Button
@click="updateDocumentStatus({ status: 'Approved' })"
class="w-full py-5"
variant="solid"
theme="green"
>
<template #prefix>
<FeatherIcon name="check" class="w-4" />
</template>
Approve
</Button>
</div>
<div
v-else-if="
document?.doc?.docstatus === 0 &&
['Approved', 'Rejected'].includes(document?.doc?.[approvalField]) &&
hasPermission('submit')
"
class="flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t z-[100] p-4"
>
<Button
@click="updateDocumentStatus({ docstatus: 1 })"
class="w-full py-5"
variant="solid"
>
Submit
</Button>
</div>
<div
v-else-if="document?.doc?.docstatus === 1 && hasPermission('cancel')"
class="flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t z-[100] p-4"
>
<Button
@click="updateDocumentStatus({ docstatus: 2 })"
class="w-full py-5"
variant="subtle"
theme="red"
>
<template #prefix>
<FeatherIcon name="x" class="w-4" />
</template>
Cancel
</Button>
</div>
<!-- File Preview Modal -->
<ion-modal
ref="modal"
:is-open="showPreviewModal"
@didDismiss="showPreviewModal = false"
>
<FilePreviewModal :file="selectedFile" />
</ion-modal>
</div>
</template>
<script setup>
import { computed, ref, defineAsyncComponent, onMounted } from "vue"
import { IonModal, modalController } from "@ionic/vue"
import { useRouter } from "vue-router"
import {
toast,
createDocumentResource,
createResource,
FeatherIcon,
} from "frappe-ui"
import FormattedField from "@/components/FormattedField.vue"
import FilePreviewModal from "@/components/FilePreviewModal.vue"
import WorkflowActionSheet from "@/components/WorkflowActionSheet.vue"
import { getCompanyCurrency } from "@/data/currencies"
import { formatCurrency } from "@/utils/formatters"
import useWorkflow from "@/composables/workflow"
const props = defineProps({
fields: {
type: Array,
required: true,
},
modelValue: {
type: Object,
required: true,
},
})
const router = useRouter()
let showPreviewModal = ref(false)
let selectedFile = ref({})
let workflow = ref(null)
function showFilePreview(fileObj) {
selectedFile.value = fileObj
showPreviewModal.value = true
}
const document = createDocumentResource({
doctype: props.modelValue.doctype,
name: props.modelValue.name,
auto: true,
onSuccess(doc) {
attachedFiles.reload()
},
})
const attachedFiles = createResource({
url: "hrms.api.get_attachments",
params: {
dt: props.modelValue.doctype,
dn: props.modelValue.name,
},
})
const docPermissions = createResource({
url: "frappe.client.get_doc_permissions",
params: { doctype: props.modelValue.doctype, docname: props.modelValue.name },
auto: true,
})
const permittedWriteFields = createResource({
url: "hrms.api.get_permitted_fields_for_write",
params: { doctype: props.modelValue.doctype },
auto: true,
})
function hasPermission(action) {
if (action === "approval")
return permittedWriteFields.data?.includes(approvalField.value)
return docPermissions.data?.permissions[action]
}
const currency = computed(() => {
let docCurrency = document?.doc?.currency
if (!docCurrency && document?.doc?.company) {
docCurrency = getCompanyCurrency(document?.doc?.company)
}
return docCurrency
})
const fieldsWithValues = computed(() => {
return props.fields.filter((field) => {
if (field.fieldtype === "Currency") {
field.value = formatCurrency(
document.doc?.[field.fieldname],
currency.value
)
} else {
if (field.fieldtype === "Table") {
// dynamically loading child table component as per config
// does not work with @ alias due to vite's import analysis
field.component = defineAsyncComponent(() =>
import(`../components/${field.componentName}.vue`)
)
}
field.value =
document?.doc?.[field.fieldname] || props.modelValue[field.fieldname]
}
return field.value
})
})
const approvalField = computed(() => {
return props.modelValue.doctype === "Expense Claim"
? "approval_status"
: "status"
})
const getSuccessMessage = ({ status = "", docstatus = 0 }) => {
if (status) return `${status} successfully!`
else if (docstatus)
return `Document ${
docstatus === 1 ? "submitted" : "cancelled"
} successfully!`
}
const getFailureMessage = ({ status = "", docstatus = 0 }) => {
if (status)
return `${status === "Approved" ? "Approval" : "Rejection"} failed!`
else if (docstatus)
return `Document ${docstatus === 1 ? "submission" : "cancellation"} failed!`
}
const updateDocumentStatus = ({ status = "", docstatus = 0 }) => {
let updateValues = {}
if (status) updateValues[approvalField.value] = status
if (docstatus) updateValues.docstatus = docstatus
document.setValue.submit(
{ ...updateValues },
{
onSuccess() {
if (docstatus !== 0) modalController.dismiss()
toast({
title: "Success",
text: getSuccessMessage({ status, docstatus }),
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
},
onError() {
toast({
title: "Error",
text: getFailureMessage({ status, docstatus }),
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
},
}
)
}
const openFormView = () => {
modalController.dismiss()
router.push({
name: `${props.modelValue.doctype.replace(/\s+/g, "")}DetailView`,
params: { id: props.modelValue.name },
})
}
onMounted(() => {
workflow.value = useWorkflow(props.modelValue.doctype)
})
</script>
<style scoped>
ion-modal {
--height: 100%;
}
</style>
|
2302_79757062/hrms
|
frontend/src/components/RequestActionSheet.vue
|
Vue
|
agpl-3.0
| 8,193
|
<template>
<div
class="flex flex-col bg-white rounded mt-5 overflow-auto"
v-if="props.items?.length"
>
<div
class="flex flex-row p-3.5 items-center justify-between border-b cursor-pointer"
v-for="link in props.items"
:key="link.name"
@click="openRequestModal(link)"
>
<component
:is="props.component || link.component"
:doc="link"
:workflowStateField="link.workflow_state_field"
:isTeamRequest="props.teamRequests"
/>
</div>
<router-link
v-if="props.addListButton"
:to="{ name: props.listButtonRoute }"
v-slot="{ navigate }"
>
<Button
variant="ghost"
@click="navigate"
class="w-full !text-gray-600 py-6 text-sm border-none bg-white hover:bg-white"
>
View List
</Button>
</router-link>
</div>
<EmptyState message="You have no requests" v-else />
<ion-modal
ref="modal"
:is-open="isRequestModalOpen"
@didDismiss="closeRequestModal"
:initial-breakpoint="1"
:breakpoints="[0, 1]"
>
<RequestActionSheet
:fields="
selectedRequest.doctype === 'Leave Application'
? LEAVE_FIELDS
: EXPENSE_CLAIM_FIELDS
"
v-model="selectedRequest"
/>
</ion-modal>
</template>
<script setup>
import { ref } from "vue"
import { IonModal } from "@ionic/vue"
import RequestActionSheet from "@/components/RequestActionSheet.vue"
import {
LEAVE_FIELDS,
EXPENSE_CLAIM_FIELDS,
} from "@/data/config/requestSummaryFields"
const props = defineProps({
component: {
type: Object,
},
items: {
type: Array,
},
teamRequests: {
type: Boolean,
default: false,
},
addListButton: {
type: Boolean,
default: false,
},
listButtonRoute: {
type: String,
default: "",
},
})
const isRequestModalOpen = ref(false)
const selectedRequest = ref(null)
const openRequestModal = async (request) => {
selectedRequest.value = request
isRequestModalOpen.value = true
}
const closeRequestModal = async () => {
isRequestModalOpen.value = false
selectedRequest.value = null
}
</script>
|
2302_79757062/hrms
|
frontend/src/components/RequestList.vue
|
Vue
|
agpl-3.0
| 1,989
|
<template>
<div class="w-full">
<TabButtons
:buttons="[{ label: 'My Requests' }, { label: 'Team Requests' }]"
v-model="activeTab"
/>
<RequestList v-if="activeTab == 'My Requests'" :items="myRequests" />
<RequestList
v-else-if="activeTab == 'Team Requests'"
:items="teamRequests"
:teamRequests="true"
/>
</div>
</template>
<script setup>
import { ref, inject, onMounted, computed, markRaw } from "vue"
import TabButtons from "@/components/TabButtons.vue"
import RequestList from "@/components/RequestList.vue"
import { myLeaves, teamLeaves } from "@/data/leaves"
import { myClaims, teamClaims } from "@/data/claims"
import LeaveRequestItem from "@/components/LeaveRequestItem.vue"
import ExpenseClaimItem from "@/components/ExpenseClaimItem.vue"
import { useListUpdate } from "@/composables/realtime"
const activeTab = ref("My Requests")
const socket = inject("$socket")
const myRequests = computed(() => updateRequestDetails(myLeaves, myClaims))
const teamRequests = computed(() =>
updateRequestDetails(teamLeaves, teamClaims)
)
function updateRequestDetails(leaves, claims) {
const requests = [...(leaves.data || []), ...(claims.data || [])]
requests.forEach((request) => {
if (request.doctype === "Leave Application") {
request.component = markRaw(LeaveRequestItem)
} else if (request.doctype === "Expense Claim") {
request.component = markRaw(ExpenseClaimItem)
}
})
return getSortedRequests(requests)
}
function getSortedRequests(list) {
// return top 10 requests sorted by posting date
return list
.sort((a, b) => {
return new Date(b.posting_date) - new Date(a.posting_date)
})
.splice(0, 10)
}
onMounted(() => {
useListUpdate(socket, "Leave Application", () => teamLeaves.reload())
useListUpdate(socket, "Expense Claim", () => teamClaims.reload())
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/RequestPanel.vue
|
Vue
|
agpl-3.0
| 1,834
|
<template>
<!-- Header -->
<div class="flex flex-row justify-between items-center">
<h2 class="text-base font-semibold text-gray-800">{{ type }}</h2>
<span class="text-base font-semibold text-gray-800">
{{ total }}
</span>
</div>
<!-- Table -->
<div
v-if="items"
class="flex flex-col bg-white mt-5 rounded border overflow-auto"
>
<div
class="flex flex-row p-3.5 items-center justify-between border-b"
v-for="(item, idx) in items"
:key="idx"
>
<div
class="text-base font-normal whitespace-nowrap overflow-hidden text-ellipsis text-gray-800"
>
{{ item.salary_component }}
</div>
<span class="text-gray-700 font-normal rounded text-base">
{{ formatCurrency(item.amount, salarySlip.currency) }}
</span>
</div>
</div>
<EmptyState
v-else
:message="`No ${props.type?.toLowerCase()}s added`"
:isTableField="true"
/>
</template>
<script setup>
import { computed } from "vue"
import EmptyState from "@/components/EmptyState.vue"
import { formatCurrency } from "@/utils/formatters"
const props = defineProps({
salarySlip: {
type: Object,
required: true,
},
type: {
type: String,
required: true,
},
isReadOnly: {
type: Boolean,
default: false,
},
})
const items = computed(() => {
return props.type === "Earnings"
? props.salarySlip.earnings
: props.salarySlip.deductions
})
const total = computed(() => {
return props.type === "Earnings"
? props.salarySlip.gross_pay
: props.salarySlip.total_deduction
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/SalaryDetailTable.vue
|
Vue
|
agpl-3.0
| 1,508
|
<template>
<div class="flex flex-col w-full justify-center gap-2.5">
<div class="flex flex-row items-center justify-between">
<div class="flex flex-row items-start gap-3 grow">
<SalaryIcon class="h-5 w-5 text-gray-500" />
<div class="flex flex-col items-start gap-1.5">
<div class="text-base font-normal text-gray-800">
{{ title }}
</div>
<div class="text-xs font-normal text-gray-500">
<span>
{{ `Gross Pay: ${formatCurrency(doc.gross_pay, doc.currency)}` }}
</span>
<span class="whitespace-pre"> · </span>
</div>
</div>
</div>
<div class="flex flex-row justify-end items-center gap-2">
<span class="text-gray-700 font-normal rounded text-base">
{{ formatCurrency(doc.net_pay, doc.currency) }}
</span>
<FeatherIcon name="chevron-right" class="h-5 w-5 text-gray-500" />
</div>
</div>
</div>
</template>
<script setup>
import { computed, inject } from "vue"
import { FeatherIcon } from "frappe-ui"
import SalaryIcon from "@/components/icons/SalaryIcon.vue"
import { formatCurrency } from "@/utils/formatters"
const dayjs = inject("$dayjs")
const props = defineProps({
doc: {
type: Object,
},
})
const title = computed(() => {
if (dayjs(props.doc.start_date).isSame(props.doc.end_date, "month")) {
// monthly salary
return dayjs(props.doc.start_date).format("MMM YYYY")
} else {
// quarterly, bimonthly, etc
return `${dayjs(props.doc.start_date).format("MMM YYYY")} - ${dayjs(
props.doc.end_date
).format("MMM YYYY")}`
}
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/SalarySlipItem.vue
|
Vue
|
agpl-3.0
| 1,563
|
<template>
<svg
viewBox="0 0 48 24"
preserveAspectRatio="xMidYMin slice"
class="h-[84px] w-[84px] -mt-10"
>
<circle cx="24" cy="24" r="9" fill="#fff"></circle>
<circle
class="stroke-current text-gray-200"
cx="24"
cy="24"
r="9"
fill="transparent"
stroke-width="4"
></circle>
<circle
class="stroke-current"
:class="colorClass"
cx="24"
cy="24"
r="9"
fill="transparent"
stroke-width="4"
:stroke-dasharray="circumference"
:stroke-dashoffset="dashOffset"
></circle>
</svg>
</template>
<script setup>
import { computed } from "vue"
const props = defineProps({
percentage: {
type: Number,
default: 0,
},
colorClass: {
type: String,
default: "text-orange-500",
},
})
const circumference = computed(() => {
return 2 * Math.PI * 9
})
const dashOffset = computed(() => {
let halfCircumference = circumference.value / 2
if (isNaN(props.percentage)) {
return halfCircumference
}
let percentage = props.percentage
if (percentage > 100) {
percentage = 100
}
return halfCircumference - (percentage / 100) * halfCircumference
})
</script>
|
2302_79757062/hrms
|
frontend/src/components/SemicircleChart.vue
|
Vue
|
agpl-3.0
| 1,113
|
<template>
<div class="flex p-1 bg-gray-200 rounded">
<button
v-for="button in buttons"
:key="button.label"
class="px-8 py-2.5 transition-all rounded-[7px] flex-auto font-medium text-base"
:class="
modelValue === button.label
? 'bg-white drop-shadow text-gray-900'
: 'text-gray-600'
"
@click="$emit('update:modelValue', button.label)"
>
{{ button.label }}
</button>
</div>
</template>
<script setup>
const props = defineProps({
buttons: {
type: Array,
required: true,
},
modelValue: {
type: String,
},
})
defineEmits(["update:modelValue"])
</script>
|
2302_79757062/hrms
|
frontend/src/components/TabButtons.vue
|
Vue
|
agpl-3.0
| 605
|
<template>
<div
v-if="actions.length > 0"
:class="[
props.view === 'form'
? 'px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg'
: 'flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t z-[100] p-4',
]"
>
<Button
v-if="props.view === 'form' || actions.length > 2"
@click="showTransitions()"
class="w-full rounded py-5 text-base disabled:bg-gray-700 disabled:text-white"
variant="solid"
>
<template #prefix>
<FeatherIcon name="chevron-up" class="w-4" />
</template>
Actions
</Button>
<template v-else>
<Button
v-for="action in actions"
class="w-full py-5"
:variant="action.variant"
:theme="action.theme"
@click="applyWorkflow({ workflowAction: action.text })"
>
<template #prefix v-if="action.featherIcon">
<FeatherIcon :name="action.featherIcon" class="w-4" />
</template>
{{ action.text }}
</Button>
</template>
</div>
<ion-action-sheet
:buttons="actions"
:is-open="showActionSheet"
@didDismiss="applyWorkflow({ event: $event })"
>
</ion-action-sheet>
</template>
<script setup>
import { IonActionSheet, modalController } from "@ionic/vue"
import { computed, ref, onMounted } from "vue"
import { FeatherIcon } from "frappe-ui"
const props = defineProps({
doc: {
type: Object,
required: true,
},
workflow: {
type: Object,
required: false,
},
view: {
type: String,
default: "form",
validator: (value) => ["form", "actionSheet"].includes(value),
},
})
const emit = defineEmits(["workflow-applied"])
let showActionSheet = ref(false)
let actions = ref([])
const getTransitions = async () => {
const transitions = await props.workflow.getTransitions(props.doc)
actions.value = transitions.map((transition) => {
let role = ""
let theme = "gray"
let variant = "subtle"
let icon = ""
let actionLabel = transition.toLowerCase()
if (actionLabel.includes("reject") || actionLabel.includes("cancel")) {
role = "destructive"
theme = "red"
variant = "subtle"
icon = "x"
} else if (actionLabel.includes("approve")) {
theme = "green"
variant = "solid"
icon = "check"
}
return {
text: transition,
role: role,
theme: theme,
variant: variant,
featherIcon: icon,
data: {
action: transition,
},
}
})
}
const showTransitions = () => {
if (actions.value?.length > 0) {
// always add last action for dismissing the modal
actions.value.push({
text: "Dismiss",
role: "cancel",
})
}
showActionSheet.value = true
}
const applyWorkflow = async ({ event = "", workflowAction = "" }) => {
const action = workflowAction || event.detail.data?.action
if (action) {
await props.workflow.applyWorkflow(props.doc, action)
modalController.dismiss()
emit("workflow-applied")
}
showActionSheet.value = false
}
onMounted(() => getTransitions())
</script>
<style scoped>
ion-action-sheet {
--button-color: var(--text-gray-500);
}
</style>
|
2302_79757062/hrms
|
frontend/src/components/WorkflowActionSheet.vue
|
Vue
|
agpl-3.0
| 3,036
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="-0.855 -0.855 24 24"
height="24"
width="24"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
>
<g id="wallet--money-payment-finance-wallet">
<path
id="Vector"
d="M19.105714285714285 16.7175v3.184285714285714c0 0.4222362857142857 -0.16781185714285712 0.8272774285714285 -0.4663386428571428 1.125804214285714S17.935807714285716 21.49392857142857 17.513571428571428 21.49392857142857H2.3882142857142856c-0.4222681285714286 0 -0.8272296642857142 -0.16781185714285712 -1.1258153592857143 -0.4663386428571428C0.9638148235714286 20.729063142857143 0.7960714285714285 20.324022 0.7960714285714285 19.901785714285715V7.960714285714285c0 -2.6379418928571425 2.1384866785714287 -4.776428571428571 4.776428571428571 -4.776428571428571H15.92142857142857v3.9803571428571427"
></path>
<path
id="Vector_2"
d="M20.697857142857142 11.941071428571428H15.125357142857142c-0.43965432857142855 0 -0.7960714285714285 0.3564171 -0.7960714285714285 0.7960714285714285v3.184285714285714c0 0.43959064285714283 0.3564171 0.7960714285714285 0.7960714285714285 0.7960714285714285H20.697857142857142c0.43959064285714283 0 0.7960714285714285 -0.3564807857142857 0.7960714285714285 -0.7960714285714285V12.737142857142857c0 -0.43965432857142855 -0.3564807857142857 -0.7960714285714285 -0.7960714285714285 -0.7960714285714285Z"
></path>
<path
id="Vector_3"
d="M19.105714285714285 11.941071428571428v-3.184285714285714c0 -0.4222681285714286 -0.16781185714285712 -0.8272296642857142 -0.4663386428571428 -1.1258201357142856C18.340848857142856 7.332391028571428 17.935807714285716 7.164642857142857 17.513571428571428 7.164642857142857H5.5725"
></path>
</g>
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/EmployeeAdvanceIcon.vue
|
Vue
|
agpl-3.0
| 1,816
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="-1 -1 28 28"
height="24"
width="24"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
>
<g
id="dollar-coin--accounting-billing-payment-cash-coin-currency-money-finance"
>
<path
id="Vector"
d="M13 25.071428571428573c6.666957142857143 0 12.071428571428571 -5.404471428571428 12.071428571428571 -12.071428571428571C25.071428571428573 6.3331357142857145 19.666957142857143 0.9285714285714286 13 0.9285714285714286 6.3331357142857145 0.9285714285714286 0.9285714285714286 6.3331357142857145 0.9285714285714286 13c0 6.666957142857143 5.404564285714286 12.071428571428571 12.071428571428571 12.071428571428571Z"
></path>
<path
id="Vector 3"
d="M16.160578571428573 9.698705714285715c-0.10869857142857144 -0.3075428571428572 -0.27643571428571434 -0.5872285714285714 -0.4895985714285714 -0.8253885714285715 -0.4534214285714286 -0.5065914285714286 -1.112317142857143 -0.8253885714285715 -1.8456842857142857 -0.8253885714285715H11.90865c-1.220737142857143 0 -2.210334285714286 0.9895971428571428 -2.210334285714286 2.210315714285714 0 1.0387185714285714 0.7232642857142858 1.937297142857143 1.7379885714285714 2.1592814285714286l2.918147142857143 0.6383371428571429c1.1367757142857144 0.24867142857142857 1.9470285714285716 1.2560600000000002 1.9470285714285716 2.419727142857143 0 1.3675628571428573 -1.1086214285714286 2.4770942857142857 -2.4761842857142855 2.4770942857142857H12.174500000000002c-1.0781457142857143 0 -1.9953514285714284 -0.6890557142857143 -2.3352828571428574 -1.6507957142857144"
></path>
<path id="Vector 2489" d="M13 8.047612857142857V5.571428571428571"></path>
<path id="Vector 2490" d="M13 20.4282V17.95207142857143"></path>
</g>
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/ExpenseIcon.vue
|
Vue
|
agpl-3.0
| 1,836
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
width="117"
height="117"
viewBox="0 0 117 117"
fill="none"
>
<g clip-path="url(#clip0_0_45)">
<path
d="M93.4394 0H23.5606C10.5485 0 0 10.5485 0 23.5606V93.4394C0 106.452 10.5485 117 23.5606 117H93.4394C106.452 117 117 106.452 117 93.4394V23.5606C117 10.5485 106.452 0 93.4394 0Z"
fill="#A1EEC9"
/>
<path
d="M56.3316 68.0044C45.408 68.0044 36.4657 59.1156 36.4657 48.1385V46.425L47.068 46.5321L46.9609 48.1385C46.9609 53.279 51.1376 57.5092 56.3316 57.5092H60.6154C65.7559 57.5092 69.9861 53.3325 69.9861 48.1385V43.8547C69.9861 38.7142 65.8094 34.484 60.6154 34.484H36.3586L36.4657 23.8817L60.6154 23.9888C71.5389 23.9888 80.4813 32.8776 80.4813 43.8547V48.1385C80.4813 59.062 71.5925 68.0044 60.6154 68.0044H56.3316Z"
fill="#0B313A"
/>
<path
d="M32.1281 85.0856C39.4105 78.7135 48.7812 75.1258 58.5267 75.1258C68.2723 75.1258 77.643 78.7135 84.9254 85.2462L77.8572 93.0105C72.5025 88.2448 65.6485 85.621 58.5267 85.621C51.405 85.621 44.4974 88.2448 39.1428 93.064L32.1817 85.0856H32.1281Z"
fill="#0B313A"
/>
</g>
<defs>
<clipPath id="clip0_0_45">
<rect width="117" height="117" fill="white" />
</clipPath>
</defs>
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/FrappeHRLogo.vue
|
Vue
|
agpl-3.0
| 1,258
|
<template>
<svg
width="116"
height="30"
viewBox="0 0 116 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect
width="30"
height="30"
rx="4"
fill="url(#paint0_linear_33093_155163)"
/>
<path d="M9.00478 6H22V9.37788H9.00478V6Z" fill="white" />
<path
d="M9 24V14.1041L21.0029 14.0986V17.4822L12.7325 17.4879V24H9Z"
fill="white"
/>
<path
d="M39.0114 21V9.36364H46.7159V11.392H41.4716V14.1648H46.2045V16.1932H41.4716V21H39.0114ZM48.1847 21V12.2727H50.5312V13.7955H50.6222C50.7813 13.2538 51.0483 12.8447 51.4233 12.5682C51.7983 12.2879 52.2301 12.1477 52.7188 12.1477C52.84 12.1477 52.9706 12.1553 53.1108 12.1705C53.2509 12.1856 53.3741 12.2064 53.4801 12.233V14.3807C53.3665 14.3466 53.2093 14.3163 53.0085 14.2898C52.8078 14.2633 52.6241 14.25 52.4574 14.25C52.1013 14.25 51.7831 14.3277 51.5028 14.483C51.2263 14.6345 51.0066 14.8466 50.8438 15.1193C50.6847 15.392 50.6051 15.7064 50.6051 16.0625V21H48.1847ZM56.9702 21.1648C56.4134 21.1648 55.9171 21.0682 55.4815 20.875C55.0459 20.678 54.7012 20.3883 54.4474 20.0057C54.1974 19.6193 54.0724 19.1383 54.0724 18.5625C54.0724 18.0777 54.1615 17.6705 54.3395 17.3409C54.5175 17.0114 54.7599 16.7462 55.0668 16.5455C55.3736 16.3447 55.7221 16.1932 56.1122 16.0909C56.5062 15.9886 56.919 15.9167 57.3509 15.875C57.8584 15.822 58.2675 15.7727 58.5781 15.7273C58.8887 15.678 59.1141 15.6061 59.2543 15.5114C59.3944 15.4167 59.4645 15.2765 59.4645 15.0909V15.0568C59.4645 14.697 59.3509 14.4186 59.1236 14.2216C58.9001 14.0246 58.5819 13.9261 58.169 13.9261C57.7334 13.9261 57.3868 14.0227 57.1293 14.2159C56.8717 14.4053 56.7012 14.6439 56.6179 14.9318L54.3793 14.75C54.4929 14.2197 54.7164 13.7614 55.0497 13.375C55.383 12.9848 55.813 12.6856 56.3395 12.4773C56.8698 12.2652 57.4834 12.1591 58.1804 12.1591C58.6652 12.1591 59.1293 12.2159 59.5724 12.3295C60.0194 12.4432 60.4152 12.6193 60.7599 12.858C61.1084 13.0966 61.383 13.4034 61.5838 13.7784C61.7846 14.1496 61.8849 14.5947 61.8849 15.1136V21H59.5895V19.7898H59.5213C59.3812 20.0625 59.1937 20.303 58.9588 20.5114C58.724 20.7159 58.4418 20.8769 58.1122 20.9943C57.7827 21.108 57.402 21.1648 56.9702 21.1648ZM57.6634 19.4943C58.0194 19.4943 58.3338 19.4242 58.6065 19.2841C58.8793 19.1402 59.0933 18.947 59.2486 18.7045C59.4039 18.4621 59.4815 18.1875 59.4815 17.8807V16.9545C59.4058 17.0038 59.3016 17.0492 59.169 17.0909C59.0402 17.1288 58.8944 17.1648 58.7315 17.1989C58.5687 17.2292 58.4058 17.2576 58.2429 17.2841C58.08 17.3068 57.9323 17.3277 57.7997 17.3466C57.5156 17.3883 57.2675 17.4545 57.0554 17.5455C56.8433 17.6364 56.6785 17.7595 56.5611 17.9148C56.4437 18.0663 56.3849 18.2557 56.3849 18.483C56.3849 18.8125 56.5043 19.0644 56.7429 19.2386C56.9853 19.4091 57.2921 19.4943 57.6634 19.4943ZM63.7628 24.2727V12.2727H66.1491V13.7386H66.2571C66.3632 13.5038 66.5166 13.2652 66.7173 13.0227C66.9219 12.7765 67.187 12.572 67.5128 12.4091C67.8423 12.2424 68.2514 12.1591 68.7401 12.1591C69.3764 12.1591 69.9635 12.3258 70.5014 12.6591C71.0393 12.9886 71.4692 13.4867 71.7912 14.1534C72.1132 14.8163 72.2741 15.6477 72.2741 16.6477C72.2741 17.6212 72.117 18.4432 71.8026 19.1136C71.492 19.7803 71.0677 20.286 70.5298 20.6307C69.9957 20.9716 69.3973 21.142 68.7344 21.142C68.2647 21.142 67.8651 21.0644 67.5355 20.9091C67.2098 20.7538 66.9427 20.5587 66.7344 20.3239C66.526 20.0852 66.367 19.8447 66.2571 19.6023H66.1832V24.2727H63.7628ZM66.1321 16.6364C66.1321 17.1553 66.2041 17.608 66.348 17.9943C66.492 18.3807 66.7003 18.6818 66.973 18.8977C67.2457 19.1098 67.5772 19.2159 67.9673 19.2159C68.3613 19.2159 68.6946 19.108 68.9673 18.892C69.2401 18.6723 69.4465 18.3693 69.5866 17.983C69.7306 17.5928 69.8026 17.1439 69.8026 16.6364C69.8026 16.1326 69.7325 15.6894 69.5923 15.3068C69.4522 14.9242 69.2457 14.625 68.973 14.4091C68.7003 14.1932 68.3651 14.0852 67.9673 14.0852C67.5734 14.0852 67.2401 14.1894 66.9673 14.3977C66.6984 14.6061 66.492 14.9015 66.348 15.2841C66.2041 15.6667 66.1321 16.1174 66.1321 16.6364ZM73.8878 24.2727V12.2727H76.2741V13.7386H76.3821C76.4882 13.5038 76.6416 13.2652 76.8423 13.0227C77.0469 12.7765 77.312 12.572 77.6378 12.4091C77.9673 12.2424 78.3764 12.1591 78.8651 12.1591C79.5014 12.1591 80.0885 12.3258 80.6264 12.6591C81.1643 12.9886 81.5942 13.4867 81.9162 14.1534C82.2382 14.8163 82.3991 15.6477 82.3991 16.6477C82.3991 17.6212 82.242 18.4432 81.9276 19.1136C81.617 19.7803 81.1927 20.286 80.6548 20.6307C80.1207 20.9716 79.5223 21.142 78.8594 21.142C78.3897 21.142 77.9901 21.0644 77.6605 20.9091C77.3348 20.7538 77.0677 20.5587 76.8594 20.3239C76.651 20.0852 76.492 19.8447 76.3821 19.6023H76.3082V24.2727H73.8878ZM76.2571 16.6364C76.2571 17.1553 76.3291 17.608 76.473 17.9943C76.617 18.3807 76.8253 18.6818 77.098 18.8977C77.3707 19.1098 77.7022 19.2159 78.0923 19.2159C78.4863 19.2159 78.8196 19.108 79.0923 18.892C79.3651 18.6723 79.5715 18.3693 79.7116 17.983C79.8556 17.5928 79.9276 17.1439 79.9276 16.6364C79.9276 16.1326 79.8575 15.6894 79.7173 15.3068C79.5772 14.9242 79.3707 14.625 79.098 14.4091C78.8253 14.1932 78.4901 14.0852 78.0923 14.0852C77.6984 14.0852 77.3651 14.1894 77.0923 14.3977C76.8234 14.6061 76.617 14.9015 76.473 15.2841C76.3291 15.6667 76.2571 16.1174 76.2571 16.6364ZM87.9901 21.1705C87.0923 21.1705 86.3196 20.9886 85.6719 20.625C85.0279 20.2576 84.5317 19.7386 84.1832 19.0682C83.8348 18.3939 83.6605 17.5966 83.6605 16.6761C83.6605 15.7784 83.8348 14.9905 84.1832 14.3125C84.5317 13.6345 85.0223 13.1061 85.6548 12.7273C86.2912 12.3485 87.0374 12.1591 87.8935 12.1591C88.4692 12.1591 89.0052 12.2519 89.5014 12.4375C90.0014 12.6193 90.437 12.8939 90.8082 13.2614C91.1832 13.6288 91.4749 14.0909 91.6832 14.6477C91.8916 15.2008 91.9957 15.8485 91.9957 16.5909V17.2557H84.6264V15.7557H89.7173C89.7173 15.4072 89.6416 15.0985 89.4901 14.8295C89.3385 14.5606 89.1283 14.3504 88.8594 14.1989C88.5942 14.0436 88.2855 13.9659 87.9332 13.9659C87.5658 13.9659 87.2401 14.0511 86.956 14.2216C86.6757 14.3883 86.456 14.6136 86.2969 14.8977C86.1378 15.178 86.0563 15.4905 86.0526 15.8352V17.2614C86.0526 17.6932 86.1321 18.0663 86.2912 18.3807C86.4541 18.6951 86.6832 18.9375 86.9787 19.108C87.2741 19.2784 87.6245 19.3636 88.0298 19.3636C88.2988 19.3636 88.545 19.3258 88.7685 19.25C88.992 19.1742 89.1832 19.0606 89.3423 18.9091C89.5014 18.7576 89.6226 18.572 89.706 18.3523L91.9446 18.5C91.831 19.0379 91.598 19.5076 91.2457 19.9091C90.8973 20.3068 90.4465 20.6174 89.8935 20.8409C89.3442 21.0606 88.7098 21.1705 87.9901 21.1705ZM93.6207 21V9.36364H96.081V14.1648H101.075V9.36364H103.53V21H101.075V16.1932H96.081V21H93.6207ZM105.558 21V9.36364H110.149C111.028 9.36364 111.778 9.52083 112.399 9.83523C113.024 10.1458 113.5 10.5871 113.825 11.1591C114.155 11.7273 114.32 12.3958 114.32 13.1648C114.32 13.9375 114.153 14.6023 113.82 15.1591C113.486 15.7121 113.003 16.1364 112.371 16.4318C111.742 16.7273 110.981 16.875 110.087 16.875H107.013V14.8977H109.689C110.159 14.8977 110.549 14.8333 110.859 14.7045C111.17 14.5758 111.401 14.3826 111.553 14.125C111.708 13.8674 111.786 13.5473 111.786 13.1648C111.786 12.7784 111.708 12.4527 111.553 12.1875C111.401 11.9223 111.168 11.7216 110.854 11.5852C110.543 11.4451 110.151 11.375 109.678 11.375H108.018V21H105.558ZM111.842 15.7045L114.734 21H112.018L109.189 15.7045H111.842Z"
fill="url(#paint1_linear_33093_155163)"
/>
<defs>
<linearGradient
id="paint0_linear_33093_155163"
x1="15"
y1="0"
x2="15"
y2="30"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#2E2E2E" />
<stop offset="1" stop-color="#242424" />
</linearGradient>
<linearGradient
id="paint1_linear_33093_155163"
x1="77"
y1="3"
x2="77"
y2="27"
gradientUnits="userSpaceOnUse"
>
<stop stop-color="#2E2E2E" />
<stop offset="1" stop-color="#242424" />
</linearGradient>
</defs>
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/FrappeHRLogoType.vue
|
Vue
|
agpl-3.0
| 7,816
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-home"
>
<path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
<polyline points="9 22 9 12 15 12 15 22" />
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/HomeIcon.vue
|
Vue
|
agpl-3.0
| 373
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-calendar"
>
<rect width="18" height="18" x="3" y="4" rx="2" ry="2" />
<line x1="16" x2="16" y1="2" y2="6" />
<line x1="8" x2="8" y1="2" y2="6" />
<line x1="3" x2="21" y1="10" y2="10" />
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/LeaveIcon.vue
|
Vue
|
agpl-3.0
| 451
|
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="-1 -1 28 28"
height="24"
width="24"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
>
<g id="bank--institution-saving-bank-payment-finance">
<path
id="Vector"
d="M23.975714285714286 10.214508571428572H2.0242857142857145c-1.0399925714285716 0 -1.4857068571428573 -1.1328571428571428 -0.6685639999999999 -1.6714285714285715L12.331428571428571 1.3559297142857143C12.53408 1.2367234285714286 12.764904285714286 1.173862857142857 13 1.173862857142857c0.2351142857142857 0 0.4659385714285714 0.06286057142857143 0.6685714285714286 0.18206685714285714l10.975714285714286 7.187150285714286c0.8171428571428572 0.5385714285714286 0.37142857142857144 1.6714285714285715 -0.6685714285714286 1.6714285714285715Z"
></path>
<path
id="Vector_2"
d="M24.142857142857142 20.42857142857143H1.8571428571428572c-0.5128351428571428 0 -0.9285714285714286 0.4158142857142857 -0.9285714285714286 0.9285714285714286V24.142857142857142c0 0.5127571428571429 0.4157362857142857 0.9285714285714286 0.9285714285714286 0.9285714285714286h22.285714285714285c0.5127571428571429 0 0.9285714285714286 -0.4158142857142857 0.9285714285714286 -0.9285714285714286v-2.7857142857142856c0 -0.5127571428571429 -0.4158142857142857 -0.9285714285714286 -0.9285714285714286 -0.9285714285714286Z"
></path>
<path
id="Vector_3"
d="M3.7142857142857144 10.214285714285715V20.42857142857143"
></path>
<path
id="Vector_4"
d="M9.904718571428571 10.214285714285715V20.42857142857143"
></path>
<path
id="Vector_5"
d="M16.09528142857143 10.214285714285715V20.42857142857143"
></path>
<path
id="Vector_6"
d="M22.285714285714285 10.214285714285715V20.42857142857143"
></path>
</g>
</svg>
</template>
|
2302_79757062/hrms
|
frontend/src/components/icons/SalaryIcon.vue
|
Vue
|
agpl-3.0
| 1,859
|
import { createResource, toast } from "frappe-ui"
function getFileReader() {
const fileReader = new FileReader()
const zoneOriginalInstance = fileReader["__zone_symbol__originalInstance"]
return zoneOriginalInstance || fileReader
}
export class FileAttachment {
constructor(fileObj) {
this.fileObj = fileObj
this.fileName = fileObj.name
}
async upload(documentType, documentName, fieldName) {
return new Promise(async (resolve, reject) => {
const reader = getFileReader()
const uploader = createResource({
url: "hrms.api.upload_base64_file",
onSuccess: (fileDoc) => resolve(fileDoc),
onError: (error) => {
toast({
title: "Error",
text: `File upload failed for ${this.fileName}. ${
error.messages?.[0] || ""
}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
reject(error)
},
})
reader.onload = () => {
console.log("Loaded successfully ✅")
this.fileContents = reader.result.toString().split(",")[1]
uploader.submit({
content: this.fileContents,
dt: documentType,
dn: documentName,
filename: this.fileName,
fieldname: fieldName,
})
}
reader.readAsDataURL(this.fileObj)
})
}
delete() {
return createResource({
url: "hrms.api.delete_attachment",
onSuccess: () => {
console.log("Deleted successfully ✅")
},
onError: (error) => {
toast({
title: "Error",
text: `File deletion failed. ${error.messages?.[0] || ""}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
},
}).submit({
filename: this.fileName,
})
}
}
const hasWords = (list, status) => list.some((word) => status.includes(word))
export async function guessStatusColor(doctype, status) {
const statesResource = createResource({
url: "hrms.api.get_doctype_states",
params: { doctype: doctype },
})
const stateMap = await statesResource.reload()
if (Object.keys(stateMap || {})?.length) {
if (stateMap?.[status] === "yellow") return "orange"
if (stateMap?.[status]) return stateMap?.[status]
}
let color = "gray"
status = status.toLowerCase()
if (
hasWords(
["open", "pending", "unpaid", "review", "medium", "not approved"],
status
)
) {
color = "orange"
} else if (
hasWords(["urgent", "high", "failed", "rejected", "error"], status)
) {
color = "red"
} else if (
hasWords(
[
"closed",
"finished",
"converted",
"completed",
"complete",
"confirmed",
"approved",
"yes",
"active",
"available",
"success",
],
status
)
) {
color = "green"
} else if (status === "submitted") {
color = "blue"
}
return color
}
|
2302_79757062/hrms
|
frontend/src/composables/index.js
|
JavaScript
|
agpl-3.0
| 2,749
|
import { reactive } from "vue"
const subscribed = reactive({})
export function useListUpdate(socket, doctype, callback) {
subscribe(socket, doctype)
socket.on("list_update", (data) => {
if (data.doctype == doctype) {
callback(data.name)
}
})
}
function subscribe(socket, doctype) {
if (subscribed[doctype]) return
socket.emit("doctype_subscribe", doctype)
subscribed[doctype] = true
}
|
2302_79757062/hrms
|
frontend/src/composables/realtime.js
|
JavaScript
|
agpl-3.0
| 402
|
import { createResource, toast } from "frappe-ui"
import { computed } from "vue"
import { userResource } from "@/data/user"
export default function useWorkflow(doctype) {
const workflowDoc = createResource({
url: "hrms.api.get_workflow",
params: { doctype: doctype },
cache: ["hrms:workflow", doctype],
})
workflowDoc.reload()
const hasWorkflow = computed(() => {
const workflowData = workflowDoc?.data
return Boolean(Object.keys(workflowData || {}).length > 0)
})
const getWorkflowStateField = () => {
// NOTE: checkbox labelled 'Don't Override Status' is named override_status hence the inverted logic
return !workflowDoc.data?.override_status
? workflowDoc.data?.workflow_state_field
: ""
}
const getDefaultState = (docstatus) => {
return workflowDoc.data?.states.find(
(state) => state.doc_status == docstatus
)
}
const getTransitions = async (doc) => {
const transitions = createResource({
url: "frappe.model.workflow.get_transitions",
params: { doc: doc },
transform: (data) => {
const isSelfApproval = userResource?.data?.name == doc.owner
return data
.filter(
(transition) => transition.allow_self_approval || !isSelfApproval
)
.map((transition) => transition.action)
},
})
return await transitions.reload()
}
const getDocumentStateRoles = (state) => {
return workflowDoc.data?.states
.filter((s) => s.state == state)
.map((s) => s.allow_edit)
}
const isReadOnly = (doc) => {
const state_fieldname = workflowDoc.data?.workflow_state_field
if (!state_fieldname) return false
const state = doc[state_fieldname] || getDefaultState(doc.docstatus)
const roles = getDocumentStateRoles(state)
return !roles.some((role) => userResource.data.roles.includes(role))
}
const applyWorkflow = async (doc, action) => {
const applyWorkflow = createResource({
url: "frappe.model.workflow.apply_workflow",
params: { doc: doc, action: action },
onSuccess() {
toast({
title: "Success",
text: `Workflow action '${action}' applied successfully`,
icon: "check-circle",
position: "bottom-center",
iconClasses: "text-green-500",
})
},
onError() {
toast({
title: "Error",
text: `Error applying workflow action: ${action}`,
icon: "alert-circle",
position: "bottom-center",
iconClasses: "text-red-500",
})
console.log(`Error applying workflow action: ${action}`)
},
})
await applyWorkflow.reload()
}
return {
hasWorkflow,
workflowDoc,
getWorkflowStateField,
getTransitions,
getDocumentStateRoles,
isReadOnly,
applyWorkflow,
}
}
|
2302_79757062/hrms
|
frontend/src/composables/workflow.js
|
JavaScript
|
agpl-3.0
| 2,640
|
import { createResource } from "frappe-ui"
import { employeeResource } from "./employee"
const transformAdvanceData = (data) => {
return data.map((claim) => {
claim.doctype = "Employee Advance"
return claim
})
}
export const advanceBalance = createResource({
url: "hrms.api.get_employee_advance_balance",
params: {
employee: employeeResource.data.name,
},
auto: true,
cache: "hrms:employee_advance_balance",
transform(data) {
return transformAdvanceData(data)
},
})
|
2302_79757062/hrms
|
frontend/src/data/advances.js
|
JavaScript
|
agpl-3.0
| 485
|
import { createResource } from "frappe-ui"
import { employeeResource } from "./employee"
import { reactive } from "vue"
export const expenseClaimSummary = createResource({
url: "hrms.api.get_expense_claim_summary",
params: {
employee: employeeResource.data.name,
},
auto: true,
cache: "hrms:expense_claim_summary",
})
const transformClaimData = (data) => {
return data.map((claim) => {
claim.doctype = "Expense Claim"
return claim
})
}
export const myClaims = createResource({
url: "hrms.api.get_expense_claims",
params: {
employee: employeeResource.data.name,
limit: 10,
},
auto: true,
cache: "hrms:my_claims",
transform(data) {
return transformClaimData(data)
},
onSuccess() {
expenseClaimSummary.reload()
},
})
export const teamClaims = createResource({
url: "hrms.api.get_expense_claims",
params: {
employee: employeeResource.data.name,
approver_id: employeeResource.data.user_id,
for_approval: 1,
limit: 10,
},
auto: true,
cache: "hrms:team_claims",
transform(data) {
return transformClaimData(data)
},
})
export let claimTypesByID = reactive({})
export const claimTypesResource = createResource({
url: "hrms.api.get_expense_claim_types",
auto: true,
transform(data) {
return data.map((row) => {
claimTypesByID[row.name] = row
return row
})
},
})
|
2302_79757062/hrms
|
frontend/src/data/claims.js
|
JavaScript
|
agpl-3.0
| 1,319
|
// This config holds the fields that should be shown in the request summary action sheet
// TODO: This should be config-driven somehow
export const LEAVE_FIELDS = [
{
fieldname: "name",
label: "ID",
fieldtype: "Data",
},
{
fieldname: "leave_type",
label: "Leave Type",
fieldtype: "Link",
},
{
fieldname: "leave_dates",
label: "Leave Dates",
fieldtype: "DateRange",
},
{
fieldname: "half_day",
label: "Half Day",
fieldtype: "Check",
},
{
fieldname: "half_day_date",
label: "Half Day Date",
fieldtype: "Date",
},
{
fieldname: "total_leave_days",
label: "Total Leave Days",
fieldtype: "Float",
},
{
fieldname: "employee",
label: "Employee",
fieldtype: "Link",
},
{
fieldname: "leave_balance",
label: "Leave Balance",
fieldtype: "Float",
},
{
fieldname: "status",
label: "Status",
fieldtype: "Select",
},
{
fieldname: "description",
label: "Reason",
fieldtype: "Small Text",
},
]
export const EXPENSE_CLAIM_FIELDS = [
{
fieldname: "name",
label: "ID",
fieldtype: "Data",
},
{
fieldname: "posting_date",
label: "Posting Date",
fieldtype: "Date",
},
{
fieldname: "employee",
label: "Employee",
fieldtype: "Link",
},
{
fieldname: "expenses",
label: "Expenses",
fieldtype: "Table",
componentName: "ExpenseItems",
},
{
fieldname: "total_claimed_amount",
label: "Total Claimed Amount",
fieldtype: "Currency",
},
{
fieldname: "total_sanctioned_amount",
label: "Total Sanctioned Amount",
fieldtype: "Currency",
},
{
fieldname: "total_taxes_and_charges",
label: "Total Taxes and Charges",
fieldtype: "Currency",
},
{
fieldname: "total_advance_amount",
label: "Total Advance Amount",
fieldtype: "Currency",
},
{
fieldname: "grand_total",
label: "Grand Total",
fieldtype: "Currency",
},
{
fieldname: "status",
label: "Status",
fieldtype: "Select",
},
{
fieldname: "approval_status",
label: "Approval Status",
fieldtype: "Select",
},
]
|
2302_79757062/hrms
|
frontend/src/data/config/requestSummaryFields.js
|
JavaScript
|
agpl-3.0
| 1,992
|
import { createResource } from "frappe-ui"
const companyCurrency = createResource({
url: "hrms.api.get_company_currencies",
auto: true,
})
const currencySymbols = createResource({
url: "hrms.api.get_currency_symbols",
auto: true,
})
export function getCompanyCurrency(company) {
return companyCurrency?.data?.[company]?.[0]
}
export function getCompanyCurrencySymbol(company) {
return companyCurrency?.data?.[company]?.[1]
}
export function getCurrencySymbol(currency) {
return currencySymbols?.data?.[currency]
}
|
2302_79757062/hrms
|
frontend/src/data/currencies.js
|
JavaScript
|
agpl-3.0
| 526
|
import router from "@/router"
import { createResource } from "frappe-ui"
export const employeeResource = createResource({
url: "hrms.api.get_current_employee_info",
cache: "hrms:employee",
onError(error) {
if (error && error.exc_type === "AuthenticationError") {
router.push("/login")
}
},
})
|
2302_79757062/hrms
|
frontend/src/data/employee.js
|
JavaScript
|
agpl-3.0
| 305
|
import { createResource } from "frappe-ui"
import { reactive } from "vue"
import { employeeResource } from "./employee"
let employeesByID = reactive({})
let employeesByUserID = reactive({})
export const employees = createResource({
url: "hrms.api.get_all_employees",
auto: true,
transform(data) {
return data.map((employee) => {
employee.isActive = employee.status === "Active"
employeesByID[employee.name] = employee
employeesByUserID[employee.user_id] = employee
return employee
})
},
onError(error) {
if (error && error.exc_type === "AuthenticationError") {
router.push({ name: "Login" })
}
},
})
export function getEmployeeInfo(employeeID) {
if (!employeeID) employeeID = employeeResource.data.name
return employeesByID[employeeID]
}
export function getEmployeeInfoByUserID(userID) {
return employeesByUserID[userID]
}
|
2302_79757062/hrms
|
frontend/src/data/employees.js
|
JavaScript
|
agpl-3.0
| 861
|
import { createResource } from "frappe-ui"
import { employeeResource } from "./employee"
import dayjs from "@/utils/dayjs"
const transformLeaveData = (data) => {
return data.map((leave) => {
leave.leave_dates = getLeaveDates(leave)
leave.doctype = "Leave Application"
return leave
})
}
export const getLeaveDates = (leave) => {
if (leave.from_date == leave.to_date)
return dayjs(leave.from_date).format("D MMM")
else
return `${dayjs(leave.from_date).format("D MMM")} - ${dayjs(
leave.to_date
).format("D MMM")}`
}
export const myLeaves = createResource({
url: "hrms.api.get_leave_applications",
params: {
employee: employeeResource.data.name,
limit: 10,
},
auto: true,
cache: "hrms:my_leaves",
transform(data) {
return transformLeaveData(data)
},
onSuccess() {
leaveBalance.reload()
},
})
export const teamLeaves = createResource({
url: "hrms.api.get_leave_applications",
params: {
employee: employeeResource.data.name,
approver_id: employeeResource.data.user_id,
for_approval: 1,
limit: 10,
},
auto: true,
cache: "hrms:team_leaves",
transform(data) {
return transformLeaveData(data)
},
})
export const leaveBalance = createResource({
url: "hrms.api.get_leave_balance_map",
params: {
employee: employeeResource.data.name,
},
auto: true,
cache: "hrms:leave_balance",
transform: (data) => {
// Calculate balance percentage for each leave type
return Object.fromEntries(
Object.entries(data).map(([leave_type, allocation]) => {
allocation.balance_percentage =
(allocation.balance_leaves / allocation.allocated_leaves) * 100
return [leave_type, allocation]
})
)
},
})
|
2302_79757062/hrms
|
frontend/src/data/leaves.js
|
JavaScript
|
agpl-3.0
| 1,657
|
import { createResource, createListResource } from "frappe-ui"
import { userResource } from "./user"
export const unreadNotificationsCount = createResource({
url: "hrms.api.get_unread_notifications_count",
cache: "hrms:unread_notifications_count",
initialData: 0,
auto: true,
})
export const notifications = createListResource({
doctype: "PWA Notification",
filters: { to_user: userResource.data.name },
fields: [
"name",
"from_user",
"message",
"read",
"creation",
"reference_document_type",
"reference_document_name",
],
auto: true,
cache: "hrms:notifications",
orderBy: "creation desc",
onSuccess() {
unreadNotificationsCount.reload()
},
})
export const arePushNotificationsEnabled = createResource({
url: "hrms.api.are_push_notifications_enabled",
cache: "hrms:push_notifications_enabled",
auto: true,
})
|
2302_79757062/hrms
|
frontend/src/data/notifications.js
|
JavaScript
|
agpl-3.0
| 844
|
import { computed, reactive } from "vue"
import { createResource, call } from "frappe-ui"
import { userResource } from "./user"
import { employeeResource } from "./employee"
import router from "@/router"
export function sessionUser() {
let cookies = new URLSearchParams(document.cookie.split("; ").join("&"))
let _sessionUser = cookies.get("user_id")
if (_sessionUser === "Guest") {
_sessionUser = null
}
return _sessionUser
}
function handleLogin(response) {
if (response.message === "Logged In") {
userResource.reload()
employeeResource.reload()
session.user = sessionUser()
router.replace(response.default_route || "/")
}
}
export const session = reactive({
login: async (email, password) => {
const response = await call("login", { usr: email, pwd: password })
handleLogin(response)
return response
},
otp: async (tmp_id, otp) => {
const response = await call("login", { tmp_id, otp })
handleLogin(response)
return response
},
logout: createResource({
url: "logout",
onSuccess() {
userResource.reset()
employeeResource.reset()
session.user = sessionUser()
router.replace({ name: "Login" })
window.location.reload()
},
}),
user: sessionUser(),
isLoggedIn: computed(() => !!session.user),
})
|
2302_79757062/hrms
|
frontend/src/data/session.js
|
JavaScript
|
agpl-3.0
| 1,257
|
import router from "@/router"
import { createResource } from "frappe-ui"
export const userResource = createResource({
url: "hrms.api.get_current_user_info",
cache: "hrms:user",
onError(error) {
if (error && error.exc_type === "AuthenticationError") {
router.push({ name: "Login" })
}
},
})
|
2302_79757062/hrms
|
frontend/src/data/user.js
|
JavaScript
|
agpl-3.0
| 302
|