Browse Source

Merge branch 'master' into dev

tags/小炒逻辑变更前
gwbvipvip 2 years ago
parent
commit
3b86a60f33
12 changed files with 281 additions and 37 deletions
  1. +2
    -3
      src/pages/activity/activityInfo/components/CreateForm.jsx
  2. +90
    -0
      src/pages/bom/manage/components/BomConsumption.jsx
  3. +32
    -0
      src/pages/bom/manage/index.css
  4. +58
    -10
      src/pages/bom/manage/index.jsx
  5. +26
    -6
      src/pages/bom/manage/services.js
  6. +1
    -1
      src/pages/device/deviceStock/index.jsx
  7. +0
    -1
      src/pages/device/deviceStock/services.js
  8. +4
    -4
      src/pages/erp/basic/productType/components/CreateForm.jsx
  9. +15
    -1
      src/pages/goods/goodsPracticeInfo/index.jsx
  10. +9
    -11
      src/pages/split/account/components/CreateForm.jsx
  11. +36
    -0
      src/pages/split/account/index.jsx
  12. +8
    -0
      src/pages/split/account/services.js

+ 2
- 3
src/pages/activity/activityInfo/components/CreateForm.jsx View File

@@ -21,7 +21,7 @@ import { MinusCircleOutlined, PlusOutlined, UploadOutlined } from '@ant-design/i
import { GetActivityConfiguration, GetCouponCanUseCountAndLimit, GetGoodsInfo, GetCosRequestURL } from '../service';
import axios from 'axios';
const CreateForm = (props) => {
const { Option, OptGroup } = Select;
const [options, setoptions] = useState();
const [current, setCurrent] = React.useState(0);
@@ -158,8 +158,7 @@ const CreateForm = (props) => {
var ext = file.name.substr(index + 1);
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} 不是图片文件`);
return;
}


+ 90
- 0
src/pages/bom/manage/components/BomConsumption.jsx View File

@@ -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;

+ 32
- 0
src/pages/bom/manage/index.css View File

@@ -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;
}

+ 58
- 10
src/pages/bom/manage/index.jsx View File

@@ -5,6 +5,7 @@ import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import CreateForm from './components/CreateForm';
import AddBomInfo from './components/AddBomInfo';
import BomConsumption from './components/BomConsumption';
import BomList from './components/BomList';
import api from './services';

@@ -19,8 +20,13 @@ const GoodsBomsManage = (props) => {
const [getBom, setBom] = useState();
/** 商品配方调整新建/更新窗口的弹窗 */
const [setBomModalVisible, handleBomModalVisible] = useState();
const [BomConsumptionModalVisible, SetBomConsumptionModalVisible] = useState(false);

const [bomtype, setBomtype] = useState([]);
const [bomtypeenum, setBomtypeenum] = useState({});

const [bomConsumptionInfo, setBomConsumptionInfo] = useState([]);

useEffect(() => {
/** 获取原料名称*/
function initStockGoods() {
@@ -163,15 +169,15 @@ const GoodsBomsManage = (props) => {
render: (_, record) => (
<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>
),
},
@@ -212,7 +218,7 @@ const GoodsBomsManage = (props) => {
更新
</a>,
<a
key="primary2"
key="BomConsumption"
type="primary"
onClick={() => {
setCurrentRow(record);
@@ -221,6 +227,18 @@ const GoodsBomsManage = (props) => {
>
添加配方物料
</a>,
<a
key="primary2"
type="primary"
onClick={async () => {
var r = await api.getomConsumptionInfo(record.id);
setBomConsumptionInfo(r.data);
setCurrentRow(record);
SetBomConsumptionModalVisible(true);
}}
>
配方用量
</a>,
<a
key="primary1"
type="primary"
@@ -236,6 +254,10 @@ const GoodsBomsManage = (props) => {
},
];

const onUpdateBom = (data) => {
setBomConsumptionInfo(data);
}

return (
<PageContainer>
<ProTable
@@ -324,6 +346,32 @@ const GoodsBomsManage = (props) => {
createModalVisible={createModalVisible}
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>
);
};


+ 26
- 6
src/pages/bom/manage/services.js View File

@@ -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,
});
}

};



+ 1
- 1
src/pages/device/deviceStock/index.jsx View File

@@ -55,7 +55,7 @@ const DeviceStockManager = (props) => {
const pushStock = async (id) => {
try {
message.loading('正在同步', key);
if (props.values.deviceTypeKey =="TMC_MT") {
if (props.values.deviceTypeKey == "TMC_MT") {
await PushDeviceTMC_MT(id).then((r) => {
message.destroy(key);
if (r.data) {


+ 0
- 1
src/pages/device/deviceStock/services.js View File

@@ -29,7 +29,6 @@ export async function PushDeviceTMC_MT(data) {
});
}


/** 获取实时库存 */
export async function CheckStockAdjust(data) {
return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, {


+ 4
- 4
src/pages/erp/basic/productType/components/CreateForm.jsx View File

@@ -24,17 +24,17 @@ const CreateForm = (props) => {
<Form.Item name="id" hidden={true}>
<Input />
</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
name="status"
label="状态"
defaultValue={props.values.status}
rules={[{ required: true, message: '请选择物料状态' }]}
rules={[{ required: true, message: '请选择物料分类状态' }]}
>
<Select placeholder="请选择物料状态">
<Select placeholder="请选择物料分类状态">
<OptGroup>
<Select.Option value="0">正常</Select.Option>
<Select.Option value="1">停用</Select.Option>


+ 15
- 1
src/pages/goods/goodsPracticeInfo/index.jsx View File

@@ -1,5 +1,5 @@
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 { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
@@ -177,6 +177,20 @@ const PageIndex = (props) => {
{' '}
{record.status == 0 ? '停用' : '启用'}
</a>,
// <Popconfirm
// type="primary"
// key="primary"
// title="确认删除吗?"
// okText="是"
// cancelText="否"
// onConfirm={() => {
// handleRemove(record.id);
// actionRef.current?.reloadAndRest();
// }}
// onCancel={() => { }}
// >
// <a href="#">删除</a>
// </Popconfirm>,

],
},


+ 9
- 11
src/pages/split/account/components/CreateForm.jsx View File

@@ -1,5 +1,5 @@
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';

const CreateForm = (props) => {
@@ -28,15 +28,13 @@ const CreateForm = (props) => {
</Form.Item>

<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 label="分账账户">
@@ -113,7 +111,7 @@ const CreateForm = (props) => {
shouldUpdate={(prevValues, currentValues) =>
prevValues?.businessList[key]?.splitType != undefined ||
prevValues?.businessList[key]?.splitType !==
currentValues?.businessList[key]?.splitType
currentValues?.businessList[key]?.splitType
}
>
{({ getFieldValue }) =>


+ 36
- 0
src/pages/split/account/index.jsx View File

@@ -12,6 +12,7 @@ import {
removeAccount,
GetStoreInfoPageAsync,
GetBusinessAsync,
gettree
} from './services';
import { getPlanList } from '../plan/services';

@@ -22,6 +23,8 @@ const AccountDetailsManage = () => {

const [storeEnum, setStoreEnum] = useState();
const [storeArray, setStoreArray] = useState([]);
const [OrgList, setOrgList] = useState([]);
const [OrgListArray, setOrgListArray] = useState([]);

//初始化数据
useEffect(() => {
@@ -59,6 +62,38 @@ const AccountDetailsManage = () => {
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();
initStore();
@@ -366,6 +401,7 @@ const AccountDetailsManage = () => {
)}
{/* 分账账户管理(新增,修改) */}
<CreateForm
OrgData={OrgList}
planArray={planArray}
storeArray={storeArray}
onFinish={async (value) => {


+ 8
- 0
src/pages/split/account/services.js View File

@@ -68,3 +68,11 @@ export async function GetBusinessAsync(storeId, planId) {
// method: 'DELETE',
// });
// }

export async function gettree(params) {
return request('​/kitchen/api​/sysOrg​/tree', {
data: {
...params,
},
});
}

Loading…
Cancel
Save