@@ -1,6 +1,7 @@ | |||||
import React, { useState, useEffect, useRef } from 'react'; | import React, { useState, useEffect, useRef } from 'react'; | ||||
import { Modal, Form, Input, Button, Select, Switch, InputNumbe, Divider, Space } from 'antd'; | |||||
import { Modal, Form, Input, Button, Select, Switch, InputNumbe, Divider, Space,message } from 'antd'; | |||||
import { PlusOutlined } from '@ant-design/icons'; | import { PlusOutlined } from '@ant-design/icons'; | ||||
import { AddBomType } from '../services'; | |||||
const UpdateBom = (props) => { | const UpdateBom = (props) => { | ||||
const { Option, OptGroup } = Select; | const { Option, OptGroup } = Select; | ||||
@@ -14,23 +15,22 @@ const UpdateBom = (props) => { | |||||
const addItem = (e) => { | const addItem = (e) => { | ||||
e.preventDefault(); | e.preventDefault(); | ||||
if (typename == 0) { | |||||
message.error("请输入名称"); | |||||
if (typename.length == 0) { | |||||
message.error("请输入名称"); | |||||
} else { | } else { | ||||
var parm = { name: typename } | |||||
AddBomType(parm).then((r) => { | |||||
if (r.succeeded) { | |||||
message.success('添加成功'); | |||||
props.initTypeList(); | |||||
settypename(''); | |||||
} else { | |||||
message.error(r.errors); | |||||
} | |||||
}) | |||||
var parm = { name: typename } | |||||
AddBomType(parm).then((r) => { | |||||
if (r.succeeded) { | |||||
message.success('添加成功'); | |||||
props.initTypeList(); | |||||
settypename(''); | |||||
} else { | |||||
message.error(r.errors); | |||||
} | |||||
}) | |||||
} | } | ||||
} | |||||
} | |||||
const headleOk = () => { | const headleOk = () => { | ||||
props.onUpdateBomSave() | props.onUpdateBomSave() | ||||
@@ -170,7 +170,7 @@ const GoodsBomsManage = (props) => { | |||||
.validateFields() | .validateFields() | ||||
.then((values) => { | .then((values) => { | ||||
console.log(values) | console.log(values) | ||||
var parm = { id: values.id, name: values.bomName, IsMain: values.bomType == '1' ? true : false, bomTypeIds: values.bomTypeList } | |||||
var parm = { id: values.id, name: values.name, IsMain: values.bomType == '1' ? true : false, bomTypeIds: values.bomTypeList } | |||||
UpdateBomInfo(parm).then((r) => { | UpdateBomInfo(parm).then((r) => { | ||||
if (r.data) { | if (r.data) { | ||||
message.success('修改成功'); | message.success('修改成功'); | ||||
@@ -275,6 +275,7 @@ const GoodsBomsManage = (props) => { | |||||
onUpdateBomSave={onUpdateBomSave} | onUpdateBomSave={onUpdateBomSave} | ||||
values={currentRow || {}} | values={currentRow || {}} | ||||
form={form2} | form={form2} | ||||
initTypeList={initTypeList} | |||||
bomTypeData={bomTypeData} | bomTypeData={bomTypeData} | ||||
onFinish={async (value) => { | onFinish={async (value) => { | ||||
@@ -313,8 +313,10 @@ const GoodsTypeManage = () => { | |||||
var success = false; | var success = false; | ||||
if (value.id) { | if (value.id) { | ||||
success = handleUpdate(value); | success = handleUpdate(value); | ||||
actionRef.current.reload(); | |||||
} else { | } else { | ||||
success = handleAdd(value); | success = handleAdd(value); | ||||
actionRef.current.reload(); | |||||
} | } | ||||
if (success) { | if (success) { | ||||
handleModalVisible(false); | handleModalVisible(false); | ||||