Browse Source

菜单权限调整

master
zhaoy 11 months ago
parent
commit
2a5cf3ff62
7 changed files with 94 additions and 16 deletions
  1. +16
    -0
      src/pages/company/account/components/CreateForm.jsx
  2. +3
    -1
      src/pages/company/account/components/MenuForm.jsx
  3. +20
    -2
      src/pages/company/account/index.jsx
  4. +2
    -2
      src/pages/company/account/service.js
  5. +21
    -8
      src/pages/sys/menus/components/CreateForm.jsx
  6. +31
    -2
      src/pages/sys/menus/index.jsx
  7. +1
    -1
      src/pages/sys/menus/service.js

+ 16
- 0
src/pages/company/account/components/CreateForm.jsx View File

@@ -37,6 +37,22 @@ const CreateForm = (props) => {
message: '邮箱格式不正确', }]}> message: '邮箱格式不正确', }]}>
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> <Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} />
</Form.Item> </Form.Item>
<Form.Item name="type" label="所属平台" rules={[{ required: true }]}>
<Select placeholder='请选择所属平台' allowClear options={[
{
value: 0,
label: '团餐',
},
{
value: 1,
label: '门店',
},
{
value: 2,
label: '后厨',
},
]}/>
</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: '手机号格式不正确' }]}> message: '手机号格式不正确' }]}>
<Input placeholder="请输入电话" /> <Input placeholder="请输入电话" />


+ 3
- 1
src/pages/company/account/components/MenuForm.jsx View File

@@ -16,7 +16,9 @@ const MenuForm = (props) => {


}); });
setCheckedKeys(arr) setCheckedKeys(arr)
var ret = await api.GetMenu('ALL');
console.log("props.values",props.datas)
var parm={getType:'ALL',type:props.datas.type}
var ret = await api.GetMenu(parm);
var data = Enumerable.from(ret.data).toArray(); var data = Enumerable.from(ret.data).toArray();
setLoad(data); setLoad(data);
}, [props.modalVisible]) }, [props.modalVisible])


+ 20
- 2
src/pages/company/account/index.jsx View File

@@ -120,7 +120,8 @@ const companyManage = () => {
const [row, setRow] = useState(); const [row, setRow] = useState();


useEffect(() => { useEffect(() => {
api.GetMenu().then((r) => {
var parm={getType:'ALL',type:0}
api.GetMenu(parm).then((r) => {
if(r.data){ if(r.data){
setTreeData(r.data.data); setTreeData(r.data.data);
} }
@@ -164,7 +165,23 @@ const companyManage = () => {
dataIndex: 'email', dataIndex: 'email',
ellipsis: true, ellipsis: true,
}, },
{
title: '所属平台',
dataIndex: 'type',
valueType: 'select',
ellipsis:true,
valueEnum: {
0: {
text: '团餐',
},
1: {
text: '门店',
},
2: {
text: '后厨',
},
},
},
{ {
title: '电话', title: '电话',
dataIndex: 'phone', dataIndex: 'phone',
@@ -423,6 +440,7 @@ const companyManage = () => {
}} }}
modalVisible={updateMenuModalVisible} modalVisible={updateMenuModalVisible}
values={row || {}} values={row || {}}
datas={stepFormValues || {}}
/> />
) : null} ) : null}
<Drawer <Drawer


+ 2
- 2
src/pages/company/account/service.js View File

@@ -18,7 +18,7 @@ export default {
/** 修改企业信息*/ /** 修改企业信息*/
updateCompany(data) { updateCompany(data) {
return request(`/saasbase/api/company/update`, { return request(`/saasbase/api/company/update`, {
method: 'PUT',
method: 'POST',
data: data, data: data,
}); });
}, },
@@ -50,7 +50,7 @@ export default {
}, },
/** 查询功能菜单*/ /** 查询功能菜单*/
GetMenu(params) { GetMenu(params) {
return request(`​/saasbase/api/menu/menutrees?getType=${params}`,
return request(`​/saasbase/api/menu/menuparmytrees?getType=${params.getType}&&type=${params.type}`,
{ {
method: 'Get', method: 'Get',
}); });


+ 21
- 8
src/pages/sys/menus/components/CreateForm.jsx View File

@@ -111,15 +111,28 @@ const CreateForm = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
{RadioKey != 0 && props.values.type != 0 ? (
''
) : (
<Form.Item name="permission" label="权限标识">
<Select placeholder='请选择权限标识'>
{props.dictData}
</Select>
<Form.Item name="type" label="所属平台">
<Select placeholder='请选择所属平台' mode="multiple" allowClear options={[
{
value: '0',
label: '团餐',
},
{
value: '1',
label: '门店',
},
{
value: '2',
label: '后厨',
},
{
value: '3',
label: '公共',
},
]}/>
</Form.Item> </Form.Item>
)}
</Col> </Col>
</Row> </Row>
<Form.Item> <Form.Item>


+ 31
- 2
src/pages/sys/menus/index.jsx View File

@@ -28,7 +28,7 @@ const menuManager = () => {
*/ */


const handleAdd = async (fields) => { const handleAdd = async (fields) => {
fields.type=3
fields.type=fields.type.join(',');
await api.add({ ...fields }).then((r) => { await api.add({ ...fields }).then((r) => {
if (r.succeeded) { if (r.succeeded) {
message.success('添加成功'); message.success('添加成功');
@@ -47,6 +47,7 @@ const menuManager = () => {
*/ */


const handleUpdate = async (fields) => { const handleUpdate = async (fields) => {
fields.type=fields.type.join(',');
api.update(fields).then((r) => { api.update(fields).then((r) => {
if (r.succeeded) { if (r.succeeded) {
message.success('更新成功'); message.success('更新成功');
@@ -72,6 +73,7 @@ const handleUpdate = async (fields) => {
onClick={() => { onClick={() => {
InitTree(); InitTree();
handleModalVisible(true); handleModalVisible(true);
record.type=record.type.split(',');
setStepFormValues(record); setStepFormValues(record);
}} }}
> >
@@ -157,6 +159,32 @@ const handleUpdate = async (fields) => {
dataIndex: 'name', dataIndex: 'name',
ellipsis:true, ellipsis:true,
}, },
{
title: '所属平台',
dataIndex: 'typeName',
},
{
title: '所属平台',
dataIndex: 'type',
valueType: 'select',
ellipsis:true,
hideInTable: true,
valueEnum: {
0: {
text: '团餐',
},
1: {
text: '门店',
},
2: {
text: '后厨',
},
3: {
text: '公共',
},
},
},
{ {
title: '菜单编码', title: '菜单编码',
dataIndex: 'code', dataIndex: 'code',
@@ -232,7 +260,8 @@ const handleUpdate = async (fields) => {
let UserData = []; let UserData = [];
//添加机构组织 //添加机构组织
await api.menutreepage(value).then((r) => { await api.menutreepage(value).then((r) => {
UserData = r.data;
UserData=r.data
console.log("UserData",UserData)
}); });
return { return {
data: UserData, data: UserData,


+ 1
- 1
src/pages/sys/menus/service.js View File

@@ -36,7 +36,7 @@ function update(params) {
} }


function trees() { function trees() {
return request(`​/saasbase/api/menu/menutrees?getType=ALL`, {
return request(`​/saasbase/api/menu/menutreesall`, {
method: 'Get', method: 'Get',
}); });
} }


Loading…
Cancel
Save