2025-09-28 17:45:29 +08:00
|
|
|
import React, { useEffect, useState, useMemo } from 'react';
|
|
|
|
|
import { Form, Button, Input, Row, Col, DatePicker, Upload, message, Image, Modal, Radio } from 'antd';
|
2024-09-20 15:02:50 +08:00
|
|
|
import { formItemLayout, btnItemLayout } from '../../../../components/crud/FormLayoutProps';
|
|
|
|
|
import apiurl from '../../../../service/apiurl';
|
|
|
|
|
import NormalSelect from '../../../../components/Form/NormalSelect';
|
|
|
|
|
import { httppost2 } from '../../../../utils/request';
|
|
|
|
|
|
|
|
|
|
import moment from 'moment';
|
2025-09-28 17:45:29 +08:00
|
|
|
const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
|
2024-09-20 15:02:50 +08:00
|
|
|
const optionsType = [
|
|
|
|
|
{
|
|
|
|
|
label: "渗压监测",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 1
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "渗流监测",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 2
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-09-28 17:45:29 +08:00
|
|
|
label: "位移监测",
|
|
|
|
|
value: 3
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
const optionsLevel = [
|
|
|
|
|
{
|
|
|
|
|
label: "黄色告警",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 1
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "红色告警",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 2
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const conditionOneType = [
|
|
|
|
|
{
|
|
|
|
|
label: ">",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: ">"
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "<",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "<"
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "=",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "="
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: ">=",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: ">="
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "<=",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "<="
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "!=",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "!="
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
]
|
2025-09-28 17:45:29 +08:00
|
|
|
|
2024-09-20 15:02:50 +08:00
|
|
|
|
|
|
|
|
const condition = [
|
|
|
|
|
{
|
|
|
|
|
label: "且",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 1
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "或",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: 2
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const wyOptions = [
|
|
|
|
|
{
|
|
|
|
|
label: "X方向",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "x"
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Y方向",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "y"
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "H方向",
|
2025-09-28 17:45:29 +08:00
|
|
|
value: "h"
|
2024-09-20 15:02:50 +08:00
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
2025-09-28 17:45:29 +08:00
|
|
|
console.log("record", record);
|
2024-09-20 15:02:50 +08:00
|
|
|
const [form] = Form.useForm();
|
2025-09-19 17:14:29 +08:00
|
|
|
const [staCodeList, setStaCodeList] = useState([])//渗压
|
2024-09-20 15:02:50 +08:00
|
|
|
const [Condition, setCondition] = useState("")
|
|
|
|
|
const [types, setTypes] = useState('')
|
2025-09-19 17:14:29 +08:00
|
|
|
const [slStacodeList, setSlStacodeList] = useState([])//渗流
|
2024-09-20 15:02:50 +08:00
|
|
|
const onFinish = (values) => {
|
|
|
|
|
values.valueOne = values.valueOne ? Number(values.valueOne) : ''
|
2025-09-28 17:45:29 +08:00
|
|
|
values.valueTwo = values.valueTwo ? Number(values.valueTwo) : ''
|
2024-09-20 15:02:50 +08:00
|
|
|
if (mode === 'edit') {
|
|
|
|
|
values.id = record.id;
|
|
|
|
|
values.createTime = record.createTime
|
2025-09-28 17:45:29 +08:00
|
|
|
onEdit(apiurl.gcaqjc.gcaqyj.yjgzpz.edit, values)
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
if (mode === 'save') {
|
2025-09-28 17:45:29 +08:00
|
|
|
onSave(apiurl.gcaqjc.gcaqyj.yjgzpz.save, values)
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
2025-09-28 17:45:29 +08:00
|
|
|
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
|
2025-09-19 17:14:29 +08:00
|
|
|
const [codeList, setCodeList] = useState([])//位移
|
2024-09-20 15:02:50 +08:00
|
|
|
|
|
|
|
|
const getwYCode = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await httppost2(apiurl.gcaqjc.sjtjcx.wycx.list)
|
2025-09-28 17:45:29 +08:00
|
|
|
setCodeList(res.data.map(s => ({ stationCode: s.cd, label: s.cdNm, value: s.cd })));//
|
2024-09-20 15:02:50 +08:00
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getSlCode = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await httppost2(apiurl.gcaqjc.sjtjcx.wycx.slList)
|
2025-09-28 17:45:29 +08:00
|
|
|
setSlStacodeList(res.data.map(s => ({ stationCode: s.dvcd, label: s.dvcd, value: s.dvcd })));
|
2024-09-20 15:02:50 +08:00
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-28 17:45:29 +08:00
|
|
|
const getStationCode = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await httppost2(apiurl.gcaqjc.gcaqyj.yjgzpz.list)
|
|
|
|
|
setStaCodeList(res.data.map(s => ({ stationCode: s.dvcd, label: s.dvcd, value: s.dvcd })));
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
2025-09-28 17:45:29 +08:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (mode !== "save") {
|
|
|
|
|
// getFileInfo(record)
|
2024-10-23 16:02:12 +08:00
|
|
|
setCondition(record?.condition)
|
2024-09-20 15:02:50 +08:00
|
|
|
setTypes(record.type)
|
|
|
|
|
}
|
|
|
|
|
}, [record, mode])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-09-19 17:14:29 +08:00
|
|
|
getwYCode()//位移
|
|
|
|
|
getStationCode()//渗压
|
|
|
|
|
getSlCode()//渗流
|
2024-09-20 15:02:50 +08:00
|
|
|
}, [])
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (mode == "save") {
|
2025-09-28 17:45:29 +08:00
|
|
|
form.setFieldValue("status", 1)
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
}, [mode])
|
2025-09-28 17:45:29 +08:00
|
|
|
|
2024-09-20 15:02:50 +08:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Form
|
|
|
|
|
form={form}
|
|
|
|
|
{...formItemLayout}
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
initialValues={record}
|
|
|
|
|
>
|
2025-09-28 17:45:29 +08:00
|
|
|
<Row>
|
2024-09-20 15:02:50 +08:00
|
|
|
<Col span={12}>
|
2025-09-28 17:45:29 +08:00
|
|
|
<Form.Item
|
|
|
|
|
label="告警类型"
|
|
|
|
|
name="type"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
2024-09-20 15:02:50 +08:00
|
|
|
<NormalSelect
|
|
|
|
|
disabled={mode === 'view'}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
allowClear options={optionsType}
|
|
|
|
|
onChange={(e) => setTypes(e)}
|
|
|
|
|
/>
|
2025-09-28 17:45:29 +08:00
|
|
|
</Form.Item>
|
2024-09-20 15:02:50 +08:00
|
|
|
</Col>
|
|
|
|
|
<Col span={12}>
|
2025-09-28 17:45:29 +08:00
|
|
|
<Form.Item
|
|
|
|
|
label="告警级别"
|
|
|
|
|
name="level"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
2024-09-20 15:02:50 +08:00
|
|
|
<NormalSelect
|
|
|
|
|
disabled={mode === 'view'}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
allowClear
|
|
|
|
|
options={optionsLevel}
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
2025-09-28 17:45:29 +08:00
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={12}>
|
2024-09-20 15:02:50 +08:00
|
|
|
<Form.Item
|
2025-09-28 17:45:29 +08:00
|
|
|
label="测点编号"
|
2024-09-20 15:02:50 +08:00
|
|
|
rules={[{ required: true }]}
|
2025-09-28 17:45:29 +08:00
|
|
|
name="stationCode"
|
2024-09-20 15:02:50 +08:00
|
|
|
|
2025-09-28 17:45:29 +08:00
|
|
|
>
|
2024-09-20 15:02:50 +08:00
|
|
|
<NormalSelect
|
|
|
|
|
disabled={mode === 'view'}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
allowClear
|
2025-09-28 17:45:29 +08:00
|
|
|
options={
|
|
|
|
|
types == 3 ? codeList :
|
|
|
|
|
types == 1 ? staCodeList : slStacodeList
|
|
|
|
|
} />
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Form.Item
|
2025-09-28 17:45:29 +08:00
|
|
|
label="校验规则描述"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
name="ruleDesc"
|
|
|
|
|
>
|
|
|
|
|
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form.Item>
|
2025-09-28 17:45:29 +08:00
|
|
|
</Col>
|
2024-09-20 15:02:50 +08:00
|
|
|
</Row>
|
2025-09-28 17:45:29 +08:00
|
|
|
{types != 3 ?
|
|
|
|
|
<>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="阈值"
|
|
|
|
|
name="conditionOne"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<NormalSelect disabled={mode === 'view'} style={{ width: '100%' }} allowClear options={conditionOneType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="valueOne"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
|
|
|
|
<Input type='num' disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="condition"
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
<NormalSelect
|
|
|
|
|
disabled={mode === 'view'}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
allowClear
|
|
|
|
|
options={condition}
|
|
|
|
|
onChange={(e) => { setCondition(e) }}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="conditionTwo"
|
|
|
|
|
wrapperCol={{ span: 18, offset: 6 }}
|
|
|
|
|
rules={[{ required: Condition ? true : false }]}
|
|
|
|
|
>
|
|
|
|
|
<NormalSelect disabled={mode === 'view' || !Condition} style={{ width: '78%' }} allowClear options={conditionOneType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="valueTwo"
|
|
|
|
|
rules={[{ required: Condition ? true : false }]}
|
|
|
|
|
>
|
|
|
|
|
<Input type='num' disabled={mode === 'view' || !Condition} style={{ width: '100%' }} allowClear />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
2024-09-20 15:02:50 +08:00
|
|
|
</>
|
|
|
|
|
:
|
|
|
|
|
<>
|
2025-09-28 17:45:29 +08:00
|
|
|
<Row>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="阈值"
|
|
|
|
|
name="direction"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<NormalSelect disabled={mode === 'view'} style={{ width: '100%' }} allowClear options={wyOptions} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
<Row >
|
|
|
|
|
<Col span={6} >
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="conditionOne"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
wrapperCol={{ span: 12, offset: 12 }}
|
|
|
|
|
>
|
|
|
|
|
<NormalSelect disabled={mode === 'view'} style={{ width: '100%' }} allowClear options={conditionOneType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={4}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="valueOne"
|
|
|
|
|
wrapperCol={{ span: 20, offset: 4 }}
|
|
|
|
|
// wrapperCol={{span:20,offset:9}}
|
|
|
|
|
>
|
|
|
|
|
<Input type='num' disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={3}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="condition"
|
|
|
|
|
wrapperCol={{ span: 12, offset: 12 }}
|
|
|
|
|
>
|
|
|
|
|
<NormalSelect
|
|
|
|
|
disabled={mode === 'view'}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
allowClear
|
|
|
|
|
options={condition}
|
|
|
|
|
onChange={(e) => { setCondition(e) }}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="conditionTwo"
|
|
|
|
|
wrapperCol={{ span: 12, offset: 12 }}
|
|
|
|
|
rules={[{ required: Condition ? true : false }]}
|
|
|
|
|
>
|
|
|
|
|
<NormalSelect disabled={mode === 'view' || !Condition} style={{ width: '100%' }} allowClear options={conditionOneType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={3}>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
name="valueTwo"
|
|
|
|
|
// wrapperCol={{span:10,offset:12}}
|
|
|
|
|
wrapperCol={{ span: 20, offset: 4 }}
|
|
|
|
|
rules={[{ required: Condition ? true : false }]}
|
|
|
|
|
>
|
|
|
|
|
<Input type='num' disabled={mode === 'view' || !Condition} style={{ width: '100%' }} allowClear />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
<Row>
|
2024-09-20 15:02:50 +08:00
|
|
|
<Col span={12}>
|
|
|
|
|
<Form.Item
|
2025-09-28 17:45:29 +08:00
|
|
|
label="是否启用"
|
|
|
|
|
name="status"
|
2024-09-20 15:02:50 +08:00
|
|
|
rules={[{ required: true }]}
|
2025-09-28 17:45:29 +08:00
|
|
|
>
|
|
|
|
|
<Radio.Group disabled={mode === 'view'} >
|
|
|
|
|
<Radio value={1}>启用</Radio>
|
|
|
|
|
<Radio value={0}>不启用</Radio>
|
|
|
|
|
</Radio.Group>
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form.Item>
|
|
|
|
|
</Col>
|
2025-09-28 17:45:29 +08:00
|
|
|
</Row>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={24}>
|
2024-09-20 15:02:50 +08:00
|
|
|
<Form.Item
|
2025-09-28 17:45:29 +08:00
|
|
|
label="处理建议"
|
|
|
|
|
name="resolveSuggest"
|
|
|
|
|
labelCol={{ span: 3 }}
|
|
|
|
|
wrapperCol={{ span: 19 }}
|
|
|
|
|
>
|
|
|
|
|
<Input.TextArea disabled={mode === 'view'} style={{ width: '100%', minHeight: '100px' }} allowClear />
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form.Item>
|
2025-09-28 17:45:29 +08:00
|
|
|
</Col>
|
2024-09-20 15:02:50 +08:00
|
|
|
</Row>
|
2025-09-28 17:45:29 +08:00
|
|
|
{
|
|
|
|
|
mode === 'view' ? null : (
|
|
|
|
|
<>
|
|
|
|
|
<Form.Item {...btnItemLayout}>
|
|
|
|
|
<Button type="primary" htmlType="submit">
|
2024-09-20 15:02:50 +08:00
|
|
|
{mode === 'save' ? '保存' :
|
|
|
|
|
mode === "similarSave" ? "保存" :
|
2025-09-28 17:45:29 +08:00
|
|
|
'修改'}
|
|
|
|
|
</Button>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ModalForm;
|