From ecc73c9c5811cca228ceabcf86ffa48c1995eb28 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Mon, 19 Feb 2024 17:44:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E9=85=8D=E6=96=B9=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.js | 7 + src/pages/database/goods/goodsInfo/index.jsx | 158 +----------------- .../goods/goodsbom/components/CreateBom.jsx | 108 ++++++++---- src/pages/database/goods/goodsbom/index.jsx | 78 +++++---- src/pages/database/goods/goodsbom/service.js | 5 + .../components/EditFrom.jsx | 4 +- .../components/From.jsx | 0 .../components/FromBatch.jsx | 0 .../components/goodstechnologymaken.jsx | 4 +- .../database/goods/goodstechnology/index.jsx | 50 ++++++ .../database/goods/goodstechnology/service.js | 0 .../database/goods/goodstechnology/style.less | 87 ++++++++++ src/pages/database/goods/newgoods/index.jsx | 2 +- 13 files changed, 280 insertions(+), 223 deletions(-) rename src/pages/database/goods/{goodsInfo => goodstechnology}/components/EditFrom.jsx (98%) rename src/pages/database/goods/{goodsInfo => goodstechnology}/components/From.jsx (100%) rename src/pages/database/goods/{goodsInfo => goodstechnology}/components/FromBatch.jsx (100%) rename src/pages/database/goods/{goodsInfo => goodstechnology}/components/goodstechnologymaken.jsx (99%) create mode 100644 src/pages/database/goods/goodstechnology/index.jsx create mode 100644 src/pages/database/goods/goodstechnology/service.js create mode 100644 src/pages/database/goods/goodstechnology/style.less diff --git a/config/routes.js b/config/routes.js index f9d4629..81023dc 100644 --- a/config/routes.js +++ b/config/routes.js @@ -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', + }, ] }, ], diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index 3ddc746..e3a51f6 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -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) => { ), - goodsbom: ( - - [ - , - , - ]} - 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), - }} - - /> - { - 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} - /> - { - 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); - }} - /> - - - - - ), - goodstechnologymaken:( - - - - ), }; return ( { 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 ( { props.goodsAttriburteData == undefined ? '' :( props.goodsAttriburteData.map((item, index) => { return ( -
+
{item.attributeName} @@ -210,10 +257,16 @@ const GoodsbomFrom = (props) => { ) }
- + + + 选择配方 + 新建配方 + + + + - + - + - + - +