Skip to content

Commit

Permalink
fix(多租户): 多租户添加资产优化
Browse files Browse the repository at this point in the history
协议资产/产品资产添加时Loading状态优化。按钮优化

fix #68
  • Loading branch information
Lind-pro committed Jun 22, 2020
1 parent a3b6efe commit 6372695
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,19 @@ const Add = (props: Props) => {
assetIdList: selectedAssetsId,
allPermission: true,
}));
if (checkedUserList.length === 0) {
message.error('请选择成员');
// if (checkedUserList.length === 0) {
// message.error('请选择成员');
// setLoading(false);
// } else {
service.assets.bind(data.id, bindData).subscribe(() => {
setLoading(false);
} else {
service.assets.bind(data.id, bindData).subscribe(() => {
setLoading(false);
message.success('添加成功')
props.close();
});
}
setLoading(false);
message.success('添加成功')
props.close();
});
// }
}
setLoading(false);

});

}
Expand Down Expand Up @@ -192,9 +193,10 @@ const Add = (props: Props) => {
onClick={() => {
bind()
}}
disabled={selectedAssetsId.length === 0}
type="primary"
>
保存
{selectedAssetsId.length === 0 ? '添加' : `添加${selectedAssetsId.length}项`}
</Button>
</div>
</Drawer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const Add = (props: Props) => {
}
useEffect(() => {
handleSearch(searchParam);

service.member.query(data.id, {}).subscribe(resp => {
setUserList(resp.data);
});
Expand All @@ -73,18 +72,19 @@ const Add = (props: Props) => {
assetIdList: selectedAssetsId,
allPermission: true,
}));
if (checkedUserList.length === 0) {
message.error('请选择成员');
// if (checkedUserList.length === 0) {
// message.error('请选择成员');
// setLoading(false);
// } else {
service.assets.bind(data.id, bindData).subscribe(() => {
setLoading(false);
} else {
service.assets.bind(data.id, bindData).subscribe(() => {
setLoading(false);
message.success('添加成功')
props.close();
});
}
setLoading(false);
message.success('添加成功')
props.close();
});
// }
}
setLoading(false);

});

}
Expand All @@ -107,7 +107,7 @@ const Add = (props: Props) => {
}]
return (
<Drawer
title="添加产品资产"
title="添加协议资产"
visible
width='70VW'
onClose={() => props.close()}
Expand Down Expand Up @@ -195,9 +195,10 @@ const Add = (props: Props) => {
onClick={() => {
bind()
}}
disabled={selectedAssetsId.length === 0}
type="primary"
>
保存
{selectedAssetsId.length === 0 ? '添加' : `添加${selectedAssetsId.length}项`}
</Button>
</div>
</Drawer>
Expand Down
10 changes: 5 additions & 5 deletions src/pages/system/tenant/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import React, { useState, useEffect } from "react"
import { Card, Button, List, Radio, Input, Avatar, Tag, message, Spin, Popconfirm } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import moment from "moment";
import { ListData } from "@/services/response";
import { router } from "umi";
import defaultImg from '@/assets/default.png';
import { TenantItem } from "./data";
import styles from './index.less';
import Service from "./service";
import { ListData } from "@/services/response";
import Save from "./save";
import { router } from "umi";


const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
Expand Down Expand Up @@ -40,7 +40,7 @@ const ListContent = ({

const Tenant = () => {

const defualtImg = 'https://tse2-mm.cn.bing.net/th/id/OIP.O9TfOiCrUHdOyEE92JtfBQAAAA?pid=Api&rs=1';
// const defualtImg = 'https://tse2-mm.cn.bing.net/th/id/OIP.O9TfOiCrUHdOyEE92JtfBQAAAA?pid=Api&rs=1';
const service = new Service('tenant');
const [loading, setLoading] = useState<boolean>(false);
const [tloading, setTloading] = useState<boolean>(false);
Expand Down Expand Up @@ -168,7 +168,7 @@ const Tenant = () => {
]}
>
<List.Item.Meta
avatar={<Avatar src={item.photo || defualtImg} shape="square" size="large" />}
avatar={<Avatar src={item.photo || defaultImg} shape="square" size="large" />}
title={<a >{item.name}</a>}
description={item.description}
/>
Expand Down
9 changes: 5 additions & 4 deletions src/pages/system/tenant/save/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useState } from "react";
import { Modal, Form, Input, Upload, Icon } from "antd"
import { FormComponentProps } from "antd/lib/form";
import { UploadProps } from "antd/lib/upload";
import { TenantItem } from "../data";
import { getAccessToken } from "@/utils/authority";
import { TenantItem } from "../data";

interface Props extends FormComponentProps {
save: Function;
Expand Down Expand Up @@ -37,7 +37,8 @@ const Save = (props: Props) => {
if (info.file.status === 'done') {
const fileUrl: string = info.file.response.result;
setLoading(false);
setImageUrl(fileUrl.replace('localhost', '192.168.3.110'));
setImageUrl(fileUrl);
// setImageUrl(fileUrl.replace('localhost', '192.168.3.110'));
}
if (info.file.status === 'uploading') {
setLoading(true);
Expand Down Expand Up @@ -99,7 +100,7 @@ const Save = (props: Props) => {
{ required: true, message: '请输入新密码' },
{ validator: validateToNextPassword }
],
})(<Input placeholder="请输入新密码" />)}
})(<Input.Password placeholder="请输入新密码" />)}
</Form.Item>
<Form.Item label="确认密码">
{getFieldDecorator('confirmPassword', {
Expand All @@ -108,7 +109,7 @@ const Save = (props: Props) => {
{
validator: compareToFirstPassword
}],
})(<Input placeholder="请输入确认密码" onBlur={handleConfirmBlur} />)}
})(<Input.Password placeholder="请输入确认密码" onBlur={handleConfirmBlur} />)}
</Form.Item>
<Form.Item label="头像">
<Upload
Expand Down

0 comments on commit 6372695

Please sign in to comment.