diff --git a/src/pages/activity/activityInfo/components/CreateForm.jsx b/src/pages/activity/activityInfo/components/CreateForm.jsx index 1c946dd..d9e67ad 100644 --- a/src/pages/activity/activityInfo/components/CreateForm.jsx +++ b/src/pages/activity/activityInfo/components/CreateForm.jsx @@ -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; } diff --git a/src/pages/bom/manage/components/BomConsumption.jsx b/src/pages/bom/manage/components/BomConsumption.jsx new file mode 100644 index 0000000..524276f --- /dev/null +++ b/src/pages/bom/manage/components/BomConsumption.jsx @@ -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 ( + + { + props.onCancel(); + }} + title="配方用量" + > +
+ { + props.values.map((item, index) => { + return
+
+ + +
+
+ 总量 + { + const tempColums = JSON.parse(JSON.stringify(props.values)); + tempColums[index].bomWeight = e.target.value; + props.onUpdateBom(tempColums); + }} /> +
+ { + item.bomMaterials.map((itemList, listIndex) => { + return
+
+
+ 名称 + { + const tempColums = JSON.parse(JSON.stringify(props.values)); + tempColums[index].bomMaterials[listIndex].name = e.target.value; + props.onUpdateBom(tempColums); + }} /> +
+
+ 数量 + { + const tempColums = JSON.parse(JSON.stringify(props.values)); + tempColums[index].bomMaterials[listIndex].num = e.target.value; + props.onUpdateBom(tempColums); + }} /> +
+
+
+ }) + } +
+ }) + } +
+ +
+ ); +}; + +export default BomConsumption; diff --git a/src/pages/bom/manage/index.css b/src/pages/bom/manage/index.css new file mode 100644 index 0000000..3f54957 --- /dev/null +++ b/src/pages/bom/manage/index.css @@ -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; +} \ No newline at end of file diff --git a/src/pages/bom/manage/index.jsx b/src/pages/bom/manage/index.jsx index 6e43014..ea59054 100644 --- a/src/pages/bom/manage/index.jsx +++ b/src/pages/bom/manage/index.jsx @@ -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) => ( { - 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 => ( - - {item.name} - - ))} + 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 => ( + + {item.name} + + ))} ), }, @@ -212,7 +218,7 @@ const GoodsBomsManage = (props) => { 更新 , { setCurrentRow(record); @@ -221,6 +227,18 @@ const GoodsBomsManage = (props) => { > 添加配方物料 , + { + var r = await api.getomConsumptionInfo(record.id); + setBomConsumptionInfo(r.data); + setCurrentRow(record); + SetBomConsumptionModalVisible(true); + }} + > + 配方用量 + , { }, ]; + const onUpdateBom = (data) => { + setBomConsumptionInfo(data); + } + return ( { createModalVisible={createModalVisible} values={currentRow || {}} /> + + {/* 配方用量 */} + { + + 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); + }} + /> ); }; diff --git a/src/pages/bom/manage/services.js b/src/pages/bom/manage/services.js index 3e24936..92318c9 100644 --- a/src/pages/bom/manage/services.js +++ b/src/pages/bom/manage/services.js @@ -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, + }); + } + }; + + diff --git a/src/pages/erp/basic/productType/components/CreateForm.jsx b/src/pages/erp/basic/productType/components/CreateForm.jsx index f689e88..69c9444 100644 --- a/src/pages/erp/basic/productType/components/CreateForm.jsx +++ b/src/pages/erp/basic/productType/components/CreateForm.jsx @@ -24,17 +24,17 @@ const CreateForm = (props) => { - - + + - 正常 停用 diff --git a/src/pages/goods/goodsPracticeInfo/index.jsx b/src/pages/goods/goodsPracticeInfo/index.jsx index 931df1e..84b9457 100644 --- a/src/pages/goods/goodsPracticeInfo/index.jsx +++ b/src/pages/goods/goodsPracticeInfo/index.jsx @@ -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 ? '停用' : '启用'} , + // { + // handleRemove(record.id); + // actionRef.current?.reloadAndRest(); + // }} + // onCancel={() => { }} + // > + // 删除 + // , ], }, diff --git a/src/pages/split/account/components/CreateForm.jsx b/src/pages/split/account/components/CreateForm.jsx index c67b90e..63cdd30 100644 --- a/src/pages/split/account/components/CreateForm.jsx +++ b/src/pages/split/account/components/CreateForm.jsx @@ -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) => { - + @@ -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 }) => diff --git a/src/pages/split/account/index.jsx b/src/pages/split/account/index.jsx index 9926ea5..b82dde5 100644 --- a/src/pages/split/account/index.jsx +++ b/src/pages/split/account/index.jsx @@ -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 = () => { )} {/* 分账账户管理(新增,修改) */} { diff --git a/src/pages/split/account/services.js b/src/pages/split/account/services.js index ca14ec2..d55cd08 100644 --- a/src/pages/split/account/services.js +++ b/src/pages/split/account/services.js @@ -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, + }, + }); +}