userEntityGrant/claim
This commit is contained in:
parent
5ab4a332b8
commit
3ded7d897a
|
|
@ -46,11 +46,11 @@ export default OakComponent({
|
||||||
data: {
|
data: {
|
||||||
pickedRowIds: [],
|
pickedRowIds: [],
|
||||||
pickedRelationIds: [],
|
pickedRelationIds: [],
|
||||||
onPickRelationsMp: (ids) => {
|
onPickRelationsMp(ids) {
|
||||||
this.onPickRelations(ids);
|
(this).onPickRelations(ids);
|
||||||
},
|
},
|
||||||
onPickRowsMp: (ids) => {
|
onPickRowsMp(ids) {
|
||||||
this.onPickRows(ids);
|
(this).onPickRows(ids);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formData({ data }) {
|
formData({ data }) {
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,10 @@ export default OakComponent({
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
relations: [],
|
relations: [],
|
||||||
onPickRelationsMp: (val) => {
|
onPickRelationsMp(val) {
|
||||||
this.props.onPickRelations(val);
|
this.props.onPickRelations(val);
|
||||||
},
|
},
|
||||||
onPickRowsMp: (val) => {
|
onPickRowsMp(val) {
|
||||||
this.props.onPickRows(val);
|
this.props.onPickRows(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -74,6 +74,10 @@ export default OakComponent({
|
||||||
label: this.t(`${entity}:r.${r.name}`),
|
label: this.t(`${entity}:r.${r.name}`),
|
||||||
value: r.id,
|
value: r.id,
|
||||||
})),
|
})),
|
||||||
|
rowOption: data.map(ele => ({
|
||||||
|
value: ele.id,
|
||||||
|
label: (ele.name || ele.title || ele.id),
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,13 @@
|
||||||
<view class="info-title">
|
<view class="info-title">
|
||||||
{{t('pickRow', { entity: t(entity + ':name') })}}
|
{{t('pickRow', { entity: t(entity + ':name') })}}
|
||||||
</view>
|
</view>
|
||||||
|
<check-list
|
||||||
|
option="{{rowOption}}"
|
||||||
|
value="{{pickedRowIds || []}}"
|
||||||
|
multiple="{{rule !== 'single'}}"
|
||||||
|
disabled="{{disablePickRow || disabled}}"
|
||||||
|
onSelect="{{onPickRowsMp}}"
|
||||||
|
/>
|
||||||
</block>
|
</block>
|
||||||
<view class="info-title">
|
<view class="info-title">
|
||||||
{{t('pickRelation.' + pickRelationRule)}}
|
{{t('pickRelation.' + pickRelationRule)}}
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,21 @@ export default OakComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
pickedRowIds: [] as string[],
|
pickedRowIds: [],
|
||||||
pickedRelationIds: [] as string[],
|
pickedRelationIds: [],
|
||||||
onPickRelationsMp: (ids: string[]) => {
|
onPickRelationsMp(ids: string[]) {
|
||||||
(this as any).onPickRelations(ids);
|
(this).onPickRelations(ids);
|
||||||
},
|
},
|
||||||
onPickRowsMp: (ids: string[]) => {
|
onPickRowsMp(ids: string[]) {
|
||||||
(this as any).onPickRows(ids);
|
(this).onPickRows(ids);
|
||||||
}
|
}
|
||||||
},
|
} as {
|
||||||
|
pickedRowIds: string[];
|
||||||
|
pickedRelationIds: string[];
|
||||||
|
} & ThisType<{
|
||||||
|
onPickRelations(ids: string[]): void;
|
||||||
|
onPickRows(ids: string[]): void;
|
||||||
|
}>,
|
||||||
formData({ data }) {
|
formData({ data }) {
|
||||||
const userId = this.features.token.getUserId();
|
const userId = this.features.token.getUserId();
|
||||||
const isGranter = userId === data?.granterId;
|
const isGranter = userId === data?.granterId;
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,21 @@ export default OakComponent({
|
||||||
pickedRelationIds: [] as string[] | undefined,
|
pickedRelationIds: [] as string[] | undefined,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
relations: [] as EntityDict['relation']['OpSchema'][],
|
relations: [],
|
||||||
onPickRelationsMp: (val: string[]) => {
|
onPickRelationsMp(val: string[]) {
|
||||||
(this as any).props.onPickRelations!(val);
|
this.props.onPickRelations(val);
|
||||||
},
|
},
|
||||||
onPickRowsMp: (val: string[]) => {
|
onPickRowsMp(val: string[]) {
|
||||||
(this as any).props.onPickRows!(val);
|
this.props.onPickRows(val);
|
||||||
}
|
}
|
||||||
},
|
} as {
|
||||||
|
relations: EntityDict['relation']['OpSchema'][];
|
||||||
|
} & ThisType<{
|
||||||
|
props: {
|
||||||
|
onPickRelations: (val: string[]) => void;
|
||||||
|
onPickRows: (val: string[]) => void;
|
||||||
|
}
|
||||||
|
}>,
|
||||||
formData({ data }) {
|
formData({ data }) {
|
||||||
if (data) {
|
if (data) {
|
||||||
const { rule, ruleOnRow, relationIds, entity } = this.props;
|
const { rule, ruleOnRow, relationIds, entity } = this.props;
|
||||||
|
|
@ -79,6 +86,10 @@ export default OakComponent({
|
||||||
value: r.id,
|
value: r.id,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
rowOption: (data as any[]).map(ele => ({
|
||||||
|
value: ele.id,
|
||||||
|
label: (ele.name || ele.title || ele.id) as string,
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,13 @@
|
||||||
<view class="info-title">
|
<view class="info-title">
|
||||||
{{t('pickRow', { entity: t(entity + ':name') })}}
|
{{t('pickRow', { entity: t(entity + ':name') })}}
|
||||||
</view>
|
</view>
|
||||||
|
<check-list
|
||||||
|
option="{{rowOption}}"
|
||||||
|
value="{{pickedRowIds || []}}"
|
||||||
|
multiple="{{rule !== 'single'}}"
|
||||||
|
disabled="{{disablePickRow || disabled}}"
|
||||||
|
onSelect="{{onPickRowsMp}}"
|
||||||
|
/>
|
||||||
</block>
|
</block>
|
||||||
<view class="info-title">
|
<view class="info-title">
|
||||||
{{t('pickRelation.' + pickRelationRule)}}
|
{{t('pickRelation.' + pickRelationRule)}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue