mp userRelation
This commit is contained in:
parent
6419d00cc4
commit
8914e3bf0c
|
|
@ -47,11 +47,28 @@ export default OakComponent({
|
|||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
userId: 1,
|
||||
relationId: 1,
|
||||
relation: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
display: 1,
|
||||
relationAuth$destRelation: {
|
||||
$entity: 'relationAuth',
|
||||
data: {
|
||||
id: 1,
|
||||
sourceRelation: {
|
||||
userRelation$relation: {
|
||||
$entity: 'userRelation',
|
||||
data: {
|
||||
id: 1,
|
||||
userId: 1,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filter: userRelationFilter,
|
||||
|
|
@ -70,6 +87,7 @@ export default OakComponent({
|
|||
entity: 1,
|
||||
entityId: 1,
|
||||
extension: 1,
|
||||
sort: 1,
|
||||
},
|
||||
filter: {
|
||||
tag1: 'avatar',
|
||||
|
|
@ -346,7 +364,7 @@ export default OakComponent({
|
|||
const { entity, entityId } = this.props;
|
||||
const { id } = e.currentTarget.dataset;
|
||||
this.navigateTo({
|
||||
url: '/userRelation/upsert/onUser',
|
||||
url: '/userRelation/upsert/byUser',
|
||||
oakId: id,
|
||||
entity,
|
||||
entityId,
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
>
|
||||
<l-list bind:lintap="onItemTapMp" data-id="{{item.id}}">
|
||||
<view class="relation" slot="left-section">
|
||||
<block wx:if="{{item.userRelation$entity.length}}" wx:for="{{item.userRelation$entity}}" wx:for-item="item2" wx:for-index="index2" wx:key="index2">
|
||||
<block wx:if="{{item.userRelation$user.length > 0}}" wx:for="{{item.userRelation$user}}" wx:for-item="item2" wx:for-index="index2" wx:key="index2">
|
||||
<l-tag l-class="tag" plain="{{true}}">
|
||||
{{item2.name ? t(entity + ':r.' + item2) : item2.display}}
|
||||
{{item2.relation.name ? t(entity + ':r.' + item2.relation.name) : item2.relation.display}}
|
||||
</l-tag>
|
||||
</block>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
{
|
||||
"navigationBarTitleText": "添加权限",
|
||||
"usingComponents": {
|
||||
"t-checkbox": "@oak-frontend-base/miniprogram_npm/tdesign/checkbox/checkbox",
|
||||
"t-checkbox-group": "@oak-frontend-base/miniprogram_npm/tdesign/checkbox-group/checkbox-group",
|
||||
"t-input": "@oak-frontend-base/miniprogram_npm/tdesign/input/input",
|
||||
"t-tag": "@oak-frontend-base/miniprogram_npm/tdesign/tag/tag",
|
||||
"t-icon": "@oak-frontend-base/miniprogram_npm/tdesign/icon/icon",
|
||||
"t-button": "@oak-frontend-base/miniprogram_npm/tdesign/button/button"
|
||||
"onUser": "./../onUser/index",
|
||||
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,15 @@
|
|||
@import "../../../config/styles/mp/index.less";
|
||||
@import "../../../config/styles/mp/mixins.less";
|
||||
|
||||
|
||||
page {
|
||||
height: 100%;
|
||||
background-color: @bg-color;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.page-body {
|
||||
height: 100%;
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
align-items: stretch;
|
||||
padding: 0;
|
||||
.safe-area-inset-bottom();
|
||||
}
|
||||
|
||||
.col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.btn-view {
|
||||
display: flex;
|
||||
margin: 0rpx @spacer-2;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
<view class="container">
|
||||
|
||||
<onUser style="display: flex;flex-direction: column; flex: 1;" oakAutoUnmount="{{true}}" oakPath="{{oakFullpath ? oakFullpath + '.user' : undefined}}" entity="{{entity}}" entityId="{{entityId}}" relations="{{relations}}" oakId="{{oakId}}" />
|
||||
|
||||
<l-button disabled="{{!oakDirty}}" size="long" bind:lintap="onConfirm">
|
||||
确定
|
||||
</l-button>
|
||||
</view>
|
||||
|
|
@ -9,9 +9,9 @@ page {
|
|||
}
|
||||
|
||||
.page-body {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
background-color: @oak-bg-color-page;
|
||||
.safe-area-inset-bottom();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,41 @@ export default OakComponent({
|
|||
tag1: 'avatar',
|
||||
},
|
||||
},
|
||||
userRelation$user: {
|
||||
$entity: 'userRelation',
|
||||
data: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
userId: 1,
|
||||
relationId: 1,
|
||||
relation: {
|
||||
id: 1,
|
||||
name: 1,
|
||||
display: 1,
|
||||
relationAuth$destRelation: {
|
||||
$entity: 'relationAuth',
|
||||
data: {
|
||||
id: 1,
|
||||
sourceRelation: {
|
||||
userRelation$relation: {
|
||||
$entity: 'userRelation',
|
||||
data: {
|
||||
id: 1,
|
||||
userId: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
isList: false,
|
||||
formData({ data: user }) {
|
||||
const { name, nickname, password, extraFile$entity, $$createAt$$ } = user || {};
|
||||
const { name, nickname, password, extraFile$entity, $$createAt$$ } =
|
||||
user || {};
|
||||
const avatar = this.features.extraFile.getUrl(
|
||||
extraFile$entity && extraFile$entity[0]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<view class="list-item">
|
||||
<view class="label">权限:</view>
|
||||
<view class="relation-box">
|
||||
<user-relations oakPath="{{(oakFullpath && userRelationRelativePath) ? oakFullpath + '.' + userRelationRelativePath : undefined }}" oakAutoUnmount="{{true}}" entity="{{entity}}" entityId="{{entityId}}" relations="{{relations}}" />
|
||||
<user-relations oakPath="{{oakFullpath ? oakFullpath + '.userRelation$user' : undefined }}" oakAutoUnmount="{{true}}" entity="{{entity}}" entityId="{{entityId}}" relations="{{relations}}" />
|
||||
</view>
|
||||
</view>
|
||||
</l-card>
|
||||
|
|
|
|||
|
|
@ -78,8 +78,15 @@ export default OakComponent({
|
|||
}
|
||||
},
|
||||
onRelationChangeMp(e: WechatMiniprogram.TouchEvent) {
|
||||
const { key: relation, checked } = e.detail;
|
||||
this.onRelationChange(relation, checked);
|
||||
const { key: relationId, checked } = e.detail;
|
||||
const { relations2 } = this.state;
|
||||
const userRelation = relations2?.find(
|
||||
(ele: {
|
||||
isChecked: boolean;
|
||||
relation: EntityDict['relation']['OpSchema'];
|
||||
}) => ele.relation.id === relationId
|
||||
);
|
||||
this.onRelationChange(userRelation?.relation, checked);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
size="64rpx"
|
||||
wx:for-items="{{relations2}}"
|
||||
wx:key="index"
|
||||
key="{{item.relation}}"
|
||||
key="{{item.relation.id}}"
|
||||
checked="{{item.isChecked}}"
|
||||
>
|
||||
{{item.relation.name ? t(entity + ':r.' + item.relation.name) : item.relation.display}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue