From d101606487ff7a358e2093ac22f8eb3874f60ddc Mon Sep 17 00:00:00 2001 From: LKWYZ Date: Mon, 18 Jul 2022 21:35:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userComponents/others/GoodsChosen.js | 2 +- src/userComponents/userLogin/UserLogin.jsx | 39 +- src/userComponents/userLogin/UserRegister.js | 10 +- .../homeIn/CreateInApplication.js | 7 +- .../homeOut/CreateOutApplication.js | 376 +++++++++--------- .../homeTrading/CreateTradingApplication.js | 293 ++++++++------ 6 files changed, 397 insertions(+), 330 deletions(-) diff --git a/src/userComponents/others/GoodsChosen.js b/src/userComponents/others/GoodsChosen.js index 2aad5e5..9eaab3b 100644 --- a/src/userComponents/others/GoodsChosen.js +++ b/src/userComponents/others/GoodsChosen.js @@ -23,7 +23,7 @@ class GoodsChosen extends React.Component { return true } }} - onSelect={(value,key)=>{const { onChange } = this.props;onChange(value,key);console.log(value,key.props.key);}} + onSelect={(value)=>{const { onChange } = this.props;onChange(value);console.log(value);}} defaultActiveFirstOption={false} placeholder="货物名称-货物编号" size="small" diff --git a/src/userComponents/userLogin/UserLogin.jsx b/src/userComponents/userLogin/UserLogin.jsx index 236a4c2..98a0630 100644 --- a/src/userComponents/userLogin/UserLogin.jsx +++ b/src/userComponents/userLogin/UserLogin.jsx @@ -21,18 +21,18 @@ class UserInput extends React.Component{ constructor(props){ super(props); this.state={ - userUserName:'', + username:'', password:'', inVCode:'', rightVCode:'', imgCode:"", result:'', - code:'', isInfoRight:false, } this.infoChange=this.infoChange.bind(this); this.psChange=this.psChange.bind(this); + this.codeChange=this.codeChange.bind(this); //this.vcChange=this.vcChange.bind(this); this.infoRight=this.infoRight.bind(this); this.infoFalse=this.infoFalse.bind(this); @@ -47,7 +47,7 @@ class UserInput extends React.Component{ axios({ method: 'get', - url: 'http://10.128.137.205:8088/passport/generate-code', + url: 'http://10.255.14.225:8088/passport/generate-code', }) .then(response=> { @@ -73,7 +73,7 @@ class UserInput extends React.Component{ //修改用户信息和密码 infoChange(event){ this.setState({ - userUserName:event.target.value, + username:event.target.value, }); } psChange(event){ @@ -81,9 +81,14 @@ class UserInput extends React.Component{ password:event.target.value, }); } + codeChange(event){ + this.setState({ + inVCode:event.target.value, + }); + } getCode(event){ - axios.get("http://10.128.137.205:8088/passport/generate-code",{withCredentials:true}).then(res=>{ + axios.get("http://10.255.14.225:8088/passport/generate-code",{withCredentials:true}).then(res=>{ this.setState({ imgCode : res.data }) @@ -136,10 +141,25 @@ class UserInput extends React.Component{ //登录按钮功能 loginBtn(event){ - const userUserName=this.state.userUserName; - const password=this.state.password; - const inVCode=this.state.inVCode; + console.log(this.state.inVCode); + axios({ + method: 'post', + url: 'http://10.255.14.225:8088/passport/userlogin', + params:{ + code:this.state.inVCode, + password:this.state.password, + userName:this.state.username, + } + }) + .then(response=> { + console.log(response); + alert(response.data.message); + }) + .catch(function (error) { + console.log(error.config); + }); + /* if(userUserName==123&&password==123){ this.setState({ isInfoRight:true, @@ -158,6 +178,7 @@ class UserInput extends React.Component{ }) }) + */ event.preventDefault(); } @@ -180,7 +201,7 @@ class UserInput extends React.Component{
- } className='relative inset-x-0 h-9 w-96 rounded-md' /> + } className='relative inset-x-0 h-9 w-96 rounded-md' /> {/** 输入验证码: */}
diff --git a/src/userComponents/userLogin/UserRegister.js b/src/userComponents/userLogin/UserRegister.js index 2b656a3..7d7b580 100644 --- a/src/userComponents/userLogin/UserRegister.js +++ b/src/userComponents/userLogin/UserRegister.js @@ -99,7 +99,7 @@ class UserRegister extends React.Component{ if(this.state.password==this.state.passagain&&this.state.userName!=null&&this.state.userUsername!=null&&this.state.password!=null&&this.state.userPhonenum!=null){ axios({ method: 'post', - url: 'http://10.128.137.205:8088/passport/registry', + url: 'http://10.255.14.225:8088/passport/registry', data:{ userName:this.state.userName, userUsername:this.state.userUsername, @@ -110,7 +110,7 @@ class UserRegister extends React.Component{ }) .then(response=> { console.log(response); - alert('注册成功!'); + alert(response.data.message); }) .catch(function (error) { console.log(error.config); @@ -139,9 +139,9 @@ class UserRegister extends React.Component{

} className='relative inset-x-0 h-9 w-96 rounded-md' value={this.state.userPhonenum} onChange={this.phonenumChange} />

- + +

diff --git a/src/userComponents/userManageCenter/homeIn/CreateInApplication.js b/src/userComponents/userManageCenter/homeIn/CreateInApplication.js index d9384b0..d0248e3 100644 --- a/src/userComponents/userManageCenter/homeIn/CreateInApplication.js +++ b/src/userComponents/userManageCenter/homeIn/CreateInApplication.js @@ -77,7 +77,7 @@ class CreateInApplication extends React.Component{ - + {/** - - remove(name)} /> + */} + + remove(name)} /> ))} diff --git a/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js b/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js index 23d81f4..34fd19c 100644 --- a/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js +++ b/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js @@ -1,107 +1,111 @@ //申请提货的面板label //还要加仓库:仓库号+仓位;货物最大数量;信息只留IC -import React from 'react'; +import React, { useState, useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, Form, Input, Space, Typography } from 'antd'; +import { Button, Form, Input, Space, Typography, Select } from 'antd'; import axios from "axios"; +import { CgRemove } from "react-icons/cg"; +import { nanoid } from "nanoid"; import { StorgeChosen, DateSelect, GoodsChosen } from '../../index'; -class CreateOutApplication extends React.Component{ - constructor(props){ - super(props); - this.state={ - idKey:"", - productVOList:[], - allData:[ - { - "inventoryOwner": "ICb4e2ad2c", - "inventoryRepository": 1, - "inventoryPosition": 3, - "inventoryProduct": 148, - "inventoryProductName": "冰红茶", - "inventoryNum": 0, - "inventoryIn": 10, - "inventoryOut": 10, - "inventoryRecent": 10, - "inventoryCreatetime": null, - "inventoryId": 15 - }, - { - "inventoryOwner": "ICb4e2ad2c", - "inventoryRepository": 1, - "inventoryPosition": 2, - "inventoryProduct": 149, - "inventoryProductName": "荔枝", - "inventoryNum": 10, - "inventoryIn": 80, - "inventoryOut": 70, - "inventoryRecent": 5, - "inventoryCreatetime": null, - "inventoryId": 17 - }, - { - "inventoryOwner": "ICb4e2ad2c", - "inventoryRepository": 1, - "inventoryPosition": 3, - "inventoryProduct": 149, - "inventoryProductName": "荔枝", - "inventoryNum": 10, - "inventoryIn": 20, - "inventoryOut": 10, - "inventoryRecent": 20, - "inventoryCreatetime": null, - "inventoryId": 18 - }, - { - "inventoryOwner": "ICb4e2ad2c", - "inventoryRepository": 1, - "inventoryPosition": 1, - "inventoryProduct": 150, - "inventoryProductName": "水", - "inventoryNum": 10, - "inventoryIn": 50, - "inventoryOut": 40, - "inventoryRecent": 50, - "inventoryCreatetime": "2022-07-14T18:31:30", - "inventoryId": 19 - }, - { - "inventoryOwner": "ICb4e2ad2c", - "inventoryRepository": 1, - "inventoryPosition": 3, - "inventoryProduct": 150, - "inventoryProductName": "水", - "inventoryNum": 30, - "inventoryIn": 50, - "inventoryOut": 20, - "inventoryRecent": 0, - "inventoryCreatetime": "2022-07-14T18:31:30", - "inventoryId": 21 - } - ] - } - this.addForm=this.addForm.bind(this); - this.onFinish=this.onFinish.bind(this); - this.onSubmit=this.onSubmit.bind(this); - this.onSelect=this.onSelect.bind(this); + +const allData=[ + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 148, + "inventoryProductName": "冰红茶", + "inventoryNum": 0, + "inventoryIn": 10, + "inventoryOut": 10, + "inventoryRecent": 10, + "inventoryCreatetime": null, + "inventoryId": 15 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 2, + "inventoryProduct": 149, + "inventoryProductName": "荔枝", + "inventoryNum": 10, + "inventoryIn": 80, + "inventoryOut": 70, + "inventoryRecent": 5, + "inventoryCreatetime": null, + "inventoryId": 17 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 149, + "inventoryProductName": "荔枝", + "inventoryNum": 10, + "inventoryIn": 20, + "inventoryOut": 10, + "inventoryRecent": 20, + "inventoryCreatetime": null, + "inventoryId": 18 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 1, + "inventoryProduct": 150, + "inventoryProductName": "水", + "inventoryNum": 10, + "inventoryIn": 50, + "inventoryOut": 40, + "inventoryRecent": 50, + "inventoryCreatetime": "2022-07-14T18:31:30", + "inventoryId": 19 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 150, + "inventoryProductName": "水", + "inventoryNum": 30, + "inventoryIn": 50, + "inventoryOut": 20, + "inventoryRecent": 0, + "inventoryCreatetime": "2022-07-14T18:31:30", + "inventoryId": 21 } + ] - onFinish(values){ - this.setState({ - productVOList:values.productInfo, - },()=>{console.log(this.state.productVOList)} - ) - console.log('Received values of form:', values); - }; - onSubmit(event){ - var time=new Date().toLocaleTimeString(); - console.log(this.state.productVOList); +const { Option } = Select; +const CreateOutApplication=()=>{ + const [productVOList, setProductVOList] = useState([]); + const [userIc, setUserIc] = useState(null); + + const addGoodsItem = () => { + setProductVOList([ + ...productVOList, + { inventoryNum: null, inventoryId: null, inventoryProductName: null }, + ]); + }; + + const removeGoodsItem = (e, index) => { + e.stopPropagation(); + let newList = [...productVOList]; + newList.splice(index, 1); + setProductVOList([...newList]); + }; + + + const onSubmit=(event)=>{ + console.log(productVOList); + axios({ method: 'post', - url: 'http://10.128.137.205:8088/user/userhome/manage/outstorage/order', - data:this.state.productVOList, + url: 'http://10.133.131.187:8088/user/userhome/manage/outstorage/order', + data:productVOList, //orderCreatetime: "2022-07-14T07:47:57.850Z", //orderCreatetime:time, @@ -117,99 +121,11 @@ class CreateOutApplication extends React.Component{ console.log(error.config); console.log("2"); }); + } - /* - formRef = React.createRef(); - -*/ - onSelect = (value,key) => { - this.formRef.current.setFieldsValue({ - inventoryId: key.props.key, - }); - }; - - formRef = React.createRef(); - addForm(){ - return( -
- - {(fields, { add, remove }) => ( - <> - {fields.map(({ key, name, ...restField }) => ( - - - - - - - - - {({ setFieldsValue }) =>setFieldsValue(1)} - - - - - - - - remove(name)} /> - - ))} - - - - - )} - - - - - -
- ) - } - - - - render(){ - return( -
+ return( +
@@ -231,30 +147,92 @@ class CreateOutApplication extends React.Component{

- {/**
- -
{}
- - -

- -
{}
-
*/}
- -
-

+ {productVOList.map((item, index) => ( +
+ + +
+ +
+ + + { + let newList = [...productVOList]; + newList[index].inventoryNum = e.target.value; + setProductVOList([...newList]); + }} + placeholder="请输入货物数量" + /> + + {index !== 0 && ( +
removeGoodsItem(e, index)} + > + +
+ )} +
+
+
+ ))} +
+ + + + +
+



- +



- ) - - } + ) } + export default CreateOutApplication; \ No newline at end of file diff --git a/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js b/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js index ebb7e3b..a446889 100644 --- a/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js +++ b/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js @@ -1,41 +1,113 @@ -//申请提货的面板label - -import React from 'react'; +import React, { useState, useEffect } from 'react'; import ReactDOM from 'react-dom/client'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, Form, Input, Space } from 'antd'; +import { Button, Form, Input, Space, Typography, Select } from 'antd'; import axios from "axios"; -import { StorgeChosen, DateSelect, GoodsChosen, } from '../../index'; +import { CgRemove } from "react-icons/cg"; +import { nanoid } from "nanoid"; +import { StorgeChosen, DateSelect, GoodsChosen } from '../../index'; + -class CreateTradingApplication extends React.Component{ - constructor(props){ - super(props); - this.state={ - productVOList:[], - } - this.addForm=this.addForm.bind(this); - this.onFinish=this.onFinish.bind(this); - this.onSubmit=this.onSubmit.bind(this); +const allData=[ + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 148, + "inventoryProductName": "冰红茶", + "inventoryNum": 0, + "inventoryIn": 10, + "inventoryOut": 10, + "inventoryRecent": 10, + "inventoryCreatetime": null, + "inventoryId": 15 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 2, + "inventoryProduct": 149, + "inventoryProductName": "荔枝", + "inventoryNum": 10, + "inventoryIn": 80, + "inventoryOut": 70, + "inventoryRecent": 5, + "inventoryCreatetime": null, + "inventoryId": 17 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 149, + "inventoryProductName": "荔枝", + "inventoryNum": 10, + "inventoryIn": 20, + "inventoryOut": 10, + "inventoryRecent": 20, + "inventoryCreatetime": null, + "inventoryId": 18 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 1, + "inventoryProduct": 150, + "inventoryProductName": "水", + "inventoryNum": 10, + "inventoryIn": 50, + "inventoryOut": 40, + "inventoryRecent": 50, + "inventoryCreatetime": "2022-07-14T18:31:30", + "inventoryId": 19 + }, + { + "inventoryOwner": "ICb4e2ad2c", + "inventoryRepository": 1, + "inventoryPosition": 3, + "inventoryProduct": 150, + "inventoryProductName": "水", + "inventoryNum": 30, + "inventoryIn": 50, + "inventoryOut": 20, + "inventoryRecent": 0, + "inventoryCreatetime": "2022-07-14T18:31:30", + "inventoryId": 21 } + ] + const { Option } = Select; +const CreateTradingApplication=()=>{ + const [productVOList, setProductVOList] = useState([[]]); + const [userIc, setUserIc] = useState(null); - onFinish(values){ - this.setState({ - productVOList:values.productInfo, - },()=>{console.log(this.state.productVOList)} - ) - console.log('Received values of form:', values); + const addGoodsItem = () => { + setProductVOList([ + ...productVOList, + { inventoryNum: null, inventoryId: null, inventoryProductName: null }, + ]); + }; + + const removeGoodsItem = (e, index) => { + e.stopPropagation(); + let newList = [...productVOList]; + newList.splice(index, 1); + setProductVOList([...newList]); }; - onSubmit(event){ - var time=new Date().toLocaleTimeString(); + const onSubmit=(event)=>{ + console.log(productVOList); + console.log(userIc); + axios({ method: 'post', url: 'http://10.128.137.205:8088/user/userhome/manage/trading/order', - data:{ + data:productVOList, + //orderCreatetime: "2022-07-14T07:47:57.850Z", //orderCreatetime:time, - productVOList:this.state.productVOList, - } + + //inventoryList:this.state.productVOList, + }) .then(response=> { console.log(response); @@ -45,78 +117,11 @@ class CreateTradingApplication extends React.Component{ console.log(error.config); console.log("2"); }); + } - - addForm(){ - return( -
- - {(fields, { add, remove }) => ( - <> - {fields.map(({ key, name, ...restField }) => ( - - - - - {/** */} -
-
- - - - - remove(name)} /> -
- ))} - - - - - )} -
- - - - -
- ) - } - - - - render(){ - return( -
+ return( +
@@ -138,33 +143,95 @@ class CreateTradingApplication extends React.Component{

- {/**
- -
{}
- - -

- -
{}
-
*/} - - -

+
- + + {setUserIc(e.target.value)}} className='rounded-md outline outline-1 outline-gray-700 relative inset-x-1 w-44'> +

+ {productVOList.map((item, index) => ( +
+ + +
+
-

+ + + { + let newList = [...productVOList]; + newList[index].inventoryNum = e.target.value; + setProductVOList([...newList]); + }} + placeholder="请输入货物数量" + /> + + {index !== 0 && ( +
removeGoodsItem(e, index)} + > + +
+ )} +
+
+
+ ))} +
+ + + + +
+



- +



- ) - - } + ) } export default CreateTradingApplication; \ No newline at end of file -- Gitee