Commit 6edfc099 by Zhang Xin

根据后台ç»接口修改平板故障上报

parent b021bb42
...@@ -63,6 +63,40 @@ const getUserinfo = (employeeId,storeId)=>{ ...@@ -63,6 +63,40 @@ const getUserinfo = (employeeId,storeId)=>{
}; };
let mock = {
data : {
flatCommonVo : {
currentTaskName: "故障上报",
currentTaskNum: 1,
currentTaskType: "ER",
taskId: 1040,
totalTaskNum: 3,
},
skuFlatVo : {
detailList : [{
"id": 660,
"storeId": 7,
"errorCode": "ER00021",
"type": "KN",
"description": "1:回零故障,2:直流电机回位错误或步进电机初始化错误(根据前一条故障代码判断)",
"taskId": 0,
"isExistProblem": 0,
"imagesFileId": "3879,3878,3846,3843",
"superType": 1,
"subType": 2,
"parentProblemType": 0,
"subProblemType": 0,
"explanation": null,
"handler": 0,
"parentProblemName": null,
"subProblemName": null,
"sellOrderNumber": "0"
}]
}
}
}
//拉取工单 //拉取工单
const getTaskList = (data={})=>{ const getTaskList = (data={})=>{
......
...@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch'; ...@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/trouble' import actionTypes from '../actiontype/trouble'
import userActionTypes from "../actiontype/user"; import userActionTypes from "../actiontype/user";
import {saveHeaderInfo} from './initHeader' import {saveHeaderInfo} from './initHeader'
import {saveCommonInfo} from "./common"; import {saveCommonInfo,getTaskList} from "./common";
const domain = ENV.domain; const domain = ENV.domain;
...@@ -178,21 +178,24 @@ const getTroubleList = (info) => { ...@@ -178,21 +178,24 @@ const getTroubleList = (info) => {
const updateTroubleList = (info, headerInfo) => { const updateTroubleList = (info, headerInfo) => {
let {taskInfo={},userInfo={},storeInfo={}} = headerInfo; let {taskInfo={},userInfo={},storeInfo={}} = headerInfo;
let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:storeInfo.employeeId,storeId:storeInfo.id}); let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id});
bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:"",storeId:""});
return (dispatch) => { console.log("updateTroubleList ",bodyData);
fetch(domain + 'machine_pad/save_all.action', { //todo 更新故障处理,并且获取新的工单
credentials: 'include', // return (dispatch) => {
method: 'POST', // fetch(domain + 'machine_pad/save_all.action', {
mode: 'cors', // credentials: 'include',
headers: myHeaders, // method: 'POST',
body: JSON.stringify(bodyData) // mode: 'cors',
}).then((response) => response.json()) // headers: myHeaders,
.then(json => { // body: JSON.stringify(bodyData)
}).catch(e => { // }).then((response) => response.json())
console.error(e) // .then(json => {
}) // getTaskList(headerInfo)
} // }).catch(e => {
// console.error(e)
// })
// }
}; };
export {getTroubleList, updateTroubleList} export {getTroubleList, updateTroubleList}
......
...@@ -18,7 +18,7 @@ export default class TextAreaContainer extends React.Component{ ...@@ -18,7 +18,7 @@ export default class TextAreaContainer extends React.Component{
componentWillMount() { componentWillMount() {
let {text} = this.props; let {text} = this.props;
this.setState({ this.setState({
text : text, text : text ? text : '',
originText : text, originText : text,
}) })
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
.textAreaContainer .textAreaDiv { .textAreaContainer .textAreaDiv {
width: 100%; width: 100%;
background-color: #f5f5f5; background-color: #fff;
height: 3.566666666666667rem; height: 3.566666666666667rem;
border: 2px solid #e5e5e5; border: 2px solid #e5e5e5;
border-radius: 0.08333333333333333rem; border-radius: 0.08333333333333333rem;
......
...@@ -9,16 +9,8 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -9,16 +9,8 @@ export default class TroubleItemComponent extends React.Component{
super(props) super(props)
this.state = { this.state = {
text: '', text: '',
imgStyle:{
'height':'100%',
} }
} }
this.reRreshImg = this.reRreshImg.bind(this)
this.deleteImgById = this.deleteImgById.bind(this)
this.confirmDeleteImg = this.confirmDeleteImg.bind(this)
this.addImg = this.addImg.bind(this)
this.showImg = this.showImg.bind(this)
}
getDes(item){ getDes(item){
let des = ""; let des = "";
...@@ -33,98 +25,10 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -33,98 +25,10 @@ export default class TroubleItemComponent extends React.Component{
return des; return des;
} }
reRreshImg(){
let props = this.props;
let item = props.item;
props.getRefreshImg(item.id,item.type)
}
addImg(){
let props = this.props;
let item = props.item;
props.showQrcode(item.errorCode)
}
deleteImgById(fileId){
console.log("deleteImgById :",fileId);
let props = this.props;
let {deleteImg,hidePopup} = props;
let item = props.item;
let errorId = item.id;
let type = item.type;
hidePopup();
deleteImg(errorId,type,fileId)
}
confirmDeleteImg(fileId){
let {showPopup,hidePopup} = this.props;
let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnDom1 = <Button key={"confirmDeleteTroubleImg1"} style={{'width':btnWidth}} text={"取消"} option={hidePopup}/>
let btnDom2 = <Button key={"confirmDeleteTroubleImg2"} style={{'width':btnWidth,'marginLeft':btnMarginLeft}} text={"确定"} option={()=>this.deleteImgById(fileId)}/>
let popDom = <PopModel popupText={"确定删除此照片吗"} popupButtons={[btnDom1,btnDom2]}/>
showPopup({popupChild:popDom});
// showPopup({
// popupText:'确定删除此照片吗',
// popupButtons:[btnDom1,btnDom2]
// })
}
showImg(imgSrc){
let {showPopup,hidePopup} = this.props;
let showImgDom = <div onClick={()=>hidePopup()} className={"showBigImg"}>
<img src={imgSrc} alt=""/>
</div>;
let popDom = <PopModel popupTitle={""} classContainer={"troubleContainerPopup"}>
{showImgDom}
</PopModel>;
showPopup({popupChild:popDom});
// showPopup({
// popupChild : showImgDom,
// showPopup : true
// });
}
render(){ render(){
let props = this.props; let props = this.props;
let item = props.item ? props.item : {}; let item = props.item ? props.item : {};
let description = this.getDes(item); let description = this.getDes(item);
let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{
return <ImageComponent key={"troubleItemImg"+k}
noCloseBtn={false}
handleClikCloseFunc = {()=>this.confirmDeleteImg(f.id)}
handleClikImgFunc = {()=>{this.showImg(f.filePath)}}
type={"custom"}
imgSrc = {f.filePath}/>
}) : [];
let imgLength = imgFiles.length;
if(imgLength < 9){
imgFiles.push(<ImageComponent showSrc={true} key={"troubleItemImgadd"+imgLength} disabled={!(item.isExistProblem && parseInt(item.isExistProblem) === 1)} type={"add"} handleClikImgFunc = {this.addImg} noCloseBtn = {true} />);
imgLength++;
}
imgFiles.push(<ImageComponent key={"troubleItemImgrefresh"+imgLength} handleClikImgFunc = {this.reRreshImg} type={"refresh"} noCloseBtn = {true} />);
let swiperOptions = {
width : 90,
spaceBetween: 20,
// freeMode:true,
// pagination: '.pagination',
// loop:false,
mode: 'horizontal',
touchRatio:0.5,
longSwipesRatio:0.1,
threshold:50,
lazyLoadingInPrevNext:true,
lazyLoading : true,
followFinger:false,
observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//修改swiper的父元素时,自动初始化swiper
lazyLoadingInPrevNextAmount: 11,
};
let swiperContainer = CONFIG.swiperContainers.troubleSwiperImgContainer + item.errorCode;
let swiperCount = imgLength+1;
let text = ""; let text = "";
if(item.explanation){ if(item.explanation){
text = item.explanation.length > 200 ? item.explanation.substring(0,200) + '...' : item.explanation text = item.explanation.length > 200 ? item.explanation.substring(0,200) + '...' : item.explanation
...@@ -162,10 +66,6 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -162,10 +66,6 @@ export default class TroubleItemComponent extends React.Component{
</div> </div>
</div> </div>
<div className={"itemControl rel"}>
{imgFiles}
</div>
</div> </div>
) )
} }
......
...@@ -117,7 +117,7 @@ class PageContainer extends React.Component { ...@@ -117,7 +117,7 @@ class PageContainer extends React.Component {
this.taskTypeOption = { this.taskTypeOption = {
'ER': this.showTroublePage, 'FIRST': this.showTroublePage,
'SECOND': this.showSecondTroubelPage 'SECOND': this.showSecondTroubelPage
}; };
} }
...@@ -151,10 +151,10 @@ class PageContainer extends React.Component { ...@@ -151,10 +151,10 @@ class PageContainer extends React.Component {
dispatch(getStoreInfo(data.storeId)); dispatch(getStoreInfo(data.storeId));
// dispatch(saveCommonInfo({ip:"192.168.10.128"})); // dispatch(saveCommonInfo({ip:"192.168.10.128"}));
// dispatch(getStoreInfo(20)); // dispatch(getStoreInfo(13));
// dispatch(saveCommonInfo({userInfo:{employeeId:9}})); // dispatch(saveCommonInfo({userInfo:{employeeId:9}}));
// dispatch(getUserinfo(9,20)) // dispatch(getUserinfo(9,13))
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'B'}}))) // dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}})))
// dispatch(saveCommonInfo({userInfo:{employeeId:20}})); // dispatch(saveCommonInfo({userInfo:{employeeId:20}}));
// dispatch(getUserinfo(20,data.storeId)); // dispatch(getUserinfo(20,data.storeId));
}); });
...@@ -739,6 +739,9 @@ class PageContainer extends React.Component { ...@@ -739,6 +739,9 @@ class PageContainer extends React.Component {
case showPage[12]: case showPage[12]:
pages =<TroubleContainer pages =<TroubleContainer
headerInfo={commonInfo} headerInfo={commonInfo}
showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()}
updateTroubleList={(info)=>dispatch(updateTroubleList(info,commonInfo))}
/> />
break; break;
case showPage[131]: case showPage[131]:
......
...@@ -6,8 +6,9 @@ export default class RightContainer extends React.Component{ ...@@ -6,8 +6,9 @@ export default class RightContainer extends React.Component{
} }
render(){ render(){
let {style={}} = this.props;
return( return(
<div className={"rightContainer"}> <div className={"rightContainer"} style={style}>
{this.props.children} {this.props.children}
</div> </div>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment