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 { ...@@ -13,6 +13,7 @@ export default {
Result: null, Result: null,
DataSave: null, DataSave: null,
DataSaveDetail: null, DataSaveDetail: null,
Permission: null,
}, },
reducers: { reducers: {
...@@ -28,6 +29,9 @@ export default { ...@@ -28,6 +29,9 @@ export default {
returnDataSaveDetail(state, { DataSaveDetail }) { returnDataSaveDetail(state, { DataSaveDetail }) {
return { ...state, DataSaveDetail }; return { ...state, DataSaveDetail };
}, },
returnPermission(state, { Permission }) {
return { ...state, Permission };
},
}, },
effects: { effects: {
...@@ -81,7 +85,8 @@ export default { ...@@ -81,7 +85,8 @@ export default {
break; break;
case 54: // 账号权限 case 54: // 账号权限
{ {
console.log(resp.data); let Permission = resp.data;
yield put({ type: 'returnPermission', Permission });
// let Result = resp.error_code; // let Result = resp.error_code;
// yield put({ type: 'returnResult', Result }); // yield put({ type: 'returnResult', Result });
} }
......
...@@ -27,24 +27,18 @@ import moment from 'moment'; ...@@ -27,24 +27,18 @@ import moment from 'moment';
const Account = (props: any) => { const Account = (props: any) => {
const module = 'Account'; 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 [term, setTerm] = useState({} as any);
// 小区列表 // 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any); // const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
// useEffect(() => {
// if (CommunityList != null) {
// setCommunityList(CommunityList);
// }
// }, [CommunityList]);
// 权限列表 // 权限列表
const treeData = enUsFaci || zhCnFaci; const treeData = enUsFaci || zhCnFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目 const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目 const [checkedKeys, setCheckedKeys] = useState<string[]>([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点 const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭 const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
...@@ -55,6 +49,48 @@ const Account = (props: any) => { ...@@ -55,6 +49,48 @@ const Account = (props: any) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const formRef = useRef(null); 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) => { const onFinishContract = async (value: any) => {
// console.log(value); // console.log(value);
...@@ -110,7 +146,7 @@ const Account = (props: any) => { ...@@ -110,7 +146,7 @@ const Account = (props: any) => {
// 点击单个触发 // 点击单个触发
const onCheck = (checkedKeys: any) => { const onCheck = (checkedKeys: any) => {
console.log('onCheck', checkedKeys); // console.log('onCheck', checkedKeys);
setCheckedKeys(checkedKeys); setCheckedKeys(checkedKeys);
}; };
...@@ -250,6 +286,7 @@ const AccountProps = (state: any) => { ...@@ -250,6 +286,7 @@ const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result } = state.Account; const { Data, DataSave, DataSaveDetail, Result } = state.Account;
const { CommunityList } = state.Init; // 小区列表 const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
const { user } = state;
return { return {
Data, Data,
DataSave, DataSave,
...@@ -257,6 +294,7 @@ const AccountProps = (state: any) => { ...@@ -257,6 +294,7 @@ const AccountProps = (state: any) => {
Result, Result,
loading, loading,
CommunityList, CommunityList,
user, // 获取当前账户信息
}; };
}; };
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import { Form, Input, Button, Spin, message, Descriptions, Checkbox, Tree, Radio } from 'antd';
Form,
Input,
Button,
Pagination,
message,
Descriptions,
Checkbox,
Tree,
Radio,
} from 'antd';
import { connect, history } from 'umi'; import { connect, history } from 'umi';
import { SearchOutlined, ClearOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons'; import { SearchOutlined, ClearOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons';
import { getCookie } from '@/utils/method'; import { getCookie } from '@/utils/method';
...@@ -27,7 +17,7 @@ import moment from 'moment'; ...@@ -27,7 +17,7 @@ import moment from 'moment';
const Account = (props: any) => { const Account = (props: any) => {
const module = 'Account'; 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; const treeData = enUsFaci || zhCnFaci;
...@@ -69,8 +59,57 @@ const Account = (props: any) => { ...@@ -69,8 +59,57 @@ const Account = (props: any) => {
// 发起获取权限请求 // 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求 RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
} }
let a = [];
for (var i = 0; i <= 66; i++) {
a.push(i);
}
console.log(a);
}, [DataSave]); }, [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) => { const onFinishContract = async (value: any) => {
// console.log(value); // console.log(value);
...@@ -159,7 +198,7 @@ const Account = (props: any) => { ...@@ -159,7 +198,7 @@ const Account = (props: any) => {
// 选择小区名字并赋值 // 选择小区名字并赋值
return ( return (
<> <Spin spinning={loading}>
<div className="contop" style={{ padding: '12px 20px' }}> <div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi"> <h3 className="capi">
<EditOutlined /> <EditOutlined />
...@@ -258,21 +297,22 @@ const Account = (props: any) => { ...@@ -258,21 +297,22 @@ const Account = (props: any) => {
</div> </div>
</Form> </Form>
</div> </div>
</> </Spin>
); );
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result } = state.Account; const { Data, DataSave, DataSaveDetail, Result, Permission } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
const { user } = state;
return { return {
Data, Data,
DataSave, DataSave,
DataSaveDetail, DataSaveDetail,
Result, Result,
loading, loading,
CommunityList, Permission,
user,
}; };
}; };
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
Spin, Spin,
Image, Image,
} from 'antd'; } 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 { Link, useIntl, connect, Dispatch, Loading } from 'umi';
import { RA } from '@/services/tos'; import { RA } from '@/services/tos';
...@@ -61,6 +61,8 @@ const ContractContent = (props: any) => { ...@@ -61,6 +61,8 @@ const ContractContent = (props: any) => {
const [imgInfo, setimgInfo] = useState(null as any); //本地图片预览 const [imgInfo, setimgInfo] = useState(null as any); //本地图片预览
const [previewVisible, setPreviewVisible] = useState(false); //本地图片预览弹窗 const [previewVisible, setPreviewVisible] = useState(false); //本地图片预览弹窗
const [imgLoad, setimgLoad] = useState(false); //本地图片预览
useEffect(() => { useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单 // 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if (DataSaveDetail == null) { if (DataSaveDetail == null) {
...@@ -166,13 +168,17 @@ const ContractContent = (props: any) => { ...@@ -166,13 +168,17 @@ const ContractContent = (props: any) => {
data: { imageType: 'tosContract', extends: comtyName }, data: { imageType: 'tosContract', extends: comtyName },
fileList: fileList, fileList: fileList,
onChange: ({ file, fileList }: { file: any; fileList: any }) => { onChange: ({ file, fileList }: { file: any; fileList: any }) => {
if (file.status === 'uploading') {
setimgLoad(true);
}
if (file.status == 'done') { if (file.status == 'done') {
message.success(file.name, 3); message.success(file.name);
setFileList(fileList); setFileList(fileList);
// 添加到表单 // 添加到表单
form.setFieldsValue({ form.setFieldsValue({
upload: 'ok', upload: 'ok',
}); });
setimgLoad(false);
} }
}, },
}; };
...@@ -184,7 +190,6 @@ const ContractContent = (props: any) => { ...@@ -184,7 +190,6 @@ const ContractContent = (props: any) => {
let a2 = moment(data[1]).subtract(1, 'month').format('YYYY-MM-DD'); let a2 = moment(data[1]).subtract(1, 'month').format('YYYY-MM-DD');
setTipTime([a1, a2]); setTipTime([a1, a2]);
} }
console.log(dateStrings);
}; };
// 选择小区名字并赋值 // 选择小区名字并赋值
...@@ -264,6 +269,27 @@ const ContractContent = (props: any) => { ...@@ -264,6 +269,27 @@ const ContractContent = (props: any) => {
return isJpgOrPng && isLt2M; 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 ( return (
<> <>
<Spin spinning={loading}> <Spin spinning={loading}>
...@@ -378,8 +404,9 @@ const ContractContent = (props: any) => { ...@@ -378,8 +404,9 @@ const ContractContent = (props: any) => {
disabled={uploadUp} disabled={uploadUp}
beforeUpload={beforeUpload} beforeUpload={beforeUpload}
onPreview={onPreviews} onPreview={onPreviews}
onRemove={onRemove}
> >
{fileList.length >= 3 ? null : <PlusOutlined />} {fileList.length >= 3 ? null : uploadButton}
</Upload> </Upload>
</Form.Item> </Form.Item>
</div> </div>
......
This diff is collapsed.
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