@@ -95,6 +95,13 @@ export default [ | |||
component: './sys/dictionary/dicttype', | |||
access: 'k6', | |||
}, | |||
{ | |||
name: '设备系列配置', | |||
icon: 'smile', | |||
path: '/sys/deviceTypeConfig', | |||
component: './sys/deviceTypeConfig', | |||
access: 'k6', | |||
}, | |||
{ | |||
name: '系统配置', | |||
icon: 'smile', | |||
@@ -211,6 +211,14 @@ export async function getInitialState() { | |||
component: './sys/dictionary/dictdata', | |||
access: 'k6', | |||
}, | |||
{ | |||
code: 'deviceTypeConfig', | |||
name: '设备系列配置', | |||
icon: 'smile', | |||
path: '/sys/deviceTypeConfig', | |||
component: './sys/deviceTypeConfig', | |||
access: 'k6', | |||
}, | |||
{ | |||
code: 'dicttype', | |||
name: '字典类型', | |||
@@ -763,7 +771,7 @@ export async function getInitialState() { | |||
var tempMenu = await queryMenuData(); | |||
//创建菜单 | |||
//await syncMenus(tempMenu); | |||
if (isDev) { | |||
if (!isDev) { | |||
var data = await dymicMenus(currentUser.data.id); | |||
tempMenu = data.data; | |||
} | |||
@@ -59,14 +59,6 @@ const Manage = () => { | |||
title: '订单号', | |||
dataIndex: 'orderId', | |||
}, | |||
{ | |||
title: '手机号', | |||
dataIndex: 'customerTel', | |||
}, | |||
{ | |||
title: '会员名称', | |||
dataIndex: 'customerName', | |||
}, | |||
{ | |||
title: '订单金额', | |||
dataIndex: 'orderRealMoney', | |||
@@ -0,0 +1,73 @@ | |||
import React, { useState, useEffect } from 'react'; | |||
import { InputNumber, Modal, Form, Input, Button, Select, DatePicker } from 'antd'; | |||
const MakeCreateForm = (props) => { | |||
const { Option, OptGroup } = Select; | |||
return ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<Form | |||
layout="Horizontal" | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="deviceSeries" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item | |||
name="makeName" | |||
label="做法名称" | |||
rules={[{ required: true }]} | |||
defaultValue="0" | |||
> | |||
<Input placeholder="输入做法名称" /> | |||
</Form.Item> | |||
<Form.Item | |||
name="makeKey" | |||
label="做法编码" | |||
rules={[{ required: true }]} | |||
defaultValue="0" | |||
> | |||
<Input placeholder="输入做法编码(只能用数字)" /> | |||
</Form.Item> | |||
<Form.Item label={'是否生效'} name="status" rules={[{ required: true }]}> | |||
<Select placeholder="请选择状态"> | |||
<OptGroup> | |||
<Select.Option value={0}>是</Select.Option> | |||
<Select.Option value={1}>否</Select.Option> | |||
</OptGroup> | |||
</Select> | |||
</Form.Item> | |||
<Form.Item | |||
name="effectiveDate" | |||
label="生效时间" | |||
rules={[{ required: true }]} | |||
> | |||
<DatePicker placeholder="输入生效时间" /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default MakeCreateForm; |
@@ -0,0 +1,234 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Popconfirm, Modal, Button, message, Input, Drawer } from 'antd'; | |||
import React, { useEffect, useState, useRef } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import ProDescriptions from '@ant-design/pro-descriptions'; | |||
import MakeCreateForm from './components/MakeCreateForm'; | |||
import { Add, Update, Delete, GetPage} from './services'; | |||
const key = 'message'; | |||
const MakeManager = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
//添加 | |||
const handleAdd = async (fields) => { | |||
try { | |||
fields.DeviceId = props.values.key; | |||
message.loading('正在添加', key); | |||
await Add(JSON.stringify(fields)).then((r) => { | |||
message.destroy(key); | |||
if (r.data) { | |||
message.success('添加成功'); | |||
actionRef.current.reload(); | |||
return true; | |||
} else { | |||
message.error('添加失败' + r.errors); | |||
actionRef.current.reload(); | |||
return false; | |||
} | |||
}); | |||
} catch (error) { | |||
message.error('添加失败请重试!'); | |||
actionRef.current.reload(); | |||
return false; | |||
} | |||
}; | |||
//删除 | |||
const handleRemoveSingle = async (value) => { | |||
try { | |||
await Delete(value).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功,即将刷新'); | |||
//刷新数据 | |||
actionRef.current.reload(); | |||
} else { | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}; | |||
//修改 | |||
const handleUpdate = async (fields) => { | |||
try { | |||
message.loading('正在修改', key); | |||
message.destroy(key); | |||
fields.DeviceId = props.values.key; | |||
await Update(JSON.stringify(fields)).then((r) => { | |||
message.destroy(key); | |||
if (r.data) { | |||
message.success('修改成功'); | |||
return true; | |||
} else { | |||
message.error('修改失败' + r.errors); | |||
return false; | |||
} | |||
}); | |||
} catch (error) { | |||
message.error('修改失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
tip: '规则名称是唯一的 key', | |||
}, | |||
{ | |||
title: '做法名称', | |||
dataIndex: 'makeName', | |||
}, | |||
{ | |||
title: '设备系列名称', | |||
dataIndex: 'deviceSeries', | |||
}, | |||
{ | |||
title: '做法编码', | |||
dataIndex: 'makeKey', | |||
}, | |||
{ | |||
title: '是否生效', | |||
dataIndex: 'status', | |||
valueEnum: { | |||
0: { | |||
text: '生效', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '未生效', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '生效时间', | |||
dataIndex: 'effectiveDate', | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
// <a | |||
// onClick={() => { | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
// }} | |||
// > | |||
// {' '} | |||
// 更新 | |||
// </a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
handleRemoveSingle(record.id); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
]; | |||
return ( | |||
<Modal | |||
width={1200} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
destroyOnClose | |||
title={(props.values == undefined ? '' : props.values.value) + '库存位置设置'} | |||
search={false} | |||
visible={props.createModalVisible} | |||
footer={false} | |||
onCancel={() => props.onCancel()} | |||
maskClosable={false} | |||
> | |||
<PageContainer | |||
header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}} | |||
> | |||
<ProTable | |||
headerTitle="" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={false} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 添加设备做法 | |||
</Button> | |||
]} | |||
request={async (params) => { | |||
var data = []; | |||
var total = 0; | |||
await GetPage(props.values.code).then((r) => { | |||
data = r.data; | |||
total = 0; | |||
}); | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
}, | |||
}} | |||
/> | |||
<MakeCreateForm | |||
onFinish={async (value) => { | |||
var success = false; | |||
value.deviceSeries = props.values.code; | |||
if (value.id) { | |||
success = handleUpdate(value); | |||
} else { | |||
success = handleAdd(value); | |||
} | |||
if (success) { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
actionRef.current.reload(); | |||
} | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
}} | |||
createModalVisible={createModalVisible} | |||
values={currentRow || {}} | |||
/> | |||
</PageContainer> | |||
</Modal> | |||
); | |||
}; | |||
export default MakeManager; |
@@ -0,0 +1,24 @@ | |||
import { request } from 'umi'; | |||
export async function GetPage(data) { | |||
return request(`/kitchen/api/deviceconfig/getmake?Code=${data}`, { | |||
method: 'GET' | |||
}); | |||
} | |||
export async function Add(data) { | |||
return request(`/kitchen/api/deviceconfig/addmake`, { | |||
method: 'post', | |||
data: data, | |||
}); | |||
} | |||
export async function Update(data) { | |||
return request(`/kitchen/api/deviceconfig/updatemake`, { | |||
method: 'post', | |||
data: data, | |||
}); | |||
} | |||
export async function Delete(data) { | |||
return request(`/kitchen/api/deviceconfig/deletemake?Ids=${data}`, { | |||
method: 'post', | |||
}); | |||
} | |||
@@ -0,0 +1,46 @@ | |||
import React, { useState, useEffect } from 'react'; | |||
import { InputNumber, Modal, Form, Input, Button, Select } from 'antd'; | |||
const CreateForm = (props) => { | |||
const { Option, OptGroup } = Select; | |||
return ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<Form | |||
layout="vertical" | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item | |||
name="loc" | |||
label="库存位置" | |||
rules={[{ required: true }]} | |||
defaultValue="0" | |||
> | |||
<Input placeholder="输入库存位置编码" /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default CreateForm; |
@@ -0,0 +1,193 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Popconfirm, Modal, Button, message, Input, Drawer } from 'antd'; | |||
import React, { useEffect, useState, useRef } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import ProDescriptions from '@ant-design/pro-descriptions'; | |||
import CreateForm from './components/CreateForm'; | |||
import { Add, Update, Delete, GetPage } from './services'; | |||
const key = 'message'; | |||
const StockLocManager = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
//添加 | |||
const handleAdd = async (fields) => { | |||
try { | |||
message.loading('正在添加', key); | |||
await Add(JSON.stringify(fields)).then((r) => { | |||
message.destroy(key); | |||
if (r.data) { | |||
message.success('添加成功'); | |||
actionRef.current.reload(); | |||
return true; | |||
} else { | |||
message.error('添加失败' + r.errors); | |||
actionRef.current.reload(); | |||
return false; | |||
} | |||
}); | |||
} catch (error) { | |||
message.error('添加失败请重试!'); | |||
actionRef.current.reload(); | |||
return false; | |||
} | |||
}; | |||
//删除 | |||
const handleRemoveSingle = async (value) => { | |||
try { | |||
await Delete(value).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功,即将刷新'); | |||
//刷新数据 | |||
actionRef.current.reload(); | |||
} else { | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
message.error('删除失败,请重试'); | |||
actionRef.current.reload(); | |||
} | |||
}; | |||
//修改 | |||
const handleUpdate = async (fields) => { | |||
try { | |||
message.loading('正在修改', key); | |||
message.destroy(key); | |||
fields.DeviceId = props.values.key; | |||
await Update(JSON.stringify(fields)).then((r) => { | |||
message.destroy(key); | |||
if (r.data) { | |||
message.success('修改成功'); | |||
return true; | |||
} else { | |||
message.error('修改失败' + r.errors); | |||
return false; | |||
} | |||
}); | |||
} catch (error) { | |||
message.error('修改失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
tip: '规则名称是唯一的 key', | |||
}, | |||
{ | |||
title: '库位值', | |||
dataIndex: 'loc', | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
handleRemoveSingle(record); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
]; | |||
return ( | |||
<Modal | |||
width={1200} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
destroyOnClose | |||
title={(props.values == undefined ? '' : props.values.value) + '库存位置设置'} | |||
search={false} | |||
visible={props.createModalVisible} | |||
footer={false} | |||
onCancel={() => props.onCancel()} | |||
maskClosable={false} | |||
> | |||
<PageContainer | |||
header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}} | |||
> | |||
<ProTable | |||
headerTitle="" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={false} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 添加设备库存位置 | |||
</Button> | |||
]} | |||
request={async (params) => { | |||
var data = []; | |||
var total = 0; | |||
await GetPage(props.values.id).then((r) => { | |||
data = r.data; | |||
total = 0; | |||
}); | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
}, | |||
}} | |||
/> | |||
<CreateForm | |||
onFinish={async (value) => { | |||
value.id = props.values.id; | |||
var success = false; | |||
success = handleAdd(value); | |||
if (success) { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
actionRef.current.reload(); | |||
} | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
}} | |||
createModalVisible={createModalVisible} | |||
values={currentRow || {}} | |||
/> | |||
</PageContainer> | |||
</Modal> | |||
); | |||
}; | |||
export default StockLocManager; |
@@ -0,0 +1,18 @@ | |||
import { request } from 'umi'; | |||
export async function GetPage(data) { | |||
return request(`/kitchen/api/deviceconfig/getloc?Id=${data}`, { | |||
method: 'GET', | |||
}); | |||
} | |||
export async function Add(data) { | |||
return request(`/kitchen/api/deviceconfig/addloc`, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
export async function Delete(data) { | |||
return request(`/kitchen/api/deviceconfig/deleteloc`, { | |||
method: 'post', | |||
data: data, | |||
}); | |||
} |
@@ -0,0 +1,60 @@ | |||
import React from 'react'; | |||
import { Input, Modal, Form, Select, Button } from 'antd'; | |||
const CreateForm = (props) => { | |||
const { Option, OptGroup } = Select; | |||
return ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
maskClosable={false} | |||
> | |||
<Form | |||
layout="vertical" | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="value" label="设备系列名称" rules={[{ required: true, max: 64 }]}> | |||
<Input placeholder="请输入设备系列名称" /> | |||
</Form.Item> | |||
<Form.Item name="code" label="设备系列编码" rules={[{ required: true, max: 64 }]}> | |||
<Input placeholder="请输入设备系列编码" /> | |||
</Form.Item> | |||
<Form.Item | |||
name="status" | |||
label="状态" | |||
defaultValue={props.values.status} | |||
rules={[{ required: true, message: '请选择状态' }]} | |||
> | |||
<Select placeholder="请选择状态"> | |||
<OptGroup> | |||
<Select.Option value="0">正常</Select.Option> | |||
<Select.Option value="1">停用</Select.Option> | |||
</OptGroup> | |||
</Select> | |||
</Form.Item> | |||
<Form.Item name="remark" label="备注" rules={[{ required: true, max: 200 }]}> | |||
<Input placeholder="请输入备注" /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default CreateForm; |
@@ -0,0 +1,340 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Drawer, Popconfirm } from 'antd'; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import ProDescriptions from '@ant-design/pro-descriptions'; | |||
import CreateForm from './components/CreateForm'; | |||
import api from './service'; | |||
import Make from '../deviceConfig/Make'; | |||
import StockLoc from '../deviceConfig/StockLoc'; | |||
/** | |||
* 添加节点 | |||
* | |||
* @param fields | |||
*/ | |||
const handleAdd = async (fields) => { | |||
try { | |||
await api.AddDictData(fields).then((r) => { | |||
if (r.data) { | |||
message.success('添加成功'); | |||
} else { | |||
message.error('添加失败请重试!'); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
message.error('添加失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
/** | |||
* 更新节点 | |||
* | |||
* @param fields | |||
*/ | |||
const handleUpdate = async (fields) => { | |||
try { | |||
await api.UpdateDictData(fields).then((r) => { | |||
if (r.data) { | |||
message.success('修改成功'); | |||
} else { | |||
message.error('修改失败请重试!'); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
message.error('修改失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
/** | |||
* 删除节点 | |||
* | |||
* @param selectedRows | |||
*/ | |||
const handleRemove = async (selectedRows) => { | |||
const hide = message.loading('正在删除数据字典'); | |||
if (!selectedRows) return true; | |||
try { | |||
await api.removeDictData(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.data) { | |||
hide(); | |||
message.success('删除成功,即将刷新'); | |||
return true; | |||
} else { | |||
hide(); | |||
message.error('删除失败,请重试'); | |||
} | |||
}); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||
message.error('删除失败,请重试'); | |||
return false; | |||
} | |||
}; | |||
const ConfigDataManage = () => { | |||
/** 新建窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(); | |||
const [stepFormValues, setStepFormValues] = useState({}); | |||
/**详情 */ | |||
const [showDetail, setShowDetail] = useState(); | |||
/*绑定数据 */ | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
/*选中*/ | |||
const [selectedRowsState, setSelectedRows] = useState(); | |||
const [createStockLocModalVisible, handleStockLocModalVisible] = useState(); | |||
const [createMakeModalVisible, handleMakeModalVisible] = useState(); | |||
/** 国际化配置 */ | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
tip: 'key', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
render: (dom, entity) => { | |||
return ( | |||
<a | |||
onClick={() => { | |||
setCurrentRow(entity); | |||
setShowDetail(true); | |||
}} | |||
> | |||
{dom} | |||
</a> | |||
); | |||
}, | |||
}, | |||
{ | |||
title: '设备系列名称', | |||
dataIndex: 'value', | |||
}, | |||
{ | |||
title: '设备系列编码', | |||
dataIndex: 'code', | |||
}, | |||
{ | |||
title: '备注', | |||
dataIndex: 'remark', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
valueEnum: { | |||
0: { | |||
text: '正常', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '停用', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
// <a | |||
// onClick={() => { | |||
// handleStockLocModalVisible(true); | |||
// setStepFormValues(record); | |||
// }} | |||
// > | |||
// {' '} | |||
// 库存位置配置 | |||
// </a>, | |||
<a | |||
onClick={() => { | |||
handleMakeModalVisible(true); | |||
setStepFormValues(record); | |||
}} | |||
> | |||
{' '} | |||
设置设备配方 | |||
</a>, | |||
<a | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setStepFormValues(record); | |||
}} | |||
> | |||
{' '} | |||
更新 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
api.removeDictData([record.id]).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功,即将刷新'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error('删除失败,请重试'); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
]; | |||
return ( | |||
<PageContainer> | |||
<ProTable | |||
headerTitle="设备系列配置列表" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 新建 | |||
</Button>, | |||
]} | |||
request={async (params) => { | |||
var dictData = []; | |||
var total = 0; | |||
params.TypeCode = 'DeviceClientType'; | |||
await api.GetDictData(params).then((r) => { | |||
dictData = r.data.data; | |||
total = r.data.total; | |||
}); | |||
return { | |||
data: dictData, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
}, | |||
}} | |||
/> | |||
{selectedRowsState?.length > 0 && ( | |||
<FooterToolbar | |||
extra={ | |||
<div> | |||
已选择{' '} | |||
<a | |||
style={{ | |||
fontWeight: 600, | |||
}} | |||
> | |||
{selectedRowsState.length} | |||
</a>{' '} | |||
项 | |||
</div> | |||
} | |||
> | |||
<Button | |||
type="primary" | |||
onClick={async () => { | |||
await handleRemove(selectedRowsState); | |||
setSelectedRows([]); | |||
actionRef.current?.reloadAndRest?.(); | |||
}} | |||
> | |||
批量删除 | |||
</Button> | |||
</FooterToolbar> | |||
)} | |||
<CreateForm | |||
onFinish={async (value) => { | |||
var success = false; | |||
value.TypeCode = 'DeviceClientType'; | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
handleModalVisible(false); | |||
setStepFormValues({}); | |||
setCurrentRow(undefined); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
} | |||
actionRef.current.reload(); | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
setStepFormValues({}); | |||
}} | |||
createModalVisible={createModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
<Drawer | |||
width={600} | |||
visible={showDetail} | |||
onClose={() => { | |||
setCurrentRow(undefined); | |||
setShowDetail(false); | |||
}} | |||
closable={false} | |||
> | |||
{currentRow?.name && ( | |||
<ProDescriptions | |||
column={2} | |||
title={currentRow?.name} | |||
request={async () => ({ | |||
data: currentRow || {}, | |||
})} | |||
params={{ | |||
id: currentRow?.name, | |||
}} | |||
columns={columns} | |||
/> | |||
)} | |||
</Drawer> | |||
<StockLoc | |||
onCancel={() => { | |||
handleStockLocModalVisible(false); | |||
}} | |||
createModalVisible={createStockLocModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
<Make | |||
onCancel={() => { | |||
handleMakeModalVisible(false); | |||
}} | |||
createModalVisible={createMakeModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default ConfigDataManage; |
@@ -0,0 +1,43 @@ | |||
import { request } from 'umi'; | |||
export default { | |||
/** 查询数据字典信息*/ | |||
GetDictData(data) { | |||
return request('/kitchen/api/dict-data/dict-data', { | |||
method: 'Post', | |||
data: data, | |||
}); | |||
}, | |||
/** 新增数据字典信息*/ | |||
AddDictData(data) { | |||
return request('/kitchen/api/deviceconfig/adddict', { | |||
method: 'POST', | |||
data: { | |||
...data, | |||
}, | |||
}); | |||
}, | |||
/** 修改数据字典信息*/ | |||
UpdateDictData(data) { | |||
return request('/kitchen/api/deviceconfig/updaedict', { | |||
method: 'POST', | |||
data: { | |||
...data, | |||
}, | |||
}); | |||
}, | |||
/** 删除数据字典信息*/ | |||
removeDictData(data) { | |||
return request(`/kitchen/api/dict-data`, { | |||
method: 'DELETE', | |||
data: data, | |||
}); | |||
}, | |||
/** 获取字典类型信息*/ | |||
getDictTypeList() { | |||
return request(`/kitchen/api/select/dicttype`, { | |||
method: 'Get', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
}, | |||
}; |