去掉mock
parent
51b01849c1
commit
8ee7b1e51a
|
|
@ -12,9 +12,9 @@ module.exports = {
|
|||
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
|
||||
//API_HOST: "http://localhost:80",
|
||||
|
||||
API_HOST: "http://192.168.0.134",
|
||||
// API_HOST: "http://192.168.0.134",
|
||||
// API_HOST: "http://192.168.0.150", //太浅
|
||||
// API_HOST: "http://192.168.0.152",
|
||||
API_HOST: "https://gbs-gateway.qhdsafety.com",
|
||||
//API_HOST: "http://192.168.0.103", //huwei
|
||||
},
|
||||
production: {
|
||||
|
|
|
|||
|
|
@ -1,99 +1,11 @@
|
|||
import { Button, Spin, Table, Tag } from "antd";
|
||||
import { Button, Spin, Table } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
||||
import { Get } from "@cqsjjb/jjb-common-lib/http";
|
||||
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
|
||||
import FilingTabs from "~/pages/Container/QualificationReview/FilingTabs";
|
||||
|
||||
const LIST_PATH = "/container/supervision/basicInfo/registeredOrg/list";
|
||||
|
||||
/** Mock 开关存储键(与机构备案管理列表共享,默认开启便于与原型对比) */
|
||||
const ORG_MOCK_STORAGE_KEY = "registeredOrgMockEnabled";
|
||||
|
||||
function getOrgMockEnabled() {
|
||||
try {
|
||||
// URL 参数优先(?mock=1/0),并持久化到 localStorage。变更时间:2026-08-10
|
||||
const qs = new URLSearchParams(window.location.search);
|
||||
if (qs.has("mock")) {
|
||||
const v = qs.get("mock") === "1";
|
||||
localStorage.setItem(ORG_MOCK_STORAGE_KEY, v ? "1" : "0");
|
||||
return v;
|
||||
}
|
||||
const stored = localStorage.getItem(ORG_MOCK_STORAGE_KEY);
|
||||
if (stored === "1") return true;
|
||||
if (stored === "0") return false;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构基础信息详情 mock(与资质备案初审 qual-filing/detail 返回结构同构,便于复用 FilingTabs 六 Tab 展示)。
|
||||
* 变更时间:2026-08-10(参考初审详情取数方式重构)
|
||||
*/
|
||||
const ORG_DETAIL_MOCK = {
|
||||
id: 1,
|
||||
filingStatusCode: 1,
|
||||
filingStatusName: "已备案",
|
||||
businessScope: ["COAL_MINING", "METAL_NONMETAL_MINING", "PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_SMELTING"],
|
||||
filingTerritoryName: "重庆市沙坪坝区",
|
||||
filingUnitName: "重庆安评技术研究院有限公司",
|
||||
filingUnitTypeName: "本地单位",
|
||||
creditCode: "915001072028699512",
|
||||
registerAddress: "重庆市沙坪坝区大学城东路20号",
|
||||
officeAddress: "重庆市沙坪坝区大学城东路20号重庆科技学院第39栋西南角实习用房三楼",
|
||||
qualCertNo: "API-2026-001",
|
||||
infoDisclosureUrl: "https://cqap.example.com",
|
||||
legalRepresentative: "郑远平",
|
||||
legalPersonPhone: "023-68705577",
|
||||
fax: "023-68705578",
|
||||
contactPhone: "陈芳 / 139****9012",
|
||||
fixedAssetAmount: 1200,
|
||||
workplaceArea: 1200,
|
||||
archiveRoomArea: 80,
|
||||
fulltimeEvaluatorCount: 25,
|
||||
registeredEngineerCount: 12,
|
||||
unitIntro: "重庆安评技术研究院成立于2015年,是一家专业从事安全评价、安全咨询、安全技术开发与转让的综合性安全技术服务机构。",
|
||||
attachmentUrl: JSON.stringify([{ name: "营业执照副本.pdf", url: "https://example.com/license.pdf" }]),
|
||||
personnelList: [
|
||||
// technicalDirectorFlag/processControlLeaderFlag:true 归管理人员(用户要求 2026-08-10)
|
||||
// 学历/专业字段:educationName / basicDisciplineMajorName(用户要求 2026-08-10)
|
||||
{ id: 1001, sourcePersonnelId: 1001, personName: "郑远平", positionName: "法定代表人", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "安全工程", workYears: "18年", technicalDirectorFlag: false, processControlLeaderFlag: false },
|
||||
{ id: 1002, sourcePersonnelId: 1002, personName: "张建国", positionName: "技术负责人", titleName: "正高级工程师", educationName: "本科", basicDisciplineMajorName: "化工工艺", workYears: "16年", technicalDirectorFlag: true, processControlLeaderFlag: false },
|
||||
{ id: 1003, sourcePersonnelId: 1003, personName: "王丽萍", positionName: "过程控制负责人", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "安全管理", workYears: "12年", technicalDirectorFlag: false, processControlLeaderFlag: true },
|
||||
{ id: 2001, sourcePersonnelId: 2001, personName: "李明华", positionName: "专职安全评价师", titleName: "高级工程师", educationName: "硕士", basicDisciplineMajorName: "采矿工程", workYears: "12年", evaluatorCertNo: "SJP-2020-001", professionalCapabilityCodeList: ["MINING"], appliedScope: ["METAL_NONMETAL_MINING"], technicalDirectorFlag: false, processControlLeaderFlag: false },
|
||||
{ id: 2002, sourcePersonnelId: 2002, personName: "陈志强", positionName: "专职安全评价师", titleName: "高级工程师", educationName: "本科", basicDisciplineMajorName: "化工工艺", workYears: "10年", evaluatorCertNo: "SJP-2019-023", professionalCapabilityCodeList: ["CHEMICAL_PROCESS"], appliedScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL"], technicalDirectorFlag: false, processControlLeaderFlag: false },
|
||||
{ id: 2003, sourcePersonnelId: 2003, personName: "刘海", positionName: "专职安全评价师", titleName: "工程师", educationName: "本科", basicDisciplineMajorName: "机械工程", workYears: "8年", evaluatorCertNo: "SJP-2021-045", professionalCapabilityCodeList: ["MECHANICAL"], appliedScope: ["METAL_SMELTING"], technicalDirectorFlag: false, processControlLeaderFlag: false },
|
||||
],
|
||||
materials: [
|
||||
{ id: 1, materialContent: "申请材料目录.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m1.pdf" },
|
||||
{ id: 2, materialContent: "安全评价机构资质申请书及材料清单.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m2.pdf" },
|
||||
{ id: 3, materialContent: "法人证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m3.pdf" },
|
||||
{ id: 4, materialContent: "截至申请之日三年内无重大违法失信记录的查询证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m4.pdf" },
|
||||
{ id: 5, materialContent: "申请单位法定代表人承诺书.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m5.pdf" },
|
||||
{ id: 6, materialContent: "固定资产法定证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m6.pdf" },
|
||||
{ id: 7, materialContent: "工作场所及档案室面积证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m7.pdf" },
|
||||
{ id: 8, materialContent: "安全评价师专业能力证明.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m8.pdf" },
|
||||
{ id: 9, materialContent: "专职技术负责人和支撑过程控制负责人证明材料.pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m9.pdf" },
|
||||
{ id: 10, materialContent: "机构内部管理制度(非受控版).pdf", materialFormat: "pdf", uploadStatusCode: 2, uploadStatusName: "已上传", attachmentUrl: "https://example.com/m10.pdf" },
|
||||
],
|
||||
equipmentList: [
|
||||
{ id: 301, deviceName: "气相色谱仪", deviceModel: "GC-2018", manufacturer: "岛津", equipmentValue: 120000, calibrationReportUrl: "https://example.com/cal1.pdf" },
|
||||
{ id: 302, deviceName: "噪声计", deviceModel: "HS-6288", manufacturer: "杭州爱华", equipmentValue: 8000, calibrationReportUrl: "https://example.com/cal2.pdf" },
|
||||
{ id: 303, deviceName: "粉尘采样器", deviceModel: "FC-5A", manufacturer: "北京劳保所", equipmentValue: 9000, calibrationReportUrl: "" },
|
||||
],
|
||||
commitment: {
|
||||
legalRepName: "郑远平",
|
||||
legalRepSignatureUrl: "https://example.com/sign.png",
|
||||
signDate: "2026-06-25 16:42",
|
||||
},
|
||||
changes: [
|
||||
{ id: 1, submitTime: "2026-07-18 10:24", submitType: "注册提交", changeFields: "基础信息全量提交", submitter: "机构管理员", statusName: "待审核", statusColor: "warning", url: "https://example.com/c1.pdf" },
|
||||
{ id: 2, submitTime: "2026-07-20 15:36", submitType: "补正提交", changeFields: "营业执照、办公地址证明", submitter: "机构管理员", statusName: "已通过", statusColor: "success", url: "https://example.com/c2.pdf" },
|
||||
],
|
||||
};
|
||||
|
||||
function parseQueryId(location) {
|
||||
const search = location?.search || window.location.search || "";
|
||||
return new URLSearchParams(search).get("id");
|
||||
|
|
@ -112,19 +24,12 @@ function RegisteredOrgDetailPage(props) {
|
|||
const [detail, setDetail] = useState({});
|
||||
const [changes, setChanges] = useState([]);
|
||||
const [loading, setLoading] = useState(Boolean(id));
|
||||
const mockEnabled = getOrgMockEnabled();
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
if (mockEnabled) {
|
||||
setDetail(ORG_DETAIL_MOCK);
|
||||
setChanges(ORG_DETAIL_MOCK.changes);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
(async () => {
|
||||
|
|
@ -176,26 +81,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
);
|
||||
}
|
||||
|
||||
// mock 演示下 changes 为原型完整列;真实接口仅返回 变更时间/变更项/操作人
|
||||
const changeColumns =
|
||||
mockEnabled || changes[0]?.submitTime
|
||||
? [
|
||||
{ title: "提交时间", dataIndex: "submitTime", width: 150 },
|
||||
{ title: "提交类型", dataIndex: "submitType", width: 100 },
|
||||
{ title: "变更字段", dataIndex: "changeFields", ellipsis: true },
|
||||
{ title: "提交人", dataIndex: "submitter", width: 100 },
|
||||
{ title: "审核状态", width: 100, render: (_, record) => <Tag color={record.statusColor || "default"}>{record.statusName || "-"}</Tag> },
|
||||
{
|
||||
title: "操作",
|
||||
width: 110,
|
||||
render: (_, record) => (
|
||||
<PreviewUrlButton url={record.url} size="small">
|
||||
查看提交件
|
||||
</PreviewUrlButton>
|
||||
),
|
||||
},
|
||||
]
|
||||
: [
|
||||
const changeColumns = [
|
||||
{ title: "变更时间", dataIndex: "changeTime", width: 160 },
|
||||
{ title: "变更项", dataIndex: "changeItemName", ellipsis: true },
|
||||
{ title: "操作人", dataIndex: "operatorName", width: 110 },
|
||||
|
|
@ -221,11 +107,7 @@ function RegisteredOrgDetailPage(props) {
|
|||
|
||||
return (
|
||||
<PageLayout
|
||||
title={
|
||||
<span>
|
||||
机构基础信息详情{mockEnabled ? <Tag color="warning" style={{ marginLeft: 8 }}>Mock 演示中</Tag> : null}
|
||||
</span>
|
||||
}
|
||||
title="机构基础信息详情"
|
||||
history={props.history}
|
||||
previous
|
||||
>
|
||||
|
|
|
|||
|
|
@ -13,74 +13,6 @@ import { NS_ORG_INFO } from "~/enumerate/namespace";
|
|||
/** 约定式路由首字母小写:registeredOrg/detail */
|
||||
const DETAIL_PATH = "/container/supervision/basicInfo/registeredOrg/detail";
|
||||
|
||||
/** Mock 开关存储键(本页面高内聚 mock,默认开启便于与原型对比) */
|
||||
const ORG_MOCK_STORAGE_KEY = "registeredOrgMockEnabled";
|
||||
|
||||
function getOrgMockEnabled() {
|
||||
try {
|
||||
// URL 参数优先(?mock=1/0),并持久化到 localStorage;与资质备案模块开关行为一致。变更时间:2026-08-10
|
||||
const qs = new URLSearchParams(window.location.search);
|
||||
if (qs.has("mock")) {
|
||||
const v = qs.get("mock") === "1";
|
||||
setOrgMockEnabled(v);
|
||||
return v;
|
||||
}
|
||||
const stored = localStorage.getItem(ORG_MOCK_STORAGE_KEY);
|
||||
if (stored === "1") return true;
|
||||
if (stored === "0") return false;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
// 2026-08-10 按用户要求默认真实接口;mock 代码/数据保留,?mock=1 可临时开启
|
||||
return false;
|
||||
}
|
||||
|
||||
function setOrgMockEnabled(enabled) {
|
||||
try {
|
||||
localStorage.setItem(ORG_MOCK_STORAGE_KEY, enabled ? "1" : "0");
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构备案管理列表 mock(与后端 GET /safetyEval/qual-filing-change/page 的 QualFilingChangeCO 同构)。
|
||||
* 字段:filingUnitName/creditCode/filingUnitTypeName/businessScope/legalRepresentative/filingStatusCode/filingStatusName。
|
||||
* 变更时间:2026-08-10(列表查询切换为 /qual-filing-change/page,mock 同步对齐)
|
||||
*/
|
||||
const ORG_MOCK_LIST = [
|
||||
{ id: 1, filingId: 1, filingUnitName: "重庆安评技术研究院有限公司", creditCode: "915001072028699512", filingUnitTypeName: "本地单位", businessScope: ["COAL_MINING", "METAL_NONMETAL_MINING", "PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_SMELTING"], legalRepresentative: "郑远平", filingStatusCode: 1, filingStatusName: "已备案" },
|
||||
{ id: 2, filingId: 2, filingUnitName: "重庆恒安安全评价有限公司", creditCode: "91500103MA60H002", filingUnitTypeName: "本地单位", businessScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_SMELTING"], legalRepresentative: "刘强", filingStatusCode: 2, filingStatusName: "审核中" },
|
||||
{ id: 3, filingId: 3, filingUnitName: "北京中安评价中心(重庆分公司)", creditCode: "91110108MA01XXXXX", filingUnitTypeName: "异地单位", businessScope: ["METAL_NONMETAL_MINING"], legalRepresentative: "周海峰", filingStatusCode: 3, filingStatusName: "已打回" },
|
||||
{ id: 4, filingId: 4, filingUnitName: "重庆渝安风险评估中心", creditCode: "91500107MA5K1111", filingUnitTypeName: "本地单位", businessScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL"], legalRepresentative: "陈明", filingStatusCode: 4, filingStatusName: "变更审核中" },
|
||||
{ id: 5, filingId: 5, filingUnitName: "四川天府安全评价有限公司(重庆分公司)", creditCode: "91510100MA61XXXXX", filingUnitTypeName: "异地单位", businessScope: ["FIREWORKS_FIRECRACKERS", "COAL_MINING"], legalRepresentative: "李伟", filingStatusCode: 1, filingStatusName: "已备案" },
|
||||
{ id: 6, filingId: 6, filingUnitName: "重庆两江安全技术服务有限公司", creditCode: "91500000MA5UYYYYY", filingUnitTypeName: "本地单位", businessScope: ["METAL_SMELTING", "ONSHORE_OIL_GAS_PIPELINE"], legalRepresentative: "王静", filingStatusCode: 5, filingStatusName: "暂存" },
|
||||
{ id: 7, filingId: 7, filingUnitName: "云南康安评价中心", creditCode: "91530000MA6PZZZZZ", filingUnitTypeName: "异地单位", businessScope: ["COAL_MINING"], legalRepresentative: "赵东升", filingStatusCode: 2, filingStatusName: "审核中" },
|
||||
{ id: 8, filingId: 8, filingUnitName: "重庆科工安全评价中心", creditCode: "91500112MA5WAAAAA", filingUnitTypeName: "本地单位", businessScope: ["ONSHORE_OIL_GAS"], legalRepresentative: "陈海林", filingStatusCode: 1, filingStatusName: "已备案" },
|
||||
{ id: 9, filingId: 9, filingUnitName: "贵州黔安风险评估有限公司(重庆分公司)", creditCode: "91520100MA6HBBBBB", filingUnitTypeName: "异地单位", businessScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL"], legalRepresentative: "张建国", filingStatusCode: 4, filingStatusName: "变更审核中" },
|
||||
{ id: 10, filingId: 10, filingUnitName: "重庆辰安检测评价有限公司", creditCode: "91500105MA5UCCCCC", filingUnitTypeName: "本地单位", businessScope: ["FIREWORKS_FIRECRACKERS", "COAL_MINING"], legalRepresentative: "王丽萍", filingStatusCode: 1, filingStatusName: "已备案" },
|
||||
{ id: 11, filingId: 11, filingUnitName: "湖南湖湘安全评价中心(重庆分公司)", creditCode: "91430100MA4LDDDDD", filingUnitTypeName: "异地单位", businessScope: ["ONSHORE_OIL_GAS_PIPELINE", "METAL_NONMETAL_MINING"], legalRepresentative: "李明华", filingStatusCode: 3, filingStatusName: "已打回" },
|
||||
{ id: 12, filingId: 12, filingUnitName: "重庆巴渝安全评价有限公司", creditCode: "91500109MA5WEEEEE", filingUnitTypeName: "本地单位", businessScope: ["PETROCHEMICAL_CHEMICAL_PHARMACEUTICAL", "METAL_NONMETAL_MINING"], legalRepresentative: "刘海", filingStatusCode: 1, filingStatusName: "已备案" },
|
||||
];
|
||||
|
||||
/** mock 查询:单位名称/状态 过滤 + 分页,返回 { success, data, total }(与接口解包一致) */
|
||||
function mockQueryRegisteredOrgPage(params = {}) {
|
||||
const keyword = String(params.filingUnitName || "").trim().toLowerCase();
|
||||
let rows = ORG_MOCK_LIST.filter((item) => {
|
||||
if (keyword && !item.filingUnitName.toLowerCase().includes(keyword)) return false;
|
||||
if (params.filingStatusCode !== undefined && params.filingStatusCode !== null && params.filingStatusCode !== "" && Number(item.filingStatusCode) !== Number(params.filingStatusCode)) return false;
|
||||
return true;
|
||||
});
|
||||
const current = Number(params.current ?? 1);
|
||||
const size = Number(params.size ?? 10);
|
||||
const start = (current - 1) * size;
|
||||
return {
|
||||
success: true,
|
||||
data: rows.slice(start, start + size),
|
||||
total: rows.length,
|
||||
};
|
||||
}
|
||||
|
||||
/** 提交状态配色(对齐原型 tag-success/warning/danger/info) */
|
||||
function getStatusColor(name) {
|
||||
if (/已备案|通过/.test(name || "")) return "success";
|
||||
|
|
@ -96,23 +28,15 @@ function RegisteredOrgListPage(props) {
|
|||
const [loading, setLoading] = useState(false);
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间:2026-08-10
|
||||
const mockEnabled = getOrgMockEnabled();
|
||||
|
||||
/**
|
||||
* 列表查询:mock 模式走本地数据;真实模式调用 GET /safetyEval/qual-filing-change/page
|
||||
* (返回 QualFilingChangeCO,字段与 mock 同构)。变更时间:2026-08-10
|
||||
* 列表查询:GET /safetyEval/qual-filing-change/page
|
||||
* (返回 QualFilingChangeCO)。变更时间:2026-08-10
|
||||
*/
|
||||
const fetchData = async (page = 1, size = 10, useMock = mockEnabled) => {
|
||||
const fetchData = async (page = 1, size = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const formData = searchForm.getFieldsValue();
|
||||
if (useMock) {
|
||||
const res = mockQueryRegisteredOrgPage({ ...formData, current: page, size });
|
||||
setDataSource(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
return;
|
||||
}
|
||||
const res = await Get(
|
||||
"/safetyEval/qual-filing-change/page",
|
||||
{ ...formData, current: page, size },
|
||||
|
|
|
|||
Loading…
Reference in New Issue