dev-tmp1
tangjie 2026-08-10 17:45:12 +08:00
parent 35452ae9a2
commit 3124915a2e
11 changed files with 48 additions and 263 deletions

View File

@ -520,7 +520,7 @@ function EquipFormModal({
);
}
function EquipViewModal({ open, currentId, equipInfoGet, onCancel }) {
export function EquipViewModal({ open, currentId, equipInfoGet, onCancel }) {
const [info, setInfo] = useState({});
const [detailLoading, setDetailLoading] = useState(false);

View File

@ -17,10 +17,6 @@ import {
REVIEW_UNIT_TYPE_OPTIONS,
toQualReviewPageQuery,
} from "../reviewPageQuery";
import {
getQualReviewMockEnabled,
mockQueryExpertList,
} from "../mockData";
import "../QualReview/index.less";
const { router } = tools;
@ -35,19 +31,8 @@ const ExpertVerification = (props) => {
const [form] = Form.useForm();
const { qualReview, queryReviewList } = props;
const { qualReviewList, qualReviewTotal, qualReviewLoading } = qualReview || {};
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间2026-08-10
const mockEnabled = getQualReviewMockEnabled();
const loadList = (useMock = mockEnabled) => {
if (useMock) {
const res = mockQueryExpertList(router.query);
props.resetModelState(NS_QUAL_REVIEW, {
qualReviewList: res.data,
qualReviewTotal: res.total,
qualReviewLoading: false,
});
return;
}
const loadList = () => {
queryReviewList({
...toQualReviewPageQuery(router.query),
supervision: true,
@ -140,8 +125,8 @@ const ExpertVerification = (props) => {
>
查看
</Button>
{/* mock 演示模式展示全部“核验”按钮便于与原型对比;真实模式仅待确认可操作 */}
{(mockEnabled || Number(record.filingStatusCode) === 2) && (
{/* 仅待确认状态可操作 */}
{Number(record.filingStatusCode) === 2 && (
<Button
type="link"
size="small"

View File

@ -6,7 +6,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import { tools } from "@cqsjjb/jjb-common-lib";
import FilingTabs from "../FilingTabs";
import { getQualReviewMockEnabled, mockGetFilingDetail } from "../mockData";
const { router } = tools;
@ -18,19 +17,10 @@ const FilingDetail = (props) => {
const { qualReview, fetchQualFilingDetail, fetchQualChangeDetail } = props;
const { fetchQualFilingDetailLoading, qualFilingDetail } = qualReview || {};
const isChange = router.query.mode === "change";
const mockEnabled = getQualReviewMockEnabled();
const statusConfig = REVIEW_STATUS_MAP[qualFilingDetail?.filingStatusCode];
useEffect(() => {
if (mockEnabled) {
// Mock 演示:本地注入详情,不请求后端
props.resetModelState(NS_QUAL_REVIEW, {
qualFilingDetail: mockGetFilingDetail(router.query.id),
fetchQualFilingDetailLoading: false,
});
return;
}
const action = isChange ? fetchQualChangeDetail : fetchQualFilingDetail;
if (router.query.id) {
action({ id: router.query.id });
@ -45,7 +35,6 @@ const FilingDetail = (props) => {
{statusConfig && (
<Tag color={statusConfig.color}>{statusConfig.label}</Tag>
)}
{mockEnabled && <Tag color="warning">Mock 演示中</Tag>}
</Space>
}
history={props.history}

View File

@ -1,9 +1,10 @@
import React, { useState, useMemo } from "react";
import { Button, Image, Input, Modal, Select, Table, Tabs, Tag } from "antd";
import { Button, Image, Input, Select, Table, Tabs, Tag } from "antd";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import { NS_QUAL_REVIEW, NS_EQUIP_INFO } from "~/enumerate/namespace";
import StaffViewModal from "~/components/StaffViewModal";
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
import { EquipViewModal } from "~/pages/Container/EnterpriseInfo/EquipInfo";
import {
QUALIFICATION_INDUSTRY_OPTIONS,
QUALIFICATION_INDUSTRY_OPTIONS_MAP,
@ -100,72 +101,6 @@ function ReadonlyField({ label, value, span }) {
);
}
/**
* 设备详情弹窗原型 modal-equip-view 缺失按列表字段补全
*/
function EquipViewModal({ record, onCancel }) {
const open = !!record;
const calibration = record ? getCalibrationTag(record) : null;
const rows = record
? [
{ label: "装备名称", value: record.deviceName },
{ label: "规格型号", value: record.deviceModel },
{ label: "生产厂家", value: record.manufacturer },
{ label: "设备价值(元)", value: record.equipmentValue },
{ label: "计量检定情况", value: null },
]
: [];
return (
<Modal
open={open}
title="装备详情"
width={560}
cancelText="关闭"
okText="关闭"
onOk={onCancel}
onCancel={onCancel}
footer={
<Button type="primary" onClick={onCancel}>
关闭
</Button>
}
>
{record && (
<div style={gridStyle}>
{rows.map((row) =>
row.value != null ? (
<ReadonlyField key={row.label} label={row.label} value={row.value} />
) : (
<div key={row.label} style={fieldStyle}>
<label style={labelStyle}>{row.label}</label>
<div>
{calibration && (
<Tag
color={calibration.status === "success" ? "success" : "warning"}
>
{calibration.label}
</Tag>
)}
</div>
</div>
),
)}
<div style={{ ...fieldStyle, ...fullSpan }}>
<label style={labelStyle}>检定报告</label>
<div>
{record.calibrationReportUrl ? (
<PreviewUrlButton url={record.calibrationReportUrl}>预览检定报告</PreviewUrlButton>
) : (
<span style={{ color: "#64748b", fontSize: "0.8rem" }}>未上传</span>
)}
</div>
</div>
</div>
)}
</Modal>
);
}
const FilingTabs = ({
detail = {},
isReview = false,
@ -176,9 +111,11 @@ const FilingTabs = ({
* 不传时保持原 6 Tab不影响初审/确认/专家核验展示变更时间2026-08-10
*/
extraTabs,
equipInfoGet,
}) => {
const [viewId, setViewId] = useState("");
const [equipRecord, setEquipRecord] = useState(null);
const [equipViewOpen, setEquipViewOpen] = useState(false);
const [equipId, setEquipId] = useState("");
const personnelRows = useMemo(
() =>
@ -520,7 +457,14 @@ const FilingTabs = ({
title: "操作",
width: 80,
render: (_, record) => (
<Button type="link" size="small" onClick={() => setEquipRecord(record)}>
<Button
type="link"
size="small"
onClick={() => {
setEquipId(record.sourceEquipmentId);
setEquipViewOpen(true);
}}
>
查看
</Button>
),
@ -592,9 +536,19 @@ const FilingTabs = ({
onCancel={() => setViewId("")}
/>
<EquipViewModal record={equipRecord} onCancel={() => setEquipRecord(null)} />
{equipViewOpen && (
<EquipViewModal
open={equipViewOpen}
currentId={equipId}
equipInfoGet={equipInfoGet}
onCancel={() => {
setEquipViewOpen(false);
setEquipId("");
}}
/>
)}
</>
);
};
export default Connect([NS_QUAL_REVIEW], true)(FilingTabs);
export default Connect([NS_QUAL_REVIEW, NS_EQUIP_INFO], true)(FilingTabs);

View File

@ -10,10 +10,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP } from "~/enumerate/enterpriseOptions";
import { REVIEW_BUSINESS_SCOPE_OPTIONS, REVIEW_STATUS_CLASS } from "../reviewPageQuery";
import {
getQualReviewMockEnabled,
mockQueryChangeList,
} from "../mockData";
import "../QualReview/index.less";
const { router } = tools;
@ -45,19 +41,8 @@ const QualChange = (props) => {
const [form] = Form.useForm();
const { qualReview, queryQualChangePage } = props;
const { qualReviewList, qualReviewTotal, qualReviewLoading } = qualReview || {};
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间2026-08-10
const mockEnabled = getQualReviewMockEnabled();
const loadList = (useMock = mockEnabled) => {
if (useMock) {
const res = mockQueryChangeList(router.query);
props.resetModelState(NS_QUAL_REVIEW, {
qualReviewList: res.data,
qualReviewTotal: res.total,
qualReviewLoading: false,
});
return;
}
const loadList = () => {
queryQualChangePage({
...router.query,
current: router.query.current || 1,
@ -143,8 +128,8 @@ const QualChange = (props) => {
>
查看
</Button>
{/* mock 演示模式展示全部“审核”按钮;真实模式 审核中/变更审核中 可审核 */}
{(mockEnabled || [2, 4].includes(Number(record.filingStatusCode))) && (
{/* 仅审核中/变更审核中可审核 */}
{[2, 4].includes(Number(record.filingStatusCode)) && (
<Button
type="link"
size="small"

View File

@ -17,10 +17,6 @@ import {
REVIEW_UNIT_TYPE_OPTIONS,
toQualReviewPageQuery,
} from "../reviewPageQuery";
import {
getQualReviewMockEnabled,
mockQueryConfirmList,
} from "../mockData";
import "../QualReview/index.less";
const { router } = tools;
@ -36,19 +32,8 @@ const QualConfirm = (props) => {
const [form] = Form.useForm();
const { qualReview, queryReviewList } = props;
const { qualReviewList, qualReviewTotal, qualReviewLoading } = qualReview || {};
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间2026-08-10
const mockEnabled = getQualReviewMockEnabled();
const loadList = (useMock = mockEnabled) => {
if (useMock) {
const res = mockQueryConfirmList(router.query);
props.resetModelState(NS_QUAL_REVIEW, {
qualReviewList: res.data,
qualReviewTotal: res.total,
qualReviewLoading: false,
});
return;
}
const loadList = () => {
queryReviewList({
...toQualReviewPageQuery(router.query),
supervision: true,
@ -141,8 +126,8 @@ const QualConfirm = (props) => {
>
查看
</Button>
{/* mock 演示模式展示全部“确认”按钮便于与原型对比;真实模式仅待确认可操作 */}
{(mockEnabled || Number(record.filingStatusCode) === 2) && (
{/* 仅待确认状态可操作 */}
{Number(record.filingStatusCode) === 2 && (
<Button
type="link"
size="small"

View File

@ -5,7 +5,6 @@ import { tools } from "@cqsjjb/jjb-common-lib";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import FilingTabs from "../FilingTabs";
import { getQualReviewMockEnabled, mockGetFilingDetail } from "../mockData";
import "./indes.less";
const { TextArea } = Input;
@ -43,18 +42,9 @@ const QualConfirmForm = (props) => {
qualFilingDetail = {},
} = qualReview || {};
const isChange = router.query.mode === "change";
const mockEnabled = getQualReviewMockEnabled();
const [submitting, setSubmitting] = useState(false);
useEffect(() => {
if (mockEnabled) {
// Mock 演示:本地注入详情,不请求后端
props.resetModelState(NS_QUAL_REVIEW, {
qualFilingDetail: mockGetFilingDetail(router.query.id),
fetchQualFilingDetailLoading: false,
});
return;
}
const action = isChange ? fetchQualChangeDetail : fetchQualFilingDetail;
action({ id: router.query.id });
}, []);
@ -64,15 +54,6 @@ const QualConfirmForm = (props) => {
const option = CONFIRM_RESULT_OPTIONS.find(
(item) => item.value === Number(values.reviewResult),
);
if (mockEnabled) {
// Mock 演示:模拟提交成功,不调用真实接口
setSubmitting(true);
await new Promise((resolve) => setTimeout(resolve, 400));
setSubmitting(false);
message.success("确认意见已提交!");
props.history.goBack();
return;
}
const submitAction = isChange ? changeReviewSubmit : reviewSubmit;
const params = {
filingId: router.query.id,
@ -97,7 +78,6 @@ const QualConfirmForm = (props) => {
<Space>
<span>资质备案确认</span>
<Tag color="warning">{qualFilingDetail.filingStatusName || "待确认"}</Tag>
{mockEnabled && <Tag color="warning">Mock 演示中</Tag>}
</Space>
}
history={props.history}

View File

@ -17,10 +17,6 @@ import {
REVIEW_UNIT_TYPE_OPTIONS,
toQualReviewPageQuery,
} from "../reviewPageQuery";
import {
getQualReviewMockEnabled,
mockQueryReviewList,
} from "../mockData";
import "./index.less";
const { router } = tools;
@ -35,23 +31,11 @@ const QualReview = (props) => {
const [form] = Form.useForm();
const { qualReview, queryReviewList } = props;
const { qualReviewList, qualReviewTotal, qualReviewLoading } = qualReview || {};
// mock 默认关闭(真实接口);?mock=1 可临时开启演示。变更时间2026-08-10
const mockEnabled = getQualReviewMockEnabled();
/**
* 数据加载mock 模式走本地高内聚数据不请求后端
* 真实模式走原有接口二者互不影响
* 数据加载走真实接口
*/
const loadList = (useMock = mockEnabled) => {
if (useMock) {
const res = mockQueryReviewList(router.query);
props.resetModelState(NS_QUAL_REVIEW, {
qualReviewList: res.data,
qualReviewTotal: res.total,
qualReviewLoading: false,
});
return;
}
const loadList = () => {
queryReviewList({
...toQualReviewPageQuery(router.query),
supervision: true,
@ -171,8 +155,8 @@ const QualReview = (props) => {
>
查看
</Button>
{/* mock 演示模式展示全部“审核”按钮便于与原型对比;真实模式按状态显示 */}
{(mockEnabled || Number(record.filingStatusCode) !== 1) && (
{/* 仅已审核状态不可审核 */}
{Number(record.filingStatusCode) !== 1 && (
<Button
type="link"
size="small"

View File

@ -3,7 +3,6 @@ import { Button, Form, Input, message, Modal, Select } from "antd";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_EXPERT, NS_QUAL_REVIEW } from "~/enumerate/namespace";
import { REVIEW_RESULT_OPTIONS } from "../reviewPageQuery";
import { getQualReviewMockEnabled, mockGetExpertPage } from "../mockData";
const { TextArea } = Input;
@ -40,21 +39,13 @@ const ReviewModal = (props) => {
const { qualExpert, qualReview, queryExpertPage, reviewSubmit, changeReviewSubmit } = props;
const { qualExpertList } = qualExpert || {};
const { qualReviewSubmitLoading } = qualReview || {};
const mockEnabled = getQualReviewMockEnabled();
const [form] = Form.useForm();
useEffect(() => {
if (open) {
form.resetFields();
if (mockEnabled) {
// Mock 演示:本地注入专家列表,不请求后端
props.resetModelState(NS_QUAL_EXPERT, {
qualExpertList: mockGetExpertPage(),
});
} else {
queryExpertPage({ current: 1, size: 100 });
}
queryExpertPage({ current: 1, size: 100 });
}
}, [open]);
@ -69,14 +60,6 @@ const ReviewModal = (props) => {
);
const doSubmit = async (values, passQuick) => {
if (mockEnabled) {
// Mock 演示:模拟提交成功,不调用真实接口
await new Promise((resolve) => setTimeout(resolve, 400));
message.success(passQuick ? "审核通过!" : "审核提交成功");
onCancel();
onSuccess?.();
return true;
}
const selected = expertOptions.find((o) => o.value === values.filingExpertId);
const result = passQuick ? 1 : values.reviewResult;
const resultLabel =

View File

@ -7,11 +7,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
import FilingTabs from "../FilingTabs";
import ReviewModal from "./ReviewModal";
import {
getQualReviewMockEnabled,
mockGetComplianceItems,
mockGetFilingDetail,
} from "../mockData";
import "./indes.less";
const { router } = tools;
@ -39,7 +34,6 @@ const QualReviewForm = (props) => {
qualFilingDetail = {},
} = qualReview || {};
const isChange = router.query.mode === "change";
const mockEnabled = getQualReviewMockEnabled();
const [compliance, setCompliance] = useState({});
const [reviewVisible, setReviewVisible] = useState(false);
@ -56,16 +50,6 @@ const QualReviewForm = (props) => {
).length;
useEffect(() => {
if (mockEnabled) {
// Mock 演示:本地注入详情与法律规定内容,不请求后端
props.resetModelState(NS_QUAL_REVIEW, {
complianceCheckItems: mockGetComplianceItems(),
qualFilingDetail: mockGetFilingDetail(router.query.id),
qualReviewLoading: false,
fetchQualFilingDetailLoading: false,
});
return;
}
const complianceAction = isChange
? queryChangeComplianceCheck
: queryComplianceCheck;
@ -80,10 +64,6 @@ const QualReviewForm = (props) => {
const handleComplianceChange = (id, v) => {
setCompliance((prev) => ({ ...prev, [id]: v }));
if (v == null) return;
if (mockEnabled) {
// Mock 演示:仅本地记录,不调用真实接口
return;
}
const hasSatisfy = v === "pass" ? 1 : 2;
const action = isChange ? modifyFilingMaterialChange : modifyFilingMaterial;
action({ id, hasSatisfy }).then((res) => {
@ -101,7 +81,6 @@ const QualReviewForm = (props) => {
{statusConfig && (
<Tag color={statusConfig.color}>{statusConfig.label}</Tag>
)}
{mockEnabled && <Tag color="warning">Mock 演示中</Tag>}
</Space>
}
history={props.history}

View File

@ -1,51 +1,12 @@
/**
* 资质备案初审QualificationReview/QualReview高内聚 Mock 数据模块
* 资质备案初审QualificationReview/QualReviewMock 数据模块
*
* 设计目标
* 1. 数据开关查询辅助函数全部集中在本文件页面只消费导出 API便于维护
* 2. 随时可切换默认开启 mock 演示可通过列表页工具栏开关localStorage
* URL 参数?mock=0 / ?mock=1随时切换关闭后完全走真实后端接口互不影响
* 3. Mock 列表覆盖原型全部状态与按钮待审核/审核中/已审核/打回/变更审核中/暂存
* 专家核验 待核验/待安排/已核验/无需以及 查看/审核 等全部按钮入口
* 便于人工与原型 regulator.html 逐项对比
*
* 开关优先级URL ?mock= > localStorage(qualReviewMockEnabled) > 默认开启
* Mock 列表覆盖原型全部状态与按钮待审核/审核中/已审核/打回/变更审核中/暂存
* 专家核验 待核验/待安排/已核验/无需以及 查看/审核 等全部按钮入口
* 便于人工与原型 regulator.html 逐项对比
*/
/**
* 默认是否启用 mocktrue=演示模式false=真实后端
* 2026-08-10 按用户要求默认切换为真实接口mock 代码/数据保留仍可通过 ?mock=1 localStorage 临时开启演示
*/
export const QUAL_REVIEW_MOCK_DEFAULT_ENABLED = false;
const MOCK_STORAGE_KEY = "qualReviewMockEnabled";
export function getQualReviewMockEnabled() {
try {
const qs = new URLSearchParams(window.location.search);
if (qs.has("mock")) {
const v = qs.get("mock") === "1";
localStorage.setItem(MOCK_STORAGE_KEY, v ? "1" : "0");
return v;
}
const stored = localStorage.getItem(MOCK_STORAGE_KEY);
if (stored === "1") return true;
if (stored === "0") return false;
} catch {
// 非浏览器环境(如构建期)忽略
}
return QUAL_REVIEW_MOCK_DEFAULT_ENABLED;
}
export function setQualReviewMockEnabled(enabled) {
try {
localStorage.setItem(MOCK_STORAGE_KEY, enabled ? "1" : "0");
} catch {
// ignore
}
}
/** 业务范围编码 → 原型展示名(与 QUALIFICATION_INDUSTRY_OPTIONS 对齐) */
/** 业务范围编码 -> 原型展示名(与 QUALIFICATION_INDUSTRY_OPTIONS 对齐) */
const SCOPE_NAME = {
COAL_MINING: "煤炭开采业",
METAL_NONMETAL_MINING: "金属、非金属矿及其他矿采选业",
@ -264,7 +225,7 @@ export const MOCK_QUAL_FILING_DETAIL = {
},
};
/** 专家列表 mock审核操作弹窗“指派专家”选项) */
/** 专家列表 mock审核操作弹窗"指派专家"选项) */
export const MOCK_EXPERT_LIST = [
{ id: 11, userName: "陈教授" },
{ id: 12, userName: "李教授" },
@ -273,7 +234,7 @@ export const MOCK_EXPERT_LIST = [
/**
* 设备计量检定情况展示原型 tag-success/tag-warning
* 有检定报告时显示已检定否则待检定
* 有检定报告时显示"已检定"否则"待检定"
*/
export function getCalibrationTag(record) {
return record?.calibrationReportUrl || record?.inspectionResult === "已检定"