diff --git a/.env b/.env
index 3056e8d..5f98f5a 100644
--- a/.env
+++ b/.env
@@ -1 +1 @@
-VITE_APP_VERSION=1.2.20260313-20
\ No newline at end of file
+VITE_APP_VERSION=1.3.20260313-70
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
index 2da4e13..eb26e36 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -4,30 +4,44 @@ import { createStore } from 'vuex'
const store = createStore({
state: {
name: '访客预约系统',
+ // 状态映射表(与后端枚举对应)
+ statusMap: {
+ // 待审核分组(-1)
+ 0: { statusName: '待审批', className: 'wait', group: -1 },
+ 90: { statusName: '逾期未审', className: 'overdue', group: -1 },
+ // 待来访分组(-2)
+ 1: { statusName: '已审批', className: 'pass', group: -2 },
+ 11: { statusName: '待到访', className: 'pending', group: -2 },
+ 12: { statusName: '已到访', className: 'visited', group: -2 },
+ 91: { statusName: '未到访', className: 'not-visited', group: -2 },
+ 99: { statusName: '已完成', className: 'finished', group: -2 },
+ // 已结束分组(-3)
+ 2: { statusName: '已拒绝', className: 'refuse', group: -3 },
+ 3: { statusName: '已撤销', className: 'cancel', group: null } // 不在任何分组
+ },
+ // 状态分类Tab(筛选用,与后端状态分组对应)
+ statusTabs: [
+ { label: '待审核', value: -1, className: 'wait', count: 0, fetched: false },
+ { label: '待来访', value: -2, className: 'pass', count: 0, fetched: false },
+ { label: '已结束', value: -3, className: 'end', count: 0, fetched: false }
+ ],
+ // 兼容旧版
stateEnum: {
- 0: {
- statusName:'待审核',
- className: 'status',
- statusText: '您的来访预约还未审核,请耐心等待',
- status: 0
- },
- 1: {
- statusName: '已通过',
- className: 'pass',
- statusText: '预约审核通过',
- status: 1
-
- },
- 2: {
- statusName:'未通过',
- className: 'refuse',
- statusText: '预约审核已拒绝',
- status: 2
- }
+ 0: { statusName: '待审核', className: 'status', statusText: '您的来访预约还未审核,请耐心等待', status: 0 },
+ 1: { statusName: '已通过', className: 'pass', statusText: '预约审核通过', status: 1 },
+ 2: { statusName: '未通过', className: 'refuse', statusText: '预约审核已拒绝', status: 2 }
}
},
getters: {
-
+ // 根据status获取状态信息
+ getStatusInfo: (state) => (status) => {
+ return state.statusMap[status] || { statusName: '未知', className: 'default', group: null }
+ },
+ // 获取状态分组值
+ getStatusGroup: (state) => (status) => {
+ const info = state.statusMap[status]
+ return info ? info.group : null
+ }
},
mutations: {
diff --git a/src/views/adminHome.vue b/src/views/adminHome.vue
index 9d7169e..26e3b12 100644
--- a/src/views/adminHome.vue
+++ b/src/views/adminHome.vue
@@ -40,7 +40,7 @@
随行人数:{{ item.visitingNum }}
来访事由:{{ item.reason }}
- {{ stateEnum[item.status].statusName }}
+ {{ getStatusInfo(item.status).statusName }}
@@ -83,6 +83,12 @@ const query = reactive({
})
const recordArr = ref([])
const stateEnum = store.state.stateEnum
+
+// 获取完整状态信息
+const getStatusInfo = (status) => {
+ return store.getters.getStatusInfo(status)
+}
+
token.value = localStorage.getItem('token')
localStorage.setItem('redirect', '/adminHome')
@@ -439,6 +445,47 @@ onMounted(() => {
color: #30BF78;
background: #E7F8F5;
}
+
+ // 新增状态样式
+ .wait {
+ color: #E6A23C;
+ background: #FFF7CC;
+ }
+
+ .cancel {
+ color: #909399;
+ background: #F4F4F5;
+ }
+
+ .pending {
+ color: #409EFF;
+ background: #ECF5FF;
+ }
+
+ .visited {
+ color: #67C23A;
+ background: #F0F9EB;
+ }
+
+ .overdue {
+ color: #E6A23C;
+ background: #FEF0F0;
+ }
+
+ .not-visited {
+ color: #909399;
+ background: #F4F4F5;
+ }
+
+ .finished {
+ color: #999999;
+ background: #F5F5F5;
+ }
+
+ .default {
+ color: #666666;
+ background: #F5F5F5;
+ }
}
}
diff --git a/src/views/applyRecord.vue b/src/views/applyRecord.vue
index b12092b..f970d48 100644
--- a/src/views/applyRecord.vue
+++ b/src/views/applyRecord.vue
@@ -3,8 +3,8 @@
提交时间:{{ item.createTime }}
-
-
{{ stateEnum[item.status].statusName }}
+
+ {{ getStatusInfo(item.status).statusName }}
@@ -16,7 +16,7 @@
拜访时间:{{ item.hours }}
- {{ item.status == 2 && item.remark ? item.remark : stateEnum[item.status].statusText }}
+ {{ item.status == 2 && item.remark ? item.remark : getStatusInfo(item.status).statusText }}
@@ -44,6 +44,11 @@ import { Toast, ImagePreview } from 'vant';
const total = ref()
const recordArr = ref([])
const stateEnum = store.state.stateEnum
+
+ // 获取完整状态信息
+ const getStatusInfo = (status) => {
+ return store.getters.getStatusInfo(status)
+ }
/* @setup */
console.log(localStorage.getItem('userToken'))
@@ -142,6 +147,31 @@ import { Toast, ImagePreview } from 'vant';
.refuse{
color: #FF6643;
}
+ // 新增状态样式
+ .wait{
+ color: #E6A23C;
+ }
+ .cancel{
+ color: #909399;
+ }
+ .pending{
+ color: #409EFF;
+ }
+ .visited{
+ color: #67C23A;
+ }
+ .overdue{
+ color: #E6A23C;
+ }
+ .not-visited{
+ color: #909399;
+ }
+ .finished{
+ color: #999999;
+ }
+ .default{
+ color: #666666;
+ }
}
.apply-content{
width: 100%;
diff --git a/src/views/visitorManage.vue b/src/views/visitorManage.vue
index dd49f1f..cb05c96 100644
--- a/src/views/visitorManage.vue
+++ b/src/views/visitorManage.vue
@@ -1,9 +1,15 @@
- 已通过
- 待审批
- 已拒绝
+
+ {{ tab.label }}
+ ({{ tab.count }})
+
@@ -15,8 +21,8 @@
被访人:{{ item.visitingName }}
来访事由:{{ item.reason }}
-
- {{ visitorStatusMap[item.status]?.name || '未知' }}
+
+ {{ getStatusInfo(item.status).statusName }}
暂无数据
@@ -25,28 +31,44 @@
@@ -88,13 +116,17 @@ onMounted(() => {
flex: 1;
text-align: center;
padding: 0.2rem;
- background: #fff;
- border-radius: 0.2rem;
font-size: 0.37rem;
&.active {
- background: #1989fa;
- color: #fff;
+ color: #1989fa;
+ font-weight: bold;
+ }
+
+ .count {
+ font-size: 0.28rem;
+ color: #666;
+ margin-left: 0.1rem;
}
}
}
@@ -145,6 +177,11 @@ onMounted(() => {
color: #f56c6c;
}
+ &.cancel {
+ background: #fef0f0;
+ color: #909399;
+ }
+
&.pending {
background: #ecf5ff;
color: #409eff;
@@ -155,11 +192,26 @@ onMounted(() => {
color: #67c23a;
}
+ &.overdue {
+ background: #fef0f0;
+ color: #e6a23c;
+ }
+
+ &.not-visited {
+ background: #f4f4f5;
+ color: #909399;
+ }
+
&.finished {
background: #f5f5f5;
color: #999;
}
+ &.end {
+ background: #f5f5f5;
+ color: #909399;
+ }
+
&.default {
background: #f5f5f5;
color: #666;
diff --git a/src/views/visitorRecord.vue b/src/views/visitorRecord.vue
index c2ee893..a08334e 100644
--- a/src/views/visitorRecord.vue
+++ b/src/views/visitorRecord.vue
@@ -1,10 +1,10 @@
-
- {{ item.statusName }}
-

+
+ {{ item.label }}
+
@@ -18,8 +18,8 @@
随行人数:{{ item.visitingNum }}
来访事由:{{ item.reason }}
-
- {{ stateEnum[item.status].statusName }}
+
+ {{ getStatusInfo(item.status).statusName }}
@@ -31,7 +31,7 @@