Browse Source

fix():bug修改

master
xingjx 1 year ago
parent
commit
4598e26d12
  1. 5
      src/components/TableModule/index.jsx
  2. 25
      src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx
  3. 4
      src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx
  4. 73
      src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/TimePart.jsx

5
src/components/TableModule/index.jsx

@ -280,7 +280,10 @@ const TableModule = forwardRef((props, ref) => {
});
}
useEffect(() => {
!areaSelectedList.length && setTimeout( fetch,1000)
if (pageName == 'productOrderInquiryCar' || pageName == 'productOrderInquiry') {
return
}
!areaSelectedList.length && setTimeout(fetch, 1000)
}, [areaSelectedList])
function cascaderChange(value, options) {
let res = [];

25
src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx

@ -28,6 +28,7 @@ function AddModal(props) {
const isEdit = status === "edit";
const [getOperationName, setGetOperationName] = useState([])
const [getNewOperationName, setNewGetOperationName] = useState([])
const [timestatus, setTimestatus] = useState(true)
const operationName = () => {
ajax.getAllOperator().then(res => {
let arr = res.data
@ -57,6 +58,7 @@ function AddModal(props) {
});
function addEctiveDate() {
setTimestatus(false)
const randomNum = Math.floor(Math.random() * 1000);
const item = {
key: randomNum.toString() + Date.now().toString().substring(0, 6),
@ -78,15 +80,23 @@ function AddModal(props) {
}
//
function fetch(params) {
console.log(81, params, timePart)
//timePart()
console.log(81, params)
// if(params?.property?.rules){
// params.property.rules.map((item)=>{
// item.details.map((e)=>{
// e.items.map(()
// })
// if(!item.details){
// message.error("")
// return
// }
// // item.details.map((e)=>{
// // e.items.map(()
// // })
// })
// }
//return
if(!timestatus){
message.error("请填写完整!")
return
}
if (status === "add") {
ajax.addChargeRule(params).then((res) => {
if (res.status === 20000) {
@ -301,7 +311,10 @@ function AddModal(props) {
index={index + 1}
itemKey={item.key}
remove={removeEffectiveDate}
timePart={timePart}
timePart={(e) => { console.log(78787,e);setTimestatus(e) }}
validate={() => {
}}
onChange={(value, key) => {
const _effectiveDateList = effectiveDateList.map((item) => {
if (item.key === key) {

4
src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx

@ -18,12 +18,12 @@ function EffectiveDate(props) {
remove = () => { },
itemKey,
onChange = () => { },
validate= () => { },
timePart = () => { },
index,
disable = false,
record = {},
} = props;
console.log(25, record)
let ac = {
"unitDelay": 1,
"unitUp": 1,
@ -179,7 +179,7 @@ function EffectiveDate(props) {
)}
<Divider />
{timePartList.map((item, index) => {
console.log(180, timePartList);
//console.log(180, timePartList);
return (
<TimePart
disable={item.status === "disable"}

73
src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/TimePart.jsx

@ -9,7 +9,8 @@ import {
Row,
Col,
Divider,
InputNumber
InputNumber,
message
} from "antd";
import moment from "moment";
function TimePart(props) {
@ -39,17 +40,49 @@ function TimePart(props) {
"status": "disable",
"key": "821170365"
}
useEffect(() => {
console.log(43, form.getFieldsValue())
if (form.getFieldsValue().time_part == undefined) {
timePart(false)
}
}, [form])
const countDown = (time) => {
var s = 0;
var hour = time.split(':')[0];
var min = time.split(':')[1];
var sec = time.split(':')[2];
s = Number(hour * 3600) + Number(min * 60) + Number(sec);
return s;
}
const valueChange = (value, all) => {
timePart(value)
//timePart(value)
console.log(value)
if(value.limit){
form.validateFields(Object.keys(value))
}
// if (value.limit) {
// console.log(46)
// //form.validateFields(Object.keys(value))
// form.validateFields()
// .then(values => { console.log(values) })
// .catch(e => console.log(e))
// }
form.validateFields().then((data) => {
console.log(data)
}).catch(err => {
if (err.errorFields.length > 0) {
console.log('不完整')
timePart(false)
} else {
console.log('完整了',all, countDown(all.end) - countDown(all.start)<all.items[0].segment * 60 )
if ( countDown(all.end) - countDown(all.start) < all.items[0].segment * 60) {
message.error("输入的分钟数要小于时间段时间")
return
}
timePart(true)
}
})
all.key = itemKey;
if (all.time_part) {
all.start = moment(all.time_part[0]).format('HH:mm:ss')
all.end = moment(all.time_part[1]).format('HH:mm:ss')
delete all.time_part
}
if (all.type == 0) {
all.items = [
@ -65,7 +98,7 @@ function TimePart(props) {
"threshold": 0,
"period": all.time_after_minute,
"unit": all.time_after_money,
"segment": all.time_before,
"segment": all.time_part ? (moment(all.time_part[1]) - moment(all.time_part[0])) / 60000 - all.time_before : all.time_before,
},
]
delete all.type
@ -99,7 +132,8 @@ function TimePart(props) {
delete all.unit
delete all.segment
}
console.log(66, all)
delete all.time_part
//console.log(66, all)
onChange(all);
};
useEffect(() => {
@ -134,7 +168,6 @@ function TimePart(props) {
})
}
}, [])
console.log(30, record)
return (
<div className="timepart-box">
<Form
@ -155,7 +188,7 @@ function TimePart(props) {
>
<Row gutter={[30]}>
<Col span={16}>
<Form.Item label={`时段${index}`} name="time_part">
<Form.Item label={`时段${index}`} name="time_part" rules={[{ required: true, message: '请选择时间段!' }]}>
<TimePicker.RangePicker style={{ width: "50%" }} order={false} secondStep={60} />
</Form.Item>
</Col>
@ -199,11 +232,11 @@ function TimePart(props) {
return (
<>
<Input.Group compact>
<Form.Item name="time_before" label="前:" rules={[{ required: true }]}>
<Form.Item name="time_before" label="前:" rules={[{ required: true, message: '请输入内容!' }]} >
<InputNumber min={0} precision={0} addonAfter={"分钟"} />
</Form.Item>
<div className="wenzi">,</div>
<Form.Item name="time_before_money" noStyle rules={[{ required: true }]}>
<Form.Item name="time_before_money" noStyle rules={[{ required: true, message: '' }]}>
<InputNumber
min={0}
addonAfter={"元"}
@ -211,7 +244,7 @@ function TimePart(props) {
/>
</Form.Item>
<div className="wenzi">/</div>
<Form.Item name="time_before_minute" noStyle rules={[{ required: true }]}>
<Form.Item name="time_before_minute" noStyle rules={[{ required: true, message: '' }]}>
<InputNumber
min={1}
precision={0}
@ -221,11 +254,11 @@ function TimePart(props) {
</Form.Item>
</Input.Group>
<Input.Group compact>
<Form.Item name="time_before" label="满:" rules={[{ required: true }]}>
<Form.Item name="time_before" label="满:" rules={[{ required: true, message: '请输入内容!' }]} >
<InputNumber min={0} precision={0} addonAfter={"分钟"} disabled />
</Form.Item>
<div className="wenzi">,</div>
<Form.Item name="time_after_money" noStyle rules={[{ required: true }]}>
<Form.Item name="time_after_money" noStyle >
<InputNumber
min={0}
addonAfter={"元"}
@ -233,7 +266,7 @@ function TimePart(props) {
/>
</Form.Item>
<div className="wenzi">/</div>
<Form.Item name="time_after_minute" noStyle rules={[{ required: true }]}>
<Form.Item name="time_after_minute" noStyle rules={[{ required: true, message: '' }]}>
<InputNumber
min={1}
precision={0}
@ -247,11 +280,11 @@ function TimePart(props) {
case 2:
return (
<Input.Group compact>
<Form.Item name="unit" noStyle rules={[{ required: true }]}>
<Form.Item name="unit" noStyle rules={[{ required: true, message: '请输入内容!' }]} >
<InputNumber min={0} addonAfter={"元"} style={{ width: "20%" }} />
</Form.Item>
<div className="wenzi">/</div>
<Form.Item name="period" noStyle rules={[{ required: true }]}>
<Form.Item name="period" noStyle rules={[{ required: true, message: '' }]} >
<InputNumber min={1} precision={0} addonAfter={"分钟"} style={{ width: "20%" }} />
</Form.Item>
</Input.Group>
@ -259,7 +292,7 @@ function TimePart(props) {
case 1:
return (
<Form.Item name="unit">
<InputNumber min={0} addonAfter={"元/次"} style={{ width: "20%" }} />
<InputNumber min={0} addonAfter={"元/次"} style={{ width: "20%" }} rules={[{ required: true, message: '请输入内容!' }]} />
</Form.Item>
);
}
@ -277,7 +310,7 @@ function TimePart(props) {
<Form.Item
label="时段最高收费金额"
name="limit"
rules={[{ required: true }]}
rules={[{ required: true, message: '请输入内容!' }]}
>
<InputNumber min={0} addonAfter={"元"} />
</Form.Item>

Loading…
Cancel
Save