userRelation适配frontend的改动
This commit is contained in:
parent
4996868d44
commit
6355b6c55d
|
|
@ -1,6 +1,7 @@
|
|||
"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',
|
||||
|
|
@ -55,10 +56,16 @@ exports.default = OakComponent({
|
|||
}
|
||||
else {
|
||||
this.clean();
|
||||
this.unsetId();
|
||||
// todo
|
||||
this.update({
|
||||
this.create({
|
||||
mobile: value,
|
||||
user: {
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: (0, uuid_1.generateNewId)(),
|
||||
password: '12345678',
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return [3 /*break*/, 3];
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function Render(props) {
|
|||
] }, { 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 && ((0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? "".concat(oakFullpath, ".user")
|
||||
}, 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 })), (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({ type: "primary", onClick: function () {
|
||||
onConfirm();
|
||||
}, disabled: !oakExecutable }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return onReset(); } }, { children: "\u91CD\u7F6E" }))] }) })) }))] })));
|
||||
|
|
|
|||
|
|
@ -31,13 +31,14 @@ exports.default = OakComponent({
|
|||
isList: false,
|
||||
formData: function (_a) {
|
||||
var user = _a.data;
|
||||
var _b = user || {}, name = _b.name, nickname = _b.nickname, password = _b.password, extraFile$entity = _b.extraFile$entity;
|
||||
var _b = user || {}, name = _b.name, nickname = _b.nickname, password = _b.password, extraFile$entity = _b.extraFile$entity, $$createAt$$ = _b.$$createAt$$;
|
||||
var avatar = this.features.extraFile.getUrl(extraFile$entity && extraFile$entity[0]);
|
||||
return {
|
||||
avatar: avatar,
|
||||
password: password,
|
||||
name: name,
|
||||
nickname: nickname,
|
||||
isNew: $$createAt$$ === 1,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
|
|
@ -56,15 +57,9 @@ exports.default = OakComponent({
|
|||
lifetimes: {
|
||||
ready: function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var entity, isCreation;
|
||||
var entity;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
entity = this.props.entity;
|
||||
isCreation = this.isCreation();
|
||||
if (isCreation) {
|
||||
this.update({
|
||||
password: '12345678',
|
||||
});
|
||||
}
|
||||
this.setState({
|
||||
userRelationRelativePath: "user".concat((0, string_1.firstLetterUpperCase)(entity), "$user"),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
|
|||
relations: string[];
|
||||
entity: string;
|
||||
entityId: string;
|
||||
isNew: boolean;
|
||||
}, {
|
||||
onMobileChange: (value: string) => Promise<void>;
|
||||
onConfirm: () => Promise<void>;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@ var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
|||
var userRelation_1 = tslib_1.__importDefault(require("./userRelation"));
|
||||
var string_1 = require("oak-domain/lib/utils/string");
|
||||
function Render(props) {
|
||||
var _a = props.data, name = _a.name, nickname = _a.nickname, password = _a.password, relations = _a.relations, oakFullpath = _a.oakFullpath, entity = _a.entity, entityId = _a.entityId;
|
||||
var _b = props.methods, t = _b.t, update = _b.update, isCreation = _b.isCreation;
|
||||
var isNew = oakFullpath && isCreation();
|
||||
var _a = props.data, name = _a.name, isNew = _a.isNew, nickname = _a.nickname, password = _a.password, relations = _a.relations, oakFullpath = _a.oakFullpath, entity = _a.entity, entityId = _a.entityId;
|
||||
var _b = props.methods, t = _b.t, update = _b.update;
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { style: { marginBottom: 0 }, label: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.tip }, { children: !isNew ? t('existedUser') : t('newUser') })), colon: false }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name'), name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { generateNewId } from 'oak-domain/lib/utils/uuid';
|
||||
import { isMobile } from 'oak-domain/lib/utils/validator';
|
||||
import { EntityDict } from '../../../../general-app-domain';
|
||||
|
||||
export default OakComponent({
|
||||
entity: 'mobile',
|
||||
|
|
@ -45,11 +47,17 @@ export default OakComponent({
|
|||
}
|
||||
else {
|
||||
this.clean();
|
||||
this.unsetId();
|
||||
// todo
|
||||
this.update({
|
||||
this.create({
|
||||
mobile: value,
|
||||
});
|
||||
user: {
|
||||
id: generateNewId(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: generateNewId(),
|
||||
password: '12345678',
|
||||
}
|
||||
}
|
||||
} as EntityDict['mobile']['CreateSingle']['data']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'mobile', fa
|
|||
</>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{mobileValueReady && (
|
||||
{mobileValueReady && userId && (
|
||||
<OnUser
|
||||
oakAutoUnmount={true}
|
||||
oakPath={oakFullpath ? `${oakFullpath}.user`
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default OakComponent({
|
|||
},
|
||||
isList: false,
|
||||
formData({ data: user }) {
|
||||
const { name, nickname, password, extraFile$entity } = user || {};
|
||||
const { name, nickname, password, extraFile$entity, $$createAt$$ } = user || {};
|
||||
const avatar = this.features.extraFile.getUrl(
|
||||
extraFile$entity && extraFile$entity[0]
|
||||
);
|
||||
|
|
@ -39,6 +39,7 @@ export default OakComponent({
|
|||
password,
|
||||
name,
|
||||
nickname,
|
||||
isNew: $$createAt$$ === 1,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
|
|
@ -57,14 +58,6 @@ export default OakComponent({
|
|||
lifetimes: {
|
||||
async ready() {
|
||||
const { entity } = this.props;
|
||||
const isCreation = this.isCreation();
|
||||
if (isCreation) {
|
||||
this.update(
|
||||
{
|
||||
password: '12345678',
|
||||
},
|
||||
);
|
||||
}
|
||||
this.setState({
|
||||
userRelationRelativePath: `user${firstLetterUpperCase(
|
||||
entity!
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
|
|||
relations: string[];
|
||||
entity: string;
|
||||
entityId: string;
|
||||
isNew: boolean;
|
||||
}, {
|
||||
onMobileChange: (value: string) => Promise<void>;
|
||||
onConfirm: () => Promise<void>;
|
||||
onReset: () => void;
|
||||
}>) {
|
||||
const { name, nickname, password, relations, oakFullpath, entity, entityId } = props.data;
|
||||
const { t, update, isCreation } = props.methods;
|
||||
const isNew = oakFullpath && isCreation();
|
||||
const { name, isNew, nickname, password, relations, oakFullpath, entity, entityId } = props.data;
|
||||
const { t, update } = props.methods;
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue