修改功能
This commit is contained in:
@@ -14,6 +14,15 @@
|
||||
})(typeof globalThis !== 'undefined' ? globalThis : window, function (root) {
|
||||
'use strict';
|
||||
|
||||
function confirmAction(message) {
|
||||
if (root.ProfileUI && typeof root.ProfileUI.confirmAction === 'function') {
|
||||
return root.ProfileUI.confirmAction(message);
|
||||
}
|
||||
return Promise.resolve(!root['confirm'] || root['confirm'](message));
|
||||
}
|
||||
|
||||
var MediaDisplay = root.MediaDisplay || (typeof require === 'function' ? require('./media-display.js') : null);
|
||||
|
||||
var documentRef = root.document;
|
||||
var selectedPersonId = '';
|
||||
var editingPersonId = '';
|
||||
@@ -200,7 +209,7 @@
|
||||
].forEach(function (field) {
|
||||
if (item && item[field] !== undefined && item[field] !== null) person[field] = String(item[field]);
|
||||
});
|
||||
['appUserId', 'genealogyId', 'fatherId', 'motherId', 'avatarOssId'].forEach(function (field) {
|
||||
['appUserId', 'genealogyId', 'fatherId', 'motherId'].forEach(function (field) {
|
||||
if (item && item[field] !== undefined && item[field] !== null) {
|
||||
var value = normalizeId(item[field]);
|
||||
|
||||
@@ -212,6 +221,10 @@
|
||||
}
|
||||
});
|
||||
if (invalidId) return null;
|
||||
if (item && item.avatarFile !== undefined && item.avatarFile !== null) {
|
||||
person.avatarFile = MediaDisplay && MediaDisplay.normalizeFileAccess(item.avatarFile);
|
||||
if (!person.avatarFile) return null;
|
||||
}
|
||||
if (toIntegerOrUndefined(item && item.generation) !== undefined) person.generation = toIntegerOrUndefined(item.generation);
|
||||
if (toIntegerOrUndefined(item && item.sortOrder) !== undefined) person.sortOrder = toIntegerOrUndefined(item.sortOrder);
|
||||
return person;
|
||||
@@ -315,6 +328,7 @@
|
||||
var selected = person.personId === selectedPersonId ? ' is-selected' : '';
|
||||
|
||||
return '<button class="module-row lineage-row' + selected + '" type="button" data-lineage-person="' + escapeHtml(person.personId) + '">' +
|
||||
(MediaDisplay ? MediaDisplay.renderAvatar(person.avatarFile, { name: person.name, className: 'lineage-avatar-media' }) : '') +
|
||||
'<div><h3>' + escapeHtml(person.name) + '</h3><p>' + escapeHtml(getPersonSummary(person)) + '</p></div>' +
|
||||
'<span class="pill">查看</span></button>';
|
||||
}).join('');
|
||||
@@ -338,6 +352,7 @@
|
||||
if (spouses) branches += '<ul><li><span>配偶</span><ul>' + spouses + '</ul></li></ul>';
|
||||
if (children) branches += '<ul><li><span>子女</span><ul>' + children + '</ul></li></ul>';
|
||||
return '<li><button class="lineage-node" type="button" data-lineage-person="' + escapeHtml(person.personId) + '">' +
|
||||
(MediaDisplay ? MediaDisplay.renderAvatar(person.avatarFile, { name: person.name, className: 'lineage-node-avatar' }) : '') +
|
||||
'<strong>' + escapeHtml(person.name) + '</strong><span>' + escapeHtml(getPersonSummary(person)) + '</span></button>' + branches + '</li>';
|
||||
}
|
||||
|
||||
@@ -630,6 +645,9 @@
|
||||
queryAll('[data-lineage-relation], [data-lineage-form] button, [data-lineage-form] input, [data-lineage-form] select, [data-lineage-form] textarea, [data-lineage-edit], [data-lineage-disable]').forEach(function (control) {
|
||||
control.disabled = writeDisabled;
|
||||
});
|
||||
queryAll('[data-lineage-relation]').forEach(function (control) {
|
||||
control.disabled = writeDisabled || !selectedPersonId;
|
||||
});
|
||||
queryAll('[data-lineage-search], [data-lineage-person-options]').forEach(function (control) {
|
||||
control.disabled = writePending;
|
||||
});
|
||||
@@ -906,7 +924,7 @@
|
||||
if (writePending || !managementAccess || redirectUnauthorized(api)) return;
|
||||
genealogyId = requireGenealogyId();
|
||||
if (!genealogyId || !personId) return;
|
||||
if (root.confirm && !root.confirm('确认停用“' + (person ? person.name : '该成员') + '”吗?有正常子女时后端会拒绝停用。')) return;
|
||||
if (!await confirmAction('确认停用“' + (person ? person.name : '该成员') + '”吗?有正常子女时后端会拒绝停用。')) return;
|
||||
setWritePending(true);
|
||||
setActionStatus('正在停用成员…', 'loading');
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user