diff --git a/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx b/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx index b85fe36..7a1ba1c 100644 --- a/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx +++ b/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/AddModal.jsx @@ -26,10 +26,10 @@ function AddModal(props) { status = "add", research = () => { }, } = props; + const [arr, setArr] = useState([]) const isEdit = status === "edit"; const [getOperationName, setGetOperationName] = useState([]) const [getNewOperationName, setNewGetOperationName] = useState([]) - const [effDate, setEffDate] = useState() const [timestatus, setTimestatus] = useState(true) const [timevalidate, setTimevalidate] = useState(true) const operationName = () => { @@ -107,7 +107,7 @@ function AddModal(props) { // // }) // }) // } - if (!timestatus) { + if (timestatus.some(ele => ele === false)) { message.error("请填写完整!") return } @@ -118,6 +118,7 @@ function AddModal(props) { message.error('时段范围不能重叠!') return } + console.log(carr) //return if (status === "add") { ajax.addChargeRule(params).then((res) => { @@ -142,7 +143,7 @@ function AddModal(props) { //提交按钮 function submit() { //return - console.log(effectiveDateList, effDate) + console.log(effectiveDateList) form .validateFields() .then((res) => { @@ -332,10 +333,9 @@ function AddModal(props) { key={item.key} index={index + 1} itemKey={item.key} - effDate={(e) => { setEffDate({ ...e }) }} remove={removeEffectiveDate} - timePart={(e) => { console.log(78787, e); setTimestatus(e) }} - validate={(e) => { setTimevalidate(e) }} + timePart={(e) => { console.log(78787, e); setTimestatus(e) }}//时段内数据是否完整 + validate={(e) => { setTimevalidate(e) }}//时段填写是否符合要求 onChange={(value, key) => { const _effectiveDateList = effectiveDateList.map((item) => { if (item.key === key) { diff --git a/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx b/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx index 21ce667..ed2a815 100644 --- a/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx +++ b/src/pages/OutRoadMgm/OutSegmentMgm/ChargeRulesMgm/EffectiveDate.jsx @@ -13,6 +13,7 @@ import { } from "antd"; import TimePart from "./TimePart"; import moment from "moment"; +var carr = [] function EffectiveDate(props) { const { remove = () => { }, @@ -20,7 +21,6 @@ function EffectiveDate(props) { onChange = () => { }, validate = () => { }, timePart = () => { }, - effDate= () => { }, index, disable = false, record = {}, @@ -96,7 +96,7 @@ function EffectiveDate(props) { } if (total === 1440) { if ([...new Set(arr)].length != timePartList.length) { - message.error('时段范围不能重叠!') + //message.error('时段范围不能重叠!') return 2 } return 1; @@ -119,12 +119,18 @@ function EffectiveDate(props) { }); } useEffect(() => { - console.log('biandd ') validate(isOneDay()) }, [timePartList]) const valueChange = (value, all) => { console.log(value, all) - effDate(all) + const obj1 = { + ...form.getFieldsValue(), + details: timePartList, + }; + if (obj1.date !== void 0) { + obj1.date = obj1.date.format("YYYY-MM-DD"); + } + onChange(obj1, itemKey); } return (