@@ -239,7 +239,7 @@ const GoodsTypeManage = () => { | |||
}} | |||
> | |||
{' '} | |||
{record.store_Status == 0 ? '停用' : '正常'} | |||
{record.store_Status == 0 ? '正常' :'停用'} | |||
</a>, | |||
], | |||
@@ -9,18 +9,18 @@ const CreateForm = (props) => { | |||
//初始化数据 | |||
useEffect(() => { | |||
const initBatching = () => { | |||
if(props.isbom){ | |||
GetProductListByBom({ DeviceId: props.DeviceId,BomIds:props.bomIds }).then((data) => { | |||
setBatchingList(data.data); | |||
}); | |||
}else { | |||
GetBatchingAsync({ DeviceId: props.DeviceId }).then((data) => { | |||
setBatchingList(data.data); | |||
}); | |||
} | |||
}; | |||
initBatching(); | |||
}, []); | |||
@@ -55,7 +55,7 @@ const CreateForm = (props) => { | |||
filterOption={(input, option) => | |||
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 | |||
}> | |||
{batchingList.map((item, index) => { | |||
{batchingList?.map((item, index) => { | |||
return ( | |||
<Select.Option index={index} value={item.id} key={item.id}> | |||
{item.name} | |||
@@ -24,7 +24,7 @@ const createRelevanceForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</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' }} | |||
> | |||
{ | |||
@@ -39,7 +39,7 @@ const createRelevanceForm = (props) => { | |||
} | |||
</Select> | |||
</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' }} | |||
mode="multiple" | |||
> | |||
@@ -24,7 +24,7 @@ const createtypeRelevanceForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</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' }} | |||
> | |||
{ | |||
@@ -39,7 +39,7 @@ const createtypeRelevanceForm = (props) => { | |||
} | |||
</Select> | |||
</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' }} | |||
> | |||
{ | |||
@@ -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, 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 { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
@@ -19,7 +19,8 @@ import { | |||
GetAllType, | |||
GetAllSmallType, | |||
GetAllGoods, | |||
GetAllPractice | |||
GetAllPractice, | |||
DeleteGoodsPractice | |||
} from './service'; | |||
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 | |||
<Popconfirm | |||
type="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 | |||
<Popconfirm | |||
type="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 | |||
onFinish={async (value) => { | |||
value.relevanceType=2; | |||
value.relevanceType = 2; | |||
var success = false; | |||
if (value.id) { | |||
success = handleRelevanceUpdate(value); | |||
@@ -276,7 +303,7 @@ const PageIndex = (props) => { | |||
</CreateRelevanceForm> | |||
<CreatetypeRelevanceForm | |||
onFinish={async (value) => { | |||
value.relevanceType=1; | |||
value.relevanceType = 1; | |||
var success = false; | |||
if (value.id) { | |||
success = handletypeRelevanceUpdate(value); | |||
@@ -134,4 +134,12 @@ export async function GetAllPractice(data) { | |||
method: 'POST', | |||
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}]}> | |||
<InputNumber step={1} min={1} max={100} precision={0} /> | |||
</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: '邮箱格式不正确', }]}> | |||
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
@@ -13,7 +13,7 @@ const MenuForm = (props) => { | |||
if(!t.isParentMenu){ | |||
arr.push(t.id); | |||
} | |||
}); | |||
setCheckedKeys(arr) | |||
var ret = await api.GetMenu('ALL'); | |||
@@ -24,7 +24,7 @@ const MenuForm = (props) => { | |||
const lbl = () => { | |||
var arr = []; | |||
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; | |||
} | |||
@@ -38,14 +38,14 @@ const MenuForm = (props) => { | |||
onCancel={() => props.onCancel()} | |||
maskClosable={false}> | |||
<Row> | |||
<Col span={12}> | |||
<Col span={8}> | |||
<Tree treeData={load} | |||
onCheck={(keys, e) => { setCheckedKeys(keys) }} | |||
defaultExpandAll={true} | |||
checkedKeys={checkedKeys} | |||
checkable /> | |||
</Col> | |||
<Col span={12}> | |||
<Col span={16}> | |||
<div>已选菜单</div> | |||
{props.values == undefined ? '' : ( | |||
lbl() | |||
@@ -69,7 +69,7 @@ const handleRemove = async (selectedRows) => { | |||
if (!selectedRows) return true; | |||
try { | |||
await api.removeCompany(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.data) { | |||
if (r) { | |||
message.success('删除成功,即将刷新'); | |||
return true; | |||
} else { | |||
@@ -330,7 +330,7 @@ const companyManage = () => { | |||
</div> | |||
} | |||
> | |||
<Button | |||
{/* <Button | |||
type="primary" | |||
onClick={async () => { | |||
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> | |||
)} | |||
<CreateForm | |||
@@ -13,6 +13,7 @@ const CreateForm = (props) => { | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
keyboard={false} | |||
destroyOnClose | |||
> | |||
<Form | |||
@@ -61,21 +62,22 @@ const CreateForm = (props) => { | |||
<Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true,max:100 }]}> | |||
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" /> | |||
</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: '经纬度格式不对'} */} | |||
<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" /> | |||
</Form.Item> | |||
<Form.Item name="tel" label="电话" rules={[{ max: 20 }]}> | |||
<Input placeholder="请输入联系电话" /> | |||
</Form.Item> | |||
<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="备注"> | |||
<TextArea rows={4} rules={[{ max: 500 }]}/> | |||
</Form.Item> | |||
<Form.Item>、【 | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
@@ -48,7 +48,7 @@ const handleUpdate = async (fields) => { | |||
return false; | |||
} | |||
hide(); | |||
message.success('添加成功'); | |||
message.success('修改成功'); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||