oak-general-business/app/pages/user/manage/index.ts

86 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// index.ts
import { composeFileUrl } from "../../../../src/utils/extraFile";
export default OakPage({
path: 'user:manage',
entity: 'user',
projection: {
id: 1,
nickname: 1,
name: 1,
userState: 1,
extraFile$entity: {
$entity: 'extraFile',
data: {
id: 1,
tag1: 1,
origin: 1,
bucket: 1,
objectId: 1,
filename: 1,
extra1: 1,
type: 1,
entity: 1,
extension: 1,
},
filter: {
tag1: 'avatar',
},
indexFrom: 0,
count: 1,
},
mobile$user: {
$entity: 'mobile',
data: {
id: 1,
mobile: 1,
},
},
},
isList: true,
formData: async ({ data: users }) => {
const userData = users.map((user) => {
const {
id,
nickname,
userState,
name,
mobile$user,
extraFile$entity,
} = user || {};
const mobile = mobile$user && mobile$user[0]?.mobile;
const avatar =
extraFile$entity &&
extraFile$entity[0] &&
composeFileUrl(extraFile$entity[0]);
return {
id,
nickname,
name,
mobile,
avatar,
userState,
};
});
return {
userData,
};
},
methods: {
goUserManageDetail(input: any) {
// resolveInput拿的是target原来代码拿的是currentTarget
const { dataset } = this.resolveInput(input);
const { id } = dataset!;
this.navigateTo({
url: 'detail/index',
oakId: id,
});
},
goNewUser() {
this.navigateTo({
url: 'upsert/index',
});
},
},
});