fix:修复 createTime 为 date,并且为可选的
This commit is contained in:
@@ -16,8 +16,8 @@ export interface Task {
|
||||
id: string
|
||||
name: string
|
||||
status: number
|
||||
createTime: number
|
||||
endTime?: number
|
||||
createTime: Date
|
||||
endTime?: Date
|
||||
reason?: string
|
||||
assigneeUser?: TaskUser
|
||||
ownerUser?: TaskUser
|
||||
|
||||
@@ -17,12 +17,12 @@ export interface ApiAccessLog {
|
||||
operateModule: string
|
||||
operateName: string
|
||||
operateType: number
|
||||
beginTime: string
|
||||
endTime: string
|
||||
beginTime: Date
|
||||
endTime: Date
|
||||
duration: number
|
||||
resultCode: number
|
||||
resultMsg: string
|
||||
createTime: string
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
/** 获取 API 访问日志分页列表 */
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface ApiErrorLog {
|
||||
requestUrl: string
|
||||
userIp: string
|
||||
userAgent: string
|
||||
exceptionTime: string
|
||||
exceptionTime: Date
|
||||
exceptionName: string
|
||||
exceptionMessage: string
|
||||
exceptionRootCauseMessage: string
|
||||
@@ -24,9 +24,9 @@ export interface ApiErrorLog {
|
||||
exceptionLineNumber: number
|
||||
processUserId: number
|
||||
processStatus: number
|
||||
processTime: string
|
||||
processTime: Date
|
||||
resultCode: number
|
||||
createTime: string
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
/** 获取 API 错误日志分页列表 */
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface Dept {
|
||||
leaderUserId?: number
|
||||
phone?: string
|
||||
email?: string
|
||||
createTime?: string
|
||||
createTime?: Date
|
||||
children?: Dept[]
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface DictData {
|
||||
sort?: number
|
||||
status: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
createTime?: Date
|
||||
}
|
||||
|
||||
/** 查询字典数据(精简)列表 */
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface Menu {
|
||||
visible: boolean
|
||||
keepAlive: boolean
|
||||
alwaysShow?: boolean
|
||||
createTime?: string
|
||||
createTime?: Date
|
||||
children?: Menu[]
|
||||
}
|
||||
|
||||
|
||||
39
src/api/system/notice/index.ts
Normal file
39
src/api/system/notice/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
const baseUrl = '/system/notice'
|
||||
|
||||
/** 通知公告信息 */
|
||||
export interface Notice {
|
||||
id?: number
|
||||
title: string
|
||||
content: string
|
||||
type: number
|
||||
status: number
|
||||
createTime?: Date
|
||||
}
|
||||
|
||||
/** 获取通知公告分页列表 */
|
||||
export function getNoticePage(params: PageParam) {
|
||||
return http.get<PageResult<Notice>>(`${baseUrl}/page`, params)
|
||||
}
|
||||
|
||||
/** 获取通知公告详情 */
|
||||
export function getNotice(id: number) {
|
||||
return http.get<Notice>(`${baseUrl}/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建通知公告 */
|
||||
export function createNotice(data: Notice) {
|
||||
return http.post<number>(`${baseUrl}/create`, data)
|
||||
}
|
||||
|
||||
/** 更新通知公告 */
|
||||
export function updateNotice(data: Notice) {
|
||||
return http.put<boolean>(`${baseUrl}/update`, data)
|
||||
}
|
||||
|
||||
/** 删除通知公告 */
|
||||
export function deleteNotice(id: number) {
|
||||
return http.delete<boolean>(`${baseUrl}/delete?id=${id}`)
|
||||
}
|
||||
@@ -13,8 +13,8 @@ export interface NotifyMessage {
|
||||
templateType: number
|
||||
templateParams: string
|
||||
readStatus: boolean
|
||||
readTime: string
|
||||
createTime: string
|
||||
readTime: Date
|
||||
createTime?: Date
|
||||
}
|
||||
|
||||
/** 获取我的站内信分页 */
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface Role {
|
||||
remark?: string
|
||||
dataScope?: number
|
||||
dataScopeDeptIds?: number[]
|
||||
createTime: string
|
||||
createTime?: Date
|
||||
}
|
||||
|
||||
/** 获取角色分页列表 */
|
||||
|
||||
@@ -10,8 +10,8 @@ export interface UserProfileVO {
|
||||
sex?: number
|
||||
avatar?: string
|
||||
loginIp: string
|
||||
loginDate: string
|
||||
createTime: string
|
||||
loginDate: Date
|
||||
createTime: Date
|
||||
roles: { id: number, name: string }[]
|
||||
dept: { id: number, name: string }
|
||||
posts: { id: number, name: string }[]
|
||||
|
||||
@@ -99,7 +99,7 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑部门' : '新增部门')
|
||||
const formLoading = ref(false) // 提交中状态
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<Dept>({
|
||||
id: undefined,
|
||||
name: '',
|
||||
|
||||
@@ -144,7 +144,7 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑菜单' : '新增菜单')
|
||||
const formLoading = ref(false) // 提交中状态
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<Menu>({
|
||||
id: undefined,
|
||||
name: '',
|
||||
|
||||
@@ -88,7 +88,7 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑岗位' : '新增岗位')
|
||||
const formLoading = ref(false) // 提交中状态
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<Post>({
|
||||
id: undefined,
|
||||
name: '',
|
||||
|
||||
@@ -88,7 +88,7 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑角色' : '新增角色')
|
||||
const formLoading = ref(false) // 提交中状态
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<Role>({
|
||||
id: undefined,
|
||||
name: '',
|
||||
@@ -96,7 +96,6 @@ const formData = ref<Role>({
|
||||
sort: 0,
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
remark: '',
|
||||
createTime: '',
|
||||
})
|
||||
const formRules = {
|
||||
name: [{ required: true, message: '角色名称不能为空' }],
|
||||
|
||||
@@ -124,7 +124,7 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const getTitle = computed(() => props.id ? '编辑用户' : '新增用户')
|
||||
const formLoading = ref(false) // 提交中状态
|
||||
const formLoading = ref(false)
|
||||
const formData = ref<User>({
|
||||
id: undefined,
|
||||
username: '',
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
<template>
|
||||
<!-- 搜索框入口 -->
|
||||
<view class="flex items-center bg-white pr-30rpx">
|
||||
<view class="flex-1">
|
||||
<wd-search
|
||||
:placeholder="searchPlaceholder"
|
||||
:hide-cancel="true"
|
||||
disabled
|
||||
@click="visible = true"
|
||||
/>
|
||||
</view>
|
||||
<view class="text-28rpx text-[#1890ff]" @click="handleReadAll">
|
||||
全部已读
|
||||
</view>
|
||||
</view>
|
||||
<wd-search
|
||||
:placeholder="searchPlaceholder"
|
||||
:hide-cancel="true"
|
||||
disabled
|
||||
@click="visible = true"
|
||||
/>
|
||||
|
||||
<!-- 搜索弹窗 -->
|
||||
<wd-popup
|
||||
v-model="visible"
|
||||
position="top"
|
||||
@@ -24,76 +15,38 @@
|
||||
>
|
||||
<view class="p-32rpx">
|
||||
<view class="mb-24rpx text-32rpx text-[#333] font-semibold">
|
||||
搜索消息
|
||||
搜索通知公告
|
||||
</view>
|
||||
|
||||
<view class="mb-24rpx">
|
||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||
已读状态
|
||||
公告标题
|
||||
</view>
|
||||
<wd-radio-group v-model="formData.readStatus" shape="button" size="medium">
|
||||
<wd-input
|
||||
v-model="formData.title"
|
||||
placeholder="请输入公告标题"
|
||||
clearable
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="mb-32rpx">
|
||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||
公告状态(0正常 1关闭)
|
||||
</view>
|
||||
<wd-radio-group v-model="formData.status" shape="button" size="medium">
|
||||
<wd-radio :value="-1">
|
||||
全部
|
||||
</wd-radio>
|
||||
<wd-radio :value="1">
|
||||
已读
|
||||
</wd-radio>
|
||||
<wd-radio :value="0">
|
||||
未读
|
||||
<wd-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</wd-radio>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
<view class="mb-32rpx">
|
||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||
发送时间
|
||||
</view>
|
||||
<view class="flex items-center gap-16rpx">
|
||||
<view class="flex-1" @click="showStartPicker = true">
|
||||
<view
|
||||
class="h-72rpx flex items-center justify-center rounded-8rpx bg-[#f5f5f5] px-24rpx text-28rpx"
|
||||
>
|
||||
{{ formatDate(formData.createTime?.[0]) || '开始日期' }}
|
||||
</view>
|
||||
</view>
|
||||
<text class="text-28rpx text-[#999]">至</text>
|
||||
<view class="flex-1" @click="showEndPicker = true">
|
||||
<view
|
||||
class="h-72rpx flex items-center justify-center rounded-8rpx bg-[#f5f5f5] px-24rpx text-28rpx"
|
||||
>
|
||||
{{ formatDate(formData.createTime?.[1]) || '结束日期' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 开始时间选择器 -->
|
||||
<wd-datetime-picker-view
|
||||
v-if="showStartPicker"
|
||||
v-model="tempCreateTime[0]"
|
||||
type="date"
|
||||
:columns-height="200"
|
||||
/>
|
||||
<view v-if="showStartPicker" class="mt-16rpx flex justify-end gap-16rpx">
|
||||
<wd-button size="small" plain @click="handleStartCancel">
|
||||
取消
|
||||
</wd-button>
|
||||
<wd-button size="small" type="primary" @click="handleStartConfirm">
|
||||
确定
|
||||
</wd-button>
|
||||
</view>
|
||||
<!-- 结束时间选择器 -->
|
||||
<wd-datetime-picker-view
|
||||
v-if="showEndPicker"
|
||||
v-model="tempCreateTime[1]"
|
||||
type="date"
|
||||
:columns-height="200"
|
||||
/>
|
||||
<view v-if="showEndPicker" class="mt-16rpx flex justify-end gap-16rpx">
|
||||
<wd-button size="small" plain @click="handleEndCancel">
|
||||
取消
|
||||
</wd-button>
|
||||
<wd-button size="small" type="primary" @click="handleEndConfirm">
|
||||
确定
|
||||
</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="w-full flex justify-center gap-24rpx">
|
||||
<wd-button class="flex-1" plain @click="handleReset">
|
||||
重置
|
||||
@@ -108,22 +61,23 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { formatDate } from '@/utils/date'
|
||||
|
||||
import { getDictLabel, getIntDictOptions } from '@/hooks/useDict'
|
||||
import { DICT_TYPE } from '@/utils/constants'
|
||||
|
||||
/** 搜索表单数据 */
|
||||
export interface SearchFormData {
|
||||
readStatus: number // -1 表示全部, 0 未读, 1 已读
|
||||
createTime?: [number | undefined, number | undefined]
|
||||
title?: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
searchParams?: Partial<SearchFormData> // 初始搜索参数
|
||||
searchParams?: Partial<SearchFormData>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
search: [data: SearchFormData]
|
||||
reset: []
|
||||
readAll: []
|
||||
}>()
|
||||
|
||||
const visible = ref(false)
|
||||
@@ -131,76 +85,35 @@ const visible = ref(false)
|
||||
/** 搜索条件 placeholder 拼接 */
|
||||
const searchPlaceholder = computed(() => {
|
||||
const conditions: string[] = []
|
||||
if (props.searchParams?.readStatus === 1) {
|
||||
conditions.push('已读')
|
||||
} else if (props.searchParams?.readStatus === 0) {
|
||||
conditions.push('未读')
|
||||
if (props.searchParams?.title) {
|
||||
conditions.push(`公告标题:${props.searchParams.title}`)
|
||||
}
|
||||
if (props.searchParams?.createTime?.[0] || props.searchParams?.createTime?.[1]) {
|
||||
const start = props.searchParams.createTime[0] ? formatDate(props.searchParams.createTime[0]) : ''
|
||||
const end = props.searchParams.createTime[1] ? formatDate(props.searchParams.createTime[1]) : ''
|
||||
if (start || end) {
|
||||
conditions.push(`${start}~${end}`)
|
||||
}
|
||||
if (props.searchParams?.status !== undefined && props.searchParams.status !== -1) {
|
||||
conditions.push(`公告状态(0正常 1关闭):${getDictLabel(DICT_TYPE.COMMON_STATUS, props.searchParams.status)}`)
|
||||
}
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索消息'
|
||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索通知公告'
|
||||
})
|
||||
|
||||
/** 全部已读 */
|
||||
function handleReadAll() {
|
||||
emit('readAll')
|
||||
}
|
||||
|
||||
const formData = reactive<SearchFormData>({
|
||||
readStatus: -1,
|
||||
createTime: [undefined, undefined],
|
||||
title: undefined,
|
||||
status: -1 as number,
|
||||
})
|
||||
|
||||
// 时间选择器状态
|
||||
const showStartPicker = ref(false)
|
||||
const showEndPicker = ref(false)
|
||||
const tempCreateTime = ref<[number, number]>([Date.now(), Date.now()])
|
||||
|
||||
/** 开始时间确认 */
|
||||
function handleStartConfirm() {
|
||||
formData.createTime = [tempCreateTime.value[0], formData.createTime?.[1]]
|
||||
showStartPicker.value = false
|
||||
}
|
||||
|
||||
/** 开始时间取消 */
|
||||
function handleStartCancel() {
|
||||
showStartPicker.value = false
|
||||
}
|
||||
|
||||
/** 结束时间确认 */
|
||||
function handleEndConfirm() {
|
||||
formData.createTime = [formData.createTime?.[0], tempCreateTime.value[1]]
|
||||
showEndPicker.value = false
|
||||
}
|
||||
|
||||
/** 结束时间取消 */
|
||||
function handleEndCancel() {
|
||||
showEndPicker.value = false
|
||||
}
|
||||
|
||||
/** 监听弹窗打开,同步外部参数 */
|
||||
watch(visible, (val) => {
|
||||
if (val && props.searchParams) {
|
||||
formData.readStatus = props.searchParams.readStatus ?? -1
|
||||
formData.createTime = props.searchParams.createTime ?? [undefined, undefined]
|
||||
formData.title = props.searchParams.title
|
||||
formData.status = props.searchParams.status ?? -1
|
||||
}
|
||||
})
|
||||
|
||||
/** 搜索 */
|
||||
function handleSearch() {
|
||||
visible.value = false
|
||||
emit('search', { ...formData })
|
||||
emit('search', { ...formData } as SearchFormData)
|
||||
}
|
||||
|
||||
/** 重置 */
|
||||
function handleReset() {
|
||||
formData.readStatus = -1
|
||||
formData.createTime = [undefined, undefined]
|
||||
formData.title = undefined
|
||||
formData.status = -1
|
||||
visible.value = false
|
||||
emit('reset')
|
||||
}
|
||||
|
||||
@@ -66,12 +66,10 @@ definePage({
|
||||
|
||||
const toast = useToast()
|
||||
const formLoading = ref(false)
|
||||
const formRef = ref()
|
||||
const fileList = ref<UploadFile[]>([])
|
||||
|
||||
const formData = ref({
|
||||
content: '',
|
||||
}) // 表单数据
|
||||
})
|
||||
const formRules = {
|
||||
content: [
|
||||
{ required: true, message: '请输入反馈内容' },
|
||||
@@ -81,7 +79,8 @@ const formRules = {
|
||||
message: '反馈内容至少10个字符',
|
||||
},
|
||||
],
|
||||
} // 表单校验规则
|
||||
}
|
||||
const formRef = ref()
|
||||
|
||||
/** 返回上一页 */
|
||||
function handleBack() {
|
||||
|
||||
Reference in New Issue
Block a user