|
@@ -127,18 +127,23 @@ export class AdminResourceComponent implements OnInit {
|
|
|
readonly updatingSurvey = signal(false);
|
|
readonly updatingSurvey = signal(false);
|
|
|
readonly targetServiceSeatUsername = signal('');
|
|
readonly targetServiceSeatUsername = signal('');
|
|
|
readonly updatingService = signal(false);
|
|
readonly updatingService = signal(false);
|
|
|
|
|
+ readonly filterStoreStatus = signal(-100);
|
|
|
|
|
+ readonly targetStoreStyleId = signal(0);
|
|
|
|
|
+ readonly targetStoreUsername = signal('');
|
|
|
|
|
+ readonly storeStyles = signal<Record<string, unknown>[]>([]);
|
|
|
|
|
+ readonly updatingStore = signal(false);
|
|
|
readonly selectedIds = signal<string[]>([]);
|
|
readonly selectedIds = signal<string[]>([]);
|
|
|
readonly bulkError = signal('');
|
|
readonly bulkError = signal('');
|
|
|
readonly bulkMessage = signal('');
|
|
readonly bulkMessage = signal('');
|
|
|
readonly icons = { ChevronLeft, ChevronRight, Eye, KeyRound, LoaderCircle, Pencil, Plus, RefreshCw, Search, Trash2, X };
|
|
readonly icons = { ChevronLeft, ChevronRight, Eye, KeyRound, LoaderCircle, Pencil, Plus, RefreshCw, Search, Trash2, X };
|
|
|
readonly columns = computed(() => {
|
|
readonly columns = computed(() => {
|
|
|
const fields = this.schema()?.fields ?? [];
|
|
const fields = this.schema()?.fields ?? [];
|
|
|
- const preferred = ['objectId', 'name', 'title', 'qtitle', 'sName', 'str1', 'categoryname', 'dicname', 'cateName', 'gradeName', 'cClassName', 'testPoint', 'kName', 'tname', 'username', 'realName', 'sRemrk', 'askId', 'zoneId', 'typeId', 'shape', 'qtype', 'required', 'ztype', 'priority', 'zstatus', 'sDefault', 'sIndex', 'str4', 'sdate', 'edate', 'fileUrl', 'type', 'state', 'eliteLevel', 'orderId', 'mobile', 'sourceKey', 'status', 'createdAt', 'updatedAt'];
|
|
|
|
|
|
|
+ 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 rank = (name: string): number => { const index = preferred.indexOf(name); return index < 0 ? preferred.length : index; };
|
|
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);
|
|
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'].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'].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));
|
|
@@ -157,6 +162,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
this.filterFontShapeTypeId.set(0); this.resetFontShapeActions();
|
|
this.filterFontShapeTypeId.set(0); this.resetFontShapeActions();
|
|
|
this.filterSurveyStatus.set(-100); this.filterSurveyId.set(0); this.resetSurveyActions();
|
|
this.filterSurveyStatus.set(-100); this.filterSurveyId.set(0); this.resetSurveyActions();
|
|
|
this.resetServiceActions();
|
|
this.resetServiceActions();
|
|
|
|
|
+ this.filterStoreStatus.set(-100); this.resetStoreActions();
|
|
|
void this.load(1, true);
|
|
void this.load(1, true);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -169,7 +175,8 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (this.className() === 'AdInfo' && reloadSchema) await this.loadAdZones();
|
|
if (this.className() === 'AdInfo' && reloadSchema) await this.loadAdZones();
|
|
|
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])); }
|
|
|
- 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' : 'list';
|
|
|
|
|
|
|
+ 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 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(); }
|
|
@@ -178,6 +185,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (pageOperation === 'fontShapes') pagePayload['typeId'] = this.filterFontShapeTypeId();
|
|
if (pageOperation === 'fontShapes') pagePayload['typeId'] = this.filterFontShapeTypeId();
|
|
|
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();
|
|
|
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();
|
|
@@ -185,20 +193,20 @@ export class AdminResourceComponent implements OnInit {
|
|
|
finally { this.loading.set(false); }
|
|
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.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.editorOpen.set(true); }
|
|
|
async openEdit(row: Record<string, unknown>): Promise<void> {
|
|
async openEdit(row: Record<string, unknown>): Promise<void> {
|
|
|
const objectId = String(row['objectId'] ?? '');
|
|
const objectId = String(row['objectId'] ?? '');
|
|
|
this.error.set('');
|
|
this.error.set('');
|
|
|
try {
|
|
try {
|
|
|
const detail = await this.functions.admin<Record<string, unknown>>('get', { className: this.className(), objectId });
|
|
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.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.editorOpen.set(true);
|
|
|
if (this.className() === '_User') await this.loadUserGroups();
|
|
if (this.className() === '_User') await this.loadUserGroups();
|
|
|
if (this.className() === 'AdInfo' && !this.adZones().length) await this.loadAdZones();
|
|
if (this.className() === 'AdInfo' && !this.adZones().length) await this.loadAdZones();
|
|
|
if (this.className() === 'AdZone') await this.loadAdPreview();
|
|
if (this.className() === 'AdZone') await this.loadAdPreview();
|
|
|
if (this.className() === 'FontPicShape' && !this.fontShapeTypes().length) await this.loadFontShapeTypes();
|
|
if (this.className() === 'FontPicShape' && !this.fontShapeTypes().length) await this.loadFontShapeTypes();
|
|
|
} catch (error) { this.error.set(error instanceof Error ? error.message : '详情加载失败'); }
|
|
} 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(); }
|
|
|
|
|
|
|
+ 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(); }
|
|
|
setField(field: AdminFieldSchema, raw: unknown): void {
|
|
setField(field: AdminFieldSchema, raw: unknown): void {
|
|
|
let value = raw;
|
|
let value = raw;
|
|
|
if (field.type === 'Number') value = raw === '' ? null : Number(raw);
|
|
if (field.type === 'Number') value = raw === '' ? null : Number(raw);
|
|
@@ -254,7 +262,9 @@ export class AdminResourceComponent implements OnInit {
|
|
|
: this.className() === 'DesignAsk' ? 'saveSurvey'
|
|
: this.className() === 'DesignAsk' ? 'saveSurvey'
|
|
|
: this.className() === 'DesignQuestion' ? 'saveSurveyQuestion'
|
|
: this.className() === 'DesignQuestion' ? 'saveSurveyQuestion'
|
|
|
: this.className() === 'ServiceSeat' ? 'saveServiceSeat'
|
|
: this.className() === 'ServiceSeat' ? 'saveServiceSeat'
|
|
|
- : this.className() === 'Temp' ? 'saveServiceCode' : 'save';
|
|
|
|
|
|
|
+ : this.className() === 'Temp' ? 'saveServiceCode'
|
|
|
|
|
+ : this.className() === 'StoreApplication' ? 'saveStoreApplication'
|
|
|
|
|
+ : this.className() === 'StoreStyle' ? 'saveStoreStyle' : '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();
|
|
@@ -268,6 +278,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
if (this.className() === 'AdInfo') payload['zoneId'] = this.targetAdZoneId();
|
|
if (this.className() === 'AdInfo') payload['zoneId'] = this.targetAdZoneId();
|
|
|
if (this.className() === 'FontPicShape') payload['typeId'] = this.targetFontShapeTypeId();
|
|
if (this.className() === 'FontPicShape') payload['typeId'] = this.targetFontShapeTypeId();
|
|
|
if (this.className() === 'ServiceSeat') payload['username'] = this.targetServiceSeatUsername();
|
|
if (this.className() === 'ServiceSeat') payload['username'] = this.targetServiceSeatUsername();
|
|
|
|
|
+ if (this.className() === 'StoreApplication') { payload['username'] = this.targetStoreUsername(); payload['styleId'] = this.targetStoreStyleId(); }
|
|
|
await this.functions.admin(operation, payload);
|
|
await this.functions.admin(operation, payload);
|
|
|
this.closeEditor(); await this.load();
|
|
this.closeEditor(); await this.load();
|
|
|
} catch (error) { this.error.set(error instanceof Error ? error.message : '保存失败'); }
|
|
} catch (error) { this.error.set(error instanceof Error ? error.message : '保存失败'); }
|
|
@@ -658,6 +669,16 @@ 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.updatingService.set(false); }
|
|
finally { this.updatingService.set(false); }
|
|
|
}
|
|
}
|
|
|
|
|
+ async applyBulkStoreAction(action: 'audit' | 'unaudit' | 'elite' | 'unelite' | 'delete'): Promise<void> {
|
|
|
|
|
+ const className = this.className(); const objectIds = this.selectedIds(); this.bulkError.set(''); this.bulkMessage.set('');
|
|
|
|
|
+ const allowed = className === 'StoreApplication' ? ['audit', 'unaudit', 'elite', 'unelite'] : className === 'StoreStyle' ? ['delete'] : [];
|
|
|
|
|
+ if (!allowed.includes(action) || !objectIds.length) { this.bulkError.set(action === 'delete' && className === 'StoreApplication' ? '店铺删除因商品主表缺失而阻塞' : '请先选择可执行该操作的店铺记录'); return; }
|
|
|
|
|
+ if (action === 'delete' && !confirm(`确认删除选中的 ${objectIds.length} 条店铺样式?`)) return;
|
|
|
|
|
+ this.updatingStore.set(true);
|
|
|
|
|
+ try { const result = await this.functions.admin<{ updated: number }>('storeBatch', { className, action, objectIds }); await this.load(); this.bulkMessage.set(`已处理 ${result.updated} 条店铺记录`); }
|
|
|
|
|
+ catch (error) { this.bulkError.set(error instanceof Error ? error.message : '店铺批量操作失败'); }
|
|
|
|
|
+ finally { this.updatingStore.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()) ? '移入回收站' : '删除';
|
|
@@ -670,6 +691,7 @@ export class AdminResourceComponent implements OnInit {
|
|
|
else if (this.className() === 'FontPicShapeType') await this.functions.admin('fontShapeTypeBatch', { className: 'FontPicShapeType', action: 'delete', objectIds: [objectId] });
|
|
else if (this.className() === 'FontPicShapeType') await this.functions.admin('fontShapeTypeBatch', { className: 'FontPicShapeType', 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 (['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 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();
|
|
|
}
|
|
}
|
|
@@ -693,6 +715,8 @@ export class AdminResourceComponent implements OnInit {
|
|
|
fontShapeTypeLabel(type: Record<string, unknown>): string { return `${String(type['name'] || '未命名分类')}(${this.fontShapeTypeIdOf(type)})`; }
|
|
fontShapeTypeLabel(type: Record<string, unknown>): string { return `${String(type['name'] || '未命名分类')}(${this.fontShapeTypeIdOf(type)})`; }
|
|
|
surveyIdOf(survey: Record<string, unknown>): number { return Number(survey['id']) || 0; }
|
|
surveyIdOf(survey: Record<string, unknown>): number { return Number(survey['id']) || 0; }
|
|
|
surveyLabel(survey: Record<string, unknown>): string { return `${String(survey['title'] || '未命名问卷')}(${this.surveyIdOf(survey)})`; }
|
|
surveyLabel(survey: Record<string, unknown>): string { return `${String(survey['title'] || '未命名问卷')}(${this.surveyIdOf(survey)})`; }
|
|
|
|
|
+ storeStyleIdOf(style: Record<string, unknown>): number { return Number(style['id']) || 0; }
|
|
|
|
|
+ storeStyleLabel(style: Record<string, unknown>): string { return `${String(style['styleName'] || '未命名样式')}(${this.storeStyleIdOf(style)})`; }
|
|
|
contentStatusValue(): number { return Number(this.draft()['status']) || 0; }
|
|
contentStatusValue(): number { return Number(this.draft()['status']) || 0; }
|
|
|
contentStatusLabel(status: number): string { return ({ [-3]: '草稿', [-2]: '回收站', [-1]: '未通过', 0: '待审核', 99: '已审核' } as Record<number, string>)[status] || String(status); }
|
|
contentStatusLabel(status: number): string { return ({ [-3]: '草稿', [-2]: '回收站', [-1]: '未通过', 0: '待审核', 99: '已审核' } as Record<number, string>)[status] || String(status); }
|
|
|
nodeStatusValue(): number { return Number(this.draft()['zstatus'] ?? 99); }
|
|
nodeStatusValue(): number { return Number(this.draft()['zstatus'] ?? 99); }
|
|
@@ -724,6 +748,10 @@ export class AdminResourceComponent implements OnInit {
|
|
|
try { const result = await this.functions.admin<ResourcePage>('surveys', { className: 'DesignAsk', page: 1, pageSize: 100, search: '', status: -100 }); this.surveys.set(result.results || []); }
|
|
try { const result = await this.functions.admin<ResourcePage>('surveys', { className: 'DesignAsk', page: 1, pageSize: 100, search: '', status: -100 }); this.surveys.set(result.results || []); }
|
|
|
catch (error) { this.surveys.set([]); this.error.set(error instanceof Error ? error.message : '问卷选项加载失败'); }
|
|
catch (error) { this.surveys.set([]); this.error.set(error instanceof Error ? error.message : '问卷选项加载失败'); }
|
|
|
}
|
|
}
|
|
|
|
|
+ private async loadStoreStyles(): Promise<void> {
|
|
|
|
|
+ try { const result = await this.functions.admin<ResourcePage>('storeStyles', { className: 'StoreStyle', page: 1, pageSize: 100, search: '' }); this.storeStyles.set(result.results || []); }
|
|
|
|
|
+ catch (error) { this.storeStyles.set([]); this.error.set(error instanceof Error ? error.message : '店铺样式选项加载失败'); }
|
|
|
|
|
+ }
|
|
|
private resetPasswordFields(): void { this.newPassword.set(''); this.confirmPassword.set(''); this.passwordMessage.set(''); this.passwordError.set(''); }
|
|
private resetPasswordFields(): void { this.newPassword.set(''); this.confirmPassword.set(''); this.passwordMessage.set(''); this.passwordError.set(''); }
|
|
|
private resetCreateUserFields(): void { this.createUsername.set(''); this.createPassword.set(''); this.createConfirmPassword.set(''); this.createDisplayName.set(''); this.createMobile.set(''); this.createInviteUsername.set(''); this.createUserError.set(''); }
|
|
private resetCreateUserFields(): void { this.createUsername.set(''); this.createPassword.set(''); this.createConfirmPassword.set(''); this.createDisplayName.set(''); this.createMobile.set(''); this.createInviteUsername.set(''); this.createUserError.set(''); }
|
|
|
private resetUserActions(detail: Record<string, unknown> = {}): void { this.userGroups.set([]); this.selectedUserGroupId.set(Number(detail['legacyGroupId'] ?? (detail['legacyUserData'] as Record<string, unknown> | undefined)?.['GroupID']) || 0); this.userActionReason.set(''); this.userActionError.set(''); this.userActionMessage.set(''); }
|
|
private resetUserActions(detail: Record<string, unknown> = {}): void { this.userGroups.set([]); this.selectedUserGroupId.set(Number(detail['legacyGroupId'] ?? (detail['legacyUserData'] as Record<string, unknown> | undefined)?.['GroupID']) || 0); this.userActionReason.set(''); this.userActionError.set(''); this.userActionMessage.set(''); }
|
|
@@ -743,4 +771,5 @@ export class AdminResourceComponent implements OnInit {
|
|
|
private resetFontShapeActions(detail: Record<string, unknown> = {}): void { this.targetFontShapeTypeId.set(Number(detail['typeId']) || this.filterFontShapeTypeId()); this.fontShapePreview.set(String(detail['shape'] || '')); }
|
|
private resetFontShapeActions(detail: Record<string, unknown> = {}): void { this.targetFontShapeTypeId.set(Number(detail['typeId']) || this.filterFontShapeTypeId()); this.fontShapePreview.set(String(detail['shape'] || '')); }
|
|
|
private resetSurveyActions(): void { this.surveyOrderStart.set(1); this.surveyChart.set(null); this.surveyChartError.set(''); this.surveyChartLoading.set(false); }
|
|
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 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); }
|
|
|
}
|
|
}
|