From a4ea3bff5d4ce85035849157f6eeabdca541dc1d Mon Sep 17 00:00:00 2001 From: chiayin Date: Tue, 31 Oct 2023 16:38:54 +0800 Subject: [PATCH] Map Attributes: fix allMapData.js. --- src/stores/allMapData.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/stores/allMapData.js b/src/stores/allMapData.js index 65fdee6..cdb036c 100644 --- a/src/stores/allMapData.js +++ b/src/stores/allMapData.js @@ -97,7 +97,22 @@ export default defineStore('allMapDataStore', { }, filterAttrs: state => { if(state.allFilterAttrs !== null){ - state.allFilterAttrㄧㄠ + state.allFilterAttrs.map(att => { + switch (att.type) { + case 'date': + att.min = att.min !== null ? moment(att.min).format('YYYY/MM/DD HH:mm') : null; + att.max = att.max !== null ? moment(att.max).format('YYYY/MM/DD HH:mm') : null; + break; + case 'float': + // Decimal.ROUND_UP|0: 無條件進位; Decimal.ROUND_DOWN|1: 無條件捨去。 + att.min = att.min !== null ? Number(new Decimal(att.min).toFixed(2, 0)) : null; + att.max = att.max !== null ? Number(new Decimal(att.max).toFixed(2, 1)) : null; + break + default: + break; + } + return att; + }); return state.allFilterAttrs; } },