Commit 87f6b29c authored by wangchunxiang's avatar wangchunxiang

组件修复

parent 94fee42f
Pipeline #2092 passed with stage
in 1 second
This diff is collapsed.
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
...@@ -62,9 +68,10 @@ const { TextArea } = Input; ...@@ -62,9 +68,10 @@ 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,42 +117,31 @@ const { TextArea } = Input; ...@@ -110,42 +117,31 @@ 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) => {
console.log(values)
if (!err) {
console.log('Received values of form: ', values);
HttpClient.post(Api.addUser,{...values}).then(data => { HttpClient.post(Api.addUser,{...values}).then(data => {
this.setState({ visible: false }); if(data){
message.success('操作成功!')
this.addModal.handleCancel()
this.getList(this.defaultParams) 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.setState({ visible_edit: false }); this.resetModal.handleCancel()
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) => {
if(list){ showBatchModal = () => {
this.setState({visible: true,list:list,title:'编辑用户'}); this.addModal.showModal()
}else{
this.setState({visible: true,title:'新增用户'});
}
}; };
...@@ -183,138 +179,84 @@ const { TextArea } = Input; ...@@ -183,138 +179,84 @@ const { TextArea } = Input;
}, },
}; };
const {list,title}=this.state; const {list,title}=this.state;
return( const configAdd={
<Fragment> title:'添加用户',
<ItemNav itemNav={this.itemNav} /> render:[
<section className='content-base'>
<div className='mb-20 formwrapper'>
<div className='formBg'><ItemTableQuery getTableQuery={this.getTableQuery} resetParams={this.resetParams} itemTableQuery={itemTableQuery} /></div>
<Button type='primary' className='ml-20' onClick={()=> this.showBatchModal()}>添加</Button>
</div>
<ItemTable columns={this.columns} dataSource={this.state.dataSource} pager={this.pager} />
</section>
<Modal title={title}
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}>
<Form {...formItemLayout} >
<Form.Item label="姓名">
{getFieldDecorator('name', {
// initialValue:list?list.name:'',
rules: [
{ {
required: true, label:'姓名',
message: '请选择', type:"input",
key:'name',
required:true
}, },
],
})(
<Input/>
)}
</Form.Item>
<Form.Item label="真实姓名">
{getFieldDecorator('realName', {
// initialValue:list?list.realName:'',
rules: [
{ {
required: true, label:'真实姓名',
message: '请选择', type:"input",
key:'realName',
required:true
}, },
],
})(
<Input/>
)}
</Form.Item>
<Form.Item label="密码">
{getFieldDecorator('pwd', {
// initialValue:list?list.pwd:'',
rules: [
{ {
required: true, label:'密码',
message: '请选择', type:"password",
key:'pwd',
required:true
},
{
label:'手机号',
type:"input",
key:'phone',
//required:true
}, },
],
})(
<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, label:'邮箱',
message: '请选择', type:"input",
key:'email',
//required:true
}, },
{
label:'备注',
type:"input",
key:'remark',
//required:true
}
], ],
})( dataSource:list,
<Input disabled/> getOutput:this.handleOk,
)} }
</Form.Item> const config={
<Form.Item label="密码"> title:'重置密码',
{getFieldDecorator('pwd', { render:[
// initialValue:list?list.realName:'',
rules: [
{ {
required: true, label:'用户ID',
message: '请选择', type:"input",
key:'id',
disabled:true,
required:true
}, },
{
label:'密码',
type:"password",
key:'pwd',
required:true
}
], ],
})( dataSource:list,
<Input/> getOutput:this.handleOkEdit,
)} }
</Form.Item> return(
<Fragment>
<ItemNav itemNav={this.itemNav} />
<section className='content-base'>
<div className='mb-20 formwrapper'>
<div className='formBg'><ItemTableQuery getTableQuery={this.getTableQuery} resetParams={this.resetParams} itemTableQuery={itemTableQuery} /></div>
<Button type='primary' className='ml-20' onClick={()=> this.showBatchModal()}>添加</Button>
</div>
<ItemTable columns={this.columns} dataSource={this.state.dataSource} pager={this.pager} />
</section>
<ItemModal config={configAdd} ref={r=> this.addModal =r}/>
<ItemModal config={config} ref={r=> this.resetModal =r}/>
</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