bug修复
parent
e91eabcd55
commit
71971d3174
|
|
@ -32,7 +32,7 @@
|
|||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-to-print": "^3.2.0",
|
||||
"zy-react-library": "^1.1.15"
|
||||
"zy-react-library": "^1.1.23"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^5.4.1",
|
||||
|
|
|
|||
|
|
@ -45,35 +45,6 @@ function HiddenAddModal(props) {
|
|||
onFinish={onSubmit}
|
||||
options={[
|
||||
{ name: "hiddenDesc", label: "隐患描述", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 },
|
||||
{
|
||||
name: "hiddenPart",
|
||||
customizeRender: true,
|
||||
render: (
|
||||
<Form.Item label="隐患部位" required labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
||||
<div style={{ display: "flex", gap: 10 }}>
|
||||
<Form.Item name="hiddenPart" noStyle rules={[{ required: true, message: "请选择隐患部位" }]}>
|
||||
{
|
||||
hiddenPartType === "select"
|
||||
? <HiddenPartSelectTree />
|
||||
: <Input placeholder="请输入隐患部位" />
|
||||
}
|
||||
</Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
if (hiddenPartType === "select")
|
||||
setHiddenPartType("input");
|
||||
if (hiddenPartType === "input")
|
||||
setHiddenPartType("select");
|
||||
form.setFieldValue("hiddenPart", "");
|
||||
}}
|
||||
>
|
||||
{hiddenPartType === "select" ? "输入" : "选择"}
|
||||
</Button>
|
||||
</div>
|
||||
</Form.Item>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "hiddenLevel",
|
||||
label: "隐患级别",
|
||||
|
|
@ -105,8 +76,37 @@ function HiddenAddModal(props) {
|
|||
{ name: "hiddenTypeName", label: "隐患类型名称", onlyForLabel: true },
|
||||
{ name: "hiddenType2", label: "隐患类型名称", onlyForLabel: true },
|
||||
{ name: "hiddenType2Name", label: "隐患类型名称", onlyForLabel: true },
|
||||
{ name: "map", customizeRender: true, render: <Map required={false} />, span: 24 },
|
||||
{
|
||||
name: "hiddenPart",
|
||||
customizeRender: true,
|
||||
render: (
|
||||
<Form.Item label="隐患部位" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
||||
<div style={{ display: "flex", gap: 10 }}>
|
||||
<Form.Item name="hiddenPart" noStyle>
|
||||
{
|
||||
hiddenPartType === "select"
|
||||
? <HiddenPartSelectTree />
|
||||
: <Input placeholder="请输入隐患部位" />
|
||||
}
|
||||
</Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
if (hiddenPartType === "select")
|
||||
setHiddenPartType("input");
|
||||
if (hiddenPartType === "input")
|
||||
setHiddenPartType("select");
|
||||
form.setFieldValue("hiddenPart", "");
|
||||
}}
|
||||
>
|
||||
{hiddenPartType === "select" ? "输入" : "选择"}
|
||||
</Button>
|
||||
</div>
|
||||
</Form.Item>
|
||||
),
|
||||
},
|
||||
{ name: "positionDesc", label: "隐患位置描述", required: false, span: 24 },
|
||||
{ name: "map", customizeRender: true, render: <Map required={false} />, span: 24 },
|
||||
{
|
||||
name: "hiddenImageFiles",
|
||||
label: "隐患图片",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import {Permission} from "@cqsjjb/jjb-common-decorator/permission";
|
||||
import {Connect} from "@cqsjjb/jjb-dva-runtime";
|
||||
import {Button, Form, message, Modal, Space} from "antd";
|
||||
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
|
||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import { Button, Form, message, Modal, Space } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import {useEffect, useState} from "react";
|
||||
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,25 +10,29 @@ import Search from "zy-react-library/components/Search";
|
|||
import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj";
|
||||
import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import {FORM_ITEM_RENDER_ENUM} from "zy-react-library/enum/formItemRender";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||
import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import {getLabelName, validatorEndTime} from "zy-react-library/utils";
|
||||
import {NS_PLAN} from "~/enumerate/namespace";
|
||||
import { getLabelName, validatorEndTime } from "zy-react-library/utils";
|
||||
import { NS_PLAN } from "~/enumerate/namespace";
|
||||
import ViewInfo from "~/pages/Container/BranchCompany/Plan/ViewInfo";
|
||||
|
||||
function List(props) {
|
||||
const query = useGetUrlQuery();
|
||||
const [form] = Form.useForm();
|
||||
const defaultParams = {};
|
||||
if (query.corpId) defaultParams.corpId = query.corpId;
|
||||
if (query.startTime) defaultParams.startTime = query.startTime;
|
||||
if (query.endTime) defaultParams.endTime = query.endTime;
|
||||
if (query.completedOnly) defaultParams.completedOnly = query.completedOnly;
|
||||
const {tableProps, getData} = useTable(props["planList"], {
|
||||
if (query.corpId)
|
||||
defaultParams.corpId = query.corpId;
|
||||
if (query.startTime)
|
||||
defaultParams.startTime = query.startTime;
|
||||
if (query.endTime)
|
||||
defaultParams.endTime = query.endTime;
|
||||
if (query.completedOnly)
|
||||
defaultParams.completedOnly = query.completedOnly;
|
||||
const { tableProps, getData } = useTable(props["planList"], {
|
||||
form,
|
||||
params: {...defaultParams},
|
||||
params: { ...defaultParams },
|
||||
});
|
||||
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
|
|
@ -40,7 +44,7 @@ function List(props) {
|
|||
title: "删除确认",
|
||||
content: "确定要删除吗?",
|
||||
onOk: async () => {
|
||||
const {success} = await props["planDelete"]({id});
|
||||
const { success } = await props["planDelete"]({ id });
|
||||
if (success) {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
|
|
@ -56,11 +60,11 @@ function List(props) {
|
|||
{
|
||||
name: "planType",
|
||||
label: "计划类型",
|
||||
render: (<DictionarySelectTree dictValue="inspectionType" onlyLastLevel/>),
|
||||
render: (<DictionarySelectTree dictValue="inspectionType" onlyLastLevel />),
|
||||
},
|
||||
{name: "planName", label: "计划名称"},
|
||||
{name: "startTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE},
|
||||
{name: "endTime", label: "计划结束时间", render: FORM_ITEM_RENDER_ENUM.DATE},
|
||||
{ name: "planName", label: "计划名称" },
|
||||
{ name: "startTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||
{ name: "endTime", label: "计划结束时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||
]}
|
||||
form={form}
|
||||
onFinish={getData}
|
||||
|
|
@ -71,7 +75,7 @@ function List(props) {
|
|||
{(props.permission(props.addPermissionKey || "inspection-qy-plan-list-add") && query.entrance !== "statistics") && (
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon/>}
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
setCurrentId("");
|
||||
|
|
@ -83,10 +87,10 @@ function List(props) {
|
|||
</>
|
||||
)}
|
||||
columns={[
|
||||
{title: "计划名称", dataIndex: "planName"},
|
||||
{title: "计划类型", dataIndex: "planTypeName"},
|
||||
{title: "计划开始时间", dataIndex: "planStartTime"},
|
||||
{title: "计划结束时间", dataIndex: "planEndTime"},
|
||||
{ title: "计划名称", dataIndex: "planName" },
|
||||
{ title: "计划类型", dataIndex: "planTypeName" },
|
||||
{ title: "计划开始时间", dataIndex: "planStartTime" },
|
||||
{ title: "计划结束时间", dataIndex: "planEndTime" },
|
||||
{
|
||||
title: "计划执行总次数",
|
||||
dataIndex: "planExecuteTotal",
|
||||
|
|
@ -119,19 +123,22 @@ function List(props) {
|
|||
title: "计划状态",
|
||||
dataIndex: "status",
|
||||
render: (_, record) => {
|
||||
const {planExecuteTotal, userExecuteNum, planStartTime, planEndTime} = record;
|
||||
const { planExecuteTotal, userExecuteNum, planStartTime, planEndTime } = record;
|
||||
const currentTime = dayjs();
|
||||
|
||||
let statusText = "";
|
||||
|
||||
if (planExecuteTotal === userExecuteNum && planExecuteTotal > 0) {
|
||||
statusText = "已完成";
|
||||
} else if (currentTime.isBefore(planStartTime, "day")) {
|
||||
}
|
||||
else if (currentTime.isBefore(planStartTime, "day")) {
|
||||
statusText = "未开始";
|
||||
} else if ((currentTime.isAfter(planStartTime, "day") || currentTime.isSame(planStartTime, "day"))
|
||||
}
|
||||
else if ((currentTime.isAfter(planStartTime, "day") || currentTime.isSame(planStartTime, "day"))
|
||||
&& (currentTime.isBefore(planEndTime, "day") || currentTime.isSame(planEndTime, "day"))) {
|
||||
statusText = "执行中";
|
||||
} else if (currentTime.isAfter(planEndTime, "day")) {
|
||||
}
|
||||
else if (currentTime.isAfter(planEndTime, "day")) {
|
||||
statusText = "已过期";
|
||||
}
|
||||
|
||||
|
|
@ -220,10 +227,10 @@ const AddModalComponent = (props) => {
|
|||
const [form] = Form.useForm();
|
||||
const planStartTime = Form.useWatch("planStartTime", form);
|
||||
const corpId = Form.useWatch("corpId", form);
|
||||
const {getUserInfo} = useGetUserInfo();
|
||||
const { getUserInfo } = useGetUserInfo();
|
||||
|
||||
const getCorpInfoList = async () => {
|
||||
const {data} = await props["corpInfoList"]({pageSize: 9999, pageIndex: 1, enterpriseType: 2});
|
||||
const { data } = await props["corpInfoList"]({ pageSize: 9999, pageIndex: 1, enterpriseType: 2 });
|
||||
setCorpInfoList(data);
|
||||
};
|
||||
|
||||
|
|
@ -233,7 +240,7 @@ const AddModalComponent = (props) => {
|
|||
setUserInfo(userInfo);
|
||||
}
|
||||
if (props.id) {
|
||||
const {data} = await props["planView"]({id: props.id});
|
||||
const { data } = await props["planView"]({ id: props.id });
|
||||
form.setFieldsValue({
|
||||
...data,
|
||||
userId: data.userId.split(","),
|
||||
|
|
@ -252,7 +259,7 @@ const AddModalComponent = (props) => {
|
|||
}, []);
|
||||
|
||||
const onSubmit = async (values) => {
|
||||
const {success} = await props[!props.id ? "planAdd" : "planUpdate"]({
|
||||
const { success } = await props[!props.id ? "planAdd" : "planUpdate"]({
|
||||
...values,
|
||||
id: props.id,
|
||||
userId: values.userId.join(","),
|
||||
|
|
@ -283,11 +290,11 @@ const AddModalComponent = (props) => {
|
|||
loading={props.plan.planLoading}
|
||||
form={form}
|
||||
showActionButtons={false}
|
||||
labelCol={{span: 10}}
|
||||
labelCol={{ span: 10 }}
|
||||
span={24}
|
||||
onFinish={onSubmit}
|
||||
options={[
|
||||
{name: "planName", label: "计划名称"},
|
||||
{ name: "planName", label: "计划名称" },
|
||||
{
|
||||
name: "planType",
|
||||
label: "计划类型",
|
||||
|
|
@ -299,8 +306,8 @@ const AddModalComponent = (props) => {
|
|||
/>
|
||||
),
|
||||
},
|
||||
{name: "planTypeName", label: "计划类型", onlyForLabel: true},
|
||||
{name: "planStartTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE},
|
||||
{ name: "planTypeName", label: "计划类型", onlyForLabel: true },
|
||||
{ name: "planStartTime", label: "计划开始时间", render: FORM_ITEM_RENDER_ENUM.DATE },
|
||||
{
|
||||
name: "planEndTime",
|
||||
label: "计划结束时间",
|
||||
|
|
@ -312,7 +319,7 @@ const AddModalComponent = (props) => {
|
|||
label: "计划执行单位",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: corpInfoList,
|
||||
itemsField: {labelKey: "corpName", valueKey: "id"},
|
||||
itemsField: { labelKey: "corpName", valueKey: "id" },
|
||||
hidden: !(props.supervision === "1"),
|
||||
componentProps: {
|
||||
onChange: (event) => {
|
||||
|
|
@ -320,7 +327,7 @@ const AddModalComponent = (props) => {
|
|||
list: corpInfoList,
|
||||
status: event,
|
||||
idKey: "id",
|
||||
nameKey: "corpName"
|
||||
nameKey: "corpName",
|
||||
}));
|
||||
form.setFieldValue("userId", []);
|
||||
form.setFieldValue("userName", []);
|
||||
|
|
@ -331,18 +338,22 @@ const AddModalComponent = (props) => {
|
|||
},
|
||||
},
|
||||
},
|
||||
{name: "corpName", label: "计划执行单位名称", onlyForLabel: true},
|
||||
{ name: "corpName", label: "计划执行单位名称", onlyForLabel: true },
|
||||
{
|
||||
name: "userId",
|
||||
label: "计划执行人员",
|
||||
render: (() => {
|
||||
const commonProps = {
|
||||
mode: "multiple",
|
||||
labelRender: item => `${item.name}(${[item.departmentName, item.postName].filter(Boolean).join("-")})`,
|
||||
onGetLabel: (label) => {
|
||||
render: (
|
||||
<PersonnelSelect
|
||||
params={{ corpinfoId: props.supervision === "1" ? corpId : userInfo.corpinfoId }}
|
||||
isNeedCorpInfoId={true}
|
||||
isNeedDepartmentId={false}
|
||||
extraParams={{ noMain: 1 }}
|
||||
mode="multiple"
|
||||
labelRender={item => `${item.name}(${[item.departmentName, item.postName].filter(Boolean).join("-")})`}
|
||||
onGetLabel={(label) => {
|
||||
form.setFieldValue("userName", label);
|
||||
},
|
||||
onGetOption: (option) => {
|
||||
}}
|
||||
onGetOption={(option) => {
|
||||
const departmentId = [];
|
||||
const departmentName = [];
|
||||
const postId = [];
|
||||
|
|
@ -357,34 +368,17 @@ const AddModalComponent = (props) => {
|
|||
form.setFieldValue("departmentName", departmentName);
|
||||
form.setFieldValue("postId", postId);
|
||||
form.setFieldValue("postName", postName);
|
||||
},
|
||||
};
|
||||
return props.supervision === "1"
|
||||
? (
|
||||
<PersonnelSelect
|
||||
params={{corpinfoId: corpId}}
|
||||
isNeedCorpInfoId={true}
|
||||
isNeedDepartmentId={false}
|
||||
extraParams={{noMain: 1}}
|
||||
{...commonProps}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<PersonnelSelect
|
||||
params={{departmentId: userInfo.departmentId}}
|
||||
extraParams={{noMain: 1}}
|
||||
{...commonProps}
|
||||
/>
|
||||
);
|
||||
})(),
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{name: "userName", label: "计划执行人员名称", onlyForLabel: true},
|
||||
{name: "departmentId", label: "计划执行人员部门", onlyForLabel: true},
|
||||
{name: "departmentName", label: "计划执行人员部门名称", onlyForLabel: true},
|
||||
{name: "postId", label: "计划执行人员岗位", onlyForLabel: true},
|
||||
{name: "postName", label: "计划执行人员岗位名称", onlyForLabel: true},
|
||||
{name: "planExecuteNum", label: "计划执行次数", render: FORM_ITEM_RENDER_ENUM.NUMBER},
|
||||
{name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA},
|
||||
{ name: "userName", label: "计划执行人员名称", onlyForLabel: true },
|
||||
{ name: "departmentId", label: "计划执行人员部门", onlyForLabel: true },
|
||||
{ name: "departmentName", label: "计划执行人员部门名称", onlyForLabel: true },
|
||||
{ name: "postId", label: "计划执行人员岗位", onlyForLabel: true },
|
||||
{ name: "postName", label: "计划执行人员岗位名称", onlyForLabel: true },
|
||||
{ name: "planExecuteNum", label: "计划执行次数", render: FORM_ITEM_RENDER_ENUM.NUMBER },
|
||||
{ name: "remarks", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
]}
|
||||
/>
|
||||
</Modal>
|
||||
|
|
@ -403,7 +397,7 @@ const ViewModal = (props) => {
|
|||
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||
]}
|
||||
>
|
||||
<ViewInfo id={props.id} supervision={props.supervision}/>
|
||||
<ViewInfo id={props.id} supervision={props.supervision} />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue