|
|
@@ -132,13 +132,14 @@ export class AdminResourceComponent implements OnInit {
|
|
|
readonly targetStoreUsername = signal('');
|
|
|
readonly storeStyles = signal<Record<string, unknown>[]>([]);
|
|
|
readonly updatingStore = signal(false);
|
|
|
+ readonly tagKeyContent = signal('');
|
|
|
readonly selectedIds = signal<string[]>([]);
|
|
|
readonly bulkError = signal('');
|
|
|
readonly bulkMessage = signal('');
|
|
|
readonly icons = { ChevronLeft, ChevronRight, Eye, KeyRound, LoaderCircle, Pencil, Plus, RefreshCw, Search, Trash2, X };
|
|
|
readonly columns = computed(() => {
|
|
|
const fields = this.schema()?.fields ?? [];
|
|
|
- const preferred = ['objectId', 'name', 'title', 'qtitle', 'sName', 'storeName', 'styleName', 'str1', 'categoryname', 'dicname', 'cateName', 'gradeName', 'cClassName', 'testPoint', 'kName', 'tname', 'username', 'userName', 'realName', 'sRemrk', 'askId', 'zoneId', 'typeId', 'shape', 'qtype', 'required', 'ztype', 'priority', 'zstatus', 'storeState', 'storeCommendState', 'storeStyleId', 'sDefault', 'sIndex', 'str4', 'sdate', 'edate', 'fileUrl', 'type', 'state', 'eliteLevel', 'orderId', 'mobile', 'sourceKey', 'status', 'createdAt', 'updatedAt'];
|
|
|
+ const preferred = ['objectId', 'name', 'title', 'qtitle', 'sName', 'storeName', 'styleName', 'count', 'content', 'str1', 'categoryname', 'dicname', 'cateName', 'gradeName', 'cClassName', 'testPoint', 'kName', 'tname', 'username', 'userName', 'realName', 'sRemrk', 'askId', 'zoneId', 'typeId', 'shape', 'qtype', 'required', 'ztype', 'priority', 'zstatus', 'storeState', 'storeCommendState', 'storeStyleId', 'sDefault', 'sIndex', 'str4', 'sdate', 'edate', 'fileUrl', 'type', 'state', 'eliteLevel', 'orderId', 'mobile', 'sourceKey', 'status', 'createdAt', 'updatedAt'];
|
|
|
const rank = (name: string): number => { const index = preferred.indexOf(name); return index < 0 ? preferred.length : index; };
|
|
|
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);
|
|
|
});
|
|
|
@@ -163,6 +164,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
this.filterSurveyStatus.set(-100); this.filterSurveyId.set(0); this.resetSurveyActions();
|
|
|
this.resetServiceActions();
|
|
|
this.filterStoreStatus.set(-100); this.resetStoreActions();
|
|
|
+ this.resetTagKeyActions();
|
|
|
void this.load(1, true);
|
|
|
});
|
|
|
}
|
|
|
@@ -176,7 +178,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
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 (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' : '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' : 'list';
|
|
|
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 === 'searchNavigations') { pagePayload['type'] = this.filterSearchNavigationType(); pagePayload['state'] = this.filterSearchNavigationState(); pagePayload['elite'] = this.filterSearchNavigationElite(); }
|
|
|
@@ -193,20 +195,21 @@ export class AdminResourceComponent implements OnInit {
|
|
|
finally { this.loading.set(false); }
|
|
|
}
|
|
|
|
|
|
- openCreate(): void { this.draftId.set(''); this.draft.set({}); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(); this.resetContentActions(); this.resetNodeActions(); this.resetSpecialActions(); this.resetGuestbookActions(); this.resetGuestCategoryActions(); this.resetBarActions(); this.resetExamClassActions(); this.resetExamPointActions(); this.resetKnowledgeActions(); this.resetTeacherActions(); this.resetDictionaryActions(); this.resetGradeActions(); this.resetAdActions(); this.resetFontShapeActions(); this.resetSurveyActions(); this.resetServiceActions(); this.resetStoreActions(); this.editorOpen.set(true); }
|
|
|
+ openCreate(): void { this.draftId.set(''); this.draft.set({}); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(); this.resetContentActions(); this.resetNodeActions(); this.resetSpecialActions(); this.resetGuestbookActions(); this.resetGuestCategoryActions(); this.resetBarActions(); this.resetExamClassActions(); this.resetExamPointActions(); this.resetKnowledgeActions(); this.resetTeacherActions(); this.resetDictionaryActions(); this.resetGradeActions(); this.resetAdActions(); this.resetFontShapeActions(); this.resetSurveyActions(); this.resetServiceActions(); this.resetStoreActions(); this.resetTagKeyActions(); this.editorOpen.set(true); }
|
|
|
async openEdit(row: Record<string, unknown>): Promise<void> {
|
|
|
const objectId = String(row['objectId'] ?? '');
|
|
|
this.error.set('');
|
|
|
try {
|
|
|
- const detail = await this.functions.admin<Record<string, unknown>>('get', { 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.editorOpen.set(true);
|
|
|
+ const detailOperation = this.className() === 'ContentTagKey' ? 'getContentTagKeys' : 'get';
|
|
|
+ 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);
|
|
|
if (this.className() === '_User') await this.loadUserGroups();
|
|
|
if (this.className() === 'AdInfo' && !this.adZones().length) await this.loadAdZones();
|
|
|
if (this.className() === 'AdZone') await this.loadAdPreview();
|
|
|
if (this.className() === 'FontPicShape' && !this.fontShapeTypes().length) await this.loadFontShapeTypes();
|
|
|
} catch (error) { this.error.set(error instanceof Error ? error.message : '详情加载失败'); }
|
|
|
}
|
|
|
- closeEditor(): void { this.editorOpen.set(false); this.draft.set({}); this.draftId.set(''); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(); this.resetContentActions(); this.resetNodeActions(); this.resetSpecialActions(); this.resetGuestbookActions(); this.resetGuestCategoryActions(); this.resetBarActions(); this.resetExamClassActions(); this.resetExamPointActions(); this.resetKnowledgeActions(); this.resetTeacherActions(); this.resetDictionaryActions(); this.resetGradeActions(); this.resetAdActions(); this.resetFontShapeActions(); this.resetSurveyActions(); this.resetServiceActions(); this.resetStoreActions(); }
|
|
|
+ closeEditor(): void { this.editorOpen.set(false); this.draft.set({}); this.draftId.set(''); this.fieldErrors.set({}); this.fieldInputs.set({}); this.resetPasswordFields(); this.resetCreateUserFields(); this.resetUserActions(); this.resetContentActions(); this.resetNodeActions(); this.resetSpecialActions(); this.resetGuestbookActions(); this.resetGuestCategoryActions(); this.resetBarActions(); this.resetExamClassActions(); this.resetExamPointActions(); this.resetKnowledgeActions(); this.resetTeacherActions(); this.resetDictionaryActions(); this.resetGradeActions(); this.resetAdActions(); this.resetFontShapeActions(); this.resetSurveyActions(); this.resetServiceActions(); this.resetStoreActions(); this.resetTagKeyActions(); }
|
|
|
setField(field: AdminFieldSchema, raw: unknown): void {
|
|
|
let value = raw;
|
|
|
if (field.type === 'Number') value = raw === '' ? null : Number(raw);
|
|
|
@@ -264,7 +267,8 @@ export class AdminResourceComponent implements OnInit {
|
|
|
: this.className() === 'ServiceSeat' ? 'saveServiceSeat'
|
|
|
: this.className() === 'Temp' ? 'saveServiceCode'
|
|
|
: this.className() === 'StoreApplication' ? 'saveStoreApplication'
|
|
|
- : this.className() === 'StoreStyle' ? 'saveStoreStyle' : 'save';
|
|
|
+ : this.className() === 'StoreStyle' ? 'saveStoreStyle'
|
|
|
+ : this.className() === 'ContentTagKey' ? 'saveContentTagKeys' : 'save';
|
|
|
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() === 'Special') payload['pid'] = this.targetSpecialParentId();
|
|
|
@@ -279,6 +283,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (this.className() === 'FontPicShape') payload['typeId'] = this.targetFontShapeTypeId();
|
|
|
if (this.className() === 'ServiceSeat') payload['username'] = this.targetServiceSeatUsername();
|
|
|
if (this.className() === 'StoreApplication') { payload['username'] = this.targetStoreUsername(); payload['styleId'] = this.targetStoreStyleId(); }
|
|
|
+ if (this.className() === 'ContentTagKey') payload['content'] = this.tagKeyContent();
|
|
|
await this.functions.admin(operation, payload);
|
|
|
this.closeEditor(); await this.load();
|
|
|
} catch (error) { this.error.set(error instanceof Error ? error.message : '保存失败'); }
|
|
|
@@ -772,4 +777,5 @@ export class AdminResourceComponent implements OnInit {
|
|
|
private resetSurveyActions(): void { this.surveyOrderStart.set(1); this.surveyChart.set(null); this.surveyChartError.set(''); this.surveyChartLoading.set(false); }
|
|
|
private resetServiceActions(detail: Record<string, unknown> = {}): void { this.targetServiceSeatUsername.set(String(detail['sRemrk'] || '')); }
|
|
|
private resetStoreActions(detail: Record<string, unknown> = {}): void { this.targetStoreUsername.set(String(detail['userName'] || '')); this.targetStoreStyleId.set(Number(detail['storeStyleId']) || 0); }
|
|
|
+ private resetTagKeyActions(detail: Record<string, unknown> = {}): void { this.tagKeyContent.set(String(detail['content'] || '')); }
|
|
|
}
|