fix,refac: 권한 부족의 경우 '-'을 잘 띄우도록

This commit is contained in:
2022-04-08 00:55:13 +09:00
parent 152fdf7143
commit 660c88975c
5 changed files with 46 additions and 37 deletions
+25 -23
View File
@@ -259,7 +259,7 @@ function storeDisplaySetting() {
return;
}
const nickName = prompt("선택한 설정의 별명을 지어주세요", currentSetting.value[0]?'':currentSetting.value[1]);
const nickName = prompt("선택한 설정의 별명을 지어주세요", currentSetting.value[0] ? "" : currentSetting.value[1]);
if (!nickName) {
return;
}
@@ -288,10 +288,9 @@ function onGridReady(params: GridReadyEvent) {
params.api.setDomLayout("normal");
}
loadLastUsedSettings();
if(currentSetting.value[0]){
if (currentSetting.value[0]) {
setDisplaySetting(currentSetting.value, defaultDisplaySetting[currentSetting.value[1]]);
}
else{
} else {
setDisplaySetting(currentSetting.value, unwrap(displaySettings.value.get(currentSetting.value[1])));
}
@@ -304,7 +303,7 @@ function getRowHeight(): number {
return rowHeight.value;
}
type headerType =
| keyof Omit<GeneralListItemP2, "no" | "imgsvr" | "picture" | "lbonus">
| keyof Omit<GeneralListItemP2, "no" | "imgsvr" | "picture" | "lbonus" | "permission" | "st0" | "st1" | "st2">
| "stat"
| "icon"
| "goldRice"
@@ -372,6 +371,9 @@ function getColumnList(): [headerType, ProvidedColumnGroup | Column, number?][]
return result;
}
function naiveCheClassNameFilter(value: string): string {
if (!value) {
return "-";
}
const text = value.split("_").pop() ?? "None";
if (text === "None") {
return "-";
@@ -381,6 +383,9 @@ function naiveCheClassNameFilter(value: string): string {
function numberFormatter(unit?: string) {
if (unit) {
return (value: GenValueParams): string => {
if (value.value == null) {
return "-";
}
const valueText = (value.value as number).toLocaleString();
return `${valueText} ${unit}`;
};
@@ -390,7 +395,7 @@ function numberFormatter(unit?: string) {
};
}
function extractTroopInfo(value: GeneralListItem): [string, GeneralListItemP2] | undefined {
if (value.permission == 0 || value.permission == 1) {
if (!value.st2) {
return undefined;
}
const troopID = value.troop;
@@ -538,22 +543,16 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
sortable: true,
comparator: (a, b, c, d) => c.data.officerLevel - d.data.officerLevel,
cellRenderer: ({ data }: GenValueParams) => {
if ([2, 3, 4].includes(data.permission)) {
const dataP2 = data as GeneralListItemP2;
if (2 <= dataP2.officerLevel && dataP2.officerLevel <= 4) {
const cityName = gameConstStore.value.cityConst[dataP2.officer_city].name;
return `${cityName}<br>${dataP2.officerLevelText}`;
}
if (data.st2 && 2 <= data.officerLevel && data.officerLevel <= 4) {
const cityName = gameConstStore.value.cityConst[data.officer_city].name;
return `${cityName}<br>${data.officerLevelText}`;
}
return data.officerLevelText;
},
filterValueGetter: ({ data }) => {
if ([2, 3, 4].includes(data.permission)) {
const dataP2 = data as GeneralListItemP2;
if (2 <= dataP2.officerLevel && dataP2.officerLevel <= 4) {
const cityName = gameConstStore.value.cityConst[dataP2.officer_city].name;
return convertSearch초성(`${cityName} ${dataP2.officerLevelText}`);
}
if (data.st2 && 2 <= data.officerLevel && data.officerLevel <= 4) {
const cityName = gameConstStore.value.cityConst[data.officer_city].name;
return convertSearch초성(`${cityName} ${data.officerLevelText}`);
}
return convertSearch초성(data.officerLevelText);
},
@@ -647,7 +646,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
headerName: "도시",
field: "city",
valueGetter: ({ data }) => {
if (data.permission == 0 || data.permission == 1) {
if (!data.st2) {
return "-";
}
return gameConstStore.value.cityConst[data.city].name;
@@ -656,7 +655,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
sortable: true,
width: 60,
filterValueGetter: ({ data }) => {
if (data.permission == 0 || data.permission == 1) {
if (!data.st2) {
return "-";
}
return convertSearch초성(gameConstStore.value.cityConst[data.city].name);
@@ -740,7 +739,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
columnGroupShow: "open",
filter: true,
filterValueGetter: ({ data }) => {
if (data.permission == 0 || data.permission == 1) {
if (!data.st2) {
return "-";
}
const name = gameConstStore.value.iActionInfo.crewtype[data.crewtype].name;
@@ -767,7 +766,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
headerName: "훈/사",
width: 60,
cellRenderer: ({ data }: GenValueParams) => {
if (data.permission == 0 || data.permission == 1) {
if (!data.st2) {
return "?";
}
return `${data.train}<br>${data.atmos}`;
@@ -890,6 +889,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
if (data.npc >= 2) {
return "NPC 장수";
}
if (!data.reservedCommand) {
return "-";
}
const commandList = data.reservedCommand;
if (!commandList) {
return "???";
@@ -930,7 +932,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
field: "turntime",
width: 60,
valueFormatter: ({ value, data }) => {
if (data.permission == 0 || data.permission == 1) {
if (!data.st2) {
return "-";
}
const turntime = value as string;