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 @@
<link rel="shortcut icon" href="./favicon.png"><link href="./css\1.css" rel="stylesheet"><link href="./css\index.css" rel="stylesheet"></head>
<body>
<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>
......@@ -40,26 +40,27 @@ class FormTpl extends Component {
return
}
}else{
let product_list = values.product_list;
if(product_list && product_list.length > 0){
let content = "请填写完整";
product_list.forEach((element)=>{
if(!element.price && element.product_id) {
content = content + element.product_id + ":";
}else if(!element.product_id && element.price) {
content = content + ":" + element.price;
} else if(!element.price && !element.product_id) {
content = content + ":";
}
})
let flag = product_list.some((element)=>{
return !element.price || !element.product_id;
})
if(flag){
this.showConfirm(content);
return;
}
}
// let product_list = values.product_list;
// if(product_list && product_list.length > 0){
// let content = "请填写完整";
// product_list.forEach((element)=>{
// if(!element.price && element.product_id) {
// content = content + element.product_id + ":";
// }else if(!element.product_id && element.price) {
// content = content + ":" + element.price;
// } else if(!element.price && !element.product_id) {
// content = content + ":";
// }
// })
// let flag = product_list.some((element)=>{
// return !element.price || !element.product_id;
// })
// if(flag){
// this.showConfirm(content);
// return;
// }
// }
console.log(values)
this.props.getReqParams(values);
}
});
......
......@@ -18,8 +18,8 @@ export default class ItemModal extends React.Component{
});
};
handleOk = () => {
this.modalConfirm.handleSubmit();
handleOk = (e) => {
this.modalConfirm.handleSubmit(e);
if(this.props.config && this.props.config.autoClose){
this.handleCancel();
}
......
......@@ -10,6 +10,8 @@ import { set, get } from "../../service/Global";
import {Tag, Button, Empty, Modal, Table, Input,Form, Popconfirm,message} from 'antd';
import {dateFormat, parseParams} from "../../service/utils";
import {Store} from "marine";
import ItemModal from '../../components/ItemModal/ItemModal';
import ItemForm from '../../components/ItemForm';
const { TextArea } = Input;
@withRouter
class User extends React.Component{
......@@ -22,8 +24,12 @@ const { TextArea } = Input;
list:{},
dataSource:{},
}
this.resetModal = React.createRef();
this.addModal = React.createRef();
}
form;
resetModal;
addModal;
defaultParams = {
page:1,
pageSize:10
......@@ -61,10 +67,11 @@ const { TextArea } = Input;
})
}
handleEditPwd=(list)=>{
this.setState({
visible_edit:true,
list:list
})
this.setState({
list:list
})
this.resetModal.showModal()
}
handleDelete=(record)=>{
return HttpClient.post(Api.deleteUserList,{id:record.id}).then(data => {
......@@ -110,43 +117,32 @@ const { TextArea } = Input;
handleCancel = () => {
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 => {
this.setState({ visible: false });
this.getList(this.defaultParams)
})
}
});
HttpClient.post(Api.addUser,{...values}).then(data => {
if(data){
message.success('操作成功!')
this.addModal.handleCancel()
this.getList(this.defaultParams)
}
})
}
handleOkEdit=()=>{
this.props.form.validateFields((err, values) => {
HttpClient.post(Api.rePwd,{id:values.id,pwd:values.pwd}).then(data => {
if(data){
message.success('操作成功!')
this.setState({ visible_edit: false });
this.getList(this.defaultParams)
}
})
});
handleOkEdit=(values)=>{
HttpClient.post(Api.rePwd,{id:values.id,pwd:values.pwd}).then(data => {
if(data){
message.success('操作成功!')
this.resetModal.handleCancel()
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){
this.setState({visible: true,list:list,title:'编辑用户'});
}else{
this.setState({visible: true,title:'新增用户'});
}
showBatchModal = () => {
this.addModal.showModal()
};
......@@ -183,6 +179,69 @@ const { TextArea } = Input;
},
};
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(
<Fragment>
<ItemNav itemNav={this.itemNav} />
......@@ -194,127 +253,10 @@ const { TextArea } = Input;
<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,
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>
<ItemModal config={configAdd} ref={r=> this.addModal =r}/>
<ItemModal config={config} ref={r=> this.resetModal =r}/>
</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