|
@@ -45,6 +45,39 @@
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
const title = ref('新增客户');
|
|
const title = ref('新增客户');
|
|
const optionsName = ref([]);
|
|
const optionsName = ref([]);
|
|
|
|
+ const range = (start, end) => {
|
|
|
|
+ const result = [];
|
|
|
|
+ for (let i = start; i < end; i++) {
|
|
|
|
+ result.push(i);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const disabledTime = (date) => {
|
|
|
|
+ const hour = dayjs().hour(); // 获取当前的小时
|
|
|
|
+ const min = dayjs().minute(); // 获取当前的分钟
|
|
|
|
+ const second = dayjs().second(); // 获取当前秒
|
|
|
|
+ if (dayjs(date).format('YYYY-MM-DD') === dayjs().format('YYYY-MM-DD')) {
|
|
|
|
+ if (dayjs(date).format('HH') === dayjs().format('HH')) {
|
|
|
|
+ if (dayjs(date).format('mm') === dayjs().format('mm')) {
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, 24).splice(0, hour),
|
|
|
|
+ disabledMinutes: () => range(0, 60).splice(0, min),
|
|
|
|
+ disabledSeconds: () => range(0, 60).splice(0, second),
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, 24).splice(0, hour),
|
|
|
|
+ disabledMinutes: () => range(0, 60).splice(0, min),
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, 24).splice(0, hour),
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
const schemas: FormSchema[] = [
|
|
const schemas: FormSchema[] = [
|
|
{
|
|
{
|
|
field: 'num',
|
|
field: 'num',
|
|
@@ -139,14 +172,15 @@
|
|
type: 'datetime',
|
|
type: 'datetime',
|
|
format: 'YYYY-MM-DD HH:mm',
|
|
format: 'YYYY-MM-DD HH:mm',
|
|
disabledDate: (current) => {
|
|
disabledDate: (current) => {
|
|
- return current && current < dayjs();
|
|
|
|
|
|
+ return current && current < dayjs().startOf('day');
|
|
},
|
|
},
|
|
|
|
+ disabledTime: disabledTime,
|
|
onChange: (value) => {
|
|
onChange: (value) => {
|
|
updateSchema({
|
|
updateSchema({
|
|
field: 'lookEndTime',
|
|
field: 'lookEndTime',
|
|
componentProps: {
|
|
componentProps: {
|
|
disabledDate: (current) => {
|
|
disabledDate: (current) => {
|
|
- return current && (current < dayjs().endOf('day') || current > dayjs(value));
|
|
|
|
|
|
+ return current && (current < dayjs().startOf('day') || current > dayjs(value));
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
});
|
|
@@ -187,6 +221,7 @@
|
|
},
|
|
},
|
|
valueFormat: 'YYYY-MM-DD HH:mm',
|
|
valueFormat: 'YYYY-MM-DD HH:mm',
|
|
format: 'YYYY-MM-DD HH:mm',
|
|
format: 'YYYY-MM-DD HH:mm',
|
|
|
|
+ disabledTime: disabledTime,
|
|
disabledDate: (current) => {
|
|
disabledDate: (current) => {
|
|
console.log('current', current);
|
|
console.log('current', current);
|
|
return current && current < dayjs();
|
|
return current && current < dayjs();
|
|
@@ -284,10 +319,11 @@
|
|
if (checkAuthOther.editEndTime) {
|
|
if (checkAuthOther.editEndTime) {
|
|
return (
|
|
return (
|
|
current &&
|
|
current &&
|
|
- (current < dayjs().endOf('day') || current > dayjs(checkAuthOther.editEndTime))
|
|
|
|
|
|
+ (current < dayjs().startOf('day') ||
|
|
|
|
+ current > dayjs(checkAuthOther.editEndTime))
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- return current && current < dayjs().endOf('day');
|
|
|
|
|
|
+ return current && current < dayjs().startOf('day');
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -300,10 +336,11 @@
|
|
if (checkAuthOther.lookEndTime) {
|
|
if (checkAuthOther.lookEndTime) {
|
|
return (
|
|
return (
|
|
current &&
|
|
current &&
|
|
- (current < dayjs().endOf('day') || current > dayjs(checkAuthOther.lookEndTime))
|
|
|
|
|
|
+ (current < dayjs().startOf('day') ||
|
|
|
|
+ current > dayjs(checkAuthOther.lookEndTime))
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- return current && current < dayjs().endOf('day');
|
|
|
|
|
|
+ return current && current < dayjs().startOf('day');
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -317,6 +354,7 @@
|
|
}
|
|
}
|
|
// return option.value.indexOf(inputText.toUpperCase()) >= 0;
|
|
// return option.value.indexOf(inputText.toUpperCase()) >= 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
async function onSearch(searchText) {
|
|
async function onSearch(searchText) {
|
|
const list = await getByRyId({ ryId: searchText });
|
|
const list = await getByRyId({ ryId: searchText });
|
|
optionsName.value =
|
|
optionsName.value =
|
|
@@ -418,6 +456,7 @@
|
|
resetFields,
|
|
resetFields,
|
|
title,
|
|
title,
|
|
t,
|
|
t,
|
|
|
|
+ disabledTime,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
});
|
|
});
|