From 0cd6e98111658fc472d8fdf20e30c9607c28147b Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Mon, 26 Feb 2024 17:21:32 +0800 Subject: [PATCH 1/2] z --- src/pages/database/goods/goodsInfo/index.jsx | 146 ++---------------- .../goods/goodsbom/components/CreateBom.jsx | 1 + .../goodstechnology/components/EditFrom.jsx | 4 +- .../goods/goodstechnology/components/From.jsx | 33 ++-- .../components/goodstechnologymaken.jsx | 6 +- .../database/goods/goodstechnology/style.less | 4 +- src/pages/database/goods/newgoods/index.jsx | 7 +- .../deviceInfo/components/CreateForm.jsx | 25 +-- .../technology/components/ActionForm.jsx | 51 ++---- .../components/CreateForm.jsx | 23 +-- 10 files changed, 87 insertions(+), 213 deletions(-) diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index e3a51f6..4accf43 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -54,7 +54,7 @@ const Advanced = (props) => { }else{ values.defaultMate=""; } - + values.isAttrubute=true; await addGoods(JSON.stringify(values)).then((r) => { if (r.succeeded) { message.success('操作成功'); @@ -197,9 +197,7 @@ const Advanced = (props) => { setMatedata(r.data); }); } - function initTypeList(){ - initGetbomType(); - } + const onNameChange = (event) => { setunitname(event.target.value); }; @@ -235,135 +233,11 @@ const Advanced = (props) => { // tab: '商品工艺', // }, ]; - const onUpdateBomCancel=()=>{ - setUpdateBomVisible(false); - setBomId('') - } - const onBomBatchingCancel=()=>{ - setBomBatchingVisible(false); - setBomId('') - } - const onUpdateBomSave=(form)=>{ - form - .validateFields() - .then((values) => { - console.log(values) - var parm={id:BomId,name:values.bomName,IsMain:values.bomType=='1'?true:false,bomTypeIds:values.bomTypeList} - UpdateBomInfo(parm).then((r)=>{ - if(r.succeeded){ - message.success('修改成功'); - setUpdateBomVisible(false); - actionRef.current.reload(); - setBomId('') - }else{ - message.error(r.errors); - } - }) - }) - } - const onBomBatchingFinish=(form)=>{ - console.log("form",form) - var parm={bomId:BomId,bomEntry:form}; - UpdateBomBatcing(parm).then((r)=>{ - if(r.succeeded){ - message.success('修改成功'); - setBomBatchingVisible(false); - actionRef.current.reload(); - setBomId('') - }else{ - message.error(r.errors); - } - }) - } - const bomcolumns = - [ - { - title: '主键', - dataIndex: 'id', - key: 'id', - hideInTable: true, - hideInSearch: true, - tip: '规则名称是唯一的 key', - }, - { - title: '配方名称', - key: 'name', - dataIndex: 'name', - valueType: 'textarea', - }, - { - title: '配方类型', - dataIndex: 'isMain', - hideInForm: true, - valueEnum: { - false: { - text: '辅料', - status: 'Processing', - }, - true: { - text: '主料', - status: 'Success', - }, - }, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_, record) => [ - { - setUpdateBomVisible(true); - setBomId(record.bomId) - }} - > - 更新 - , - { - setBomBatchingVisible(true); - setBomId(record.bomId) - }} - > - 配方详情 - , - { - const hide = message.loading('正在删除'); - try { - DelGoodsBom(record.id); - hide(); - message.success('删除成功,即将刷新'); - actionRef.current.reload(); - return true; - } catch (error) { - hide(); - message.error('删除失败,请重试'); - actionRef.current.reload(); - return false; - } - }} - onCancel={() => {}} - > - 删除 - , - ], - } - ] const onChange = (newValue) => { setgoodsTypeIdvalue(newValue); }; const filterOption = (input, option) => - (option?.label ?? '').toLowerCase().includes(input.toLowerCase()); + (option?.title ?? '').toLowerCase().includes(input.toLowerCase()); const contentList = { basis: ( { dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} treeData={treeData} onChange={onChange} - filterOption={filterOption} + filterTreeNode={filterOption} value={goodsTypeIdvalue} placeholder="请选择商品类型" treeDefaultExpandAll + /> @@ -404,12 +279,15 @@ const Advanced = (props) => {