Commit 5a33990a authored by cellee's avatar cellee

bug修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 19afdaad
......@@ -13,6 +13,7 @@ export default {
Result: null,
DataSave: null,
DataSaveDetail: null,
Permission: null,
},
reducers: {
......@@ -28,6 +29,9 @@ export default {
returnDataSaveDetail(state, { DataSaveDetail }) {
return { ...state, DataSaveDetail };
},
returnPermission(state, { Permission }) {
return { ...state, Permission };
},
},
effects: {
......@@ -81,7 +85,8 @@ export default {
break;
case 54: // 账号权限
{
console.log(resp.data);
let Permission = resp.data;
yield put({ type: 'returnPermission', Permission });
// let Result = resp.error_code;
// yield put({ type: 'returnResult', Result });
}
......
......@@ -27,24 +27,18 @@ import moment from 'moment';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, CommunityList } = props;
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, user } = props;
// 拉取数据的条件存储
const [term, setTerm] = useState({} as any);
// 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
// useEffect(() => {
// if (CommunityList != null) {
// setCommunityList(CommunityList);
// }
// }, [CommunityList]);
// 权限列表
const treeData = enUsFaci || zhCnFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
......@@ -55,6 +49,48 @@ const Account = (props: any) => {
const [form] = Form.useForm();
const formRef = useRef(null);
// 当前账户信息
useEffect(() => {
if (user != null) {
let treeDatas = treeData;
let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表
let arr: any = []; // 一级栏目权限
let erArr: any = []; // 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
for (let i of _a) {
for (let j in _p) {
if (_p[j].key == i) {
arr.push(_p[j].key);
_p[j].disabled = false;
}
// 二级权限
for (let k in _p[j].children) {
if (_p[j].children[k].key == i) {
erArr.push(_p[j].children[k].key);
_p[j].children[k].disableCheckbox = false;
}
}
}
}
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
}
}, [user]);
function funs(arr: any, val: any) {
console.log(val);
console.log(arr.key);
console.log('-------');
if (arr.key == val) {
return true;
} else {
return false;
}
}
// 保存提交
const onFinishContract = async (value: any) => {
// console.log(value);
......@@ -110,7 +146,7 @@ const Account = (props: any) => {
// 点击单个触发
const onCheck = (checkedKeys: any) => {
console.log('onCheck', checkedKeys);
// console.log('onCheck', checkedKeys);
setCheckedKeys(checkedKeys);
};
......@@ -250,6 +286,7 @@ const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false;
const { user } = state;
return {
Data,
DataSave,
......@@ -257,6 +294,7 @@ const AccountProps = (state: any) => {
Result,
loading,
CommunityList,
user, // 获取当前账户信息
};
};
......
import React, { useState, useEffect, useRef } from 'react';
import {
Form,
Input,
Button,
Pagination,
message,
Descriptions,
Checkbox,
Tree,
Radio,
} from 'antd';
import { Form, Input, Button, Spin, message, Descriptions, Checkbox, Tree, Radio } from 'antd';
import { connect, history } from 'umi';
import { SearchOutlined, ClearOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons';
import { getCookie } from '@/utils/method';
......@@ -27,7 +17,7 @@ import moment from 'moment';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, CommunityList } = props;
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, Permission, user } = props;
// 权限列表
const treeData = enUsFaci || zhCnFaci;
......@@ -69,8 +59,57 @@ const Account = (props: any) => {
// 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
}
let a = [];
for (var i = 0; i <= 66; i++) {
a.push(i);
}
console.log(a);
}, [DataSave]);
// 当前账户权限
useEffect(() => {
if (user != null) {
let treeDatas = treeData;
let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表
let arr: any = []; // 一级栏目权限
let erArr: any = []; // 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
for (let i of _a) {
for (let j in _p) {
if (_p[j].key == i) {
arr.push(_p[j].key);
_p[j].disabled = false;
}
// 二级权限
for (let k in _p[j].children) {
if (_p[j].children[k].key == i) {
erArr.push(_p[j].children[k].key);
_p[j].children[k].disableCheckbox = false;
}
}
}
}
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
}
}, [user]);
// 已选权限
useEffect(() => {
if (Permission != null) {
let newPer = eval('(' + Permission + ')');
let data: any = [];
for (let i in newPer) {
data[i] = newPer[i] + '';
}
setCheckedKeys(data);
}
}, [Permission]);
// 保存提交
const onFinishContract = async (value: any) => {
// console.log(value);
......@@ -159,7 +198,7 @@ const Account = (props: any) => {
// 选择小区名字并赋值
return (
<>
<Spin spinning={loading}>
<div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
......@@ -258,21 +297,22 @@ const Account = (props: any) => {
</div>
</Form>
</div>
</>
</Spin>
);
};
const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const { Data, DataSave, DataSaveDetail, Result, Permission } = state.Account;
const loading = state.loading.models.Account || false;
const { user } = state;
return {
Data,
DataSave,
DataSaveDetail,
Result,
loading,
CommunityList,
Permission,
user,
};
};
......
......@@ -12,7 +12,7 @@ import {
Spin,
Image,
} from 'antd';
import { PlusOutlined, LeftOutlined } from '@ant-design/icons';
import { PlusOutlined, LeftOutlined, LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, Loading } from 'umi';
import { RA } from '@/services/tos';
......@@ -61,6 +61,8 @@ const ContractContent = (props: any) => {
const [imgInfo, setimgInfo] = useState(null as any); //本地图片预览
const [previewVisible, setPreviewVisible] = useState(false); //本地图片预览弹窗
const [imgLoad, setimgLoad] = useState(false); //本地图片预览
useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if (DataSaveDetail == null) {
......@@ -166,13 +168,17 @@ const ContractContent = (props: any) => {
data: { imageType: 'tosContract', extends: comtyName },
fileList: fileList,
onChange: ({ file, fileList }: { file: any; fileList: any }) => {
if (file.status === 'uploading') {
setimgLoad(true);
}
if (file.status == 'done') {
message.success(file.name, 3);
message.success(file.name);
setFileList(fileList);
// 添加到表单
form.setFieldsValue({
upload: 'ok',
});
setimgLoad(false);
}
},
};
......@@ -184,7 +190,6 @@ const ContractContent = (props: any) => {
let a2 = moment(data[1]).subtract(1, 'month').format('YYYY-MM-DD');
setTipTime([a1, a2]);
}
console.log(dateStrings);
};
// 选择小区名字并赋值
......@@ -264,6 +269,27 @@ const ContractContent = (props: any) => {
return isJpgOrPng && isLt2M;
}
// 移除文件
const onRemove = async (file: any) => {
console.log('点击');
let fileListArr = fileList;
for (let i in fileListArr) {
if (fileListArr[i].uid == file.uid) {
fileListArr.splice(i, 1);
}
}
console.log(fileListArr);
setFileList([...fileListArr]);
};
// 文件上传按钮
const uploadButton = (
<div>
{imgLoad ? <LoadingOutlined /> : <PlusOutlined />}
<div style={{ marginTop: 5 }}>Upload</div>
</div>
);
return (
<>
<Spin spinning={loading}>
......@@ -378,8 +404,9 @@ const ContractContent = (props: any) => {
disabled={uploadUp}
beforeUpload={beforeUpload}
onPreview={onPreviews}
onRemove={onRemove}
>
{fileList.length >= 3 ? null : <PlusOutlined />}
{fileList.length >= 3 ? null : uploadButton}
</Upload>
</Form.Item>
</div>
......
export const zhCnFaci = [
{
title: 'Check all',
title: '全选',
key: '0',
children: [
{
title: 'life用户管理',
key: '1',
disabled: true,
children: [
{ title: '查看用户', key: '2' },
{ title: '编辑用户', key: '3' },
{ title: '添加用户', key: '4' },
{ title: '删除单元', key: '5' },
{ title: '查看家属/租户', key: '6' },
{ title: '注销家属/租户', key: '7' },
{ title: '查看用户', key: '2', disableCheckbox: true },
{ title: '编辑用户', key: '3', disableCheckbox: true },
{ title: '添加用户', key: '4', disableCheckbox: true },
{ title: '删除单元', key: '5', disableCheckbox: true },
{ title: '查看家属/租户', key: '6', disableCheckbox: true },
{ title: '注销家属/租户', key: '7', disableCheckbox: true },
],
},
{
title: '服务商管理',
key: '8',
disabled: true,
children: [
{ title: '查看服务商', key: '9' },
{ title: '编辑服务商', key: '10' },
{ title: '添加服务商', key: '11' },
{ title: '注销服务商', key: '12' },
{ title: '查看保安账号', key: '13' },
{ title: '注销保安账号', key: '14' },
{ title: '查看服务商', key: '9', disableCheckbox: true },
{ title: '编辑服务商', key: '10', disableCheckbox: true },
{ title: '添加服务商', key: '11', disableCheckbox: true },
{ title: '注销服务商', key: '12', disableCheckbox: true },
{ title: '查看保安账号', key: '13', disableCheckbox: true },
{ title: '注销保安账号', key: '14', disableCheckbox: true },
],
},
{
title: '物业费管理',
key: '15',
children: [{ title: '查看物业费', key: '16' }],
disabled: true,
children: [{ title: '查看物业费', key: '16', disableCheckbox: true }],
},
{
title: '物业服务-小区保养',
key: '17',
disabled: true,
children: [
{ title: '查看信息', key: '18' },
{ title: '回复信息', key: '19' },
{ title: '查看信息', key: '18', disableCheckbox: true },
{ title: '回复信息', key: '19', disableCheckbox: true },
],
},
{
title: '物业服务-业主投诉',
key: '20',
disabled: true,
children: [
{ title: '查看信息', key: '21' },
{ title: '回复信息', key: '22' },
{ title: '查看信息', key: '21', disableCheckbox: true },
{ title: '回复信息', key: '22', disableCheckbox: true },
],
},
{
title: '物业服务-建议反馈',
key: '23',
disabled: true,
children: [
{ title: '查看信息', key: '24' },
{ title: '回复信息', key: '25' },
{ title: '查看信息', key: '24', disableCheckbox: true },
{ title: '回复信息', key: '25', disableCheckbox: true },
],
},
{
title: '物业服务-装修申请',
key: '26',
disabled: true,
children: [
{ title: '查看信息', key: '27' },
{ title: '回复信息', key: '28' },
{ title: '查看信息', key: '27', disableCheckbox: true },
{ title: '回复信息', key: '28', disableCheckbox: true },
],
},
{
title: '物业服务-住户卡申请',
key: '29',
disabled: true,
children: [
{ title: '查看信息', key: '30' },
{ title: '回复信息', key: '31' },
{ title: '申请住户卡', key: '32' },
{ title: '查看信息', key: '30', disableCheckbox: true },
{ title: '回复信息', key: '31', disableCheckbox: true },
{ title: '申请住户卡', key: '32', disableCheckbox: true },
],
},
{
title: '物业服务-在线报事',
key: '33',
disabled: true,
children: [
{ title: '查看信息', key: '34' },
{ title: '回复信息', key: '35' },
{ title: '查看信息', key: '34', disableCheckbox: true },
{ title: '回复信息', key: '35', disableCheckbox: true },
],
},
{
title: '物业服务-保质期服务',
key: '36',
disabled: true,
children: [
{ title: '查看信息', key: '37' },
{ title: '回复信息', key: '38' },
{ title: '查看信息', key: '37', disableCheckbox: true },
{ title: '回复信息', key: '38', disableCheckbox: true },
],
},
{
title: '合同管理',
key: '39',
disabled: true,
children: [
{ title: '查看合同', key: '40' },
{ title: '添加合同', key: '41' },
{ title: '编辑合同', key: '42' },
{ title: '查看合同', key: '40', disableCheckbox: true },
{ title: '添加合同', key: '41', disableCheckbox: true },
{ title: '编辑合同', key: '42', disableCheckbox: true },
],
},
{
title: '小区列表',
key: '43',
disabled: true,
children: [
{ title: '查看小区', key: '44' },
{ title: '编辑小区', key: '45' },
{ title: '添加小区', key: '46' },
{ title: '注销小区', key: '47' },
{ title: '查看小区', key: '44', disableCheckbox: true },
{ title: '编辑小区', key: '45', disableCheckbox: true },
{ title: '添加小区', key: '46', disableCheckbox: true },
{ title: '注销小区', key: '47', disableCheckbox: true },
],
},
{
title: '小区公告',
key: '48',
disabled: true,
children: [
{ title: '查看公告', key: '49' },
{ title: '编辑公告', key: '50' },
{ title: '添加公告', key: '51' },
{ title: '查看公告', key: '49', disableCheckbox: true },
{ title: '编辑公告', key: '50', disableCheckbox: true },
{ title: '添加公告', key: '51', disableCheckbox: true },
],
},
{
title: '小区设施',
key: '52',
disabled: true,
children: [
{ title: '查看预约设施', key: '53' },
{ title: '添加预约设施', key: '54' },
{ title: '取消预约设施', key: '55' },
{ title: '退还预约设施费用', key: '56' },
{ title: '查看设施', key: '57' },
{ title: '编辑设施', key: '58' },
{ title: '添加设施', key: '59' },
{ title: '查看预约设施', key: '53', disableCheckbox: true },
{ title: '添加预约设施', key: '54', disableCheckbox: true },
{ title: '取消预约设施', key: '55', disableCheckbox: true },
{ title: '退还预约设施费用', key: '56', disableCheckbox: true },
{ title: '查看设施', key: '57', disableCheckbox: true },
{ title: '编辑设施', key: '58', disableCheckbox: true },
{ title: '添加设施', key: '59', disableCheckbox: true },
],
},
{
title: '访客记录',
key: '60',
children: [{ title: '查看访客记录', key: '61' }],
disabled: true,
children: [{ title: '查看访客记录', key: '61', disableCheckbox: true }],
},
{
title: '账号管理',
key: '62',
disabled: true,
children: [
{ title: '查看账号', key: '63' },
{ title: '编辑账号', key: '64' },
{ title: '添加账号', key: '65' },
{ title: '注销账号', key: '66' },
{ title: '查看账号', key: '63', disableCheckbox: true },
{ title: '编辑账号', key: '64', disableCheckbox: true },
{ title: '添加账号', key: '65', disableCheckbox: true },
{ title: '注销账号', key: '66', disableCheckbox: true },
],
},
],
......@@ -151,149 +167,165 @@ export const zhCnFaci = [
export const enUsFaci = [
{
title: 'Check all',
title: 'Check All',
key: '0',
children: [
{
title: 'LIFE Users',
key: '1',
disabled: true,
children: [
{ title: 'Check users', key: '2' },
{ title: 'Edit users', key: '3' },
{ title: 'Add users', key: '4' },
{ title: 'Delete unit', key: '5' },
{ title: 'Check family/tenants', key: '6' },
{ title: 'Log off family/tenants', key: '7' },
{ title: 'Check users', key: '2', disableCheckbox: true },
{ title: 'Edit users', key: '3', disableCheckbox: true },
{ title: 'Add users', key: '4', disableCheckbox: true },
{ title: 'Delete unit', key: '5', disableCheckbox: true },
{ title: 'Check family/tenants', key: '6', disableCheckbox: true },
{ title: 'Log off family/tenants', key: '7', disableCheckbox: true },
],
},
{
title: 'Service Providers',
key: '8',
disabled: true,
children: [
{ title: 'Check service providers', key: '9' },
{ title: 'Edit service providers', key: '10' },
{ title: 'Add service providers', key: '11' },
{ title: 'Log off service providers', key: '12' },
{ title: 'Check security account', key: '13' },
{ title: 'Log off security account', key: '14' },
{ title: 'Check service providers', key: '9', disableCheckbox: true },
{ title: 'Edit service providers', key: '10', disableCheckbox: true },
{ title: 'Add service providers', key: '11', disableCheckbox: true },
{ title: 'Log off service providers', key: '12', disableCheckbox: true },
{ title: 'Check security account', key: '13', disableCheckbox: true },
{ title: 'Log off security account', key: '14', disableCheckbox: true },
],
},
{
title: 'Property Management',
key: '15',
children: [{ title: 'View property fees', key: '16' }],
disabled: true,
children: [{ title: 'View property fees', key: '16', disableCheckbox: true }],
},
{
title: 'Commercial Service-Community Maintenance',
key: '17',
disabled: true,
children: [
{ title: 'See information', key: '18' },
{ title: 'Reply message', key: '19' },
{ title: 'See information', key: '18', disableCheckbox: true },
{ title: 'Reply message', key: '19', disableCheckbox: true },
],
},
{
title: 'Commercial Service-Owner Complaints',
key: '20',
disabled: true,
children: [
{ title: 'See information', key: '21' },
{ title: 'Reply message', key: '22' },
{ title: 'See information', key: '21', disableCheckbox: true },
{ title: 'Reply message', key: '22', disableCheckbox: true },
],
},
{
title: 'Commercial Service-Problem Feedback',
key: '23',
disabled: true,
children: [
{ title: 'See information', key: '24' },
{ title: 'Reply message', key: '25' },
{ title: 'See information', key: '24', disableCheckbox: true },
{ title: 'Reply message', key: '25', disableCheckbox: true },
],
},
{
title: 'Commercial Service-Renovation Application',
key: '26',
disabled: true,
children: [
{ title: 'See information', key: '27' },
{ title: 'Reply message', key: '28' },
{ title: 'See information', key: '27', disableCheckbox: true },
{ title: 'Reply message', key: '28', disableCheckbox: true },
],
},
{
title: 'Commercial Service-AccessCard Application',
key: '29',
disabled: true,
children: [
{ title: 'See information', key: '30' },
{ title: 'Reply message', key: '31' },
{ title: 'Apply accesscard', key: '32' },
{ title: 'See information', key: '30', disableCheckbox: true },
{ title: 'Reply message', key: '31', disableCheckbox: true },
{ title: 'Apply accesscard', key: '32', disableCheckbox: true },
],
},
{
title: 'Commercial Service-Report Online',
key: '33',
disabled: true,
children: [
{ title: 'See information', key: '34' },
{ title: 'Reply message', key: '35' },
{ title: 'See information', key: '34', disableCheckbox: true },
{ title: 'Reply message', key: '35', disableCheckbox: true },
],
},
{
title: 'Commercial Service-Shelf Life Service',
key: '36',
disabled: true,
children: [
{ title: 'See information', key: '37' },
{ title: 'Reply message', key: '38' },
{ title: 'See information', key: '37', disableCheckbox: true },
{ title: 'Reply message', key: '38', disableCheckbox: true },
],
},
{
title: 'Contract Management',
key: '39',
disabled: true,
children: [
{ title: 'Check contract', key: '40' },
{ title: 'Add contract', key: '41' },
{ title: 'Edit contract', key: '42' },
{ title: 'Check contract', key: '40', disableCheckbox: true },
{ title: 'Add contract', key: '41', disableCheckbox: true },
{ title: 'Edit contract', key: '42', disableCheckbox: true },
],
},
{
title: 'Community',
key: '43',
disabled: true,
children: [
{ title: 'Check community', key: '44' },
{ title: 'Edit community', key: '45' },
{ title: 'Add community', key: '46' },
{ title: 'Log off community', key: '47' },
{ title: 'Check community', key: '44', disableCheckbox: true },
{ title: 'Edit community', key: '45', disableCheckbox: true },
{ title: 'Add community', key: '46', disableCheckbox: true },
{ title: 'Log off community', key: '47', disableCheckbox: true },
],
},
{
title: 'Announcement',
key: '48',
disabled: true,
children: [
{ title: 'Check announcement', key: '49' },
{ title: 'Edit announcement', key: '50' },
{ title: 'Add announcement', key: '51' },
{ title: 'Check announcement', key: '49', disableCheckbox: true },
{ title: 'Edit announcement', key: '50', disableCheckbox: true },
{ title: 'Add announcement', key: '51', disableCheckbox: true },
],
},
{
title: 'Facility Bookings',
key: '52',
disabled: true,
children: [
{ title: 'View booking facilities', key: '53' },
{ title: 'Add booking facilities', key: '54' },
{ title: 'Cancel booking facilities', key: '55' },
{ title: 'Refund of booking facility fee', key: '56' },
{ title: 'View facilities', key: '57' },
{ title: 'Edit facilities', key: '58' },
{ title: 'Add facilities', key: '59' },
{ title: 'View booking facilities', key: '53', disableCheckbox: true },
{ title: 'Add booking facilities', key: '54', disableCheckbox: true },
{ title: 'Cancel booking facilities', key: '55', disableCheckbox: true },
{ title: 'Refund of booking facility fee', key: '56', disableCheckbox: true },
{ title: 'View facilities', key: '57', disableCheckbox: true },
{ title: 'Edit facilities', key: '58', disableCheckbox: true },
{ title: 'Add facilities', key: '59', disableCheckbox: true },
],
},
{
title: 'Visitor Record',
key: '60',
children: [{ title: 'View visitor record', key: '61' }],
disabled: true,
children: [{ title: 'View visitor record', key: '61', disableCheckbox: true }],
},
{
title: 'Account Management',
key: '62',
disabled: true,
children: [
{ title: 'View account', key: '63' },
{ title: 'Edit account', key: '64' },
{ title: 'Add account', key: '65' },
{ title: 'Log off account', key: '66' },
{ title: 'View account', key: '63', disableCheckbox: true },
{ title: 'Edit account', key: '64', disableCheckbox: true },
{ title: 'Add account', key: '65', disableCheckbox: true },
{ title: 'Log off account', key: '66', disableCheckbox: true },
],
},
],
......
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