修改了一个参数
This commit is contained in:
parent
32cbb6c99b
commit
550520c2ec
|
|
@ -53,6 +53,14 @@ export default OakPage({
|
|||
},
|
||||
},
|
||||
},
|
||||
filters: [{
|
||||
filter: async ({ features }) => {
|
||||
const token = await features.token.getToken();
|
||||
return {
|
||||
id: token,
|
||||
};
|
||||
},
|
||||
}],
|
||||
formData: async ({ data: [token] }) => {
|
||||
const user = token?.user;
|
||||
const player = token?.player;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ page {
|
|||
|
||||
.primary-bg {
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
height: 100rpx;
|
||||
background-color: @default-color;
|
||||
}
|
||||
.img {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
|
||||
OakPage(
|
||||
|
|
@ -5,8 +6,9 @@ OakPage(
|
|||
path: 'userRelation:detail',
|
||||
entity: 'user',
|
||||
projection: async ({onLoadOptions}) => {
|
||||
const { entity } = onLoadOptions;
|
||||
const entityStr = entity && entity.charAt(0).toUpperCase() + entity.substring(1);
|
||||
const { entity, entityIds, nameExpression, relations } = onLoadOptions;
|
||||
const entityStr = firstLetterUpperCase(entity!);
|
||||
const entityIds2 = JSON.parse(entityIds!) as string[];
|
||||
return {
|
||||
id: 1,
|
||||
name: 1,
|
||||
|
|
@ -27,6 +29,14 @@ OakPage(
|
|||
[`${entity}Id`]: 1,
|
||||
relation: 1,
|
||||
},
|
||||
filter: {
|
||||
[`${entity}Id`]: {
|
||||
$in: entityIds2,
|
||||
},
|
||||
relation: {
|
||||
$in: JSON.parse(relations!),
|
||||
}
|
||||
}
|
||||
},
|
||||
extraFile$entity: {
|
||||
$entity: 'extraFile',
|
||||
|
|
@ -51,35 +61,47 @@ OakPage(
|
|||
};
|
||||
},
|
||||
isList: false,
|
||||
formData: async function ({ data: user, params }) {
|
||||
const { entity, relations } = params!;
|
||||
const entityStr = entity.charAt(0).toUpperCase() + entity.substring(1);
|
||||
const userRelation = user![`user${entityStr}$user`];
|
||||
const relationArr = (userRelation as any)?.map((ele: any) => ele.relation) || [];
|
||||
const relationList = JSON.parse(relations) as Array<string>;
|
||||
const relationArr2: [string, boolean][] = [];
|
||||
relationList.forEach(ele => {
|
||||
relationArr2.push([ele, relationArr.includes(ele) ? true : false]);
|
||||
})
|
||||
const { extraFile$entity } = user || {};
|
||||
formData: async function ({ data: user, props }) {
|
||||
const { entity, relations, entityIds } = props;
|
||||
const entityStr = firstLetterUpperCase(entity!);
|
||||
const { name, nickname, mobile, [`user${entityStr}$user`]: relationRows, extraFile$entity } = user!;
|
||||
// entity按id聚集
|
||||
const entityIds2 = JSON.parse(entityIds!) as string[];
|
||||
const entityRows = entityIds2.map(
|
||||
(id, idx) => ({
|
||||
id,
|
||||
name: entityNames[idx],
|
||||
relations: (relationRows as {
|
||||
relation: string;
|
||||
[A: string]: string;
|
||||
}[]).filter(
|
||||
ele => ele[`${entity}Id`] === id
|
||||
).map(
|
||||
ele => ele.relation
|
||||
)
|
||||
})
|
||||
);
|
||||
const avatar = extraFile$entity![0] && composeFileUrl(extraFile$entity![0]);
|
||||
return Object.assign(user!, {
|
||||
relationArr,
|
||||
relationArr2,
|
||||
return {
|
||||
name,
|
||||
nickname,
|
||||
avatar,
|
||||
})
|
||||
relations,
|
||||
entityRows,
|
||||
mobile,
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
entity: String,
|
||||
entityId: String,
|
||||
entityIds: String,
|
||||
nameExpression: String,
|
||||
relations: String,
|
||||
entityNames: String,
|
||||
},
|
||||
data: {
|
||||
show: false,
|
||||
relationArr2: [],
|
||||
},
|
||||
lifetimes: {
|
||||
},
|
||||
methods: {
|
||||
handleShow() {
|
||||
this.setState({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class="white-bg">
|
||||
<view class="content">
|
||||
<image mode="aspectFill" class="img" src="{{avatar}}" lazy-load></image>
|
||||
<text class="name">{{name || '--'}}</text>
|
||||
<text class="name">{{name || nickname || '--'}}</text>
|
||||
<text class="mobile">{{mobile || '--'}}</text>
|
||||
<divider />
|
||||
<view wx:if="{{relationArr.length}}" class="tag-view">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
|
||||
export default OakPage(
|
||||
|
|
@ -51,7 +52,8 @@ export default OakPage(
|
|||
};
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
// 暂时注掉
|
||||
/* {
|
||||
filter: async ({ onLoadOptions }) => {
|
||||
const { entityId, relations, entity } = onLoadOptions;
|
||||
const entityStr = entity && entity.charAt(0).toUpperCase() + entity.substring(1);
|
||||
|
|
@ -70,12 +72,12 @@ export default OakPage(
|
|||
},
|
||||
} as any;
|
||||
},
|
||||
},
|
||||
}, */
|
||||
],
|
||||
isList: true,
|
||||
formData: async function ({ data: users, params, features }) {
|
||||
const { entity } = params!;
|
||||
const entityStr = entity.charAt(0).toUpperCase() + entity.substring(1);
|
||||
formData: async function ({ data: users, props, features }) {
|
||||
const { entity } = props;
|
||||
const entityStr = firstLetterUpperCase(entity!);
|
||||
|
||||
const isRoot = await features.token.isRoot();
|
||||
const filter = await this.getFilterByName('name');
|
||||
|
|
@ -106,10 +108,13 @@ export default OakPage(
|
|||
},
|
||||
properties: {
|
||||
entity: String,
|
||||
entityId: String,
|
||||
entityIds: String,
|
||||
relations: String,
|
||||
nameExpression: String,
|
||||
},
|
||||
data: {
|
||||
searchValue: '',
|
||||
},
|
||||
data: {},
|
||||
lifetimes: {},
|
||||
methods: {
|
||||
async searchChange(input: any) {
|
||||
|
|
@ -139,21 +144,22 @@ export default OakPage(
|
|||
this.refresh();
|
||||
},
|
||||
goUpsertUser() {
|
||||
const { entity, entityId } = this.props;
|
||||
const { entity, entityIds } = this.props;
|
||||
this.navigateTo({
|
||||
url: '../../user/manage/upsert/index',
|
||||
});
|
||||
},
|
||||
handleCardClick(event: any) {
|
||||
const { entity, entityId } = this.props;
|
||||
const { entity, entityIds, nameExpression, relations } = this.props;
|
||||
const { dataset } = this.resolveInput(event);
|
||||
const { id } = dataset!;
|
||||
this.navigateTo({
|
||||
url: '../detail/index',
|
||||
oakId: id,
|
||||
entity,
|
||||
entityId,
|
||||
relations: JSON.stringify(['manager', 'owner']),
|
||||
entityIds,
|
||||
nameExpression,
|
||||
relations,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export default OakPage(
|
|||
isList: true,
|
||||
filters: [
|
||||
{
|
||||
filter: async ({ features, rest, onLoadOptions }) => {
|
||||
filter: async ({ onLoadOptions }) => {
|
||||
const scene = decodeURIComponent(onLoadOptions.scene!);
|
||||
const uuid = scene && expandUuidTo36Bytes(scene!);
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const checkers: Checker<EntityDict, 'token', GeneralRuntimeContext<EntityDict>>
|
|||
action: 'select',
|
||||
entity: 'token',
|
||||
checker: async ({ operation }, context) => {
|
||||
const scene = context.getScene();
|
||||
/* const scene = context.getScene();
|
||||
const { filter } = operation;
|
||||
if (scene === 'token:me') {
|
||||
if (!filter || !filter.id) {
|
||||
|
|
@ -46,7 +46,7 @@ const checkers: Checker<EntityDict, 'token', GeneralRuntimeContext<EntityDict>>
|
|||
id: await context.getTokenValue(),
|
||||
})
|
||||
});
|
||||
}
|
||||
} */
|
||||
return 0;
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue