|
@@ -133,6 +133,10 @@ export class AdminResourceComponent implements OnInit {
|
|
|
readonly storeStyles = signal<Record<string, unknown>[]>([]);
|
|
readonly storeStyles = signal<Record<string, unknown>[]>([]);
|
|
|
readonly updatingStore = signal(false);
|
|
readonly updatingStore = signal(false);
|
|
|
readonly tagKeyContent = signal('');
|
|
readonly tagKeyContent = signal('');
|
|
|
|
|
+ readonly filterUserMoneyType = signal(1);
|
|
|
|
|
+ readonly filterUserMoneyStartDate = signal('');
|
|
|
|
|
+ readonly filterUserMoneyEndDate = signal('');
|
|
|
|
|
+ readonly updatingUserLevel = signal(false);
|
|
|
readonly selectedIds = signal<string[]>([]);
|
|
readonly selectedIds = signal<string[]>([]);
|
|
|
readonly bulkError = signal('');
|
|
readonly bulkError = signal('');
|
|
|
readonly bulkMessage = signal('');
|
|
readonly bulkMessage = signal('');
|
|
@@ -144,7 +148,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
return fields.map((field, index) => ({ field, index })).sort((a, b) => rank(a.field.name) - rank(b.field.name) || a.index - b.index).map(({ field }) => field).slice(0, 7);
|
|
return fields.map((field, index) => ({ field, index })).sort((a, b) => rank(a.field.name) - rank(b.field.name) || a.index - b.index).map(({ field }) => field).slice(0, 7);
|
|
|
});
|
|
});
|
|
|
readonly pageCount = computed(() => Math.max(1, Math.ceil((this.page()?.total ?? 0) / (this.page()?.pageSize || 20))));
|
|
readonly pageCount = computed(() => Math.max(1, Math.ceil((this.page()?.total ?? 0) / (this.page()?.pageSize || 20))));
|
|
|
- readonly bulkEnabled = computed(() => ['_User', 'CommonModel', 'Node', 'Special', 'Guestbook', 'GuestBar', 'Datadiccategory', 'Datadic', 'GradeCate', 'Grade', 'Currency', 'SysHoliday', 'Search', 'AdZone', 'AdInfo', 'FontPicShape', 'FontPicShapeType', 'DesignAsk', 'DesignQuestion', 'DesignAnswer', 'ServiceSeat', 'Temp', 'StoreApplication', 'StoreStyle'].includes(this.className()));
|
|
|
|
|
|
|
+ readonly bulkEnabled = computed(() => ['_User', 'CommonModel', 'Node', 'Special', 'Guestbook', 'GuestBar', 'Datadiccategory', 'Datadic', 'GradeCate', 'Grade', 'Currency', 'SysHoliday', 'Search', 'AdZone', 'AdInfo', 'FontPicShape', 'FontPicShapeType', 'DesignAsk', 'DesignQuestion', 'DesignAnswer', 'ServiceSeat', 'Temp', 'StoreApplication', 'StoreStyle', 'UserLevel'].includes(this.className()));
|
|
|
readonly allPageSelected = computed(() => {
|
|
readonly allPageSelected = computed(() => {
|
|
|
const ids = (this.page()?.results || []).map((row) => String(row['objectId'] || '')).filter(Boolean);
|
|
const ids = (this.page()?.results || []).map((row) => String(row['objectId'] || '')).filter(Boolean);
|
|
|
return Boolean(ids.length) && ids.every((id) => this.selectedIds().includes(id));
|
|
return Boolean(ids.length) && ids.every((id) => this.selectedIds().includes(id));
|
|
@@ -165,6 +169,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
this.resetServiceActions();
|
|
this.resetServiceActions();
|
|
|
this.filterStoreStatus.set(-100); this.resetStoreActions();
|
|
this.filterStoreStatus.set(-100); this.resetStoreActions();
|
|
|
this.resetTagKeyActions();
|
|
this.resetTagKeyActions();
|
|
|
|
|
+ this.filterUserMoneyType.set(1); this.filterUserMoneyStartDate.set(''); this.filterUserMoneyEndDate.set('');
|
|
|
void this.load(1, true);
|
|
void this.load(1, true);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -178,7 +183,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (this.className() === 'FontPicShape' && reloadSchema) await this.loadFontShapeTypes();
|
|
if (this.className() === 'FontPicShape' && reloadSchema) await this.loadFontShapeTypes();
|
|
|
if (['DesignQuestion', 'DesignAnswer'].includes(this.className()) && reloadSchema) { await this.loadSurveys(); if (!this.filterSurveyId() && this.surveys().length) this.filterSurveyId.set(this.surveyIdOf(this.surveys()[0])); }
|
|
if (['DesignQuestion', 'DesignAnswer'].includes(this.className()) && reloadSchema) { await this.loadSurveys(); if (!this.filterSurveyId() && this.surveys().length) this.filterSurveyId.set(this.surveyIdOf(this.surveys()[0])); }
|
|
|
if (this.className() === 'StoreApplication' && reloadSchema) await this.loadStoreStyles();
|
|
if (this.className() === 'StoreApplication' && reloadSchema) await this.loadStoreStyles();
|
|
|
- const pageOperation = this.className() === 'Grade' && this.filterGradeCategoryId() > 0 ? 'gradeOptions' : this.className() === 'Search' ? 'searchNavigations' : this.className() === 'AdZone' ? 'adZones' : this.className() === 'AdInfo' ? 'adInfos' : this.className() === 'FontPicShape' ? 'fontShapes' : this.className() === 'FontPicShapeType' ? 'fontShapeTypes' : this.className() === 'DesignAsk' ? 'surveys' : this.className() === 'DesignQuestion' ? 'surveyQuestions' : this.className() === 'DesignAnswer' ? 'surveyResults' : this.className() === 'ServiceSeat' ? 'serviceSeats' : this.className() === 'Temp' ? 'serviceCodes' : this.className() === 'StoreApplication' ? 'storeApplications' : this.className() === 'StoreStyle' ? 'storeStyles' : this.className() === 'ContentTagKey' ? 'contentTagKeys' : 'list';
|
|
|
|
|
|
|
+ const pageOperation = this.className() === 'Grade' && this.filterGradeCategoryId() > 0 ? 'gradeOptions' : this.className() === 'Search' ? 'searchNavigations' : this.className() === 'AdZone' ? 'adZones' : this.className() === 'AdInfo' ? 'adInfos' : this.className() === 'FontPicShape' ? 'fontShapes' : this.className() === 'FontPicShapeType' ? 'fontShapeTypes' : this.className() === 'DesignAsk' ? 'surveys' : this.className() === 'DesignQuestion' ? 'surveyQuestions' : this.className() === 'DesignAnswer' ? 'surveyResults' : this.className() === 'ServiceSeat' ? 'serviceSeats' : this.className() === 'Temp' ? 'serviceCodes' : this.className() === 'StoreApplication' ? 'storeApplications' : this.className() === 'StoreStyle' ? 'storeStyles' : this.className() === 'ContentTagKey' ? 'contentTagKeys' : this.className() === 'UserLevel' ? 'userLevels' : this.className() === 'UserMoneyLog' ? 'userMoneyLogs' : 'list';
|
|
|
const pagePayload: Record<string, unknown> = { className: this.className(), page: pageNumber, pageSize: 20, search: this.search().trim() };
|
|
const pagePayload: Record<string, unknown> = { className: this.className(), page: pageNumber, pageSize: 20, search: this.search().trim() };
|
|
|
if (pageOperation === 'gradeOptions') { pagePayload['categoryId'] = this.filterGradeCategoryId(); pagePayload['parentId'] = this.filterGradeParentId(); }
|
|
if (pageOperation === 'gradeOptions') { pagePayload['categoryId'] = this.filterGradeCategoryId(); pagePayload['parentId'] = this.filterGradeParentId(); }
|
|
|
if (pageOperation === 'searchNavigations') { pagePayload['type'] = this.filterSearchNavigationType(); pagePayload['state'] = this.filterSearchNavigationState(); pagePayload['elite'] = this.filterSearchNavigationElite(); }
|
|
if (pageOperation === 'searchNavigations') { pagePayload['type'] = this.filterSearchNavigationType(); pagePayload['state'] = this.filterSearchNavigationState(); pagePayload['elite'] = this.filterSearchNavigationElite(); }
|
|
@@ -188,6 +193,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (pageOperation === 'surveys') pagePayload['status'] = this.filterSurveyStatus();
|
|
if (pageOperation === 'surveys') pagePayload['status'] = this.filterSurveyStatus();
|
|
|
if (pageOperation === 'surveyQuestions' || pageOperation === 'surveyResults') pagePayload['askId'] = this.filterSurveyId();
|
|
if (pageOperation === 'surveyQuestions' || pageOperation === 'surveyResults') pagePayload['askId'] = this.filterSurveyId();
|
|
|
if (pageOperation === 'storeApplications') pagePayload['status'] = this.filterStoreStatus();
|
|
if (pageOperation === 'storeApplications') pagePayload['status'] = this.filterStoreStatus();
|
|
|
|
|
+ if (pageOperation === 'userMoneyLogs') { pagePayload['type'] = this.filterUserMoneyType(); pagePayload['startDate'] = this.filterUserMoneyStartDate(); pagePayload['endDate'] = this.filterUserMoneyEndDate(); }
|
|
|
this.page.set(await this.functions.admin<ResourcePage>(pageOperation, pagePayload));
|
|
this.page.set(await this.functions.admin<ResourcePage>(pageOperation, pagePayload));
|
|
|
if (this.className() === '_User' && reloadSchema) await this.loadUserGroups();
|
|
if (this.className() === '_User' && reloadSchema) await this.loadUserGroups();
|
|
|
if (this.className() === 'Datadic' && reloadSchema) await this.loadDictionaryCategories();
|
|
if (this.className() === 'Datadic' && reloadSchema) await this.loadDictionaryCategories();
|
|
@@ -200,7 +206,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
const objectId = String(row['objectId'] ?? '');
|
|
const objectId = String(row['objectId'] ?? '');
|
|
|
this.error.set('');
|
|
this.error.set('');
|
|
|
try {
|
|
try {
|
|
|
- const detailOperation = this.className() === 'ContentTagKey' ? 'getContentTagKeys' : 'get';
|
|
|
|
|
|
|
+ const detailOperation = this.className() === 'ContentTagKey' ? 'getContentTagKeys' : this.className() === 'UserMoneyLog' ? 'getUserMoneyLog' : 'get';
|
|
|
const detail = await this.functions.admin<Record<string, unknown>>(detailOperation, { className: this.className(), objectId });
|
|
const detail = await this.functions.admin<Record<string, unknown>>(detailOperation, { className: this.className(), objectId });
|
|
|
this.draftId.set(objectId); this.draft.set(detail); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(detail); this.resetContentActions(detail); this.resetNodeActions(detail); this.resetSpecialActions(detail); this.resetGuestbookActions(detail); this.resetGuestCategoryActions(detail); this.resetBarActions(detail); this.resetExamClassActions(detail); this.resetExamPointActions(detail); this.resetKnowledgeActions(detail); this.resetTeacherActions(detail); this.resetDictionaryActions(detail); this.resetGradeActions(detail); this.resetAdActions(detail); this.resetFontShapeActions(detail); this.resetSurveyActions(); this.resetServiceActions(detail); this.resetStoreActions(detail); this.resetTagKeyActions(detail); this.editorOpen.set(true);
|
|
this.draftId.set(objectId); this.draft.set(detail); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(detail); this.resetContentActions(detail); this.resetNodeActions(detail); this.resetSpecialActions(detail); this.resetGuestbookActions(detail); this.resetGuestCategoryActions(detail); this.resetBarActions(detail); this.resetExamClassActions(detail); this.resetExamPointActions(detail); this.resetKnowledgeActions(detail); this.resetTeacherActions(detail); this.resetDictionaryActions(detail); this.resetGradeActions(detail); this.resetAdActions(detail); this.resetFontShapeActions(detail); this.resetSurveyActions(); this.resetServiceActions(detail); this.resetStoreActions(detail); this.resetTagKeyActions(detail); this.editorOpen.set(true);
|
|
|
if (this.className() === '_User') await this.loadUserGroups();
|
|
if (this.className() === '_User') await this.loadUserGroups();
|
|
@@ -268,7 +274,8 @@ export class AdminResourceComponent implements OnInit {
|
|
|
: this.className() === 'Temp' ? 'saveServiceCode'
|
|
: this.className() === 'Temp' ? 'saveServiceCode'
|
|
|
: this.className() === 'StoreApplication' ? 'saveStoreApplication'
|
|
: this.className() === 'StoreApplication' ? 'saveStoreApplication'
|
|
|
: this.className() === 'StoreStyle' ? 'saveStoreStyle'
|
|
: this.className() === 'StoreStyle' ? 'saveStoreStyle'
|
|
|
- : this.className() === 'ContentTagKey' ? 'saveContentTagKeys' : 'save';
|
|
|
|
|
|
|
+ : this.className() === 'ContentTagKey' ? 'saveContentTagKeys'
|
|
|
|
|
+ : this.className() === 'UserLevel' ? 'saveUserLevel' : 'save';
|
|
|
const payload: Record<string, unknown> = { className: this.className(), objectId: this.draftId() || undefined, fields: this.draft() };
|
|
const payload: Record<string, unknown> = { className: this.className(), objectId: this.draftId() || undefined, fields: this.draft() };
|
|
|
if (this.className() === 'Node') payload['parentId'] = this.targetNodeParentId();
|
|
if (this.className() === 'Node') payload['parentId'] = this.targetNodeParentId();
|
|
|
if (this.className() === 'Special') payload['pid'] = this.targetSpecialParentId();
|
|
if (this.className() === 'Special') payload['pid'] = this.targetSpecialParentId();
|
|
@@ -684,6 +691,15 @@ export class AdminResourceComponent implements OnInit {
|
|
|
catch (error) { this.bulkError.set(error instanceof Error ? error.message : '店铺批量操作失败'); }
|
|
catch (error) { this.bulkError.set(error instanceof Error ? error.message : '店铺批量操作失败'); }
|
|
|
finally { this.updatingStore.set(false); }
|
|
finally { this.updatingStore.set(false); }
|
|
|
}
|
|
}
|
|
|
|
|
+ async applyBulkUserLevelDelete(): Promise<void> {
|
|
|
|
|
+ const objectIds = this.selectedIds(); this.bulkError.set(''); this.bulkMessage.set('');
|
|
|
|
|
+ if (this.className() !== 'UserLevel' || !objectIds.length) { this.bulkError.set('请先选择积分等级'); return; }
|
|
|
|
|
+ if (!confirm(`确认删除选中的 ${objectIds.length} 个积分等级?`)) return;
|
|
|
|
|
+ this.updatingUserLevel.set(true);
|
|
|
|
|
+ try { const result = await this.functions.admin<{ updated: number }>('userLevelBatch', { className: 'UserLevel', action: 'delete', objectIds }); await this.load(); this.bulkMessage.set(`已删除 ${result.updated} 个积分等级`); }
|
|
|
|
|
+ catch (error) { this.bulkError.set(error instanceof Error ? error.message : '积分等级删除失败'); }
|
|
|
|
|
+ finally { this.updatingUserLevel.set(false); }
|
|
|
|
|
+ }
|
|
|
async remove(row: Record<string, unknown>): Promise<void> {
|
|
async remove(row: Record<string, unknown>): Promise<void> {
|
|
|
const objectId = String(row['objectId'] ?? '');
|
|
const objectId = String(row['objectId'] ?? '');
|
|
|
const verb = ['CommonModel', 'Node', 'Guestbook'].includes(this.className()) ? '移入回收站' : '删除';
|
|
const verb = ['CommonModel', 'Node', 'Guestbook'].includes(this.className()) ? '移入回收站' : '删除';
|
|
@@ -697,6 +713,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
else if (['DesignAsk', 'DesignQuestion', 'DesignAnswer'].includes(this.className())) await this.functions.admin('surveyBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
else if (['DesignAsk', 'DesignQuestion', 'DesignAnswer'].includes(this.className())) await this.functions.admin('surveyBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
|
else if (['ServiceSeat', 'Temp'].includes(this.className())) await this.functions.admin('serviceBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
else if (['ServiceSeat', 'Temp'].includes(this.className())) await this.functions.admin('serviceBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
|
else if (['StoreApplication', 'StoreStyle'].includes(this.className())) await this.functions.admin('storeBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
else if (['StoreApplication', 'StoreStyle'].includes(this.className())) await this.functions.admin('storeBatch', { className: this.className(), action: 'delete', objectIds: [objectId] });
|
|
|
|
|
+ else if (this.className() === 'UserLevel') await this.functions.admin('userLevelBatch', { className: 'UserLevel', action: 'delete', objectIds: [objectId] });
|
|
|
else await this.functions.admin('delete', { className: this.className(), objectId });
|
|
else await this.functions.admin('delete', { className: this.className(), objectId });
|
|
|
await this.load();
|
|
await this.load();
|
|
|
}
|
|
}
|