@ -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;
|
||||
}
|
||||
|
||||
@ -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' }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user