Browse Source

回读div里的模拟placeholder清空,辅检出现两次,模板列表为空高度问题,火狐div清空还有个换行符去掉

Luolei 6 years ago
parent
commit
fca4a15e3a

+ 3 - 0
src/components/AddAssistCheck/Textarea/index.jsx

@@ -47,6 +47,9 @@ class Textarea extends Component {
     if(next.isRead != isRead){
       this.$dom.current.innerText = next.value||'';
     }
+    if(next.value && next.value.trim() != ''){
+      $("#textareaWarring").html('')
+    }
   }
   componentDidMount(){
     const {value} = this.props;

+ 2 - 2
src/components/AddAssistCheck/index.jsx

@@ -88,12 +88,12 @@ class AddAssistCheck extends React.Component {
         const {handleSign} = this.props;
         return <ul>
         {
-            list && list.map((item) => {
+            list && list.map((item,idx) => {
                 return <li key={item.id}
                     className={styles.searchLi}
                     title={item.name}
                     onClick={() => {
-                        handleSign(item.questionId);
+                        handleSign(item.questionId,idx);
                         this.setState({ show: false })
                     }}
                 >

+ 1 - 1
src/components/TemplateItems/index.jsx

@@ -66,7 +66,7 @@ class TemplateItems extends React.Component {
                         </div> :
                         <div className={style.wrapperTop}>
                             <span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
-                    </div>) : null
+                    </div>) : <div style={{height:'36px'}}></div>
                 }
                 <div className={style.tempLists} ref={this.$cont}>
                     {

+ 2 - 2
src/containers/AssistCheck.js

@@ -20,8 +20,8 @@ function mapDispatchToProps(dispatch, store) {
         handleChangeValue(val) {
             dispatch(getSearchList(val))
         },
-        handleSign(id){
-            dispatch(assistLable(id))
+        handleSign(id,idx){
+            dispatch(assistLable(id,idx))
         },
         handleDelAssist(idx){
             dispatch(delAssistLabel(idx))

+ 3 - 2
src/store/actions/assistCheck.js

@@ -4,9 +4,10 @@ export const searchList = (list) => ({         //获取搜索数据
     type:GET_ASSIST_SEARCH_LIST,
     list
 })
-export const assistLable = (id) => ({         //添加数据
+export const assistLable = (id,idx) => ({         //添加数据
     type:GET_ASSIST_LABEL,
-    id
+    id,
+    idx
 })
 export const delAssistLabel = (idx) => ({         //删除数据
     type:DEL_ASSIST_LABEL,

+ 9 - 5
src/store/reducers/assistCheck.js

@@ -32,14 +32,15 @@ export default (state = initSearchList, action) => {
         const tempArrs = newState.assistLabel;
         let tmpString = '';
         for (let i = 0; i < tempArr.length; i++) {
-            if (tempArr[i].questionId == action.id) {
+            if (tempArr[i].questionId == action.id && i == action.idx) {
                 tempArr[i].time = getCurrentDate();
                 tempArrs.push(tempArr[i]);
                 newState.assistLabel = [...tempArrs];
             }
         }
         for (let j = 0; j < tempArrs.length; j++) {
-            tmpString += (tempArrs[j].name+(tempArrs[j].value?(':'+tempArrs[j].value)+', ':': ')+(tempArrs[j].time?'报告日期:'+tempArrs[j].time:'')+';')
+            let tmpVal = tempArrs[j].value?tempArrs[j].value.trim():tempArrs[j].value;
+            tmpString += (tempArrs[j].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArrs[j].time?'报告日期:'+tempArrs[j].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;
@@ -54,7 +55,8 @@ export default (state = initSearchList, action) => {
             return
         }
         for (let i = 0; i < tempArr.length; i++) {
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
+            tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
         }
         newState.assistLabel = [...tempArr]
         newState.dataString = tmpString
@@ -69,7 +71,8 @@ export default (state = initSearchList, action) => {
                 tempArr[i].value = action.val
                 newState.assistLabel = [...tempArr]
             }
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
+            tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;
@@ -83,7 +86,8 @@ export default (state = initSearchList, action) => {
                 tempArr[i].time = action.date
                 newState.assistLabel = [...tempArr]
             }
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
+            tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;