mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
The modification which the function of fuzzy query has been completed.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-form
|
||||
:inline="true"
|
||||
:model="search_info"
|
||||
:model="search"
|
||||
class="demo-form-inline"
|
||||
label-width="auto"
|
||||
ref="searchForm"
|
||||
@@ -10,12 +10,12 @@
|
||||
<el-row :span="24">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告标题:" prop="title">
|
||||
<el-input v-model="search_info.title" placeholder="请输入公告标题"></el-input>
|
||||
<el-input v-model="search.title" placeholder="请输入公告标题"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告类型:" prop="type">
|
||||
<el-select v-model="search_info.type" placeholder="请选择公告类型">
|
||||
<el-select v-model="search.type" placeholder="请选择公告类型">
|
||||
<el-option
|
||||
v-for="item in enableNoticeTypeList"
|
||||
:key="item.id"
|
||||
@@ -59,19 +59,15 @@
|
||||
<script lang="ts">
|
||||
import { COLOR_PRODUCTION, SIZE_ICON_MD, SIZE_ICON_SM } from '@/constants/Common.constants'
|
||||
import _ from 'lodash'
|
||||
import { useNoticeTypeStore } from '@/store/notice'
|
||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
|
||||
const noticeStore = useNoticeStore()
|
||||
export default {
|
||||
name: 'NoticeHead',
|
||||
data() {
|
||||
return {
|
||||
timeRang: [],
|
||||
search_info: {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
timeRang: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -86,10 +82,12 @@ export default {
|
||||
},
|
||||
selectByCondition() {
|
||||
if (!_.isEmpty(this.timeRang)) {
|
||||
this.search_info.startTime = this.handleDateFormatUTC(this.timeRang[0])
|
||||
this.search_info.endTime = this.handleDateFormatUTC(this.timeRang[1])
|
||||
noticeStore.$patch((state) => {
|
||||
state.search.startTime = this.handleDateFormatUTC(this.timeRang[0])
|
||||
this.search.endTime = this.handleDateFormatUTC(this.timeRang[1])
|
||||
})
|
||||
}
|
||||
this.$emit('selectByCond', 1, 5, this.search_info)
|
||||
this.$emit('selectByCond')
|
||||
},
|
||||
handleDateFormatUTC(date) {
|
||||
let newFormat = ''
|
||||
@@ -105,10 +103,18 @@ export default {
|
||||
},
|
||||
resetForm() {
|
||||
this.timeRang = []
|
||||
this.$refs.searchForm.resetFields()
|
||||
noticeStore.$patch((state) => {
|
||||
state.search = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['currentPage', 'pageSize', 'search']),
|
||||
...mapState(useNoticeTypeStore, ['enableNoticeTypeList'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,8 @@ export default {
|
||||
'hackReset',
|
||||
'currentPage',
|
||||
'pageSize',
|
||||
'multiDeleteSelection'
|
||||
'multiDeleteSelection',
|
||||
'search'
|
||||
])
|
||||
},
|
||||
emits: ['clearFilter', 'handleDeleteById'],
|
||||
@@ -246,18 +247,32 @@ export default {
|
||||
noticeStore.$patch((state) => {
|
||||
state.pageSize = pageSize
|
||||
})
|
||||
noticeStore.selectAllNotice(this.currentPage, parseInt(pageSize))
|
||||
noticeStore.selectAllNotice(
|
||||
this.currentPage,
|
||||
parseInt(pageSize),
|
||||
this.search.title,
|
||||
this.search.type,
|
||||
this.search.startTime,
|
||||
this.search.endTime
|
||||
)
|
||||
},
|
||||
handleCurrentChange(currentPage) {
|
||||
// currentPage:当前第几页
|
||||
noticeStore.$patch((state) => {
|
||||
state.currentPage = currentPage
|
||||
})
|
||||
noticeStore.selectAllNotice(parseInt(currentPage), this.pageSize)
|
||||
noticeStore.selectAllNotice(
|
||||
parseInt(currentPage),
|
||||
this.pageSize,
|
||||
this.search.title,
|
||||
this.search.type,
|
||||
this.search.startTime,
|
||||
this.search.endTime
|
||||
)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
noticeStore.selectAllNotice(this.currentPage, this.pageSize)
|
||||
noticeStore.selectAllNotice(this.currentPage, this.pageSize, '', '', '', '')
|
||||
},
|
||||
updated() {
|
||||
this.$refs.tableRef.clearFilter(['sender.username'])
|
||||
|
||||
@@ -63,31 +63,15 @@ export default {
|
||||
SIZE_ICON_MD() {
|
||||
return SIZE_ICON_MD
|
||||
},
|
||||
selectByCond(currentPage, pageSize, search) {
|
||||
request
|
||||
.get('/notice/page', {
|
||||
currentPage,
|
||||
pageSize,
|
||||
title: search.title,
|
||||
type: search.type,
|
||||
startTime: search.startTime,
|
||||
endTime: search.endTime
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
noticeStore.selectData = response.data.data
|
||||
noticeStore.total = parseInt(response.data.msg)
|
||||
ElMessage({
|
||||
message: '查询成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20031) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
selectByCond() {
|
||||
noticeStore.selectAllNotice(
|
||||
this.currentPage,
|
||||
this.pageSize,
|
||||
this.search.title,
|
||||
this.search.type,
|
||||
this.search.startTime,
|
||||
this.search.endTime
|
||||
)
|
||||
},
|
||||
handleDialogClose() {
|
||||
noticeStore.$patch((state) => {
|
||||
@@ -111,7 +95,14 @@ export default {
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeStore.selectAllNotice(this.currentPage, this.pageSize)
|
||||
noticeStore.selectAllNotice(
|
||||
this.currentPage,
|
||||
this.pageSize,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
@@ -130,7 +121,14 @@ export default {
|
||||
},
|
||||
getLoading() {
|
||||
noticeStore.loading = true
|
||||
noticeStore.selectAllNotice(this.currentPage, this.pageSize)
|
||||
noticeStore.selectAllNotice(
|
||||
this.currentPage,
|
||||
this.pageSize,
|
||||
this.search.title,
|
||||
this.search.type,
|
||||
this.search.startTime,
|
||||
this.search.endTime
|
||||
)
|
||||
},
|
||||
deleteBatchByIds() {
|
||||
const multiDeleteIds = []
|
||||
@@ -150,7 +148,14 @@ export default {
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeStore.selectAllNotice(this.currentPage, this.pageSize)
|
||||
noticeStore.selectAllNotice(
|
||||
this.currentPage,
|
||||
this.pageSize,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
@@ -176,7 +181,8 @@ export default {
|
||||
'dialogAddVisible',
|
||||
'currentPage',
|
||||
'pageSize',
|
||||
'multiDeleteSelection'
|
||||
'multiDeleteSelection',
|
||||
'search'
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ export const useNoticeStore = defineStore('notice', {
|
||||
total: 0,
|
||||
pageSize: 5,
|
||||
currentPage: 1,
|
||||
search: {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
},
|
||||
selectData: [
|
||||
{
|
||||
content: '',
|
||||
@@ -114,11 +120,22 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
async selectAllNotice(currentPage: number, pageSize: number) {
|
||||
async selectAllNotice(
|
||||
currentPage: number,
|
||||
pageSize: number,
|
||||
title: string,
|
||||
type: string,
|
||||
startTime: string,
|
||||
endTime: string
|
||||
) {
|
||||
void request
|
||||
.get('/notice/page', {
|
||||
currentPage,
|
||||
pageSize
|
||||
pageSize,
|
||||
title,
|
||||
type,
|
||||
startTime,
|
||||
endTime
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
@@ -174,7 +191,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
})
|
||||
}
|
||||
})
|
||||
await this.selectAllNotice(1, 5)
|
||||
await this.selectAllNotice(1, 5, '', '', '', '')
|
||||
},
|
||||
async handleUpdateNotice(updateNotice: IAddNoticeData) {
|
||||
await request.put('/notice', updateNotice).then((response) => {
|
||||
@@ -192,7 +209,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
})
|
||||
}
|
||||
})
|
||||
await this.selectAllNotice(1, 5)
|
||||
await this.selectAllNotice(1, 5, '', '', '', '')
|
||||
this.hackReset = false
|
||||
},
|
||||
async modifyNoticeIsRead(notice: INotice) {
|
||||
|
||||
Reference in New Issue
Block a user