修复:工作人员列表切换后自动加载数据
监听工作人员类型变化,切换安装、配送和运维菜单时自动重置搜索及页码并重新查询;补充资源、搜索和人员关联回归检查,同时更新中文需求说明与操作日志。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 功能:静态检查平台总后台全部标准资源是否具备独立记录页配置。
|
||||
* 版本:v1.0.0
|
||||
* 版本:v1.1.0
|
||||
*/
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -39,6 +39,13 @@ for (const marker of ["makeRecordRoute('create'", "makeRecordRoute('detail'", "m
|
||||
if (!routeBuilderSource.includes(marker)) fail(`通用路由生成器缺少 ${marker}`);
|
||||
}
|
||||
if (listSource.includes('<a-drawer')) fail('列表组件仍包含 CRUD Drawer');
|
||||
if (
|
||||
!listSource.includes(
|
||||
'[() => props.definition.resource, () => staffType.value]',
|
||||
)
|
||||
) {
|
||||
fail('工作人员角色菜单切换未触发列表重新加载');
|
||||
}
|
||||
if (existsSync(resolve(root, 'src/views/account/AccountProfilePage.vue'))) {
|
||||
fail('旧账户资料组件仍存在,未统一到共享记录页');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 功能:校验标准资源列表仅在具备真实搜索能力时显示动态中文提示。
|
||||
* 版本:v1.0.0
|
||||
* 版本:v1.1.0
|
||||
*/
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
@@ -24,6 +24,7 @@ const expectations = [
|
||||
[searchState, 'definition.value.searchFields', '读取后端搜索契约'],
|
||||
[searchState, 'resourceListDisplayFields', '搜索字段与实际列表列求交集'],
|
||||
[searchState, 'if (searchEnabled.value || !route.query.keyword) return;', '清理不支持页面的陈旧关键字'],
|
||||
[searchState, 'if (route.query.keyword || route.query.page) await syncQuery();', '切换列表时清理陈旧关键字和页码'],
|
||||
[searchState, '`可搜索:${searchableFields.value', '明确列出可搜索中文字段'],
|
||||
[resources, 'searchFields: resourceSearchFields(name)', '资源定义消费后端搜索契约'],
|
||||
[resources, "resourceSearchEnumOptions('staff_account', 'role_code')", '工作人员中文角色与搜索契约同源'],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 功能:验证工作人员关联字段过滤、资质来源校验和路由上下文传递契约。
|
||||
* 版本:v1.0.0
|
||||
* 版本:v1.1.0
|
||||
*/
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
@@ -117,6 +117,10 @@ const listSource = await readFile(
|
||||
'utf8',
|
||||
);
|
||||
assert.match(listSource, /staff_type: staffType\.value/);
|
||||
assert.match(listSource, /'staff_type'/);
|
||||
const listSearchSource = await readFile(
|
||||
new URL('../src/views/shared/use-resource-list-search.ts', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
assert.match(listSearchSource, /'staff_type'/);
|
||||
|
||||
console.log('工作人员关联与资质上下文检查通过');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
功能:展示标准资源列表,并将新建、详情和编辑入口导航到独立页面。
|
||||
版本:v2.2.0
|
||||
版本:v2.2.1
|
||||
-->
|
||||
<template>
|
||||
<a-card :title="listTitle" :bordered="false">
|
||||
@@ -470,8 +470,9 @@ onMounted(async () => {
|
||||
});
|
||||
onBeforeUnmount(avatarLoader.reset);
|
||||
watch(
|
||||
() => props.definition.resource,
|
||||
[() => props.definition.resource, () => staffType.value],
|
||||
async () => {
|
||||
// 同一工作人员资源切换角色菜单时,复位旧查询并主动加载当前角色数据。
|
||||
await resetSearchState();
|
||||
await Promise.all([
|
||||
relations.preload(displayFields.value),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 功能描述:管理标准资源列表的可搜索字段、关键字状态和 URL 查询参数。
|
||||
* 版本:v1.0.0
|
||||
* 版本:v1.0.1
|
||||
*/
|
||||
import { computed, reactive, type Ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@@ -73,7 +73,7 @@ export function useResourceListSearch(
|
||||
async function resetSearchState() {
|
||||
page.value = 1;
|
||||
filters.keyword = '';
|
||||
if (route.query.keyword) await syncQuery();
|
||||
if (route.query.keyword || route.query.page) await syncQuery();
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user