企业预案管理
parent
3af4efd132
commit
d1b1eee4dd
|
|
@ -16,34 +16,23 @@ function BasicInfo(props) {
|
||||||
|
|
||||||
const [enterprisePlanEventType, setEnterprisePlanEventType] = useState([]);
|
const [enterprisePlanEventType, setEnterprisePlanEventType] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
if (!props.planId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const { data } = await props["enterprisePlanBasicInfoInfo"]({ id: props.planId });
|
|
||||||
form.setFieldsValue({
|
|
||||||
...data,
|
|
||||||
eventType: data.eventType ? data.eventType.split(",") : [],
|
|
||||||
eventTypeName: data.eventTypeName ? data.eventTypeName.split(",") : [],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const getEnterprisePlanEventType = async () => {
|
const getEnterprisePlanEventType = async () => {
|
||||||
const dictionaryItems = await getDictionary({ dictValue: "enterprisePlanEventType" });
|
const dictionaryItems = await getDictionary({ dictValue: "enterprisePlanEventType" });
|
||||||
setEnterprisePlanEventType(dictionaryItems);
|
setEnterprisePlanEventType(dictionaryItems);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, [props.planId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getEnterprisePlanEventType();
|
getEnterprisePlanEventType();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(props.basicInfo);
|
||||||
|
}, [props.basicInfo]);
|
||||||
|
|
||||||
const onSubmit = async (values) => {
|
const onSubmit = async (values) => {
|
||||||
const { success, data } = await props[!props.planId ? "enterprisePlanBasicInfoAdd" : "enterprisePlanBasicInfoUpdate"]({
|
const { success, data } = await props[!props.planId ? "enterprisePlanBasicInfoAdd" : "enterprisePlanBasicInfoUpdate"]({
|
||||||
...values,
|
...values,
|
||||||
|
id: props.planId,
|
||||||
eventType: values.eventType.join(","),
|
eventType: values.eventType.join(","),
|
||||||
eventTypeName: values.eventTypeName.join(","),
|
eventTypeName: values.eventTypeName.join(","),
|
||||||
});
|
});
|
||||||
|
|
@ -51,9 +40,9 @@ function BasicInfo(props) {
|
||||||
message.success("保存成功");
|
message.success("保存成功");
|
||||||
props.setUrlState({
|
props.setUrlState({
|
||||||
planId: data?.id || props.planId,
|
planId: data?.id || props.planId,
|
||||||
planName: values.planName,
|
|
||||||
currentStep: "gradeResponse",
|
currentStep: "gradeResponse",
|
||||||
});
|
});
|
||||||
|
props.getBasicInfo();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { message } from "antd";
|
import { Button, message, Space } from "antd";
|
||||||
|
import { useEffect } from "react";
|
||||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
||||||
|
|
@ -7,6 +8,10 @@ import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
||||||
function PlanText(props) {
|
function PlanText(props) {
|
||||||
const [form] = FormBuilder.useForm();
|
const [form] = FormBuilder.useForm();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(props.basicInfo);
|
||||||
|
}, [props.basicInfo]);
|
||||||
|
|
||||||
const onSubmit = async (values) => {
|
const onSubmit = async (values) => {
|
||||||
const { success } = await props["enterprisePlanBasicInfoUpdate"]({
|
const { success } = await props["enterprisePlanBasicInfoUpdate"]({
|
||||||
...values,
|
...values,
|
||||||
|
|
@ -15,17 +20,25 @@ function PlanText(props) {
|
||||||
if (success) {
|
if (success) {
|
||||||
message.success("保存成功");
|
message.success("保存成功");
|
||||||
props.setUrlState({ currentStep: "planAttachments" });
|
props.setUrlState({ currentStep: "planAttachments" });
|
||||||
|
props.getBasicInfo();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormBuilder
|
<FormBuilder
|
||||||
loading={props.enterprisePlan.enterprisePlanBasicInfoLoading}
|
loading={props.enterprisePlan.enterprisePlanBasicInfoLoading}
|
||||||
values={{
|
|
||||||
planName: props.planName,
|
|
||||||
}}
|
|
||||||
span={24}
|
span={24}
|
||||||
submitButtonText="保存并下一步"
|
customActionButtons={(
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => {
|
||||||
|
props.setUrlState({ currentStep: "planInstructions" });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
上一步
|
||||||
|
</Button>
|
||||||
|
<Button type="primary" onClick={form.submit}>保存并下一步</Button>
|
||||||
|
</Space>
|
||||||
|
)}
|
||||||
options={[
|
options={[
|
||||||
{ name: "planName", label: "预案名称", componentProps: { disabled: true } },
|
{ name: "planName", label: "预案名称", componentProps: { disabled: true } },
|
||||||
{ name: "planText", label: "预案文本", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, required: false },
|
{ name: "planText", label: "预案文本", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, required: false },
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ function Add(props) {
|
||||||
{
|
{
|
||||||
currentStep: "basicInfo",
|
currentStep: "basicInfo",
|
||||||
planId: query.id,
|
planId: query.id,
|
||||||
planName: query.planName,
|
|
||||||
},
|
},
|
||||||
{ navigateMode: "replace" },
|
{ navigateMode: "replace" },
|
||||||
);
|
);
|
||||||
|
|
@ -30,6 +29,23 @@ function Add(props) {
|
||||||
const [responseLevelRefresh, setResponseLevelRefresh] = useState(true);
|
const [responseLevelRefresh, setResponseLevelRefresh] = useState(true);
|
||||||
const [executingAgencyRefresh, setExecutingAgencyRefresh] = useState(true);
|
const [executingAgencyRefresh, setExecutingAgencyRefresh] = useState(true);
|
||||||
const [reviewPersonModalVisible, setReviewPersonModalVisible] = useState(false);
|
const [reviewPersonModalVisible, setReviewPersonModalVisible] = useState(false);
|
||||||
|
const [basicInfo, setBasicInfo] = useState({});
|
||||||
|
|
||||||
|
const getBasicInfo = async () => {
|
||||||
|
if (!urlState.planId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const { data } = await props["enterprisePlanBasicInfoInfo"]({ id: urlState.planId });
|
||||||
|
setBasicInfo({
|
||||||
|
...data,
|
||||||
|
eventType: data.eventType ? data.eventType.split(",") : [],
|
||||||
|
eventTypeName: data.eventTypeName ? data.eventTypeName.split(",") : [],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getBasicInfo();
|
||||||
|
}, [urlState.planId]);
|
||||||
|
|
||||||
const subordinateTabDisabled = !urlState.planId;
|
const subordinateTabDisabled = !urlState.planId;
|
||||||
const isShowFooter = ["basicInfo", "planText"].includes(urlState.currentStep);
|
const isShowFooter = ["basicInfo", "planText"].includes(urlState.currentStep);
|
||||||
|
|
@ -92,6 +108,8 @@ function Add(props) {
|
||||||
<BasicInfo
|
<BasicInfo
|
||||||
planId={urlState.planId}
|
planId={urlState.planId}
|
||||||
setUrlState={setUrlState}
|
setUrlState={setUrlState}
|
||||||
|
basicInfo={basicInfo}
|
||||||
|
getBasicInfo={getBasicInfo}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
@ -143,8 +161,9 @@ function Add(props) {
|
||||||
children: (
|
children: (
|
||||||
<PlanText
|
<PlanText
|
||||||
planId={urlState.planId}
|
planId={urlState.planId}
|
||||||
planName={urlState.planName}
|
|
||||||
setUrlState={setUrlState}
|
setUrlState={setUrlState}
|
||||||
|
basicInfo={basicInfo}
|
||||||
|
getBasicInfo={getBasicInfo}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
disabled: subordinateTabDisabled,
|
disabled: subordinateTabDisabled,
|
||||||
|
|
@ -238,4 +257,4 @@ const ReviewPersonModalComponent = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReviewPersonModal = Connect([NS_ENTERPRISE_PLAN], true)(ReviewPersonModalComponent);
|
const ReviewPersonModal = Connect([NS_ENTERPRISE_PLAN], true)(ReviewPersonModalComponent);
|
||||||
export default Add;
|
export default Connect([NS_ENTERPRISE_PLAN], true)(Add);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ function List(props) {
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.history.push(`./view?id=${record.id}&planName=${record.planName}`);
|
props.history.push(`./view?id=${record.id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
|
|
@ -81,7 +81,7 @@ function List(props) {
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.history.push(`./add?id=${record.id}&planName=${record.planName}`);
|
props.history.push(`./add?id=${record.id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,7 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
|
||||||
import { Descriptions } from "antd";
|
import { Descriptions } from "antd";
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
|
||||||
|
|
||||||
function BasicInfo(props) {
|
function BasicInfo(props) {
|
||||||
const [info, setInfo] = useState({});
|
const info = props.info;
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
const { data } = await props["enterprisePlanBasicInfoInfo"]({ id: props.planId });
|
|
||||||
setInfo(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, [props.planId]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -37,4 +25,4 @@ function BasicInfo(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Connect([NS_ENTERPRISE_PLAN], true)(BasicInfo);
|
export default BasicInfo;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
|
||||||
import { Descriptions } from "antd";
|
import { Descriptions } from "antd";
|
||||||
import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
|
||||||
|
|
||||||
function BasicInfo(props) {
|
function PlanText(props) {
|
||||||
|
const info = props.info;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Descriptions
|
<Descriptions
|
||||||
|
|
@ -10,12 +10,12 @@ function BasicInfo(props) {
|
||||||
column={1}
|
column={1}
|
||||||
styles={{ label: { width: 200 } }}
|
styles={{ label: { width: 200 } }}
|
||||||
items={[
|
items={[
|
||||||
{ label: "预案名称", children: props.planName },
|
{ label: "预案名称", children: info.planName },
|
||||||
{ label: "预案文本", children: props.planText },
|
{ label: "预案文本", children: info.planText },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Connect([NS_ENTERPRISE_PLAN], true)(BasicInfo);
|
export default PlanText;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
import useUrlState from "@ahooksjs/use-url-state";
|
import useUrlState from "@ahooksjs/use-url-state";
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { Tabs } from "antd";
|
import { Tabs } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import Page from "zy-react-library/components/Page";
|
import Page from "zy-react-library/components/Page";
|
||||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import { NS_ENTERPRISE_PLAN } from "~/enumerate/namespace";
|
||||||
import BasicInfo from "./components/BasicInfo";
|
import BasicInfo from "./components/BasicInfo";
|
||||||
import GradeResponse from "./components/GradeResponse";
|
import GradeResponse from "./components/GradeResponse";
|
||||||
import OrganizationStructure from "./components/OrganizationStructure";
|
import OrganizationStructure from "./components/OrganizationStructure";
|
||||||
|
|
@ -10,17 +13,26 @@ import PlanInstructions from "./components/PlanInstructions";
|
||||||
import PlanResources from "./components/PlanResources";
|
import PlanResources from "./components/PlanResources";
|
||||||
import PlanText from "./components/PlanText";
|
import PlanText from "./components/PlanText";
|
||||||
|
|
||||||
function View() {
|
function View(props) {
|
||||||
const query = useGetUrlQuery();
|
const query = useGetUrlQuery();
|
||||||
const [urlState, setUrlState] = useUrlState(
|
const [urlState, setUrlState] = useUrlState(
|
||||||
{
|
{
|
||||||
currentStep: "basicInfo",
|
currentStep: "basicInfo",
|
||||||
planId: query.id,
|
|
||||||
planName: query.planName,
|
|
||||||
},
|
},
|
||||||
{ navigateMode: "replace" },
|
{ navigateMode: "replace" },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [basicInfo, setBasicInfo] = useState({});
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const { data } = await props["enterprisePlanBasicInfoInfo"]({ id: query.id });
|
||||||
|
setBasicInfo(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page headerTitle="查看">
|
<Page headerTitle="查看">
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|
@ -30,7 +42,7 @@ function View() {
|
||||||
{
|
{
|
||||||
key: "basicInfo",
|
key: "basicInfo",
|
||||||
label: "基本信息",
|
label: "基本信息",
|
||||||
children: (<BasicInfo planId={query.id} />),
|
children: (<BasicInfo info={basicInfo} />),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "gradeResponse",
|
key: "gradeResponse",
|
||||||
|
|
@ -55,7 +67,7 @@ function View() {
|
||||||
{
|
{
|
||||||
key: "planText",
|
key: "planText",
|
||||||
label: "预案文案",
|
label: "预案文案",
|
||||||
children: (<PlanText planId={query.id} planName={urlState.planName} />),
|
children: (<PlanText info={basicInfo} />),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "planAttachments",
|
key: "planAttachments",
|
||||||
|
|
@ -68,4 +80,4 @@ function View() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default View;
|
export default Connect([NS_ENTERPRISE_PLAN], true)(View);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue