Kaynağa Gözat

时间选择器限制

1178232204@qq.com 3 yıl önce
ebeveyn
işleme
80a20502c5

Dosya farkı çok büyük olduğundan ihmal edildi
+ 21039 - 22
package-lock.json


+ 0 - 1
src/api/request.js

@@ -124,7 +124,6 @@ const request = {
     getColumnResultNumber:'/daqe-center/columnResultManagement/getColumnResultNumber',//字段校验问题明细数量
     dataCheck:'/daqe-center/columnResultManagement/dataCheck',//数据校验
     updateColumnResult:'/daqe-center/columnResultManagement/updateColumnResult',//修改
-    
 
     getBlockLossPage:'/daqe-center/blockLossManage/getBlockLossPage',//病历数据丢失明细列表
     upBlockLossById:'/daqe-center/blockLossManage/upBlockLossById',//病历数据丢失明细修改

+ 12 - 1
src/components/BlockLossManage/editBlock.js

@@ -13,9 +13,9 @@ function EditBlock(props) {
     useEffect(() => {
     }, []);
     const [form] = Form.useForm();
+    const [dates, setDates] = useState([]);
     const { blockDetail, type } = useContext(BlockContext);
     const initialValues = blockDetail;
-    console.log(initialValues);
     const onFinish = values => {
         if (type == 1) {
 
@@ -42,6 +42,14 @@ function EditBlock(props) {
             }
         })
     }
+    function disabledDate(current) {
+        if (!dates || dates.length === 0) {
+            return current && current >= moment().endOf('day');
+        }
+        const tooLate = dates[0] && current.diff(dates[0], 'days') > 30;
+        const tooEarly = dates[1] && dates[1].diff(current, 'days') > 30;
+        return current && current >= moment().endOf('day') || tooEarly || tooLate;
+    };
     //数据对比
     function dataCompare(values) {
         values.startDate = moment(values.time[0]).format('YYYY-MM-DD 00:00:00');
@@ -74,6 +82,7 @@ function EditBlock(props) {
                 layout={type == 3 ? 'inline' : 'horizontal'}
                 onFinish={onFinish}
                 initialValues={initialValues}
+                className='block'
             >
                 <Col span={12} hidden={type != 3}>
                     <Form.Item
@@ -157,6 +166,8 @@ function EditBlock(props) {
                         <Form.Item label="日期" name="time" rules={[{ required: true }]} labelAlign="right">
                             <RangePicker
                                 placeholder={['开始时间', '结束时间']}
+                                disabledDate={disabledDate}
+                                onCalendarChange={val => setDates(val)}
                             />
                         </Form.Item>
                         : ''}

+ 2 - 24
src/components/BlockLossManage/index.js

@@ -7,6 +7,7 @@ import './index.less'
 import apiObj from '@api/index';
 import EditBlock from './editBlock';
 import BlockContext from './block-context';
+import { disabledDate } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
@@ -84,29 +85,7 @@ function BlockLossManage() {
         setCurrent(page)
         getBlockLossPage()
     }
-    const disabledDate = (current) => {
-        return current && current >= moment().endOf('day'); // 选择时间要大于等于当前天。若今天不能被选择,去掉等号即可。
-    }
-    const range = (start, end) => {
-        const result = [];
-        for (let i = start; i <= end; i++) {
-            result.push(i);
-        }
-        return result;
-    };
-    const disabledDateTime = (dates, partial) => {
-        let hours = moment().hours();//0~23
-        let minutes = moment().minutes();//0~59
-        let seconds = moment().seconds();//0~59
-        //当日只能选择当前时间之后的时间点
-        if (dates && moment(dates[1]).date() === moment().date() && partial == 'end') {
-            return {
-                disabledHours: () => range(hours + 1, 23),
-                disabledMinutes: () => range(minutes + 1, 59),
-                disabledSeconds: () => range(seconds + 1, 59),
-            };
-        }
-    }
+    
     //返回
     function cancel() {
         setVisible(false)
@@ -187,7 +166,6 @@ function BlockLossManage() {
                             <Form.Item label="日期" name="time">
                                 <RangePicker
                                     disabledDate={disabledDate} // 限制日期不可选
-                                    disabledTime={disabledDateTime}
                                     placeholder={['开始时间', '结束时间']}
                                 />
                             </Form.Item>

+ 4 - 4
src/components/BlockLossManage/index.less

@@ -63,8 +63,8 @@
     }
   }
 }
-.ant-form-inline .ant-form-item > .ant-form-item-label {
-  flex: none;
-  text-align: right;
-  width: 70px;
+.block {
+  .ant-form-item-label {
+    width: 70px;
+  }
 }

+ 209 - 205
src/components/DutyRecord/index.js

@@ -1,225 +1,229 @@
 import React, { useState, useEffect, useRef } from 'react';
-import { Form, Input, Button, Table, Pagination, Row, Col, Select, Modal,DatePicker } from 'antd';
+import { Form, Input, Button, Table, Pagination, Row, Col, Select, Modal, DatePicker } from 'antd';
 import '@common/common.less';
 import apiObj from '@api/index';
 import moment from "moment";
 import "moment/locale/zh-cn"
-import {message} from "antd/lib/index";
+import { message } from "antd/lib/index";
+import { disabledDate } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
 function DutyRecord() {
-  useEffect(() => {
-	getDutyRecord();
-  }, []);
-  const [logList, setLogList] = useState([]);
-  const [total, setTotal] = useState(0);
-  const [visible, setVisible] = useState(false);
-  const [size, setSize] = useState(15);
-  const [current, setCurrent] = useState(1);
-  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
-  const [params, setParams] = useState({
-	pages: 1,
-	current: 1,
-	size: 15
-  });
-  const [form] = Form.useForm();
-  const typeMap = {
-    '1':'职务变更',
-	'2':'职称变更'
-  };
-  let data = {
-	pages: 1,
-	current: 1,
-	size: size
-  }
-  //表格数据
-  function getDutyRecord(param) {
-	post(api.getOfficialCapacityPage, param || params).then((res) => {
-	  if (res.data.code === 200) {
-		const data = res.data.data;
-		setLogList(data.records);
-		setTotal(data.total)
-	  }
-	})
-  }
-  //删除记录
-  function delRecord(){
-	post(api.delOfficialCapacityPage, {id:selectedRowKeys}).then((res) => {
-	  if (res.data.code === 200) {
-	    //刷新列表
-		getDutyRecord()
-	  }else{
-		message.warning(res.data.msg||'操作失败,请重试~');
-	  }
+	useEffect(() => {
+		getDutyRecord();
+	}, []);
+	const [logList, setLogList] = useState([]);
+	const [total, setTotal] = useState(0);
+	const [visible, setVisible] = useState(false);
+	const [size, setSize] = useState(15);
+	const [current, setCurrent] = useState(1);
+	const [selectedRowKeys, setSelectedRowKeys] = useState([]);
+	const [params, setParams] = useState({
+		pages: 1,
+		current: 1,
+		size: 15
 	});
-	showDelModal(false);
-  }
-  //删除弹窗确认
-  function showDelModal(flag){
-	  console.log(selectedRowKeys)
-    if(flag&&!selectedRowKeys.length){
-	  message.warning("请先选择要删除的记录~",1);
-	  return;
+	const [form] = Form.useForm();
+	const typeMap = {
+		'1': '职务变更',
+		'2': '职称变更'
+	};
+	let data = {
+		pages: 1,
+		current: 1,
+		size: size
+	}
+	//表格数据
+	function getDutyRecord(param) {
+		post(api.getOfficialCapacityPage, param || params).then((res) => {
+			if (res.data.code === 200) {
+				const data = res.data.data;
+				setLogList(data.records);
+				setTotal(data.total)
+			}
+		})
+	}
+	//删除记录
+	function delRecord() {
+		post(api.delOfficialCapacityPage, { id: selectedRowKeys }).then((res) => {
+			if (res.data.code === 200) {
+				//刷新列表
+				getDutyRecord()
+			} else {
+				message.warning(res.data.msg || '操作失败,请重试~');
+			}
+		});
+		showDelModal(false);
+	}
+	//删除弹窗确认
+	function showDelModal(flag) {
+		console.log(selectedRowKeys)
+		if (flag && !selectedRowKeys.length) {
+			message.warning("请先选择要删除的记录~", 1);
+			return;
+		}
+		setVisible(flag)
 	}
-	setVisible(flag)
-  }
-
-  function onSizeChange(current, pageSize) {
-	params.current = current
-	params.size = pageSize
-	setSize(pageSize)
-	setCurrent(current)
-	setParams(params)
-	getDutyRecord()
-  }
-  function changePage(page, pageSize) {
-	params.current = page
-	params.size = pageSize
-	setParams(params)
-	setCurrent(page)
-	getDutyRecord()
-  }
-	function onTypeChange(){
 
+	function onSizeChange(current, pageSize) {
+		params.current = current
+		params.size = pageSize
+		setSize(pageSize)
+		setCurrent(current)
+		setParams(params)
+		getDutyRecord()
 	}
-  function onSelectChange(selectedRowKeys){
-	setSelectedRowKeys(selectedRowKeys);
-  };
-  const onFinish = (value) => {
-	if (value.changeTime){
-	  value.changeTimeStart = moment(value.changeTime[0]).format('YYYY-MM-DD 00:00:00')
-	  value.changeTimeEnd = moment(value.changeTime[1]).format('YYYY-MM-DD 23:23:59')
+	function changePage(page, pageSize) {
+		params.current = page
+		params.size = pageSize
+		setParams(params)
+		setCurrent(page)
+		getDutyRecord()
 	}
-	const param = {
-	  ...data,
-	  ...value,
+	function onTypeChange() {
+
 	}
-	setCurrent(1)
-	setParams(param)
-	getDutyRecord(param);
-  };
-  const onReset = () => {
-	setCurrent(1)
-	setParams(data)
-	form.resetFields();
-	getDutyRecord(data);
-  };
-  const columns = [
-	{ title: '医生姓名', dataIndex: 'doctorName', key: 'doctorName' },
-	{ title: '科室', dataIndex: 'deptName', key: 'deptName' },
-	{ title: '工号', dataIndex: 'doctorCode', key: 'doctorCode' },
-	{ title: '变更时间', dataIndex: 'changeTime', key: 'changeTime' },
-	{ title: '职务/职称名称', dataIndex: 'name', key: 'name' },
-	{ title: '变更类型', dataIndex: 'type', key: 'type',render:(text,record)=>{
-	  return typeMap[record.type];
-  } },
-  ];
-  const rowSelection = {
-	selectedRowKeys,
-	onChange: onSelectChange,
-  };
-  return (
-	  <div className="wrapper">
-		<div className="filter-box">
-		  <Form
-			  form={form}
-			  name="normal_login"
-			  onFinish={onFinish}
-		  >
-			<Row gutter={24}>
-			  <Col span={5} key={0}>
-				<Form.Item label="医生姓名" name="doctorName">
-				  <Input placeholder="请输入" autoComplete='off'/>
-				</Form.Item>
-			  </Col>
-			  <Col span={5} key={1}>
-				<Form.Item label="科室" name="deptName">
-				  <Input placeholder="请输入" autoComplete='off'/>
-				</Form.Item>
-			  </Col>
-			  <Col span={5} key={2}>
-				<Form.Item label="工号" name="doctorCode">
-				  <Input placeholder="请输入" autoComplete='off'/>
-				</Form.Item>
-			  </Col>
-			  <Col span={5} key={3}>
-				<Form.Item label="职务/职称名称" name="name">
-				  <Input placeholder="请输入" autoComplete='off'/>
-				</Form.Item>
-			  </Col>
-			  <Col span={5} key={4}>
-				<Form.Item label="变更类型" name="type">
-				  <Select
-					  placeholder="请选择"
-					  onChange={onTypeChange}
-					  allowClear
-				  >
-					<Option value="0" key={0}>全部</Option>
-					<Option value="1" key={1}>{typeMap['1']}</Option>
-					<Option value="2" key={2}>{typeMap['2']}</Option>
-				  </Select>
-				</Form.Item>
-			  </Col>
-			  <Col span={7} key={5}>
-				<Form.Item label="变更时间" name="changeTime">
-				  <RangePicker
-					  placeholder={['开始时间', '结束时间']}
-				  />
-				</Form.Item>
-			  </Col>
-			  <Col span={6} key={6}>
-				<Form.Item>
-				  <Button type="primary" htmlType="submit">
-					查询
-				  </Button>
-				  <Button onClick={onReset}>
-					重置
-				  </Button>
-				</Form.Item>
-			  </Col>
-			</Row>
-		  </Form>
-		</div>
+	function onSelectChange(selectedRowKeys) {
+		setSelectedRowKeys(selectedRowKeys);
+	};
+	const onFinish = (value) => {
+		if (value.changeTime) {
+			value.changeTimeStart = moment(value.changeTime[0]).format('YYYY-MM-DD 00:00:00')
+			value.changeTimeEnd = moment(value.changeTime[1]).format('YYYY-MM-DD 23:23:59')
+		}
+		const param = {
+			...data,
+			...value,
+		}
+		setCurrent(1)
+		setParams(param)
+		getDutyRecord(param);
+	};
+	const onReset = () => {
+		setCurrent(1)
+		setParams(data)
+		form.resetFields();
+		getDutyRecord(data);
+	};
+	const columns = [
+		{ title: '医生姓名', dataIndex: 'doctorName', key: 'doctorName' },
+		{ title: '科室', dataIndex: 'deptName', key: 'deptName' },
+		{ title: '工号', dataIndex: 'doctorCode', key: 'doctorCode' },
+		{ title: '变更时间', dataIndex: 'changeTime', key: 'changeTime' },
+		{ title: '职务/职称名称', dataIndex: 'name', key: 'name' },
+		{
+			title: '变更类型', dataIndex: 'type', key: 'type', render: (text, record) => {
+				return typeMap[record.type];
+			}
+		},
+	];
+	const rowSelection = {
+		selectedRowKeys,
+		onChange: onSelectChange,
+	};
+	return (
+		<div className="wrapper">
+			<div className="filter-box">
+				<Form
+					form={form}
+					name="normal_login"
+					onFinish={onFinish}
+				>
+					<Row gutter={24}>
+						<Col span={5} key={0}>
+							<Form.Item label="医生姓名" name="doctorName">
+								<Input placeholder="请输入" autoComplete='off' />
+							</Form.Item>
+						</Col>
+						<Col span={5} key={1}>
+							<Form.Item label="科室" name="deptName">
+								<Input placeholder="请输入" autoComplete='off' />
+							</Form.Item>
+						</Col>
+						<Col span={5} key={2}>
+							<Form.Item label="工号" name="doctorCode">
+								<Input placeholder="请输入" autoComplete='off' />
+							</Form.Item>
+						</Col>
+						<Col span={5} key={3}>
+							<Form.Item label="职务/职称名称" name="name">
+								<Input placeholder="请输入" autoComplete='off' />
+							</Form.Item>
+						</Col>
+						<Col span={5} key={4}>
+							<Form.Item label="变更类型" name="type">
+								<Select
+									placeholder="请选择"
+									onChange={onTypeChange}
+									allowClear
+								>
+									<Option value="0" key={0}>全部</Option>
+									<Option value="1" key={1}>{typeMap['1']}</Option>
+									<Option value="2" key={2}>{typeMap['2']}</Option>
+								</Select>
+							</Form.Item>
+						</Col>
+						<Col span={7} key={5}>
+							<Form.Item label="变更时间" name="changeTime">
+								<RangePicker
+									disabledDate={disabledDate}
+									placeholder={['开始时间', '结束时间']}
+								/>
+							</Form.Item>
+						</Col>
+						<Col span={6} key={6}>
+							<Form.Item>
+								<Button type="primary" htmlType="submit">
+									查询
+								</Button>
+								<Button onClick={onReset}>
+									重置
+								</Button>
+							</Form.Item>
+						</Col>
+					</Row>
+				</Form>
+			</div>
 
-		<div className="table">
-		  <div className="table-header">
-			<h2 className="table-title">职务职称变更记录</h2>
-			<Button type="primary" onClick={()=>showDelModal(true)}>删除</Button>
-		  </div>
+			<div className="table">
+				<div className="table-header">
+					<h2 className="table-title">职务职称变更记录</h2>
+					<Button type="primary" onClick={() => showDelModal(true)}>删除</Button>
+				</div>
 
-		  <Table
-			  columns={columns}
-			  rowSelection={rowSelection}
-			  scroll={{ y: 'calc(100vh - 360px)' }}
-			  dataSource={logList}
-			  rowKey={record => record.id}
-			  pagination={{
-				pageSize: size,
-				size: 'small',
-				current: current,
-				showSizeChanger: true,
-				pageSizeOptions: ['15', '30', '60', '120'],
-				showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
-				onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
-				onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
-				total: total
-			  }} />
-		</div>
-		<Modal
-			title="删除职务职称变更记录"
-			okText='确定'
-			cancelText='取消'
-			width={400}
-			visible={visible}
-			onOk={delRecord}
-			/*confirmLoading={confirmLoading}*/
-			onCancel={()=>showDelModal(false)}
-		>
-		  <p>职务职称变更记录删除后将无法恢复,确认删除这{selectedRowKeys.length}条变更记录?</p>
-		</Modal>
-	  </div >
-  )
+				<Table
+					columns={columns}
+					rowSelection={rowSelection}
+					scroll={{ y: 'calc(100vh - 360px)' }}
+					dataSource={logList}
+					rowKey={record => record.id}
+					pagination={{
+						pageSize: size,
+						size: 'small',
+						current: current,
+						showSizeChanger: true,
+						pageSizeOptions: ['15', '30', '60', '120'],
+						showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
+						onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
+						onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
+						total: total
+					}} />
+			</div>
+			<Modal
+				title="删除职务职称变更记录"
+				okText='确定'
+				cancelText='取消'
+				width={400}
+				visible={visible}
+				onOk={delRecord}
+				/*confirmLoading={confirmLoading}*/
+				onCancel={() => showDelModal(false)}
+			>
+				<p>职务职称变更记录删除后将无法恢复,确认删除这{selectedRowKeys.length}条变更记录?</p>
+			</Modal>
+		</div >
+	)
 }
 
 export default DutyRecord;

+ 18 - 28
src/components/FieldProblem/editProblem.js

@@ -1,12 +1,11 @@
 import React, {
     useState, useEffect, useContext
 } from 'react';
-import { Form, Col, DatePicker, Button, Radio, TreeSelect, message, Space, Input } from 'antd';
+import { Form, Col, DatePicker, Button, message, Space, Input } from 'antd';
 import apiObj from '@api/index';
 import BlockContext from './problem-context';
 import moment from "moment";
 import "moment/locale/zh-cn"
-import { calcMinus, calcAdd } from '@utils/index'
 const { RangePicker } = DatePicker;
 const { post, api, xPost } = apiObj;
 const { TextArea } = Input;
@@ -14,12 +13,12 @@ function EditBlock(props) {
     useEffect(() => {
     }, []);
     const [form] = Form.useForm();
-    const [selectDate, setSelectDate] = useState(null);
+    const [dates, setDates] = useState([]);
     const { problemDetail, type } = useContext(BlockContext);
     const initialValues = problemDetail;
     const onFinish = values => {
         if (type == 1) {
-            dataCompare(values)
+            dataCheck(values)
         } else {
             editProblem(values)
         }
@@ -41,15 +40,15 @@ function EditBlock(props) {
         })
     }
     //数据对比
-    function dataCompare(values) {
+    function dataCheck(values) {
         values.startDate = moment(values.time[0]).format('YYYY-MM-DD 00:00:00');
         values.endDate = moment(values.time[1]).format('YYYY-MM-DD 23:23:59');
         let params = {
             behospitalCode: values.behospitalCode,
-            endDate: values.endDate,
-            startDate: values.startDate
+            dateEnd: values.endDate,
+            dateStart: values.startDate
         }
-        post(api.dataCompare, params).then((res) => {
+        post(api.dataCheck, params).then((res) => {
             if (res.data.code === 200) {
                 props.userChange()
                 message.success(res.data.message);
@@ -59,29 +58,21 @@ function EditBlock(props) {
             }
         })
     }
-    /* 控制下单时间选择范围30天 */
-    const disabledTaskDate = (current) => {
-        if (!current || !selectDate) return false;
-        const offsetV = 2592000000;                 //30天转换成ms
-        const selectV = selectDate.valueOf();
-        const currenV = current.valueOf();
-        return (calcMinus(currenV, offsetV) > selectV || calcAdd(currenV, offsetV) < selectV) ? true : false;
-    }
-    /* 选择任务时间变化 */
-    const onDateChange = (dates) => {
-        if (!dates || !dates.length) return;
-        setSelectDate(dates[0]);
-    }
-    const onDateOpenChange = () => {
-        setSelectDate(null);
-    }
+    function disabledDate(current) {
+        if (!dates || dates.length === 0) {
+            return current && current >= moment().endOf('day');
+        }
+        const tooLate = dates[0] && current.diff(dates[0], 'days') > 30;
+        const tooEarly = dates[1] && dates[1].diff(current, 'days') > 30;
+        return current && current >= moment().endOf('day') || tooEarly || tooLate;
+    };
     function cancel() {
         props.userChange()
     }
     return (
         <>
             <Form
-                labelCol={type == 3 ? { span: 12 } : { span: 4 }}
+                labelCol={type == 3 ? { span: 16 } : { span: 4 }}
                 wrapperCol={{ span: 16 }}
                 form={form}
                 name="register"
@@ -202,9 +193,8 @@ function EditBlock(props) {
                         <Form.Item label="日期" name="time" rules={[{ required: true }]} labelAlign="right">
                             <RangePicker
                                 placeholder={['开始时间', '结束时间']}
-                                disabledDate={disabledTaskDate}
-                                onCalendarChange={onDateChange}
-                                onOpenChange={onDateOpenChange}
+                                disabledDate={disabledDate}
+                                onCalendarChange={val => setDates(val)}
                             />
                         </Form.Item>
                         : ''}

+ 4 - 3
src/components/FieldProblem/index.js

@@ -1,6 +1,5 @@
 import React, { useState, useEffect, useRef } from 'react';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
-import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
 import { getCookie } from '@utils/index'
 import '@common/common.less';
 import moment from "moment";
@@ -9,6 +8,7 @@ import './index.less'
 import apiObj from '@api/index';
 import EditProblem from './editProblem';
 import ProblemContext from './problem-context';
+import { disabledDate } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
@@ -70,7 +70,7 @@ function FieldProblem() {
             }
         })
     }
-    
+
 
     //修改
     function showModal(title, row, type) {
@@ -167,6 +167,7 @@ function FieldProblem() {
                         <Col span={6} key={0}>
                             <Form.Item label="日期" name="time">
                                 <RangePicker
+                                    disabledDate={disabledDate}
                                     placeholder={['开始时间', '结束时间']}
                                 />
                             </Form.Item>
@@ -188,7 +189,7 @@ function FieldProblem() {
                         </Col>
                         <Col span={5} key={4}>
                             <Form.Item label="质控模块名称" name="modeName">
-                            <Input placeholder="请输入" autoComplete='off' />
+                                <Input placeholder="请输入" autoComplete='off' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={5}>

+ 1 - 3
src/components/FieldProblem/index.less

@@ -1,7 +1,5 @@
 .problem {
-  /deep/.ant-form-inline .ant-form-item > .ant-form-item-label {
-    flex: none;
-    text-align: right;
+  .ant-form-item-label {
     width: 130px;
   }
 }

+ 7 - 5
src/components/OperationLog/index.js

@@ -4,6 +4,7 @@ import '@common/common.less';
 import apiObj from '@api/index';
 import moment from "moment";
 import "moment/locale/zh-cn"
+import { disabledDate } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 function OperationLog() {
@@ -54,9 +55,9 @@ function OperationLog() {
   }
 
   const onFinish = (value) => {
-    if (value.time){
+    if (value.time) {
       value.startDate = moment(value.time[0]).format('YYYY-MM-DD')
-      value.endDate = moment(value.time[1]).format('YYYY-MM-DD') 
+      value.endDate = moment(value.time[1]).format('YYYY-MM-DD')
     }
     const param = {
       ...data,
@@ -98,13 +99,14 @@ function OperationLog() {
           <Row gutter={24}>
             <Col span={5} key={0}>
               <Form.Item label="操作人" name="operationName">
-                <Input placeholder="用户名" autoComplete='off'/>
+                <Input placeholder="用户名" autoComplete='off' />
               </Form.Item>
             </Col>
             <Col span={5} key={1}>
-              <Form.Item name="time">
+              <Form.Item name="time" label="操作日期">
                 <RangePicker
-                  placeholder={['开始时间', '结束时间']} 
+                  disabledDate={disabledDate}
+                  placeholder={['开始时间', '结束时间']}
                 />
               </Form.Item>
             </Col>

+ 4 - 35
src/utils/index.js

@@ -1,4 +1,6 @@
 import { message } from 'antd';
+import moment from "moment";
+import "moment/locale/zh-cn"
 //统一处理请求成功、失败
 
 export function handleResponse(res, callback, error) {
@@ -99,39 +101,6 @@ export function filterIds(arr, str) {    //arr需遍历的数组;str需拼接
     })
 }
 
-export function calcMinus(num1, num2) {
-    num1 = Number(num1);
-    num2 = Number(num2);
-    if (isNaN(num1) || isNaN(num2)) return 0;
-
-    const num1Digits = (num1.toString().split(".")[1] || "").length;
-    const num2Digits = (num2.toString().split(".")[1] || "").length;
-    const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits));
-    return (calcMulti(num1, baseNum) - calcMulti(num2, baseNum)) / baseNum;
-};
-
-export function calcAdd(num1, num2) {
-    num1 = Number(num1);
-    num2 = Number(num2);
-    if (isNaN(num1) || isNaN(num2)) return 0;
-    const num1Digits = (num1.toString().split(".")[1] || "").length;
-    const num2Digits = (num2.toString().split(".")[1] || "").length;
-    const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits));
-    return (calcMulti(num1, baseNum) + calcMulti(num2, baseNum)) / baseNum;
+export function disabledDate(current){
+    return current && current >= moment().endOf('day'); // 选择时间要大于等于当前天。若今天不能被选择,去掉等号即可。
 }
-/* 两个浮点数相乘 */
-export function calcMulti(num1, num2) {
-    num1 = Number(num1);
-    num2 = Number(num2);
-    if (isNaN(num1) || isNaN(num2)) return 0;
-    const num1String = num1.toString();
-    const num2String = num2.toString();
-    const num1Digits = (num1String.split(".")[1] || "").length;
-    const num2Digits = (num2String.split(".")[1] || "").length;
-    const baseNum = Math.pow(10, num1Digits + num2Digits);
-    return (
-        (Number(num1String.replace(".", "")) *
-            Number(num2String.replace(".", ""))) /
-        baseNum
-    );
-};

Dosya farkı çok büyük olduğundan ihmal edildi
+ 11442 - 10230
yarn.lock