@@ -118,7 +118,13 @@ export default [ | |||
component: './database/basic/batching', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '配方管理', | |||
icon: 'smile', | |||
path: '/database/bom', | |||
component: './database/bom', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品管理', | |||
icon: 'smile', | |||
@@ -17,7 +17,7 @@ const CreateForm = (props) => { | |||
> | |||
<Form | |||
layout="horizontal" | |||
labelCol={{ span: 4 }} | |||
labelCol={{ span: 6 }} | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -33,9 +33,11 @@ const CreateForm = (props) => { | |||
<Input placeholder="请输入管理员姓名" /> | |||
</Form.Item> | |||
<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 name="email" label="登陆账号(手机号)" | |||
tooltip="初始密码为:123456" | |||
rules={[{ required: true, max: 50,message:"请输入手机号"},{pattern: /^1[3-9][0-9]{9}$/, | |||
message: '手机号格式不正确', }]}> | |||
<Input placeholder="手机号是登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
{/* <Form.Item name="type" label="所属平台" rules={[{ required: true }]}> | |||
<Select placeholder='请选择所属平台' allowClear options={[ | |||
@@ -53,10 +55,10 @@ message: '邮箱格式不正确', }]}> | |||
}, | |||
]}/> | |||
</Form.Item> */} | |||
<Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入电话" /> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="remark" label="备注" rules={[{ max: 100 }]}> | |||
<Input placeholder="请输入备注" /> | |||
</Form.Item> | |||
@@ -338,6 +338,7 @@ const companyManage = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone=value.email; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -0,0 +1,53 @@ | |||
.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; | |||
} | |||
.clickRowStyl{background-color:antiquewhite} | |||
.ant-tree-switcher{ | |||
width: 1px; | |||
} | |||
.ant-tree-switcher-noop{ | |||
display: none; | |||
} | |||
.ant-tree .ant-tree-treenode{ | |||
height: 40px; | |||
} | |||
.ant-tree .ant-tree-node-content-wrapper{ | |||
line-height: 40px; | |||
height: 40px; | |||
} | |||
.ant-tree .ant-tree-treenode-draggable .ant-tree-draggable-icon{ | |||
line-height: 40px; | |||
} | |||
.ant-tree .ant-tree-treenode:focus{ | |||
background-color: #ffd8bf; | |||
} |
@@ -0,0 +1,135 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Drawer, Modal, Space, Tag,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 {bomPage} from './services'; | |||
const GoodsBomsManage = (props) => { | |||
const actionRef = useRef(); | |||
const [modalVisible, setModalVisible] = useState(false); | |||
useEffect(() => { | |||
}, []); | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
key: 'id', | |||
hideInTable: true, | |||
hideInSearch: true, | |||
tip: '规则名称是唯一的 key', | |||
}, | |||
{ | |||
title: '配方名称', | |||
key: 'name', | |||
dataIndex: 'name', | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
title: '配方类型', | |||
dataIndex: 'isMain', | |||
hideInForm: true, | |||
valueEnum: { | |||
false: { | |||
text: '辅料', | |||
status: 'Processing', | |||
}, | |||
true: { | |||
text: '主料', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
setUpdateBomVisible(true); | |||
setBomId(record.bomId) | |||
}} | |||
> | |||
更新 | |||
</a>, | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
setBomBatchingVisible(true); | |||
setBomId(record.bomId) | |||
}} | |||
> | |||
配方详情 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
} | |||
] | |||
return ( | |||
<PageContainer header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}}> | |||
<ProTable | |||
columns={columns} | |||
actionRef={actionRef} | |||
rowKey="id" | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
setModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 新建 | |||
</Button>, | |||
]} | |||
request={async (params) => { | |||
var total = 0; | |||
var data=[]; | |||
const res = await bomPage(params); | |||
if(res.statusCode==200){ | |||
data=res.data.data; | |||
total=res.data.total; | |||
} | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => setSelectedRows(selectedRows), | |||
}} | |||
/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default GoodsBomsManage; |
@@ -0,0 +1,11 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl } from '@/global_data'; | |||
export async function bomPage(data) { | |||
return request(getDataBaseUrl()+'/api/bom/BomPage', { | |||
method: 'POST', | |||
data:data, | |||
}); | |||
} | |||
@@ -148,7 +148,7 @@ const Advanced = (props) => { | |||
initGoodsUnit(); | |||
initGoodsType(); | |||
initGetbomType(); | |||
//intBatching();//默认原料 | |||
intBatching();//默认原料 | |||
//} | |||
}, [tabStatus]) | |||
@@ -192,11 +192,11 @@ const Advanced = (props) => { | |||
}) | |||
} | |||
// function intBatching(){ | |||
// getproductpage().then((r) => { | |||
// setMatedata(r.data); | |||
// }); | |||
// } | |||
function intBatching(){ | |||
getproductpage().then((r) => { | |||
setMatedata(r.data); | |||
}); | |||
} | |||
function initTypeList(){ | |||
initGetbomType(); | |||
} | |||
@@ -172,6 +172,9 @@ const handleAdd = async (fields) => { | |||
<a | |||
key="config" | |||
onClick={() => { | |||
if(record.pid=="0"){ | |||
record.pid=null; | |||
} | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
@@ -292,24 +295,24 @@ const handleAdd = async (fields) => { | |||
)} | |||
<CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -145,6 +145,9 @@ const TableList = () => { | |||
<a | |||
key="primary3" | |||
onClick={() => { | |||
if(record.pid==0){ | |||
record.pid=null; | |||
} | |||
setStepFormValues(record); | |||
handleModalVisible(true); | |||
}} | |||
@@ -310,24 +313,24 @@ const TableList = () => { | |||
)} | |||
{ | |||
createModalVisible && <CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -1,5 +1,5 @@ | |||
import React,{useEffect,useState} from 'react'; | |||
import { Modal, Form, Input, Button, Select } from 'antd'; | |||
import { Modal, Form, Input, Button, Select,TreeSelect } from 'antd'; | |||
import api from './service' | |||
const CreateForm = (props) => { | |||
@@ -32,7 +32,7 @@ const CreateForm = (props) => { | |||
preserve={false} | |||
layout="horizontal" | |||
labelCol={{ | |||
span: 4, | |||
span: 6, | |||
}} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -40,21 +40,33 @@ const CreateForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户" rules={[{ required: true, max: 255 }]}> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
{/* <Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> */} | |||
<TreeSelect | |||
style={{ width: '100%' }} | |||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |||
treeData={props.treeDatas} | |||
placeholder="请选择上级名称" | |||
treeDefaultExpandAll | |||
/> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户(手机号)" | |||
tooltip="初始密码为:123456" | |||
rules={[{ required: true, max: 255,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确'}]}> | |||
<Input placeholder="请输入登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
<Form.Item name="name" label="用户姓名" rules={[{ required: true, max: 255 }]}> | |||
<Input placeholder="请输入用户姓名" /> | |||
</Form.Item> | |||
<Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入用户手机" /> | |||
</Form.Item> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
<Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
@@ -1,6 +1,6 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Select,Popconfirm } from 'antd'; | |||
import React, { useState, useRef } from 'react'; | |||
import React, { useState, useRef,useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import CreateForm from './components/CreateForm' | |||
@@ -84,6 +84,7 @@ const userManager = () => { | |||
const [selectDatas, SetselectData] = useState(); | |||
const [sysUserId, SetSysUserId] = useState(); | |||
const [account, setaccount] = useState(); | |||
const [treeData, setTreeData] = useState(); | |||
const InitRole = (id) => { | |||
SetSysUserId(id); | |||
api.GetRoleDic().then(r => { | |||
@@ -221,6 +222,18 @@ const userManager = () => { | |||
render: (_, record) => Btn(record) | |||
}, | |||
]; | |||
useEffect(() => { | |||
initfranchiseeType(); | |||
}, []); | |||
function initfranchiseeType() { | |||
api.gettree2().then((r) => { | |||
debugger | |||
setTreeData(r.data); | |||
});api | |||
} | |||
return ( | |||
<PageContainer host header={{ | |||
title: '', | |||
@@ -298,6 +311,7 @@ const userManager = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone= value.account; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -314,6 +328,7 @@ const userManager = () => { | |||
handleModalVisible(false); | |||
setStepFormValues({}); | |||
}} | |||
treeDatas={treeData} | |||
modalVisible={createModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
@@ -85,6 +85,15 @@ function gettree(params) { | |||
}); | |||
} | |||
function gettree2(params) { | |||
return request(getDataBaseUrl()+'/api/organize/tree', { | |||
method: 'GET', | |||
data: { | |||
...params, | |||
}, | |||
}); | |||
} | |||
export default { | |||
Page, | |||
Enable, | |||
@@ -99,5 +108,6 @@ export default { | |||
AddUserRole, | |||
UpdateUserRole, | |||
SetDataRole, | |||
gettree | |||
gettree, | |||
gettree2 | |||
}; |