111
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
francis-fh
2026-06-17 01:07:44 +08:00
parent 37e3f3bd6b
commit e5a41feea9
2 changed files with 41 additions and 8 deletions

View File

@@ -206,12 +206,14 @@ export const CompanyDetailView = ({
onCancel,
record,
scaleEnum,
industryEnum,
loading,
}: {
open: boolean;
onCancel: () => void;
record?: API.CompanyList.Company;
scaleEnum?: DictValueEnumObj;
industryEnum?: DictValueEnumObj;
loading?: boolean;
}) => {
const contacts = record?.companyContactList?.filter(
@@ -253,8 +255,8 @@ export const CompanyDetailView = ({
<DictTag enums={scaleEnum} value={record.scale} />
)}
{statusTag}
{record?.industry ? (
<span className="company-detail__industry">{record.industry}</span>
{record?.industry != null && record.industry !== '' ? (
<DictTag enums={industryEnum} value={record.industry} />
) : null}
</div>
</div>

View File

@@ -14,7 +14,8 @@ import {
putCmsCompanyList,
} from '@/services/company/list';
import { getDictValueEnum } from '@/services/system/dict';
import DictTag from '@/components/DictTag';
import { getCmsIndustryTreeList } from '@/services/classify/industry';
import DictTag, { DictValueEnumObj } from '@/components/DictTag';
import { postCompanyApproval } from '@/services/company/review';
const buildListSearchParams = (values: Record<string, any>): API.CompanyList.Params => {
@@ -36,6 +37,25 @@ const loadCompanyDetail = async (record: API.CompanyList.Company) => {
return { ...record, ...detail };
};
/** 将行业树数据展平为 DictValueEnumObj */
const flattenIndustryTree = (tree: { id: number; label: string; children?: any[] }[]): DictValueEnumObj => {
const map: DictValueEnumObj = {};
const walk = (nodes: { id: number; label: string; children?: any[] }[]) => {
nodes?.forEach((node) => {
map[node.id] = {
text: node.label,
label: node.label,
value: node.id,
};
if (node.children?.length) {
walk(node.children);
}
});
};
walk(tree);
return map;
};
function ManagementList() {
const access = useAccess();
@@ -48,6 +68,7 @@ function ManagementList() {
const [detailLoading, setDetailLoading] = useState<boolean>(false);
const [detailData, setDetailData] = useState<API.CompanyList.Company | undefined>();
const [scaleEnum, setScaleEnum] = useState<Record<string, any>>({});
const [industryEnum, setIndustryEnum] = useState<DictValueEnumObj>({});
const [approvalVisible, setApprovalVisible] = useState<boolean>(false);
const [approvalStatus, setApprovalStatus] = useState<1 | 2>(1);
const [approvalReason, setApprovalReason] = useState<string>('');
@@ -89,6 +110,11 @@ function ManagementList() {
getDictValueEnum('scale', true, true).then((data) => {
setScaleEnum(data);
});
getCmsIndustryTreeList().then((res) => {
if (res?.data) {
setIndustryEnum(flattenIndustryTree(res.data));
}
});
}, []);
const columns: ProColumns<API.CompanyList.Company>[] = [
@@ -118,6 +144,9 @@ function ManagementList() {
dataIndex: 'industry',
valueType: 'text',
align: 'center',
render: (_, record) => {
return <DictTag enums={industryEnum} value={record.industry} />;
},
},
{
title: '公司规模',
@@ -187,7 +216,7 @@ function ManagementList() {
size="small"
key="detail"
icon={<AlignLeftOutlined />}
hidden={!access.hasPerms('area:business:List.view')}
hidden={!access.hasPerms('cms:company:query')}
onClick={async () => {
setDetailData({ ...record });
setDetailVisible(true);
@@ -209,7 +238,7 @@ function ManagementList() {
size="small"
key="edit"
icon={<FormOutlined />}
hidden={!access.hasPerms('area:business:List.update')}
hidden={!access.hasPerms('cms:company:edit')}
onClick={async () => {
const hide = message.loading('正在加载详情');
try {
@@ -229,6 +258,7 @@ function ManagementList() {
type="link"
size="small"
key="approval"
hidden={!access.hasPerms('sys:company:approval')}
icon={<AuditOutlined />}
onClick={() => {
setCurrentRow(record);
@@ -245,7 +275,7 @@ function ManagementList() {
danger
key="batchRemove"
icon={<DeleteOutlined />}
hidden={!access.hasPerms('area:subway:List')}
hidden={!access.hasPerms('cms:company:remove')}
onClick={async () => {
Modal.confirm({
title: '删除',
@@ -291,7 +321,7 @@ function ManagementList() {
<Button
type="primary"
key="add"
hidden={!access.hasPerms('manage:List:add')}
hidden={!access.hasPerms('cms:company:add')}
onClick={async () => {
setCurrentRow(undefined);
setModalVisible(true);
@@ -302,7 +332,7 @@ function ManagementList() {
<Button
type="primary"
key="export"
hidden={!access.hasPerms('system:user:export')}
hidden={!access.hasPerms('cms:company:export')}
onClick={async () => {
const searchVal = formTableRef.current?.getFieldsValue();
handleExport(buildListSearchParams(searchVal || {}));
@@ -348,6 +378,7 @@ function ManagementList() {
}}
record={detailData}
scaleEnum={scaleEnum}
industryEnum={industryEnum}
/>
<Modal