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

@ -85,11 +85,11 @@ const initChart = () => {
const handleResize = () => {
chartInstance?.resize();
};
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
// 获取故障类型数据
const fetchFaultData = async () => {
try {
const response = await axios.get('http://localhost:5000/fault-types');
const response = await axios.get(`${apiUrl}/fault-types`);
if (response.data.success) {
faultData.value = response.data.data;
}

View File

@ -97,6 +97,8 @@
</template>
<script>
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
export default {
name: 'FaultManagement',
data() {
@ -123,7 +125,7 @@ export default {
methods: {
async fetchFaults() {
try {
const response = await fetch(`http://localhost:5000/fault-list?page=${this.currentPage}&size=${this.pageSize}&search=${this.searchQuery}&status=${this.selectedStatus}`);
const response = await fetch(`${apiUrl}/fault-list?page=${this.currentPage}&size=${this.pageSize}&search=${this.searchQuery}&status=${this.selectedStatus}`);
const data = await response.json();
if (data.success) {
this.faults = data.data;
@ -159,7 +161,7 @@ export default {
},
async notifyResponsible(fault) {
try {
const response = await fetch(`http://localhost:5000/api/fault/notify/${fault.id}`, {
const response = await fetch(`${apiUrl}/api/fault/notify/${fault.id}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});