diff --git a/src/pages/plan/add/step1.js b/src/pages/plan/add/step1.js index e3bb227c..ad3bd8e6 100644 --- a/src/pages/plan/add/step1.js +++ b/src/pages/plan/add/step1.js @@ -126,13 +126,9 @@ export default class acclist extends React.Component{ model:model2 }); } - onDisabledCombinedDate = (val)=>{ - - console.log(val.getTime()) - console.log(new Date().getTime()) - - - return val.getDate() < new Date(); + onDisabledCombinedDate = (val)=>{ + + return val.getTime() < new Date().getTime(); } render(){ //校验规则 diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 3dc512bc..208d8354 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -12,6 +12,7 @@ import Addruleform from "./addruleform/addruleform" import Productform from "../product/add" import Bus from "../../../assets/eventBus.js" import _ from "lodash"; +import moment from "moment" const TabPanel = Tabs.TabPanel; export default class acclist extends React.Component{ @@ -258,6 +259,22 @@ export default class acclist extends React.Component{ this.setState({distdata:this.state.distdata}) console.log(this.state.distdata) } + + onDisabledCombinedDate = (val)=>{ + + let step1 = JSON.parse (sessionStorage.getItem("step1")); + let str = moment(val).format("YYYY-MM-DD HH:mm:ss") + + + + let isBetween = moment(str).isBetween(step1.begin_time,step1.end_time); + console.log(isBetween) + + return isBetween + } + + + render(){ const Column = [ { @@ -591,6 +608,7 @@ export default class acclist extends React.Component{ format: 'HH:mm:ss', defaultTime: ['12:00:00', '23:59:59'], }} + disabledDate={this.onDisabledCombinedDate} format="YYYY-MM-DD HH:mm:ss" onChange={(e)=>{ diff --git a/src/pages/plan/edit/step2.js b/src/pages/plan/edit/step2.js index 3437c9b5..0eedc744 100644 --- a/src/pages/plan/edit/step2.js +++ b/src/pages/plan/edit/step2.js @@ -54,6 +54,11 @@ export default class acclist extends React.Component{ // model2.style = e; // this.setState({model:model2}) } + + onDisabledCombinedDate = (val)=>{ + + return val.getTime() < new Date().getTime(); + } render(){ const Column = [ {