Browse Source

fix: 所有时间选择插件input read only

ZhaoJun 1 year ago
parent
commit
6639084099

+ 19 - 8
src/components/ManagementPage/chartModal.js

@@ -1,8 +1,7 @@
 //图表弹窗
-import React, { useState } from 'react';
-import { Button, DatePicker, Modal, Form, Row, Col } from 'antd';
-import dayjs from 'dayjs';
 import ChartModule from '@/components/ManagementPage/chartModule';
+import { Button, Col, DatePicker, Form, Modal, Row } from 'antd';
+import dayjs from 'dayjs';
 const FormItem = Form.Item;
 function chartModal(props) {
   const {
@@ -18,7 +17,7 @@ function chartModal(props) {
     onCancel,
     sTimeInitialValue,
     eTimeInitialValue,
-    type = true //true 显示 false 隐藏时间查询
+    type = true, //true 显示 false 隐藏时间查询
   } = props;
   const handleSearch = () => {
     form.validateFields((err, fieldsValue) => {
@@ -39,7 +38,7 @@ function chartModal(props) {
       title={title}
       width="90%"
     >
-      {type &&
+      {type && (
         <Form
           layout="inline"
           // labelAlign="left"
@@ -51,14 +50,26 @@ function chartModal(props) {
               <FormItem label="开始时间">
                 {form.getFieldDecorator('start_date', {
                   initialValue: sTimeInitialValue || dayjs().subtract(1, 'M'),
-                })(<DatePicker allowClear={false} placeholder="选择开始日期" />)}
+                })(
+                  <DatePicker
+                    inputReadOnly
+                    allowClear={false}
+                    placeholder="选择开始日期"
+                  />,
+                )}
               </FormItem>
             </Col>
             <Col span={10}>
               <FormItem label="结束时间">
                 {form.getFieldDecorator('end_date', {
                   initialValue: eTimeInitialValue || dayjs(),
-                })(<DatePicker allowClear={false} placeholder="选择结束日期" />)}
+                })(
+                  <DatePicker
+                    inputReadOnly
+                    allowClear={false}
+                    placeholder="选择结束日期"
+                  />,
+                )}
               </FormItem>
             </Col>
             <Col span={2}>
@@ -73,7 +84,7 @@ function chartModal(props) {
             </Col>
           </Row>
         </Form>
-      }
+      )}
       <div style={{ height: 400, marginTop: 20 }}>
         <ChartModule
           yName={yName}

+ 2 - 0
src/components/ManagementPage/searchModule.js

@@ -70,6 +70,7 @@ function SearchModule(props) {
           initialValue={defaultValue[0]}
         >
           <DatePicker
+            inputReadOnly
             allowClear={false}
             placeholder="选择开始日期"
             className={styles.datePicker}
@@ -81,6 +82,7 @@ function SearchModule(props) {
           initialValue={defaultValue[1]}
         >
           <DatePicker
+            inputReadOnly
             allowClear={false}
             placeholder="选择结束日期"
             className={styles.datePicker}

+ 1 - 1
src/pages/EqSelfInspection/components/Detail.js

@@ -529,7 +529,7 @@ function ErrorHandleModal(props) {
               name="PlanTime"
               rules={[{ required: true, message: '请选择计划完成日期' }]}
             >
-              <DatePicker />
+              <DatePicker inputReadOnly />
             </Form.Item>
           </>
         )}

+ 1 - 0
src/pages/SmartOps/HistoryRecord.js

@@ -180,6 +180,7 @@ const HistoryRecord = (props) => {
       <div className={styles.searchContent}>
         日期:
         <RangePicker
+          inputReadOnly
           className={styles.timePicker}
           onChange={(value) => handleParamsChange('date', value)}
         />

+ 1 - 0
src/pages/SmartOps/OperationRecord.js

@@ -200,6 +200,7 @@ const OperationRecord = (props) => {
           </Button> */}
         日期:
         <RangePicker
+          inputReadOnly
           className={[styles.timePicker, styles.marginRight].join(' ')}
           onChange={(value) => handleParamsChange('date', value)}
         />

+ 2 - 1
src/pages/SmartOps/WorkAnalysisDetail.js

@@ -268,7 +268,7 @@ const ListContent = (props) => {
 
   const selectedItem = (e) => {
     setSelected(e);
-    setCurrent(current => [...current, `${active}&&${e}`]);
+    setCurrent((current) => [...current, `${active}&&${e}`]);
   };
 
   //通知unity切换tab发送tab数据
@@ -431,6 +431,7 @@ const ChartContent = (props) => {
     <div className={styles.chartBox}>
       <Form layout="inline" className={styles.form}>
         <RangePicker
+          inputReadOnly
           style={{ width: 250 }}
           allowClear={false}
           defaultValue={time}

+ 5 - 1
src/pages/TaskManage/components/MandateDetail.js

@@ -594,7 +594,11 @@ const DispatchTaskModal = (props) => {
           name="plan_end_time"
           rules={[{ required: true, message: '请选择完成时间' }]}
         >
-          <DatePicker style={{ width: '100%' }} placeholder="请选择完成时间" />
+          <DatePicker
+            inputReadOnly
+            style={{ width: '100%' }}
+            placeholder="请选择完成时间"
+          />
         </Form.Item>
       </Form>
     </Modal>