Browse Source

公出时间增加不能小于当前时间的限制

dev01 2 days ago
parent
commit
4a4f0f50e4
2 changed files with 24 additions and 10 deletions
  1. 15 4
      src/pages/applyDepart/publicContent.jsx
  2. 9 6
      src/pages/egressDetails/index.jsx

+ 15 - 4
src/pages/applyDepart/publicContent.jsx

@@ -480,15 +480,26 @@ class PublicContent extends Component {
               isPartition
               pickerShow={this.state.isPickerRender}
               onconditionaljudgment={(v) => {
-                let a = dayjs(
+                let startTimeD = dayjs(
+                  dayjs(v.detail.startTime)
+                    .second(0)
+                    .format("YYYY-MM-DD HH:mm:ss")
+                );
+                let endTimeD = dayjs(
                   dayjs(v.detail.endTime)
                     .second(0)
                     .format("YYYY-MM-DD HH:mm:ss")
                 );
-                let b = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
-                if (a.isBefore(b)) {
+                let currTimeD = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
+                if (!startTimeD.isAfter(currTimeD)) {
+                  Taro.showToast({
+                    title: "开始时间不能小于当前时间",
+                    icon: "none",
+                  });
+                  v.detail.setLv(false);
+                } else if (!endTimeD.isAfter(startTimeD)) {
                   Taro.showToast({
-                    title: "结束时间不能小于当前时间",
+                    title: "结束时间不能小于开始时间",
                     icon: "none",
                   });
                   v.detail.setLv(false);

+ 9 - 6
src/pages/egressDetails/index.jsx

@@ -982,13 +982,16 @@ class EgressDetails extends Component {
             });
           }}
           onDetermine={() => {
-            this.state.inquiryFn();
             this.setState({
-              isInquiryOpened: false,
-              inquiryTitle: "",
-              inquiryContent: "",
-              isNo: true,
-              inquiryFn: () => { },
+              isInquiryOpened: false
+            }, () => {
+              this.state.inquiryFn();
+              this.setState({
+                inquiryTitle: "",
+                inquiryContent: "",
+                isNo: true,
+                inquiryFn: () => { },
+              });
             });
           }}
         />