1
Some checks failed
CI / build (push) Has been cancelled

This commit is contained in:
jrhlh
2025-07-18 18:49:59 +08:00
parent 3eeebab4f8
commit bd1fc93771
30 changed files with 119 additions and 177 deletions

View File

@ -294,7 +294,7 @@ const refreshAlerts = () => {
// 模拟刷新数据
console.log('刷新预警数据')
}
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
// 通知负责人
const notifyResponsible = async () => {
if (!currentAlert.value) return
@ -303,7 +303,7 @@ const notifyResponsible = async () => {
notifyMessage.value = ''
try {
const response = await axios.post(`http://localhost:5000/api/fault/notify/${currentAlert.value.id}`)
const response = await axios.post(`${apiUrl}/api/fault/notify/${currentAlert.value.id}`)
if (response.data.success) {
notifyMessage.value = '通知已成功发送给负责人'

View File

@ -253,7 +253,7 @@ import axios from 'axios';
import Askai from "../components1/askai.vue";
// 配置后端基础URL
axios.defaults.baseURL = 'http://localhost:5000';
axios.defaults.baseURL = import.meta.env.VITE_API_BASE_URL;
// 状态管理
const isLoading = ref(false);

View File

@ -46,7 +46,7 @@ import Gu4 from "../components3/gu4.vue";
import Gu5 from "../components3/gu5.vue";
import Gu6 from "../components3/gu6.vue";
import Askai from "../components1/askai.vue";
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
export default {
name: 'FaultManagementDashboard',
components: {Askai, Gu6, Gu5, Gu4 },
@ -73,7 +73,7 @@ export default {
async fetchDashboardData() {
this.isLoading = true;
try {
const response = await axios.get('http://localhost:5000/dashboard');
const response = await axios.get(`${apiUrl}/dashboard`);
const {todayFaults, monthlyFaults, limit} = response.data;
this.todayFaults = todayFaults;

View File

@ -577,11 +577,11 @@ onMounted(() => {
fetchLogs();
}
});
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
// 获取用户数据
const fetchUsers = async () => {
try {
const response = await axios.get('http://localhost:5000/personnel/users', {
const response = await axios.get(`${apiUrl}/personnel/users`, {
headers: {
Authorization: `Bearer ${userInfo.token}`
}
@ -613,7 +613,7 @@ const fetchUsers = async () => {
// 获取日志数据
const fetchLogs = async () => {
try {
const response = await axios.get(`http://localhost:5000/personnel/logs`, {
const response = await axios.get(`${apiUrl}/personnel/logs`, {
headers: {
Authorization: `Bearer ${userInfo.token}`
}
@ -674,7 +674,7 @@ const handleAddUser = async () => {
};
try {
const response = await axios.post('http://localhost:5000/personnel/users', requestData, {
const response = await axios.post(`${apiUrl}/personnel/users`, requestData, {
headers: {
Authorization: `Bearer ${userInfo.token}`
}
@ -761,7 +761,7 @@ const handleEditUser = async () => {
try {
const response = await axios.put(
`http://localhost:5000/personnel/users/${editingUser.value.username}`,
`${apiUrl}/personnel/users/${editingUser.value.username}`,
payload,
{
headers: {
@ -803,7 +803,7 @@ const deleteUser = async (username) => {
if (!confirm(`确定要删除用户 ${username} 吗?此操作不可撤销。`)) return;
try {
const response = await axios.delete(`http://localhost:5000/personnel/users/${username}`, {
const response = await axios.delete(`${apiUrl}/personnel/users/${username}`, {
headers: {
Authorization: `Bearer ${userInfo.token}`
}