Skip to content

Commit

Permalink
fix(多租户): 多租户成员管理
Browse files Browse the repository at this point in the history
选择了成员则只能编辑/查看成员的资产
  • Loading branch information
Lind-pro committed Jun 18, 2020
1 parent 5a4d0ee commit c7ffcc8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import encodeQueryParam from "@/utils/encodeParam";
interface Props {
close: Function
data: any
user: any
}
const Add = (props: Props) => {
const service = new Service('tenant');
Expand All @@ -15,7 +16,7 @@ const Add = (props: Props) => {
const [loading, setLoading] = useState<boolean>(true);
const [userList, setUserList] = useState();
const { data } = props;
const [checkedUserList, setCheckedUserList] = useState<string[]>([]);
const [checkedUserList, setCheckedUserList] = useState<string[]>([props.user]);
const [selectedAssetsId, setSelectedAssetsId] = useState<string[]>([]);

useEffect(() => {
Expand All @@ -25,6 +26,7 @@ const Add = (props: Props) => {
tenantId: data?.id,
assetType: 'device',
not: true,
memberId: props.user,
})
}
})).subscribe(resp => {
Expand Down Expand Up @@ -79,6 +81,7 @@ const Add = (props: Props) => {
>
<Form.Item label="选择成员">
<Select
value={checkedUserList}
mode="tags"
placeholder="选择成员"
onChange={(value: string[]) => { setCheckedUserList(value) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import User from "./user";
interface Props {
close: Function;
data: any;
user: any;
}
const Edit = (props: Props) => {
const service = new Service('tenant');
Expand All @@ -25,6 +26,7 @@ const Edit = (props: Props) => {
id$assets: JSON.stringify({
tenantId: data?.id,
assetType: 'device',
memberId: props.user,
// not: true,
})
}
Expand Down Expand Up @@ -126,7 +128,9 @@ const Edit = (props: Props) => {
</div>
{add && (
<Add
data={data} close={() => {
user={props.user}
data={data}
close={() => {
setAdd(false);
handleSearch();
}} />
Expand Down
3 changes: 2 additions & 1 deletion src/pages/system/tenant/components/assets/device/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Device = (props: Props) => {
id$assets: JSON.stringify({
tenantId: data?.id,
assetType: 'device',
// not: true,
memberId: props.user,
})
}
}
Expand All @@ -89,6 +89,7 @@ const Device = (props: Props) => {
</Card>
{visible && (
<Edit
user={props.user}
data={data}
close={() => {
setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import encodeQueryParam from "@/utils/encodeParam";
interface Props {
close: Function
data: any
user: any
}
const Add = (props: Props) => {
const service = new Service('tenant');
Expand All @@ -15,7 +16,7 @@ const Add = (props: Props) => {
const [loading, setLoading] = useState<boolean>(true);
const [userList, setUserList] = useState();
const { data } = props;
const [checkedUserList, setCheckedUserList] = useState<string[]>([]);
const [checkedUserList, setCheckedUserList] = useState<string[]>([props.user]);
const [selectedAssetsId, setSelectedAssetsId] = useState<string[]>([]);

useEffect(() => {
Expand Down Expand Up @@ -93,6 +94,7 @@ const Add = (props: Props) => {
>
<Form.Item label="选择成员">
<Select
value={checkedUserList}
mode="tags"
placeholder="选择成员"
onChange={(value: string[]) => { setCheckedUserList(value) }}
Expand Down
14 changes: 5 additions & 9 deletions src/pages/system/tenant/components/assets/product/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import User from "./user";
interface Props {
close: Function;
data: any;
user: any
}
const Edit = (props: Props) => {
const service = new Service('tenant');
Expand All @@ -26,6 +27,7 @@ const Edit = (props: Props) => {
id$assets: JSON.stringify({
tenantId: data?.id,
assetType: 'product',
memberId: props.user,
// not: true,
})
}
Expand Down Expand Up @@ -117,17 +119,11 @@ const Edit = (props: Props) => {
>
关闭
</Button>
{/* <Button
onClick={() => {
// autzSetting();
}}
type="primary"
>
保存
</Button> */}
</div>
{add && (
<Add data={data}
<Add
user={props.user}
data={data}
close={() => {
setAdd(false);
handleSearch();
Expand Down
2 changes: 2 additions & 0 deletions src/pages/system/tenant/components/assets/product/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Product = (props: Props) => {
id$assets: JSON.stringify({
tenantId: data?.id,
assetType: 'product',
memberId: props.user,
// not: true,
})
}
Expand Down Expand Up @@ -93,6 +94,7 @@ const Product = (props: Props) => {

<Edit
data={data}
user={props.user}
close={() => {
setVisible(false);
getData();
Expand Down

0 comments on commit c7ffcc8

Please sign in to comment.