parent
8dd9cfddd7
commit
627166fccb
|
|
@ -24,3 +24,8 @@ export const rescueTeamDelete = declareRequest(
|
||||||
"rescueTeamLoading",
|
"rescueTeamLoading",
|
||||||
`Delete >@/fireResource/rescueTeam/{id}`,
|
`Delete >@/fireResource/rescueTeam/{id}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const rescueTeamCheckName = declareRequest(
|
||||||
|
"rescueTeamLoading",
|
||||||
|
`Post >@/fireResource/rescueTeam/checkName`,
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ function Add(props) {
|
||||||
const [mapOpen, setMapOpen] = useState(false);
|
const [mapOpen, setMapOpen] = useState(false);
|
||||||
const [mapLng, setMapLng] = useState("");
|
const [mapLng, setMapLng] = useState("");
|
||||||
const [mapLat, setMapLat] = useState("");
|
const [mapLat, setMapLat] = useState("");
|
||||||
|
const pageTitle = query.id ? "编辑" : "新增";
|
||||||
|
|
||||||
// 设备列表
|
// 设备列表
|
||||||
const createEmptyDevice = () => ({
|
const createEmptyDevice = () => ({
|
||||||
|
|
@ -131,6 +132,7 @@ function Add(props) {
|
||||||
|
|
||||||
const handleMapConfirm = (lng, lat) => {
|
const handleMapConfirm = (lng, lat) => {
|
||||||
form.setFieldsValue({ lng, lat });
|
form.setFieldsValue({ lng, lat });
|
||||||
|
form.validateFields(["lng", "lat"]).catch(() => {});
|
||||||
setMapOpen(false);
|
setMapOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -144,6 +146,10 @@ function Add(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDevice = (key) => {
|
const removeDevice = (key) => {
|
||||||
|
if (devices.length <= 1) {
|
||||||
|
message.warning("设备信息至少保留一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const index = devices.findIndex(item => item.key === key);
|
const index = devices.findIndex(item => item.key === key);
|
||||||
const newDevices = devices.filter(item => item.key !== key);
|
const newDevices = devices.filter(item => item.key !== key);
|
||||||
setDevices(newDevices);
|
setDevices(newDevices);
|
||||||
|
|
@ -172,8 +178,8 @@ function Add(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removePerson = (key) => {
|
const removePerson = (key) => {
|
||||||
if (persons.length === 1) {
|
if (persons.length <= 1) {
|
||||||
message.warning("至少保留一条人员数据");
|
message.warning("人员信息至少保留一条");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const index = persons.findIndex(item => item.key === key);
|
const index = persons.findIndex(item => item.key === key);
|
||||||
|
|
@ -222,6 +228,19 @@ function Add(props) {
|
||||||
const validDevices = devices.filter(
|
const validDevices = devices.filter(
|
||||||
device => device.deviceName || device.deviceModel || device.deviceQty || device.deviceLocation,
|
device => device.deviceName || device.deviceModel || device.deviceQty || device.deviceLocation,
|
||||||
);
|
);
|
||||||
|
const validPersons = persons.filter(
|
||||||
|
person => person.personName || person.personPhone || person.dutyDesc,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (validDevices.length === 0) {
|
||||||
|
message.warning("设备信息至少保留一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validPersons.length === 0) {
|
||||||
|
message.warning("人员信息至少保留一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
|
|
@ -233,7 +252,7 @@ function Add(props) {
|
||||||
deviceLocation: device.deviceLocation,
|
deviceLocation: device.deviceLocation,
|
||||||
...(device.id && { id: device.id }),
|
...(device.id && { id: device.id }),
|
||||||
})),
|
})),
|
||||||
persons: persons.map(({ key, ...person }) => ({
|
persons: validPersons.map(({ key, ...person }) => ({
|
||||||
personName: person.personName,
|
personName: person.personName,
|
||||||
personPhone: person.personPhone,
|
personPhone: person.personPhone,
|
||||||
dutyDesc: person.dutyDesc,
|
dutyDesc: person.dutyDesc,
|
||||||
|
|
@ -262,7 +281,7 @@ function Add(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading || uploadFileLoading || deleteFileLoading || getFileLoading}
|
loading={loading || uploadFileLoading || deleteFileLoading || getFileLoading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|
@ -351,22 +370,30 @@ function Add(props) {
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
|
<Form.Item noStyle shouldUpdate>
|
||||||
|
{() => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="纬度"
|
label="纬度"
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
required
|
||||||
|
validateStatus={form.getFieldError("lat").length ? "error" : ""}
|
||||||
|
help={form.getFieldError("lat")[0]}
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="lat"
|
name="lat"
|
||||||
noStyle
|
noStyle
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
rules={[{ required: true, message: "请选择纬度" }]}
|
||||||
>
|
>
|
||||||
<Input placeholder="请点击地图定位按钮选择" disabled style={{ flex: 1 }} />
|
<Input placeholder="请点击定位按钮选择" disabled />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</div>
|
||||||
<Button type="primary" onClick={openMap}>
|
<Button type="primary" onClick={openMap}>
|
||||||
地图定位
|
点击定位
|
||||||
</Button>
|
</Button>
|
||||||
</Space.Compact>
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
@ -378,6 +405,7 @@ function Add(props) {
|
||||||
name="roomImages"
|
name="roomImages"
|
||||||
labelCol={{ span: 3 }}
|
labelCol={{ span: 3 }}
|
||||||
wrapperCol={{ span: 21 }}
|
wrapperCol={{ span: 21 }}
|
||||||
|
rules={[{ required: true, message: "请上传消防控制室图片" }]}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
fileType="image"
|
fileType="image"
|
||||||
|
|
@ -459,7 +487,8 @@ function Add(props) {
|
||||||
label="设备位置"
|
label="设备位置"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={['devicesForm', index, 'deviceLocation']}
|
name={['devicesForm', index, 'deviceLocation']}
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -473,10 +502,13 @@ function Add(props) {
|
||||||
onChange={e => updateDevice(device.key, "deviceLocation", e.target.value)}
|
onChange={e => updateDevice(device.key, "deviceLocation", e.target.value)}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button danger onClick={() => removeDevice(device.key)}>
|
</div>
|
||||||
|
{devices.length > 1 && (
|
||||||
|
<Button type="primary" danger onClick={() => removeDevice(device.key)}>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Space.Compact>
|
)}
|
||||||
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
@ -551,8 +583,8 @@ function Add(props) {
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<div style={{ textAlign: 'right', paddingTop: 30 }}>
|
<div style={{ textAlign: 'right', paddingTop: 30 }}>
|
||||||
{index > 0 && (
|
{persons.length > 1 && (
|
||||||
<Button danger onClick={() => removePerson(person.key)}>
|
<Button type="primary" danger onClick={() => removePerson(person.key)}>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,7 @@ function List(props) {
|
||||||
isShowAllAction={isFromSupervision}
|
isShowAllAction={isFromSupervision}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
history={pageHistory}
|
history={pageHistory}
|
||||||
|
headerTitle="消防控制室"
|
||||||
>
|
>
|
||||||
<Search
|
<Search
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
|
|
@ -166,6 +167,7 @@ function List(props) {
|
||||||
<Table
|
<Table
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
|
{props.permission("xfkzs-add") && (
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -174,6 +176,7 @@ function List(props) {
|
||||||
>
|
>
|
||||||
新增
|
新增
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
|
|
@ -224,6 +227,7 @@ function List(props) {
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space size={8}>
|
<Space size={8}>
|
||||||
|
{props.permission("xfkzs-info") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -233,6 +237,8 @@ function List(props) {
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfkzs-update") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -242,6 +248,8 @@ function List(props) {
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfkzs-remove") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -252,6 +260,7 @@ function List(props) {
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ function View(props) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [detail, setDetail] = useState(null);
|
const [detail, setDetail] = useState(null);
|
||||||
const [statusDict, setStatusDict] = useState([]);
|
const [statusDict, setStatusDict] = useState([]);
|
||||||
|
const pageTitle = "查看";
|
||||||
|
|
||||||
const { loading: dictLoading, getDictionary } = useDictionary();
|
const { loading: dictLoading, getDictionary } = useDictionary();
|
||||||
const { loading: getFileLoading, getFile } = useGetFile();
|
const { loading: getFileLoading, getFile } = useGetFile();
|
||||||
|
|
@ -163,7 +164,7 @@ function View(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading || dictLoading || getFileLoading}
|
loading={loading || dictLoading || getFileLoading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
{detail && (
|
{detail && (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ function Add(props) {
|
||||||
const [mapOpen, setMapOpen] = useState(false);
|
const [mapOpen, setMapOpen] = useState(false);
|
||||||
const [mapLng, setMapLng] = useState("");
|
const [mapLng, setMapLng] = useState("");
|
||||||
const [mapLat, setMapLat] = useState("");
|
const [mapLat, setMapLat] = useState("");
|
||||||
|
const pageTitle = query.id ? "编辑" : "新增";
|
||||||
|
|
||||||
// 设备信息列表
|
// 设备信息列表
|
||||||
const createEmptyDevice = () => ({
|
const createEmptyDevice = () => ({
|
||||||
|
|
@ -105,6 +106,7 @@ function Add(props) {
|
||||||
|
|
||||||
const handleMapConfirm = (lng, lat) => {
|
const handleMapConfirm = (lng, lat) => {
|
||||||
form.setFieldsValue({ lng, lat });
|
form.setFieldsValue({ lng, lat });
|
||||||
|
form.validateFields(["lng", "lat"]).catch(() => {});
|
||||||
setMapOpen(false);
|
setMapOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -136,6 +138,11 @@ function Add(props) {
|
||||||
device.chargeUnit || device.deviceLocation || device.paramsSpec,
|
device.chargeUnit || device.deviceLocation || device.paramsSpec,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (validDevices.length === 0) {
|
||||||
|
message.warning("设备信息至少保留一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
pumpRoomId,
|
pumpRoomId,
|
||||||
|
|
@ -182,6 +189,10 @@ function Add(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDevice = (key) => {
|
const removeDevice = (key) => {
|
||||||
|
if (devices.length <= 1) {
|
||||||
|
message.warning("设备信息至少保留一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const index = devices.findIndex(item => item.key === key);
|
const index = devices.findIndex(item => item.key === key);
|
||||||
const newDevices = devices.filter(item => item.key !== key);
|
const newDevices = devices.filter(item => item.key !== key);
|
||||||
setDeviceList(newDevices);
|
setDeviceList(newDevices);
|
||||||
|
|
@ -204,7 +215,7 @@ function Add(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading || uploadFileLoading || deleteFileLoading || getFileLoading}
|
loading={loading || uploadFileLoading || deleteFileLoading || getFileLoading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|
@ -292,22 +303,30 @@ function Add(props) {
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
|
<Form.Item noStyle shouldUpdate>
|
||||||
|
{() => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="纬度"
|
label="纬度"
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
required
|
||||||
|
validateStatus={form.getFieldError("lat").length ? "error" : ""}
|
||||||
|
help={form.getFieldError("lat")[0]}
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="lat"
|
name="lat"
|
||||||
noStyle
|
noStyle
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
rules={[{ required: true, message: "请选择纬度" }]}
|
||||||
>
|
>
|
||||||
<Input placeholder="请点击地图定位按钮选择" disabled style={{ flex: 1 }} />
|
<Input placeholder="请点击定位按钮选择" disabled />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</div>
|
||||||
<Button type="primary" onClick={openMap}>
|
<Button type="primary" onClick={openMap}>
|
||||||
地图定位
|
点击定位
|
||||||
</Button>
|
</Button>
|
||||||
</Space.Compact>
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
@ -319,6 +338,7 @@ function Add(props) {
|
||||||
name="roomImages"
|
name="roomImages"
|
||||||
labelCol={{ span: 3 }}
|
labelCol={{ span: 3 }}
|
||||||
wrapperCol={{ span: 21 }}
|
wrapperCol={{ span: 21 }}
|
||||||
|
rules={[{ required: true, message: "请上传消防泵房图片" }]}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
fileType="image"
|
fileType="image"
|
||||||
|
|
@ -432,7 +452,8 @@ function Add(props) {
|
||||||
label="设备参数和规格"
|
label="设备参数和规格"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={['devicesForm', index, 'paramsSpec']}
|
name={['devicesForm', index, 'paramsSpec']}
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -446,10 +467,17 @@ function Add(props) {
|
||||||
onChange={e => updateDevice(device.key, "paramsSpec", e.target.value)}
|
onChange={e => updateDevice(device.key, "paramsSpec", e.target.value)}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button danger onClick={() => removeDevice(device.key)}>
|
</div>
|
||||||
|
{devices.length > 1 && (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
danger
|
||||||
|
onClick={() => removeDevice(device.key)}
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Space.Compact>
|
)}
|
||||||
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,12 @@ function List(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page isShowAllAction={isFromSupervision} isShowFooter={false} history={pageHistory}>
|
<Page
|
||||||
|
isShowAllAction={isFromSupervision}
|
||||||
|
isShowFooter={false}
|
||||||
|
history={pageHistory}
|
||||||
|
headerTitle="消防泵房"
|
||||||
|
>
|
||||||
<Search
|
<Search
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 16 }}
|
wrapperCol={{ span: 16 }}
|
||||||
|
|
@ -144,7 +149,9 @@ function List(props) {
|
||||||
<Table
|
<Table
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
|
{props.permission("xfbf-add") && (
|
||||||
<Button type="primary" onClick={() => props.history.push("./add")}>新增</Button>
|
<Button type="primary" onClick={() => props.history.push("./add")}>新增</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
|
|
@ -159,9 +166,15 @@ function List(props) {
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space size={8}>
|
<Space size={8}>
|
||||||
|
{props.permission("xfbf-info") && (
|
||||||
<Button type="link" size="small" onClick={() => props.history.push(`./view?id=${record.id}`)}>查看</Button>
|
<Button type="link" size="small" onClick={() => props.history.push(`./view?id=${record.id}`)}>查看</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfbf-update") && (
|
||||||
<Button type="link" size="small" onClick={() => props.history.push(`./add?id=${record.id}`)}>编辑</Button>
|
<Button type="link" size="small" onClick={() => props.history.push(`./add?id=${record.id}`)}>编辑</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfbf-remove") && (
|
||||||
<Button type="link" size="small" danger onClick={() => onDelete(record.id)}>删除</Button>
|
<Button type="link" size="small" danger onClick={() => onDelete(record.id)}>删除</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ function View(props) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [detail, setDetail] = useState(null);
|
const [detail, setDetail] = useState(null);
|
||||||
const [statusDict, setStatusDict] = useState([]);
|
const [statusDict, setStatusDict] = useState([]);
|
||||||
|
const pageTitle = "查看";
|
||||||
|
|
||||||
const { getDictionary } = useDictionary();
|
const { getDictionary } = useDictionary();
|
||||||
const { loading: getFileLoading, getFile } = useGetFile();
|
const { loading: getFileLoading, getFile } = useGetFile();
|
||||||
|
|
@ -148,7 +149,7 @@ function View(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading || getFileLoading}
|
loading={loading || getFileLoading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
{detail && (
|
{detail && (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,32 @@ function Add(props) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const pageTitle = query.id ? "编辑" : "新增";
|
||||||
|
|
||||||
|
const validateTeamNameUnique = async (_, value) => {
|
||||||
|
const teamName = value?.trim();
|
||||||
|
if (!teamName) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!props["rescueTeamCheckName"]) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await props["rescueTeamCheckName"]({
|
||||||
|
teamName,
|
||||||
|
id: query.id,
|
||||||
|
});
|
||||||
|
if (response?.data) {
|
||||||
|
return Promise.reject(new Error("救援队名称已存在"));
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return Promise.reject(new Error("救援队名称校验失败"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 消防队员列表
|
// 消防队员列表
|
||||||
const createEmptyMember = () => ({
|
const createEmptyMember = () => ({
|
||||||
|
|
@ -99,6 +125,7 @@ function Add(props) {
|
||||||
|
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
try {
|
try {
|
||||||
|
await form.validateFields(["teamName"]);
|
||||||
const apiMethod = query.id ? props["rescueTeamUpdate"] : props["rescueTeamAdd"];
|
const apiMethod = query.id ? props["rescueTeamUpdate"] : props["rescueTeamAdd"];
|
||||||
|
|
||||||
// 处理日期格式和提交参数
|
// 处理日期格式和提交参数
|
||||||
|
|
@ -133,6 +160,9 @@ function Add(props) {
|
||||||
props.history.goBack();
|
props.history.goBack();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
if (error?.errorFields) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
message.error(query.id ? "修改失败" : "新增失败");
|
message.error(query.id ? "修改失败" : "新增失败");
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
@ -170,7 +200,7 @@ function Add(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading}
|
loading={loading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|
@ -191,12 +221,19 @@ function Add(props) {
|
||||||
name="teamName"
|
name="teamName"
|
||||||
labelCol={{ span: 3 }}
|
labelCol={{ span: 3 }}
|
||||||
wrapperCol={{ span: 21 }}
|
wrapperCol={{ span: 21 }}
|
||||||
|
validateTrigger="onBlur"
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: "请输入救援队名称" },
|
{ required: true, message: "请输入救援队名称" },
|
||||||
{ max: 50, message: "救援队名称不能超过50个字符" },
|
{ max: 50, message: "救援队名称不能超过50个字符" },
|
||||||
|
{ validator: validateTeamNameUnique },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input placeholder="请输入救援队名称" />
|
<Input
|
||||||
|
placeholder="请输入救援队名称"
|
||||||
|
onBlur={e => {
|
||||||
|
form.setFieldValue("teamName", e.target.value?.trim());
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
@ -258,10 +295,10 @@ function Add(props) {
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder="请输入队长电话"
|
placeholder="请输入队长电话"
|
||||||
maxLength={20}
|
maxLength={11}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
// 只允许输入数字和连字符
|
// 只允许输入数字和连字符
|
||||||
const value = e.target.value.replace(/[^\d-]/g, '');
|
const value = e.target.value.replace(/[^\d-]/g, '').slice(0, 11);
|
||||||
form.setFieldValue('captainPhone', value);
|
form.setFieldValue('captainPhone', value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -362,7 +399,8 @@ function Add(props) {
|
||||||
label={`队员${index + 1}电话`}
|
label={`队员${index + 1}电话`}
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={['rescueMembersForm', index, 'personPhone']}
|
name={['rescueMembersForm', index, 'personPhone']}
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -373,23 +411,25 @@ function Add(props) {
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder="请输入队员电话"
|
placeholder="请输入队员电话"
|
||||||
maxLength={20}
|
maxLength={11}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
const value = e.target.value.replace(/[^\d-]/g, '');
|
const value = e.target.value.replace(/[^\d-]/g, '').slice(0, 11);
|
||||||
updateMember(member.key, "personPhone", value);
|
updateMember(member.key, "personPhone", value);
|
||||||
form.setFieldValue(['rescueMembersForm', index, 'personPhone'], value);
|
form.setFieldValue(['rescueMembersForm', index, 'personPhone'], value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</div>
|
||||||
{index !== 0 && (
|
{index !== 0 && (
|
||||||
<Button
|
<Button
|
||||||
|
type="primary"
|
||||||
danger
|
danger
|
||||||
onClick={() => removeMember(member.key)}
|
onClick={() => removeMember(member.key)}
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Space.Compact>
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,12 @@ function List(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page isShowAllAction={isFromSupervision} isShowFooter={false} history={pageHistory}>
|
<Page
|
||||||
|
isShowAllAction={isFromSupervision}
|
||||||
|
isShowFooter={false}
|
||||||
|
history={pageHistory}
|
||||||
|
headerTitle="消防救援队"
|
||||||
|
>
|
||||||
<Search
|
<Search
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 16 }}
|
wrapperCol={{ span: 16 }}
|
||||||
|
|
@ -126,7 +131,9 @@ function List(props) {
|
||||||
<Table
|
<Table
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
|
{props.permission("xfjyd-add") && (
|
||||||
<Button type="primary" onClick={() => props.history.push("./add")}>新增</Button>
|
<Button type="primary" onClick={() => props.history.push("./add")}>新增</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
|
|
@ -143,9 +150,15 @@ function List(props) {
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space size={8}>
|
<Space size={8}>
|
||||||
|
{props.permission("xfjyd-info") && (
|
||||||
<Button type="link" size="small" onClick={() => props.history.push(`./view?id=${record.id}`)}>查看</Button>
|
<Button type="link" size="small" onClick={() => props.history.push(`./view?id=${record.id}`)}>查看</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfjyd-update") && (
|
||||||
<Button type="link" size="small" onClick={() => props.history.push(`./add?id=${record.id}`)}>编辑</Button>
|
<Button type="link" size="small" onClick={() => props.history.push(`./add?id=${record.id}`)}>编辑</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfjyd-remove") && (
|
||||||
<Button type="link" size="small" danger onClick={() => onDelete(record.id)}>删除</Button>
|
<Button type="link" size="small" danger onClick={() => onDelete(record.id)}>删除</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ function View(props) {
|
||||||
const query = useGetUrlQuery();
|
const query = useGetUrlQuery();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [detail, setDetail] = useState(null);
|
const [detail, setDetail] = useState(null);
|
||||||
|
const pageTitle = "查看";
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
@ -57,7 +58,7 @@ function View(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading}
|
loading={loading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
{detail && (
|
{detail && (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ function Add(props) {
|
||||||
const [mapOpen, setMapOpen] = useState(false);
|
const [mapOpen, setMapOpen] = useState(false);
|
||||||
const [mapLng, setMapLng] = useState("");
|
const [mapLng, setMapLng] = useState("");
|
||||||
const [mapLat, setMapLat] = useState("");
|
const [mapLat, setMapLat] = useState("");
|
||||||
|
const pageTitle = query.id ? "编辑" : "新增";
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
@ -43,6 +44,7 @@ function Add(props) {
|
||||||
|
|
||||||
const handleMapConfirm = (lng, lat) => {
|
const handleMapConfirm = (lng, lat) => {
|
||||||
form.setFieldsValue({ lng, lat });
|
form.setFieldsValue({ lng, lat });
|
||||||
|
form.validateFields(["lng", "lat"]).catch(() => {});
|
||||||
setMapOpen(false);
|
setMapOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -68,7 +70,7 @@ function Add(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading}
|
loading={loading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|
@ -117,22 +119,30 @@ function Add(props) {
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
|
<Form.Item noStyle shouldUpdate>
|
||||||
|
{() => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="纬度"
|
label="纬度"
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
required
|
||||||
|
validateStatus={form.getFieldError("lat").length ? "error" : ""}
|
||||||
|
help={form.getFieldError("lat")[0]}
|
||||||
>
|
>
|
||||||
<Space.Compact style={{ width: "100%" }}>
|
<div style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="lat"
|
name="lat"
|
||||||
noStyle
|
noStyle
|
||||||
rules={[{ required: true, message: "请选择纬度" }]}
|
rules={[{ required: true, message: "请选择纬度" }]}
|
||||||
>
|
>
|
||||||
<Input placeholder="请点击地图定位按钮选择" disabled style={{ flex: 1 }} />
|
<Input placeholder="请点击定位按钮选择" disabled />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
</div>
|
||||||
<Button type="primary" onClick={openMap}>
|
<Button type="primary" onClick={openMap}>
|
||||||
地图定位
|
点击定位
|
||||||
</Button>
|
</Button>
|
||||||
</Space.Compact>
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ function List(props) {
|
||||||
isShowAllAction={isFromSupervision}
|
isShowAllAction={isFromSupervision}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
history={pageHistory}
|
history={pageHistory}
|
||||||
|
headerTitle="消防水源"
|
||||||
>
|
>
|
||||||
<Search
|
<Search
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
|
|
@ -160,6 +161,7 @@ function List(props) {
|
||||||
<Table
|
<Table
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
|
{props.permission("xfsy-add") && (
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -168,6 +170,7 @@ function List(props) {
|
||||||
>
|
>
|
||||||
新增
|
新增
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
|
|
@ -204,6 +207,7 @@ function List(props) {
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space size={8}>
|
<Space size={8}>
|
||||||
|
{props.permission("xfsy-info") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -213,6 +217,8 @@ function List(props) {
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfsy-update") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -222,6 +228,8 @@ function List(props) {
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
{props.permission("xfsy-remove") && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
@ -230,6 +238,7 @@ function List(props) {
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ function View(props) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [detail, setDetail] = useState(null);
|
const [detail, setDetail] = useState(null);
|
||||||
const [statusDict, setStatusDict] = useState([]);
|
const [statusDict, setStatusDict] = useState([]);
|
||||||
|
const pageTitle = "查看";
|
||||||
|
|
||||||
const { getDictionary } = useDictionary();
|
const { getDictionary } = useDictionary();
|
||||||
|
|
||||||
|
|
@ -57,7 +58,7 @@ function View(props) {
|
||||||
<Page
|
<Page
|
||||||
loading={loading}
|
loading={loading}
|
||||||
isShowFooter={false}
|
isShowFooter={false}
|
||||||
isShowBack={false}
|
headerTitle={pageTitle}
|
||||||
>
|
>
|
||||||
{detail && (
|
{detail && (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue