Commit 87f6b29c authored by wangchunxiang's avatar wangchunxiang

组件修复

parent 94fee42f
Pipeline #2092 passed with stage
in 1 second
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
<link rel="shortcut icon" href="./favicon.png"><link href="./css\1.css" rel="stylesheet"><link href="./css\index.css" rel="stylesheet"></head> <link rel="shortcut icon" href="./favicon.png"><link href="./css\1.css" rel="stylesheet"><link href="./css\index.css" rel="stylesheet"></head>
<body> <body>
<div id="ice-container"></div> <div id="ice-container"></div>
<script type="text/javascript" src="./vendors~index.a924e8bb586f543bbe22.js"></script><script type="text/javascript" src="./index.8cfda429281ba29719a0.js"></script></body> <script type="text/javascript" src="./vendors~index.492db4ef39b5fbb503d6.js"></script><script type="text/javascript" src="./index.628eea446c6fa047c11d.js"></script></body>
</html> </html>
...@@ -40,26 +40,27 @@ class FormTpl extends Component { ...@@ -40,26 +40,27 @@ class FormTpl extends Component {
return return
} }
}else{ }else{
let product_list = values.product_list; // let product_list = values.product_list;
if(product_list && product_list.length > 0){ // if(product_list && product_list.length > 0){
let content = "请填写完整"; // let content = "请填写完整";
product_list.forEach((element)=>{ // product_list.forEach((element)=>{
if(!element.price && element.product_id) { // if(!element.price && element.product_id) {
content = content + element.product_id + ":"; // content = content + element.product_id + ":";
}else if(!element.product_id && element.price) { // }else if(!element.product_id && element.price) {
content = content + ":" + element.price; // content = content + ":" + element.price;
} else if(!element.price && !element.product_id) { // } else if(!element.price && !element.product_id) {
content = content + ":"; // content = content + ":";
} // }
}) // })
let flag = product_list.some((element)=>{ // let flag = product_list.some((element)=>{
return !element.price || !element.product_id; // return !element.price || !element.product_id;
}) // })
if(flag){ // if(flag){
this.showConfirm(content); // this.showConfirm(content);
return; // return;
} // }
} // }
console.log(values)
this.props.getReqParams(values); this.props.getReqParams(values);
} }
}); });
......
...@@ -18,8 +18,8 @@ export default class ItemModal extends React.Component{ ...@@ -18,8 +18,8 @@ export default class ItemModal extends React.Component{
}); });
}; };
handleOk = () => { handleOk = (e) => {
this.modalConfirm.handleSubmit(); this.modalConfirm.handleSubmit(e);
if(this.props.config && this.props.config.autoClose){ if(this.props.config && this.props.config.autoClose){
this.handleCancel(); this.handleCancel();
} }
......
...@@ -10,6 +10,8 @@ import { set, get } from "../../service/Global"; ...@@ -10,6 +10,8 @@ import { set, get } from "../../service/Global";
import {Tag, Button, Empty, Modal, Table, Input,Form, Popconfirm,message} from 'antd'; import {Tag, Button, Empty, Modal, Table, Input,Form, Popconfirm,message} from 'antd';
import {dateFormat, parseParams} from "../../service/utils"; import {dateFormat, parseParams} from "../../service/utils";
import {Store} from "marine"; import {Store} from "marine";
import ItemModal from '../../components/ItemModal/ItemModal';
import ItemForm from '../../components/ItemForm';
const { TextArea } = Input; const { TextArea } = Input;
@withRouter @withRouter
class User extends React.Component{ class User extends React.Component{
...@@ -22,8 +24,12 @@ const { TextArea } = Input; ...@@ -22,8 +24,12 @@ const { TextArea } = Input;
list:{}, list:{},
dataSource:{}, dataSource:{},
} }
this.resetModal = React.createRef();
this.addModal = React.createRef();
} }
form; form;
resetModal;
addModal;
defaultParams = { defaultParams = {
page:1, page:1,
pageSize:10 pageSize:10
...@@ -61,10 +67,11 @@ const { TextArea } = Input; ...@@ -61,10 +67,11 @@ const { TextArea } = Input;
}) })
} }
handleEditPwd=(list)=>{ handleEditPwd=(list)=>{
this.setState({ this.setState({
visible_edit:true, list:list
list:list })
}) this.resetModal.showModal()
} }
handleDelete=(record)=>{ handleDelete=(record)=>{
return HttpClient.post(Api.deleteUserList,{id:record.id}).then(data => { return HttpClient.post(Api.deleteUserList,{id:record.id}).then(data => {
...@@ -110,43 +117,32 @@ const { TextArea } = Input; ...@@ -110,43 +117,32 @@ const { TextArea } = Input;
handleCancel = () => { handleCancel = () => {
this.setState({ visible: false,visible_edit:false }); this.setState({ visible: false,visible_edit:false });
}; };
handleOk=()=>{ handleOk=(values)=>{
this.props.form.validateFields((err, values) => { HttpClient.post(Api.addUser,{...values}).then(data => {
console.log(values) if(data){
if (!err) { message.success('操作成功!')
console.log('Received values of form: ', values); this.addModal.handleCancel()
HttpClient.post(Api.addUser,{...values}).then(data => { this.getList(this.defaultParams)
this.setState({ visible: false }); }
this.getList(this.defaultParams) })
})
}
});
} }
handleOkEdit=()=>{ handleOkEdit=(values)=>{
this.props.form.validateFields((err, values) => { HttpClient.post(Api.rePwd,{id:values.id,pwd:values.pwd}).then(data => {
HttpClient.post(Api.rePwd,{id:values.id,pwd:values.pwd}).then(data => { if(data){
if(data){ message.success('操作成功!')
message.success('操作成功!') this.resetModal.handleCancel()
this.setState({ visible_edit: false }); this.getList(this.defaultParams)
this.getList(this.defaultParams) }
}
})
})
});
} }
getExcel = () => {
// window.open(parseParams(Api.crm_order,Object.assign(this.defaultParams,{api_token:get('token'),export:1})));
};
showBatchModal = (list) => { showBatchModal = () => {
if(list){ this.addModal.showModal()
this.setState({visible: true,list:list,title:'编辑用户'});
}else{
this.setState({visible: true,title:'新增用户'});
}
}; };
...@@ -183,6 +179,69 @@ const { TextArea } = Input; ...@@ -183,6 +179,69 @@ const { TextArea } = Input;
}, },
}; };
const {list,title}=this.state; const {list,title}=this.state;
const configAdd={
title:'添加用户',
render:[
{
label:'姓名',
type:"input",
key:'name',
required:true
},
{
label:'真实姓名',
type:"input",
key:'realName',
required:true
},
{
label:'密码',
type:"password",
key:'pwd',
required:true
},
{
label:'手机号',
type:"input",
key:'phone',
//required:true
},
{
label:'邮箱',
type:"input",
key:'email',
//required:true
},
{
label:'备注',
type:"input",
key:'remark',
//required:true
}
],
dataSource:list,
getOutput:this.handleOk,
}
const config={
title:'重置密码',
render:[
{
label:'用户ID',
type:"input",
key:'id',
disabled:true,
required:true
},
{
label:'密码',
type:"password",
key:'pwd',
required:true
}
],
dataSource:list,
getOutput:this.handleOkEdit,
}
return( return(
<Fragment> <Fragment>
<ItemNav itemNav={this.itemNav} /> <ItemNav itemNav={this.itemNav} />
...@@ -194,127 +253,10 @@ const { TextArea } = Input; ...@@ -194,127 +253,10 @@ const { TextArea } = Input;
<ItemTable columns={this.columns} dataSource={this.state.dataSource} pager={this.pager} /> <ItemTable columns={this.columns} dataSource={this.state.dataSource} pager={this.pager} />
</section> </section>
<Modal title={title} <ItemModal config={configAdd} ref={r=> this.addModal =r}/>
visible={this.state.visible} <ItemModal config={config} ref={r=> this.resetModal =r}/>
onOk={this.handleOk}
onCancel={this.handleCancel}>
<Form {...formItemLayout} >
<Form.Item label="姓名">
{getFieldDecorator('name', {
// initialValue:list?list.name:'',
rules: [
{
required: true,
message: '请选择',
},
],
})(
<Input/>
)}
</Form.Item>
<Form.Item label="真实姓名">
{getFieldDecorator('realName', {
// initialValue:list?list.realName:'',
rules: [
{
required: true,
message: '请选择',
},
],
})(
<Input/>
)}
</Form.Item>
<Form.Item label="密码">
{getFieldDecorator('pwd', {
// initialValue:list?list.pwd:'',
rules: [
{
required: true,
message: '请选择',
},
],
})(
<Input type='password'/>
)}
</Form.Item>
<Form.Item label="手机号">
{getFieldDecorator('phone', {
// initialValue:list?list.phone:'',
// rules: [
// {
// required: true,
// message: '请选择',
// },
// ],
})(
<Input type='phone'/>
)}
</Form.Item>
<Form.Item label="邮箱">
{getFieldDecorator('email', {
// initialValue:list?list.email:'',
// rules: [
// {
// required: true,
// message: '请选择',
// },
// ],
})(
<Input type='email'/>
)}
</Form.Item>
<Form.Item label="备注">
{getFieldDecorator('remark', {
// initialValue:list?list.remark:'',
// rules: [
// {
// required: true,
// message: '请选择',
// },
// ],
})(
<Input type='text'/>
)}
</Form.Item>
</Form>
</Modal>
<Modal title={title}
visible={this.state.visible_edit}
onOk={this.handleOkEdit}
onCancel={this.handleCancel}>
<Form {...formItemLayout} >
<Form.Item label="用户ID">
{getFieldDecorator('id', {
initialValue:list?list.id:'',
rules: [
{
required: true,
message: '请选择',
},
],
})(
<Input disabled/>
)}
</Form.Item>
<Form.Item label="密码">
{getFieldDecorator('pwd', {
// initialValue:list?list.realName:'',
rules: [
{
required: true,
message: '请选择',
},
],
})(
<Input/>
)}
</Form.Item>
</Form>
</Modal>
</Fragment> </Fragment>
) )
} }
......
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