@@ -239,7 +239,7 @@ const GoodsTypeManage = () => { | |||||
}} | }} | ||||
> | > | ||||
{' '} | {' '} | ||||
{record.store_Status == 0 ? '停用' : '正常'} | |||||
{record.store_Status == 0 ? '正常' :'停用'} | |||||
</a>, | </a>, | ||||
], | ], | ||||
@@ -9,18 +9,18 @@ const CreateForm = (props) => { | |||||
//初始化数据 | //初始化数据 | ||||
useEffect(() => { | useEffect(() => { | ||||
const initBatching = () => { | const initBatching = () => { | ||||
if(props.isbom){ | if(props.isbom){ | ||||
GetProductListByBom({ DeviceId: props.DeviceId,BomIds:props.bomIds }).then((data) => { | GetProductListByBom({ DeviceId: props.DeviceId,BomIds:props.bomIds }).then((data) => { | ||||
setBatchingList(data.data); | setBatchingList(data.data); | ||||
}); | }); | ||||
}else { | }else { | ||||
GetBatchingAsync({ DeviceId: props.DeviceId }).then((data) => { | GetBatchingAsync({ DeviceId: props.DeviceId }).then((data) => { | ||||
setBatchingList(data.data); | setBatchingList(data.data); | ||||
}); | }); | ||||
} | } | ||||
}; | }; | ||||
initBatching(); | initBatching(); | ||||
}, []); | }, []); | ||||
@@ -55,7 +55,7 @@ const CreateForm = (props) => { | |||||
filterOption={(input, option) => | filterOption={(input, option) => | ||||
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 | option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 | ||||
}> | }> | ||||
{batchingList.map((item, index) => { | |||||
{batchingList?.map((item, index) => { | |||||
return ( | return ( | ||||
<Select.Option index={index} value={item.id} key={item.id}> | <Select.Option index={index} value={item.id} key={item.id}> | ||||
{item.name} | {item.name} | ||||
@@ -24,7 +24,7 @@ const createRelevanceForm = (props) => { | |||||
<Form.Item name="id" hidden={true}> | <Form.Item name="id" hidden={true}> | ||||
<Input /> | <Input /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label='商品' name={'goodsId'} initialValue={props.values.goodsId}> | |||||
<Form.Item label='商品' name={'goodsId'} rules={[{ required: true }]} initialValue={props.values.goodsId}> | |||||
<Select showSearch style={{ width: '300px' }} | <Select showSearch style={{ width: '300px' }} | ||||
> | > | ||||
{ | { | ||||
@@ -39,7 +39,7 @@ const createRelevanceForm = (props) => { | |||||
} | } | ||||
</Select> | </Select> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label='做法' name={'practiceIds'} initialValue={props.values.practiceIds || []}> | |||||
<Form.Item label='做法' name={'practiceIds'} rules={[{ required: true }]} initialValue={props.values.practiceIds || []}> | |||||
<Select style={{ width: '300px' }} | <Select style={{ width: '300px' }} | ||||
mode="multiple" | mode="multiple" | ||||
> | > | ||||
@@ -24,7 +24,7 @@ const createtypeRelevanceForm = (props) => { | |||||
<Form.Item name="id" hidden={true}> | <Form.Item name="id" hidden={true}> | ||||
<Input /> | <Input /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label='商品类别' name={'goodsSmallType'} initialValue={props.values.goodsSmallType}> | |||||
<Form.Item label='商品类别' name={'goodsSmallType'} rules={[{ required: true }]} initialValue={props.values.goodsSmallType}> | |||||
<Select style={{ width: '300px' }} | <Select style={{ width: '300px' }} | ||||
> | > | ||||
{ | { | ||||
@@ -39,7 +39,7 @@ const createtypeRelevanceForm = (props) => { | |||||
} | } | ||||
</Select> | </Select> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label='做法类别' name={'makeTypeId'} initialValues={props.values.practiceTypeId}> | |||||
<Form.Item label='做法类别' name={'makeTypeId'} rules={[{ required: true }]} initialValues={props.values.practiceTypeId}> | |||||
<Select style={{ width: '300px' }} | <Select style={{ width: '300px' }} | ||||
> | > | ||||
{ | { | ||||
@@ -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, Select, Popconfirm, 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'; | ||||
@@ -19,7 +19,8 @@ import { | |||||
GetAllType, | GetAllType, | ||||
GetAllSmallType, | GetAllSmallType, | ||||
GetAllGoods, | GetAllGoods, | ||||
GetAllPractice | |||||
GetAllPractice, | |||||
DeleteGoodsPractice | |||||
} from './service'; | } from './service'; | ||||
import CreateRelevanceForm from './components/createRelevanceForm'; | import CreateRelevanceForm from './components/createRelevanceForm'; | ||||
@@ -80,7 +81,25 @@ const PageIndex = (props) => { | |||||
} | } | ||||
const handleRemove = async (id) => { | |||||
const hide = message.loading('正在删除'); | |||||
if (!id) return true; | |||||
try { | |||||
await DeleteGoodsPractice({ id: id }).then((r) => { | |||||
hide(); | |||||
if (r.data) { | |||||
message.success('删除成功,即将刷新'); | |||||
} else { | |||||
message.error('删除失败,请重试'); | |||||
} | |||||
}); | |||||
return true; | |||||
} catch (error) { | |||||
hide(); | |||||
message.error('删除失败,请重试'); | |||||
return false; | |||||
} | |||||
}; | |||||
/** | /** | ||||
* 更新节点 | * 更新节点 | ||||
* | * | ||||
@@ -184,16 +203,20 @@ const PageIndex = (props) => { | |||||
{' '} | {' '} | ||||
修改 | 修改 | ||||
</a>, | </a>, | ||||
<a | |||||
<Popconfirm | |||||
type="primary" | |||||
key="primary" | key="primary" | ||||
onClick={() => { | |||||
record.status = record.status == 0 ? 1 : 0; | |||||
editPracticeRecord(record); | |||||
title="确认删除吗?" | |||||
okText="是" | |||||
cancelText="否" | |||||
onConfirm={() => { | |||||
handleRemove(record.id); | |||||
actionRef.current?.reloadAndRest(); | |||||
}} | }} | ||||
onCancel={() => { }} | |||||
> | > | ||||
{' '} | |||||
{record.status == 0 ? '停用' : '启用'} | |||||
</a>, | |||||
<a href="#">删除</a> | |||||
</Popconfirm>, | |||||
], | ], | ||||
}, | }, | ||||
@@ -229,16 +252,20 @@ const PageIndex = (props) => { | |||||
{' '} | {' '} | ||||
修改 | 修改 | ||||
</a>, | </a>, | ||||
<a | |||||
<Popconfirm | |||||
type="primary" | |||||
key="primary" | key="primary" | ||||
onClick={() => { | |||||
record.status = record.status == 0 ? 1 : 0; | |||||
editPracticeRecord(record); | |||||
title="确认删除吗?" | |||||
okText="是" | |||||
cancelText="否" | |||||
onConfirm={() => { | |||||
handleRemove(record.id); | |||||
actionRef.current?.reloadAndRest(); | |||||
}} | }} | ||||
onCancel={() => { }} | |||||
> | > | ||||
{' '} | |||||
{record.status == 0 ? '停用' : '启用'} | |||||
</a>, | |||||
<a href="#">删除</a> | |||||
</Popconfirm>, | |||||
], | ], | ||||
}, | }, | ||||
@@ -249,7 +276,7 @@ const PageIndex = (props) => { | |||||
<CreateRelevanceForm | <CreateRelevanceForm | ||||
onFinish={async (value) => { | onFinish={async (value) => { | ||||
value.relevanceType=2; | |||||
value.relevanceType = 2; | |||||
var success = false; | var success = false; | ||||
if (value.id) { | if (value.id) { | ||||
success = handleRelevanceUpdate(value); | success = handleRelevanceUpdate(value); | ||||
@@ -276,7 +303,7 @@ const PageIndex = (props) => { | |||||
</CreateRelevanceForm> | </CreateRelevanceForm> | ||||
<CreatetypeRelevanceForm | <CreatetypeRelevanceForm | ||||
onFinish={async (value) => { | onFinish={async (value) => { | ||||
value.relevanceType=1; | |||||
value.relevanceType = 1; | |||||
var success = false; | var success = false; | ||||
if (value.id) { | if (value.id) { | ||||
success = handletypeRelevanceUpdate(value); | success = handletypeRelevanceUpdate(value); | ||||
@@ -134,4 +134,12 @@ export async function GetAllPractice(data) { | |||||
method: 'POST', | method: 'POST', | ||||
data: data, | data: data, | ||||
}); | }); | ||||
} | |||||
} | |||||
export async function DeleteGoodsPractice(data) { | |||||
return request(`/kitchen//api/goodspracticerelevance/del`, { | |||||
method: 'POST', | |||||
data: data, | |||||
}); | |||||
} | |||||
@@ -37,7 +37,7 @@ const CreateForm = (props) => { | |||||
<Form.Item name="settlementCycles" label="结算周期" rules={[{ required: true}]}> | <Form.Item name="settlementCycles" label="结算周期" rules={[{ required: true}]}> | ||||
<InputNumber step={1} min={1} max={100} precision={0} /> | <InputNumber step={1} min={1} max={100} precision={0} /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="email" label="电子邮件" rules={[{ required: true, max: 50,pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, | |||||
<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: '邮箱格式不正确', }]}> | message: '邮箱格式不正确', }]}> | ||||
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | <Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | ||||
</Form.Item> | </Form.Item> | ||||
@@ -13,7 +13,7 @@ const MenuForm = (props) => { | |||||
if(!t.isParentMenu){ | if(!t.isParentMenu){ | ||||
arr.push(t.id); | arr.push(t.id); | ||||
} | } | ||||
}); | }); | ||||
setCheckedKeys(arr) | setCheckedKeys(arr) | ||||
var ret = await api.GetMenu('ALL'); | var ret = await api.GetMenu('ALL'); | ||||
@@ -24,7 +24,7 @@ const MenuForm = (props) => { | |||||
const lbl = () => { | const lbl = () => { | ||||
var arr = []; | var arr = []; | ||||
Enumerable.from(props.values).forEach(t => { | Enumerable.from(props.values).forEach(t => { | ||||
arr.push(<Tag style={{ width: 68, margin: 'Center' }} color="processing">{t.name}</Tag>); | |||||
arr.push(<Tag style={{ width: 100, margin: 'Center' }} color="processing">{t.name}</Tag>); | |||||
}); | }); | ||||
return arr; | return arr; | ||||
} | } | ||||
@@ -38,14 +38,14 @@ const MenuForm = (props) => { | |||||
onCancel={() => props.onCancel()} | onCancel={() => props.onCancel()} | ||||
maskClosable={false}> | maskClosable={false}> | ||||
<Row> | <Row> | ||||
<Col span={12}> | |||||
<Col span={8}> | |||||
<Tree treeData={load} | <Tree treeData={load} | ||||
onCheck={(keys, e) => { setCheckedKeys(keys) }} | onCheck={(keys, e) => { setCheckedKeys(keys) }} | ||||
defaultExpandAll={true} | defaultExpandAll={true} | ||||
checkedKeys={checkedKeys} | checkedKeys={checkedKeys} | ||||
checkable /> | checkable /> | ||||
</Col> | </Col> | ||||
<Col span={12}> | |||||
<Col span={16}> | |||||
<div>已选菜单</div> | <div>已选菜单</div> | ||||
{props.values == undefined ? '' : ( | {props.values == undefined ? '' : ( | ||||
lbl() | lbl() | ||||
@@ -69,7 +69,7 @@ const handleRemove = async (selectedRows) => { | |||||
if (!selectedRows) return true; | if (!selectedRows) return true; | ||||
try { | try { | ||||
await api.removeCompany(selectedRows.map((row) => row.id)).then((r) => { | await api.removeCompany(selectedRows.map((row) => row.id)).then((r) => { | ||||
if (r.data) { | |||||
if (r) { | |||||
message.success('删除成功,即将刷新'); | message.success('删除成功,即将刷新'); | ||||
return true; | return true; | ||||
} else { | } else { | ||||
@@ -330,7 +330,7 @@ const companyManage = () => { | |||||
</div> | </div> | ||||
} | } | ||||
> | > | ||||
<Button | |||||
{/* <Button | |||||
type="primary" | type="primary" | ||||
onClick={async () => { | onClick={async () => { | ||||
await handleRemove(selectedRowsState); | await handleRemove(selectedRowsState); | ||||
@@ -339,7 +339,22 @@ const companyManage = () => { | |||||
}} | }} | ||||
> | > | ||||
批量删除 | 批量删除 | ||||
</Button> | |||||
</Button> */} | |||||
<Popconfirm | |||||
type="primary" | |||||
key="primary" | |||||
title="确认删除吗?" | |||||
okText="是" | |||||
cancelText="否" | |||||
onConfirm={() => { | |||||
handleRemove(selectedRowsState); | |||||
setSelectedRows([]); | |||||
actionRef.current?.reloadAndRest?.(); | |||||
}} | |||||
onCancel={() => { }} | |||||
> | |||||
<a href="#">批量删除</a> | |||||
</Popconfirm> | |||||
</FooterToolbar> | </FooterToolbar> | ||||
)} | )} | ||||
<CreateForm | <CreateForm | ||||
@@ -13,6 +13,7 @@ const CreateForm = (props) => { | |||||
onCancel={() => { | onCancel={() => { | ||||
props.onCancel(); | props.onCancel(); | ||||
}} | }} | ||||
keyboard={false} | |||||
destroyOnClose | destroyOnClose | ||||
> | > | ||||
<Form | <Form | ||||
@@ -61,21 +62,22 @@ const CreateForm = (props) => { | |||||
<Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true,max:100 }]}> | <Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true,max:100 }]}> | ||||
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" /> | <Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" /> | ||||
</Form.Item> | </Form.Item> | ||||
{/* ,pattern: /^(1[1-2][0-9]\.\d{6,12},((3[0-6])|(2[8-9]))\.\d{6,12};){2,}1[1-2][0-9]\.\d{6,12},((3[0-6])|(2[8-9]))\.\d{6,12}$/, | |||||
{/* ,pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/, | |||||
message: '经纬度格式不对'} */} | message: '经纬度格式不对'} */} | ||||
<Form.Item label={'店铺地址坐标'} name="store_Loc" rules={[{ required: true,max:100}]}> | |||||
<Form.Item label={'店铺坐标'} name="store_Loc" rules={[{ required: true,max:100,pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/, | |||||
message: '经纬度格式不对'} ]}> | |||||
<Input placeholder="104.070734,30.575041" /> | <Input placeholder="104.070734,30.575041" /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="tel" label="电话" rules={[{ max: 20 }]}> | <Form.Item name="tel" label="电话" rules={[{ max: 20 }]}> | ||||
<Input placeholder="请输入联系电话" /> | <Input placeholder="请输入联系电话" /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="sort" label="排序"> | <Form.Item name="sort" label="排序"> | ||||
<InputNumber min={1} step={1} /> | |||||
</Form.Item>, | |||||
<InputNumber min={1} step={1} precision={0} /> | |||||
</Form.Item> | |||||
<Form.Item name="remark" label="备注"> | <Form.Item name="remark" label="备注"> | ||||
<TextArea rows={4} rules={[{ max: 500 }]}/> | <TextArea rows={4} rules={[{ max: 500 }]}/> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item>、【 | |||||
<Form.Item> | |||||
<Button type="primary" htmlType="submit"> | <Button type="primary" htmlType="submit"> | ||||
保存 | 保存 | ||||
</Button> | </Button> | ||||
@@ -48,7 +48,7 @@ const handleUpdate = async (fields) => { | |||||
return false; | return false; | ||||
} | } | ||||
hide(); | hide(); | ||||
message.success('添加成功'); | |||||
message.success('修改成功'); | |||||
return true; | return true; | ||||
} catch (error) { | } catch (error) { | ||||
hide(); | hide(); | ||||