mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
add the function of fuzzy query in the page of NoticeView had been completed
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
:model="search"
|
||||
class="demo-form-inline"
|
||||
label-width="auto"
|
||||
ref="searchForm"
|
||||
style="min-width: 1185px"
|
||||
>
|
||||
<el-row :span="24">
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
await noticeStore.selectAllNoticeSelf(flag)
|
||||
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||
},
|
||||
handleDialogClose() {
|
||||
noticeStore.$patch((state) => {
|
||||
@@ -208,7 +208,7 @@ export default {
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
await noticeStore.selectAllNoticeSelf(flag)
|
||||
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
143
ui/src/components/notice/NoticeViewHead.vue
Normal file
143
ui/src/components/notice/NoticeViewHead.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<el-form
|
||||
:inline="true"
|
||||
:model="searchBySelf"
|
||||
class="demo-form-inline"
|
||||
label-width="auto"
|
||||
style="min-width: 1185px"
|
||||
>
|
||||
<el-row :span="24">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告标题:" prop="title">
|
||||
<el-input v-model="searchBySelf.title" placeholder="请输入公告标题"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告类型:" prop="type">
|
||||
<el-select v-model="searchBySelf.type" placeholder="请选择公告类型">
|
||||
<el-option
|
||||
v-for="item in enableNoticeTypeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="日期:" prop="timeRang">
|
||||
<el-date-picker
|
||||
v-model="timeRang"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
style="width: auto"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="selectByCondition"
|
||||
><el-icon :size="SIZE_ICON_SM()" style="color: white; margin-right: 5px">
|
||||
<icon-pinnacle-notice_search /> </el-icon
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button type="primary" @click="resetForm"
|
||||
><el-icon :size="SIZE_ICON_SM()" style="color: white">
|
||||
<icon-pinnacle-reset /> </el-icon
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { COLOR_PRODUCTION, SIZE_ICON_MD, SIZE_ICON_SM } from '@/constants/Common.constants'
|
||||
import _ from 'lodash'
|
||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
|
||||
const noticeStore = useNoticeStore()
|
||||
export default {
|
||||
name: 'NoticeHead',
|
||||
data() {
|
||||
return {
|
||||
timeRang: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
SIZE_ICON_SM() {
|
||||
return SIZE_ICON_SM
|
||||
},
|
||||
COLOR_PRODUCTION() {
|
||||
return COLOR_PRODUCTION
|
||||
},
|
||||
SIZE_ICON_MD() {
|
||||
return SIZE_ICON_MD
|
||||
},
|
||||
selectByCondition() {
|
||||
if (!_.isEmpty(this.timeRang)) {
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf.startTime = this.handleDateFormatUTC(this.timeRang[0])
|
||||
this.searchBySelf.endTime = this.handleDateFormatUTC(this.timeRang[1])
|
||||
})
|
||||
}
|
||||
let flag = 0
|
||||
if (this.currentViewPage === 'All') {
|
||||
flag = -1
|
||||
} else if (this.currentViewPage === 'ToRead') {
|
||||
flag = 0
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
this.$emit('selectSelfByCond', flag)
|
||||
},
|
||||
handleDateFormatUTC(date) {
|
||||
let newFormat = ''
|
||||
const dateParse = new Date(Date.parse(date))
|
||||
const yy = dateParse.getUTCFullYear()
|
||||
const mm = _.padStart((dateParse.getUTCMonth() + 1).toString(), 2, '0')
|
||||
const dd = _.padStart(dateParse.getUTCDate().toString(), 2, '0')
|
||||
const hh = _.padStart(dateParse.getUTCHours().toString(), 2, '0')
|
||||
const mf = _.padStart(dateParse.getUTCMinutes().toString(), 2, '0')
|
||||
const ss = _.padStart(dateParse.getUTCSeconds().toString(), 2, '0')
|
||||
newFormat = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
|
||||
return newFormat
|
||||
},
|
||||
resetForm() {
|
||||
this.timeRang = []
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
let flag = 0
|
||||
if (this.currentViewPage === 'All') {
|
||||
flag = -1
|
||||
} else if (this.currentViewPage === 'ToRead') {
|
||||
flag = 0
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
this.$emit('selectSelfByCond', flag)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['currentPage', 'pageSize', 'searchBySelf', 'currentViewPage']),
|
||||
...mapState(useNoticeTypeStore, ['enableNoticeTypeList'])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-form {
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -14,7 +14,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'AlRead'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(1)
|
||||
noticeStore.selectAllNoticeSelf(1, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -15,7 +15,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'All'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(-1)
|
||||
noticeStore.selectAllNoticeSelf(-1, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['showLoading'])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<notice-head @selectByCond="getLoading"></notice-head>
|
||||
<notice-manage-head @selectByCond="getLoading"></notice-manage-head>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-button
|
||||
@@ -52,7 +52,11 @@ import 'element-plus/theme-chalk/el-message-box.css'
|
||||
import request from '@/services'
|
||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
import { SIZE_ICON_MD } from '@/constants/Common.constants'
|
||||
import {
|
||||
DATABASE_DELETE_ERROR,
|
||||
DATABASE_DELETE_OK,
|
||||
SIZE_ICON_MD
|
||||
} from '@/constants/Common.constants'
|
||||
const noticeStore = useNoticeStore()
|
||||
const noticeTypeStore = useNoticeTypeStore()
|
||||
|
||||
@@ -82,7 +86,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.delete('/notice/' + deleteID).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
@@ -96,7 +100,7 @@ export default {
|
||||
'',
|
||||
[]
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -123,7 +127,6 @@ export default {
|
||||
this.search.endTime,
|
||||
this.search.userIdList
|
||||
)
|
||||
// noticeStore.search.userIdList = []
|
||||
},
|
||||
deleteBatchByIds() {
|
||||
const multiDeleteIds = []
|
||||
@@ -138,7 +141,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.post('/notice/batch', multiDeleteIds).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
@@ -152,7 +155,7 @@ export default {
|
||||
'',
|
||||
[]
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
@@ -45,7 +45,11 @@
|
||||
</el-container>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { SIZE_ICON_MD } from '@/constants/Common.constants'
|
||||
import {
|
||||
DATABASE_DELETE_ERROR,
|
||||
DATABASE_DELETE_OK,
|
||||
SIZE_ICON_MD
|
||||
} from '@/constants/Common.constants'
|
||||
import { useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -113,13 +117,13 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.delete('/notice_type/' + typeId).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -142,13 +146,13 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.post('/notice_type/batch', multiDeleteTypeIds).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<notice-head></notice-head>
|
||||
<notice-view-head @selectSelfByCond="getLoading" />
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
|
||||
@@ -15,14 +15,31 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { useNoticeTypeStore } from '@/store/notice'
|
||||
import { useNoticeTypeStore, useNoticeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
const noticeTypeStore = useNoticeTypeStore()
|
||||
const noticeStore = useNoticeStore()
|
||||
|
||||
export default {
|
||||
name: 'NoticeView',
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['showLoading', 'searchBySelf'])
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {},
|
||||
methods: {
|
||||
getLoading(status) {
|
||||
noticeStore.showLoading = true
|
||||
noticeStore.selectAllNoticeSelf(
|
||||
status,
|
||||
this.searchBySelf.title,
|
||||
this.searchBySelf.type,
|
||||
this.searchBySelf.startTime,
|
||||
this.searchBySelf.endTime
|
||||
)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
noticeTypeStore.selectEnableNoticeType()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'ToRead'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(0)
|
||||
noticeStore.selectAllNoticeSelf(0, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import request from '@/services'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
DATABASE_SAVE_ERROR,
|
||||
DATABASE_SAVE_OK,
|
||||
DATABASE_SELECT_OK,
|
||||
DATABASE_UPDATE_ERROR,
|
||||
DATABASE_UPDATE_OK
|
||||
} from '@/constants/Common.constants'
|
||||
|
||||
export interface IAddNoticeData {
|
||||
title: string
|
||||
@@ -55,6 +62,12 @@ export const useNoticeStore = defineStore('notice', {
|
||||
endTime: '',
|
||||
userIdList: []
|
||||
},
|
||||
searchBySelf: {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
},
|
||||
selectData: [
|
||||
{
|
||||
content: '',
|
||||
@@ -142,7 +155,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
userIdList: userIdList.toString() + ''
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.selectData = response.data.data
|
||||
this.total = parseInt(response.data.msg)
|
||||
this.loading = false
|
||||
@@ -155,13 +168,23 @@ export const useNoticeStore = defineStore('notice', {
|
||||
}
|
||||
})
|
||||
},
|
||||
async selectAllNoticeSelf(readStatus: number) {
|
||||
async selectAllNoticeSelf(
|
||||
readStatus: number,
|
||||
title: string,
|
||||
type: string,
|
||||
startTime: string,
|
||||
endTime: string
|
||||
) {
|
||||
await request
|
||||
.get('/notice/self', {
|
||||
readStatus
|
||||
readStatus,
|
||||
title,
|
||||
type,
|
||||
startTime,
|
||||
endTime
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.selectData = response.data.data
|
||||
this.showLoading = false
|
||||
} else {
|
||||
@@ -180,13 +203,13 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
handleAddNotice(addFormData: IAddNoticeData) {
|
||||
void request.post('/notice', addFormData).then((response) => {
|
||||
if (response.data.code === 20022) {
|
||||
if (response.data.code === DATABASE_SAVE_OK) {
|
||||
this.dialogAddVisible = false
|
||||
ElMessage({
|
||||
message: '发布成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20032) {
|
||||
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -197,14 +220,14 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
handleUpdateNotice(updateNotice: IAddNoticeData) {
|
||||
void request.put('/notice', updateNotice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
this.dialogEditVisible = false
|
||||
this.editFlag = false
|
||||
ElMessage({
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -216,7 +239,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
async modifyNoticeIsRead(notice: INotice) {
|
||||
await request.put('/notice/modify_notice_read', notice).then((response) => {
|
||||
if (response.data.code === 20033) {
|
||||
if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -226,12 +249,12 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
async modifyTop(notice: INotice) {
|
||||
await request.put('/notice/update_notice_top', notice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -282,7 +305,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async selectNoticeType(currentPage: number, pageSize: number) {
|
||||
await request.get('/notice_type/page', { currentPage, pageSize }).then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.noticeTypeList = response.data.data
|
||||
this.total = parseInt(response.data.msg)
|
||||
if (this.noticeTypeList.length !== 0) {
|
||||
@@ -304,12 +327,12 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
enable
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
ElMessage({
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -319,13 +342,13 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async handleAddNoticeType(addFormData: IAddNoticeTypeData) {
|
||||
await request.post('/notice_type', addFormData).then((response) => {
|
||||
if (response.data.code === 20022) {
|
||||
if (response.data.code === DATABASE_SAVE_OK) {
|
||||
this.dialogAddTypeVisible = false
|
||||
ElMessage({
|
||||
message: '添加成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20032) {
|
||||
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -336,7 +359,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async handleUpdateNoticeType(updateNotice: IAddNoticeTypeData) {
|
||||
await request.put('/notice_type', updateNotice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
this.dialogEditTypeVisible = false
|
||||
this.editFlag = false
|
||||
this.hackReset = false
|
||||
@@ -349,7 +372,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
Reference in New Issue
Block a user