Commit de45c121 by Zhang Xin

填添加首é¡故障离åˆ列表»辑

parent 144150e6
...@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch'; ...@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/store' import actionTypes from '../actiontype/store'
const domain = ENV.domain; const domain = ENV.domain;
let mock = { let json = {
"meta": { "meta": {
"code": "200", "code": "200",
"message": "成功", "message": "成功",
...@@ -37,7 +37,12 @@ const getStoreInfo = ()=>{ ...@@ -37,7 +37,12 @@ const getStoreInfo = ()=>{
// .then(json=>{ // .then(json=>{
// console.log(json); // console.log(json);
// }).catch(e=>{console.error(e)}) // }).catch(e=>{console.error(e)})
dispatch(saveStoreInfo(mock.data)) if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(json.data.warehouse))
}else{
}
} }
} }
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/trouble' import actionTypes from '../actiontype/trouble'
import userActionTypes from "../actiontype/user";
const domain = ENV.domain; const domain = ENV.domain;
let mock = { let json = {
"meta": { "meta": {
"code": "200", "code": "200",
"message": "成功", "message": "成功",
...@@ -55,7 +56,7 @@ let mock = { ...@@ -55,7 +56,7 @@ let mock = {
"employee": { "employee": {
"id": 5, "id": 5,
"employeeName": "机器库管员", "employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg" "headImageUrl": "http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
}, },
"taskIds": [ "taskIds": [
155 155
...@@ -70,6 +71,15 @@ const saveTroubleList = (data)=>{ ...@@ -70,6 +71,15 @@ const saveTroubleList = (data)=>{
} }
}; };
const saveUserInfo = (data)=>{
return{
type : userActionTypes.SAVEUSERINFO,
data
}
}
const getTroubleList = ()=>{ const getTroubleList = ()=>{
return(dispatch)=>{ return(dispatch)=>{
// fetch(domain + '/web/pad_warehouse/getMachineData.action',{ // fetch(domain + '/web/pad_warehouse/getMachineData.action',{
...@@ -82,7 +92,14 @@ const getTroubleList = ()=>{ ...@@ -82,7 +92,14 @@ const getTroubleList = ()=>{
// .then(json=>{ // .then(json=>{
// console.log(json); // console.log(json);
// }).catch(e=>{console.error(e)}) // }).catch(e=>{console.error(e)})
dispatch(saveTroubleList(mock.data)) if(json.meta.success && json.data){
if(json.data.employee){
//存储用户信息
dispatch(saveUserInfo(json.data.employee));
}
dispatch(saveTroubleList(json.data))
}
} }
} }
......
const actionTypes = {
SAVEUSERINFO : 'SAVEUSERINFO',
}
export default actionTypes
\ No newline at end of file
import React from 'react'; import React from 'react';
require('./index.css') require('./index.css')
const headerStatus = { const headerStatus = CONFIG.headerStatus;
1 : 'home',
2 : 'other'
}
export default class HeaderComponent extends React.Component{ export default class HeaderComponent extends React.Component{
constructor(props){ constructor(props){
super(props); super(props);
this.getHomeHeader = this.getHomeHeader.bind(this); this.getHomeHeader = this.getHomeHeader.bind(this);
this.getOtherHeader = this.getOtherHeader.bind(this); this.getOtherHeader = this.getOtherHeader.bind(this);
this.state = { this.state = {
showHeader : headerStatus[2] showHeader : headerStatus[1]
} }
} }
componentWillReceiveProps(nextProps){
}
getHeader(){ getHeader(){
let pages = null; let pages = null;
switch (this.state.showHeader){ let {showHeader} = this.props;
switch (showHeader){
case headerStatus[1]: case headerStatus[1]:
pages = this.getHomeHeader(); pages = this.getHomeHeader();
break; break;
case headerStatus[2]: case headerStatus[2]:
pages = this.getOtherHeader(); pages = this.props.children;
break; break;
} }
...@@ -29,40 +30,66 @@ export default class HeaderComponent extends React.Component{ ...@@ -29,40 +30,66 @@ export default class HeaderComponent extends React.Component{
} }
getHomeHeader(){ getHomeHeader(){
return <div className={"homeHeader clearfix"}> let {storeInfo,userinfo} = this.props;
<div className={"headerContent leftContent fl"}> return (
<div className={"headerlogo"}> <div className={"homeHeader clearfix"}>
<img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt=""/> {
</div> storeInfo ? <div className={"headerContent leftContent fl"}>
<div className={"locationInfo"}> <div className={"headerlogo"}>
<img className={"addIcon"} src={UTILPATH.localImg.addIcon} alt=""/> <img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt=""/>
<div className={"local colfff"}> </div>
<p className={"font30"}>华贸商业街</p> <div className={"locationInfo"}>
<p className={"font24"}>ID : 001</p> <img className={"addIcon"} src={UTILPATH.localImg.addIcon} alt=""/>
</div> <div className={"local colfff"}>
</div> <p className={"font30"}>{storeInfo.name}</p>
</div> <p className={"font24"}>ID : 001</p>
</div>
</div>
</div> : null
}
<div className={"headerContent rightContent fr"}> {
<img className={"userheadImg"} src={UTILPATH.localImg.defaultImg} alt=""/> userinfo ? <div className={"headerContent rightContent fr " + (userinfo.id ? '' : 'hide')}>
<div className={"userinfo font24 colfff"}> <img className={"userheadImg"} src={ userinfo.headImageUrl || UTILPATH.localImg.defaultImg} alt=""/>
<p>李大仁</p> <div className={"userinfo font24 colfff"}>
<p>ID:001</p> <p>{userinfo.employeeName || ''}</p>
</div> <p>ID:{userinfo.id || 0}</p>
</div>
</div> : null
}
</div> </div>
</div>
)
} }
getOtherHeader(){ getOtherHeader(){
let {headerIconList} = this.props;
return <div className={"otherHeader font32 clearfix"}> return <div className={"otherHeader font32 clearfix"}>
<div className={"fl colfff"}>
<i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i> {
<span className={"middle"}>检查编辑结果</span> headerIconList ? headerIconList.map((info,index)=>{
</div> let dom = null;
<div className={"fr col999"}> if(index === 0){
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i> dom = (
<span className={"middle"}>保存</span> <div className={"fl colfff"} onClick={()=>info.option()}>
</div> <i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
)
}else if(index ===1){
dom = (
<div className={"fr "+(info.active ? 'colff7860':'col999')} onClick={()=>info.option()}>
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
)
}
return dom;
}) : null
}
</div> </div>
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
.headerComponent .homeHeader .headerlogo .logoImg{ .headerComponent .homeHeader .headerlogo .logoImg{
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 40%; left: 44%;
transform: translate(-50%,-50%); transform: translate(-50%,-50%);
} }
.headerComponent .homeHeader .locationInfo{ .headerComponent .homeHeader .locationInfo{
......
...@@ -19,7 +19,7 @@ export default class PopupComponent extends React.Component{ ...@@ -19,7 +19,7 @@ export default class PopupComponent extends React.Component{
return ( return (
<div className={"defaultPopup col333"}> <div className={"defaultPopup col333"}>
<div className={"defaultPopupText font30"}> <div className={"defaultPopupText font30"}>
{this.props.text} {popupInfo.popupText}
</div> </div>
<div className={"defaultPopupButtons font32"}> <div className={"defaultPopupButtons font32"}>
{dom} {dom}
......
...@@ -8,31 +8,54 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -8,31 +8,54 @@ export default class TroubleItemComponent extends React.Component{
} }
} }
getDes(item){
let des = "";
switch (item.type){
case 'KN':
des = item.description || '';
break;
case 'OP':
des = `${item.parentProblemName || ''} ${item.subProblemName || ''}`;
break;
}
return des;
}
render(){ render(){
let props = this.props;
let item = props.item ? props.item : {};
let description = this.getDes(item);
return ( return (
<div className={"troubleItemComponent"}> <div className={"troubleItemComponent"}>
<div className={"finishBox"}> <div className={"finishBox"}>
<div className={"finishText colfff font24"}>已处理</div> <div className={"finishText colfff font24"}>已处理</div>
</div> </div>
<div className={"itemText font32"}>故障问题1:故障ID-00001</div> <div className={"itemText font32"}>故障问题{props.num || 0}:故障ID-{item.errorCode || ''}</div>
<div className={"itemWrongInfo font24 col999"}> <div className={"itemWrongInfo font24 col999"}>
<p>2:3 左侧动作故障,取货动作出错</p> <p>{description}</p>
</div> </div>
<div className={"jugdeQuestion font32 rel"}> <div className={"jugdeQuestion font32 rel"}>
<span className={"colff7860 font32 star"}>*</span> <span className={"colff7860 font32 star"}>*</span>
<span>是否有此问题</span> <span>是否有此问题</span>
<div className={"questionBox border_e5"}></div> <div className={"questionBox border_e5 "+(item.isExistProblem && parseInt(item.isExistProblem) === 1 ? 'active':'')}
<div className={"questionBox border_e5"}></div> onClick={()=>props.setItem(item.errorCode,"isExistProblem",1)}
></div>
<div className={"questionBox border_e5 "+(item.isExistProblem && parseInt(item.isExistProblem) === 2 ? 'active':'')}
onClick={()=>props.setItem(item.errorCode,"isExistProblem",2)}
></div>
</div> </div>
<div className={"itemTextArea rel font24"}> <div className={"itemTextArea rel font24"}>
<div className={"itemTextEdit font24 colff7860"}> <div className={"itemTextEdit font24 colff7860"} onClick={()=>props.showText(item.errorCode)}>
<span className={"iconfont font24 icon icon-editor-line colff7860"}></span> <span className={"iconfont font24 icon icon-editor-line colff7860"}></span>
<span> 编辑</span> <span> 编辑</span>
</div> </div>
<span className={"colff7860 font32 star"}>*</span> <span className={"colff7860 font32 star"}>*</span>
<div className={"itemTextAreaBox col999 border_e5"}> <div className={"itemTextAreaBox col999 border_e5"} onClick={()=>props.showText(item.errorCode)}>
{ {
this.state.text ? <textarea readOnly className={"itemTextAreaBoxs col999"} value={this.state.text}></textarea> : item.explanation ? <textarea readOnly className={"itemTextAreaBoxs col999"} value={item.explanation}></textarea> :
<span className={"itemPlayceHolder"}>编辑检查结果</span> <span className={"itemPlayceHolder"}>编辑检查结果</span>
} }
......
import swiperContainers from './swiperContainer' import swiperContainers from './swiperContainer'
import showPage from './showPage'
module.exports = {swiperContainers} module.exports = {swiperContainers,...showPage}
\ No newline at end of file \ No newline at end of file
const showPage = {
1 : 'Trouble',
2 : 'Scan',
3 : 'DamageProductList',
4 : 'OtherQuestionUpload',
5 : 'TextArea',
6 : 'Qrcode',
7 : 'Home',
8 : 'FinishAsk',
9 : 'ChooseTask'
};
const headerStatus = {
1 : 'home',
2 : 'other'
}
module.exports = {showPage,headerStatus};
\ No newline at end of file
...@@ -5,7 +5,6 @@ import { connect } from 'react-redux'; ...@@ -5,7 +5,6 @@ import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore"; import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList} from "../../actions/getTroubles"; import {getTroubleList} from "../../actions/getTroubles";
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent' import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import TroubleContainer from '../TroubleContainer/TroubleContainer' import TroubleContainer from '../TroubleContainer/TroubleContainer'
import TextAreaContainer from '../TextAreaContainer/TextAreaContainer' import TextAreaContainer from '../TextAreaContainer/TextAreaContainer'
...@@ -19,17 +18,8 @@ import Qrcode from '../Qrcode/Qrcode' ...@@ -19,17 +18,8 @@ import Qrcode from '../Qrcode/Qrcode'
require('./index.css') require('./index.css')
const showPage = { const showPage = CONFIG.showPage;
1 : 'Trouble', const headerStatus = CONFIG.headerStatus;
2 : 'Scan',
3 : 'DamageProductList',
4 : 'OtherQuestionUpload',
5 : 'TextArea',
6 : 'Qrcode',
7 : 'Home',
8 : 'FinishAsk',
9 : 'ChooseTask'
}
const defaultPopupInfo = { const defaultPopupInfo = {
...@@ -46,20 +36,27 @@ class PageContainer extends React.Component { ...@@ -46,20 +36,27 @@ class PageContainer extends React.Component {
// UTILPATH.socket.getIp(); // UTILPATH.socket.getIp();
this.state = { this.state = {
showPage : showPage[1], showPage : showPage[1],
lastPage : '',
page : null, page : null,
popupInfo : defaultPopupInfo, popupInfo : defaultPopupInfo,
pageStyle : { pageStyle : {
// 'backgroundColor' : '#ffffff' // 'backgroundColor' : '#ffffff'
} },
lastPageStyle:{
},
}; };
this.getPages = this.getPages.bind(this); this.getPages = this.getPages.bind(this);
this.showPopup = this.showPopup.bind(this); this.showPopup = this.showPopup.bind(this);
this.hidePopup = this.hidePopup.bind(this); this.hidePopup = this.hidePopup.bind(this);
this.showQrCode = this.showQrCode.bind(this);
this.saveLastPage = this.saveLastPage.bind(this);
this.goBack = this.goBack.bind(this);
} }
componentWillMount() { componentWillMount() {
let {dispatch} = this.props; let {dispatch} = this.props;
dispatch(getStoreInfo()); dispatch(getStoreInfo());
dispatch(getTroubleList());
let pages = this.getPages(); let pages = this.getPages();
this.setState({ this.setState({
page : pages page : pages
...@@ -96,11 +93,48 @@ class PageContainer extends React.Component { ...@@ -96,11 +93,48 @@ class PageContainer extends React.Component {
}) })
} }
showQrCode(url){
this.setState({
showPage: showPage[5],
tempInfo : {
text : text,
url : url
}
})
}
saveLastPage(page,pageStyle){
this.setState({
lastPage : page,
lastPageStyle : pageStyle
})
}
goBack(){
console.log("goback")
let lastPage = this.state.lastPage;
let pageStyle = this.state.lastPageStyle;
this.setState({
showPage: lastPage,
pageStyle : pageStyle
})
}
getPages(){ getPages(){
let pages = null; let pages = null;
let {state,dispatch} = this.props;
switch (this.state.showPage){ switch (this.state.showPage){
case showPage[1]: case showPage[1]:
pages = <TroubleContainer />; pages = <TroubleContainer
troubleList={state.troubleList}
storeInfo={state.storeInfo}
userInfo={state.userInfo}
initTroubleList={()=>dispatch(getTroubleList())}
showTextArea={(text)=>this.showTextArea(text)}
/>;
break; break;
case showPage[2]: case showPage[2]:
pages = <ScanBarCodeContainer />; pages = <ScanBarCodeContainer />;
...@@ -111,9 +145,6 @@ class PageContainer extends React.Component { ...@@ -111,9 +145,6 @@ class PageContainer extends React.Component {
case showPage[4]: case showPage[4]:
pages = <OtherQuestionContainer />; pages = <OtherQuestionContainer />;
break; break;
case showPage[5]:
pages = <TextAreaContainer />;
break;
case showPage[6]: case showPage[6]:
pages = <Qrcode />; pages = <Qrcode />;
break; break;
...@@ -131,11 +162,12 @@ class PageContainer extends React.Component { ...@@ -131,11 +162,12 @@ class PageContainer extends React.Component {
} }
render() { render() {
let {state} = this.props;
return ( return (
<div className={"pageContainer "} style={this.state.pageStyle}> <div className={"pageContainer "} style={this.state.pageStyle}>
<HeaderComponent />
<PopupComponent popupInfo={this.state.popupInfo} /> <PopupComponent popupInfo={this.state.popupInfo} />
{this.state.page} {this.getPages()}
</div> </div>
) )
} }
......
.pageContainer{ .pageContainer{
position: relative; position: relative;
height: 956px; height: 945px;
width: 1920px; width: 1920px;
} }
.pageContainer.backColfff{ .pageContainer.backColfff{
......
import React from 'react'; import React from 'react';
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
require('./index.css'); require('./index.css');
export default class TextAreaContainer extends React.Component{ export default class TextAreaContainer extends React.Component{
...@@ -7,24 +8,57 @@ export default class TextAreaContainer extends React.Component{ ...@@ -7,24 +8,57 @@ export default class TextAreaContainer extends React.Component{
this.state = { this.state = {
text : '' text : ''
} }
this.getOtherHeader = this.getOtherHeader.bind(this);
this.saveText = this.saveText.bind(this);
} }
componentWillReceiveProps(nextProps){
let text = nextProps.text ? nextProps.text : '' componentWillMount() {
let {text} = this.props;
this.setState({ this.setState({
text : text text : text
}) })
} }
handleChange(e){ handleChange(e){
let value = e.target.value let value = e.target.value;
this.setState({text: value}); this.setState({text: value});
} }
saveText(){
if(this.state.text){
this.props.saveText(this.state.text)
}
}
getOtherHeader(){
let {goBack} = this.props;
return <div className={"otherHeader font32 clearfix"}>
<div className={"fl colfff"} onClick={()=>goBack()}>
<i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i>
<span className={"middle"}>编辑检查结果</span>
</div>
<div className={"fr "+(this.state.text ? 'colff7860':'col999')} onClick={()=>this.saveText()}>
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i>
<span className={"middle"}>保存</span>
</div>
</div>
}
render(){ render(){
return ( return (
<div className={"textAreaContainer"}> <div>
<div className={"textAreaDiv font30 col999"} > <HeaderComponent
<textarea className={"textAreaBox font30 col999"} name="" id="" cols="30" rows="10" onChange={this.handleChange.bind(this)} value={this.state.text} placeholder={"点击输入"}></textarea> showHeader={CONFIG.headerStatus[2]}
>
{this.getOtherHeader()}
</HeaderComponent>
<div className={"textAreaContainer"}>
<div className={"textAreaDiv font30 col999"} >
<textarea className={"textAreaBox font30 col999"} name="" id="" cols="30" rows="10" onChange={this.handleChange.bind(this)} value={this.state.text} placeholder={"点击输入"}></textarea>
</div>
</div> </div>
</div> </div>
) )
} }
} }
...@@ -2,21 +2,66 @@ import React from 'react'; ...@@ -2,21 +2,66 @@ import React from 'react';
import SwiperComponent from '../../components/CommonComponent/SwiperComponent/SwiperComponent' import SwiperComponent from '../../components/CommonComponent/SwiperComponent/SwiperComponent'
import TroubleItem from '../../components/TroubleComponent/TroubleItemComponent/TroubleItemComponent' import TroubleItem from '../../components/TroubleComponent/TroubleItemComponent/TroubleItemComponent'
import Button from '../../components/CommonComponent/ButtonComponent/ButtonComponent' import Button from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import TextArea from "../TextAreaContainer/TextAreaContainer";
require('./index.css') require('./index.css')
export default class TroubleContainer extends React.Component{ export default class TroubleContainer extends React.Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state = { this.state = {
showTrouble : false showTrouble : true,
} troubleList : {},
currentErrorCode : 0,
showTextArea : false,
tmpText : ''
};
this.setItem = this.setItem.bind(this);
this.showText = this.showText.bind(this);
this.goBack = this.goBack.bind(this);
this.saveText = this.saveText.bind(this);
} }
dealTrouble(){ dealTrouble(){
let troubleList = this.state.troubleList;
let details = troubleList.details;
let arr = details.filter(d=>{
})
this.setState({ this.setState({
showTrouble : false showTrouble : false
}) })
} }
componentWillMount(){
let {initTroubleList} = this.props;
initTroubleList();
}
componentWillReceiveProps(nextProps){
let troubleList = nextProps.troubleList;
let nowTroubleList = this.state.troubleList;
let troubleErrorCodeList = Array.isArray(troubleList.details) ? troubleList.details.map(i=>i.errorCode) : []
let nowtroubleErrorCodeList = Array.isArray(nowTroubleList.details) ? nowTroubleList.details.map(i=>i.errorCode) : []
//上一次和这一次不一样
let troubleErrorCodeListStr = troubleErrorCodeList.join(",");
let nowtroubleErrorCodeListStr = nowtroubleErrorCodeList.join(",");
if(
troubleErrorCodeListStr !== nowtroubleErrorCodeListStr
){
this.setState({
troubleList : troubleList
})
}
}
haveNext(){ haveNext(){
console.log("有") console.log("有")
} }
...@@ -25,44 +70,109 @@ export default class TroubleContainer extends React.Component{ ...@@ -25,44 +70,109 @@ export default class TroubleContainer extends React.Component{
console.log("没有") console.log("没有")
} }
showText(errcode){
console.log("errcode ",errcode)
let troubleList = this.state.troubleList;
let details = troubleList.details;
let index = details.findIndex(d=>d.errorCode === errcode);
if(index > -1){
let text = details[index]['explanation'];
console.log("text ",text)
this.setState({
currentErrorCode : errcode,
showTextArea : true,
tmpText: text
})
}
}
setItem(errcode,option,info){
let troubleList = this.state.troubleList;
let details = troubleList.details;
let index = details.findIndex(d=>d.errorCode === errcode);
if(index > -1){
details[index][option] = info;
}
this.setState({
troubleList : troubleList,
},()=>{
this.goBack()
})
}
saveText(text){
let errcode = this.state.currentErrorCode;
this.setItem(errcode,'explanation',text);
}
goBack(){
this.setState({
currentErrorCode : 0,
showTextArea : false,
tmpText: ''
})
}
render(){ render(){
let arr = [1,2,3,4];
let dom = arr.map((i,k)=>{ let {userInfo,storeInfo} = this.props;
return <TroubleItem key={k}/>; let troubleList = this.state.troubleList;
let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0;
let details = Array.isArray(troubleList.details) ? troubleList.details : [];
let dom = details.map((i,k)=>{
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem} showText={this.showText}/>;
}); });
let swiperOptions = { let swiperOptions = {
width : 1396, width : 1396,
spaceBetween: 30, spaceBetween: 30,
freeMode:true, freeMode:true,
// slidesPerView: 2.6,
}; };
let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer; let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer;
let swiperCount = arr.length; let swiperCount = details.length;
return ( return (
<div className={"toubleContainers"}> <div>
<div className={"troubleContainer " + ( this.state.showTrouble ? '' : 'hide')}> {
<div className={"troubleText font32"}><span className={"colff7860"}>* </span>必填项</div> this.state.showTextArea ? <TextArea
<div className={"troubleBox"}> text={this.state.tmpText}
<SwiperComponent goBack={this.goBack}
swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount} saveText={this.saveText}
> ></TextArea> :
{dom} <div className={"toubleContainers " + (showTrouble ? '' : 'hide')}>
</SwiperComponent> <HeaderComponent
</div> showHeader={CONFIG.headerStatus[1]}
<div className={"troubleBtnBox"}> userinfo={userInfo}
<div className={"troubleBtn colfff font32"} onClick={()=>this.dealTrouble.bind(this)()}> storeInfo={storeInfo}
处理完毕 />
<div className={"troubleContainer " + ( this.state.showTrouble ? '' : 'hide')}>
<div className={"troubleText font32"}><span className={"colff7860"}>* </span>必填项</div>
<div className={"troubleBox"}>
<SwiperComponent
swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount}
>
{dom}
</SwiperComponent>
</div>
<div className={"troubleBtnBox"}>
<div className={"troubleBtn colfff font32"} onClick={()=>this.dealTrouble.bind(this)()}>
处理完毕
</div>
</div>
</div>
<div className={"selectContainer " + ( this.state.showTrouble ? 'hide' : '')}>
<div className={"selectText font40 col333"} style={{"marginTop":"230px"}}>出货板传送区、机械手平台、轨道是否有未出货遗留的货品</div>
<div className={"selectButtons"}>
<Button text={"有"} option={this.haveNext} style={{"marginTop":"128px"}}/>
<Button text={"没有"} option={this.haveNoNext} style={{"marginTop":"49px"}}/>
</div>
</div>
</div> </div>
</div> }
</div>
<div className={"selectContainer " + ( this.state.showTrouble ? 'hide' : '')}>
<div className={"selectText font40 col333"} style={{"marginTop":"230px"}}>出货板传送区、机械手平台、轨道是否有未出货遗留的货品</div>
<div className={"selectButtons"}>
<Button text={"有"} option={this.haveNext} style={{"marginTop":"128px"}}/>
<Button text={"没有"} option={this.haveNoNext} style={{"marginTop":"49px"}}/>
</div>
</div>
</div> </div>
) )
} }
......
...@@ -28,4 +28,6 @@ function renderPage(store) { ...@@ -28,4 +28,6 @@ function renderPage(store) {
} }
let store = activateVendor(); let store = activateVendor();
renderPage(store); renderPage(store);
\ No newline at end of file
import { combineReducers } from 'redux' import { combineReducers } from 'redux'
import trouble from './trouble' import troubleList from './trouble'
import storeInfo from './store' import storeInfo from './store'
import scanBarCodeContainer from './scanBarCodeContainer' import scanBarCodeContainer from './scanBarCodeContainer'
import userInfo from './user'
export default combineReducers({ export default combineReducers({
trouble, troubleList,
storeInfo, storeInfo,
userInfo,
scanBarCodeContainer scanBarCodeContainer
}) })
import actionTypes from '../actiontype/trouble'; import actionTypes from '../actiontype/trouble';
const saveStore = (content,data)=>{ let data = {
return Object.assign({},content,data); "details": [
{
"id": 1634,
"errorCode": "ER00001",
"type": "KN",
"description": "2:左侧动作故障,4:机械手移动到放货位置出错()",
"files": [
{
"id": 16,
"filePath": "/tmp/2016-08-16/1471329685902.jpg"
},
{
"id": 17,
"filePath": "/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "/sku/0/0/426/1471330380712.jpg"
}
],
},
{
"id": 1,
"errorCode": null,
"type": "OP",
"files": [
{
"id": 16,
"filePath": "/tmp/2016-08-16/1471329685902.jpg"
},
{
"id": 17,
"filePath": "/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "/sku/0/0/426/1471330380712.jpg"
}
],
"parentProblemName": "机械故障",
"subProblemName": "其他问题111"
}
],
"employee": {
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"taskIds": [
155
]
} }
const dealTroubleList = (data)=>{
let defaultInfo = {
details: [],
taskIds: []
};
let defaultDetailItem = {
isExistProblem : 0,
imagesFileId : "",
explanation : ""
};
let info = Object.assign({},defaultInfo,data);
info.details = info.details.map((i)=>{
return Object.assign({},i,defaultDetailItem);
});
return info;
};
const saveTroubles = (content,data)=>{
let newData = dealTroubleList(data);
return Object.assign({},content,newData);
};
export default function(state={}, action) { export default function(state={}, action) {
switch (action.type) { switch (action.type) {
case actionTypes.SAVETROUBLELIST: case actionTypes.SAVETROUBLELIST:
return saveStore(state,action.data) return saveTroubles(state,action.data);
default: default:
return state; return state;
} }
......
import actionTypes from '../actiontype/user';
const saveUser = (content,data)=>{
return Object.assign({},content,data);
}
export default function(state={}, action) {
switch (action.type) {
case actionTypes.SAVEUSERINFO:
return saveUser(state,action.data)
default:
return state;
}
}
\ No newline at end of file
...@@ -28,7 +28,7 @@ const parseJson = (response)=>{ ...@@ -28,7 +28,7 @@ const parseJson = (response)=>{
return response.json(); return response.json();
}; };
const getIp = ()=>{ const getIp = (cb)=>{
console.log("getIp : ",initIndex) console.log("getIp : ",initIndex)
for(let i = initIndex; i < (totalIndex + initIndex) ; i++){ for(let i = initIndex; i < (totalIndex + initIndex) ; i++){
let url = 'http://' + domainIp + i + ':9999/getmyid'; let url = 'http://' + domainIp + i + ':9999/getmyid';
...@@ -44,7 +44,7 @@ const getIp = ()=>{ ...@@ -44,7 +44,7 @@ const getIp = ()=>{
if(data.storeId){ if(data.storeId){
let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId; let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId;
currentIpIndex = i; currentIpIndex = i;
init(wsUrl); init(wsUrl,cb);
} }
}) })
...@@ -85,9 +85,11 @@ const testIp = (ip) => { ...@@ -85,9 +85,11 @@ const testIp = (ip) => {
.then(parseJson) .then(parseJson)
.then((data) => { .then((data) => {
if(data.storeId){ if(data.storeId){
window.storeId = data.storeId;
window.localIp = domainIp + i;
let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId; let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId;
currentIpIndex = i; currentIpIndex = i;
init(wsUrl); init(wsUrl,cb);
} }
}) })
.catch((err) =>{ .catch((err) =>{
...@@ -102,7 +104,7 @@ const testIp = (ip) => { ...@@ -102,7 +104,7 @@ const testIp = (ip) => {
} }
const init = (url)=>{ const init = (url,cb)=>{
console.log("init :" ,url); console.log("init :" ,url);
if("WebSocket" in window && !ws && url){ if("WebSocket" in window && !ws && url){
ws = new WebSocket(url); ws = new WebSocket(url);
...@@ -117,7 +119,7 @@ const init = (url)=>{ ...@@ -117,7 +119,7 @@ const init = (url)=>{
inteval = null; inteval = null;
initIndex = 1; initIndex = 1;
failTotal = 1; failTotal = 1;
cb();
console.log("open"); console.log("open");
isFalse = false; isFalse = false;
...@@ -188,4 +190,4 @@ const closeSocket = ()=>{ ...@@ -188,4 +190,4 @@ const closeSocket = ()=>{
} }
} }
module.exports = {getIp,sendMsg} module.exports = {getIp,sendMsg};
\ No newline at end of file \ No newline at end of file
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