style(confirm-user): 格式化代码样式并优化表单组件配置

- 统一导入语句格式,调整空格和括号位置
- 优化表格列配置的对齐方式和间距
- 调整按钮图标组件的标签闭合格式
- 修复删除按钮的条件渲染换行格式
- 更新表单字段的标签列宽度配置
- 添加人员选择组件的额外参数支持
- 优化确认范围相关字段的标签显示设置
master
fangjiakai 2026-01-28 09:03:12 +08:00
parent b3189c154f
commit 9cfa1c171e
1 changed files with 28 additions and 26 deletions

View File

@ -1,7 +1,7 @@
import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; import {Permission} from "@cqsjjb/jjb-common-decorator/permission";
import { Connect } from "@cqsjjb/jjb-dva-runtime"; import {Connect} from "@cqsjjb/jjb-dva-runtime";
import { Button, Form, message, Modal, Space } from "antd"; import {Button, Form, message, Modal, Space} from "antd";
import { useEffect, useState } from "react"; import {useEffect, useState} from "react";
import FormBuilder from "zy-react-library/components/FormBuilder"; import FormBuilder from "zy-react-library/components/FormBuilder";
import AddIcon from "zy-react-library/components/Icon/AddIcon"; import AddIcon from "zy-react-library/components/Icon/AddIcon";
import Page from "zy-react-library/components/Page"; import Page from "zy-react-library/components/Page";
@ -10,13 +10,13 @@ import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj";
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
import Table from "zy-react-library/components/Table"; import Table from "zy-react-library/components/Table";
import useTable from "zy-react-library/hooks/useTable"; import useTable from "zy-react-library/hooks/useTable";
import { NS_CONFIRM_USER } from "~/enumerate/namespace"; import {NS_CONFIRM_USER} from "~/enumerate/namespace";
function HiddenConfirmUser(props) { function HiddenConfirmUser(props) {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [addModalOpen, setAddModalOpen] = useState(false); const [addModalOpen, setAddModalOpen] = useState(false);
const [currentId, setCurrentId] = useState(""); const [currentId, setCurrentId] = useState("");
const { tableProps, getData } = useTable(props["confirmUserList"], { const {tableProps, getData} = useTable(props["confirmUserList"], {
form, form,
transform: formData => ({ transform: formData => ({
hiddenFindTime: formData.hiddenFindTime?.[0], hiddenFindTime: formData.hiddenFindTime?.[0],
@ -29,7 +29,7 @@ function HiddenConfirmUser(props) {
title: "删除确认", title: "删除确认",
content: "确定要删除吗?", content: "确定要删除吗?",
onOk: async () => { onOk: async () => {
const { success } = await props["confirmUserDelete"]({ id }); const {success} = await props["confirmUserDelete"]({id});
if (success) { if (success) {
message.success("删除成功"); message.success("删除成功");
getData(); getData();
@ -41,10 +41,10 @@ function HiddenConfirmUser(props) {
return ( return (
<Page isShowAllAction={false}> <Page isShowAllAction={false}>
<Search <Search
labelCol={{ span: 4 }} labelCol={{span: 4}}
options={[ options={[
{ name: "likeName", label: "姓名" }, {name: "likeName", label: "姓名"},
{ name: "eqDeptId", label: "部门", render: <DepartmentSelectTree /> }, {name: "eqDeptId", label: "部门", render: <DepartmentSelectTree/>},
]} ]}
form={form} form={form}
onFinish={getData} onFinish={getData}
@ -55,7 +55,7 @@ function HiddenConfirmUser(props) {
{props.permission("fgs-yhqrr-xz") && ( {props.permission("fgs-yhqrr-xz") && (
<Button <Button
type="primary" type="primary"
icon={<AddIcon />} icon={<AddIcon/>}
onClick={() => { onClick={() => {
setAddModalOpen(true); setAddModalOpen(true);
}} }}
@ -66,10 +66,10 @@ function HiddenConfirmUser(props) {
</> </>
)} )}
columns={[ columns={[
{ title: "部门", dataIndex: "deptName" }, {title: "部门", dataIndex: "deptName"},
{ title: "岗位", dataIndex: "postName" }, {title: "岗位", dataIndex: "postName"},
{ title: "姓名", dataIndex: "name" }, {title: "姓名", dataIndex: "name"},
{ title: "手机号", dataIndex: "userName" }, {title: "手机号", dataIndex: "userName"},
{ {
title: "操作", title: "操作",
width: 120, width: 120,
@ -87,7 +87,8 @@ function HiddenConfirmUser(props) {
编辑 编辑
</Button> </Button>
)} )}
{props.permission("fgs-yhqrr-sc") && <Button type="link" danger onClick={() => onDelete(record.id)}>删除</Button>} {props.permission("fgs-yhqrr-sc") &&
<Button type="link" danger onClick={() => onDelete(record.id)}>删除</Button>}
</Space> </Space>
), ),
}, },
@ -112,7 +113,7 @@ const AddModalComponent = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const deptId = Form.useWatch("deptId", form); const deptId = Form.useWatch("deptId", form);
const getData = async () => { const getData = async () => {
const { data } = await props["confirmUserView"]({ id: props.id }); const {data} = await props["confirmUserView"]({id: props.id});
form.setFieldsValue({ form.setFieldsValue({
...data, ...data,
confirmRange: data.confirmRange.split(","), confirmRange: data.confirmRange.split(","),
@ -123,7 +124,7 @@ const AddModalComponent = (props) => {
props.id && getData(); props.id && getData();
}, []); }, []);
const onSubmit = async (values) => { const onSubmit = async (values) => {
const { success } = await props[!props.id ? "confirmUserAdd" : "confirmUserUpdate"]({ const {success} = await props[!props.id ? "confirmUserAdd" : "confirmUserUpdate"]({
...values, ...values,
confirmRange: values.confirmRange.join(","), confirmRange: values.confirmRange.join(","),
confirmRangeName: values.confirmRangeName.join(","), confirmRangeName: values.confirmRangeName.join(","),
@ -150,7 +151,7 @@ const AddModalComponent = (props) => {
loading={props.confirmUser.confirmUserLoading} loading={props.confirmUser.confirmUserLoading}
form={form} form={form}
span={24} span={24}
labelCol={{ span: 12 }} labelCol={{span: 12}}
showActionButtons={false} showActionButtons={false}
onFinish={onSubmit} onFinish={onSubmit}
options={[ options={[
@ -170,14 +171,15 @@ const AddModalComponent = (props) => {
/> />
), ),
}, },
{ name: "deptName", label: "部门名称", onlyForLabel: true }, {name: "deptName", label: "部门名称", onlyForLabel: true},
{ {
name: "userId", name: "userId",
label: "隐患确认人", label: "隐患确认人",
render: ( render: (
<PersonnelSelect <PersonnelSelect
disabled={props.id} disabled={props.id}
params={{ departmentId: deptId }} params={{departmentId: deptId}}
extraParams={{ noMain: 1 }}
onGetOption={(option) => { onGetOption={(option) => {
form.setFieldValue("name", option.name); form.setFieldValue("name", option.name);
form.setFieldValue("userName", option.username); form.setFieldValue("userName", option.username);
@ -187,10 +189,10 @@ const AddModalComponent = (props) => {
/> />
), ),
}, },
{ name: "name", label: "确认人", onlyForLabel: true }, {name: "name", label: "确认人", onlyForLabel: true},
{ name: "userName", label: "确认人", onlyForLabel: true }, {name: "userName", label: "确认人", onlyForLabel: true},
{ name: "postName", label: "确认人", onlyForLabel: true }, {name: "postName", label: "确认人", onlyForLabel: true},
{ name: "postId", label: "确认人", onlyForLabel: true }, {name: "postId", label: "确认人", onlyForLabel: true},
{ {
name: "confirmRange", name: "confirmRange",
label: "确认范围(部门)", label: "确认范围(部门)",
@ -204,7 +206,7 @@ const AddModalComponent = (props) => {
/> />
), ),
}, },
{ name: "confirmRangeName", label: "确认范围(部门)名称", onlyForLabel: true }, {name: "confirmRangeName", label: "确认范围(部门)名称", onlyForLabel: true},
]} ]}
/> />
</Modal> </Modal>