Compare commits
2 Commits
17487cce2b
...
c5908f4376
| Author | SHA1 | Date | |
|---|---|---|---|
| c5908f4376 | |||
| f78aa97bd1 |
@@ -1,5 +1,5 @@
|
||||
VITE_APP_NAME=后台管理(开发环境)
|
||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
||||
VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||
|
||||
|
||||
|
||||
@@ -108,6 +108,56 @@ export interface CreditCompany {
|
||||
cechnologyLevel?: string;
|
||||
// 是否小微企业
|
||||
smallEnterprise?: string;
|
||||
// 记录数
|
||||
creditAdministrativeLicense?: number;
|
||||
// 记录数
|
||||
creditBankruptcy?: number;
|
||||
// 记录数
|
||||
creditBranch?: number;
|
||||
// 记录数
|
||||
creditBreachOfTrust?: number;
|
||||
// 记录数
|
||||
creditCaseFiling?: number;
|
||||
// 记录数
|
||||
creditCompetitor?: number;
|
||||
// 记录数
|
||||
creditCourtAnnouncement?: number;
|
||||
// 记录数
|
||||
creditCourtSession?: number;
|
||||
// 记录数
|
||||
creditCustomer?: number;
|
||||
// 记录数
|
||||
creditDeliveryNotice?: number;
|
||||
// 记录数
|
||||
creditExternal?: number;
|
||||
// 记录数
|
||||
creditFinalVersion?: number;
|
||||
// 记录数
|
||||
creditGqdj?: number;
|
||||
// 记录数
|
||||
creditHistoricalLegalPerson?: number;
|
||||
// 记录数
|
||||
creditJudgmentDebtor?: number;
|
||||
// 记录数
|
||||
creditJudicialDocument?: number;
|
||||
// 记录数
|
||||
creditJudiciary?: number;
|
||||
// 记录数
|
||||
creditMediation?: number;
|
||||
// 记录数
|
||||
creditNearbyCompany?: number;
|
||||
// 记录数
|
||||
creditPatent?: number;
|
||||
// 记录数
|
||||
creditRiskRelation?: number;
|
||||
// 记录数
|
||||
creditSupplier?: number;
|
||||
// 记录数
|
||||
creditSuspectedRelationship?: number;
|
||||
// 记录数
|
||||
creditUser?: number;
|
||||
// 记录数
|
||||
creditXgxf?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 是否推荐
|
||||
|
||||
@@ -40,7 +40,16 @@
|
||||
:tabBarGutter="9"
|
||||
class="credit-company-tabs"
|
||||
>
|
||||
<a-tab-pane v-for="tab in tabList" :key="tab.key" :tab="tab.label">
|
||||
<a-tab-pane v-for="tab in tabList" :key="tab.key">
|
||||
<template #tab>
|
||||
<span
|
||||
:class="{
|
||||
'credit-company-tab-has-data': tabHasData[tab.key]
|
||||
}"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</span>
|
||||
</template>
|
||||
<a-space style="margin-bottom: 12px">
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -272,6 +281,38 @@
|
||||
{ key: '历史法定代表人', label: '历史法定代表人' }
|
||||
];
|
||||
|
||||
/**
|
||||
* 企业详情接口会下发各子表“记录数”(见 CreditCompany 模型中 `// 记录数` 字段)。
|
||||
* 用这个来做 Tab 高亮,避免为了计算高亮去逐个请求所有子表接口。
|
||||
*/
|
||||
const tabCountFieldMap: Record<string, keyof CreditCompany> = {
|
||||
招投标: 'creditUser',
|
||||
对外投资: 'creditExternal',
|
||||
风险关系: 'creditRiskRelation',
|
||||
竞争对手: 'creditCompetitor',
|
||||
供应商: 'creditSupplier',
|
||||
客户: 'creditCustomer',
|
||||
司法案件: 'creditJudiciary',
|
||||
被执行人: 'creditJudgmentDebtor',
|
||||
限制高消费: 'creditXgxf',
|
||||
终本案件: 'creditFinalVersion',
|
||||
开庭公告: 'creditCourtSession',
|
||||
法院公告: 'creditCourtAnnouncement',
|
||||
失信被执行人: 'creditBreachOfTrust',
|
||||
裁判文书: 'creditJudicialDocument',
|
||||
立案信息: 'creditCaseFiling',
|
||||
诉前调解: 'creditMediation',
|
||||
送达公告: 'creditDeliveryNotice',
|
||||
股权冻结: 'creditGqdj',
|
||||
附近企业: 'creditNearbyCompany',
|
||||
分支机构: 'creditBranch',
|
||||
破产重整: 'creditBankruptcy',
|
||||
行政许可: 'creditAdministrativeLicense',
|
||||
疑似关系: 'creditSuspectedRelationship',
|
||||
专利: 'creditPatent',
|
||||
历史法定代表人: 'creditHistoricalLegalPerson'
|
||||
};
|
||||
|
||||
type TabApiConfig = {
|
||||
page: (
|
||||
params: any
|
||||
@@ -1183,6 +1224,7 @@
|
||||
};
|
||||
|
||||
const tabState = reactive<Record<string, TabState>>({});
|
||||
const tabHasData = reactive<Record<string, boolean>>({});
|
||||
tabList.forEach((tab) => {
|
||||
tabState[tab.key] = {
|
||||
loading: false,
|
||||
@@ -1195,6 +1237,7 @@
|
||||
},
|
||||
loadedSignature: undefined
|
||||
};
|
||||
tabHasData[tab.key] = false;
|
||||
});
|
||||
const activeTab = ref(tabList[0].key);
|
||||
|
||||
@@ -1492,6 +1535,15 @@
|
||||
tabState[tab.key].loading = false;
|
||||
tabState[tab.key].loadedSignature = undefined;
|
||||
resetTabPagination(tab.key);
|
||||
tabHasData[tab.key] = false;
|
||||
});
|
||||
};
|
||||
|
||||
const syncTabsHasDataFromCounts = () => {
|
||||
tabList.forEach((tab) => {
|
||||
const field = tabCountFieldMap[tab.key];
|
||||
const raw = (form as any)?.[field] ?? (props.data as any)?.[field] ?? 0;
|
||||
tabHasData[tab.key] = Number(raw) > 0;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1536,8 +1588,9 @@
|
||||
|
||||
const requestedPage = state.pagination.current;
|
||||
let res = await fetchPage(requestedPage);
|
||||
const total = res?.count ?? 0;
|
||||
let list = res?.list || [];
|
||||
const total =
|
||||
typeof (res as any)?.count === 'number' ? (res as any).count : list.length;
|
||||
|
||||
if (total > 0 && list.length === 0 && requestedPage > 1) {
|
||||
setTabPagination(key, { current: 1 });
|
||||
@@ -1545,8 +1598,15 @@
|
||||
list = res?.list || [];
|
||||
}
|
||||
|
||||
state.pagination.total = res?.count ?? 0;
|
||||
state.pagination.total =
|
||||
typeof (res as any)?.count === 'number' ? (res as any).count : list.length;
|
||||
// Keep the count field in sync (only when backend returns a count), so Tab highlight can update after import/refresh.
|
||||
const countField = tabCountFieldMap[key];
|
||||
if (countField && typeof (res as any)?.count === 'number') {
|
||||
(form as any)[countField] = (res as any).count;
|
||||
}
|
||||
state.data = list;
|
||||
tabHasData[key] = (state.pagination.total ?? 0) > 0;
|
||||
if (!state.columns.length) {
|
||||
state.columns = buildColumns(key, state.data);
|
||||
}
|
||||
@@ -1584,6 +1644,7 @@
|
||||
assignObject(form, props.data);
|
||||
}
|
||||
activeTab.value = tabList[0].key;
|
||||
syncTabsHasDataFromCounts();
|
||||
loadTabData(activeTab.value, true);
|
||||
} else {
|
||||
showRelatedImport.value = false;
|
||||
@@ -1604,7 +1665,16 @@
|
||||
resetForm();
|
||||
clearTabData();
|
||||
assignObject(form, data);
|
||||
syncTabsHasDataFromCounts();
|
||||
loadTabData(activeTab.value, true);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Tab label highlight when the module record-count field is > 0. */
|
||||
.credit-company-tab-has-data {
|
||||
color: #ff4d4f;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user