feat(供应商列表): 一并撤掉「综合分数」筛选(含 AI 助手契约,i18n 键按要求保留)
开发者续:「1.需要(撤掉综合分筛选),2(i18n 键)这个可以保留」。
界面:
· 删除「综合分数」筛选下拉与其状态 `filterComposite`、过滤谓词、分页 resetKey 依赖;
· 列表现在只剩:搜索、经营分类/商品、状态、免入库 四个筛选。
AI 助手契约(必须同改,否则助手一调用就报"当前页不支持字段"把整批 patch 打回):
· copilotSupplierListPageContract:状态类型去掉 `filterComposite`、字段定义去掉 `composite_filter`、
补丁分支删除;getState/values/commit/clear_filters 同步;
· server MCP 工具 list_supplier_directory 不再下发 `composite_filter`;
· 能力 schema(registerBuiltins)去掉 `composite` 入参并更新描述。
按要求**保留**:i18n 三语键(col.quota / col.composite_score / filter.allComposite / hasComposite / noneComposite)
与编辑表单里的「配额比例 (%)」(分配规则要用)。
测试:供应商列表契约 3/3 ✅、i18n 对齐 42/42 ✅、助手相关 4/4 ✅;
前端全量 147 文件通过、仅既有基线 `SystemConfig.allowZeroCost`(2 例)红;两端 tsc ✅。
This commit is contained in:
@@ -420,7 +420,7 @@ export function registerBuiltinCapabilities() {
|
||||
registerCapability({
|
||||
name: 'list_supplier_directory',
|
||||
description:
|
||||
'只读查询供应商档案。search/status/skip_inbound/category/sku/composite 可选。skip_inbound 省略为全部;1 已开启直送免入库(备货完成不入仓、配送员核货;不是商品直送);0 关闭。默认只返回数据。不新增、不导入、不删除、不代开关免入库。',
|
||||
'只读查询供应商档案。search/status/skip_inbound/category/sku 可选(综合分已不展示、不再作为筛选维度)。skip_inbound 省略为全部;1 已开启直送免入库(备货完成不入仓、配送员核货;不是商品直送);0 关闭。默认只返回数据。不新增、不导入、不删除、不代开关免入库。',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -429,7 +429,6 @@ export function registerBuiltinCapabilities() {
|
||||
skip_inbound: { type: 'string', description: '省略全部;1 已开启免入库;0 关闭' },
|
||||
category: { type: 'string' },
|
||||
sku: { type: 'string' },
|
||||
composite: { type: 'string', description: '空全部;has 有综合分;none 无综合分' },
|
||||
},
|
||||
},
|
||||
permissions: SUPPLIER_PERMS,
|
||||
|
||||
@@ -20,7 +20,6 @@ export const handlers: Record<string, OrderEntryToolHandler> = {
|
||||
{ name: 'search', value: search },
|
||||
{ name: 'category_filter', value: result.category },
|
||||
{ name: 'sku_filter', value: result.sku },
|
||||
{ name: 'composite_filter', value: result.composite },
|
||||
{ name: 'status_filter', value: result.status },
|
||||
{ name: 'skip_inbound_filter', value: result.skip_inbound },
|
||||
];
|
||||
|
||||
@@ -163,7 +163,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
const { initialLoading: loading, refreshing, startLoad, finishLoad } = useListLoadState();
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
/** '' | 'has' | 'none' — 综合分有无 */
|
||||
const [filterComposite, setFilterComposite] = useState('');
|
||||
const [filterStatus, setFilterStatus] = useState('');
|
||||
/** 默认全部;一级/二级均可 */
|
||||
const [filterCategoryCode, setFilterCategoryCode] = useState('');
|
||||
@@ -800,10 +799,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
const filteredSuppliers = suppliers.filter((s) => {
|
||||
const matchesSearch = s.company_name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
s.supplier_code.toLowerCase().includes(searchQuery.toLowerCase());
|
||||
const matchesComposite =
|
||||
!filterComposite ||
|
||||
(filterComposite === 'has' && s.composite_score != null) ||
|
||||
(filterComposite === 'none' && s.composite_score == null);
|
||||
const matchesStatus = !filterStatus || s.status === parseInt(filterStatus);
|
||||
const boundCodes = (supplierCategories[s.supplier_code] || []).map((c) => c.category_code);
|
||||
const matchesCategory = supplierCategoriesMatchFilter(
|
||||
@@ -815,19 +810,18 @@ export const SupplierManagement: React.FC = () => {
|
||||
!filterSkipInbound ||
|
||||
(filterSkipInbound === '1' && s.skip_inbound) ||
|
||||
(filterSkipInbound === '0' && !s.skip_inbound);
|
||||
return matchesSearch && matchesComposite && matchesStatus && matchesCategory && matchesSkipInbound;
|
||||
return matchesSearch && matchesStatus && matchesCategory && matchesSkipInbound;
|
||||
});
|
||||
|
||||
const sortedSuppliers = tableSort.sortRows(filteredSuppliers, (s) => s.settlement_days);
|
||||
const supplierPage = useClientTablePagination(sortedSuppliers, {
|
||||
resetKey: `${searchQuery}|${filterComposite}|${filterStatus}|${filterCategoryCode}|${filterSkuCode}|${filterSkipInbound}|${tableSort.sortKey}|${tableSort.sortDir}`,
|
||||
resetKey: `${searchQuery}|${filterStatus}|${filterCategoryCode}|${filterSkuCode}|${filterSkipInbound}|${tableSort.sortKey}|${tableSort.sortDir}`,
|
||||
});
|
||||
|
||||
const copilotRef = useRef({
|
||||
searchQuery,
|
||||
filterCategoryCode,
|
||||
filterSkuCode,
|
||||
filterComposite,
|
||||
filterStatus,
|
||||
filterSkipInbound,
|
||||
total: filteredSuppliers.length,
|
||||
@@ -836,7 +830,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
searchQuery,
|
||||
filterCategoryCode,
|
||||
filterSkuCode,
|
||||
filterComposite,
|
||||
filterStatus,
|
||||
filterSkipInbound,
|
||||
total: filteredSuppliers.length,
|
||||
@@ -854,7 +847,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
searchQuery: copilotRef.current.searchQuery,
|
||||
filterCategoryCode: copilotRef.current.filterCategoryCode,
|
||||
filterSkuCode: copilotRef.current.filterSkuCode,
|
||||
filterComposite: copilotRef.current.filterComposite,
|
||||
filterStatus: copilotRef.current.filterStatus,
|
||||
filterSkipInbound: copilotRef.current.filterSkipInbound,
|
||||
}),
|
||||
@@ -863,7 +855,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
search: state.searchQuery,
|
||||
category_filter: state.filterCategoryCode,
|
||||
sku_filter: state.filterSkuCode,
|
||||
composite_filter: state.filterComposite,
|
||||
status_filter: state.filterStatus,
|
||||
skip_inbound_filter: state.filterSkipInbound,
|
||||
total: copilotRef.current.total,
|
||||
@@ -872,7 +863,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
setSearchQuery(next.searchQuery);
|
||||
setFilterCategoryCode(next.filterCategoryCode);
|
||||
setFilterSkuCode(next.filterSkuCode);
|
||||
setFilterComposite(next.filterComposite);
|
||||
setFilterStatus(next.filterStatus);
|
||||
setFilterSkipInbound(next.filterSkipInbound);
|
||||
await fetchSuppliersRef.current();
|
||||
@@ -883,7 +873,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
setSearchQuery('');
|
||||
setFilterCategoryCode('');
|
||||
setFilterSkuCode('');
|
||||
setFilterComposite('');
|
||||
setFilterStatus('');
|
||||
setFilterSkipInbound('');
|
||||
void fetchSuppliersRef.current();
|
||||
@@ -962,16 +951,6 @@ export const SupplierManagement: React.FC = () => {
|
||||
placeholder={t('suppliers.filter.skuPh')}
|
||||
options={skuFilterOptions}
|
||||
/>
|
||||
<SearchableSelect
|
||||
value={filterComposite}
|
||||
onChange={setFilterComposite}
|
||||
allowEmpty
|
||||
emptyLabel={t('suppliers.filter.allComposite')}
|
||||
options={[
|
||||
{ value: 'has', label: t('suppliers.filter.hasComposite') },
|
||||
{ value: 'none', label: t('suppliers.filter.noneComposite') },
|
||||
]}
|
||||
/>
|
||||
<SearchableSelect
|
||||
value={filterStatus}
|
||||
onChange={setFilterStatus}
|
||||
|
||||
@@ -5,7 +5,6 @@ const base = {
|
||||
searchQuery: '',
|
||||
filterCategoryCode: '',
|
||||
filterSkuCode: '',
|
||||
filterComposite: '',
|
||||
filterStatus: '',
|
||||
filterSkipInbound: '',
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@ export type SupplierListCopilotState = {
|
||||
searchQuery: string;
|
||||
filterCategoryCode: string;
|
||||
filterSkuCode: string;
|
||||
filterComposite: string;
|
||||
filterStatus: string;
|
||||
filterSkipInbound: string;
|
||||
};
|
||||
@@ -16,7 +15,6 @@ export const SUPPLIER_LIST_COPILOT_FIELDS: CopilotFieldDef[] = [
|
||||
{ name: 'search', type: 'string', description: '搜索供应商名称或编码' },
|
||||
{ name: 'category_filter', type: 'string', description: '空为全部经营分类,否则分类编码;与 sku_filter 互斥' },
|
||||
{ name: 'sku_filter', type: 'string', description: '空为全部商品,否则 SKU 编码;与 category_filter 互斥' },
|
||||
{ name: 'composite_filter', type: 'string', description: '空为全部,has 有综合分,none 无综合分' },
|
||||
{
|
||||
name: 'status_filter',
|
||||
type: 'string',
|
||||
@@ -55,14 +53,6 @@ export function applySupplierListCopilotFieldPatches(
|
||||
if (next.filterSkuCode) next.filterCategoryCode = '';
|
||||
continue;
|
||||
}
|
||||
if (name === 'composite_filter') {
|
||||
const composite = String(patch.value ?? '').trim();
|
||||
if (composite && composite !== 'has' && composite !== 'none') {
|
||||
return { ok: false, error: 'composite_filter 只能是 has、none 或空' };
|
||||
}
|
||||
next.filterComposite = composite;
|
||||
continue;
|
||||
}
|
||||
if (name === 'status_filter') {
|
||||
const status = String(patch.value ?? '').trim();
|
||||
if (status && !/^(10|20|30|40)$/.test(status)) {
|
||||
|
||||
Reference in New Issue
Block a user