feat
parent
1be6126075
commit
8e6c5c1b69
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
javaGitBranch: "<branch-name>",
|
javaGitBranch: "<branch-name>",
|
||||||
// 本地联调 safetyEval-service(context-path: /safetyEval,默认端口 8095)
|
// 本地联调 safetyEval-service(context-path: /safetyEval,默认端口 8095)
|
||||||
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
|
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
|
||||||
API_HOST: "http://192.168.0.149",
|
API_HOST: "http://192.168.0.152",
|
||||||
},
|
},
|
||||||
production: {
|
production: {
|
||||||
// 应用后端分支名称,部署上线需要
|
// 应用后端分支名称,部署上线需要
|
||||||
|
|
@ -49,7 +49,7 @@ module.exports = {
|
||||||
// 监听端口号
|
// 监听端口号
|
||||||
port: "8081",
|
port: "8081",
|
||||||
// 服务地址(0.0.0.0 允许局域网 IP 访问)
|
// 服务地址(0.0.0.0 允许局域网 IP 访问)
|
||||||
host: "0.0.0.0",
|
host: "192.168.0.187",
|
||||||
// 是否自动打开浏览器
|
// 是否自动打开浏览器
|
||||||
open: false,
|
open: false,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,57 +1,30 @@
|
||||||
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import {
|
|
||||||
fromOrgInfoForm,
|
|
||||||
fromSingleResponse,
|
|
||||||
toOrgInfoForm,
|
|
||||||
} from "../enterpriseInfo/adapter";
|
|
||||||
import { apiGet, apiPost, safeAction } from "../enterpriseInfo/http";
|
|
||||||
import { setOrgInfoDetailCache } from "../enterpriseInfo/orgBootstrap";
|
|
||||||
import { setOrgInfoId } from "../enterpriseInfo/orgContext";
|
|
||||||
|
|
||||||
function persistOrgInfoId(result, rawData) {
|
export const orgInfoGet = declareRequest(
|
||||||
const id = result?.data?.id ?? rawData?.id;
|
"orgInfoLoading",
|
||||||
if (id) {
|
"Get > /safetyEval/org-info/getInfo",
|
||||||
setOrgInfoId(id);
|
"orgInfoDetail: {} | res.data || {}",
|
||||||
}
|
);
|
||||||
setOrgInfoDetailCache(result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildSaveHeaders(payload) {
|
export const orgInfoSave = declareRequest(
|
||||||
if (payload?.id) {
|
"orgInfoLoading",
|
||||||
setOrgInfoId(payload.id);
|
"Post > @/safetyEval/org-info/save",
|
||||||
return { orgInfoId: String(payload.id) };
|
);
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const orgInfoGet = declareRequest("orgInfoLoading", safeAction(async () => {
|
export const orgInfoModify = declareRequest(
|
||||||
const res = await apiGet("/safetyEval/org-info/getInfo", {}, {}, { includeOrgContext: false });
|
"orgInfoLoading",
|
||||||
const result = fromSingleResponse(res, toOrgInfoForm);
|
"Post > @/safetyEval/org-info/modify",
|
||||||
return persistOrgInfoId(result, res?.data);
|
);
|
||||||
}));
|
|
||||||
|
|
||||||
export const orgInfoSave = declareRequest("orgInfoLoading", safeAction(async (values) => {
|
export const orgInfoDraft = declareRequest(
|
||||||
const payload = fromOrgInfoForm(values, { isDraft: false });
|
"orgInfoLoading",
|
||||||
const headers = buildSaveHeaders(payload);
|
"Post > @/safetyEval/org-info/save",
|
||||||
const res = payload.id
|
);
|
||||||
? await apiPost("/safetyEval/org-info/modify", payload, headers)
|
|
||||||
: await apiPost("/safetyEval/org-info/save", payload, headers);
|
|
||||||
const result = fromSingleResponse(res, toOrgInfoForm);
|
|
||||||
persistOrgInfoId(result, res?.data);
|
|
||||||
return result;
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const orgInfoDraft = declareRequest("orgInfoLoading", safeAction(async (values) => {
|
export const orgInfoDraftModify = declareRequest(
|
||||||
const payload = fromOrgInfoForm(values, { isDraft: true });
|
"orgInfoLoading",
|
||||||
const headers = buildSaveHeaders(payload);
|
"Post > @/safetyEval/org-info/modify",
|
||||||
const res = payload.id
|
);
|
||||||
? await apiPost("/safetyEval/org-info/modify", payload, headers)
|
|
||||||
: await apiPost("/safetyEval/org-info/save", payload, headers);
|
|
||||||
const result = fromSingleResponse(res, toOrgInfoForm);
|
|
||||||
persistOrgInfoId(result, res?.data);
|
|
||||||
return result;
|
|
||||||
}));
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
orgAccountList,
|
orgAccountList,
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,11 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
disabled={disabled}
|
//disabled={disabled}
|
||||||
listType="picture-card"
|
listType="picture-card"
|
||||||
|
headers={{
|
||||||
|
token: sessionStorage.getItem('token')
|
||||||
|
}}
|
||||||
maxCount={maxCount}
|
maxCount={maxCount}
|
||||||
accept={accept}
|
accept={accept}
|
||||||
action={`${window.process.env.app.API_HOST}/safetyEval/file/upload`}
|
action={`${window.process.env.app.API_HOST}/safetyEval/file/upload`}
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,6 @@ function OrgInfoPage(props) {
|
||||||
/** 是否已存在机构数据(有 id 视为已入库,只能修改) */
|
/** 是否已存在机构数据(有 id 视为已入库,只能修改) */
|
||||||
const [hasExistingData, setHasExistingData] = useState(false);
|
const [hasExistingData, setHasExistingData] = useState(false);
|
||||||
|
|
||||||
const selectDistrictOptions = CHONGQING_DISTRICTS.map((v) => ({
|
|
||||||
label: v,
|
|
||||||
value: v,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const loadDetail = async () => {
|
const loadDetail = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await props.orgInfoGet();
|
const res = await props.orgInfoGet();
|
||||||
|
|
@ -60,6 +55,7 @@ function OrgInfoPage(props) {
|
||||||
productionDate: res.data.productionDate
|
productionDate: res.data.productionDate
|
||||||
? dayjs(res.data.productionDate)
|
? dayjs(res.data.productionDate)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
attachmentUrls: res.data.attachmentUrls? JSON.parse(res.data.attachmentUrls) :null,
|
||||||
});
|
});
|
||||||
setHasExistingData(true);
|
setHasExistingData(true);
|
||||||
setEditing(false);
|
setEditing(false);
|
||||||
|
|
@ -67,11 +63,6 @@ function OrgInfoPage(props) {
|
||||||
setDetail({});
|
setDetail({});
|
||||||
setHasExistingData(false);
|
setHasExistingData(false);
|
||||||
setEditing(true);
|
setEditing(true);
|
||||||
form.setFieldsValue({
|
|
||||||
filingType: "确认备案",
|
|
||||||
filingRecordStatus: "未备案",
|
|
||||||
attachments: mockUploadFileList("资质申请书.pdf"),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn("[OrgInfo] loadDetail failed:", err);
|
console.warn("[OrgInfo] loadDetail failed:", err);
|
||||||
|
|
@ -107,16 +98,17 @@ function OrgInfoPage(props) {
|
||||||
productionDate: formValues.productionDate
|
productionDate: formValues.productionDate
|
||||||
? dayjs(formValues.productionDate).format("YYYY-MM-DD")
|
? dayjs(formValues.productionDate).format("YYYY-MM-DD")
|
||||||
: undefined,
|
: undefined,
|
||||||
|
attachmentUrls: formValues.attachmentUrls? JSON.stringify(formValues.attachmentUrls) :null,
|
||||||
|
authStatusCode: submitType === "draft" ? 0 : 1,
|
||||||
|
authStatusName: submitType === "draft" ? "草稿" : "已提交",
|
||||||
};
|
};
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
let request;
|
let request;
|
||||||
if (hasExistingData) {
|
if (hasExistingData) {
|
||||||
// 已有数据:仅走修改接口
|
request = props.orgInfoModify;
|
||||||
request = props.orgInfoSave;
|
|
||||||
values.id = detail.id;
|
values.id = detail.id;
|
||||||
} else {
|
} else {
|
||||||
// 无数据:暂存、提交均走保存接口(草稿/已提交由 authStatusCode 区分)
|
|
||||||
request =
|
request =
|
||||||
submitType === "draft" ? props.orgInfoDraft : props.orgInfoSave;
|
submitType === "draft" ? props.orgInfoDraft : props.orgInfoSave;
|
||||||
}
|
}
|
||||||
|
|
@ -133,14 +125,7 @@ function OrgInfoPage(props) {
|
||||||
setEditing(false);
|
setEditing(false);
|
||||||
loadDetail();
|
loadDetail();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} finally {
|
||||||
if (err?.errorFields) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
message.error(
|
|
||||||
hasExistingData ? "修改失败,请稍后重试" : "保存失败,请稍后重试",
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -150,9 +135,7 @@ function OrgInfoPage(props) {
|
||||||
title={
|
title={
|
||||||
<div>
|
<div>
|
||||||
<span>机构信息管理</span>
|
<span>机构信息管理</span>
|
||||||
<div
|
<div className="pageLayout-extra">
|
||||||
className="pageLayout-extra"
|
|
||||||
>
|
|
||||||
新成立或首次使用系统的安全评价机构,可通过系统提供的引导页面,详细填写机构的基本信息。
|
新成立或首次使用系统的安全评价机构,可通过系统提供的引导页面,详细填写机构的基本信息。
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -174,7 +157,7 @@ function OrgInfoPage(props) {
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="orgName"
|
name="unitName"
|
||||||
label="生产经营单位名称"
|
label="生产经营单位名称"
|
||||||
rules={[{ required: true, message: "请输入生产经营单位名称" }]}
|
rules={[{ required: true, message: "请输入生产经营单位名称" }]}
|
||||||
>
|
>
|
||||||
|
|
@ -192,7 +175,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="safetyIndustryCategory"
|
name="safetyIndustryCategoryName"
|
||||||
label="安全生产监管行业类别"
|
label="安全生产监管行业类别"
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: "请输入安全生产监管行业类别" },
|
{ required: true, message: "请输入安全生产监管行业类别" },
|
||||||
|
|
@ -203,12 +186,12 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="regionCountyName"
|
name="districtName"
|
||||||
label="属地"
|
label="属地"
|
||||||
rules={[{ required: true, message: "请选择属地" }]}
|
rules={[{ required: true, message: "请选择属地" }]}
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
options={selectDistrictOptions}
|
options={CHONGQING_DISTRICTS}
|
||||||
placeholder="请选择属地"
|
placeholder="请选择属地"
|
||||||
allowClear
|
allowClear
|
||||||
/>
|
/>
|
||||||
|
|
@ -216,7 +199,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="regionStreetName"
|
name="townStreet"
|
||||||
label="所属镇、街道"
|
label="所属镇、街道"
|
||||||
rules={[{ required: true, message: "请输入所属镇街道" }]}
|
rules={[{ required: true, message: "请输入所属镇街道" }]}
|
||||||
>
|
>
|
||||||
|
|
@ -224,7 +207,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="regionCommunityName" label="属村(社区)">
|
<Form.Item name="villageCommunity" label="属村(社区)">
|
||||||
<Input placeholder="请输入属村(社区)" allowClear />
|
<Input placeholder="请输入属村(社区)" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
@ -277,13 +260,13 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="ownershipType" label="归属类型">
|
<Form.Item name="ownershipTypeName" label="归属类型">
|
||||||
<Input placeholder="请输入归属类型" allowClear />
|
<Input placeholder="请输入归属类型" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="gbIndustryCode"
|
name="economyIndustryCode"
|
||||||
label="国民经济行业分类(GB/T4754-2017)"
|
label="国民经济行业分类(GB/T4754-2017)"
|
||||||
>
|
>
|
||||||
<Input placeholder="请输入国民经济行业分类" allowClear />
|
<Input placeholder="请输入国民经济行业分类" allowClear />
|
||||||
|
|
@ -300,7 +283,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="legalRepPhone"
|
name="legalRepresentativePhone"
|
||||||
label="法定代表人联系电话"
|
label="法定代表人联系电话"
|
||||||
rules={[phoneRule("法定代表人联系电话", false)]}
|
rules={[phoneRule("法定代表人联系电话", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -309,7 +292,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="principal"
|
name="principalName"
|
||||||
label="主要负责人"
|
label="主要负责人"
|
||||||
rules={[{ required: true, message: "请输入主要负责人" }]}
|
rules={[{ required: true, message: "请输入主要负责人" }]}
|
||||||
>
|
>
|
||||||
|
|
@ -326,13 +309,13 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="safetyDeptHead" label="安全管理部门负责人">
|
<Form.Item name="safetyDeptManager" label="安全管理部门负责人">
|
||||||
<Input placeholder="请输入安全管理部门负责人" allowClear />
|
<Input placeholder="请输入安全管理部门负责人" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="safetyDeptPhone"
|
name="safetyDeptManagerPhone"
|
||||||
label="安全管理部门负责人联系电话"
|
label="安全管理部门负责人联系电话"
|
||||||
rules={[phoneRule("安全管理部门负责人联系电话", false)]}
|
rules={[phoneRule("安全管理部门负责人联系电话", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -343,13 +326,13 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="safetyVp" label="主管安全副总">
|
<Form.Item name="safetyDeputyManager" label="主管安全副总">
|
||||||
<Input placeholder="请输入主管安全副总" allowClear />
|
<Input placeholder="请输入主管安全副总" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="safetyVpPhone"
|
name="safetyDeputyPhone"
|
||||||
label="主管安全副总联系电话"
|
label="主管安全副总联系电话"
|
||||||
rules={[phoneRule("主管安全副总联系电话", false)]}
|
rules={[phoneRule("主管安全副总联系电话", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -365,13 +348,13 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="businessStatus" label="企业经营状态">
|
<Form.Item name="businessStatusName" label="企业经营状态">
|
||||||
<Input placeholder="请输入企业经营状态" allowClear />
|
<Input placeholder="请输入企业经营状态" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="disclosureUrl"
|
name="infoDisclosureUrl"
|
||||||
label="信息公开网址"
|
label="信息公开网址"
|
||||||
rules={[urlRule("信息公开网址", false)]}
|
rules={[urlRule("信息公开网址", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -408,7 +391,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="fullTimeEvaluatorCount"
|
name="fulltimeEvaluatorCount"
|
||||||
label="专职安全评价师数量"
|
label="专职安全评价师数量"
|
||||||
rules={[nonNegativeIntegerRule("专职安全评价师数量", false)]}
|
rules={[nonNegativeIntegerRule("专职安全评价师数量", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -422,7 +405,7 @@ function OrgInfoPage(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="registeredSafetyEngineerCount"
|
name="registeredEngineerCount"
|
||||||
label="注册安全工程师数量"
|
label="注册安全工程师数量"
|
||||||
rules={[nonNegativeIntegerRule("注册安全工程师数量", false)]}
|
rules={[nonNegativeIntegerRule("注册安全工程师数量", false)]}
|
||||||
>
|
>
|
||||||
|
|
@ -435,7 +418,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="enterpriseStatus" label="企业状态">
|
<Form.Item name="enterpriseStatusName" label="企业状态">
|
||||||
<Select
|
<Select
|
||||||
options={ENTERPRISE_STATUS_OPTIONS}
|
options={ENTERPRISE_STATUS_OPTIONS}
|
||||||
placeholder="请选择企业状态"
|
placeholder="请选择企业状态"
|
||||||
|
|
@ -444,7 +427,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="enterpriseScale" label="企业规模">
|
<Form.Item name="enterpriseScaleName" label="企业规模">
|
||||||
<Select
|
<Select
|
||||||
options={ENTERPRISE_SCALE_OPTIONS}
|
options={ENTERPRISE_SCALE_OPTIONS}
|
||||||
placeholder="请选择企业规模"
|
placeholder="请选择企业规模"
|
||||||
|
|
@ -453,7 +436,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="filingType" label="备案类型">
|
<Form.Item name="filingTypeName" label="备案类型">
|
||||||
<Select
|
<Select
|
||||||
options={FILING_TYPE_OPTIONS}
|
options={FILING_TYPE_OPTIONS}
|
||||||
placeholder="请选择备案类型"
|
placeholder="请选择备案类型"
|
||||||
|
|
@ -462,7 +445,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="filingRecordStatus" label="备案状态">
|
<Form.Item name="filingRecordStatusName" label="备案状态">
|
||||||
<Select
|
<Select
|
||||||
options={FILING_RECORD_STATUS_OPTIONS}
|
options={FILING_RECORD_STATUS_OPTIONS}
|
||||||
placeholder="请选择备案状态"
|
placeholder="请选择备案状态"
|
||||||
|
|
@ -471,7 +454,7 @@ function OrgInfoPage(props) {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<AttachmentUpload name="attachments" label="上传附件" />
|
<AttachmentUpload name="attachmentUrls" label="上传附件" />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -1,60 +1,32 @@
|
||||||
import { message, Spin } from "antd";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { NS_ORG_INFO } from "~/enumerate/namespace";
|
||||||
import {
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
ensureOrgContext,
|
import { Skeleton } from "antd";
|
||||||
isOrgInfoPage,
|
|
||||||
ORG_INFO_PAGE_PATH,
|
|
||||||
} from "~/api/enterpriseInfo/orgBootstrap";
|
|
||||||
|
|
||||||
/**
|
/** 资质申请管理模块入口:需先有机构信息 */
|
||||||
* 企业信息模块入口:进入时 getInfo,有机构则缓存 orgInfoId;无机构则仅允许访问机构信息管理页。
|
|
||||||
*/
|
|
||||||
function EnterpriseInfo(props) {
|
function EnterpriseInfo(props) {
|
||||||
const [checking, setChecking] = useState(true);
|
|
||||||
const onOrgInfoPage = isOrgInfoPage();
|
const [orgInfoId, setOrgInfoId] = useState(
|
||||||
|
sessionStorage.getItem("orgInfoId"),
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cancelled = false;
|
if (!orgInfoId) {
|
||||||
|
props.orgInfoGet().then((res) => {
|
||||||
ensureOrgContext({ force: true })
|
setOrgInfoId(res?.data?.id);
|
||||||
.then((ctx) => {
|
|
||||||
if (cancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ctx?.networkError && onOrgInfoPage) {
|
|
||||||
message.warning("机构信息加载失败,请确认后端服务已启动");
|
|
||||||
}
|
|
||||||
if (!ctx?.hasOrg && !onOrgInfoPage) {
|
|
||||||
message.warning("请先完善机构信息");
|
|
||||||
//window.location.replace(ORG_INFO_PAGE_PATH);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setChecking(false);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.warn("[EnterpriseInfo] ensureOrgContext failed:", err);
|
|
||||||
if (!cancelled) {
|
|
||||||
if (onOrgInfoPage) {
|
|
||||||
message.warning("机构信息加载失败,请确认后端服务已启动");
|
|
||||||
}
|
|
||||||
setChecking(false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
console.log(props.location.pathname);
|
||||||
|
|
||||||
return () => {
|
if(props.location.pathname.includes('EnterpriseInfo/OrgInfo')){
|
||||||
cancelled = true;
|
return props.children;
|
||||||
};
|
|
||||||
}, [onOrgInfoPage]);
|
|
||||||
|
|
||||||
if (checking) {
|
|
||||||
return <Spin fullscreen tip="正在加载机构信息..." />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: "100%" }}>
|
<div style={{ height: "100%" }}>
|
||||||
{props.children}
|
{orgInfoId ? props.children : <Skeleton active></Skeleton>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EnterpriseInfo;
|
export default Connect([NS_ORG_INFO], true)(EnterpriseInfo);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function QualApplication(props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: "100%" }}>
|
<div style={{ height: "100%" }}>
|
||||||
{orgInfoId ? props.children : <Skeleton></Skeleton>}
|
{orgInfoId ? props.children : <Skeleton active></Skeleton>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
|
import { NS_QUAL_REVIEW } from "~/enumerate/namespace";
|
||||||
import StaffViewModal from "~/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal";
|
import StaffViewModal from "~/pages/Container/EnterpriseInfo/PersonnelInfo/StaffViewModal";
|
||||||
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
|
import PreviewUrlButton from "~/components/PreviewUrlButton/index";
|
||||||
import {
|
|
||||||
MOCK_EQUIP_DETAIL,
|
|
||||||
|
|
||||||
CALIBRATION_MAP,
|
|
||||||
} from "../mockData";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 共享组件:资质备案 5 个标签页(详情 / 审核共用)
|
* 共享组件:资质备案 5 个标签页(详情 / 审核共用)
|
||||||
|
|
@ -25,16 +21,12 @@ const FilingTabs = ({
|
||||||
isReview = false,
|
isReview = false,
|
||||||
compliance = {},
|
compliance = {},
|
||||||
onComplianceChange,
|
onComplianceChange,
|
||||||
onPersonnelView,
|
|
||||||
onEquipView,
|
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
const [equipVisible, setEquipVisible] = useState(false);
|
|
||||||
const [selectedEquip, setSelectedEquip] = useState(null);
|
|
||||||
const [viewId, setViewId] = useState("");
|
const [viewId, setViewId] = useState("");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const baseCols = [
|
const baseCols = [
|
||||||
{ title: "序号", width: 60, render: (_, __, i) => i + 1 },
|
{ title: "序号", width: 60, render: (_, __, i) => i + 1 },
|
||||||
{ title: "材料名称", dataIndex: "materialContent" },
|
{ title: "材料名称", dataIndex: "materialContent" },
|
||||||
|
|
@ -188,34 +180,7 @@ const FilingTabs = ({
|
||||||
onCancel={() => setViewId("")}
|
onCancel={() => setViewId("")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 设备详细信息弹窗 */}
|
|
||||||
<Modal
|
|
||||||
title="设备详细信息"
|
|
||||||
open={equipVisible}
|
|
||||||
onCancel={() => setEquipVisible(false)}
|
|
||||||
width={600}
|
|
||||||
footer={<Button onClick={() => setEquipVisible(false)}>关闭</Button>}
|
|
||||||
>
|
|
||||||
{selectedEquip && (
|
|
||||||
<Descriptions column={1} size="small">
|
|
||||||
<Descriptions.Item label="设备名称">{MOCK_EQUIP_DETAIL.name}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="型号">{MOCK_EQUIP_DETAIL.model}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="仪器分类">{MOCK_EQUIP_DETAIL.category}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="设备类型">{MOCK_EQUIP_DETAIL.type}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="厂家">{MOCK_EQUIP_DETAIL.manufacturer}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="现场校验类型">{MOCK_EQUIP_DETAIL.calibrationType}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="设备流量说明">{MOCK_EQUIP_DETAIL.flowDesc}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="最大流量">{MOCK_EQUIP_DETAIL.maxFlow}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="最小流量">{MOCK_EQUIP_DETAIL.minFlow}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="是否双路">{MOCK_EQUIP_DETAIL.dualChannel}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="校准初始值" span={2}>{MOCK_EQUIP_DETAIL.calibInitValue}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="校准单位" span={2}>{MOCK_EQUIP_DETAIL.calibUnit}</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="设备状态">
|
|
||||||
<Tag color={CALIBRATION_MAP[MOCK_EQUIP_DETAIL.status]?.color}>{CALIBRATION_MAP[MOCK_EQUIP_DETAIL.status]?.label}</Tag>
|
|
||||||
</Descriptions.Item>
|
|
||||||
</Descriptions>
|
|
||||||
)}
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue