fix(web-admin): refresh assignment filter project options after save
归属调整成功后递增 ProjectSelect refreshKey,立即重拉筛选区项目组/项目选项。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
964384108a
commit
d2f37985cb
4 files changed
+26
-1
No files matched your search
@@ -55,6 +55,8 @@
|
||||
bizType?: BizType
|
||||
disabled?: boolean
|
||||
projectName?: string
|
||||
/** Bump to reload options without remounting (e.g. after assignment). */
|
||||
refreshKey?: number | string
|
||||
}>()
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
@@ -79,7 +81,7 @@
|
||||
retry = ref(0)
|
||||
let version = 0
|
||||
watch(
|
||||
() => [props.bizType, props.disabled, props.filter, retry.value],
|
||||
() => [props.bizType, props.disabled, props.filter, props.refreshKey, retry.value],
|
||||
async () => {
|
||||
const requestVersion = ++version
|
||||
if (props.disabled) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { nextFilterOptionsEpoch } from './filter-options-epoch'
|
||||
|
||||
describe('nextFilterOptionsEpoch', () => {
|
||||
it('bumps only when at least one assignment succeeded', () => {
|
||||
assert.equal(nextFilterOptionsEpoch(3, 1), 4)
|
||||
assert.equal(nextFilterOptionsEpoch(3, 2), 4)
|
||||
assert.equal(nextFilterOptionsEpoch(3, 0), 3)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
/** After successful assignment saves, bump so filter ProjectSelect reloads options. */
|
||||
export function nextFilterOptionsEpoch(epoch: number, successCount: number) {
|
||||
return successCount > 0 ? epoch + 1 : epoch
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
team
|
||||
v-model="query.teamId"
|
||||
:biz-type="query.bizType"
|
||||
:refresh-key="filterOptionsEpoch"
|
||||
/></el-form-item>
|
||||
<el-form-item label="项目"
|
||||
><ProjectSelect
|
||||
@@ -44,6 +45,7 @@
|
||||
filter
|
||||
v-model="query.projectId"
|
||||
:biz-type="query.bizType"
|
||||
:refresh-key="filterOptionsEpoch"
|
||||
/></el-form-item>
|
||||
<el-form-item label="当前状态"
|
||||
><el-select v-model="query.status" clearable
|
||||
@@ -264,6 +266,7 @@
|
||||
import { assignmentTabs, assignmentColumns, assignmentKeywordHints } from './assignment-columns'
|
||||
import ProjectSelect from '@/components/business/ProjectSelect.vue'
|
||||
import { assignmentSnapshot } from '@/utils/project-management'
|
||||
import { nextFilterOptionsEpoch } from '@/utils/filter-options-epoch'
|
||||
import {
|
||||
bizLabels,
|
||||
fetchProjectRecords,
|
||||
@@ -289,6 +292,7 @@
|
||||
pageSize: 20
|
||||
})
|
||||
const tableRef = ref<{ clearSelection?: () => void } | null>(null)
|
||||
const filterOptionsEpoch = ref(0)
|
||||
const rows = ref<ProjectRecord[]>([]),
|
||||
total = ref(0),
|
||||
statusCounts = ref<Record<string, number>>({}),
|
||||
@@ -509,6 +513,10 @@
|
||||
} else {
|
||||
ElMessage.warning(`成功 ${successCount} 条,失败 ${failCount} 条`)
|
||||
}
|
||||
filterOptionsEpoch.value = nextFilterOptionsEpoch(
|
||||
filterOptionsEpoch.value,
|
||||
successCount
|
||||
)
|
||||
await load()
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user