fix
parent
7121437b4d
commit
039423bd6c
|
|
@ -21,7 +21,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
|
||||||
fileList: value
|
fileList: value
|
||||||
? value.split(",").map((item) => ({
|
? value.split(",").map((item) => ({
|
||||||
url: item,
|
url: item,
|
||||||
uid: item,
|
uid: item,
|
||||||
status: "done",
|
status: "done",
|
||||||
name: "附件",
|
name: "附件",
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { Button, DatePicker, Form, Image, Input, message, Modal, Row, Col, Select, Table, Upload } from "antd";
|
import {
|
||||||
import { UploadOutlined } from "@ant-design/icons";
|
Button,
|
||||||
|
DatePicker,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
message,
|
||||||
|
Modal,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Select,
|
||||||
|
Table,
|
||||||
|
} from "antd";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
||||||
|
|
@ -319,14 +329,10 @@ function StaffFormModal({
|
||||||
const [detailLoading, setDetailLoading] = useState(false);
|
const [detailLoading, setDetailLoading] = useState(false);
|
||||||
const [deptPositionOptions, setDeptPositionOptions] = useState([]);
|
const [deptPositionOptions, setDeptPositionOptions] = useState([]);
|
||||||
const [positionLoading, setPositionLoading] = useState(false);
|
const [positionLoading, setPositionLoading] = useState(false);
|
||||||
const [uploadFileList, setUploadFileList] = useState([]);
|
|
||||||
const [previewImage, setPreviewImage] = useState("");
|
|
||||||
const watchedDeptId = Form.useWatch("deptId", form);
|
const watchedDeptId = Form.useWatch("deptId", form);
|
||||||
const wasOpenRef = useRef(false);
|
const wasOpenRef = useRef(false);
|
||||||
const inflightDeptRef = useRef(null);
|
const inflightDeptRef = useRef(null);
|
||||||
|
|
||||||
const isImage = (url) => /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || "");
|
|
||||||
|
|
||||||
const loadPositionsByDept = async (deptId) => {
|
const loadPositionsByDept = async (deptId) => {
|
||||||
const id = deptId;
|
const id = deptId;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|
@ -363,8 +369,6 @@ function StaffFormModal({
|
||||||
if (!currentId) {
|
if (!currentId) {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setDeptPositionOptions([]);
|
setDeptPositionOptions([]);
|
||||||
setUploadFileList([]);
|
|
||||||
setPreviewImage("");
|
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
registerEngineerFlag: 2,
|
registerEngineerFlag: 2,
|
||||||
});
|
});
|
||||||
|
|
@ -372,8 +376,6 @@ function StaffFormModal({
|
||||||
}
|
}
|
||||||
if (!open) {
|
if (!open) {
|
||||||
setDeptPositionOptions([]);
|
setDeptPositionOptions([]);
|
||||||
setUploadFileList([]);
|
|
||||||
setPreviewImage("");
|
|
||||||
}
|
}
|
||||||
wasOpenRef.current = open;
|
wasOpenRef.current = open;
|
||||||
}, [open, currentId, form]);
|
}, [open, currentId, form]);
|
||||||
|
|
@ -410,8 +412,6 @@ function StaffFormModal({
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setDeptPositionOptions([]);
|
setDeptPositionOptions([]);
|
||||||
setUploadFileList([]);
|
|
||||||
setPreviewImage("");
|
|
||||||
onCancel();
|
onCancel();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -661,46 +661,6 @@ function StaffFormModal({
|
||||||
label="申报专业能力证明材料"
|
label="申报专业能力证明材料"
|
||||||
maxCount={5}
|
maxCount={5}
|
||||||
/>
|
/>
|
||||||
<Form.Item
|
|
||||||
name="proofMaterialUrl"
|
|
||||||
label="申报专业能力证明材料"
|
|
||||||
valuePropName="fileList"
|
|
||||||
getValueFromEvent={(e) => {
|
|
||||||
if (Array.isArray(e)) return e;
|
|
||||||
return e?.fileList;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Upload
|
|
||||||
action={`${window.process.env.app.API_HOST}/safetyEval/file/upload`}
|
|
||||||
headers={{ token: sessionStorage.getItem("token") }}
|
|
||||||
maxCount={5}
|
|
||||||
fileList={uploadFileList}
|
|
||||||
onChange={(info) => {
|
|
||||||
setUploadFileList(info.fileList);
|
|
||||||
}}
|
|
||||||
onPreview={(file) => {
|
|
||||||
const src = file.url || file.response?.data?.url || file.thumbUrl;
|
|
||||||
if (!src) return;
|
|
||||||
if (isImage(src)) {
|
|
||||||
setPreviewImage(src);
|
|
||||||
} else {
|
|
||||||
window.open(src, "_blank");
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button icon={<UploadOutlined />}>上传文件</Button>
|
|
||||||
</Upload>
|
|
||||||
</Form.Item>
|
|
||||||
<Image
|
|
||||||
style={{ display: "none" }}
|
|
||||||
preview={{
|
|
||||||
visible: !!previewImage,
|
|
||||||
src: previewImage,
|
|
||||||
onVisibleChange: (visible) => {
|
|
||||||
if (!visible) setPreviewImage("");
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="currentAddress" label="现住地址">
|
<Form.Item name="currentAddress" label="现住地址">
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,21 @@
|
||||||
import {
|
import {
|
||||||
Button, Descriptions, Form, Input, InputNumber, message, Modal, Row, Col, Select, Space, Tag,
|
Button, DatePicker, Descriptions, Form, Input, InputNumber, message, Modal, Row, Col, Select, Space, Tag, Table,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
|
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
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";
|
||||||
import Search from "zy-react-library/components/Search";
|
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
|
||||||
import Table from "zy-react-library/components/Table";
|
import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
|
||||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|
||||||
import useTable from "zy-react-library/hooks/useTable";
|
|
||||||
import { isOrgAccountEnabled } from "~/api/enterpriseInfo/adapter";
|
import { isOrgAccountEnabled } from "~/api/enterpriseInfo/adapter";
|
||||||
import {
|
import {
|
||||||
CHONGQING_DISTRICTS,
|
CHONGQING_DISTRICTS,
|
||||||
ENTERPRISE_SCALE_OPTIONS,
|
ENTERPRISE_SCALE_OPTIONS,
|
||||||
ENTERPRISE_STATUS_OPTIONS,
|
|
||||||
ORG_ACCOUNT_STATE_OPTIONS,
|
ORG_ACCOUNT_STATE_OPTIONS,
|
||||||
|
ENTERPRISE_STATUS_OPTIONS
|
||||||
} from "~/enumerate/enterpriseOptions";
|
} from "~/enumerate/enterpriseOptions";
|
||||||
import { NS_ORG_INFO } from "~/enumerate/namespace";
|
import { NS_ORG_INFO } from "~/enumerate/namespace";
|
||||||
import { safeListRequest, safeRequest } from "~/utils";
|
import { safeListRequest, safeRequest } from "~/utils";
|
||||||
import { formSelectField } from "~/utils/enterpriseForm";
|
|
||||||
|
|
||||||
const SEARCH_COL = { xs: 24, sm: 12, md: 8, lg: 6 };
|
|
||||||
const SEARCH_DEFAULT_VALUES = { state: "" };
|
|
||||||
|
|
||||||
function OrgAccountPage(props) {
|
function OrgAccountPage(props) {
|
||||||
const [searchForm] = Form.useForm();
|
const [searchForm] = Form.useForm();
|
||||||
|
|
@ -32,8 +27,21 @@ function OrgAccountPage(props) {
|
||||||
const [rawDetail, setRawDetail] = useState(null);
|
const [rawDetail, setRawDetail] = useState(null);
|
||||||
const [detailLoading, setDetailLoading] = useState(false);
|
const [detailLoading, setDetailLoading] = useState(false);
|
||||||
const [editLoading, setEditLoading] = useState(false);
|
const [editLoading, setEditLoading] = useState(false);
|
||||||
|
const [dataSource, setDataSource] = useState([]);
|
||||||
|
const [total, setTotal] = useState(0);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const { tableProps, getData } = useTable(safeListRequest(props.orgAccountList), { form: searchForm });
|
const getData = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const params = searchForm.getFieldsValue();
|
||||||
|
const res = await safeListRequest(props.orgAccountList)(params);
|
||||||
|
setDataSource(res?.data || []);
|
||||||
|
setTotal(res?.total || 0);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
|
|
@ -162,6 +170,37 @@ function OrgAccountPage(props) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{ title: "机构名称", dataIndex: "orgName", ellipsis: true },
|
||||||
|
{ title: "属地", dataIndex: "district", width: 100 },
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
width: 80,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Tag color={isOrgAccountEnabled(record) ? "success" : "error"}>
|
||||||
|
{isOrgAccountEnabled(record) ? "启用" : "禁用"}
|
||||||
|
</Tag>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ title: "开户时间", dataIndex: "createTime", width: 110 },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
width: 320,
|
||||||
|
fixed: "right",
|
||||||
|
render: (_, record) => (
|
||||||
|
<TableAction>
|
||||||
|
<Button type="link" size="small" onClick={() => openView(record.id)}>查看</Button>
|
||||||
|
<Button type="link" size="small" onClick={() => openEdit(record.id)}>编辑</Button>
|
||||||
|
<Button type="link" size="small" onClick={() => onResetPassword(record)}>重置密码</Button>
|
||||||
|
<Button type="link" size="small" danger onClick={() => onDelete(record)}>删除</Button>
|
||||||
|
<Button type="link" size="small" onClick={() => onToggleStatus(record)}>
|
||||||
|
{isOrgAccountEnabled(record) ? "禁用" : "启用"}
|
||||||
|
</Button>
|
||||||
|
</TableAction>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayout
|
<PageLayout
|
||||||
title={
|
title={
|
||||||
|
|
@ -173,60 +212,55 @@ function OrgAccountPage(props) {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Search
|
<SearchForm
|
||||||
|
style={{ marginBottom: 24 }}
|
||||||
form={searchForm}
|
form={searchForm}
|
||||||
values={SEARCH_DEFAULT_VALUES}
|
loading={loading}
|
||||||
options={[
|
formLine={[
|
||||||
{ name: "orgName", label: "机构名称", placeholder: "关键字搜索", colProps: SEARCH_COL },
|
<Form.Item key="orgName" name="orgName">
|
||||||
formSelectField("district", "属地", CHONGQING_DISTRICTS, {
|
<ControlWrapper.Input label="机构名称" placeholder="关键字搜索" allowClear />
|
||||||
colProps: SEARCH_COL,
|
</Form.Item>,
|
||||||
placeholder: "请选择属地",
|
<Form.Item key="district" name="district">
|
||||||
}),
|
<ControlWrapper.Select label="属地" placeholder="请选择属地" allowClear>
|
||||||
formSelectField("state", "状态", ORG_ACCOUNT_STATE_OPTIONS, {
|
{CHONGQING_DISTRICTS.map((opt) => (
|
||||||
colProps: SEARCH_COL,
|
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
|
||||||
componentProps: { allowClear: false, showSearch: false },
|
))}
|
||||||
}),
|
</ControlWrapper.Select>
|
||||||
{
|
</Form.Item>,
|
||||||
name: "openTimeRange",
|
<Form.Item key="state" name="state">
|
||||||
label: "开户时间",
|
<ControlWrapper.Select label="状态" placeholder="请选择状态">
|
||||||
render: FORM_ITEM_RENDER_ENUM.DATE_RANGE,
|
{ORG_ACCOUNT_STATE_OPTIONS.map((opt) => (
|
||||||
colProps: { ...SEARCH_COL, lg: 8 },
|
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
|
||||||
},
|
))}
|
||||||
|
</ControlWrapper.Select>
|
||||||
|
</Form.Item>,
|
||||||
|
<Form.Item key="openTimeRange" name="openTimeRange">
|
||||||
|
<ControlWrapper.DatePicker.RangePicker label="开户时间" />
|
||||||
|
</Form.Item>,
|
||||||
]}
|
]}
|
||||||
onFinish={getData}
|
onReset={() => {
|
||||||
|
searchForm.resetFields();
|
||||||
|
getData();
|
||||||
|
}}
|
||||||
|
onFinish={() => getData()}
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
{...tableProps}
|
rowKey="id"
|
||||||
columns={[
|
columns={columns}
|
||||||
{ title: "机构名称", dataIndex: "orgName", ellipsis: true },
|
dataSource={dataSource}
|
||||||
{ title: "属地", dataIndex: "district", width: 100 },
|
scroll={{ y: props.scrollY }}
|
||||||
{
|
loading={loading}
|
||||||
title: "状态",
|
pagination={{
|
||||||
width: 80,
|
total,
|
||||||
render: (_, record) => (
|
showSizeChanger: true,
|
||||||
<Tag color={isOrgAccountEnabled(record) ? "success" : "error"}>
|
showQuickJumper: true,
|
||||||
{isOrgAccountEnabled(record) ? "启用" : "禁用"}
|
showTotal: (t) => `共 ${t} 条`,
|
||||||
</Tag>
|
current: 1,
|
||||||
),
|
pageSize: 10,
|
||||||
|
onChange: (page, pageSize) => {
|
||||||
|
getData();
|
||||||
},
|
},
|
||||||
{ title: "开户时间", dataIndex: "createTime", width: 110 },
|
}}
|
||||||
{
|
|
||||||
title: "操作",
|
|
||||||
width: 320,
|
|
||||||
fixed: "right",
|
|
||||||
render: (_, record) => (
|
|
||||||
<Space size={0} wrap>
|
|
||||||
<Button type="link" size="small" onClick={() => openView(record.id)}>查看</Button>
|
|
||||||
<Button type="link" size="small" onClick={() => openEdit(record.id)}>编辑</Button>
|
|
||||||
<Button type="link" size="small" onClick={() => onResetPassword(record)}>重置密码</Button>
|
|
||||||
<Button type="link" size="small" danger onClick={() => onDelete(record)}>删除</Button>
|
|
||||||
<Button type="link" size="small" onClick={() => onToggleStatus(record)}>
|
|
||||||
{isOrgAccountEnabled(record) ? "禁用" : "启用"}
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue