@@ -178,7 +178,6 @@ const chartsOption = ref({
178178 loadSpeedChart: null ,
179179});
180180
181- const searchTime = ref ();
182181const searchInfo = reactive <Host .MonitorGPUSearch >({
183182 productName: ' ' ,
184183 startTime: new Date (new Date ().setHours (0 , 0 , 0 , 0 )),
@@ -201,27 +200,30 @@ const loadOptions = async () => {
201200};
202201
203202const search = async () => {
204- if (searchTime .value && searchTime .value .length === 2 ) {
205- searchInfo .startTime = searchTime .value [0 ];
206- searchInfo .endTime = searchTime .value [1 ];
203+ if (timeRangeGlobal .value && timeRangeGlobal .value .length === 2 ) {
204+ searchInfo .startTime = timeRangeGlobal .value [0 ];
205+ searchInfo .endTime = timeRangeGlobal .value [1 ];
207206 }
208207 loading .value = true ;
209208 await loadGPUMonitor (searchInfo )
210209 .then ((res ) => {
211210 loading .value = false ;
212- let baseDate = res .data .date .length === 0 ? loadEmptyDate (timeRangeGlobal .value ) : res .data .date ;
211+ let baseDate = res .data .date || [];
212+ if (baseDate .length === 0 ) {
213+ baseDate = loadEmptyDate (timeRangeGlobal .value );
214+ }
213215 let date = baseDate .map (function (item : any ) {
214216 return dateFormatWithoutYear (item );
215217 });
216- initCPUCharts (date , res .data .gpuValue );
217- initMemoryCharts (date , res .data .memoryValue );
218+ initCPUCharts (date , res .data .gpuValue || [] );
219+ initMemoryCharts (date , res .data .memoryValue || [] );
218220 if (gpuType .value === ' gpu' ) {
219- initPowerCharts (date , res .data .powerValue );
221+ initPowerCharts (date , res .data .powerValue || [] );
220222 } else {
221- initXpuPowerCharts (date , res .data .powerValue );
223+ initXpuPowerCharts (date , res .data .powerValue || [] );
222224 }
223- initSpeedCharts (date , res .data .speedValue );
224- initTemperatureCharts (date , res .data .temperatureValue );
225+ initSpeedCharts (date , res .data .speedValue || [] );
226+ initTemperatureCharts (date , res .data .temperatureValue || [] );
225227 })
226228 .catch (() => {
227229 loading .value = false ;
@@ -370,8 +372,8 @@ function loadEmptyData() {
370372}
371373function loadEmptyData2() {
372374 return [
373- { value: 0 , data: {} },
374- { value: 0 , data: {} },
375+ { value: 0 , data: { total: 0 , used: 0 } },
376+ { value: 0 , data: { total: 0 , used: 0 } },
375377 ];
376378}
377379
0 commit comments