Browse Source

日期修改

luolei 4 years ago
parent
commit
0624fae028

+ 5 - 5
src/components/AddInspect/SlidePic/index.jsx

@@ -120,10 +120,10 @@ class SlideSelect extends Component {
       refreshScroller()&&refreshScroller().scrollYTo(290);
     })*/
   }
-  handleInput(e,item,sign){
+  handleInput(e,item,sign,tip){
     const tempTimer = this.state.timer
     const {setTipValue} = this.props
-    setTipValue(item,e.target.value,sign)
+    setTipValue(item,e.target.value,sign,tip)
     if(sign == 2){
       let type = getArrow(item.minValue,item.maxValue,e.target.value||null)
       this.setState({
@@ -182,7 +182,7 @@ class SlideSelect extends Component {
                     placeholder='时间'
                     autoComplete="off"
                     value={item.time}
-                    onInput={(e)=>{this.handleInput(e,item,1)}}
+                    onInput={(e)=>{this.handleInput(e,item,idx)}}
                     onBlur={()=>{this.handleBlur()}}
                     />
               </span>
@@ -207,7 +207,7 @@ class SlideSelect extends Component {
               placeholder='(填写)'
               autoComplete="off"
               value={item.value||item.otherValue}
-              onInput={(e)=>{this.handleInput(e,item,2)}}
+              onInput={(e)=>{this.handleInput(e,item,idx)}}
               onBlur={()=>{this.handleBlur()}}
               /><img style={{display:style==1||style==2?'inline-block':'none'}} src={style==1?down:style==2?up:''} />{item.units}
           </span>
@@ -220,7 +220,7 @@ class SlideSelect extends Component {
                 placeholder='时间'
                 autoComplete="off"
                 value={item.time}
-                onInput={(e)=>{this.handleInput(e,item,1)}}
+                onInput={(e)=>{this.handleInput(e,item,idx,1)}}
                 onBlur={()=>{this.handleBlur()}}
                 />
           </span>

+ 2 - 2
src/containers/Inspect.js

@@ -99,8 +99,8 @@ function mapDispatchToProps(dispatch) {
       dispatch(delPartItem(idx))
       dispatch(getMRAnalyse())
     },
-    setTipValue(item,value,type) {
-      dispatch(setTips(item,value,type))
+    setTipValue(item,value,type,tip) {
+      dispatch(setTips(item,value,type,tip))
     },
     //右侧推送
     fetchPushInfos(obj) {

+ 2 - 2
src/store/actions/inspect.js

@@ -63,11 +63,11 @@ export const setContext = (obj) => ({
     type:SET_CONTEXT,
     obj
 })
-export const setTips = (item,value,sign) => ({
+export const setTips = (item,value,sign,tip) => ({
     type:SET_TIP_NEW,
     item,
     value,
-    sign
+    sign,tip
 })
 export const searchType = (value) => ({
     type:SEARCH_TYPE,

+ 9 - 9
src/store/reducers/inspect.js

@@ -94,18 +94,19 @@ export default (state = initSearchList, action) => {
         let tempArr = newState.labelListBig;
         let tempArrs = newState.labelListSmall;
         let tmpLis = action.item
-        console.log(action)
-        if(action.sign == 1){
-            tempArr = tempArr.filter((item)=>{
-                item.time = action.value
+        if(tmpLis.flg == 1){//大项,改的只能是时间
+            tempArr = tempArr.filter((item,idx)=>{
+                if(action.sign==idx){
+                    item.time = action.value
+                }
                 return item
             })
         }else{
-            tempArrs = tempArrs.filter((item)=>{
-                if(item.time == tmpLis.time){
-                    if(action.sign ==1){
+            tempArrs = tempArrs.filter((item,idx)=>{
+                if(action.sign == idx){
+                    if(action.tip==1){//小项改时间
                         item.time = action.value
-                    }else{
+                    }else{//小项该数值
                         if(isNumber(action.value-0)){
                             item.value = action.value
                         }else{
@@ -115,7 +116,6 @@ export default (state = initSearchList, action) => {
                 }
                 return item
             })
-
         }
         newState.labelListBig = [...tempArr]
         newState.labelListSmall = [...tempArrs]