@@ -21,7 +21,7 @@ import { MinusCircleOutlined, PlusOutlined, UploadOutlined } from '@ant-design/i | |||||
import { GetActivityConfiguration, GetCouponCanUseCountAndLimit, GetGoodsInfo, GetCosRequestURL } from '../service'; | import { GetActivityConfiguration, GetCouponCanUseCountAndLimit, GetGoodsInfo, GetCosRequestURL } from '../service'; | ||||
import axios from 'axios'; | import axios from 'axios'; | ||||
const CreateForm = (props) => { | const CreateForm = (props) => { | ||||
const { Option, OptGroup } = Select; | const { Option, OptGroup } = Select; | ||||
const [options, setoptions] = useState(); | const [options, setoptions] = useState(); | ||||
const [current, setCurrent] = React.useState(0); | const [current, setCurrent] = React.useState(0); | ||||
@@ -158,8 +158,7 @@ const CreateForm = (props) => { | |||||
var ext = file.name.substr(index + 1); | var ext = file.name.substr(index + 1); | ||||
const reader = new FileReader(); | const reader = new FileReader(); | ||||
if (['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext) == -1) | |||||
{ | |||||
if (['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext) == -1) { | |||||
message.error(`${file.name} 不是图片文件`); | message.error(`${file.name} 不是图片文件`); | ||||
return; | return; | ||||
} | } | ||||
@@ -0,0 +1,90 @@ | |||||
import React, { useState, useEffect } from 'react'; | |||||
import { Modal, Form, Input, Button, Select, Space, Card } from 'antd' | |||||
import { EditableProTable, ProForm, ProFormText } from '@ant-design/pro-form'; | |||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; | |||||
import '../index.css' | |||||
const BomConsumption = (props) => { | |||||
const copyFormula = (index) => { | |||||
const tempColums = JSON.parse(JSON.stringify(props.values)); | |||||
tempColums.push(tempColums[index]); | |||||
props.onUpdateBom(tempColums); | |||||
} | |||||
const deleteFormula = (index) => { | |||||
if (props.values.length <= 1) return; | |||||
const tempColums = JSON.parse(JSON.stringify(props.values)); | |||||
tempColums.splice(index, 1); | |||||
props.onUpdateBom(tempColums); | |||||
} | |||||
const handleOk = () => { | |||||
props.onFinish(props.values); | |||||
// console.log('表单值为', props.values); | |||||
}; | |||||
return ( | |||||
<Modal | |||||
width={540} | |||||
visible={props.visible} | |||||
bodyStyle={{ padding: '32px 40px 48px' }} | |||||
footer={null} | |||||
onCancel={() => { | |||||
props.onCancel(); | |||||
}} | |||||
title="配方用量" | |||||
> | |||||
<div className="formual-form-card"> | |||||
{ | |||||
props.values.map((item, index) => { | |||||
return <div className="formual-form-list" key={index}> | |||||
<div className="form-list-copy" > | |||||
<Button onClick={() => copyFormula(index)}>复制一份配方用量</Button> | |||||
<Button style={{ marginLeft: '10px' }} danger onClick={() => deleteFormula(index)}>删除配方用量</Button> | |||||
</div> | |||||
<div className="form-list-item form-list-total"> | |||||
<span className="form-input-label">总量</span> | |||||
<Input placeholder="请输入总量" value={item.bomWeight} onChange={(e) => { | |||||
const tempColums = JSON.parse(JSON.stringify(props.values)); | |||||
tempColums[index].bomWeight = e.target.value; | |||||
props.onUpdateBom(tempColums); | |||||
}} /> | |||||
</div> | |||||
{ | |||||
item.bomMaterials.map((itemList, listIndex) => { | |||||
return <div className="form-list-detail" key={itemList.id}> | |||||
<div className="form-detail-card"> | |||||
<div className="form-list-item formmual-name"> | |||||
<span className="form-input-label">名称</span> | |||||
<Input placeholder="物料名称" value={itemList.name} onChange={(e) => { | |||||
const tempColums = JSON.parse(JSON.stringify(props.values)); | |||||
tempColums[index].bomMaterials[listIndex].name = e.target.value; | |||||
props.onUpdateBom(tempColums); | |||||
}} /> | |||||
</div> | |||||
<div className="form-list-item formmual-company"> | |||||
<span className="form-input-label">数量</span> | |||||
<Input placeholder="物料数量" value={itemList.num} onChange={(e) => { | |||||
const tempColums = JSON.parse(JSON.stringify(props.values)); | |||||
tempColums[index].bomMaterials[listIndex].num = e.target.value; | |||||
props.onUpdateBom(tempColums); | |||||
}} /> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
}) | |||||
} | |||||
</div> | |||||
}) | |||||
} | |||||
</div> | |||||
<Button type="primary" onClick={handleOk} style={{ float: 'right' }}> | |||||
保存 | |||||
</Button> | |||||
</Modal> | |||||
); | |||||
}; | |||||
export default BomConsumption; |
@@ -0,0 +1,32 @@ | |||||
.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; | |||||
} |
@@ -5,6 +5,7 @@ import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||||
import ProTable from '@ant-design/pro-table'; | import ProTable from '@ant-design/pro-table'; | ||||
import CreateForm from './components/CreateForm'; | import CreateForm from './components/CreateForm'; | ||||
import AddBomInfo from './components/AddBomInfo'; | import AddBomInfo from './components/AddBomInfo'; | ||||
import BomConsumption from './components/BomConsumption'; | |||||
import BomList from './components/BomList'; | import BomList from './components/BomList'; | ||||
import api from './services'; | import api from './services'; | ||||
@@ -19,8 +20,13 @@ const GoodsBomsManage = (props) => { | |||||
const [getBom, setBom] = useState(); | const [getBom, setBom] = useState(); | ||||
/** 商品配方调整新建/更新窗口的弹窗 */ | /** 商品配方调整新建/更新窗口的弹窗 */ | ||||
const [setBomModalVisible, handleBomModalVisible] = useState(); | const [setBomModalVisible, handleBomModalVisible] = useState(); | ||||
const [BomConsumptionModalVisible, SetBomConsumptionModalVisible] = useState(false); | |||||
const [bomtype, setBomtype] = useState([]); | const [bomtype, setBomtype] = useState([]); | ||||
const [bomtypeenum, setBomtypeenum] = useState({}); | const [bomtypeenum, setBomtypeenum] = useState({}); | ||||
const [bomConsumptionInfo, setBomConsumptionInfo] = useState([]); | |||||
useEffect(() => { | useEffect(() => { | ||||
/** 获取原料名称*/ | /** 获取原料名称*/ | ||||
function initStockGoods() { | function initStockGoods() { | ||||
@@ -163,15 +169,15 @@ const GoodsBomsManage = (props) => { | |||||
render: (_, record) => ( | render: (_, record) => ( | ||||
<Space> | <Space> | ||||
{ | { | ||||
bomtype.filter(x => { | |||||
let findId = record.bomTypeList.find(findItem => findItem === x.id); | |||||
let findBomType = bomtype.find(bomItem => bomItem.id === findId); | |||||
return findBomType != null || undefined; | |||||
}).map(item => ( | |||||
<Tag color="#87d068" key={item.id}> | |||||
{item.name} | |||||
</Tag> | |||||
))} | |||||
bomtype.filter(x => { | |||||
let findId = record.bomTypeList.find(findItem => findItem === x.id); | |||||
let findBomType = bomtype.find(bomItem => bomItem.id === findId); | |||||
return findBomType != null || undefined; | |||||
}).map(item => ( | |||||
<Tag color="#87d068" key={item.id}> | |||||
{item.name} | |||||
</Tag> | |||||
))} | |||||
</Space> | </Space> | ||||
), | ), | ||||
}, | }, | ||||
@@ -212,7 +218,7 @@ const GoodsBomsManage = (props) => { | |||||
更新 | 更新 | ||||
</a>, | </a>, | ||||
<a | <a | ||||
key="primary2" | |||||
key="BomConsumption" | |||||
type="primary" | type="primary" | ||||
onClick={() => { | onClick={() => { | ||||
setCurrentRow(record); | setCurrentRow(record); | ||||
@@ -221,6 +227,18 @@ const GoodsBomsManage = (props) => { | |||||
> | > | ||||
添加配方物料 | 添加配方物料 | ||||
</a>, | </a>, | ||||
<a | |||||
key="primary2" | |||||
type="primary" | |||||
onClick={async () => { | |||||
var r = await api.getomConsumptionInfo(record.id); | |||||
setBomConsumptionInfo(r.data); | |||||
setCurrentRow(record); | |||||
SetBomConsumptionModalVisible(true); | |||||
}} | |||||
> | |||||
配方用量 | |||||
</a>, | |||||
<a | <a | ||||
key="primary1" | key="primary1" | ||||
type="primary" | type="primary" | ||||
@@ -236,6 +254,10 @@ const GoodsBomsManage = (props) => { | |||||
}, | }, | ||||
]; | ]; | ||||
const onUpdateBom = (data) => { | |||||
setBomConsumptionInfo(data); | |||||
} | |||||
return ( | return ( | ||||
<PageContainer> | <PageContainer> | ||||
<ProTable | <ProTable | ||||
@@ -324,6 +346,32 @@ const GoodsBomsManage = (props) => { | |||||
createModalVisible={createModalVisible} | createModalVisible={createModalVisible} | ||||
values={currentRow || {}} | values={currentRow || {}} | ||||
/> | /> | ||||
{/* 配方用量 */} | |||||
<BomConsumption | |||||
onFinish={async (value) => { | |||||
api.addBomConsumptionInfo({ | |||||
"bomId": currentRow.id, | |||||
"bomConsumptionInfo": value | |||||
}).then((r) => { | |||||
if (r.data) { | |||||
SetBomConsumptionModalVisible(false); | |||||
message.success('成功'); | |||||
} else { | |||||
message.error('添加失败请重试!'); | |||||
} | |||||
}); | |||||
console.log(value); | |||||
}} | |||||
visible={BomConsumptionModalVisible} | |||||
values={bomConsumptionInfo} | |||||
onUpdateBom={onUpdateBom} | |||||
onCancel={() => { | |||||
SetBomConsumptionModalVisible(false); | |||||
}} | |||||
/> | |||||
</PageContainer> | </PageContainer> | ||||
); | ); | ||||
}; | }; | ||||
@@ -73,10 +73,30 @@ export default { | |||||
}, | }, | ||||
//获取菜谱分类 | //获取菜谱分类 | ||||
getbomtypepage(data) { | |||||
return request(`/kitchen/api/bom/getbomtypepage`, { | |||||
method: 'Post', | |||||
data: data, | |||||
}); | |||||
} | |||||
getbomtypepage(data) { | |||||
return request(`/kitchen/api/bom/getbomtypepage`, { | |||||
method: 'Post', | |||||
data: data, | |||||
}); | |||||
}, | |||||
//添加菜谱物料用量 | |||||
addBomConsumptionInfo(data) { | |||||
return request(`/kitchen/api/bom/addBomConsumptionInfo`, { | |||||
method: 'Post', | |||||
data: data, | |||||
}); | |||||
}, | |||||
//获取菜谱物料用量 | |||||
getomConsumptionInfo(data) { | |||||
return request(`/kitchen/api/bom/getomConsumptionInfo?bomId=${data}`, { | |||||
method: 'get', | |||||
data: data, | |||||
}); | |||||
} | |||||
}; | }; | ||||
@@ -55,7 +55,7 @@ const DeviceStockManager = (props) => { | |||||
const pushStock = async (id) => { | const pushStock = async (id) => { | ||||
try { | try { | ||||
message.loading('正在同步', key); | message.loading('正在同步', key); | ||||
if (props.values.deviceTypeKey =="TMC_MT") { | |||||
if (props.values.deviceTypeKey == "TMC_MT") { | |||||
await PushDeviceTMC_MT(id).then((r) => { | await PushDeviceTMC_MT(id).then((r) => { | ||||
message.destroy(key); | message.destroy(key); | ||||
if (r.data) { | if (r.data) { | ||||
@@ -29,7 +29,6 @@ export async function PushDeviceTMC_MT(data) { | |||||
}); | }); | ||||
} | } | ||||
/** 获取实时库存 */ | /** 获取实时库存 */ | ||||
export async function CheckStockAdjust(data) { | export async function CheckStockAdjust(data) { | ||||
return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, { | return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, { | ||||
@@ -24,17 +24,17 @@ const CreateForm = (props) => { | |||||
<Form.Item name="id" hidden={true}> | <Form.Item name="id" hidden={true}> | ||||
<Input /> | <Input /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="name" label="物料类型名称" rules={[{ required: true, max: 64,whitespace:true }]}> | |||||
<Input placeholder="请输入物料类型名称" /> | |||||
<Form.Item name="name" label="物料分类名称" rules={[{ required: true, max: 64,whitespace:true }]}> | |||||
<Input placeholder="请输入物物料分类称" /> | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item | <Form.Item | ||||
name="status" | name="status" | ||||
label="状态" | label="状态" | ||||
defaultValue={props.values.status} | defaultValue={props.values.status} | ||||
rules={[{ required: true, message: '请选择物料状态' }]} | |||||
rules={[{ required: true, message: '请选择物料分类状态' }]} | |||||
> | > | ||||
<Select placeholder="请选择物料状态"> | |||||
<Select placeholder="请选择物料分类状态"> | |||||
<OptGroup> | <OptGroup> | ||||
<Select.Option value="0">正常</Select.Option> | <Select.Option value="0">正常</Select.Option> | ||||
<Select.Option value="1">停用</Select.Option> | <Select.Option value="1">停用</Select.Option> | ||||
@@ -1,5 +1,5 @@ | |||||
import { FontColorsOutlined, PlusOutlined, DownOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons'; | import { FontColorsOutlined, PlusOutlined, DownOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons'; | ||||
import { Modal, Form, Input, Button, Select, TreeSelect, Space, Checkbox, Col, Row, DatePicker, Card, List, Tree, message, Drawer, Divider, Tag, Tabs } from 'antd'; | |||||
import { Modal, Form, Input, Button,Popconfirm , Select, TreeSelect, Space, Checkbox, Col, Row, DatePicker, Card, List, Tree, message, Drawer, Divider, Tag, Tabs } from 'antd'; | |||||
import React, { useState, useRef, useEffect } from 'react'; | import React, { useState, useRef, useEffect } from 'react'; | ||||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | ||||
import ProTable from '@ant-design/pro-table'; | import ProTable from '@ant-design/pro-table'; | ||||
@@ -177,6 +177,20 @@ const PageIndex = (props) => { | |||||
{' '} | {' '} | ||||
{record.status == 0 ? '停用' : '启用'} | {record.status == 0 ? '停用' : '启用'} | ||||
</a>, | </a>, | ||||
// <Popconfirm | |||||
// type="primary" | |||||
// key="primary" | |||||
// title="确认删除吗?" | |||||
// okText="是" | |||||
// cancelText="否" | |||||
// onConfirm={() => { | |||||
// handleRemove(record.id); | |||||
// actionRef.current?.reloadAndRest(); | |||||
// }} | |||||
// onCancel={() => { }} | |||||
// > | |||||
// <a href="#">删除</a> | |||||
// </Popconfirm>, | |||||
], | ], | ||||
}, | }, | ||||
@@ -1,5 +1,5 @@ | |||||
import React, { useState, useEffect } from 'react'; | import React, { useState, useEffect } from 'react'; | ||||
import { Modal, Form, Input, Button, Select, Radio, Space, InputNumber } from 'antd'; | |||||
import { Modal, Form, Input, Button, Select, Radio, Space, InputNumber,TreeSelect } from 'antd'; | |||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; | import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; | ||||
const CreateForm = (props) => { | const CreateForm = (props) => { | ||||
@@ -28,15 +28,13 @@ const CreateForm = (props) => { | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="storeId" label={'选择店铺'} rules={[{ required: true }]}> | <Form.Item name="storeId" label={'选择店铺'} rules={[{ required: true }]}> | ||||
<Select disabled={props.values.id ? true : false}> | |||||
{props.storeArray.map((item, index) => { | |||||
return ( | |||||
<Select.Option index={index} value={item.id} key={item.id}> | |||||
{item.text} | |||||
</Select.Option> | |||||
); | |||||
})} | |||||
</Select> | |||||
<TreeSelect | |||||
style={{ width: '100%' }} | |||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |||||
treeData={props.OrgData} | |||||
placeholder="归属门店" | |||||
treeDefaultExpandAll | |||||
/> | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label="分账账户"> | <Form.Item label="分账账户"> | ||||
@@ -113,7 +111,7 @@ const CreateForm = (props) => { | |||||
shouldUpdate={(prevValues, currentValues) => | shouldUpdate={(prevValues, currentValues) => | ||||
prevValues?.businessList[key]?.splitType != undefined || | prevValues?.businessList[key]?.splitType != undefined || | ||||
prevValues?.businessList[key]?.splitType !== | prevValues?.businessList[key]?.splitType !== | ||||
currentValues?.businessList[key]?.splitType | |||||
currentValues?.businessList[key]?.splitType | |||||
} | } | ||||
> | > | ||||
{({ getFieldValue }) => | {({ getFieldValue }) => | ||||
@@ -12,6 +12,7 @@ import { | |||||
removeAccount, | removeAccount, | ||||
GetStoreInfoPageAsync, | GetStoreInfoPageAsync, | ||||
GetBusinessAsync, | GetBusinessAsync, | ||||
gettree | |||||
} from './services'; | } from './services'; | ||||
import { getPlanList } from '../plan/services'; | import { getPlanList } from '../plan/services'; | ||||
@@ -22,6 +23,8 @@ const AccountDetailsManage = () => { | |||||
const [storeEnum, setStoreEnum] = useState(); | const [storeEnum, setStoreEnum] = useState(); | ||||
const [storeArray, setStoreArray] = useState([]); | const [storeArray, setStoreArray] = useState([]); | ||||
const [OrgList, setOrgList] = useState([]); | |||||
const [OrgListArray, setOrgListArray] = useState([]); | |||||
//初始化数据 | //初始化数据 | ||||
useEffect(() => { | useEffect(() => { | ||||
@@ -59,6 +62,38 @@ const AccountDetailsManage = () => { | |||||
setStoreEnum(list); | setStoreEnum(list); | ||||
}); | }); | ||||
}; | }; | ||||
function initOrgList() { | |||||
gettree().then((r) => { | |||||
inittree(r.data); | |||||
function inittree(datas) { | |||||
for (var i in datas) { | |||||
if( datas[i]['type']==2|| datas[i]['type']==3){ | |||||
datas[i]['disabled']=false; | |||||
}else{ | |||||
datas[i]['disabled']=true; | |||||
} | |||||
if (datas[i].children) { | |||||
inittree(datas[i].children); | |||||
} | |||||
} | |||||
} | |||||
setOrgList(r.data); | |||||
let list = {}; | |||||
formateData(r.data); | |||||
function formateData(datas) { | |||||
for (var i in datas) { | |||||
list[datas[i]['disabled']]=true; | |||||
list[datas[i]['value']] = { text: datas[i]['title'] }; | |||||
if (datas[i].children) { | |||||
formateData(datas[i].children); | |||||
} | |||||
} | |||||
} | |||||
setOrgListArray(list); | |||||
}); | |||||
} | |||||
initOrgList(); | |||||
initPlan(); | initPlan(); | ||||
initStore(); | initStore(); | ||||
@@ -366,6 +401,7 @@ const AccountDetailsManage = () => { | |||||
)} | )} | ||||
{/* 分账账户管理(新增,修改) */} | {/* 分账账户管理(新增,修改) */} | ||||
<CreateForm | <CreateForm | ||||
OrgData={OrgList} | |||||
planArray={planArray} | planArray={planArray} | ||||
storeArray={storeArray} | storeArray={storeArray} | ||||
onFinish={async (value) => { | onFinish={async (value) => { | ||||
@@ -68,3 +68,11 @@ export async function GetBusinessAsync(storeId, planId) { | |||||
// method: 'DELETE', | // method: 'DELETE', | ||||
// }); | // }); | ||||
// } | // } | ||||
export async function gettree(params) { | |||||
return request('/kitchen/api/sysOrg/tree', { | |||||
data: { | |||||
...params, | |||||
}, | |||||
}); | |||||
} |