fix: 盲盒模式禁用任务搜索
盲盒模式下禁用搜索框并清空关键词,同时请求参数忽略关键词。
This commit is contained in:
parent
651608ebf0
commit
1a80f5482f
@ -4,8 +4,9 @@
|
||||
<div class="search-row">
|
||||
<a-input-search
|
||||
v-model:value="localFilters.keyword"
|
||||
:placeholder="searchPlaceholder"
|
||||
:placeholder="disableSearch ? '盲盒模式下不可搜索' : searchPlaceholder"
|
||||
class="search-input"
|
||||
:disabled="disableSearch"
|
||||
@search="handleFilterChange"
|
||||
@pressEnter="handleFilterChange"
|
||||
/>
|
||||
@ -287,6 +288,11 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: '搜索任务编号、标题、SPU信息、发布人...'
|
||||
},
|
||||
// 是否禁用搜索
|
||||
disableSearch: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 统计文本
|
||||
statsText: {
|
||||
type: String,
|
||||
@ -418,10 +424,24 @@ watch(
|
||||
|
||||
// 筛选条件变更
|
||||
const handleFilterChange = () => {
|
||||
if (props.disableSearch) {
|
||||
localFilters.keyword = undefined
|
||||
}
|
||||
emit('update:modelValue', { ...localFilters })
|
||||
emit('change', { ...localFilters })
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.disableSearch,
|
||||
(disabled) => {
|
||||
if (disabled && localFilters.keyword) {
|
||||
localFilters.keyword = undefined
|
||||
emit('update:modelValue', { ...localFilters })
|
||||
emit('change', { ...localFilters })
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 重置筛选条件
|
||||
const handleReset = () => {
|
||||
localFilters.keyword = undefined
|
||||
|
||||
@ -77,6 +77,8 @@
|
||||
:sort-options="availableSortOptions"
|
||||
:status-options="availableStatusOptions"
|
||||
status-placeholder="任务状态"
|
||||
:disable-search="showBlindBox"
|
||||
:search-placeholder="showBlindBox ? '盲盒模式下不可搜索' : '搜索任务编号、标题、SPU信息、发布人...'"
|
||||
:show-receiving-dept="true"
|
||||
:demand-types="demandTypes"
|
||||
:task-sub-types="taskSubTypes"
|
||||
@ -2490,7 +2492,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, onUnmounted, h } from 'vue'
|
||||
import { ref, reactive, computed, onMounted, onUnmounted, h, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { message, Modal, InputNumber, Textarea, Radio, RadioGroup, Button, Select, Space, Tag, Tooltip } from 'ant-design-vue'
|
||||
import DefaultLayout from '@/layouts/DefaultLayout.vue'
|
||||
@ -3494,8 +3496,8 @@ const loadTasks = async (forceReload = false) => {
|
||||
if (filters.taskSubType) params.taskSubType = filters.taskSubType
|
||||
if (filters.minScore) params.minScore = Number(filters.minScore)
|
||||
if (filters.maxScore) params.maxScore = Number(filters.maxScore)
|
||||
if (filters.keyword) params.keyword = filters.keyword.trim()
|
||||
if (filters.publisherName) params.publisherName = filters.publisherName.trim()
|
||||
if (!showBlindBox.value && filters.keyword) params.keyword = filters.keyword.trim()
|
||||
if (!showBlindBox.value && filters.publisherName) params.publisherName = filters.publisherName.trim()
|
||||
if (filters.timeRange) params.timeRange = filters.timeRange
|
||||
if (filters.sortBy) params.sortBy = filters.sortBy
|
||||
if (filters.filterDeptId) params.filterDeptId = filters.filterDeptId // 🔥 按接单部门筛选
|
||||
@ -3603,6 +3605,19 @@ const handleReset = () => {
|
||||
loadTasks(true) // 强制重新加载
|
||||
}
|
||||
|
||||
watch(showBlindBox, (enabled) => {
|
||||
if (enabled) {
|
||||
if (filters.keyword) {
|
||||
filters.keyword = undefined
|
||||
}
|
||||
if (filters.publisherName) {
|
||||
filters.publisherName = undefined
|
||||
}
|
||||
pagination.page = 1
|
||||
loadTasks(true)
|
||||
}
|
||||
})
|
||||
|
||||
// 页码变更
|
||||
const handlePageChange = () => {
|
||||
loadTasks() // 使用缓存数据进行分页
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user