Browse Source

过滤空格

1178232204@qq.com 3 years ago
parent
commit
036299adf7

+ 19 - 19
src/components/BlockLossManage/index.js

@@ -7,7 +7,7 @@ import './index.less'
 import apiObj from '@api/index';
 import EditBlock from './editBlock';
 import BlockContext from './block-context';
-import { disabledDate } from '@utils/index'
+import { disabledDate, getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
@@ -185,18 +185,18 @@ function BlockLossManage() {
                             </Form.Item>
                         </Col>
                         <Col span={5} key={1}>
-                            <Form.Item label="住院序号" name="behospitalCode">
-                                <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={2}>
-                            <Form.Item label="文书编号" name="recId">
-                                <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="文书编号" name="recId" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={3}>
-                            <Form.Item label="文书标题" name="recTitle">
-                                <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="文书标题" name="recTitle" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={4}>
@@ -275,55 +275,55 @@ function BlockLossManage() {
                 <div className="table-data">
                     <Row className="data-box">
                         <Col span={6} order={1} className="data-item">
-                            <p>{blockData.hisNum || '-'}</p>
+                            <p>{blockData.hisNum || blockData.hisNum == 0 ? blockData.hisNum : '-'}</p>
                             <p>His</p>
                         </Col>
                         <Col span={6} order={2} className="data-item">
-                            <p>{blockData.logNum || '-'}</p>
+                            <p>{blockData.logNum || blockData.logNum == 0 ? blockData.logNum : '-'}</p>
                             <p>接口日志</p>
                         </Col>
                         <Col span={6} order={3} className="data-item">
-                            <p>{blockData.realNum || '-'}</p>
+                            <p>{blockData.realNum || blockData.realNum == 0 ? blockData.realNum : '-'}</p>
                             <p>实际</p>
                         </Col>
                         <Col span={6} order={4} className="data-item item" >
-                            <p>{blockData.allLossNum || '-'}</p>
+                            <p>{blockData.allLossNum || blockData.allLossNum == 0 ? blockData.allLossNum : '-'}</p>
                             <p>合计丢失</p>
                         </Col>
                     </Row>
                     <Row className="data-box">
                         <Col span={6} order={1} className="box-item">
-                            <p>{blockData.outRecNum || '-'}</p>
+                            <p>{blockData.outRecNum || blockData.outRecNum == 0 ? blockData.outRecNum : '-'}</p>
                             <p>文书丢失</p>
                         </Col>
                         <Col span={6} order={2} className="box-item">
-                            <p>{blockData.outHomePageNum || '-'}</p>
+                            <p>{blockData.outHomePageNum || blockData.outHomePageNum == 0 ? blockData.outHomePageNum : '-'}</p>
                             <p>病案首页丢失</p>
                         </Col>
                         <Col span={6} order={3} className="box-item">
-                            <p>{blockData.outCodeNum || '-'}</p>
+                            <p>{blockData.outCodeNum || blockData.outCodeNum == 0 ? blockData.outCodeNum : '-'}</p>
                             <p>病历号丢失</p>
                         </Col>
                         <Col span={6} order={4} className="box-item box">
-                            <p>{blockData.outLossNum || '-'}</p>
+                            <p>{blockData.outLossNum || blockData.outLossNum == 0 ? blockData.outLossNum : '-'}</p>
                             <p>外部丢失</p>
                         </Col>
                     </Row>
                     <Row className="data-box">
                         <Col span={6} order={1} className="box-item">
-                            <p>{blockData.inRecNum || '-'}</p>
+                            <p>{blockData.inRecNum || blockData.inRecNum == 0 ? blockData.inRecNum : '-'}</p>
                             <p>文书丢失</p>
                         </Col>
                         <Col span={6} order={2} className="box-item">
-                            <p>{blockData.inHomePageNum || '-'}</p>
+                            <p>{blockData.inHomePageNum || blockData.inHomePageNum == 0 ? blockData.inHomePageNum : '-'}</p>
                             <p>病案首页丢失</p>
                         </Col>
                         <Col span={6} order={3} className="box-item">
-                            <p>{blockData.inCodeNum || '-'}</p>
+                            <p>{blockData.inCodeNum || blockData.inCodeNum == 0 ? blockData.inCodeNum : '-'}</p>
                             <p>病历号丢失</p>
                         </Col>
                         <Col span={6} order={4} className="box-item box">
-                            <p>{blockData.inLossNum || '-'}</p>
+                            <p>{blockData.inLossNum || blockData.inLossNum == 0 ? blockData.inLossNum : '-'}</p>
                             <p>内部丢失</p>
                         </Col>
                     </Row>

+ 18 - 17
src/components/FieldProblem/index.js

@@ -8,6 +8,7 @@ import './index.less'
 import apiObj from '@api/index';
 import EditProblem from './editProblem';
 import ProblemContext from './problem-context';
+import { getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
@@ -143,7 +144,7 @@ function FieldProblem() {
         { title: '上传字段值', dataIndex: 'tableVal', key: 'tableVal' },
         {
             title: '备注', dataIndex: 'description', key: 'description', render: (text, record) => {
-                return (record.description||"").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
+                return (record.description || "-").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
             }
         },
         {
@@ -187,23 +188,23 @@ function FieldProblem() {
                             </Form.Item>
                         </Col>
                         <Col span={5} key={1}>
-                            <Form.Item label="住院序号" name="behospitalCode">
-                                <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={2}>
-                            <Form.Item label="文书编号" name="recId">
-                                <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="文书编号" name="recId" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={3}>
-                            <Form.Item label="文书标题" name="recTitle">
-                                <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="文书标题" name="recTitle" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={4}>
-                            <Form.Item label="质控模块名称" name="modeName">
-                                <Input placeholder="质控模块名称" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="质控模块名称" name="modeName" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="质控模块名称" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={5}>
@@ -256,37 +257,37 @@ function FieldProblem() {
                 <div className="table-data" style={{ justifyContent: 'left' }}>
                     <Row className="data-box">
                         <Col span={6} order={1} className="box-item">
-                            <p>{probleData.notSolvedNonnull || '-'}</p>
+                            <p>{probleData.notSolvedNonnull || probleData.notSolvedNonnull == 0 ? probleData.notSolvedNonnull : '-'}</p>
                             <p>数据缺失</p>
                         </Col>
                         <Col span={6} order={2} className="box-item">
-                            <p>{probleData.notSolvedStandardvalue || '-'}</p>
+                            <p>{probleData.notSolvedStandardvalue || probleData.notSolvedStandardvalue == 0 ? probleData.notSolvedStandardvalue : '-'}</p>
                             <p>非标准值</p>
                         </Col>
                         <Col span={6} order={3} className="box-item">
-                            <p>{probleData.notSolvedRegular || '-'}</p>
+                            <p>{probleData.notSolvedRegular || probleData.notSolvedRegular == 0 ? probleData.notSolvedRegular : '-'}</p>
                             <p>正则校验失败</p>
                         </Col>
                         <Col span={6} order={4} className="box-item item">
-                            <p>{probleData.notSolved || '-'}</p>
+                            <p>{probleData.notSolved || probleData.notSolved == 0 ? probleData.notSolved : '-'}</p>
                             <p>未处理</p>
                         </Col>
                     </Row>
                     <Row className="data-box">
                         <Col span={6} order={1} className="box-item">
-                            <p>{probleData.resolvedNonnull || '-'}</p>
+                            <p>{probleData.resolvedNonnull || probleData.resolvedNonnull == 0 ? probleData.resolvedNonnull : '-'}</p>
                             <p>数据缺失</p>
                         </Col>
                         <Col span={6} order={2} className="box-item">
-                            <p>{probleData.resolvedStandardvalue || '-'}</p>
+                            <p>{probleData.resolvedStandardvalue || probleData.resolvedStandardvalue == 0 ? probleData.resolvedStandardvalue : '-'}</p>
                             <p>非标准值</p>
                         </Col>
                         <Col span={6} order={3} className="box-item">
-                            <p>{probleData.resolvedRegular || '-'}</p>
+                            <p>{probleData.resolvedRegular || probleData.resolvedRegular == 0 ? probleData.resolvedRegular : '-'}</p>
                             <p>正则校验失败</p>
                         </Col>
                         <Col span={6} order={4} className="box-item box">
-                            <p>{probleData.resolved || '-'}</p>
+                            <p>{probleData.resolved || probleData.resolved == 0 ? probleData.resolved : '-'}</p>
                             <p>已处理</p>
                         </Col>
                     </Row>

+ 4 - 2
src/components/FieldRules/addRules.js

@@ -6,6 +6,7 @@ import backIcon from "@images/back.png";
 import FiledContext from './filed-context';
 import add from '@images/add-icon.png';
 import del from '@images/del-icon.png';
+import { getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { Option } = Select;
 const { TextArea } = Input;
@@ -324,7 +325,7 @@ function ContentForm(props) {
                         standardValueList.map((it, i) => {
                             return (
                                 <div className='box-2' key={i} >
-                                    <Form.Item name={['standardValueList', i, 'tit']} style={{ width: 159 }}>
+                                    <Form.Item name={['standardValueList', i, 'tit']} style={{ width: 159 }} getValueFromEvent={getValueFromEvent}>
                                         <Input autoComplete='off' placeholder="请输入" />
                                     </Form.Item>
                                     <img onClick={() => modifyStand(i)} src={i == 0 ? add : del} />
@@ -347,10 +348,11 @@ function ContentForm(props) {
                 <Form.Item hidden={true} name="regularId" noStyle>
                     <Input />
                 </Form.Item>
-                <Form.Item label="说明" name="description" rules={[{ max: 200, message: '说明不能超过200个字符' }]}>
+                <Form.Item label="说明" name="description" rules={[{ max: 200, message: '说明不能超过200个字符' }]} getValueFromEvent={getValueFromEvent}>
                     <TextArea
                         autoSize={{ minRows: 3, maxRows: 5 }}
                         placeholder="请输入"
+                        
                     />
                 </Form.Item>
             </Form>

+ 6 - 5
src/components/FieldRules/index.js

@@ -5,6 +5,7 @@ import '@common/common.less';
 import apiObj from '@api/index';
 import AddRules from './addRules';
 import FiledContext from './filed-context';
+import { getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { RangePicker } = DatePicker;
 const { Option } = Select;
@@ -163,7 +164,7 @@ function FieldRules() {
                         columnEname: data.columnEname,
                         tableCname: data.tableCname,
                         tableEname: data.tableEname,
-                        disable:true,
+                        disable: true,
                         id: data.id
                     }],
                     standardValueList: [{
@@ -226,7 +227,7 @@ function FieldRules() {
         },
         {
             title: '标准值维护', dataIndex: 'standardvalue', key: 'standardvalue', width: 110, render: (text, record) => {
-                return (record.standardvalue||"").length > 10 ? <span title={record.standardvalue}>{record.standardvalue.substring(0, 10) + '...'}</span> : record.standardvalue;
+                return (record.standardvalue || "-").length > 10 ? <span title={record.standardvalue}>{record.standardvalue.substring(0, 10) + '...'}</span> : record.standardvalue;
             }
         },
         {
@@ -236,7 +237,7 @@ function FieldRules() {
         },
         {
             title: '说明', dataIndex: 'description', key: 'description', render: (text, record) => {
-                return (record.description||"").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
+                return (record.description || "-").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
             }
         },
         {
@@ -325,8 +326,8 @@ function FieldRules() {
                             </Form.Item>
                         </Col>
                         <Col span={5} key={5}>
-                            <Form.Item label="标准值" name="standardValue">
-                                <Input placeholder="标准值" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="标准值" name="standardValue" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="标准值" autoComplete='off' allowClear maxLength='30'  />
                             </Form.Item>
                         </Col>
                         <Col span={5} key={6}>

+ 4 - 3
src/components/RegularManage/addRegular.js

@@ -4,6 +4,7 @@ import React, {
 import { Form, Modal, Button, message, Space, Input } from 'antd';
 import apiObj from '@api/index';
 import RegularContext from './regular-context';
+import { getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { TextArea } = Input;
 function EditBlock(props) {
@@ -54,16 +55,16 @@ function EditBlock(props) {
                 onFinish={onFinish}
                 initialValues={initialValues}
             >
-                <Form.Item label="正则式名称" name="name" rules={[{ required: true,message:'请输入正则式名称'},{ max: 30,message:'正则式名称不能超过30个字符' }]}>
+                <Form.Item label="正则式名称" name="name" getValueFromEvent={getValueFromEvent} rules={[{ required: true,message:'请输入正则式名称'},{ max: 30,message:'正则式名称不能超过30个字符' },{ pattern: /^[^\s]*$/,message: '请输入正则式名称',}]}>
                     <Input placeholder="请输入" autoComplete='off'/>
                 </Form.Item>
-                <Form.Item label="正则式值" name="val"rules={[{ required: true,message:'请输入正则式值'},{ max: 512,message:'正则式值不能超过512个字符' }]}>
+                <Form.Item label="正则式值" name="val"  rules={[{ required: true,message:'请输入正则式值'},{ max: 512,message:'正则式值不能超过512个字符' },{ pattern: /^[^\s]*$/,message: '请输入正则式值',}]}>
                     <TextArea
                         autoSize={{ minRows: 5, maxRows: 5 }}
                         placeholder="请输入"
                     />
                 </Form.Item>
-                <Form.Item label="说明" name="description" rules={[{ max: 200,message:'说明不能超过200个字符' }]}>
+                <Form.Item label="说明" name="description" getValueFromEvent={getValueFromEvent} rules={[{ max: 200,message:'说明不能超过200个字符' }]}>
                     <TextArea
                         autoSize={{ minRows: 5, maxRows: 5 }}
                         placeholder="请输入"

+ 5 - 4
src/components/RegularManage/index.js

@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space } from 'antd';
 import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
 import { getCookie } from '@utils/index'
+import { getValueFromEvent } from '@utils/index'
 import '@common/common.less';
 import apiObj from '@api/index';
 import AddRegular from './addRegular';
@@ -138,12 +139,12 @@ function RegularManage() {
         { title: '正则式名称', dataIndex: 'name', key: 'name' },
         {
             title: '正则式值', dataIndex: 'val', key: 'val', render: (text, record) => {
-                return record.val.length > 20 ? <span title={record.val}>{record.val.substring(0, 20)+'...'}</span>: record.val;
+                return record.val.length > 20 ? <span title={record.val}>{record.val.substring(0, 20) + '...'}</span> : record.val;
             }
         },
         {
             title: '说明', dataIndex: 'description', key: 'description', render: (text, record) => {
-                return record.description.length > 20 ? <span title={record.description}>{record.description.substring(0, 20)+'...'}</span> : record.description;
+                return (record.description || "-").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
             }
         },
         {
@@ -165,8 +166,8 @@ function RegularManage() {
                 >
                     <Row gutter={24}>
                         <Col span={5} key={0}>
-                            <Form.Item label="正则式名称" name="name">
-                                <Input placeholder="正则式名称" autoComplete='off' allowClear maxLength='30'/>
+                            <Form.Item label="正则式名称" name="name" getValueFromEvent={getValueFromEvent}>
+                                <Input placeholder="正则式名称" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
 

+ 3 - 3
src/utils/index.js

@@ -66,7 +66,7 @@ export function getTimeDetail() {
     return str;
 }
 export function getValueFromEvent(e) {
-    return e.target.value.replace(/(^\s*)|(\s*$)/g, '');
+    return e.target.value.replace(/\s*/g,"");
 }
 //存取cookie
 export function setCookie(cname, cvalue) {
@@ -101,6 +101,6 @@ export function filterIds(arr, str) {    //arr需遍历的数组;str需拼接
     })
 }
 
-export function disabledDate(current){
+export function disabledDate(current) {
     return current && current >= moment().endOf('day'); // 选择时间要大于等于当前天。若今天不能被选择,去掉等号即可。
-}
+}