userRelationList页面上监听relations的变化

This commit is contained in:
Xu Chang 2023-01-18 23:09:09 +08:00
parent f1e8f2584d
commit f9beba6c1e
2 changed files with 24 additions and 2 deletions

View File

@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("oak-domain/lib/types");
var lodash_1 = require("oak-domain/lib/utils/lodash");
var string_1 = require("oak-domain/lib/utils/string");
var uuid_1 = require("oak-domain/lib/utils/uuid");
exports.default = OakComponent({
@ -140,8 +141,18 @@ exports.default = OakComponent({
this.refresh();
}
},
'relations': function (value) {
var relations = this.props.relations;
if (this.state.oakFullpath && (value.length !== relations.length || (0, lodash_1.difference)(value, relations).length > 0)) {
this.refresh();
}
}
},
lifetimes: {
ready: function () {
console.log('ready', this.props.relations);
}
},
lifetimes: {},
methods: {
goUpsert: function () {
var _a = this.props, entity = _a.entity, entityId = _a.entityId, relations = _a.relations, redirectToAfterConfirm = _a.redirectToAfterConfirm;

View File

@ -1,4 +1,5 @@
import { OakUserUnpermittedException } from 'oak-domain/lib/types';
import { difference } from 'oak-domain/lib/utils/lodash';
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
import { generateNewId } from 'oak-domain/lib/utils/uuid';
import { EntityDict } from '../../../general-app-domain';
@ -135,8 +136,18 @@ export default OakComponent({
this.refresh();
}
},
'relations'(value) {
const { relations } = this.props;
if (this.state.oakFullpath && (value.length !== relations.length || difference(value, relations).length > 0)) {
this.refresh();
}
}
},
lifetimes: {
ready() {
console.log('ready', this.props.relations);
}
},
lifetimes: {},
methods: {
goUpsert() {
const { entity, entityId, relations, redirectToAfterConfirm } =