dev_1.2
tangjie 2026-07-22 11:26:12 +08:00
parent 27ce2feea5
commit 748b5ac34e
2 changed files with 61 additions and 24 deletions

View File

@ -134,14 +134,17 @@ const CustomerManage = (props) => {
const handleCreateSubmit = () => { const handleCreateSubmit = () => {
modalForm.validateFields().then(async (values) => { modalForm.validateFields().then(async (values) => {
let res;
if (editingId) { if (editingId) {
await props.customerModify({ ...values, id: editingId }); res = await props.customerModify({ ...values, id: editingId });
} else { } else {
await props.customerSave(values); res = await props.customerSave(values);
} }
if (res.success) {
message.success(editingId ? "修改成功" : "创建成功"); message.success(editingId ? "修改成功" : "创建成功");
setModalOpen(false); setModalOpen(false);
getData(); getData();
}
}); });
}; };
@ -184,7 +187,7 @@ const CustomerManage = (props) => {
}, },
{ {
title: "操作", title: "操作",
width: 260, width: 220,
fixed: "right", fixed: "right",
render: (_, record) => ( render: (_, record) => (
<Space> <Space>
@ -335,9 +338,13 @@ const CustomerManage = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="industryCode" label="所属行业" <Form.Item
name="industryCode"
label="所属行业"
getValueFromEvent={(value) => value.join(",")} getValueFromEvent={(value) => value.join(",")}
getValueProps={(value) => ({ value: value ? value.split(",").filter(Boolean) : [] })} getValueProps={(value) => ({
value: value ? value.split(",").filter(Boolean) : [],
})}
> >
<Select mode="multiple" placeholder="请选择" allowClear> <Select mode="multiple" placeholder="请选择" allowClear>
{QUALIFICATION_INDUSTRY_OPTIONS.map((opt) => ( {QUALIFICATION_INDUSTRY_OPTIONS.map((opt) => (

View File

@ -13,10 +13,11 @@ import {
Tag, Tag,
} from "antd"; } from "antd";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {tools} from "@cqsjjb/jjb-common-lib"; import { tools } from "@cqsjjb/jjb-common-lib";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions";
import BaiduMapPicker from "~/components/BaiduMapPicker"; import BaiduMapPicker from "~/components/BaiduMapPicker";
import { district } from "~/enumerate/constant"; import { district } from "~/enumerate/constant";
import { phoneRule } from "~/utils/validators"; import { phoneRule } from "~/utils/validators";
@ -39,7 +40,11 @@ const EvalProjectCreate = (props) => {
const projectId = router.query?.id; const projectId = router.query?.id;
const isView = projectId; const isView = projectId;
const { evalProjectSaveLoading, evalProjectDetailLoading, customerPage: customerList } = props.safetyEvalBusiness; const {
evalProjectSaveLoading,
evalProjectDetailLoading,
customerPage: customerList,
} = props.safetyEvalBusiness;
useEffect(() => { useEffect(() => {
props.customerPage({ current: 1, size: 999 }); props.customerPage({ current: 1, size: 999 });
@ -55,12 +60,18 @@ const EvalProjectCreate = (props) => {
const data = res.data; const data = res.data;
form.setFieldsValue({ form.setFieldsValue({
...data, ...data,
planStartDate: data.planStartDate ? dayjs(data.planStartDate) : undefined, planStartDate: data.planStartDate
? dayjs(data.planStartDate)
: undefined,
planEndDate: data.planEndDate ? dayjs(data.planEndDate) : undefined, planEndDate: data.planEndDate ? dayjs(data.planEndDate) : undefined,
}); });
if (data.participants?.length) { if (data.participants?.length) {
setSelectedParticipants( setSelectedParticipants(
data.participants.map((p) => ({ id: p.id, userName: p.name, ...p })), data.participants.map((p) => ({
id: p.id,
userName: p.name,
...p,
})),
); );
} }
} }
@ -115,7 +126,8 @@ const EvalProjectCreate = (props) => {
history={props.history} history={props.history}
previous previous
footer={ footer={
!isView && <Flex gap={24}> !isView && (
<Flex gap={24}>
<Button onClick={() => props.history.goBack()}>取消</Button> <Button onClick={() => props.history.goBack()}>取消</Button>
<Button <Button
type="primary" type="primary"
@ -125,6 +137,7 @@ const EvalProjectCreate = (props) => {
提交并返回项目列表 提交并返回项目列表
</Button> </Button>
</Flex> </Flex>
)
} }
loading={detailLoading} loading={detailLoading}
> >
@ -174,7 +187,9 @@ const EvalProjectCreate = (props) => {
showSearch showSearch
optionFilterProp="label" optionFilterProp="label"
onChange={(value, option) => { onChange={(value, option) => {
const customer = customerList?.find((item) => item.id === value); const customer = customerList?.find(
(item) => item.id === value,
);
console.log(customer); console.log(customer);
form.setFieldsValue({ form.setFieldsValue({
customerContactName: customer?.principalName || "", customerContactName: customer?.principalName || "",
@ -226,7 +241,7 @@ const EvalProjectCreate = (props) => {
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item name="projectLeaderName" label="项目负责人"> <Form.Item name="projectLeaderName" label="项目负责人">
<Input placeholder="请输入" maxLength={50} /> <Input placeholder="请输入" maxLength={30} />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
@ -241,6 +256,21 @@ const EvalProjectCreate = (props) => {
<DatePicker style={{ width: "100%" }} placeholder="请选择" /> <DatePicker style={{ width: "100%" }} placeholder="请选择" />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}>
<Form.Item
name="industryCode"
label="所属行业"
>
<Select placeholder="请选择" allowClear>
{QUALIFICATION_INDUSTRY_OPTIONS.map((opt) => (
<Select.Option key={opt.value} value={opt.value}>
{opt.label}
</Select.Option>
))}
</Select>
</Form.Item>
</Col>
</Row> </Row>
</Card> </Card>