Commit 8a2f48fa authored by Maofei94's avatar Maofei94

fix: 小程序配置修复

parent 8a485575
......@@ -268,7 +268,7 @@ const ManagementDataBase = () => {
</Spin>
</Card>
<Card className={styles.mgTop20}>
<div className={styles.tableTitle}>数据库升级记录</div>
<div className={styles.tableTitle}>数据库版本记录</div>
<Table
className={styles.mgTop20}
columns={logColumns}
......@@ -280,7 +280,7 @@ const ManagementDataBase = () => {
</Card>
<Card className={styles.mgTop20}>
<div className={styles.tableTitle}>
表字段手动修复
手动修复
(字段长度不统一,请手动修改差异,数据可能会截断,请谨慎操作)
</div>
<Table
......
......@@ -28,8 +28,12 @@ const MobileConfigPage = props => {
console.log(res, 'res');
if (res.code === 0) {
const { data } = res;
if (data[0].children.length > 0) {
const title = data[0].children[0].text || '熊猫掌天下小程序';
let obj =
data[0].children.length > 0 &&
data[0].children.find(item => item.id.includes('miniapp'));
console.log(obj, 'obj');
if (data[0].children.length > 0 && obj) {
const title = obj.text || '';
setShowConfig(true);
setMiniTitle(title);
setPosition(['right']);
......
......@@ -91,7 +91,8 @@ const MiniMenu = props => {
if (res.code === 0) {
const { data } = res;
setLoading(false);
const result = data[0].children[0].children[1].children;
let obj = data[0].children.find(item => item.id.includes('miniapp'));
const result = obj.children[1].children;
setTreeData(result);
console.log(result);
......@@ -515,7 +516,10 @@ const MiniMenu = props => {
submitCallback={editSubmitCallback}
/>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="当前未选中菜单"
/>
)}
</div>
<div
......
import React, { useState, useEffect } from 'react';
import { Form, Input, notification, Select } from 'antd';
import SiteModal from '@/components/Modal/SiteModa';
import { addRole, getRoleGroup } from '@/services/userCenter/roleManage/api';
import {
addRole,
getRoleGroup,
getWebConfigTypes,
} from '@/services/userCenter/roleManage/api';
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
......@@ -9,40 +13,66 @@ const AddModal = props => {
const [formLayout, setFormLayout] = useState('horizontal');
const [groupList, setGroupList] = useState([]);
const [loading, setLoading] = useState(false);
const { confirmModal, itemObj } = props;
const { confirmModal, itemObj, siteList } = props;
const [typeList, setTypeList] = useState([]); // 应用类别
useEffect(() => {
itemObj.groupflag &&
form.setFieldsValue({
group: itemObj.groupflag,
});
itemObj &&
form.setFieldsValue({
subSystemValue: itemObj.visibleValue,
});
return () => {
form.resetFields();
};
}, [itemObj]);
useEffect(() => {
getWebConfigTypes({}).then(res => {
if (res.code === 0) {
const { data } = res;
const arr = Object.entries(data);
const list = [];
arr.map((item, index) => {
let obj = {
key: index,
value: item[0],
label: item[1],
};
list.push(obj);
});
setTypeList(list);
console.log(list);
}
console.log(res, 'resss');
});
}, [itemObj]);
const onSubmit = () => {
form
.validateFields()
.then(res => {
console.log(form.getFieldsValue());
setLoading(true);
addRole({
roleName: res.roleName,
description: res.description,
group: res.group,
subSystemValue: itemObj.subSystemValue || itemObj.visibleValue || '',
subSystemValue: res.subSystemValue || '',
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
if (res.success) {
let id = res.roleID;
form.resetFields();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
confirmModal();
confirmModal(id);
} else {
notification.error({
message: '提示',
......@@ -74,11 +104,14 @@ const AddModal = props => {
// 获取分组列表
const selectFocus = e => {
setGroupList([]);
console.log(form.getFieldsValue().subSystemValue);
getRoleGroup({
_version: 9999,
_dc: Date.now(),
subSystemValue: itemObj.subSystemValue || itemObj.visibleValue || '',
subSystemName: itemObj.subSystemValue || itemObj.visibleValue || '',
// subSystemValue: itemObj.subSystemValue || itemObj.visibleValue || '',
// subSystemName: itemObj.subSystemValue || itemObj.visibleValue || '',
subSystemValue: form.getFieldsValue().subSystemValue || '',
subSystemName: form.getFieldsValue().subSystemValue || '',
})
.then(res => {
if (res) {
......@@ -96,6 +129,29 @@ const AddModal = props => {
console.error(err);
});
};
const handleSelect = () => {
// getWebConfigTypes({}).then(res => {
// if (res.code === 0) {
// const { data } = res;
// const arr = Object.entries(data);
// const list = [];
// arr.map((item, index) => {
// let obj = {
// key: index,
// value: item[0],
// label: item[1],
// };
// list.push(obj);
// });
// setTypeList(list);
// console.log(list);
// }
// console.log(res, 'resss');
// });
};
const handleChange = e => {
console.log(e);
};
const onFinish = value => {};
return (
......@@ -116,6 +172,9 @@ const AddModal = props => {
layout={formLayout}
onFinish={onFinish}
labelCol={{ span: 4 }}
// initialValues={{
// subSystemValue: itemObj.subSystemValue || itemObj.visibleValue,
// }}
>
<Item
label="角色名称"
......@@ -129,8 +188,32 @@ const AddModal = props => {
>
<Input placeholder="请输入角色名称" />
</Item>
<Item label="角色类别" name="subSystemValue">
{itemObj.subSystemValue || itemObj.visibleValue}
<Item
label="角色类别"
name="subSystemValue"
rules={[
{
required: true,
message: '请选择角色类别',
},
]}
>
{/* {itemObj.subSystemValue || itemObj.visibleValue} */}
<Select
placeholder="请选择角色类别"
onFocus={() => {
handleSelect();
}}
onChange={e => {
handleChange(e);
}}
>
{typeList.map(item => (
<Option value={item.value} key={item.key}>
{item.label}
</Option>
))}
</Select>
</Item>
<Item label="角色分组" name="group">
<Select
......
......@@ -10,6 +10,7 @@ import {
Button,
Tooltip,
Space,
Empty,
} from 'antd';
import PageContainer from '@/components/BasePageContainer';
import {
......@@ -22,6 +23,7 @@ import {
setMenuToRole,
getRoleGroupList,
getMenuByRoleWithLevel,
getWebConfigTypes,
} from '@/services/userCenter/roleManage/api';
import ListCard, {
checkChildrenByCondition,
......@@ -62,6 +64,8 @@ const SiteManage = () => {
const [loading, setLoading] = useState(true);
const [btnLoading, setBtnLoading] = useState(false);
const [mulu, setMulu] = useState(true);
const [siteList, setSiteList] = useState([]);
const [disFlag, setDisFlag] = useState(false);
// 点击树的回调
const handleTreeSelect = (e, treenode) => {
......@@ -250,6 +254,7 @@ const SiteManage = () => {
};
// 确认回调
const confirmModal = e => {
console.log(e, 'e');
setModalVisible(false);
setFlag(flag + 1);
setItemObj('');
......@@ -317,8 +322,6 @@ const SiteManage = () => {
};
return (
<PageContainer>
{/* <Row gutter={0}>
<Col span={mulu ? 4 : 0}> */}
<div
className={classnames({
[styles.content]: true,
......@@ -356,6 +359,7 @@ const SiteManage = () => {
onCancel={() => setModalVisible(false)}
itemObj={itemObj}
confirmModal={confirmModal}
siteList={siteList}
/>
<DelModal
visible={delVisible}
......@@ -388,27 +392,6 @@ const SiteManage = () => {
)}
</div>
</Card>
{/* <div>
{mulu && (
<Tooltip title="隐藏角色栏" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)}
</div> */}
{/* </Col> */}
{/* <Col span={mulu ? 0 : 1}>
{mulu && (
<Tooltip title="隐藏角色栏" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)}
{!mulu && (
<Tooltip title="显示角色栏" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} />
</Tooltip>
)}
</Col> */}
{/* <Col span={mulu ? 20 : 23}> */}
<div
className={classnames({
[styles.boxR]: true,
......@@ -440,9 +423,19 @@ const SiteManage = () => {
onClick={() => {
handleAdd();
}}
disabled={itemObj.roleID}
>
新增角色
</Button>
<Button
type="primary"
onClick={() => {
groupEdit();
}}
disabled={!itemObj.groupflag}
>
编辑分组
</Button>
<Button
type="primary"
disabled={!itemObj.roleID}
......@@ -462,15 +455,6 @@ const SiteManage = () => {
>
删除角色
</Button>
<Button
type="primary"
onClick={() => {
groupEdit();
}}
disabled={!itemObj.groupflag}
>
编辑分组
</Button>
</Space>
</Col>
</Row>
......@@ -481,7 +465,7 @@ const SiteManage = () => {
[styles.cardBoxR]: true,
})}
>
{roleID && (
{roleID ? (
<ListCard
loading={loading}
checkList={valueList}
......@@ -491,11 +475,14 @@ const SiteManage = () => {
btnLoading={btnLoading}
hasData={hasData}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="当前未选中角色"
/>
)}
</Card>
</div>
{/* </Col>
</Row> */}
</div>
</PageContainer>
);
......
......@@ -57,3 +57,7 @@ export const setRoleGroupName = params =>
// 保存选择的功能
export const getMenuByRoleWithLevel = params =>
get('/Cityinterface/rest/services/OMS.svc/W4_GetMenuByRoleWithLevel', params);
// 获取角色类别
export const getWebConfigTypes = params =>
get(`${PUBLISH_SERVICE}/PlatformCenter/GetWebConfigTypes`, params);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment