This commit is contained in:
qsc 2023-08-21 13:44:51 +08:00
parent 5436fabd41
commit 8d59718742
239 changed files with 3334 additions and 171 deletions

View File

@ -37,5 +37,5 @@ export declare type Poi = {
email?: string;
businessArea?: string;
};
declare const Location: (props: LocationProps) => JSX.Element;
declare const Location: (props: LocationProps) => import("react/jsx-runtime").JSX.Element;
export default Location;

View File

@ -29,5 +29,5 @@ export interface AMapProps extends APILoaderProps {
securityJsCode?: string;
serviceHost?: string;
}
declare const memo: (props: AMapProps) => JSX.Element;
declare const memo: (props: AMapProps) => import("react/jsx-runtime").JSX.Element;
export default memo;

View File

@ -7,4 +7,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
name: string;
width: string;
editor: any;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -8,4 +8,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
content?: string;
html?: string;
origin?: string;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -8,4 +8,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
content?: string;
html?: string;
origin?: string;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -12,4 +12,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
openArray: string[];
}, {
createOne: () => Promise<void>;
}>): JSX.Element | null;
}>): import("react/jsx-runtime").JSX.Element | null;

View File

@ -26,4 +26,4 @@ export default function Render(props: WebComponentProps<EntityDict, "article", f
}>;
clearContentTip: () => void;
gotoPreview: (content?: string, title?: string) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -21,4 +21,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
createSubArticle: (name: string) => Promise<void>;
createSubArticleMenu: (name: string) => Promise<void>;
gotoDoc: (articleMenuId: string) => void;
}>): JSX.Element | null;
}>): import("react/jsx-runtime").JSX.Element | null;

View File

@ -18,4 +18,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
}, {
createOne: (name?: string) => Promise<void>;
getDefaultArticle: (rows: EntityDict['articleMenu']['OpSchema'][]) => void;
}>): JSX.Element | null;
}>): import("react/jsx-runtime").JSX.Element | null;

View File

@ -9,4 +9,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
}, {
gotoDoc: () => void;
gotoArticleDetail: (oakId: string) => void;
}>): JSX.Element | null;
}>): import("react/jsx-runtime").JSX.Element | null;

View File

@ -10,4 +10,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'message', f
setMobile: (value: string) => void;
sendCaptcha: (mobile: string) => Promise<void>;
onConfirmByMobile: (mobile: string, captcha: string, newPassword: string) => Promise<void>;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -5,4 +5,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'message', f
failTimes: number;
}, {
onConfirm: (prevPassword: string, password: string) => Promise<void>;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -6,4 +6,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'message', f
oakId: string;
}, {
goToMobile: () => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -7,7 +7,7 @@ declare type IDownloadProps = {
style?: React.CSSProperties;
filename?: string;
};
declare function Download(props: IDownloadProps): JSX.Element;
declare function Download(props: IDownloadProps): import("react/jsx-runtime").JSX.Element;
declare namespace Download {
var onDownload: (arrayBuffer: ArrayBuffer, filename: string) => void;
var base64ToBlob: (base64String: string) => Blob;

View File

@ -1,3 +1,3 @@
import './index.less';
declare const Empty: () => JSX.Element;
declare const Empty: () => import("react/jsx-runtime").JSX.Element;
export default Empty;

View File

@ -1,3 +1,3 @@
import './index.less';
declare const Empty: () => JSX.Element;
declare const Empty: () => import("react/jsx-runtime").JSX.Element;
export default Empty;

View File

@ -15,5 +15,5 @@ interface IErrorPageProps {
children?: React.ReactNode;
icon?: React.ReactNode;
}
declare function ErrorPage(props: IErrorPageProps): JSX.Element;
declare function ErrorPage(props: IErrorPageProps): import("react/jsx-runtime").JSX.Element;
export default ErrorPage;

View File

@ -15,5 +15,5 @@ declare type GridProps = {
list: Array<Item>;
onChange?: (index: number, event?: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
};
declare const _default: React.MemoExoticComponent<(props: GridProps) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: GridProps) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -17,5 +17,5 @@ declare type PageHeaderProps = {
children?: React.ReactNode;
showHeader?: boolean;
};
declare const _default: React.MemoExoticComponent<(props: PageHeaderProps) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: PageHeaderProps) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -14,5 +14,5 @@ declare type IQrCodeProps = {
successed?: boolean;
type?: EntityDict['wechatLogin']['Schema']['type'];
};
declare function QrCode(props: IQrCodeProps): JSX.Element;
declare function QrCode(props: IQrCodeProps): import("react/jsx-runtime").JSX.Element;
export default QrCode;

View File

@ -5,5 +5,5 @@ declare type Props = {
description?: string;
children?: React.ReactNode;
};
declare const _default: React.MemoExoticComponent<(props: Props) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: Props) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -5,5 +5,5 @@ declare type Props = {
description?: string;
children?: React.ReactNode;
};
declare const _default: React.MemoExoticComponent<(props: Props) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: Props) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -14,5 +14,5 @@ interface GrantProps {
rootStyle?: React.CSSProperties;
rootClassName?: string;
}
declare function Grant(props: GrantProps): JSX.Element;
declare function Grant(props: GrantProps): import("react/jsx-runtime").JSX.Element;
export default Grant;

View File

@ -14,5 +14,5 @@ interface QrCodeProps {
rootStyle?: React.CSSProperties;
rootClassName?: string;
}
declare function QrCode(props: QrCodeProps): JSX.Element;
declare function QrCode(props: QrCodeProps): import("react/jsx-runtime").JSX.Element;
export default QrCode;

View File

@ -15,5 +15,5 @@ export default function render(props: WebComponentProps<EntityDict, 'user', fals
setValue: (path: string, value: string) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -4,4 +4,4 @@ export default function Web(props: {
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -4,4 +4,4 @@ export default function WechatMp(props: {
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -5,4 +5,4 @@ export default function WechatPublic(props: {
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -3,5 +3,5 @@ declare type StyleProps = {
value?: StyleType | null;
onChange: (value: StyleType) => void;
};
export default function Render(props: StyleProps): JSX.Element;
export default function Render(props: StyleProps): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -3,4 +3,4 @@ export default function Account(props: {
account: Required<Config>['Account'];
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -2,4 +2,4 @@ import { Config } from '../../../../types/Config';
export default function Cos(props: {
cos: Required<Config>['Cos'];
setValue: (path: string, value: any) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -2,4 +2,4 @@ import { Config } from '../../../../types/Config';
export default function Cos(props: {
live: Required<Config>['Live'];
setValue: (path: string, value: any) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -2,4 +2,4 @@ import { Config } from '../../../../types/Config';
export default function Cos(props: {
map: Required<Config>['Map'];
setValue: (path: string, value: any) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -4,4 +4,4 @@ export default function Sms(props: {
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -12,4 +12,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
setValue: (path: string, value: string) => void;
removeItem: (path: string, index: number) => void;
cleanKey: (path: string, key: string) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -6,4 +6,4 @@ export default function render(props: WebComponentProps<EntityDict, 'extraFile',
avatarUrl?: string;
}, {
onPickByWeb: (files: File[]) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -1 +1 @@
export default function render(): JSX.Element;
export default function render(): import("react/jsx-runtime").JSX.Element;

View File

@ -19,5 +19,5 @@ export default function render(props: WebComponentProps<EntityDict, "extraFile",
closeModal: () => void;
onModal1Confirm: (value: number) => void;
setSelectedId: (id: number) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -30,5 +30,5 @@ export default function render(props: WebComponentProps<EntityDict, "extraFile",
getUrl: (extraFile: EntityDict['extraFile']['OpSchema']) => string;
getFileName: (extraFile: EntityDict['extraFile']['OpSchema']) => string;
eFFormatBytes: (value: number) => string;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -10,4 +10,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
}>;
}, {
onClick: (action: string) => void;
}>): JSX.Element | null;
}>): import("react/jsx-runtime").JSX.Element | null;

View File

@ -10,4 +10,4 @@ export default function render(props: WebComponentProps<EntityDict, 'address', t
resetInitialData: () => void;
downloadEnv: () => void;
resetEnv: (data: Record<string, any>) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -8,4 +8,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
size?: string;
className?: string;
style?: React.CSSProperties;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -11,4 +11,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'message', f
router: EntityDict['message']['Schema']['router'];
visitState: EntityDict['message']['Schema']['visitState'];
id: string;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -3,4 +3,4 @@ export default function render(props: {
data: {
data: MessageProps;
};
}): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;

View File

@ -5,4 +5,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'messageType
dirtyIds: string[];
messageTypes: string[];
applicationId: string;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -9,4 +9,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'token', fal
iconName?: string;
iconLarger?: string;
onClick?: () => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -13,4 +13,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'token', fal
}, {
logout: () => void;
updateAttribute: (attr: string, value: any) => Promise<void>;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -13,4 +13,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'token', fal
}, {
logout: () => void;
updateAttribute: (attr: string, value: any) => Promise<void>;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -8,4 +8,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
style?: React.CSSProperties;
}, {
goMessageList: () => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -10,4 +10,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
buttonClassName?: string;
}, {
goMessageList: () => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -6,4 +6,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'userEntityG
url: string;
expiresAt: number;
title?: string;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -4,4 +4,4 @@ export default function render(props: WebComponentProps<EntityDict, 'parasite',
loading: boolean;
illegal: boolean;
expired: boolean;
}, {}>): JSX.Element;
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -7,4 +7,4 @@ export default function render(props: WebComponentProps<EntityDict, 'parasite',
}, {
cancel: () => void;
getQrCode: () => Promise<void>;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -19,4 +19,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'parasite',
onSearch: (value: string) => void;
onSelect: (value: string) => void;
setSearchValue: (value: string) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -16,4 +16,4 @@ export default function render(props: WebComponentProps<EntityDict, 'area', true
setCheckedList: (station: string, flag: boolean) => void;
cancel: () => void;
confirm: () => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -3,5 +3,5 @@ interface IProps {
defaultValue?: number | string;
onChange: (color: string) => void;
}
declare const _default: React.MemoExoticComponent<(props: IProps) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: IProps) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -9,5 +9,5 @@ interface IProps {
onChange: (value?: any) => void;
options: IOption[];
}
declare const _default: React.MemoExoticComponent<(props: IProps) => JSX.Element>;
declare const _default: React.MemoExoticComponent<(props: IProps) => import("react/jsx-runtime").JSX.Element>;
export default _default;

View File

@ -1 +1 @@
export default function Render(this: any): JSX.Element;
export default function Render(this: any): import("react/jsx-runtime").JSX.Element;

View File

@ -19,4 +19,4 @@ export default function Render(props: WebComponentProps<EntityDict, 'token', fal
sendCaptcha: (mobile: string) => Promise<void>;
loginByMobile: (mobile: string, password?: string, captcha?: string) => Promise<void>;
setLoginMode: (value: number) => void;
}>): JSX.Element;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,14 @@
import { EntityDict } from '../../../oak-app-domain';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
entityId: string;
redirectToAfterConfirm: ED2["userEntityGrant"]["Schema"]["redirectTo"];
qrCodeType: string;
showTitle: true;
showBack: false;
onCreate: () => void;
onUpdate: (id: string) => void;
}>) => React.ReactElement;
export default _default;

View File

@ -0,0 +1,403 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("oak-domain/lib/types");
var string_1 = require("oak-domain/lib/utils/string");
var uuid_1 = require("oak-domain/lib/utils/uuid");
var assert_1 = tslib_1.__importDefault(require("assert"));
exports.default = OakComponent({
entity: 'user',
projection: function () {
var userId = this.features.token.getUserId();
var isRoot = this.features.token.isRoot();
(0, assert_1.default)(userId);
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
var userRelationFilter = {
entity: entity,
entityId: entityId,
};
if (!isRoot) {
userRelationFilter.relation = {
relationAuth$destRelation: {
sourceRelation: {
userRelation$relation: {
userId: userId,
},
},
}
};
}
return {
id: 1,
name: 1,
nickname: 1,
mobile$user: {
$entity: 'mobile',
data: {
id: 1,
userId: 1,
mobile: 1,
},
},
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,
}
}
}
}
}
}
},
filter: userRelationFilter,
},
extraFile$entity: {
$entity: 'extraFile',
data: {
id: 1,
tag1: 1,
origin: 1,
bucket: 1,
objectId: 1,
filename: 1,
extra1: 1,
type: 1,
entity: 1,
entityId: 1,
extension: 1,
sort: 1,
},
filter: {
tag1: 'avatar',
},
indexFrom: 0,
count: 1,
},
};
},
filters: [
{
filter: function () {
var userId = this.features.token.getUserId();
var isRoot = this.features.token.isRoot();
var _a = this.props, entityId = _a.entityId, entity = _a.entity;
var filter = {
entity: entity,
entityId: entityId,
};
if (!isRoot) {
filter.relation = {
relationAuth$destRelation: {
sourceRelation: {
userRelation$relation: {
userId: userId,
}
}
}
};
/* filter.relationId = {
$in: {
entity: 'relationAuth',
data: {
destRelationId: 1,
},
filter: {
sourceRelationId: {
$in: {
entity: 'userRelation',
data: {
relationId: 1,
},
filter: {
userId,
},
},
},
},
},
}; */
}
return {
userRelation$user: filter,
/* id: {
$in: {
entity: 'userRelation',
data: {
userId: 1,
},
filter,
},
}, */
};
},
},
],
isList: true,
formData: function (_a) {
var users = _a.data, props = _a.props, features = _a.features;
var entity = props.entity, entityId = props.entityId;
var filter = this.getFilterByName('fulltext');
return {
users: users === null || users === void 0 ? void 0 : users.map(function (ele) {
var _a;
var mobile$user = ele.mobile$user, extraFile$entity = ele.extraFile$entity;
var mobile = mobile$user && ((_a = mobile$user[0]) === null || _a === void 0 ? void 0 : _a.mobile);
var avatar = features.extraFile.getUrl(extraFile$entity && extraFile$entity[0]);
var user2 = Object.assign({}, ele, {
mobile: mobile,
avatar: avatar,
});
return user2;
}),
searchValue: (filter === null || filter === void 0 ? void 0 : filter.$text) && filter.$text.$search,
};
},
properties: {
entity: '',
entityId: '',
redirectToAfterConfirm: {},
qrCodeType: '',
onUpdate: function (id) { },
onCreate: function () { },
},
data: {
searchValue: '',
showActionSheet: false,
itemList: [
{
name: '从现有人员中选择(通过手机号)',
mode: 'byMobile',
},
{
name: '通过分享二维码',
mode: 'byQrCode',
},
],
idRemoveMp: '',
},
listeners: {
'entity,entityId': function (prev, next) {
if (this.state.oakFullpath) {
if (prev.entity !== next.entity || prev.entityId !== next.entityId) {
this.refresh();
}
}
},
},
lifetimes: {
attached: function () {
// this.calcRelations();
},
ready: function () {
// console.log('ready', this.props.relations);
},
},
methods: {
goUpsert: function () {
var _a = this.props, entity = _a.entity, entityId = _a.entityId, redirectToAfterConfirm = _a.redirectToAfterConfirm, qrCodeType = _a.qrCodeType, onCreate = _a.onCreate;
if (onCreate) {
onCreate();
}
else {
if (process.env.NODE_ENV === 'development') {
console.warn('userRelation将不再作为page直接使用请使用回调函数处理');
}
this.navigateTo({
url: '/userRelation/upsert',
entity: entity,
entityId: entityId,
}, {
redirectToAfterConfirm: redirectToAfterConfirm,
qrCodeType: qrCodeType,
});
}
},
goUpdate: function (id) {
var _a = this.props, entity = _a.entity, entityId = _a.entityId, onUpdate = _a.onUpdate;
if (onUpdate) {
onUpdate(id);
}
else {
if (process.env.NODE_ENV === 'development') {
console.warn('userRelation将不再作为page直接使用请使用回调函数处理');
}
this.navigateTo({
url: '/userRelation/upsert/byUser',
entity: entity,
entityId: entityId,
oakId: id,
});
}
},
confirmDelete: function (idRemove) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, entity, entityId, entityStr, users, user, relations, err_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.props, entity = _a.entity, entityId = _a.entityId;
entityStr = (0, string_1.firstLetterUpperCase)(entity);
users = this.state.users;
user = users.find(function (ele) { return ele.id === idRemove; });
relations = user.userRelation$user;
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
this.updateItem({
userRelation$user: [
{
id: (0, uuid_1.generateNewId)(),
action: 'remove',
data: {},
filter: {
id: {
$in: relations.map(function (ele) { return ele.id; }),
},
},
},
],
}, idRemove, 'revoke');
return [4 /*yield*/, this.execute()];
case 2:
_b.sent();
return [3 /*break*/, 4];
case 3:
err_1 = _b.sent();
if (err_1 instanceof types_1.OakUserUnpermittedException) {
this.setMessage({
type: 'error',
content: err_1.message,
});
return [2 /*return*/];
}
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
},
searchChangeMp: function (event) {
var value = event.detail.value;
this.addNamedFilter({
filter: {
$text: {
$search: value,
},
},
'#name': 'fulltext',
});
},
searchCancelMp: function () {
this.removeNamedFilterByName('fulltext', true);
},
searchConfirmMp: function () {
this.refresh();
},
chooseActionMp: function (e) {
var _a = this.props, entity = _a.entity, entityId = _a.entityId, redirectToAfterConfirm = _a.redirectToAfterConfirm, qrCodeType = _a.qrCodeType;
var mode = e.detail.item.mode;
if (mode === 'byMobile') {
this.navigateTo({
url: '/userRelation/upsert/byMobile',
entity: entity,
entityId: entityId,
});
}
else {
this.navigateTo({
url: '/userRelation/upsert/byUserEntityGrant',
entity: entity,
entityId: entityId,
redirectToAfterConfirm: redirectToAfterConfirm,
qrCodeType: qrCodeType,
});
}
},
cancelActionMp: function (e) {
this.setState({
showActionSheet: false,
});
},
showActionSheetMp: function () {
this.setState({
showActionSheet: true,
});
},
onItemTapMp: function (e) {
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
var id = e.currentTarget.dataset.id;
this.navigateTo({
url: '/userRelation/upsert/byUser',
oakId: id,
entity: entity,
entityId: entityId,
});
},
onDeleteMp: function (e) {
var id = e.currentTarget.dataset.id;
this.setState({
idRemoveMp: id,
});
},
cancelDeleteMp: function () {
this.setState({
idRemoveMp: '',
});
},
confirmDeleteMp: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var idRemoveMp, err_2;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
idRemoveMp = this.state.idRemoveMp;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.confirmDelete(idRemoveMp)];
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
err_2 = _a.sent();
this.setState({
idRemoveMp: '',
});
if (err_2 instanceof types_1.OakUserUnpermittedException) {
this.setMessage({
type: 'error',
content: err_2.message,
});
return [2 /*return*/];
}
return [3 /*break*/, 4];
case 4:
this.setState({
idRemoveMp: '',
});
return [2 /*return*/];
}
});
});
},
},
});

View File

@ -0,0 +1,14 @@
{
"navigationBarTitleText": "人员列表",
"usingComponents": {
"l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
"l-icon": "@oak-frontend-base/miniprogram_npm/lin-ui/icon/index",
"l-card": "@oak-frontend-base/miniprogram_npm/lin-ui/card/index",
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
"l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index",
"l-list": "@oak-frontend-base/miniprogram_npm/lin-ui/list/index",
"l-dialog": "@oak-frontend-base/miniprogram_npm/lin-ui/dialog/index",
"l-action-sheet": "@oak-frontend-base/miniprogram_npm/lin-ui/action-sheet/index",
"l-status-show": "@oak-frontend-base/miniprogram_npm/lin-ui/status-show/index"
}
}

View File

@ -0,0 +1,58 @@
/** index.wxss **/
@import "../../../config/styles/mp/index.less";
@import "../../../config/styles/mp/mixins.less";
page {
height: 100%;
background-color: @oak-bg-color-page;
}
.page-body {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
box-sizing: border-box;
align-items: stretch;
padding: 0;
.safe-area-inset-bottom();
}
.search-bar {
background-color: #fff;
padding: 10rpx;
z-index: 1;
margin-bottom: 20rpx;
display: flex;
flex-direction: row;
align-items: flex-end;
.search-input {
flex: 1;
margin-right: 10rpx;
}
}
.relation {
display: flex;
flex-wrap: wrap;
.tag {
margin: 10rpx;
}
}
.info {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: @oak-bg-color-container;
color: @oak-color-info;
}
.add {
position: fixed;
right: 20rpx;
bottom: 20rpx;
}

View File

@ -0,0 +1,67 @@
<!-- index.wxml -->
<view class="page-body">
<view class="search-bar">
<view class="search-input">
<l-input
placeholder="输入人员信息搜索"
hide-label="{{true}}"
value="{{searchValue || ''}}"
clear="{{true}}"
bind:linconfirm="searchConfirmMp"
bind:linclear="searchCancelMp"
bind:lininput="searchChangeMp"
/>
</view>
<l-button
bind:lintap="showActionSheetMp"
>
新增
</l-button>
</view>
<block wx:if="{{users && users.length > 0}}">
<block wx:for="{{users}}" wx:key="index">
<l-card
type="avatar"
image="{{item.avatar}}"
title="{{item.name || item.nickname}}"
describe="{{item.mobile}}"
>
<l-list bind:lintap="onItemTapMp" data-id="{{item.id}}">
<view class="relation" slot="left-section">
<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.relation.name ? t(entity + ':r.' + item2.relation.name) : item2.relation.display}}
</l-tag>
</block>
</view>
</l-list>
<l-button
special="{{true}}"
bind:lintap="onDeleteMp"
data-id="{{item.id}}"
slot="more"
>
<l-icon
name="delete"
color="red"
size="30"
/>
</l-button>
</l-card>
</block>
</block>
<block wx:else>
<l-status-show show="{{true}}" type="data"></l-status-show>
</block>
<l-action-sheet open-api="{{false}}" show-cancel item-list="{{itemList}}" show="{{showActionSheet}}"
bind:linitemtap="chooseActionMp" bind:lincancel="cancelActionMp"/>
<l-dialog
show="{{!!idRemoveMp}}"
type="confirm"
title="确认"
content="确认删除权限吗"
bind:lincancel="cancelDeleteMp"
bind:lintap="cancelDeleteMp"
bind:linconfirm="confirmDeleteMp"
/>
</view>

View File

@ -0,0 +1,4 @@
{
"confirmRevokeAll": "确认删除用户的所有权限吗?",
"search": "搜索用户名"
}

View File

@ -0,0 +1,49 @@
.container {
height: 100%;
flex: 1;
display: flex;
flex-direction: column;
background-color: var(--oak-bg-color-page);
}
.header {
padding: 16px;
background-color: var(--oak-bg-color-container);
margin-bottom: 10rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.avatar {
height: 56px;
width: 56px;
.text {
color: #fff;
font-size: 16px;
}
}
.description {
.row {
.label {
color: var(--oak-text-color-secondary);
font-size: 12px;
}
.value {
color: var(--oak-text-color-primary);
font-size: 12px;
}
}
}
.fab {
position: fixed;
bottom: 50px;
right: 10px;
z-index: 1;
}

View File

@ -0,0 +1,20 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {
users: (EntityDict['user']['Schema'] & {
avatar?: string;
mobile?: string;
})[];
searchValue?: string;
pagination: {
pageSize: number;
total: number;
currentPage: number;
};
entity: string;
entityId: string;
}, {
goUpsert: () => void;
confirmDelete: (id: string) => Promise<void>;
goUpdate: (id: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_mobile_1 = require("antd-mobile");
var antd_mobile_icons_1 = require("antd-mobile-icons");
var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less"));
function Render(props) {
var _a = props.methods, t = _a.t, goUpsert = _a.goUpsert, goUpdate = _a.goUpdate, addNamedFilter = _a.addNamedFilter, refresh = _a.refresh, removeNamedFilterByName = _a.removeNamedFilterByName;
var _b = props.data, entity = _b.entity, users = _b.users, searchValue = _b.searchValue;
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)("span", tslib_1.__assign({ className: mobile_module_less_1.default.header }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { flex: 1 } }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { placeholder: t('search'), value: searchValue, onChange: function (value) {
addNamedFilter({
'#name': 'name',
filter: {
$text: {
$search: value,
}
}
}, false);
}, onEnterPress: function () { return refresh(); }, clearable: true, onClear: function () { return removeNamedFilterByName('name'); } }) })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Button, tslib_1.__assign({ size: 'small', color: 'primary', onClick: function () { return goUpsert(); } }, { children: t('common::action.create') }))] })), (0, jsx_runtime_1.jsx)(antd_mobile_1.List, { children: users === null || users === void 0 ? void 0 : users.map(function (ele, index) {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_mobile_1.List.Item, tslib_1.__assign({ prefix: ele.avatar ? (0, jsx_runtime_1.jsx)(antd_mobile_1.Avatar, { className: mobile_module_less_1.default.avatar, src: ele.avatar }) : (0, jsx_runtime_1.jsx)(antd_mobile_icons_1.UserCircleOutline, { className: mobile_module_less_1.default.avatar }), extra: ele.mobile || '--', description: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: {
display: 'flex',
flexWrap: 'wrap',
} }, { children: (_a = ele.userRelation$user) === null || _a === void 0 ? void 0 : _a.map(function (ele2, index2) {
var _a, _b;
return ((0, jsx_runtime_1.jsx)(antd_mobile_1.Tag, tslib_1.__assign({ fill: "outline" }, { children: ((_a = ele2.relation) === null || _a === void 0 ? void 0 : _a.name) ? t(entity + ':r.' + ele2.relation.name) : (_b = ele2.relation) === null || _b === void 0 ? void 0 : _b.display }), index));
}) })), onClick: function () { return goUpdate(ele.id); } }, { children: ele.name || ele.nickname || '--' })));
}) })] })));
}
exports.default = Render;

View File

@ -0,0 +1,8 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

View File

@ -0,0 +1,14 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {
users: EntityDict['user']['Schema'][];
searchValue?: string;
entity: string;
entityId: string;
showBack: boolean;
showTitle: boolean;
}, {
goUpsert: () => void;
goUpdate: (id: string) => void;
confirmDelete: (id: string) => Promise<void>;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
// import UserEntityGrantList from '../../../pages/userEntityGrant/list';
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function Render(props) {
var _this = this;
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.users, users = _b === void 0 ? [] : _b, entity = _a.entity, entityId = _a.entityId, oakLoading = _a.oakLoading;
var _c = oakPagination || {}, pageSize = _c.pageSize, total = _c.total, currentPage = _c.currentPage;
var _d = props.methods, goUpsert = _d.goUpsert, t = _d.t, setCurrentPage = _d.setCurrentPage, setPageSize = _d.setPageSize, confirmDelete = _d.confirmDelete, goUpdate = _d.goUpdate;
var _e = tslib_1.__read((0, react_1.useState)(undefined), 2), idRemove = _e[0], setIdRemove = _e[1];
var _f = tslib_1.__read((0, react_1.useState)(false), 2), inviteVisible = _f[0], setInviteVisible = _f[1];
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return goUpsert(); } }, { children: "\u6DFB\u52A0" })) })), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, rowKey: "id", columns: [
{
width: 100,
dataIndex: 'index',
title: '序号',
render: function (value, record, index) { return index + 1; },
},
{
dataIndex: 'avatar',
title: '头像',
render: function (value, record, index) {
return value ? ((0, jsx_runtime_1.jsx)(antd_1.Avatar, { src: value, shape: "circle" })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u672A\u8BBE\u7F6E" }));
},
},
{
dataIndex: 'name',
title: '姓名',
},
{
dataIndex: 'nickname',
title: '昵称',
},
{
dataIndex: 'mobile',
title: '手机号',
},
{
dataIndex: 'relations',
title: '权限',
render: function (value, record, index) {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_1.Space, { children: (_a = record.userRelation$user) === null || _a === void 0 ? void 0 : _a.map(function (ele, index) { return ((0, jsx_runtime_1.jsx)(antd_1.Tag, { children: ele.relation.name ? t(entity + ':r.' + ele.relation.name) : ele.relation.display }, index)); }) }));
},
},
{
title: '操作',
dataIndex: 'operate',
render: function (value, record, index) {
var _a, _b;
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)("a", tslib_1.__assign({ onClick: function (e) { return goUpdate(record.id); } }, { children: !!((_a = record.userRelation$user) === null || _a === void 0 ? void 0 : _a.length)
? t('common::action.update')
: t('common::action.grant') })), !!((_b = record.userRelation$user) === null || _b === void 0 ? void 0 : _b.length) && ((0, jsx_runtime_1.jsx)("a", tslib_1.__assign({ style: {
color: 'var(--oak-color-error)',
}, onClick: function () {
return setIdRemove(record.id);
} }, { children: t('common::action.revoke') })))] }));
},
},
], dataSource: users, pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: function (current, size) {
setPageSize(current);
},
onChange: function (page, pageSize) {
setCurrentPage(page);
},
} })] })), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: t('common::areYouSure'), open: !!idRemove, onOk: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, confirmDelete(idRemove)];
case 1:
_a.sent();
setIdRemove(undefined);
return [2 /*return*/];
}
});
}); }, onCancel: function () { return setIdRemove(undefined); }, cancelText: t('common::action.cancel'), okText: t('common::action.confirm') }, { children: (0, jsx_runtime_1.jsx)("p", { children: t('confirmRevokeAll') }) }))] }));
}
exports.default = Render;

View File

@ -0,0 +1,8 @@
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, true, {
nameProperty: string;
user: import("oak-domain/lib/types").GeneralEntityShape;
relations: string[];
oakEntity: string | number;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var string_1 = require("oak-domain/lib/utils/string");
exports.default = OakComponent({
isList: true,
formData: function (_a) {
var _this = this;
var data = _a.data;
var _b = this.props, nameProperty = _b.nameProperty, oakEntity = _b.oakEntity;
var entityStr = (0, string_1.firstLetterUpperCase)(oakEntity);
var rows = data === null || data === void 0 ? void 0 : data.map(function (ele) {
var _a = ele, id = _a.id, _b = nameProperty, name = _a[_b], _c = "user".concat(entityStr, "$").concat(oakEntity), userEntity = _a[_c];
var relations = userEntity === null || userEntity === void 0 ? void 0 : userEntity.map(function (ele) { return ele.relation; });
var hasRelation = _this.props.relations.map(function (ele2) {
return relations.includes(ele2);
});
return {
id: id,
name: name,
hasRelation: hasRelation,
};
});
return {
rows: rows,
};
},
properties: {
nameProperty: '',
user: {},
relations: [],
oakEntity: '',
},
methods: {
onChange: function (input) {
var _a = this.resolveInput(input, ['checked']), dataset = _a.dataset, checked = _a.checked;
var _b = dataset, entityId = _b.id, relation = _b.relation, index = _b.index;
var _c = this.props, oakEntity = _c.oakEntity, user = _c.user;
var entityStr = (0, string_1.firstLetterUpperCase)(oakEntity);
// todo 需要修改为最新写法
// this.toggleNode(
// {
// relation,
// userId: user.id,
// },
// checked,
// `${index}.user${entityStr}$${oakEntity}`
// );
},
confirm: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.execute()];
case 1:
_a.sent();
return [4 /*yield*/, this.navigateBack()];
case 2:
_a.sent();
return [2 /*return*/];
}
});
});
},
},
});

View File

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "修改权限",
"usingComponents": {
"t-divider": "@oak-frontend-base/miniprogram_npm/tdesign/divider/divider",
"t-button": "@oak-frontend-base/miniprogram_npm/tdesign/button/button",
"t-switch": "@oak-frontend-base/miniprogram_npm/tdesign/switch/switch"
}
}

View File

@ -0,0 +1,159 @@
/** index.wxss **/
@import "../../../config/styles/mp/index.less";
@import "../../../config/styles/mp/mixins.less";
page {
height: 100%;
}
.container {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
box-sizing: border-box;
align-items: stretch;
padding: 0;
.safe-area-inset-bottom();
}
.primary-bg {
width: 100%;
height: 140rpx;
background-color: @primary-color;
}
.img {
width: 180rpx;
height: 180rpx;
margin: 0 auto;
border-radius: 50%;
background-color: @bg-color-fade;
}
.row-end {
display: flex;
justify-content: flex-end;
}
.white-bg {
display: flex;
flex-direction: column;
padding: @spacer;
}
.content {
display: flex;
flex-direction: column;
transform: translateY(-110rpx);
}
.name {
margin: @spacer auto;
font-size: @font-size-base;
color: @text-level-2-color;
}
.mobile {
margin: 0 auto;
font-size: @font-size-base;
color: @text-level-3-color;
}
.tag-view {
display: flex;
justify-content: center;
flex-wrap: wrap;
margin-bottom: @spacer;
}
.tag {
margin: 2rpx;
}
.btn-view {
display: flex;
justify-content: center;
}
.check-view {
width: 700rpx;
display: flex;
flex: 1;
flex-direction: column;
background-color: #fff;
}
.col {
display: flex;
flex-direction: column;
flex: 1;
}
.list {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.singleRelationItem {
display: flex;
padding: 18rpx;
flex-direction: row;
align-items: center;
width: 92%;
box-shadow: 0 4rpx 20rpx 0 rgba(212, 217, 223, 0.5);
border-radius: 4px;
.name {
color: @text-level-3-color;
flex: 1;
margin-right: 10rpx;
}
}
.multiRelationItem {
display: flex;
padding: 18rpx;
flex-direction: column;
align-items: stretch;
width: 92%;
box-shadow: 0 4rpx 20rpx 0 rgba(212, 217, 223, 0.5);
border-radius: 4px;
.name {
color: @text-level-3-color;
}
.relationList {
display: flex;
flex-direction: row;
.relationItem {
display: flex;
flex-direction: column;
align-items: center;
padding: 10rpx;
text {
color: @text-level-4-color;
font-size: @font-size-base;
}
}
}
}
.btn-container {
position: fixed;
bottom: 0;
display: flex;
flex-direction: row;
width: 100%;
.btn {
flex: 1;
}
padding-left: 10rpx;
padding-right: 10rpx;
}

View File

@ -0,0 +1,32 @@
<!-- index.wxml -->
<view class="container">
<view class="primary-bg"></view>
<view class="white-bg">
<view class="content">
<image mode="aspectFill" class="img" src="{{user.avatar}}" lazy-load></image>
<text class="name">{{user.name || user.nickname || '--'}}</text>
<text class="mobile">{{user.mobile || '--'}}</text>
<t-divider />
<view class="list" wx:for="{{rows}}" wx:key="idx">
<block wx:if="{{relations.length === 1}}">
<view class="singleRelationItem">
<view class="name">{{item.name}}</view>
<t-switch value="{{item.hasRelation[0]}}" bind:change="onChange" data-id="{{item.id}}" data-relation="{{relations[0]}}" data-index="{{index}}" />
</view>
</block>
<block wx:else>
<view class="multiRelationItem">
<view class="name">{{item.name}}</view>
<view class="relationList">
<view class="relationItem" wx:for="{{relations}}" wx:key="idx2" wx:for-item="relation" wx:for-index="index2">
<t-switch value="{{item.hasRelation[index2]}}" bind:change="onChange" data-id="{{item.id}}" data-relation="{{relation}}" data-index="{{index}}" />
<text>{{relation}}</text>
</view>
</view>
</view>
</block>
</view>
</view>
</view>
<t-button theme="primary" style="margin: 16rpx" disabled="{{!oakDirty}}" block size="large" bind:tap="confirm" content="确定" />
</view>

View File

@ -0,0 +1 @@
export default function render(this: any): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
function render() {
var rows = this.state.rows;
return ((0, jsx_runtime_1.jsx)("div", {}));
}
exports.default = render;

View File

@ -0,0 +1,7 @@
.container {
height: 100vh;
display: flex;
flex-direction: column;
}

View File

@ -0,0 +1,8 @@
/// <reference types="react" />
import { EntityDict } from '../../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "mobile", false, {
entity: keyof EntityDict;
entityId: string;
relations: import("../../../../oak-app-domain/Relation/Schema").OpSchema[];
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -0,0 +1,147 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var uuid_1 = require("oak-domain/lib/utils/uuid");
var validator_1 = require("oak-domain/lib/utils/validator");
exports.default = OakComponent({
entity: 'mobile',
projection: {
id: 1,
mobile: 1,
ableState: 1,
userId: 1,
},
isList: false,
formData: function (_a) {
var mobile = _a.data;
var oakFullpath = this.state.oakFullpath;
var userRelations = oakFullpath && this.features.runningTree.getOperations("".concat(oakFullpath, ".user.userRelation$user"));
return {
userId: mobile === null || mobile === void 0 ? void 0 : mobile.userId,
legal: userRelations && userRelations.length > 0,
};
},
properties: {
entity: '',
entityId: '',
relations: [],
},
data: {
mobileValue: '',
mobileValueReady: false,
isNew: false,
},
methods: {
onMobileChange: function (value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var mobileValueReady, data;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
mobileValueReady = (0, validator_1.isMobile)(value);
if (!mobileValueReady) return [3 /*break*/, 2];
return [4 /*yield*/, this.features.cache.refresh('mobile', {
data: {
id: 1,
mobile: 1,
ableState: 1,
userId: 1,
},
filter: {
mobile: value,
ableState: 'enabled',
}
})];
case 1:
data = (_a.sent()).data;
if (data.length > 0) {
this.clean();
this.setId(data[0].id);
this.setState({
isNew: false,
});
}
else {
this.clean();
this.setState({
isNew: true,
});
this.create({
mobile: value,
user: {
id: (0, uuid_1.generateNewId)(),
action: 'create',
data: {
id: (0, uuid_1.generateNewId)(),
}
}
});
}
return [3 /*break*/, 3];
case 2:
this.clean();
this.unsetId();
_a.label = 3;
case 3:
this.setState({
mobileValueReady: mobileValueReady,
mobileValue: value,
});
return [2 /*return*/];
}
});
});
},
onConfirm: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var userValue;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.state.isNew) {
userValue = this.getFreshValue('user');
if (!userValue.name) {
this.setMessage({
type: 'error',
content: '用户姓名未填写',
});
return [2 /*return*/];
}
if (!userValue.password) {
this.setMessage({
type: 'error',
content: '用户密码未设置',
});
return [2 /*return*/];
}
}
return [4 /*yield*/, this.execute()];
case 1:
_a.sent();
this.setState({
mobileValue: '',
mobileValueReady: false,
});
this.unsetId();
return [2 /*return*/];
}
});
});
},
onReset: function () {
this.clean();
this.setState({
mobileValue: '',
mobileValueReady: false,
});
this.unsetId();
},
searchChangeMp: function (e) {
var value = e.detail.value;
this.onMobileChange(value);
},
searchCancelMp: function () {
this.onReset();
}
},
});

View File

@ -0,0 +1,14 @@
{
"navigationBarTitleText": "添加权限",
"usingComponents": {
"l-status-show": "@oak-frontend-base/miniprogram_npm/lin-ui/status-show/index",
"l-notice-bar": "@oak-frontend-base/miniprogram_npm/lin-ui/notice-bar/index",
"l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
"l-icon": "@oak-frontend-base/miniprogram_npm/lin-ui/icon/index",
"l-card": "@oak-frontend-base/miniprogram_npm/lin-ui/card/index",
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
"l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index",
"l-list": "@oak-frontend-base/miniprogram_npm/lin-ui/list/index",
"relation-on-user": "../onUser/index"
}
}

View File

@ -0,0 +1,30 @@
@import "../../../../config/styles/mp/index.less";
@import "../../../../config/styles/mp/mixins.less";
page {
height: 100%;
background-color: @oak-bg-color-page;
}
.page-body {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
box-sizing: border-box;
align-items: stretch;
padding: 0;
background-color: @oak-bg-color-container;
.r-o-u {
flex: 1;
display: flex;
flex-direction: column;
}
}
.search-bar {
padding: 10rpx;
z-index: 1;
margin-bottom: 20rpx;
}

View File

@ -0,0 +1,43 @@
<view class="page-body">
<l-notice-bar
front-icon-name="notification"
show="{{true}}"
>
必须在系统中登记了手机号的用户才可通过这里搜索
</l-notice-bar>
<view class="search-bar">
<l-input
type="digit"
maxlength="11"
placeholder="输入完整手机号搜索"
hide-label="{{true}}"
value="{{mobileValue || ''}}"
clear="{{true}}"
bind:linclear="searchCancelMp"
bind:lininput="searchChangeMp"
/>
</view>
<block wx:if="{{mobileValueReady}}">
<block wx:if="{{userId}}">
<relation-on-user
class="r-o-u"
oakId="{{userId}}"
mobile="{{mobileValue}}"
oakPath="{{oakFullpath ? oakFullpath + '.user' : undefined}}"
oakAutoUnmount="{{true}}"
entity="{{entity}}"
entityId="{{entityId}}"
relations="{{relations}}"
isComponent="{{true}}"
/>
</block>
<block wx:else>
<l-status-show show="{{true}}" type="error" describe="查无此用户"></l-status-show>
</block>
</block>
<l-button disabled="{{!oakDirty}}" size="long" bind:lintap="onConfirm">
{{t('common::action.confirm')}}
</l-button>
</view>

View File

@ -0,0 +1,3 @@
{
"inputMobile": "请输入手机号查找"
}

View File

@ -0,0 +1,12 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.btn-container {
width: 100%;
display: flex;
flex-direction: row;
}

View File

@ -0,0 +1,14 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, {
entity: keyof EntityDict;
entityId: string;
relations: EntityDict['relation']['OpSchema'][];
mobileValue: string;
mobileValueReady: boolean;
userId: string;
}, {
onMobileChange: (value: string) => Promise<void>;
onConfirm: () => Promise<void>;
onReset: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_mobile_1 = require("antd-mobile");
var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less"));
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
function Render(props) {
var _a = props.data, mobileValue = _a.mobileValue, mobileValueReady = _a.mobileValueReady, relations = _a.relations, entity = _a.entity, entityId = _a.entityId, userId = _a.userId, oakFullpath = _a.oakFullpath, oakExecutable = _a.oakExecutable, oakDirty = _a.oakDirty;
var _b = props.methods, onConfirm = _b.onConfirm, onMobileChange = _b.onMobileChange, onReset = _b.onReset, t = _b.t;
return ((0, jsx_runtime_1.jsxs)(antd_mobile_1.Form, tslib_1.__assign({ footer: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default['btn-container'] }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.Button, tslib_1.__assign({ color: "primary", style: { flex: 2 }, onClick: function () {
onConfirm();
}, disabled: !oakExecutable }, { children: t('common::action.confirm') })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Button, tslib_1.__assign({ style: { flex: 1 }, onClick: function () { return onReset(); } }, { children: t('common::reset') }))] })) }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: "\u624B\u673A\u53F7\u7801", name: "mobile", rules: [
{
required: true,
message: '手机号不能为空',
},
{
min: 11,
message: '请输入11位手机号',
},
{
max: 11,
message: '请输入11位手机号',
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { maxLength: 11, value: mobileValue, onChange: function (value) {
onMobileChange(value);
}, placeholder: t('inputMobile'), type: "tel", clearable: true }) }) })), mobileValueReady && userId && ((0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? "".concat(oakFullpath, ".user")
: undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId }))] })));
}
exports.default = Render;

View File

@ -0,0 +1,17 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.formContainer {
padding-top: 32px;
width: 676px;
margin: 0 auto;
}
.tip {
font-size: 12px;
color: var(--oak-warning-color);
}

View File

@ -0,0 +1,16 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, {
entity: keyof EntityDict;
entityId: string;
relations: EntityDict['relation']['OpSchema'][];
mobileValue: string;
mobileValueReady: boolean;
userId: string;
legal: boolean;
isNew: boolean;
}, {
onMobileChange: (value: string) => Promise<void>;
onConfirm: () => Promise<void>;
onReset: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
function Render(props) {
var _this = this;
var _a = props.data, mobileValue = _a.mobileValue, mobileValueReady = _a.mobileValueReady, relations = _a.relations, entity = _a.entity, entityId = _a.entityId, userId = _a.userId, oakFullpath = _a.oakFullpath, oakExecutable = _a.oakExecutable, legal = _a.legal, isNew = _a.isNew;
var _b = props.methods, onConfirm = _b.onConfirm, onMobileChange = _b.onMobileChange, onReset = _b.onReset, t = _b.t;
var _c = tslib_1.__read((0, react_1.useState)(false), 2), passwordConfirm = _c[0], setPasswordConfirm = _c[1];
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u624B\u673A\u53F7\u7801", required: true, name: "mobile", rules: [
{
message: '手机号不能为空',
},
{
min: 11,
message: '请输入11位手机号',
},
{
max: 11,
message: '请输入11位手机号',
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { maxLength: 11, value: mobileValue, onChange: function (e) {
var strValue = e.target.value;
onMobileChange(strValue);
}, placeholder: "\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801", type: "tel" }) }) })) })), mobileValueReady && userId && ((0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? "".concat(oakFullpath, ".user")
: undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId, setPasswordConfirm: setPasswordConfirm })), (0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ style: { flex: 2 }, type: "primary", onClick: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, onConfirm()];
case 1:
_a.sent();
setPasswordConfirm(false);
return [2 /*return*/];
}
});
}); }, disabled: !legal || !oakExecutable || (isNew && !passwordConfirm) }, { children: t('common::action.confirm') })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return onReset(); }, style: { flex: 1 } }, { children: t('common::reset') }))] }) })) }))] })));
}
exports.default = Render;

View File

@ -0,0 +1,8 @@
import { EntityDict } from '../../../../oak-app-domain';
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
entityId: string;
}>) => React.ReactElement;
export default _default;

View File

@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
isList: false,
properties: {
entity: '',
entityId: '',
},
data: {
relations: [],
},
lifetimes: {
ready: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, entity, entityId, isRoot, filter, userId, relations;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.props, entity = _a.entity, entityId = _a.entityId;
isRoot = this.features.token.isRoot();
filter = {
entity: entity,
$or: [
{
entityId: entityId,
},
{
entityId: {
$exists: false,
},
}
],
};
if (!isRoot) {
userId = this.features.token.getUserId();
filter.relationAuth$destRelation = {
sourceRelation: {
userRelation$relation: {
userId: userId,
},
},
};
}
return [4 /*yield*/, this.features.cache.refresh('relation', {
data: {
id: 1,
entity: 1,
entityId: 1,
name: 1,
display: 1,
},
filter: filter,
})];
case 1:
relations = (_b.sent()).data;
this.setState({
relations: relations,
});
return [2 /*return*/];
}
});
});
}
},
methods: {
onConfirm: function () {
this.execute();
},
onReset: function () {
this.clean();
}
}
});

View File

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "添加权限",
"usingComponents": {
"onUser": "./../onUser/index",
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index"
}
}

View File

@ -0,0 +1,16 @@
/** index.wxss **/
@import "../../../../config/styles/mp/index.less";
@import "../../../../config/styles/mp/mixins.less";
page {
height: 100%;
display: flex;
flex-direction: column;
}
.container {
display: flex;
flex-direction: column;
flex: 1;
}

View File

@ -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">
{{t('common::action.confirm')}}
</l-button>
</view>

View File

@ -0,0 +1,12 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.btn-container {
width: 100%;
display: flex;
flex-direction: row;
}

View File

@ -0,0 +1,11 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {
relations: EntityDict['relation']['OpSchema'][];
entity: keyof EntityDict;
entityId: string;
oakId: string;
}, {
onConfirm: () => Promise<void>;
onReset: () => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_mobile_1 = require("antd-mobile");
var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less"));
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
function Render(props) {
var _a = props.data, relations = _a.relations, entity = _a.entity, entityId = _a.entityId, oakId = _a.oakId, oakDirty = _a.oakDirty, oakFullpath = _a.oakFullpath, oakExecutable = _a.oakExecutable;
var _b = props.methods, onConfirm = _b.onConfirm, onReset = _b.onReset, t = _b.t;
return ((0, jsx_runtime_1.jsx)(antd_mobile_1.Form, tslib_1.__assign({ footer: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default['btn-container'] }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.Button, tslib_1.__assign({ color: "primary", style: { flex: 2 }, onClick: function () {
onConfirm();
}, disabled: oakExecutable !== true }, { children: t('common::action.confirm') })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Button, tslib_1.__assign({ style: { flex: 1 }, onClick: function () { return onReset(); } }, { children: t('common::reset') }))] })) }, { children: (0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath && "".concat(oakFullpath, ".user"), entity: entity, entityId: entityId, relations: relations, oakId: oakId }) })));
}
exports.default = Render;

View File

@ -0,0 +1,8 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}

Some files were not shown because too many files have changed in this diff Show More