- ag-grid 기반 - 컬럼 사용자 정의 기능 제공 - 컬럼 재정렬, 고정, 정렬 기능 - 컬럼 상태 저장, 불러오기 - 마지막 컬럼 재 사용 - 아이콘, 장수명 클릭 시 특수 기능 제공 - 기본 세력 장수/암행부에서는 '감찰부' - 추가 컬럼 - 최근 전투 - 전투 수 - 승리 수 - 살상률 - API/Nation/GeneralList 추가 Co-authored-by: hide_d <hided62@gmail.com> Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/213
46 lines
1.2 KiB
Vue
46 lines
1.2 KiB
Vue
<template>
|
|
<span v-if="props.params.value == null">?</span>
|
|
<span v-else-if="params.iActionMap" v-b-tooltip.hover :title="params.iActionMap[props.params.value].info ?? ''">{{
|
|
params.iActionMap[props.params.value].name
|
|
}}</span>
|
|
<span v-else-if="params.info" v-b-tooltip.hover :title="params.info">{{ displayValue }}</span>
|
|
<span v-else>{{ displayValue }}</span>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import type { GameIActionInfo } from "@/defs/GameObj";
|
|
import type { ValueFormatterParams } from "ag-grid-community";
|
|
import { isNumber, isString } from "lodash";
|
|
import { ref, watch, type PropType } from "vue";
|
|
|
|
const props = defineProps({
|
|
params: {
|
|
type: Object as PropType<
|
|
ValueFormatterParams & {
|
|
info?: string;
|
|
iActionMap?: Record<string, GameIActionInfo>;
|
|
}
|
|
>,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
function convertValue(value: unknown): string {
|
|
if (isString(value)) {
|
|
return value;
|
|
}
|
|
if (isNumber(value)) {
|
|
return value.toLocaleString();
|
|
}
|
|
return `${value}`;
|
|
}
|
|
|
|
const displayValue = ref<string>(convertValue(props.params.value));
|
|
watch(
|
|
() => props.params,
|
|
(newParams) => {
|
|
displayValue.value = convertValue(newParams.value);
|
|
}
|
|
);
|
|
</script>
|