@@ -8,12 +8,12 @@ | |||
*/ | |||
export default { | |||
dev: { | |||
'/saasbase/': { | |||
target: 'http://localhost:5001/', | |||
'/kitchbase/': { | |||
target: 'http://localhost:5006/', | |||
changeOrigin: true, | |||
secure: false, //关闭证书验证 | |||
pathRewrite: { | |||
'/saasbase/': '', | |||
'/kitchbase/': '', | |||
}, | |||
}, | |||
'/storemanagement/': { | |||
@@ -118,7 +118,14 @@ export default [ | |||
component: './database/basic/batching', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '配方管理', | |||
icon: 'smile', | |||
path: '/database/bom', | |||
component: './database/bom', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品管理', | |||
icon: 'smile', | |||
@@ -152,6 +159,20 @@ export default [ | |||
component: './database/goods/goodsInfo', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品配方', | |||
icon: 'smile', | |||
path: '/database/goods/goodsbom', | |||
component: './database/goods/goodsbom', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品工艺', | |||
icon: 'smile', | |||
path: '/database/goods/goodstechnology', | |||
component: './database/goods/goodstechnology', | |||
access: 'k7', | |||
}, | |||
] | |||
}, | |||
], | |||
@@ -6,7 +6,7 @@ export function getApiUrl() { | |||
} | |||
} | |||
export function getDataBaseUrl() { | |||
return '/saasbase'; | |||
return '/kitchbase'; | |||
} | |||
export function getStoremanagement() { | |||
@@ -17,7 +17,7 @@ const CreateForm = (props) => { | |||
> | |||
<Form | |||
layout="horizontal" | |||
labelCol={{ span: 4 }} | |||
labelCol={{ span: 6 }} | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -33,9 +33,11 @@ const CreateForm = (props) => { | |||
<Input placeholder="请输入管理员姓名" /> | |||
</Form.Item> | |||
<Form.Item name="email" label="邮箱账号" rules={[{ required: true, max: 50,message:"请输入邮箱账号"},{pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, | |||
message: '邮箱格式不正确', }]}> | |||
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | |||
<Form.Item name="email" label="登陆账号(手机号)" | |||
tooltip="初始密码为:123456" | |||
rules={[{ required: true, max: 50,message:"请输入手机号"},{pattern: /^1[3-9][0-9]{9}$/, | |||
message: '手机号格式不正确', }]}> | |||
<Input placeholder="手机号是登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
{/* <Form.Item name="type" label="所属平台" rules={[{ required: true }]}> | |||
<Select placeholder='请选择所属平台' allowClear options={[ | |||
@@ -53,10 +55,10 @@ message: '邮箱格式不正确', }]}> | |||
}, | |||
]}/> | |||
</Form.Item> */} | |||
<Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入电话" /> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="remark" label="备注" rules={[{ max: 100 }]}> | |||
<Input placeholder="请输入备注" /> | |||
</Form.Item> | |||
@@ -338,6 +338,7 @@ const companyManage = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone=value.email; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -0,0 +1,145 @@ | |||
import React, { useState, useRef } from 'react'; | |||
import { Button, Modal, Form, Input, Select, Divider, Space, message } from 'antd'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { EditableProTable } from '@ant-design/pro-table'; | |||
import { AddBomType } from '../services'; | |||
const App = (props) => { | |||
const [form] = Form.useForm(); | |||
const inputRef = useRef(null); | |||
const [typename, settypename] = useState(''); | |||
const [dataSource, setDataSource] = useState([]); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
const onNameChange = (event) => { | |||
settypename(event.target.value); | |||
} | |||
const columns = [ | |||
{ | |||
title: '物料名称', | |||
dataIndex: 'batchingId', | |||
formItemProps: (form, { rowIndex }) => { | |||
return { | |||
rules: | |||
rowIndex > 1 ? [{ required: true, message: '此项为必填项' }] : [], | |||
}; | |||
}, | |||
valueType: 'select', | |||
fieldProps: { | |||
showSearch: true, | |||
options: props.matedata.map((item, index) => { return { label: item.name, value: item.id } }) | |||
}, | |||
width: '25%', | |||
}, | |||
{ | |||
title: '用量', | |||
dataIndex: 'dosage', | |||
valueType: 'digit', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: '15%', | |||
render: () => { | |||
return null; | |||
}, | |||
}, | |||
] | |||
const addItem = (e) => { | |||
e.preventDefault(); | |||
if (typename.length == 0) { | |||
message.error("请输入名称"); | |||
} else { | |||
var parm = { name: typename } | |||
AddBomType(parm).then((r) => { | |||
if (r.succeeded) { | |||
message.success('添加成功'); | |||
props.initTypeList(); | |||
settypename(''); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}) | |||
} | |||
} | |||
return ( | |||
<> | |||
<Modal title="Basic Modal" | |||
onCancel={props.onCancel} | |||
open={props.modalVisible} > | |||
<Form layout="horizontal" preserve={false} form={form} > | |||
<Form.Item name="bomName" label="配方名称" rules={[{ required: true, message: '配方名称' }]}> | |||
<Input placeholder="请输入配方名称" /> | |||
</Form.Item> | |||
<Form.Item name="bomTypeList" rules={[{ required: true, message: '配方分类' }]} label="配方分类" > | |||
<Select | |||
style={{ width: '100%' }} | |||
mode="tags" | |||
placeholder="请选配方分类" | |||
options={props.bomTypeData} | |||
dropdownRender={(menu) => ( | |||
<> | |||
{menu} | |||
<Divider style={{ margin: '8px 0' }} /> | |||
<Space style={{ padding: '0 8px 4px' }}> | |||
<Input | |||
placeholder="请输入配方分类" | |||
ref={inputRef} | |||
value={typename} | |||
onChange={onNameChange} | |||
onKeyDown={(e) => e.stopPropagation()} | |||
/> | |||
<Button type="text" icon={<PlusOutlined />} onClick={addItem}> | |||
新增 | |||
</Button> | |||
</Space> | |||
</> | |||
)} | |||
/> | |||
</Form.Item> | |||
</Form> | |||
<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(), | |||
}), | |||
}} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, defaultDoms) => { | |||
return [defaultDoms.delete, defaultDoms.Button]; | |||
}, | |||
onValuesChange: (record, recordList) => { | |||
setDataSource(recordList); | |||
}, | |||
onDelete: async (key, row) => { | |||
console.log(key) | |||
console.log(row) | |||
}, | |||
onChange: setEditableRowKeys, | |||
}} /> | |||
</Modal> | |||
</> | |||
); | |||
}; | |||
export default App; |
@@ -0,0 +1,53 @@ | |||
.form-list-item { | |||
display: flex; | |||
align-items: center; | |||
} | |||
.form-list-copy { | |||
display: flex; | |||
justify-content: flex-end; | |||
margin-bottom: 10px; | |||
} | |||
.form-input-label { | |||
width: 50px; | |||
flex-shrink: 0; | |||
} | |||
.form-list-detail { | |||
display: flex; | |||
align-items: center; | |||
justify-content: space-between; | |||
margin: 10px 0; | |||
} | |||
.form-detail-card { | |||
display: flex; | |||
align-items: center; | |||
} | |||
.formmual-name input { | |||
width: 200px; | |||
margin-right: 10px; | |||
} | |||
.clickRowStyl{background-color:antiquewhite} | |||
.ant-tree-switcher{ | |||
width: 1px; | |||
} | |||
.ant-tree-switcher-noop{ | |||
display: none; | |||
} | |||
.ant-tree .ant-tree-treenode{ | |||
height: 40px; | |||
} | |||
.ant-tree .ant-tree-node-content-wrapper{ | |||
line-height: 40px; | |||
height: 40px; | |||
} | |||
.ant-tree .ant-tree-treenode-draggable .ant-tree-draggable-icon{ | |||
line-height: 40px; | |||
} | |||
.ant-tree .ant-tree-treenode:focus{ | |||
background-color: #ffd8bf; | |||
} |
@@ -0,0 +1,179 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Drawer, Modal, Space, Tag, Popconfirm } from 'antd'; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import { bomPage, getproductpage,GetbomTypelist } from './services'; | |||
import CreateBom from './components/CreateBom'; | |||
const GoodsBomsManage = (props) => { | |||
const actionRef = useRef(); | |||
const [modalVisible, setModalVisible] = useState(false); | |||
const [matedata, setMatedata] = useState([]); | |||
const [bomTypeData,setbomTypeData]= useState([]); | |||
useEffect(() => { | |||
intBatching();//默认原料 | |||
}, []); | |||
function intBatching() { | |||
getproductpage().then((r) => { | |||
setMatedata(r.data); | |||
}); | |||
} | |||
function initTypeList() { | |||
initGetbomType(); | |||
} | |||
function initGetbomType() { | |||
GetbomTypelist().then((r) => { | |||
var list = []; | |||
if (r.data.length > 0) { | |||
r.data.forEach((item) => { | |||
list.push({ text: item.name, value: item.id, label: item.name }); | |||
}); | |||
} | |||
setbomTypeData(list) | |||
}) | |||
} | |||
function initGetbomType(){ | |||
GetbomTypelist().then((r)=>{ | |||
var list = []; | |||
if (r.data.length > 0) { | |||
r.data.forEach((item) => { | |||
list.push({ text: item.name, value: item.id, label: item.name }); | |||
}); | |||
} | |||
setbomTypeData(list) | |||
}) | |||
} | |||
const columns = [ | |||
{ | |||
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) => [ | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
setUpdateBomVisible(true); | |||
setBomId(record.bomId) | |||
}} | |||
> | |||
更新 | |||
</a>, | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
setBomBatchingVisible(true); | |||
setBomId(record.bomId) | |||
}} | |||
> | |||
配方详情 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
} | |||
] | |||
return ( | |||
<PageContainer header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}}> | |||
<ProTable | |||
columns={columns} | |||
actionRef={actionRef} | |||
rowKey="id" | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
setModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 新建 | |||
</Button>, | |||
]} | |||
request={async (params) => { | |||
var total = 0; | |||
var data = []; | |||
const res = await bomPage(params); | |||
if (res.statusCode == 200) { | |||
data = res.data.data; | |||
total = res.data.total; | |||
} | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => setSelectedRows(selectedRows), | |||
}} | |||
/> | |||
{/* 新增菜谱 */} | |||
<CreateBom modalVisible={modalVisible} | |||
matedata={matedata} | |||
initTypeList={initTypeList} | |||
onCancel={() => { setModalVisible(false); }} | |||
/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default GoodsBomsManage; |
@@ -0,0 +1,33 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl } from '@/global_data'; | |||
export async function bomPage(data) { | |||
return request(getDataBaseUrl()+'/api/bom/BomPage', { | |||
method: 'POST', | |||
data:data, | |||
}); | |||
} | |||
export async function AddBomType (data) { | |||
return request(getDataBaseUrl()+`/api/bom/addbomtype`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function getproductpage(params) { | |||
return request(getDataBaseUrl()+'/api/batching/getbatchingselectlist', { | |||
method: 'Get', | |||
}); | |||
} | |||
export async function GetbomTypelist (data) { | |||
return request(getDataBaseUrl()+`/api/bom/getbomtypelist`, { | |||
method: 'Get', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
@@ -214,6 +214,8 @@ const GoodsbomFrom = (props) => { | |||
</Select> | |||
</Form.Item> | |||
</Form> | |||
<span><span style={{color:'red',marginRight: 3}}>*</span>商品属性</span> | |||
{ | |||
props.goodsAttriburteData == undefined ? '' :( | |||
@@ -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); | |||
@@ -253,7 +253,7 @@ const Advanced = (props) => { | |||
if(r.succeeded){ | |||
message.success('修改成功'); | |||
setUpdateBomVisible(false); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
setBomId('') | |||
}else{ | |||
message.error(r.errors); | |||
@@ -268,7 +268,7 @@ const Advanced = (props) => { | |||
if(r.succeeded){ | |||
message.success('修改成功'); | |||
setBomBatchingVisible(false); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
setBomId('') | |||
}else{ | |||
message.error(r.errors); | |||
@@ -343,12 +343,12 @@ const Advanced = (props) => { | |||
DelGoodsBom(record.id); | |||
hide(); | |||
message.success('删除成功,即将刷新'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reloadAndRest(); | |||
actionRef.current.reload(); | |||
return 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.reloadAndRest(); | |||
}} | |||
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.reloadAndRest(); | |||
}) | |||
}} | |||
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 | |||
@@ -0,0 +1,148 @@ | |||
import React, { useState,useRef,useEffect } from 'react'; | |||
import { PlusOutlined} from '@ant-design/icons'; | |||
import { Modal, Form, Input, Button, Select,Radio,message,Tag,Divider,Space } from 'antd'; | |||
import { GetByidBomList } from '../service'; | |||
import { | |||
EditableProTable, | |||
ProTable | |||
} from '@ant-design/pro-table'; | |||
const GoodsbomFrom = (props) => { | |||
const { Option, OptGroup } = Select; | |||
const [dataSource, setDataSource] = useState([]); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
const [form] = Form.useForm(); | |||
useEffect(() => { | |||
let soredata=[]; | |||
if(props.BomId){ | |||
GetByidBomList(props.BomId).then((t)=>{ | |||
var data=t.data | |||
if(data.bomEntry.length>0){ | |||
data.bomEntry.map(x=>{ | |||
var item={ | |||
id:x.id, | |||
bomId:x.bomId, | |||
batchingId:x.batchingId, | |||
dosage:x.bomQty | |||
} | |||
console.log("item",item) | |||
soredata.push(item) | |||
}) | |||
} | |||
console.log("soredata",soredata) | |||
if(soredata.length>0){ | |||
setEditableRowKeys(soredata.map((item) => item.id)) | |||
setDataSource(soredata); | |||
} | |||
}) | |||
} | |||
},[props]) | |||
const columns=[ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
key: 'id', | |||
hideInTable: true, | |||
hideInSearch: true, | |||
tip: '规则名称是唯一的 key', | |||
}, | |||
{ | |||
title: '配方', | |||
dataIndex: 'bomId', | |||
hideInTable: true, | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '物料名称', | |||
dataIndex: 'batchingId', | |||
formItemProps: (form, { rowIndex }) => { | |||
return { | |||
rules: | |||
rowIndex > 1 ? [{ required: true, message: '此项为必填项' }] : [], | |||
}; | |||
}, | |||
valueType: 'select', | |||
fieldProps: { | |||
showSearch:true, | |||
options: props.matedata.map((item, index) => {return {label:item.name,value:item.id}}) | |||
}, | |||
width: '25%', | |||
}, | |||
{ | |||
title: '用量', | |||
dataIndex: 'dosage', | |||
valueType:'digit', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: '15%', | |||
render: () => { | |||
return null; | |||
}, | |||
}, | |||
] | |||
const headleOk=()=>{ | |||
if(dataSource.length==0){ | |||
check=false; | |||
message.error("请选择物料") | |||
}else{ | |||
props.onBomBatchingFinish(dataSource); | |||
setDataSource([]) | |||
} | |||
} | |||
return ( | |||
<Modal | |||
title={'配方详情'} | |||
width={1040} | |||
visible={props.BomBatchingVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
okText="确认" | |||
cancelText="取消" | |||
onOk={headleOk} | |||
onCancel={() => { | |||
props.onBomBatchingCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<EditableProTable | |||
columns={columns} | |||
rowKey="id" | |||
value={dataSource} | |||
onChange={setDataSource} | |||
recordCreatorProps={{ | |||
newRecordType: 'dataSource', | |||
record: () => ({ | |||
id: Date.now(), | |||
bomId:props.BomId | |||
}), | |||
}} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, defaultDoms) => { | |||
return [defaultDoms.delete,defaultDoms.Button]; | |||
}, | |||
onValuesChange: (record, recordList) => { | |||
setDataSource(recordList); | |||
}, | |||
onDelete:async (key, row) =>{ | |||
console.log(key) | |||
console.log(row) | |||
}, | |||
onChange: setEditableRowKeys, | |||
}}/> | |||
</Modal> | |||
//vessels | |||
); | |||
}; | |||
export default GoodsbomFrom; |
@@ -0,0 +1,387 @@ | |||
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,getbyidbomlist } from '../service'; | |||
import { | |||
EditableProTable, | |||
ProTable | |||
} from '@ant-design/pro-table'; | |||
const GoodsbomFrom = (props) => { | |||
const { Option, OptGroup } = Select; | |||
const [checkvalue, setCheckvalue] = useState([]); | |||
const [dataSource, setDataSource] = useState([]); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
const [form] = Form.useForm(); | |||
const [typename, settypename] = useState(''); | |||
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); | |||
} | |||
const addItem=(e)=>{ | |||
e.preventDefault(); | |||
if(typename.length==0){ | |||
message.error("请输入名称"); | |||
}else{ | |||
var parm={name:typename} | |||
AddBomType(parm).then((r)=>{ | |||
if(r.succeeded){ | |||
message.success('添加成功'); | |||
props.initTypeList(); | |||
settypename(''); | |||
}else{ | |||
message.error(r.errors); | |||
} | |||
}) | |||
} | |||
} | |||
useEffect(() => { | |||
console.log("props.Bomdata",props.Bomdata) | |||
console.log(props.goodsname) | |||
setdisaenumbled('block') | |||
setdisnewd("none") | |||
// form.setFieldsValue({ | |||
// bomName: props.goodsname, | |||
// // bomType:1 | |||
// }); | |||
if(props.defaultmatedata){ | |||
let soredata=[]; | |||
props.defaultmatedata.forEach((item,index)=>{ | |||
var data={ | |||
id:index, | |||
batchingId:item, | |||
dosage:0 | |||
} | |||
soredata.push(data) | |||
}) | |||
setEditableRowKeys(soredata.map((item) => item.id)) | |||
setDataSource(soredata); | |||
} | |||
},[props]) | |||
const columns=[ | |||
{ | |||
title: '物料名称', | |||
dataIndex: 'batchingId', | |||
formItemProps: (form, { rowIndex }) => { | |||
return { | |||
rules: | |||
rowIndex > 1 ? [{ required: true, message: '此项为必填项' }] : [], | |||
}; | |||
}, | |||
valueType: 'select', | |||
fieldProps: { | |||
showSearch:true, | |||
options: props.matedata.map((item, index) => {return {label:item.name,value:item.id}}) | |||
}, | |||
width: '25%', | |||
}, | |||
{ | |||
title: '用量', | |||
dataIndex: 'dosage', | |||
valueType:'digit', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: '15%', | |||
render: () => { | |||
return null; | |||
}, | |||
}, | |||
] | |||
const headleOk=()=>{ | |||
form | |||
.validateFields() | |||
.then((values) => { | |||
var check=true; | |||
var data=values; | |||
console.log("values",values) | |||
if(checkvalue.length==0){ | |||
check=false; | |||
message.error("请选择商品属性") | |||
}else{ | |||
data.shuxing=checkvalue; | |||
} | |||
if(disnewd=="block"){ | |||
if(dataSource.length==0){ | |||
check=false; | |||
message.error("请选择物料") | |||
}else{ | |||
data.mate=dataSource.map(x=>{return {batchingId:x.batchingId,dosage:x.dosage}}); | |||
} | |||
} | |||
if(check){ | |||
form.resetFields(); | |||
if(disaenumbled=="block"){ | |||
data.Type="check" | |||
}else{ | |||
data.Type="add" | |||
} | |||
data.goodsAttributeValue=arttuename | |||
data.bomType=1; | |||
data.bomName=values.bomName+"("+arttuename11+")" | |||
props.onFinish(data); | |||
setDataSource([]) | |||
setCheckvalue([]) | |||
setarttuename("") | |||
} | |||
}) | |||
.catch((info) => { | |||
message.error("请填写必填信息") | |||
}); | |||
} | |||
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) { | |||
// 将第一组的值累加到数组中 | |||
updatedValues[index] = value; | |||
} | |||
} | |||
props.goodsAttriburteData.forEach(item=>{ | |||
for (let index = 0; index < updatedValues.length; index++) { | |||
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+"-" | |||
} | |||
} | |||
} | |||
}) | |||
setarttuename1(names) | |||
setarttuename(names1) | |||
// form.setFieldsValue({ | |||
// bomName: props.goodsname+"("+names+")" | |||
// }); | |||
setCheckvalue(updatedValues) | |||
} | |||
const handleChange = (value) => { | |||
console.log(`selected ${value}`); | |||
form.setFieldsValue({ | |||
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={'关联配方'} | |||
width={1040} | |||
visible={props.handleCreateoodsBomModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
okText="确认" | |||
cancelText="取消" | |||
onOk={headleOk} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
maskClosable={false} | |||
destroyOnClose | |||
> | |||
<span><span style={{color:'red',marginRight: 3}}>*</span>商品属性</span> | |||
{ | |||
props.goodsAttriburteData == undefined ? '' :( | |||
props.goodsAttriburteData.map((item, index) => { | |||
return ( | |||
<div style={{marginLeft: 80,marginBottom:10}}> | |||
<div> | |||
<span style={{marginRight: 10}}> <Tag color="blue">{item.attributeName}</Tag>:</span> | |||
<span> | |||
<Radio.Group name={"radiogroup"+index} buttonStyle="solid" size="small" onChange={onChangevalue}> | |||
{ | |||
item.goodsAttributeValueList.map((item, index)=>{ | |||
return ( | |||
<Radio.Button name={index} value={item.goodsAttributeValuId} style={{marginRight: 22, marginTop: 16}}>{item.attributeValue}</Radio.Button> | |||
) | |||
}) | |||
} | |||
</Radio.Group> | |||
</span> | |||
</div> | |||
</div> | |||
); | |||
}) | |||
) | |||
} | |||
<Form layout="horizontal" preserve={false} form={form}> | |||
<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 | |||
style={{width:'90%'}} | |||
optionFilterProp="children" | |||
onChange={handleChange} | |||
placeholder="请选配方信息"> | |||
{props.Bomdata?.map((item, index) => { | |||
return ( | |||
<Option index={index} value={item.id} key={item.id}> | |||
{item.name} | |||
</Option> | |||
); | |||
})} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item shouldUpdate style={{display:disnewd}} name="bomName" label="配方名称" rules={[{ required: false, message: '配方名称' }]}> | |||
<Input style={{width:'87%'}} placeholder="请输入配方名称"/> | |||
</Form.Item> | |||
<Form.Item shouldUpdate style={{display:disnewd}} name="bomTypeList" rules={[{ required: false, message: '配方分类' }]} label="配方分类" > | |||
<Select | |||
style={{width: '100%'}} | |||
mode="tags" | |||
placeholder="请选配方分类" | |||
options={props.bomTypeData} | |||
dropdownRender={(menu) => ( | |||
<> | |||
{menu} | |||
<Divider style={{margin: '8px 0'}}/> | |||
<Space style={{padding: '0 8px 4px'}}> | |||
<Input | |||
placeholder="请输入配方分类" | |||
ref={inputRef} | |||
value={typename} | |||
onChange={onNameChange} | |||
onKeyDown={(e) => e.stopPropagation()} | |||
/> | |||
<Button type="text" icon={<PlusOutlined />} onClick={addItem}> | |||
新增 | |||
</Button> | |||
</Space> | |||
</> | |||
)} | |||
/> | |||
</Form.Item> | |||
{/* <Form.Item name="bomType" label="配方类型" initialValue='1' rules={[{ required: true, message: '配方类型' }]}> | |||
<Select | |||
placeholder="请选配方类型" | |||
onChange={(value) => { | |||
form.setFieldsValue({ | |||
bomType:value | |||
}); | |||
}} | |||
> | |||
<OptGroup> | |||
<Select.Option value="1">主料配方</Select.Option> | |||
<Select.Option value="0">辅料配方</Select.Option> | |||
</OptGroup> | |||
</Select> | |||
</Form.Item> */} | |||
</Form> | |||
<EditableProTable | |||
headerTitle={ <span><span style={{color:'red',marginRight: 3}}>*</span>配方详情</span>} | |||
columns={columns} | |||
rowKey="id" | |||
value={dataSource} | |||
onChange={setDataSource} | |||
recordCreatorProps={recordCreatorProps} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, defaultDoms) => { | |||
return [defaultDoms.delete,defaultDoms.Button]; | |||
}, | |||
onValuesChange: (record, recordList) => { | |||
setDataSource(recordList); | |||
}, | |||
onDelete:async (key, row) =>{ | |||
console.log(key) | |||
console.log(row) | |||
}, | |||
onChange: setEditableRowKeys, | |||
}}/> | |||
{/* <ProTable | |||
headerTitle="选择物料" | |||
actionRef={actionRef} | |||
size="small" | |||
scroll={{x:200,y:200}} | |||
rowKey="id" | |||
search={false} | |||
request={async (params) => { | |||
let Data = []; | |||
var total = 0; | |||
await getproductpage(params).then((r) => { | |||
Data = r.data.data; | |||
total = r.data.total; | |||
}); | |||
return { | |||
data: Data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
}, | |||
}}/> */} | |||
</Modal> | |||
//vessels | |||
); | |||
}; | |||
export default GoodsbomFrom; |
@@ -0,0 +1,279 @@ | |||
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 ProTable from '@ant-design/pro-table'; | |||
import CreateBom from './components/CreateBom'; | |||
// import UpdateBom from './components/UpdateBom' | |||
// import BomBatching from './components/BomBatching' | |||
import { addGoods} from '../newgoods/service'; | |||
import { GetGoodsBom, DelGoodsBom,getbygoodsidattribute,addgoodsbomattribute,GetbomTypelist,getproductpage,getbomlist } from './service' | |||
import axios from 'axios'; | |||
import { history } from 'umi'; | |||
const { Step } = Steps; | |||
const { Option, OptGroup } = Select; | |||
const { TextArea } = Input; | |||
const Advanced = (props) => { | |||
const [form] = Form.useForm(); | |||
const [goodsTypes, setGoodsTypes] = useState([]); | |||
const [goodsUnit, setGoodsUnit] = useState([]); | |||
const [goodsBigTypes, setGoodsBigTypes] = useState([]); | |||
const [goodsTaste, setGoodsTaste] = useState([]); | |||
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState(); | |||
const [handleCreateoodsBomModalVisible,setHandleCreateoodsBomModalVisible] = useState(false); | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const actionRef = useRef(); | |||
const [currTabKey, SetCurrTabKey] = useState("basis") | |||
const [url, setUrl] = useState(props.location.query.values ? props.location.query.values.imgUrl : null); | |||
const [currentGoodsProp, setCurrentGoodsProp] = useState(0); | |||
const [goodsAttriburteData, setGoodsAttriburteData] = useState([]); | |||
const [bomtype, setBomtype] = useState([]); | |||
const [matedata, setMatedata] = useState([]); | |||
const [treeData, setTreeData] = useState(); | |||
const [unitname, setunitname] = useState(''); | |||
const [bomTypeData,setbomTypeData]= useState([]); | |||
const inputRef = useRef(null); | |||
const [Bomdata, setBomdata] = useState([]); | |||
const [BomIds, setBomIds] = useState([]); | |||
const [BomId, setBomId] = useState(); | |||
const [UpdateBomVisible, setUpdateBomVisible] = useState(false); | |||
const [BomBatchingVisible,setBomBatchingVisible]= useState(false); | |||
const [goodsTypeIdvalue, setgoodsTypeIdvalue] = useState(); | |||
useEffect(() => { | |||
// if(!props.location?.query?.values){ | |||
// history.push({ | |||
// pathname: '/database/goods/newgoods', | |||
// }); | |||
// }else{ | |||
initGetbomType(); | |||
intBatching();//默认原料 | |||
//} | |||
}, []) | |||
function initGetbomType(){ | |||
GetbomTypelist().then((r)=>{ | |||
var list = []; | |||
if (r.data.length > 0) { | |||
r.data.forEach((item) => { | |||
list.push({ text: item.name, value: item.id, label: item.name }); | |||
}); | |||
} | |||
setbomTypeData(list) | |||
}) | |||
} | |||
function intBatching(){ | |||
getproductpage().then((r) => { | |||
setMatedata(r.data); | |||
}); | |||
} | |||
function initTypeList(){ | |||
initGetbomType(); | |||
} | |||
const bomcolumns = | |||
[ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
key: 'id', | |||
hideInTable: true, | |||
hideInSearch: true, | |||
tip: '规则名称是唯一的 key', | |||
}, | |||
{ | |||
title: '配方名称', | |||
key: 'name', | |||
dataIndex: 'name', | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
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', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
// <a | |||
// key="primary" | |||
// type="primary" | |||
// onClick={() => { | |||
// setUpdateBomVisible(true); | |||
// setBomId(record.bomId) | |||
// }} | |||
// > | |||
// 更新 | |||
// </a>, | |||
// <a | |||
// key="primary" | |||
// type="primary" | |||
// onClick={() => { | |||
// setBomBatchingVisible(true); | |||
// setBomId(record.bomId) | |||
// }} | |||
// > | |||
// 配方详情 | |||
// </a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
try { | |||
DelGoodsBom(record.id).then((r)=>{ | |||
if(r.data){ | |||
message.success('删除成功,即将刷新'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
return false; | |||
} | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
} | |||
] | |||
return ( | |||
<PageContainer | |||
host header={{ | |||
title: [<a key="back" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/newgoods', | |||
}); | |||
}}><ArrowLeftOutlined />返回</a>], | |||
breadcrumb: {}, | |||
}} | |||
> | |||
<ProTable | |||
columns={bomcolumns} | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search | |||
toolBarRender={() => [ | |||
<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) | |||
} | |||
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(r.data) | |||
}) | |||
return { | |||
data: msg.data.data, | |||
success: true, | |||
total: total, | |||
}; | |||
} | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => setSelectedRows(selectedRows), | |||
}} | |||
/> | |||
<CreateBom handleCreateoodsBomModalVisible={handleCreateoodsBomModalVisible} | |||
bomTypeData={bomTypeData} | |||
Bomdata={Bomdata} | |||
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(r.errors) | |||
} | |||
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); | |||
}} | |||
/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default Advanced; |
@@ -0,0 +1,57 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl } from '@/global_data'; | |||
export async function GetbomTypelist (data) { | |||
return request(getDataBaseUrl()+`/api/bom/getbomtypelist`, { | |||
method: 'Get', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function getproductpage(params) { | |||
return request(getDataBaseUrl()+'/api/batching/getbatchingselectlist', { | |||
method: 'Get', | |||
}); | |||
} | |||
export async function addgoodsbomattribute(data) { | |||
return request(getDataBaseUrl()+`/api/goods/addgoodsbomattribute`, { | |||
method: 'Post', | |||
data: data, | |||
}); | |||
} | |||
export async function getbygoodsidattribute (data) { | |||
return request(getDataBaseUrl()+`/api/goodsattribute/getbygoodsidattribute?id=`+data, { | |||
method: 'Get', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function GetGoodsBom(data) { | |||
return request(getDataBaseUrl()+`/api/goods/getgoodsbompage`, { | |||
method: 'Post', | |||
data: data, | |||
}); | |||
} | |||
export async function DelGoodsBom (data) { | |||
return request(getDataBaseUrl()+`/api/goods/delgoodsbom?Ids=${data}`, { | |||
method: 'GET', | |||
//data: data, | |||
}); | |||
} | |||
export async function AddBomType (data) { | |||
return request(getDataBaseUrl()+`/api/bom/addbomtype`, { | |||
method: 'Post', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function getbomlist() { | |||
return request(getDataBaseUrl()+'/api/bom/getbomlist', { | |||
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; | |||
} |
@@ -172,6 +172,9 @@ const handleAdd = async (fields) => { | |||
<a | |||
key="config" | |||
onClick={() => { | |||
if(record.pid=="0"){ | |||
record.pid=null; | |||
} | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
@@ -292,24 +295,24 @@ const handleAdd = async (fields) => { | |||
)} | |||
<CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -217,7 +217,7 @@ const GoodsManage = () => { | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodsInfo', | |||
pathname: '/database/goods/goodsbom', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
@@ -235,7 +235,7 @@ const GoodsManage = () => { | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodsInfo', | |||
pathname: '/database/goods/goodstechnology', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
@@ -145,6 +145,9 @@ const TableList = () => { | |||
<a | |||
key="primary3" | |||
onClick={() => { | |||
if(record.pid==0){ | |||
record.pid=null; | |||
} | |||
setStepFormValues(record); | |||
handleModalVisible(true); | |||
}} | |||
@@ -310,24 +313,24 @@ const TableList = () => { | |||
)} | |||
{ | |||
createModalVisible && <CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -1,5 +1,5 @@ | |||
import React,{useEffect,useState} from 'react'; | |||
import { Modal, Form, Input, Button, Select } from 'antd'; | |||
import { Modal, Form, Input, Button, Select,TreeSelect } from 'antd'; | |||
import api from './service' | |||
const CreateForm = (props) => { | |||
@@ -32,7 +32,7 @@ const CreateForm = (props) => { | |||
preserve={false} | |||
layout="horizontal" | |||
labelCol={{ | |||
span: 4, | |||
span: 6, | |||
}} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -40,21 +40,33 @@ const CreateForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户" rules={[{ required: true, max: 255 }]}> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
{/* <Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> */} | |||
<TreeSelect | |||
style={{ width: '100%' }} | |||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |||
treeData={props.treeDatas} | |||
placeholder="请选择上级名称" | |||
treeDefaultExpandAll | |||
/> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户(手机号)" | |||
tooltip="初始密码为:123456" | |||
rules={[{ required: true, max: 255,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确'}]}> | |||
<Input placeholder="请输入登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
<Form.Item name="name" label="用户姓名" rules={[{ required: true, max: 255 }]}> | |||
<Input placeholder="请输入用户姓名" /> | |||
</Form.Item> | |||
<Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入用户手机" /> | |||
</Form.Item> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
<Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
@@ -1,6 +1,6 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Select,Popconfirm } from 'antd'; | |||
import React, { useState, useRef } from 'react'; | |||
import React, { useState, useRef,useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import CreateForm from './components/CreateForm' | |||
@@ -84,6 +84,7 @@ const userManager = () => { | |||
const [selectDatas, SetselectData] = useState(); | |||
const [sysUserId, SetSysUserId] = useState(); | |||
const [account, setaccount] = useState(); | |||
const [treeData, setTreeData] = useState(); | |||
const InitRole = (id) => { | |||
SetSysUserId(id); | |||
api.GetRoleDic().then(r => { | |||
@@ -221,6 +222,18 @@ const userManager = () => { | |||
render: (_, record) => Btn(record) | |||
}, | |||
]; | |||
useEffect(() => { | |||
initfranchiseeType(); | |||
}, []); | |||
function initfranchiseeType() { | |||
api.gettree2().then((r) => { | |||
debugger | |||
setTreeData(r.data); | |||
});api | |||
} | |||
return ( | |||
<PageContainer host header={{ | |||
title: '', | |||
@@ -298,6 +311,7 @@ const userManager = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone= value.account; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -314,6 +328,7 @@ const userManager = () => { | |||
handleModalVisible(false); | |||
setStepFormValues({}); | |||
}} | |||
treeDatas={treeData} | |||
modalVisible={createModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
@@ -85,6 +85,15 @@ function gettree(params) { | |||
}); | |||
} | |||
function gettree2(params) { | |||
return request(getDataBaseUrl()+'/api/organize/tree', { | |||
method: 'GET', | |||
data: { | |||
...params, | |||
}, | |||
}); | |||
} | |||
export default { | |||
Page, | |||
Enable, | |||
@@ -99,5 +108,6 @@ export default { | |||
AddUserRole, | |||
UpdateUserRole, | |||
SetDataRole, | |||
gettree | |||
gettree, | |||
gettree2 | |||
}; |