Ver Fonte

提交移动端过滤时间

Lijy há 3 meses atrás
pai
commit
f7887175d1

+ 8 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/addEditor.vue

@@ -181,7 +181,7 @@
 
       <!-- 选择时间 -->
       <van-popup v-model:show="showDateTimePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
-        <van-time-picker v-model="showDatePickerTimeVal" @confirm="showPickerTimeConfirm" @cancel="showDateTimePicker = false" />
+        <van-time-picker v-model="showDatePickerTimeVal" @confirm="showPickerTimeConfirm" @cancel="showDateTimePicker = false" :filter="filterTimePicker" />
       </van-popup>
     </div>
   </div>
@@ -256,6 +256,13 @@ const contactDisabled = computed(() => {
   return false
 })
 
+function filterTimePicker(type, options) {
+  if (type === 'minute') {
+    return options.filter(option => Number(option.value) % 30 === 0);
+  }
+  return options;
+}
+
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
     let formValue = {

+ 10 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/detail.vue

@@ -71,7 +71,7 @@
 
     <!-- 选择时间 -->
     <van-popup v-model:show="showDateTimePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
-      <van-time-picker v-model="showDatePickerTimeVal" @confirm="showPickerTimeConfirm" @cancel="showDateTimePicker = false" />
+      <van-time-picker v-model="showDatePickerTimeVal" @confirm="showPickerTimeConfirm" @cancel="showDateTimePicker = false" :filter="filterTimePicker" />
     </van-popup>
   </div>
 </template>
@@ -122,6 +122,13 @@ watch(() => props.info, (newValue) => {
   initializeData(newValue.id)
 })
 
+function filterTimePicker(type, options) {
+  if (type === 'minute') {
+    return options.filter(option => Number(option.value) % 30 === 0);
+  }
+  return options;
+}
+
 function showPickerTimeConfirm({ selectedValues }) {
   if(showDateType.value == 'showStartDelayData') {
     showStartDelayData.value = `${showDatePickerVal.value.join('-')} ${selectedValues.join(':')}` 
@@ -153,8 +160,8 @@ function showDatePickerCli(type) {
 }
 
 function restartTask() {
-  showStartDelayData.value = infoData.value.startDate ? infoData.value.startDate : dayjs().format("YYYY-MM-DD HH:mm")
-  showEndtDelayData.value = infoData.value.endDate ? infoData.value.endDate : dayjs().format("YYYY-MM-DD HH:mm")
+  showStartDelayData.value = infoData.value.startDate ? infoData.value.startDate : `${dayjs().format("YYYY-MM-DD HH")}:00`
+  showEndtDelayData.value = infoData.value.endDate ? infoData.value.endDate : `${dayjs().format("YYYY-MM-DD HH")}:00`
   showDelay.value = true
 }
 function delayTimeEvent() {