Commit 489fc3c6 authored by cellee's avatar cellee

预约时间大改

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 60587c01
import React from 'react';
import { TimePicker } from 'antd';
const { RangePicker } = TimePicker;
import moment from 'moment';
const OnTime = (porps: any) => {
// disabled 是否禁止
// limit 默认开放时间
// inhibitTime 禁止选择时间
// onChanges 时间选择事件
let { disabled, limit, inhibitTime, onChanges } = porps;
// 禁止时间 数组格式
const disabledHours = () => {
// 禁止的小时数组
let result = [];
// 设施默认的开放时间
let lim = limit ? limit.split('-') : [];
for (var i = 0; i < 24; i++) {
if (
i < parseInt(moment(lim[0], 'HH:ss').format('HH')) ||
i > parseInt(moment(lim[1], 'HH:ss').format('HH'))
) {
result.push(i);
}
}
// 选择日期禁止的时间
if (inhibitTime) {
for (let j in inhibitTime) {
result.push(parseInt(moment(inhibitTime[j], 'HH:ss').format('HH')));
}
}
// 去重排序
return [...new Set(result)].sort((x, y) => x - y);
};
return (
<>
<RangePicker
minuteStep={60}
format="HH:mm"
onChange={(time: any, timeString: any) => {
onChanges(time, timeString);
}}
allowClear={false}
disabled={disabled}
disabledHours={disabledHours}
/>
</>
);
};
export default OnTime;
...@@ -192,12 +192,7 @@ export default { ...@@ -192,12 +192,7 @@ export default {
} break; } break;
// 时间查询 // 时间查询
case 50:{ case 50:{
let resultTime = []; let resultTime = resp.data;
let data = resp.data;
for (var i = 0; i < data.length; i += 2){
let a = data[i] + '-' + data[i+1];
resultTime.push(a);
}
yield put({ type: 'onResult', resultTime }); yield put({ type: 'onResult', resultTime });
} break; } break;
......
...@@ -58,9 +58,9 @@ const BugDetail = (props: any) => { ...@@ -58,9 +58,9 @@ const BugDetail = (props: any) => {
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="Submission time" style={{ paddingBottom: 16 }}> <Descriptions.Item label="Submission time" style={{ paddingBottom: 16 }}>
{DataSave {DataSave
? moment(DataSave.updateTime.time).format('YYYY-MM-DD hh') + ? moment(DataSave.updateTime.time).format('YYYY-MM-DD hh:mm') +
':00' + // ':00' +
(parseInt(moment(DataSave.updateTime.time).format('HH')) > 11 ? 'PM' : 'AM') (parseInt(moment(DataSave.updateTime.time).format('HH')) > 11 ? ' PM' : ' AM')
: '-'} : '-'}
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
......
...@@ -31,9 +31,9 @@ const SystemFeedback = (props: any) => { ...@@ -31,9 +31,9 @@ const SystemFeedback = (props: any) => {
dataIndex: 'createTime', dataIndex: 'createTime',
render: (text: any) => { render: (text: any) => {
let data = let data =
moment(text.time).format('YYYY-MM-DD hh') + moment(text.time).format('YYYY-MM-DD hh:mm') +
':00' + // ':00' +
(parseInt(moment(text.time).format('HH')) > 11 ? 'PM' : 'AM'); (parseInt(moment(text.time).format('HH')) > 11 ? ' PM' : ' AM');
// let data = moment(text.time).calendar(); // let data = moment(text.time).calendar();
return data; return data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment