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