Compare commits

..

2 Commits

4 changed files with 107 additions and 28 deletions

View File

@ -10,7 +10,7 @@ module.exports = {
javaGitBranch: "<branch-name>", javaGitBranch: "<branch-name>",
// 本地联调 safety-eval-servicecontext-path: /safety-eval默认端口 8095 // 本地联调 safety-eval-servicecontext-path: /safety-eval默认端口 8095
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095 // 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
API_HOST: process.env.SAFETY_EVAL_API_HOST || "http://127.0.0.1:8095", API_HOST: "http://192.168.0.149:8095",
}, },
production: { production: {
// 应用后端分支名称,部署上线需要 // 应用后端分支名称,部署上线需要

View File

@ -4,6 +4,7 @@ import {
Col, Col,
DatePicker, DatePicker,
Form, Form,
Image,
Input, Input,
InputNumber, InputNumber,
message, message,
@ -12,6 +13,8 @@ import {
Space, Space,
Upload, Upload,
} from "antd"; } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
@ -41,6 +44,7 @@ function OrgInfoPage(props) {
const [editing, setEditing] = useState(true); const [editing, setEditing] = useState(true);
const [submitting, setSubmitting] = useState(false); const [submitting, setSubmitting] = useState(false);
const [detail, setDetail] = useState({}); const [detail, setDetail] = useState({});
const [previewImage, setPreviewImage] = useState("");
/** 是否已存在机构数据(有 id 视为已入库,只能修改) */ /** 是否已存在机构数据(有 id 视为已入库,只能修改) */
const [hasExistingData, setHasExistingData] = useState(false); const [hasExistingData, setHasExistingData] = useState(false);
@ -59,7 +63,6 @@ function OrgInfoPage(props) {
productionDate: res.data.productionDate productionDate: res.data.productionDate
? dayjs(res.data.productionDate) ? dayjs(res.data.productionDate)
: undefined, : undefined,
}); });
setHasExistingData(true); setHasExistingData(true);
setEditing(false); setEditing(false);
@ -145,24 +148,22 @@ function OrgInfoPage(props) {
} }
}; };
const subTitleText =
"新成立或首次使用系统的安全评价机构,可通过系统提供的引导页面,详细填写机构的基本信息。";
return ( return (
<PageLayout <PageLayout
title="机构信息管理" title="机构信息管理"
extra={ extra={
hasExistingData && hasExistingData &&
!editing && ( !editing && (
<Button type="primary" loading={orgInfoLoading} onClick={() => setEditing(true)}> <Button
type="primary"
loading={orgInfoLoading}
onClick={() => setEditing(true)}
>
修改 修改
</Button> </Button>
) )
} }
> >
<p style={{ margin: 0, marginBottom: 24, color: "rgba(0, 0, 0, 0.45)" }}>
{subTitleText}
</p>
<Form form={form} labelCol={{ span: 10 }} disabled={!editing}> <Form form={form} labelCol={{ span: 10 }} disabled={!editing}>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
<Col span={12}> <Col span={12}>
@ -200,7 +201,11 @@ function OrgInfoPage(props) {
label="属地" label="属地"
rules={[{ required: true, message: "请选择属地" }]} rules={[{ required: true, message: "请选择属地" }]}
> >
<Select options={selectDistrictOptions} placeholder="请选择属地" allowClear /> <Select
options={selectDistrictOptions}
placeholder="请选择属地"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -325,7 +330,10 @@ function OrgInfoPage(props) {
label="安全管理部门负责人联系电话" label="安全管理部门负责人联系电话"
rules={[phoneRule("安全管理部门负责人联系电话", false)]} rules={[phoneRule("安全管理部门负责人联系电话", false)]}
> >
<Input placeholder="请输入安全管理部门负责人联系电话" allowClear /> <Input
placeholder="请输入安全管理部门负责人联系电话"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -344,7 +352,10 @@ function OrgInfoPage(props) {
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="productionDate" label="投产日期"> <Form.Item name="productionDate" label="投产日期">
<DatePicker style={{ width: "100%" }} placeholder="请选择投产日期" /> <DatePicker
style={{ width: "100%" }}
placeholder="请选择投产日期"
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -367,7 +378,12 @@ function OrgInfoPage(props) {
label="工作场所建筑面积" label="工作场所建筑面积"
rules={[positiveNumberRule("工作场所建筑面积", false)]} rules={[positiveNumberRule("工作场所建筑面积", false)]}
> >
<InputNumber style={{ width: "100%" }} min={0} precision={2} placeholder="请输入工作场所建筑面积" /> <InputNumber
style={{ width: "100%" }}
min={0}
precision={2}
placeholder="请输入工作场所建筑面积"
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -376,7 +392,12 @@ function OrgInfoPage(props) {
label="档案室面积" label="档案室面积"
rules={[positiveNumberRule("档案室面积", false)]} rules={[positiveNumberRule("档案室面积", false)]}
> >
<InputNumber style={{ width: "100%" }} min={0} precision={2} placeholder="请输入档案室面积" /> <InputNumber
style={{ width: "100%" }}
min={0}
precision={2}
placeholder="请输入档案室面积"
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -385,7 +406,12 @@ function OrgInfoPage(props) {
label="专职安全评价师数量" label="专职安全评价师数量"
rules={[nonNegativeIntegerRule("专职安全评价师数量", false)]} rules={[nonNegativeIntegerRule("专职安全评价师数量", false)]}
> >
<InputNumber style={{ width: "100%" }} min={0} precision={0} placeholder="请输入专职安全评价师数量" /> <InputNumber
style={{ width: "100%" }}
min={0}
precision={0}
placeholder="请输入专职安全评价师数量"
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -394,27 +420,48 @@ function OrgInfoPage(props) {
label="注册安全工程师数量" label="注册安全工程师数量"
rules={[nonNegativeIntegerRule("注册安全工程师数量", false)]} rules={[nonNegativeIntegerRule("注册安全工程师数量", false)]}
> >
<InputNumber style={{ width: "100%" }} min={0} precision={0} placeholder="请输入注册安全工程师数量" /> <InputNumber
style={{ width: "100%" }}
min={0}
precision={0}
placeholder="请输入注册安全工程师数量"
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="enterpriseStatus" label="企业状态"> <Form.Item name="enterpriseStatus" label="企业状态">
<Select options={ENTERPRISE_STATUS_OPTIONS} placeholder="请选择企业状态" allowClear /> <Select
options={ENTERPRISE_STATUS_OPTIONS}
placeholder="请选择企业状态"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="enterpriseScale" label="企业规模"> <Form.Item name="enterpriseScale" label="企业规模">
<Select options={ENTERPRISE_SCALE_OPTIONS} placeholder="请选择企业规模" allowClear /> <Select
options={ENTERPRISE_SCALE_OPTIONS}
placeholder="请选择企业规模"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="filingType" label="备案类型"> <Form.Item name="filingType" label="备案类型">
<Select options={FILING_TYPE_OPTIONS} placeholder="请选择备案类型" allowClear /> <Select
options={FILING_TYPE_OPTIONS}
placeholder="请选择备案类型"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="filingRecordStatus" label="备案状态"> <Form.Item name="filingRecordStatus" label="备案状态">
<Select options={FILING_RECORD_STATUS_OPTIONS} placeholder="请选择备案状态" allowClear /> <Select
options={FILING_RECORD_STATUS_OPTIONS}
placeholder="请选择备案状态"
allowClear
/>
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -422,9 +469,35 @@ function OrgInfoPage(props) {
name="attachments" name="attachments"
label="上传附件" label="上传附件"
valuePropName="fileList" valuePropName="fileList"
getValueFromEvent={({ fileList }) => {
return (
fileList?.map((file) => {
return {
url: file.response?.data.url || file.url,
uid: file.uid,
name: file.name,
};
}) || []
);
}}
> >
<Upload maxCount={5} listType="picture-card"> <Upload
<Button>上传附件</Button> maxCount={5}
onPreview={(file) => {
const isImage = /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(file.name || file.url || "");
if (isImage) {
setPreviewImage(file.url || file.thumbUrl);
} else {
window.open(file.url || file.thumbUrl);
}
}}
listType="picture-card"
action={`${window.process.env.app.API_HOST}/safety-eval/file/upload`}
>
<button style={{ border: 0, background: "none" }} type="button">
<PlusOutlined />
<div style={{ marginTop: 8 }}>上传附件</div>
</button>
</Upload> </Upload>
</Form.Item> </Form.Item>
</Col> </Col>
@ -449,6 +522,16 @@ function OrgInfoPage(props) {
</Space> </Space>
</div> </div>
)} )}
<Image
style={{ display: "none" }}
preview={{
visible: !!previewImage,
src: previewImage,
onVisibleChange: (visible) => {
if (!visible) setPreviewImage("");
},
}}
/>
</PageLayout> </PageLayout>
); );
} }

View File

@ -1,8 +1,6 @@
function PersonnelInfo(props) { function PersonnelInfo(props) {
return ( return (
<div> props.children
{props.children}
</div>
); );
} }

View File

@ -2,8 +2,6 @@ import React from "react";
export default (props)=>{ export default (props)=>{
return ( return (
<div style={{height: "100%"}}> props.children
{props.children}
</div>
) )
} }