Commit 9b43094c by yaxiLiuu

fixed the base function ï

parent ebd5255b
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import * as actionTypes from '../actiontype/ScanBarCode'; import * as actionTypes from '../actiontype/ScanBarCode';
import actionTypes_error from '../actiontype/error' import actionTypes_error from '../actiontype/error'
let domain = 'http://192.168.10.189:8083'; let domain = ENV.domain;
const fakeJsonData = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"needCheck": true,
"inventorylossId": 0,
"skuBaseInfoVo": {
"skuId": 972,
"skuNumber": "UB000972",
"skuName": "怡宝饮用纯净水",
"skuImagePath": "http://static.mjitech.com/static/sku/0/0/972/1503296770206.jpg",
"barcode": "6901285991219",
"skuAttributesVoList": [
{
"name": "净含量",
"value": "555",
"unit": "ml"
}
]
},
"inventory": null,
"skuPassVoList": [
{
"id": 14466,
"warehouseId": 21,
"cabinetAreaId": 21,
"shelfId": 21211,
"skuId": 972,
"skuPassNumber": 2,
"width": 6,
"xPosition": 10,
"yPosition": 15,
"xAxis": 6,
"yAxis": 6,
"x1Axis": 0,
"y1Axis": 45,
"xOffset": 13,
"yOffset": 12,
"status": "使用中",
"quantity": 0,
"realQuantity": 97,
"maxStock": 5,
"scrapQuantity": 0,
"remarks": "21_5_1_2",
"deleted": 0,
"skuName": "怡宝饮用纯净水",
"skuNumber": "UB000972",
"cabinetNumber": 3,
"willoffSkuNumber": 0
}
],
"packingList": [
"未确认包装情况",
"包装完整",
"包装损坏"
],
"positionList": [
"未确认位置",
"机械手平台",
"出货传送区",
"轨道",
"其他位置"
]
}
}
const fakeJsonData2 = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {}}
export function scanBarCodeGetProductInfo(postData) { export function scanBarCodeGetProductInfo(postData) {
return (dispatch) => { return (dispatch) => {
/*let url = String(domain+'/web/machine_pad/scanning_sku_barcode_for_add_loss_task'); let url = String(domain+'/web/machine_pad/scanning_sku_barcode_for_add_loss_task');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -102,38 +26,39 @@ export function scanBarCodeGetProductInfo(postData) { ...@@ -102,38 +26,39 @@ export function scanBarCodeGetProductInfo(postData) {
} }
} }
).catch(e=>dispatch(console.log("出现错误")) ).catch(e=>dispatch(console.log("出现错误"))
)*/ )
dispatch(initSuccess(fakeJsonData.data)) /* dispatch(initSuccess(fakeJsonData.data))*/
} }
} }
export function submitProductInfo(postaData) { export function submitProductInfo(postData) {
return (dispatch)=>{ return (dispatch)=>{
/* let url = String(domain+'/web/ssubmit_add_loss_task'); let url = String(domain+'/web/machine_pad/submit_add_loss_task');
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
mode : 'cors', mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : JSON.stringify(postData) body : JSON.stringify(postData)
}).then((response) => response.json()) }).then((response) => response.json())
.then( .then(
(json)=>{ (json)=>{
if(json.is_succ){ if(json.data){
}else{
}
}
).catch(e=>dispatch(console.log("出现错误"))
)*/
let submit = { let submit = {
"submit":true "submit":true
} }
dispatch(submitProductSuccess(submit)) dispatch(submitProductSuccess(submit))
} }
}
).catch(e=>{console.error(e)}
)
/* */
}
} }
export function saveEditProductInfo(data) { export function saveEditProductInfo(data) {
console.log("=========action============")
console.log(data)
return (dispatach) =>{ return (dispatach) =>{
dispatach(saveEditProductInfoSuccess(data)) dispatach(saveEditProductInfoSuccess(data))
} }
...@@ -146,7 +71,7 @@ function initSuccess(data) { ...@@ -146,7 +71,7 @@ function initSuccess(data) {
data data
} }
} }
function submitProductSuccess(data) { export function submitProductSuccess(data) {
return { return {
type:actionTypes.SUBMIT_PRODUCT_SUCCESS, type:actionTypes.SUBMIT_PRODUCT_SUCCESS,
data data
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import * as actionTypes from '../actiontype/otherQuestion'; import * as actionTypes from '../actiontype/otherQuestion';
const domain = 'http://test.mjitech.com'; const domain = ENV.domain;
const fakeJsonData = { //有服务器交互的actions
"meta": { export function initGetOtherProblem(postData) {
"code": "200", return (dispatch) => {
"message": "成功", let url = String(domain+'/web/machine_pad/list_other_fault.action');
"success": true console.log(url)
}, fetch(url,{
"data": { credentials : 'include',
"feeds": [ method : 'POST',
{ mode : 'cors',
"id": 7, headers: {
"files": [ 'content-type':'application/json;charset=UTF-8',
{
"id": 13,
"filePath": "http://static.mjitech.com/static/sku/0/0/2/1471329355724.jpg"
},
{
"id": 14,
"filePath": "http://static.mjitech.com/static/sku/0/0/425/1471329537289.jpg"
},
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
}
],
"parentProblemName": null,
"subProblemName": null
},
{
"id": 6,
"files": [
{
"id": 13,
"filePath": "http://static.mjitech.com/static/sku/0/0/2/1471329355724.jpg"
},
{
"id": 14,
"filePath": "http://static.mjitech.com/static/sku/0/0/425/1471329537289.jpg"
},
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
}
],
"parentProblemName": null,
"subProblemName": null
}
],
"employee": {
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"warehouse": {
"id": 13,
"name": "华贸商业街",
"image": "/tmp/2018-05-25/1527243213701.jpg"
},
"problems": [
{
"id": 18,
"message": "机械故障",
"type": "OP",
"dicDetails": [
{
"messageId": 2,
"parentId": null,
"message": "fdffdfde3"
},
{
"messageId": 3,
"parentId": null,
"message": "55d5fdf"
},
{
"messageId": 4,
"parentId": null,
"message": "dfdf"
}
]
},
{
"id": 19,
"message": "下位机程序Bug",
"type": "OP",
"dicDetails": [
{
"messageId": 7,
"parentId": null,
"message": "其他问题89"
},
{
"messageId": 8,
"parentId": null,
"message": "dfdfdf"
}, },
{ body : JSON.stringify(postData)
"messageId": 9,
"parentId": null, }).then((response) => response.json())
"message": "werer" .then(
(json)=>{
if(json.meta.success){
dispatch(initSuccess(json.data))
}else{
} }
]
} }
] ).catch(e=>{console.error(e)}
)
/* */
} }
} }
const fakseJsonData2 = { export function addNewProbem(postData) {
"meta": return (dispatch) => {
{ let url = String(domain+'/web/machine_pad/insert_problem.action');
"code": "200", console.log(url)
"message": "成功", fetch(url,{
"success": true credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
}, },
"data": body : JSON.stringify(postData)
{
"feed": }).then((response) => response.json())
{ .then(
"id": 10, (json)=>{
} if(json.meta.success){
dispatch(addNewProblemSuccess(json.data))
}else{
} }
}
const fakeJsonData3 ={
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"feeds":[6,7]
} }
} ).catch(e=>{console.error(e)}
const fakeJsonData4 = { )
"meta": { /* */
"code": "200",
"message": "成功",
"success": true
},
"data": {
} }
} }
//有服务器交互的actions export function deleteProblem(postData) {
export function initGetOtherProblem(postData) {
return (dispatch) => { return (dispatch) => {
/*let url = String(domain+'/web/machine_pad/list_other_fault.action'); let url = String(domain+'/web/machine_pad/skip_feed_problem.action');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
mode : 'cors', mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : JSON.stringify(postData) body : JSON.stringify(postData)
}).then((response) => response.json()) }).then((response) => response.json())
.then( .then(
(json)=>{ (json)=>{
if(json.meta.is_succ){ if(json.meta.success){
initSuccess(json.data) dispatch(deleteProblemSuccess({"submitOtherProblem":true,"feedIds":json.data.feedIds}))
}else{ }else{
} }
} }
).catch(e=>dispatch(console.log("出现错误")) ).catch(e=>{console.error(e)}
)*/ )
dispatch(initSuccess(fakeJsonData.data))
}
}
export function addNewProbem(postaData) {
return (dispatch) =>{
fakseJsonData2.data.feed.id++
dispatch(addNewProblemSuccess(fakseJsonData2.data))
}
}
export function deleteProblem(postData) {
console.log(postData)
return(dispatch)=>{
dispatch(deleteProblemSuccess(fakeJsonData3.data))
} }
} }
export function submitProblemList(postData) { export function submitProblemList(postData) {
console.log("=====================postData=================="); return (dispatch) => {
console.log(postData); let url = String(domain+'/web/machine_pad/add_feed_problem.action');
return (dispatch)=>{ console.log(url)
dispatch(submitProblemListSuccess(fakeJsonData4)) fetch(url,{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : JSON.stringify(postData)
}).then((response) => response.json())
.then(
(json)=>{
if(json.meta.success){
dispatch(submitProblemListSuccess({"submitOtherProblem":true}))
}else{
}
}
).catch(e=>{console.error(e)}
)
} }
} }
//本地负责数据维护的action //本地负责数据维护的action
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import * as actionTypes from '../actiontype/reportDamage'; import * as actionTypes from '../actiontype/reportDamage';
import actionTypes_error from "../actiontype/error";
let domain = ENV.domain;
const fakeJson = { const fakeJson = {
"meta": { "meta": {
"code": "200", "code": "200",
...@@ -211,16 +213,59 @@ const fakeJson2 = { ...@@ -211,16 +213,59 @@ const fakeJson2 = {
] ]
} }
export function getReportDamageList (postData) { export function getReportDamageList (postData) {
return (dispatch)=>{ return (dispatch) => {
dispatch(getReportDamageListSuccess(fakeJson.data)) let url = String(domain+'/web/machine_pad/list_all_dealed_invetory_loss/'+postData.taskId+'.json');
console.log(url)
fetch(url,{
credentials : 'include',
method : 'GET',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : {}
}).then((response) => response.json())
.then(
(json)=>{
//处理数据如果
if(json.meta.success){
dispatch(getReportDamageListSuccess(json.data))
}else{
dispatch(throwError(json.meta.message))
}
}).catch(e=>{console.error(e)}
)
} }
} }
export function deleteDamageItem(postaData) { export function deleteDamageItem(postaData,taskId) {
console.log(postaData) return (dispatch) => {
console.log("dffffffffffffffffffffffffffffffff") let url = String(domain+'/web/machine_pad/delete_invetory_loss_by_saas');
return (dispatch)=>{ console.log(url)
dispatch(getReportDamageListSuccess(fakeJson2.data)) fetch(url,{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : JSON.stringify(postaData)
}).then((response) => response.json())
.then(
(json)=>{
//处理数据如果
let success = json.meta.success;
if(success){
dispatch(getReportDamageList({"taskId":500}))
}else{
dispatch(throwError(json.meta.message))
}
}
).catch(e=>{console.error(e)}
)
/* dispatch(initSuccess(fakeJsonData.data))*/
} }
} }
...@@ -239,3 +284,9 @@ function deleteDamageListSuccess(data) { ...@@ -239,3 +284,9 @@ function deleteDamageListSuccess(data) {
data data
} }
} }
function throwError(data) {
return{
type:actionTypes_error.ADDERRORINFO,
errMsg:data
}
}
\ No newline at end of file
...@@ -36,6 +36,26 @@ export default class EditProblemItem extends React.Component{ ...@@ -36,6 +36,26 @@ export default class EditProblemItem extends React.Component{
}); });
} }
componentWillReceiveProps(nextProps){
let nextImgList = nextProps.imgList;
let {editProblemItem,trouleId} = this.props
let imgList = this.props.imgList;
//修改值
if(String(nextImgList.files)!=String(imgList.files) || String(imgList.errorId)!= String(nextImgList.errorId)){
if(trouleId == Number(nextImgList.errorId)){
let data={};
data.type = "imgFiles";
data.files = nextImgList.files;
data.troubelId = trouleId;
editProblemItem(data);
}else{
console.log("==================不相等===========")
}
}
}
handleShowElement(value){ handleShowElement(value){
if(value == "showDetailElement"){ if(value == "showDetailElement"){
//点击了 小分类 检查如果大分类未选择则进行提示 //点击了 小分类 检查如果大分类未选择则进行提示
...@@ -91,13 +111,14 @@ export default class EditProblemItem extends React.Component{ ...@@ -91,13 +111,14 @@ export default class EditProblemItem extends React.Component{
} }
render(){ render(){
let props = this.props; let props = this.props;
let imgFiles = props.baseInfo.files; let imgFiles = props.baseInfo.files?props.baseInfo.files:[];
let troubleId = props.trouleId; let troubleId = props.trouleId;
let taskType = props.taskType;
// 方法 // 方法
// 1. 删除问题 // 1. 删除问题
let deleteProblem = props.deleteProblem; let deleteProblem = props.deleteProblem;
// 2. 刷新图片 // 2. 刷新图片
let reRreshImg = props.reRreshImg; let getRefreshImg = props.getRefreshImg;
// 3. 添加图片 // 3. 添加图片
let addImg = props.addImg; let addImg = props.addImg;
// 4. 删除图片 // 4. 删除图片
...@@ -122,7 +143,7 @@ export default class EditProblemItem extends React.Component{ ...@@ -122,7 +143,7 @@ export default class EditProblemItem extends React.Component{
return <ImgToolComponent return <ImgToolComponent
key={"troubelImg"+index} key={"troubelImg"+index}
noCloseBtn={false} noCloseBtn={false}
handleClikCloseFunc = {deleteImg} handleClikCloseFunc = {deleteImg(troubleId,taskType,item.id)}
handleClikImgFunc = {()=>{}} handleClikImgFunc = {()=>{}}
type={"custom"} type={"custom"}
imgSrc = {item.filePath} imgSrc = {item.filePath}
...@@ -135,7 +156,7 @@ export default class EditProblemItem extends React.Component{ ...@@ -135,7 +156,7 @@ export default class EditProblemItem extends React.Component{
<div className={"editUploadItem clearfix"}> <div className={"editUploadItem clearfix"}>
<span className={"closeBtn"} onClick={deleteProblem()}>×</span> <span className={"closeBtn"} onClick={deleteProblem()}>×</span>
<div className={"newTroubleTitle"}> <div className={"newTroubleTitle"}>
新故障问题:故障 <span>SD568844</span> 新故障问题:故障 <span>{"OP0000"+troubleId}</span>
</div> </div>
<div className={"newTroubleContent clearfix"}> <div className={"newTroubleContent clearfix"}>
<span className={"startIcon"}>*</span> <span className={"startIcon"}>*</span>
...@@ -177,10 +198,8 @@ export default class EditProblemItem extends React.Component{ ...@@ -177,10 +198,8 @@ export default class EditProblemItem extends React.Component{
{imgListUi} {imgListUi}
</div> </div>
<div className={"operationLeft"}> <div className={"operationLeft"}>
<ImgToolComponent type={"add"} handleClikImgFunc = {addImg} noCloseBtn = {true}></ImgToolComponent> <ImgToolComponent type={"add"} handleClikImgFunc = {addImg()} noCloseBtn = {true}></ImgToolComponent>
{ <ImgToolComponent handleClikImgFunc = {getRefreshImg()} type={"refresh"} noCloseBtn = {true}></ImgToolComponent>
imgFiles && imgFiles.length>0?(<ImgToolComponent handleClikImgFunc = {reRreshImg} type={"refresh"} noCloseBtn = {true}></ImgToolComponent>):""
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -10,7 +10,7 @@ export default class DamageItem extends React.Component{ ...@@ -10,7 +10,7 @@ export default class DamageItem extends React.Component{
} }
render(){ render(){
let {itemInfo,deleteItem} = this.props; let {itemInfo,deleteItem} = this.props;
let {lossPosition,packingStatus,skuBaseInfoVo,inventoryId} = itemInfo; let {lossPosition,packingStatus,skuBaseInfoVo,inventoryLossId} = itemInfo;
let productContent = '' let productContent = ''
skuBaseInfoVo.skuAttributesVoList.map((item,index)=>{ skuBaseInfoVo.skuAttributesVoList.map((item,index)=>{
let newText = ""; let newText = "";
...@@ -20,7 +20,7 @@ export default class DamageItem extends React.Component{ ...@@ -20,7 +20,7 @@ export default class DamageItem extends React.Component{
return ( return (
<div className={"damageProductItem"}> <div className={"damageProductItem"}>
<span onClick={()=>{deleteItem(inventoryId)}} className={"closeBtn"}>×</span> <span onClick={()=>{deleteItem(inventoryLossId)}} className={"closeBtn"}>×</span>
<div className={"productBaseInfo clearfix"}> <div className={"productBaseInfo clearfix"}>
<img className={"productImg"} src= {skuBaseInfoVo.skuImagePath} alt=""/> <img className={"productImg"} src= {skuBaseInfoVo.skuImagePath} alt=""/>
<div className={"baseNumber"}> <div className={"baseNumber"}>
......
...@@ -67,13 +67,8 @@ export default class ProductDetailItem extends React.Component{ ...@@ -67,13 +67,8 @@ export default class ProductDetailItem extends React.Component{
handleSubmit(){ handleSubmit(){
let {inventorylossId,skuBaseInfoVo,handleSubmitProductInfo,data_currentProblemObj,changePages} = this.props; let {inventorylossId,skuBaseInfoVo,handleSubmitProductInfo,data_currentProblemObj,changePages} = this.props;
let data = {};
data.inventoryLossId = inventorylossId;
data.lossPostion = this.state.currentPosition;
data.packingStatus = this.state.currentPakageStatus;
data.packingStatusImageIds = [];
handleSubmitProductInfo(data_currentProblemObj); handleSubmitProductInfo(data_currentProblemObj);
changePages(CONFIG.showPage[3])
} }
render(){ render(){
...@@ -163,8 +158,8 @@ export default class ProductDetailItem extends React.Component{ ...@@ -163,8 +158,8 @@ export default class ProductDetailItem extends React.Component{
<div className={"btnContainer"}> <div className={"btnContainer"}>
<button <button
onClick={this.handleSubmit.bind(this)} onClick={this.handleSubmit.bind(this)}
className={"submitEditBtn"+(this.state.currentPosition!=undefined && this.state.currentPakageStatus!=undefined?" selectBtn":"")} className={"submitEditBtn"+(this.state.currentPosition==undefined || this.state.currentPakageStatus==undefined ||((Number(this.state.currentPakageStatus)==2 && imgFileList.length<=0))?" ":" selectBtn")}
disabled={this.state.currentPosition==undefined || this.state.currentPakageStatus==undefined?true:false} disabled={this.state.currentPosition==undefined || this.state.currentPakageStatus==undefined ||(Number(this.state.currentPakageStatus)==2 && imgFileList.length<=0)?true:false}
>提交</button> >提交</button>
</div> </div>
</div> </div>
......
...@@ -3,7 +3,10 @@ import React from 'react'; ...@@ -3,7 +3,10 @@ import React from 'react';
import SwiperComponent from '../../components/CommonComponent/SwiperComponent/SwiperComponent' import SwiperComponent from '../../components/CommonComponent/SwiperComponent/SwiperComponent'
import EditProblemItem from '../../components/OtherQuestionComponent/EditProblemComponent' import EditProblemItem from '../../components/OtherQuestionComponent/EditProblemComponent'
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent' import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import ButtonComponent from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
import TextArea from "../TextAreaContainer/TextAreaContainer"; import TextArea from "../TextAreaContainer/TextAreaContainer";
import Qrcode from '../Qrcode/Qrcode'
require('./index.css'); require('./index.css');
export default class OtherQuestionContainer extends React.Component{ export default class OtherQuestionContainer extends React.Component{
constructor(props){ constructor(props){
...@@ -11,13 +14,21 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -11,13 +14,21 @@ export default class OtherQuestionContainer extends React.Component{
this.state = { this.state = {
showTextArea:false, showTextArea:false,
tmpText:"", tmpText:"",
currentProblemId:'' currentProblemId:'',
showQr:false,
qrUrl:"",
taskTy:"OP",
showPop:false,
popupInfo:{},
} }
} }
componentWillMount() { componentWillMount() {
let {dispatch,initStart,state} = this.props; let {initStart,headerInfo,userInfo} = this.props;
// 请求 初始数据接口 // 请求 初始数据接口
let postData = {}; let postData = {
employeeId:headerInfo.employeeId?headerInfo.employeeId:"20",
storeId:headerInfo.storeId?headerInfo.storeId:"17"
};
initStart(postData); initStart(postData);
} }
...@@ -26,8 +37,15 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -26,8 +37,15 @@ export default class OtherQuestionContainer extends React.Component{
componentDidUpdate() { componentDidUpdate() {
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
let {state} = nextProps; /* let {state} = nextProps;
let {otherQuestion} = state; let {otherQuestion,refreshImg} = state;
let lastRefreshImg = this.props.state.refreshImg;
if(String(lastRefreshImg)!=String(refreshImg)){
//更新数据
let troubleId = ""
}
console.log(refreshImg);
console.log("============================willrecvie refreshImg")*/
} }
componentWillUnmount(){ componentWillUnmount(){
...@@ -75,38 +93,101 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -75,38 +93,101 @@ export default class OtherQuestionContainer extends React.Component{
handleAddNewTroble(){ handleAddNewTroble(){
let postData = {}; let postData = {};
let {addNewProblem} = this.props; let {addNewProblem,headerInfo} = this.props;
postData.employeeId = "dfdf"; postData.employeeId = headerInfo.employeeId?headerInfo.employeeId:"20";
postData.employeeId = "dfdf"; postData.storeId = headerInfo.storeId?headerInfo.storeId:"17";
addNewProblem(); addNewProblem(postData);
} }
/* /*
* 删除已经编辑的的问题 * 删除已经编辑的的问题
* */ * */
handleDeleteProblem(troubleId){ handleDeleteProblem(troubleId){
let {deleteProblem} = this.props; let {deleteProblem,headerInfo} = this.props;
console.log(deleteProblem); console.log(deleteProblem);
let postData = {}; let postData = {};
postData.feedIds =[]; postData.feedIds =String(troubleId);
postData.feedIds.push(troubleId); postData.employeeId = headerInfo.employeeId?headerInfo.employeeId:"20";
postData.storeId = headerInfo.storeId?headerInfo.storeId:"17";
deleteProblem(postData); deleteProblem(postData);
console.log("删除编辑的问题");
} }
handleSubmitProblemList(){ handleSubmitProblemList(){
let {submitProblemList,state,changePages}=this.props; let {submitProblemList,state,headerInfo,changePages}=this.props;
let that = this;
let problemList = state.otherQuestion.data_allProblemList; let problemList = state.otherQuestion.data_allProblemList;
console.log("=========================数量") //编辑成想要的格式
console.log(problemList); let postData = {};
submitProblemList(problemList) postData.problems = [];
changePages(CONFIG.showPage[8]) for(let key in problemList){
let currentObj = problemList[key];
let tempObj = {};
tempObj.id = currentObj.id;
tempObj.problemType = currentObj.problemType;
tempObj.detailProblemType = currentObj.detailProblemType;
tempObj.remark = currentObj.remark;
let newImgIds = []
if(currentObj.files&&currentObj.files.length>0){
newImgIds = currentObj.files.map((item,index)=>{
return item.id
})
}
tempObj.imagesFileId = newImgIds.join(',');
postData.problems.push(tempObj);
}
postData.employeeId = headerInfo.employeeId?headerInfo.employeeId:"20";
postData.storeId = headerInfo.storeId?headerInfo.storeId:"17";
//检查 postData.problems
let problemsLength = postData.problems.length;
let needEdit = [];
postData.problems.map((item,index)=>{
if(item.problemType == undefined){
needEdit.push(item.id)
}
if(index+1 == postData.problems.length && needEdit.length==0){
submitProblemList(postData)
}
if(index+1 == postData.problems.length && needEdit.length>0){
console.log("================及Nlaile=========")
that.setState({
showPop:true,
popupInfo:{
"popupText":"提交前请输入相关信息,如果不想提交可以直接跳过(右上角)",
"showPopup":true,
"popupButtons": [<ButtonComponent key={"btn"} option={this.handleShowPopo.bind(this)} text={"确定"}/>]
}
})
}
})
/*changePages(CONFIG.showPage[8])*/
} }
/*处理提示框*/;
handleShowPopo(){
this.setState({
showPop:false
})
}
/* /*
*添加照片 *添加照片
* */ * */
handleAddImg(){ handleAddImg(troubleId){
let {state} = this.props;
let {storeInfo} = state;
let tmpUrl = "";
tmpUrl = `${ENV.uploadImg}${troubleId}/${this.state.taskTy}`
this.setState({
"showQr":true,
"qrUrl":tmpUrl
},()=>{
console.log("=======================设置的二维码===========")
console.log(this.state.qrUrl)
})
console.log("添加照片") console.log("添加照片")
} }
...@@ -114,41 +195,40 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -114,41 +195,40 @@ export default class OtherQuestionContainer extends React.Component{
/* /*
*刷新当前图片 *刷新当前图片
* */ * */
handleRefreshProbelmImg(){ handleRefreshProbelmImg(troubleId,troubleType){
console.log("刷新当前问题备注图片") let {getRefreshImg} = this.props;
getRefreshImg(troubleId,troubleType)
} }
/* /*
* 删除图片 * 删除图片
* */ * */
handleDeleteImg(){ handleDeleteImg(errorId,taskType,fileId){
console.log("删除图片") let {deleteImg} = this.props;
deleteImg(errorId,taskType,fileId)
} }
/*
* 整体提交已经编辑的问题
* */
/*handleSubmitProblemList(){
console.log("=======提交已经编辑的问题==")
}*/
/*
* 直接跳过
* */
handleOverPass(){ handleOverPass(){
let {deleteProblem,state} = this.props; let {deleteProblem,headerInfo} = this.props;
let problemKeyList = Object.keys(state.otherQuestion.data_allProblemList);
let postData = {}; let postData = {};
postData.feedIds =problemKeyList; postData.feedIds ="";
postData.employeeId = headerInfo.employeeId?headerInfo.employeeId:"20";
postData.storeId = headerInfo.storeId?headerInfo.storeId:"17";
deleteProblem(postData); deleteProblem(postData);
} }
//二维码返回
handleQrBack(){
this.setState({
showQr:false
})
}
render(){ render(){
//let 难道初始化的数据: //let 难道初始化的数据:
let {state,addNewProblem,editProblemItem,deleteProblem} = this.props; let {state,addNewProblem,editProblemItem,deleteProblem,getRefreshImg} = this.props;
let {otherQuestion,userInfo,storeInfo} = state; let {otherQuestion,refreshImg,userInfo,storeInfo} = state;
let {problems} = otherQuestion; let {problems} = otherQuestion;
let feeds = otherQuestion.feeds; let feeds = otherQuestion.feeds;
let problemList = otherQuestion.data_allProblemList; let problemList = otherQuestion.data_allProblemList;
...@@ -163,14 +243,17 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -163,14 +243,17 @@ export default class OtherQuestionContainer extends React.Component{
let currentItemUi = <EditProblemItem let currentItemUi = <EditProblemItem
editProblemItem = {editProblemItem} editProblemItem = {editProblemItem}
trouleId = {troubleId} trouleId = {troubleId}
imgList = {refreshImg}
clickEdit = {this.handleShowRemark.bind(this,troubleId)} clickEdit = {this.handleShowRemark.bind(this,troubleId)}
problemInfo = {problems} problemInfo = {problems}
baseInfo = {item} baseInfo = {item}
remarkText = {currentRemark} remarkText = {currentRemark}
getRefreshImg = {()=>(this.handleRefreshProbelmImg.bind(this,troubleId,this.state.taskTy))}
deleteProblem = {()=>(this.handleDeleteProblem.bind(this,troubleId))} deleteProblem = {()=>(this.handleDeleteProblem.bind(this,troubleId))}
addImg = {()=>(this.handleAddImg.bind(this))} addImg = {()=>(this.handleAddImg.bind(this,troubleId))}
reRreshImg = {()=>(this.handleRefreshProbelmImg.bind(this))} deleteImg = {(errorId,type,fileId)=>(this.handleDeleteImg.bind(this,errorId,type,fileId))}
deleteImg = {()=>(this.handleDeleteImg.bind(this))} taskType = {this.state.taskTy}
key={key}/> key={key}/>
editProblemItemUI.push(currentItemUi); editProblemItemUI.push(currentItemUi);
} }
...@@ -183,15 +266,21 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -183,15 +266,21 @@ export default class OtherQuestionContainer extends React.Component{
// slidesPerView: 2.6, // slidesPerView: 2.6,
}; };
let swiperContainer = CONFIG.swiperContainers.editProblemSwiperContainer; let swiperContainer = CONFIG.swiperContainers.editProblemSwiperContainer;
return ( //控制Ui显示
this.state.showTextArea?( let elementUI = '';
<TextArea if(this.state.showTextArea){
elementUI = <TextArea
text={this.state.tmpText} text={this.state.tmpText}
goBack={this.handleEditGoBack.bind(this)} goBack={this.handleEditGoBack.bind(this)}
saveText={this.handleSaveRemarkText.bind(this)} saveText={this.handleSaveRemarkText.bind(this)}
></TextArea> ></TextArea>
):( }else if(this.state.showQr){
<div className={"OtherQuestionContainer"}> elementUI = <Qrcode goBack={this.handleQrBack.bind(this)} url={this.state.taskTy}></Qrcode>
}else{
elementUI = <div className={"OtherQuestionContainer"}>
{this.state.showPop?(
<PopupComponent popupInfo = {this.state.popupInfo}></PopupComponent>
):""}
<HeaderComponent <HeaderComponent
showHeader={CONFIG.headerStatus[1]} showHeader={CONFIG.headerStatus[1]}
userinfo={userInfo} userinfo={userInfo}
...@@ -212,7 +301,10 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -212,7 +301,10 @@ export default class OtherQuestionContainer extends React.Component{
<div className={"overPass"} onClick={this.handleOverPass.bind(this)}>跳过</div> <div className={"overPass"} onClick={this.handleOverPass.bind(this)}>跳过</div>
</div> </div>
) }
return (
<div>{elementUI}</div>
) )
} }
......
...@@ -5,7 +5,7 @@ import { connect } from 'react-redux'; ...@@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore"; import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList,updateTroubleList} from "../../actions/getTroubles"; import {getTroubleList,updateTroubleList} from "../../actions/getTroubles";
import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion" import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion"
import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo} from "../../actions/ScanBarCode" import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo,submitProductSuccess} from "../../actions/ScanBarCode"
import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList' import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList'
import {getRefreshImg,deleteImg} from "../../actions/refreshImg" import {getRefreshImg,deleteImg} from "../../actions/refreshImg"
import {uploadError,addErrorInfo} from '../../actions/uploadError' import {uploadError,addErrorInfo} from '../../actions/uploadError'
...@@ -384,12 +384,16 @@ class PageContainer extends React.Component { ...@@ -384,12 +384,16 @@ class PageContainer extends React.Component {
break; break;
case showPage[2]: case showPage[2]:
pages = <ScanBarCodeContainer pages = <ScanBarCodeContainer
headerInfo = {state.headerInfo}
storeInfo={state.storeInfo}
userInfo={state.userInfo}
getProductInfo = {(postData)=>dispatch(scanBarCodeGetProductInfo(postData))} getProductInfo = {(postData)=>dispatch(scanBarCodeGetProductInfo(postData))}
submitProductInfo = {(postData)=>dispatch(submitProductInfo(postData))} submitProductInfo = {(postData)=>dispatch(submitProductInfo(postData))}
getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))} getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))}
deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))} deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))}
saveEditProductInfo = {(postData)=>dispatch(saveEditProductInfo(postData))} saveEditProductInfo = {(postData)=>dispatch(saveEditProductInfo(postData))}
changePages={(data)=>this.changePages(data)} changePages={(data)=>this.changePages(data)}
submitProductSuccess = {(postData)=>dispatch(submitProductSuccess(postData))}
state = {state} state = {state}
/>; />;
break; break;
...@@ -398,6 +402,9 @@ class PageContainer extends React.Component { ...@@ -398,6 +402,9 @@ class PageContainer extends React.Component {
getReportDamageList = {(postData)=>dispatch(getReportDamageList(postData))} getReportDamageList = {(postData)=>dispatch(getReportDamageList(postData))}
deleteDamageItem = {(postData)=>{dispatch(deleteDamageItem(postData))}} deleteDamageItem = {(postData)=>{dispatch(deleteDamageItem(postData))}}
changePages={(data)=>this.changePages(data)} changePages={(data)=>this.changePages(data)}
headerInfo = {state.headerInfo}
storeInfo={state.storeInfo}
userInfo={state.userInfo}
state = {state} state = {state}
/>; />;
break; break;
...@@ -408,7 +415,12 @@ class PageContainer extends React.Component { ...@@ -408,7 +415,12 @@ class PageContainer extends React.Component {
editProblemItem = {(data)=>dispatch(editProblemItem(data))} editProblemItem = {(data)=>dispatch(editProblemItem(data))}
deleteProblem = {(data)=>dispatch(deleteProblem(data))} deleteProblem = {(data)=>dispatch(deleteProblem(data))}
submitProblemList = {(data)=>dispatch(submitProblemList(data))} submitProblemList = {(data)=>dispatch(submitProblemList(data))}
getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))}
deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))}
changePages={(data)=>this.changePages(data)} changePages={(data)=>this.changePages(data)}
headerInfo = {state.headerInfo}
storeInfo={state.storeInfo}
userInfo={state.userInfo}
state = {state} state = {state}
/>; />;
break; break;
......
...@@ -11,15 +11,19 @@ export default class ReportDamagesListContainer extends React.Component{ ...@@ -11,15 +11,19 @@ export default class ReportDamagesListContainer extends React.Component{
super(props) super(props)
} }
componentWillMount(){ componentWillMount(){
let {getReportDamageList} = this.props; let {getReportDamageList,state} = this.props;
let{userInfo,headerInfo,storeInfo} = state;
let postData = {}; let postData = {};
postData.taskId=headerInfo.taskId?headerInfo.taskId:Number(500)
getReportDamageList(postData) getReportDamageList(postData)
} }
hanldeDeleteDamageItem(data){ hanldeDeleteDamageItem(data){
let postData = {}; let postData = {};
postData.inventoryLossId = data; postData.inventoryLossId = data;
let {deleteDamageItem} = this.props; let {deleteDamageItem,state} = this.props;
deleteDamageItem(postData) let{userInfo,headerInfo,storeInfo} = state;
let taskId = headerInfo.taskId?headerInfo.taskId:Number(500);
deleteDamageItem(postData,taskId)
} }
hanleAddMoreClick(){ hanleAddMoreClick(){
let {changePages} = this.props; let {changePages} = this.props;
......
...@@ -34,11 +34,15 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -34,11 +34,15 @@ export default class ScanBarCodeContainer extends React.Component{
let {state,changePages} = nextProps; let {state,changePages} = nextProps;
let {scanBarCode,userInfo,storeInfo,refreshImg} = state; let {scanBarCode,userInfo,storeInfo,refreshImg} = state;
let productInfo = state.scanBarCode; let productInfo = state.scanBarCode;
let {inventorylossId,skuBaseInfoVo,packingList,positionList,data_currentProblemObj} = productInfo; let {inventorylossId,skuBaseInfoVo,packingList,positionList,data_currentProblemObj,submit} = productInfo;
if(submit){
changePages(CONFIG.showPage[3])
}
let productDetailUi = <ProductDetailItem let productDetailUi = <ProductDetailItem
skuBaseInfoVo = {skuBaseInfoVo} skuBaseInfoVo = {skuBaseInfoVo}
packingList = {packingList} packingList = {packingList}
positionList = {positionList} positionList = {positionList}
inventorylossId = {inventorylossId}
data_currentProblemObj = {data_currentProblemObj} data_currentProblemObj = {data_currentProblemObj}
handleAddImg ={this.handleAddImg.bind(this)} handleAddImg ={this.handleAddImg.bind(this)}
handleDeleteImg ={this.handleDeleteImg.bind(this)} handleDeleteImg ={this.handleDeleteImg.bind(this)}
...@@ -47,7 +51,6 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -47,7 +51,6 @@ export default class ScanBarCodeContainer extends React.Component{
handleSaveEditProductInfo = {this.handleSaveEditProductInfo.bind(this)} handleSaveEditProductInfo = {this.handleSaveEditProductInfo.bind(this)}
refreshImg = {refreshImg} refreshImg = {refreshImg}
changePages = {changePages} changePages = {changePages}
/> />
if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId && this.state.showProductInfo){ if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId && this.state.showProductInfo){
this.setState({ this.setState({
...@@ -59,6 +62,9 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -59,6 +62,9 @@ export default class ScanBarCodeContainer extends React.Component{
} }
} }
componentWillUnmount() { componentWillUnmount() {
console.log("===============submitProductSuccess===============");
let {submitProductSuccess} = this.props;
submitProductSuccess({"submit":false})
} }
// 输入条形码改变 onchange事件监听 条形码的值 // 输入条形码改变 onchange事件监听 条形码的值
handleSaveInputBarCode(event){ handleSaveInputBarCode(event){
...@@ -119,7 +125,6 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -119,7 +125,6 @@ export default class ScanBarCodeContainer extends React.Component{
}) })
} }
handleSaveEditProductInfo(data){ handleSaveEditProductInfo(data){
console.log("=================储存===")
let {saveEditProductInfo} = this.props; let {saveEditProductInfo} = this.props;
saveEditProductInfo(data) saveEditProductInfo(data)
} }
...@@ -132,14 +137,16 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -132,14 +137,16 @@ export default class ScanBarCodeContainer extends React.Component{
//上传图片 //上传图片
handleAddImg(){ handleAddImg(){
let {state} = this.props; let {state} = this.props;
let {storeInfo} = state; let {storeInfo,scanBarCode} = state;
console.log(scanBarCode);
console.log("+===================scanBarcode==============")
let tmpUrl = ""; let tmpUrl = "";
tmpUrl: `${ENV.uploadImg}/${storeInfo.taskId}/${this.state.taskTy}` tmpUrl = `${ENV.uploadImg}/${scanBarCode.inventorylossId}/${this.state.taskTy}`
this.setState({ this.setState({
"showQr":true, "showQr":true,
"taskTy":tmpUrl "qrUrl":tmpUrl
},()=>{ },()=>{
console.log(tmpUrl) console.log(this.state.qrUrl)
}) })
console.log("添加照片") console.log("添加照片")
} }
...@@ -158,29 +165,27 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -158,29 +165,27 @@ export default class ScanBarCodeContainer extends React.Component{
} }
//点击编辑报损的商品的提交按钮 //点击编辑报损的商品的提交按钮
handleSubmitProductInfo(data){ handleSubmitProductInfo(data){
let {submitProductInfo} = this.props; let {submitProductInfo,userInfo,storeInfo,headerInfo} = this.props;
let postaData ={}; //检查如果选择了 包装损坏还没有上传图片的话进行提示
postaData.taskId = "dfdf"; let pakageStatus = data.packingStatus;
postaData.inventoryLossId = data.inventoryLossId; let packingStatusImageIds = data.data_currentProblemObj;
postaData.lossPostion = data.lossPostion; data.taskId = headerInfo.taskId?Number(headerInfo.taskId):Number(500)
postaData.packingStatus = data.packingStatus; submitProductInfo(data);
postaData.packingStatusImageIds = data.packingStatusImageIds; /* changePages(CONFIG.showPage[3])*/
console.log(postaData)
submitProductInfo(postaData);
//让弹窗消失 //让弹窗消失
this.setState({ //让弹窗消失
/*this.setState({
showProductInfo:false, showProductInfo:false,
popupInfo:{ popupInfo:{
"showPopup":false, "showPopup":false,
} }
}) })*/
} }
render() { render() {
let {state} = this.props; let {state} = this.props;
let {userInfo,storeInfo} = state; let {userInfo,storeInfo} = state;
let productInfo = state.scanBarCode; let productInfo = state.scanBarCode;
let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo; let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo;
return ( return (
<div className={"scanBarCodeContainer"}> <div className={"scanBarCodeContainer"}>
{this.state.showQr?( {this.state.showQr?(
......
...@@ -49,10 +49,14 @@ function addNewProblem(state,data) { ...@@ -49,10 +49,14 @@ function addNewProblem(state,data) {
return newInfo; return newInfo;
} }
function deleteProblemItem(state,data) { function deleteProblemItem(state,data) {
let feedId = data.feeds; console.log('==================data===========');
feedId.map((item,index)=>{ console.log(data);
delete allFeeds[item] let feedId = data.feedIds;
}) if(feedId){
delete allFeeds[feedId]
}else{
allFeeds = {}
}
state.data_allProblemList = allFeeds; state.data_allProblemList = allFeeds;
let newInfo = Object.assign({},state,data); let newInfo = Object.assign({},state,data);
return newInfo; return newInfo;
...@@ -70,6 +74,8 @@ function submitProblemList(state,data) { ...@@ -70,6 +74,8 @@ function submitProblemList(state,data) {
function editProblem(state,data) { function editProblem(state,data) {
console.log(data); console.log(data);
let problemId = data.troubelId; let problemId = data.troubelId;
console.log("=====================problemId");
console.log(problemId)
let type = data.type; let type = data.type;
let currentProblemObj = allFeeds[problemId]; let currentProblemObj = allFeeds[problemId];
if(type == "remark"){ if(type == "remark"){
...@@ -81,6 +87,9 @@ function editProblem(state,data) { ...@@ -81,6 +87,9 @@ function editProblem(state,data) {
if(type == "detailProblemType"){ if(type == "detailProblemType"){
currentProblemObj.detailProblemType = data.problemId; currentProblemObj.detailProblemType = data.problemId;
} }
if(type == "imgFiles"){
currentProblemObj.files = data.files;
}
state.data_allProblemList = allFeeds; state.data_allProblemList = allFeeds;
return state; return state;
......
import * as actionTypes from '../actiontype/reportDamage'; import * as actionTypes from '../actiontype/reportDamage';
function initDamgeListSuccess(state,data) { function initDamgeListSuccess(state,data) {
console.log(data); console.log("reportDamageList=============")
console.log("============newData"); console.log(state);
let newInfo = Object.assign([],state,data); let newInfo = Object.assign([],data);
return newInfo; return newInfo;
} }
function deleteDamgeItemSuccess(state,data) { function deleteDamgeItemSuccess(state,data) {
...@@ -13,8 +13,6 @@ export default function(state={}, action) { ...@@ -13,8 +13,6 @@ export default function(state={}, action) {
switch (action.type) { switch (action.type) {
case actionTypes.INIT_GETDAMGELIST_SUCCESS: case actionTypes.INIT_GETDAMGELIST_SUCCESS:
return initDamgeListSuccess(state,action.data) return initDamgeListSuccess(state,action.data)
case actionTypes.DELET_DAMAGEITEM_SUCCESS:
return deleteDamgeItemSuccess(state,action.data)
default: default:
return state; return state;
} }
......
import * as actionTypes from '../actiontype/ScanBarCode'; import * as actionTypes from '../actiontype/ScanBarCode';
let currentProductInfo = {}; let currentProductInfo = {};
function initSuccess(state,data) { function initSuccess(state,data) {
currentProductInfo.inventorylossId = data.inventorylossId; currentProductInfo.inventoryLossId = data.inventorylossId;
currentProductInfo.packingStatusImageIds = [];
currentProductInfo.lossPostion = undefined;
currentProductInfo.packingStatus = undefined;
data.data_currentProblemObj = Object.assign({},currentProductInfo); data.data_currentProblemObj = Object.assign({},currentProductInfo);
let newInfo = Object.assign({},state,data); let newInfo = Object.assign({},state,data);
return newInfo; return newInfo;
...@@ -12,8 +15,6 @@ function submitSuccess(state,data) { ...@@ -12,8 +15,6 @@ function submitSuccess(state,data) {
} }
function saveInfoSuccess(state,data) { function saveInfoSuccess(state,data) {
console.log("====================reducer================")
console.log(data);
if(data.type == "productPosition"){ if(data.type == "productPosition"){
currentProductInfo.lossPostion = data.data; currentProductInfo.lossPostion = data.data;
} }
......
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