🐛 修复切换库是定时器不刷新的bug

This commit is contained in:
gaofy 2023-11-14 10:17:58 +08:00
parent d9f9a3764d
commit fb19336228

View File

@ -198,7 +198,7 @@ const medicineCustom: any[] = [
{ name: '阿托品', plus: 1, total: 100 },
{ name: '罗库溴铵', plus: 0.1, total: 10 }
];
const database = ref('数据模拟20231109185403');
const database = ref('');
const databaseOptions = ref([] as { value: string, label: string }[]);
const messageSum = ref(10);
const userName = ref('admin');
@ -243,8 +243,7 @@ function getFeatureTable() {
chartDom3.value.chartSet();
chartDom4.value.chartSet();
}, 0);
}else{
console.log(res);
} else {
ElMessage({
message: res.message,
type: 'error',
@ -280,7 +279,7 @@ function getChartData() {
function getData(callback: () => void) {
// if (isStart.value) {
post('/getfeature', { database: database.value, start: 0, end: 1 }, (res: any) => {
const obj = res.data[0] || {};
const obj = (res.data && res.data[0]) || {};
if (obj.ID !== chartNowData.ID) {
chartNowData = obj;
const isHR = obj.HR >= 50 && obj.HR <= 80;
@ -300,7 +299,7 @@ function getChartData() {
// chartDom4.value.updateChart(obj.ST, obj.Time || obj.TIME);
}
callback();
})
});
// } else {
// callback();
// }
@ -310,11 +309,10 @@ function getChartData() {
function getDatabases() {
post('/getdatabases', {}, (res: any) => {
if (res.status === 200) {
console.log(res);
databaseOptions.value = [];
const hideDatabase = ['information_schema', 'mysql', 'performance_schema'];
res.data.forEach((item: any, index: number) => {
if(!hideDatabase.some(e => e === item.Database)) databaseOptions.value.push({value: item.Database, label: item.Database});
if (!hideDatabase.some(e => e === item.Database)) databaseOptions.value.push({ value: item.Database, label: item.Database });
})
database.value = databaseOptions.value[0].label;
initData();