diff --git a/src/components/Dict/DictLabel.vue b/src/components/Dict/DictLabel.vue
index 61ab570..8391618 100644
--- a/src/components/Dict/DictLabel.vue
+++ b/src/components/Dict/DictLabel.vue
@@ -32,25 +32,47 @@ const getLabelAndTagByValue = async (dictCode: string, value: any) => {
// 按需加载字典数据
await dictStore.loadDictItems(dictCode)
// 从缓存中获取字典数据
- const dictItems = dictStore.getDictItems(dictCode)
+ const response: any = dictStore.getDictItems(dictCode)
+
+ // 处理API响应格式
+ let dictItems = []
+ if (Array.isArray(response)) {
+ dictItems = response
+ } else if (response && typeof response === 'object' && Array.isArray(response.data)) {
+ dictItems = response.data
+ } else {
+ console.warn(`Dictionary items for code "${dictCode}" is not in expected format:`, response)
+ return {
+ label: '',
+ tagType: undefined
+ }
+ }
+
// 查找对应的字典项
- const dictItem = dictItems.find((item) => item.value == value)
+ const dictItem = dictItems.find((item: any) => item.value == value)
return {
label: dictItem?.label || '',
tagType: dictItem?.tagType
}
}
+
/**
* 更新 label 和 tagType
*/
const updateLabelAndTag = async () => {
if (!props.code || props.modelValue === undefined) return
- const { label: newLabel, tagType: newTagType } = await getLabelAndTagByValue(
- props.code,
- props.modelValue
- )
- label.value = newLabel
- tagType.value = newTagType as typeof tagType.value
+ try {
+ const { label: newLabel, tagType: newTagType } = await getLabelAndTagByValue(
+ props.code,
+ props.modelValue
+ )
+ label.value = newLabel
+ tagType.value = newTagType as typeof tagType.value
+ } catch (error) {
+ console.error('Failed to update dict label:', error)
+ label.value = ''
+ tagType.value = undefined
+ }
}
// 初始化或code变化时更新标签和标签样式
diff --git a/src/components/Notification/ApprovalForm.vue b/src/components/Notification/ApprovalForm.vue
new file mode 100644
index 0000000..3bc9985
--- /dev/null
+++ b/src/components/Notification/ApprovalForm.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/src/components/Notification/index.vue b/src/components/Notification/index.vue
index 3db62d7..ee5083e 100644
--- a/src/components/Notification/index.vue
+++ b/src/components/Notification/index.vue
@@ -10,19 +10,20 @@
-
-
+
+
+
{{ item.type }}
{{ item.title }}
- {{ item.publishTime }}
+ {{ item.content }}
@@ -87,6 +88,9 @@ const noticeDialogVisible = ref(false)
const noticeDetail = ref
(null)
import { useStomp } from '@/composables/websocket/useStomp'
+import { UserApprovalProcessing, UserRoxyexhibition } from '@/api/calibration/approval'
+import { functionDialogBox } from '@/utils/functionDialogBox'
+import ApprovalForm from '@/components/Notification/ApprovalForm.vue'
const { subscribe, unsubscribe, isConnected } = useStomp()
watch(
@@ -104,7 +108,6 @@ watch(
type: data.type,
publishTime: data.publishTime
})
-
ElNotification({
title: '您收到一条新的通知消息!',
message: data.title,
@@ -116,26 +119,52 @@ watch(
}
}
)
-
/**
* 获取我的通知公告
*/
function featchMyNotice() {
- NoticeAPI.getMyNoticePage({ pageNum: 1, pageSize: 5, isRead: 0 }).then((data) => {
- noticeList.value = data.list
+ UserRoxyexhibition({ pageNum: 1, pageSize: 5 }).then((res: any) => {
+ noticeList.value = res.data
+ console.log(noticeList.value)
})
}
// 阅读通知公告
-function handleReadNotice(id: string) {
- NoticeAPI.getDetail(id).then((data) => {
- noticeDialogVisible.value = true
- noticeDetail.value = data
- // 标记为已读
- const index = noticeList.value.findIndex((notice) => notice.id === id)
- if (index >= 0) {
- noticeList.value.splice(index, 1)
+function handleReadNotice(data: any) {
+ // NoticeAPI.getDetail(id).then((res: any) => {
+ // noticeDialogVisible.value = true
+ // noticeDetail.value = res.data
+ // // 标记为已读
+ // const index = noticeList.value.findIndex((notice) => notice.id === id)
+ // if (index >= 0) {
+ // noticeList.value.splice(index, 1)
+ // }
+ // })
+ functionDialogBox(
+ ApprovalForm,
+ {
+ content: data.content
+ },
+ {
+ title: data.type,
+ width: '500',
+ ok(value: any) {
+ onUserApprovalProcessing({ id: data.id, type: data.type, state: value.state })
+ }
+ // cancel() {
+ // console.log("value");
+ // },
}
+ )
+}
+
+const onUserApprovalProcessing = (data: any) => {
+ UserApprovalProcessing(data).then((res: any) => {
+ ElMessage({
+ type: 'success',
+ message: res.message
+ })
+ featchMyNotice()
})
}
@@ -160,4 +189,10 @@ onBeforeUnmount(() => {
})
-
+
diff --git a/src/layouts/components/NavBar/components/NavbarActions.vue b/src/layouts/components/NavBar/components/NavbarActions.vue
index 38492d0..e81cae2 100644
--- a/src/layouts/components/NavBar/components/NavbarActions.vue
+++ b/src/layouts/components/NavBar/components/NavbarActions.vue
@@ -59,10 +59,8 @@ import { SidebarColor, ThemeMode } from '@/enums/settings/theme-enum'
import { LayoutMode } from '@/enums'
// 导入子组件
-import MenuSearch from '@/components/MenuSearch/index.vue'
import Fullscreen from '@/components/Fullscreen/index.vue'
import SizeSelect from '@/components/SizeSelect/index.vue'
-import LangSelect from '@/components/LangSelect/index.vue'
import Notification from '@/components/Notification/index.vue'
const { t } = useI18n()
diff --git a/src/views/system/notice/components/MyNotice.vue b/src/views/system/notice/components/MyNotice.vue
index 49b46d6..27082bc 100644
--- a/src/views/system/notice/components/MyNotice.vue
+++ b/src/views/system/notice/components/MyNotice.vue
@@ -38,37 +38,29 @@
class="data-table__content"
>
-
+
-
-
-
-
-
-
-
+ {{ scope.row.type }}
+
-
-
- 已读
- 未读
+ {{ scope.row.state }}
-
- 查看
+
+ 审批
@@ -110,12 +102,16 @@