Browse Source

数据对比时间问题修改

1178232204@qq.com 3 years ago
parent
commit
93d4b196ca

+ 2 - 2
src/components/BlockLossManage/editBlock.js

@@ -18,8 +18,8 @@ function EditBlock(props) {
     const { blockDetail, type } = useContext(BlockContext);
     const initialValues = blockDetail;
     const onFinish = values => {
-        values.startDate = moment(values.startDate).format('YYYY-MM-DD 00:00:00');
-        values.endDate = moment(values.endDate).format('YYYY-MM-DD 23:59:59');
+        values.startDate = values.startDate ? moment(values.startDate).format('YYYY-MM-DD 00:00:00') : null;
+        values.endDate = values.endDate ? moment(values.endDate).format('YYYY-MM-DD 23:59:59') : null;
         if (values.startDate > values.endDate) {
             message.warning('开始时间不能大于结束时间');
             return

+ 3 - 5
src/components/FieldProblem/editProblem.js

@@ -6,7 +6,7 @@ import apiObj from '@api/index';
 import BlockContext from './problem-context';
 import moment from "moment";
 import "moment/locale/zh-cn"
-import { disabledDate, getDaysBetween,getValueFromEvent } from '@utils/index'
+import { disabledDate, getDaysBetween, getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { TextArea } = Input;
 function EditBlock(props) {
@@ -18,9 +18,8 @@ function EditBlock(props) {
     const { problemDetail, type } = useContext(BlockContext);
     const initialValues = problemDetail;
     const onFinish = values => {
-        values.startDate = moment(values.startDate).format('YYYY-MM-DD 00:00:00');
-        values.endDate = moment(values.endDate).format('YYYY-MM-DD 23:59:59');
-        console.log(getDaysBetween(values.startDate, values.endDate));
+        values.startDate = values.startDate ? moment(values.startDate).format('YYYY-MM-DD 00:00:00') : null;
+        values.endDate = values.endDate ? moment(values.endDate).format('YYYY-MM-DD 23:59:59') : null;
         if (values.startDate > values.endDate) {
             message.warning('开始时间不能大于结束时间');
             return
@@ -227,7 +226,6 @@ function EditBlock(props) {
                         <Form.Item label="日期" >
                             <Form.Item name="startDate" className='times'>
                                 <DatePicker
-                                    allowClear={false}
                                     disabledDate={disabledDate}
                                     placeholder="请选择开始日期"
                                     onChange={onStartChange}

+ 1 - 1
src/components/FieldProblem/index.js

@@ -318,7 +318,7 @@ function FieldProblem() {
                 <div className="table-header">
                     <h2 className="table-title">字段校验问题明细</h2>
                     <Space size="middle">
-                        <Button type="primary" onClick={() => showModal('数据校验设置', { behospitalCode: '', time: '' }, 1)}>数据校验</Button>
+                        <Button type="primary" onClick={() => showModal('数据校验设置', { behospitalCode: '', startDate: null,endDate:null }, 1)}>数据校验</Button>
                     </Space>
 
                 </div>