mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
🐛 刷新页面服务报错,页面table数据切换库不刷新问题解决
This commit is contained in:
parent
e2ee5867c6
commit
89bb3dd6d4
|
@ -1,6 +1,7 @@
|
|||
|
||||
import express from "express";
|
||||
import mysql from "mysql";
|
||||
import Client from 'easymysql';
|
||||
/**
|
||||
* 401 需要跳转登录验证
|
||||
* 500 接口错误
|
||||
|
@ -25,6 +26,8 @@ const con = mysql.createConnection({
|
|||
...mysqlParams
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 查询数据方法 SELECT * FROM table
|
||||
const m_get = (table, Clause, order, start, end) => {
|
||||
return `SELECT * FROM ${table} ${Clause ? 'WHERE ' + Clause : ``} ORDER BY ${order || `ID`} DESC ${!end ? `` : `LIMIT ` + start + `,` + end};`
|
||||
|
@ -76,31 +79,37 @@ const dateFormater = (formater, time) => {
|
|||
|
||||
// 获取数据库列表
|
||||
const getDatabases = () => app.post('/getdatabases', function (req, res) {
|
||||
con.connect();
|
||||
// con.connect();
|
||||
con.query("SHOW DATABASES", function (error, results, fields) {
|
||||
if (error) {
|
||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||
return res.status(500).send(error);
|
||||
} else {
|
||||
res.send(results);
|
||||
// con.end();
|
||||
}
|
||||
});
|
||||
con.end();
|
||||
});
|
||||
|
||||
// 公共查询方法
|
||||
const mysqlQuery = (res, database, sql) => {
|
||||
if(!database) return res.status(500).send('database is ' + database);
|
||||
connection(database).connect();
|
||||
connection(database).query(sql, (error, results, fields) => {
|
||||
if (error) {
|
||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||
return res.status(500).send(error);
|
||||
} else {
|
||||
res.send(results);
|
||||
}
|
||||
});
|
||||
connection(database).end();
|
||||
if (!database) return res.status(500).send('database is ' + database);
|
||||
try {
|
||||
// connection(database).connect();
|
||||
connection(database).query(sql, (error, results, fields) => {
|
||||
if (error) {
|
||||
// console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||
return res.status(500).send(error);
|
||||
} else {
|
||||
res.send(results);
|
||||
// connection(database).end();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return res.status(500).send('连接失败', error);
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
@ -8,9 +8,7 @@ import AIMedicineTable from "./core/AIMedicineTable.js";
|
|||
import doctorMedicineTable from "./core/doctorMedicineTable.js";
|
||||
import AIFlagTable from "./core/AIFlagTable.js";
|
||||
|
||||
// root/Gao!8636
|
||||
const app = common.app;
|
||||
const connection = common.connection;
|
||||
const nowTime = common.nowTime;
|
||||
|
||||
//配置ajax跨域请求
|
||||
|
@ -24,6 +22,15 @@ app.use(bodyParser.json());
|
|||
|
||||
app.listen(3001, () => console.log('服务启动! ' + nowTime()));
|
||||
|
||||
common.con.connect();
|
||||
common.con.query("SHOW DATABASES", function (error, results, fields) {
|
||||
if (error) {
|
||||
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
|
||||
} else {
|
||||
common.connection(results[results.length-1].Database).connect();
|
||||
}
|
||||
});
|
||||
|
||||
common.getDatabases();
|
||||
featureTable.getTable();
|
||||
AIMedicineTable.getTable();
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
<el-table-column prop="num" label="票号" width="40" align="center" />
|
||||
<el-table-column prop="name" label="药物名称" align="center" />
|
||||
<el-table-column prop="speed" label="速度(ml/h)" width="100" />
|
||||
<el-table-column prop="total" label="累计药量(ml)" width="100" >
|
||||
<el-table-column prop="total" label="累计药量(ml)" width="100">
|
||||
<template #default="scope">—</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="state" label="工作状态" width="70" align="center" />
|
||||
|
@ -238,6 +238,8 @@ function initData() {
|
|||
isAIDose.value = false;
|
||||
unusual.value = [];
|
||||
mssageList.value = [];
|
||||
tableData.value = [];
|
||||
tableDataStore.value = [];
|
||||
getFeatureTable();
|
||||
getMssageLog();
|
||||
getTableData(isAIDose.value);
|
||||
|
@ -313,7 +315,9 @@ function getChartData() {
|
|||
}
|
||||
}, 2000);
|
||||
setInterval(() => {
|
||||
chartDom4.value.updateChart(0, new Date());
|
||||
try {
|
||||
chartDom4.value.updateChart(0, new Date());
|
||||
} catch (error) { }
|
||||
}, 1000);
|
||||
function getData() {
|
||||
isRunTimer = false;
|
||||
|
@ -834,10 +838,12 @@ onMounted(() => {
|
|||
padding-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
&>.left-box {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 100%;
|
||||
|
||||
.unusual-title {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
@ -848,6 +854,7 @@ onMounted(() => {
|
|||
border: 1px dashed #C1C1C1;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.unusual-box {
|
||||
width: 100%;
|
||||
height: calc(100% - 45px);
|
||||
|
@ -869,6 +876,7 @@ onMounted(() => {
|
|||
&>.right-box {
|
||||
width: calc(100% - 205px);
|
||||
height: 100%;
|
||||
|
||||
.video-box {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
@ -1010,5 +1018,4 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
|
Loading…
Reference in New Issue
Block a user