@@ -165,6 +165,13 @@ export default [ | |||
component: './database/goods/goodsbom', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品工艺', | |||
icon: 'smile', | |||
path: '/database/goods/goodstechnology', | |||
component: './database/goods/goodstechnology', | |||
access: 'k7', | |||
}, | |||
] | |||
}, | |||
], | |||
@@ -6,7 +6,7 @@ import classNames from 'classnames'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import GoodsbomFrom from './components/GoodsbomFrom'; | |||
import CreateBom from './components/CreateBom'; | |||
import GoodsTechnologyMaken from './components/goodstechnologymaken' | |||
// import GoodsTechnologyMaken from '../goodstechnology/components/goodstechnologymaken' | |||
import UpdateBom from './components/UpdateBom' | |||
import BomBatching from './components/BomBatching' | |||
import { addGoods} from '../newgoods/service'; | |||
@@ -226,14 +226,14 @@ const Advanced = (props) => { | |||
key: 'basis', | |||
tab: '商品基础信息', | |||
}, | |||
{ | |||
key: 'goodsbom', | |||
tab: '商品配方', | |||
}, | |||
{ | |||
key: 'goodstechnologymaken', | |||
tab: '商品工艺', | |||
}, | |||
// { | |||
// key: 'goodsbom', | |||
// tab: '商品配方', | |||
// }, | |||
// { | |||
// key: 'goodstechnologymaken', | |||
// tab: '商品工艺', | |||
// }, | |||
]; | |||
const onUpdateBomCancel=()=>{ | |||
setUpdateBomVisible(false); | |||
@@ -468,146 +468,6 @@ const Advanced = (props) => { | |||
</Form> | |||
</Card> | |||
), | |||
goodsbom: ( | |||
<Card | |||
title="商品配方" | |||
style={{ | |||
marginBottom: 24, | |||
}} | |||
bordered={false} | |||
> | |||
<ProTable | |||
columns={bomcolumns} | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={false} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
if (props.location.query.values?.id == undefined || props.location.query.values?.id == null) { | |||
message.info('请先添加商品基础信息!'); | |||
} else { | |||
getbomlist().then((r)=>{ | |||
if(BomIds.length>0){ | |||
var da=[] | |||
r.data.map(x=>{ | |||
var sd={} | |||
var dif=BomIds.find(p=>p==x.id); | |||
if(!dif){ | |||
da.push(x) | |||
} | |||
}) | |||
} | |||
console.log("da",da) | |||
setBomdata(da) | |||
}) | |||
handleGoodsBomModalVisible(true); | |||
} | |||
}} | |||
> | |||
<PlusOutlined /> 选择配方 | |||
</Button>, | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={ async() => { | |||
if (props.location.query.values?.id == undefined || props.location.query.values?.id == null) { | |||
message.info('请先添加商品基础信息!'); | |||
} else { | |||
await getbygoodsidattribute(props.location.query.values.id).then((r)=>{ | |||
setGoodsAttriburteData(r.data); | |||
}) | |||
setHandleCreateoodsBomModalVisible(true); | |||
} | |||
// | |||
}} | |||
> | |||
<PlusOutlined /> 新建配方 | |||
</Button>, | |||
]} | |||
request={async (params) => { | |||
if (props.location.query.values.id == undefined || props.location.query.values.id == null) { | |||
} else { | |||
params.GoodsId = props.location.query.values.id; | |||
var total = 0; | |||
const msg = await GetGoodsBom(params); | |||
if(msg.data.data.length>0){ | |||
var nom=msg.data.data.map(x=>{ | |||
return x.bomId; | |||
}) | |||
setBomIds(nom) | |||
} | |||
return { | |||
data: msg.data.data, | |||
success: true, | |||
total: total, | |||
}; | |||
} | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => setSelectedRows(selectedRows), | |||
}} | |||
/> | |||
<GoodsbomFrom | |||
Bomdata={Bomdata} | |||
onFinish={async (value) => { | |||
console.log("value", value); | |||
value['GoodsId'] = props.location.query.values.id; | |||
var success = false; | |||
success = await addgoodsbom(value); | |||
if (success) { | |||
handleGoodsBomModalVisible(false); | |||
} | |||
actionRef.current.reload(); | |||
}} | |||
onCancel={() => { | |||
handleGoodsBomModalVisible(false); | |||
}} | |||
createModalVisible={setGoodsBomModalVisible} | |||
/> | |||
<CreateBom handleCreateoodsBomModalVisible={handleCreateoodsBomModalVisible} | |||
bomTypeData={bomTypeData} | |||
initTypeList={initTypeList} | |||
onFinish={async (value) => { | |||
value.goodsId=props.location.query.values.id; | |||
console.log(value) | |||
await addgoodsbomattribute(value).then((r)=>{ | |||
console.log(r) | |||
if(r.data){ | |||
message.success("添加成功") | |||
setHandleCreateoodsBomModalVisible(false); | |||
}else{ | |||
message.error("添加失败") | |||
} | |||
actionRef.current.reload(); | |||
}) | |||
}} | |||
goodsid={props.location.query.values?.id} | |||
goodsname={props.location.query.values?.name} | |||
goodsAttriburteData={goodsAttriburteData} | |||
matedata={matedata} | |||
bomtype={bomtype} | |||
defaultmatedata={props.location.query.values?.defaultMate} | |||
onCancel={() => { | |||
setHandleCreateoodsBomModalVisible(false); | |||
}} | |||
/> | |||
<UpdateBom onUpdateBomCancel={onUpdateBomCancel} bomtype={bomtype} BomId={BomId} UpdateBomVisible={UpdateBomVisible} bomTypeData={bomTypeData} onUpdateBomSave={onUpdateBomSave}/> | |||
<BomBatching matedata={matedata} onBomBatchingCancel={onBomBatchingCancel} BomId={BomId} BomBatchingVisible={BomBatchingVisible} onBomBatchingFinish={onBomBatchingFinish}/> | |||
</Card> | |||
), | |||
goodstechnologymaken:( | |||
<Card title="商品工艺" style={{ marginBottom: 24}} bordered={false}> | |||
<GoodsTechnologyMaken goodsid={props.location.query.values?.id}></GoodsTechnologyMaken> | |||
</Card> | |||
), | |||
}; | |||
return ( | |||
<PageContainer | |||
@@ -1,7 +1,7 @@ | |||
import React, { useState,useRef,useEffect } from 'react'; | |||
import { PlusOutlined,CheckOutlined} from '@ant-design/icons'; | |||
import { Modal, Form, Input, Button, Select,Radio,message,Tag,Divider,Space } from 'antd'; | |||
import { AddBomType,getproductpage } from '../service'; | |||
import { AddBomType,getbyidbomlist } from '../service'; | |||
import { | |||
EditableProTable, | |||
ProTable | |||
@@ -16,6 +16,10 @@ const GoodsbomFrom = (props) => { | |||
const inputRef = useRef(null); | |||
const [disaenumbled, setdisaenumbled] = useState('block'); | |||
const [disnewd, setdisnewd] = useState('none'); | |||
const [arttue,setarttue]=useState(1); | |||
const [arttuename,setarttuename]=useState(""); | |||
const [arttuename11,setarttuename1]=useState(""); | |||
const [recordCreatorProps,setrecordCreatorProps]=useState(false) | |||
const onNameChange=(event)=>{ | |||
settypename(event.target.value); | |||
} | |||
@@ -41,10 +45,12 @@ const GoodsbomFrom = (props) => { | |||
useEffect(() => { | |||
console.log("props.Bomdata",props.Bomdata) | |||
console.log(props.goodsname) | |||
form.setFieldsValue({ | |||
bomName: props.goodsname, | |||
// bomType:1 | |||
}); | |||
setdisaenumbled('block') | |||
setdisnewd("none") | |||
// form.setFieldsValue({ | |||
// bomName: props.goodsname, | |||
// // bomType:1 | |||
// }); | |||
if(props.defaultmatedata){ | |||
let soredata=[]; | |||
props.defaultmatedata.forEach((item,index)=>{ | |||
@@ -122,9 +128,13 @@ const GoodsbomFrom = (props) => { | |||
}else{ | |||
data.Type="add" | |||
} | |||
data.goodsAttributeValue=arttuename | |||
data.bomType=1; | |||
data.bomName=values.bomName+"("+arttuename11+")" | |||
props.onFinish(data); | |||
setDataSource([]) | |||
setCheckvalue([]) | |||
setarttuename("") | |||
} | |||
}) | |||
@@ -135,6 +145,7 @@ const GoodsbomFrom = (props) => { | |||
const onChangevalue=(data)=>{ | |||
const { name, value } = data.target; | |||
let names=""; | |||
let names1=""; | |||
let updatedValues = [...checkvalue]; | |||
for (let index = 0; index < props.goodsAttriburteData.length; index++) { | |||
if (name === 'radiogroup'+index) { | |||
@@ -148,18 +159,20 @@ const GoodsbomFrom = (props) => { | |||
var bs=item.goodsAttributeValueList.find(x=>x.goodsAttributeValuId==updatedValues[index])?.attributeValue | |||
if(bs){ | |||
names=names+bs; | |||
names1=names1+bs | |||
if(index< updatedValues.length-1){ | |||
names=names+"-" | |||
names1=names1+"-" | |||
} | |||
} | |||
} | |||
}) | |||
form.setFieldsValue({ | |||
bomName: props.goodsname+"("+names+")" | |||
}); | |||
setarttuename1(names) | |||
setarttuename(names1) | |||
// form.setFieldsValue({ | |||
// bomName: props.goodsname+"("+names+")" | |||
// }); | |||
setCheckvalue(updatedValues) | |||
} | |||
const handleChange = (value) => { | |||
@@ -168,10 +181,44 @@ const GoodsbomFrom = (props) => { | |||
bomId: value, | |||
// bomType:1 | |||
}); | |||
getbyidbomlist(value).then((r)=>{ | |||
let soredata=[]; | |||
r.data?.bomEntry?.forEach((item,index)=>{ | |||
var data={ | |||
id:index, | |||
batchingId:item.batchingId, | |||
dosage:item.bomQty | |||
} | |||
soredata.push(data) | |||
}) | |||
//setEditableRowKeys(soredata.map((item) => item.id)) | |||
setDataSource(soredata); | |||
}) | |||
}; | |||
const onchagetype= (e) => { | |||
console.log(form) | |||
setarttue(e.target.value) | |||
setCheckvalue([]) | |||
setDataSource([]) | |||
if(e.target.value==1){//选择配方 | |||
setrecordCreatorProps(false); | |||
setdisaenumbled("block") | |||
setdisnewd("none") | |||
}else{ | |||
setrecordCreatorProps({ | |||
newRecordType: 'dataSource', | |||
record: () => ({ | |||
id: Date.now(), | |||
})}) | |||
setdisaenumbled("none") | |||
setdisnewd("block") | |||
} | |||
} | |||
return ( | |||
<Modal | |||
title={'新建配方'} | |||
title={'关联配方'} | |||
width={1040} | |||
visible={props.handleCreateoodsBomModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
@@ -189,7 +236,7 @@ const GoodsbomFrom = (props) => { | |||
props.goodsAttriburteData == undefined ? '' :( | |||
props.goodsAttriburteData.map((item, index) => { | |||
return ( | |||
<div style={{marginLeft: 80}}> | |||
<div style={{marginLeft: 80,marginBottom:10}}> | |||
<div> | |||
<span style={{marginRight: 10}}> <Tag color="blue">{item.attributeName}</Tag>:</span> | |||
<span> | |||
@@ -210,10 +257,16 @@ const GoodsbomFrom = (props) => { | |||
) | |||
} | |||
<Form layout="horizontal" preserve={false} form={form}> | |||
<Form.Item style={{display:disaenumbled}} name="bomId" label="选择配方" rules={[{ required: false, message: '配方信息' }]}> | |||
<Form.Item name="type" label="功能类型"> | |||
<Radio.Group name="type" defaultValue={1} value={arttue} onChange={onchagetype}> | |||
<Radio.Button value={1}>选择配方</Radio.Button> | |||
<Radio.Button value={0}>新建配方</Radio.Button> | |||
</Radio.Group> | |||
</Form.Item> | |||
<Form.Item shouldUpdate style={{display:disaenumbled}} name="bomId" label="选择配方" rules={[{ required: false, message: '配方信息' }]}> | |||
<Select | |||
showSearch | |||
mode="multiple" | |||
style={{width:'90%'}} | |||
optionFilterProp="children" | |||
onChange={handleChange} | |||
@@ -227,23 +280,13 @@ const GoodsbomFrom = (props) => { | |||
); | |||
})} | |||
</Select> | |||
<Button | |||
type="primary" | |||
key="primary" onClick={ async() => { | |||
setdisaenumbled("none") | |||
setdisnewd("block") | |||
}}><PlusOutlined />新建</Button> | |||
</Form.Item> | |||
<Form.Item style={{display:disnewd}} name="bomName" label="配方名称" rules={[{ required: false, message: '配方名称' }]}> | |||
<Form.Item shouldUpdate style={{display:disnewd}} name="bomName" label="配方名称" rules={[{ required: false, message: '配方名称' }]}> | |||
<Input style={{width:'87%'}} placeholder="请输入配方名称"/> | |||
<Button | |||
type="primary" | |||
key="primary" onClick={ async() => { | |||
setdisaenumbled("block") | |||
setdisnewd("none") | |||
}}><CheckOutlined />选择配方</Button> | |||
</Form.Item> | |||
<Form.Item style={{display:disnewd}} name="bomTypeList" rules={[{ required: false, message: '配方分类' }]} label="配方分类" > | |||
<Form.Item shouldUpdate style={{display:disnewd}} name="bomTypeList" rules={[{ required: false, message: '配方分类' }]} label="配方分类" > | |||
<Select | |||
style={{width: '100%'}} | |||
mode="tags" | |||
@@ -286,18 +329,13 @@ const GoodsbomFrom = (props) => { | |||
</Form.Item> */} | |||
</Form> | |||
<EditableProTable style={{display:disnewd}} | |||
<EditableProTable | |||
headerTitle={ <span><span style={{color:'red',marginRight: 3}}>*</span>配方详情</span>} | |||
columns={columns} | |||
rowKey="id" | |||
value={dataSource} | |||
onChange={setDataSource} | |||
recordCreatorProps={{ | |||
newRecordType: 'dataSource', | |||
record: () => ({ | |||
id: Date.now(), | |||
}), | |||
}} | |||
recordCreatorProps={recordCreatorProps} | |||
editable={{ | |||
type: 'multiple', | |||
@@ -89,20 +89,29 @@ const Advanced = (props) => { | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
title: '配方类型', | |||
dataIndex: 'isMain', | |||
hideInForm: true, | |||
valueEnum: { | |||
false: { | |||
text: '辅料', | |||
status: 'Processing', | |||
}, | |||
true: { | |||
text: '主料', | |||
status: 'Success', | |||
}, | |||
}, | |||
title: '商品属性', | |||
key: 'goodsAttributeValue', | |||
dataIndex: 'goodsAttributeValue', | |||
valueType: 'textarea', | |||
fieldProps:{ | |||
placeholder:'请输入属性,属性格式为:xx-xx' | |||
} | |||
}, | |||
// { | |||
// title: '配方类型', | |||
// dataIndex: 'isMain', | |||
// hideInForm: true, | |||
// valueEnum: { | |||
// false: { | |||
// text: '辅料', | |||
// status: 'Processing', | |||
// }, | |||
// true: { | |||
// text: '主料', | |||
// status: 'Success', | |||
// }, | |||
// }, | |||
// }, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
@@ -135,17 +144,18 @@ const Advanced = (props) => { | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
const hide = message.loading('正在删除'); | |||
try { | |||
DelGoodsBom(record.id); | |||
hide(); | |||
message.success('删除成功,即将刷新'); | |||
actionRef.current.reload(); | |||
DelGoodsBom(record.id).then((r)=>{ | |||
if(r.data){ | |||
message.success('删除成功,即将刷新'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
return false; | |||
} | |||
}} | |||
@@ -174,7 +184,7 @@ const Advanced = (props) => { | |||
columns={bomcolumns} | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={false} | |||
search | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
@@ -209,17 +219,17 @@ const Advanced = (props) => { | |||
} | |||
getbomlist().then((r)=>{ | |||
console.log("nom",nom) | |||
if(nom.length>0){ | |||
var da=[] | |||
r.data.map(x=>{ | |||
var dif=nom.find(p=>p==x.id); | |||
if(!dif){ | |||
da.push(x) | |||
} | |||
}) | |||
} | |||
console.log("da",da) | |||
setBomdata(da) | |||
// if(nom.length>0){ | |||
// var da=[] | |||
// r.data.map(x=>{ | |||
// var dif=nom.find(p=>p==x.id); | |||
// if(!dif){ | |||
// da.push(x) | |||
// } | |||
// }) | |||
// } | |||
// console.log("da",da) | |||
setBomdata(r.data) | |||
}) | |||
return { | |||
data: msg.data.data, | |||
@@ -247,7 +257,7 @@ const Advanced = (props) => { | |||
message.success("添加成功") | |||
setHandleCreateoodsBomModalVisible(false); | |||
}else{ | |||
message.error("添加失败") | |||
message.error(r.errors) | |||
} | |||
actionRef.current.reload(); | |||
}) | |||
@@ -50,3 +50,8 @@ export async function GetGoodsBom(data) { | |||
method: 'Get', | |||
}); | |||
} | |||
export async function getbyidbomlist(bomId) { | |||
return request(getDataBaseUrl()+'/api/bom/getbyidbomlist?bomId='+bomId, { | |||
method: 'Get', | |||
}); | |||
} |
@@ -2,8 +2,8 @@ import React, { useState, useRef, useEffect } from 'react'; | |||
import { Card, Select, Button, message, Checkbox, Modal } from 'antd'; | |||
import { ProCard } from '@ant-design/pro-Card'; | |||
import { DeleteOutlined, CloseOutlined } from '@ant-design/icons'; | |||
import From from './From' | |||
import FromBatch from './FromBatch' | |||
import From from '../components/From' | |||
import FromBatch from '../components/FromBatch' | |||
import { useFetchData } from '@ant-design/pro-utils'; | |||
const EditFrom = (props) => { | |||
const [fromdata, setfromdata] = useState([]) |
@@ -15,9 +15,9 @@ import { | |||
AddGoodsTechnologyAction, | |||
UpdateGoodsTechnologyAction, | |||
deletebydevidegoodstechnologyaction | |||
} from '../service'; | |||
} from '../../goodsInfo/service'; | |||
import style from '../style.less' | |||
import EditFrom from './EditFrom' | |||
import EditFrom from '../components/EditFrom' | |||
import useFetchData from '@ant-design/pro-descriptions/lib/useFetchData'; | |||
const goodstechnologymaken = (props) => { | |||
const [attrvalue, setAttrvalue] = useState(''); |
@@ -0,0 +1,50 @@ | |||
import { PlusOutlined, UploadOutlined,ArrowLeftOutlined } from '@ant-design/icons'; | |||
import { Button, Card, message, Steps, Empty, Form, Input, Upload, Select, InputNumber, Switch,TreeSelect,Divider,Space,Popconfirm } from 'antd'; | |||
import { GridContent, PageContainer, RouteContext } from '@ant-design/pro-layout'; | |||
import React, { Fragment, useRef, useState, useEffect } from 'react'; | |||
import GoodsTechnologyMaken from './components/goodstechnologymaken' | |||
import axios from 'axios'; | |||
import { history } from 'umi'; | |||
const { Step } = Steps; | |||
const { Option, OptGroup } = Select; | |||
const { TextArea } = Input; | |||
const Advanced = (props) => { | |||
//设置 | |||
useEffect(() => { | |||
// if(!props.location?.query?.values){ | |||
// history.push({ | |||
// pathname: '/database/goods/newgoods', | |||
// }); | |||
// }else{ | |||
//SetCurrTabKey(tabStatus.tabActiveKey); | |||
//initGoodsUnit(); | |||
//initGoodsType(); | |||
//initGetbomType(); | |||
//intBatching();//默认原料 | |||
//} | |||
}, []) | |||
return ( | |||
<PageContainer | |||
host header={{ | |||
title: [<a key="back" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/newgoods', | |||
}); | |||
}}><ArrowLeftOutlined />返回</a>], | |||
breadcrumb: {}, | |||
}} | |||
title={'商品工艺'} | |||
> | |||
<GoodsTechnologyMaken goodsid={props.location.query.values?.id}></GoodsTechnologyMaken> | |||
</PageContainer> | |||
); | |||
}; | |||
export default Advanced; |
@@ -0,0 +1,87 @@ | |||
@import '~antd/es/style/themes/default.less'; | |||
.main { | |||
:global { | |||
.ant-descriptions-row > td { | |||
padding-bottom: 8px; | |||
} | |||
.ant-page-header-heading-extra { | |||
flex-direction: column; | |||
} | |||
} | |||
} | |||
.headerList { | |||
margin-bottom: 4px; | |||
:global { | |||
.ant-descriptions-row > td { | |||
padding-bottom: 8px; | |||
} | |||
} | |||
.stepDescription { | |||
position: relative; | |||
left: 38px; | |||
padding-top: 8px; | |||
font-size: 14px; | |||
text-align: left; | |||
> div { | |||
margin-top: 8px; | |||
margin-bottom: 4px; | |||
} | |||
} | |||
} | |||
.pageHeader { | |||
:global { | |||
.ant-page-header-heading-extra > * + * { | |||
margin-left: 8px; | |||
} | |||
} | |||
.moreInfo { | |||
display: flex; | |||
justify-content: space-between; | |||
width: 200px; | |||
} | |||
} | |||
@media screen and (max-width: @screen-sm) { | |||
.stepDescription { | |||
left: 8px; | |||
} | |||
.pageHeader { | |||
:global { | |||
.ant-pro-page-header-wrap-row { | |||
flex-direction: column; | |||
} | |||
} | |||
} | |||
} | |||
.formlable{ | |||
color: #3a3a3a; | |||
border: 1px solid #bfbbbb; | |||
width: 91px; | |||
height: 32px; | |||
text-align: center; | |||
line-height: 30px; | |||
margin-left: 15px; | |||
} | |||
.formlabletxt{ | |||
color: #3a3a3a; | |||
border: 1px solid #ebe1e1; | |||
width: 170px; | |||
height: 32px; | |||
text-align: center; | |||
line-height: 30px; | |||
margin-left: 15px; | |||
} | |||
::-webkit-scrollbar{ | |||
width:6px; | |||
background-color: #fff; | |||
} | |||
::-webkit-scrollbar-thumb{ | |||
background-color: #ddd; | |||
border-radius: 3px; | |||
width:6px; | |||
} |
@@ -235,7 +235,7 @@ const GoodsManage = () => { | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodsbom', | |||
pathname: '/database/goods/goodstechnology', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||