浏览代码

no message

linwenxin 8 月之前
父节点
当前提交
796dd59e66
共有 1 个文件被更改,包括 77 次插入2 次删除
  1. 77 2
      src/views/workOrder/workOrderPool/components/reschedule/index.vue

+ 77 - 2
src/views/workOrder/workOrderPool/components/reschedule/index.vue

@@ -37,6 +37,7 @@ export default {
     return {
       orderInfo: {
         appointmentTime: '',
+        appointmentEndTime: '',
         recordSelected: []
       }
     }
@@ -44,13 +45,38 @@ export default {
   computed: {
     serviceInfo() {
       return [
+        // {
+        //   isShow: this.formOptions.appointmentTime.isShow,
+        //   name: 'el-date-picker',
+        //   md: 8,
+        //   attributes: {
+        //     disabled: !this.formOptions.appointmentTime.isEdit,
+        //     style: { width: '100%' },
+        //     placeholder: '请选择',
+        //     'value-format': 'yyyy-MM-dd HH:mm:ss',
+        //     'picker-options': {
+        //       disabledDate: time => {
+        //         return time.getTime() < Date.now() - 86400000
+        //       }
+        //     }
+        //   },
+        //   formItemAttributes: {
+        //     label: '预约上门日期',
+        //     prop: 'appointmentTime',
+        //     rules: this.formOptions.appointmentTime.isRules
+        //   }
+        // },
         {
           isShow: this.formOptions.appointmentTime.isShow,
           name: 'el-date-picker',
           md: 8,
           attributes: {
             disabled: !this.formOptions.appointmentTime.isEdit,
+            'picker-options': 'pickerOptions11',
+            'popper-class': 'custom-popper11',
+            'append-to-body': true,
             style: { width: '100%' },
+            type: 'datetime',
             placeholder: '请选择',
             'value-format': 'yyyy-MM-dd HH:mm:ss',
             'picker-options': {
@@ -59,11 +85,60 @@ export default {
               }
             }
           },
+          events: {
+            change: value => {
+              if (value && new Date(value).getTime() < new Date().getTime() - 2000) {
+                this.orderInfo.appointmentTime = ''
+                this.$message.warning('必须大于当前时间')
+              } else {
+                this.orderInfo.appointmentEndTime = ''
+              }
+            }
+          },
           formItemAttributes: {
-            label: '预约上门日期',
+            label: '预约开始时间',
             prop: 'appointmentTime',
             rules: this.formOptions.appointmentTime.isRules
           }
+        },
+        {
+          isShow: this.formOptions.appointmentTime.isShow,
+          name: 'el-date-picker',
+          md: 8,
+          attributes: {
+            disabled: !this.formOptions.appointmentTime.isEdit,
+            'picker-options': 'pickerOptions11',
+            'popper-class': 'custom-popper11',
+            'append-to-body': true,
+            style: { width: '100%' },
+            type: 'datetime',
+            placeholder: '请选择',
+            'value-format': 'yyyy-MM-dd HH:mm:ss',
+            'picker-options': {
+              disabledDate: time => {
+                var data = this.orderInfo?.appointmentTime?.split(' ')?.[0]
+                return (
+                  time.getTime() < new Date(data ? `${data} 00:00:00` : '').getTime() ||
+                  time.getTime() > new Date(data ? `${data} 00:00:00` : '').getTime()
+                )
+              }
+            }
+          },
+          events: {
+            change: value => {
+              if (value && new Date(value).getTime() < new Date().getTime() - 2000) {
+                this.orderInfo.appointmentEndTime = ''
+                this.$message.warning('必须大于当前时间')
+              } else if (value && new Date(value).getTime() < new Date(this.orderInfo?.appointmentTime).getTime()) {
+                this.orderInfo.appointmentTime = value
+              }
+            }
+          },
+          formItemAttributes: {
+            label: '预约结束时间',
+            prop: 'appointmentEndTime',
+            rules: this.formOptions.appointmentTime.isRules
+          }
         }
       ]
     },
@@ -84,7 +159,7 @@ export default {
           changeOrderChangeAppointmentTime({
             ids: this.orderInfo.recordSelected.map(item => item.id),
             appointmentTime: this.orderInfo.appointmentTime,
-            appointmentEndTime: this.orderInfo.appointmentTime
+            appointmentEndTime: this.orderInfo.appointmentEndTime
           }).then(res => {
             this.$message({
               type: 'success',