3v324v23 commited on
Commit
0b654da
·
1 Parent(s): 04a9c5d

Fix Jinja2/Vue delimiter conflict by using ${ } for Vue

Browse files
Files changed (1) hide show
  1. templates/index.html +14 -14
templates/index.html CHANGED
@@ -35,7 +35,7 @@
35
  class="p-3 rounded-lg cursor-pointer transition-all border"
36
  :class="currentAsset?.id === asset.id ? 'bg-indigo-50 border-indigo-200 text-indigo-700' : 'bg-white border-transparent hover:bg-gray-50'">
37
  <div class="flex justify-between items-center mb-1">
38
- <span class="font-medium truncate">{{ asset.name }}</span>
39
  <span class="w-2 h-2 rounded-full"
40
  :class="{
41
  'bg-green-500': asset.status === 'operational',
@@ -44,8 +44,8 @@
44
  }"></span>
45
  </div>
46
  <div class="text-xs text-gray-500 flex justify-between">
47
- <span>{{ asset.type }}</span>
48
- <span>健康度: {{ asset.health_score }}%</span>
49
  </div>
50
  </div>
51
  </div>
@@ -60,7 +60,7 @@
60
  <!-- Header -->
61
  <header class="h-16 bg-white border-b border-gray-200 flex justify-between items-center px-8 shadow-sm z-10">
62
  <h1 class="text-lg font-semibold text-gray-700">
63
- {{ currentAsset ? currentAsset.name + ' - 仪表盘' : '仪表盘' }}
64
  </h1>
65
  <div class="flex items-center gap-4">
66
  <!-- Upload Button -->
@@ -95,7 +95,7 @@
95
  'text-yellow-600': currentAsset.health_score <= 80 && currentAsset.health_score > 50,
96
  'text-red-600': currentAsset.health_score <= 50
97
  }">
98
- {{ currentAsset.health_score }}%
99
  </span>
100
  <span class="text-sm text-gray-400 mb-1">vs 上周</span>
101
  </div>
@@ -108,20 +108,20 @@
108
  <span v-if="currentAsset.status === 'operational'" class="text-green-600">运行中</span>
109
  <span v-else-if="currentAsset.status === 'warning'" class="text-yellow-600">警告</span>
110
  <span v-else-if="currentAsset.status === 'critical'" class="text-red-600">危急</span>
111
- <span v-else>{{ currentAsset.status }}</span>
112
  </div>
113
  </div>
114
 
115
  <!-- Temp -->
116
  <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
117
  <div class="text-gray-400 text-xs font-medium uppercase mb-2">平均温度 (Avg Temp)</div>
118
- <div class="text-2xl font-bold">{{ lastTemp }} °C</div>
119
  </div>
120
 
121
  <!-- Vibration -->
122
  <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
123
  <div class="text-gray-400 text-xs font-medium uppercase mb-2">峰值振动 (Peak Vib)</div>
124
- <div class="text-2xl font-bold">{{ lastVib }} mm/s</div>
125
  </div>
126
  </div>
127
 
@@ -155,11 +155,11 @@
155
  'bg-red-100 text-red-700': anomaly.severity === 'critical',
156
  'bg-yellow-100 text-yellow-700': anomaly.severity === 'warning'
157
  }">
158
- {{ anomaly.severity === 'critical' ? '危急' : (anomaly.severity === 'warning' ? '警告' : anomaly.severity) }}
159
  </span>
160
- <span class="ml-2 text-sm text-gray-500">{{ anomaly.timestamp }}</span>
161
  <div class="mt-1 font-medium text-gray-800">
162
- {{ anomaly.metric === 'Vibration' ? '振动' : (anomaly.metric === 'Temperature' ? '温度' : anomaly.metric) }} 出阈值 ({{ anomaly.value }} > {{ anomaly.threshold }})
163
  </div>
164
  </div>
165
  <button v-if="!anomaly.diagnosis"
@@ -167,7 +167,7 @@
167
  class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-indigo-700 transition flex items-center gap-2"
168
  :disabled="diagnosingId === anomaly.id">
169
  <i class="fas fa-stethoscope" :class="{'animate-pulse': diagnosingId === anomaly.id}"></i>
170
- {{ diagnosingId === anomaly.id ? '分析中...' : 'AI 智能诊断' }}
171
  </button>
172
  <div v-else class="text-right">
173
  <span class="text-xs font-bold text-green-600 border border-green-200 px-2 py-1 rounded bg-green-50">已诊断</span>
@@ -179,11 +179,11 @@
179
  <div class="flex gap-4">
180
  <div class="flex-1">
181
  <div class="text-indigo-800 font-bold mb-1"><i class="fas fa-clipboard-check mr-1"></i> 根因分析 (Root Cause)</div>
182
- <p class="text-indigo-700 leading-relaxed">{{ anomaly.diagnosis }}</p>
183
  </div>
184
  <div class="flex-1 border-l border-indigo-200 pl-4">
185
  <div class="text-indigo-800 font-bold mb-1"><i class="fas fa-tools mr-1"></i> 维修建议 (Recommendation)</div>
186
- <p class="text-indigo-700 leading-relaxed">{{ anomaly.recommendation }}</p>
187
  </div>
188
  </div>
189
  </div>
 
35
  class="p-3 rounded-lg cursor-pointer transition-all border"
36
  :class="currentAsset?.id === asset.id ? 'bg-indigo-50 border-indigo-200 text-indigo-700' : 'bg-white border-transparent hover:bg-gray-50'">
37
  <div class="flex justify-between items-center mb-1">
38
+ <span class="font-medium truncate">${ asset.name }</span>
39
  <span class="w-2 h-2 rounded-full"
40
  :class="{
41
  'bg-green-500': asset.status === 'operational',
 
44
  }"></span>
45
  </div>
46
  <div class="text-xs text-gray-500 flex justify-between">
47
+ <span>${ asset.type }</span>
48
+ <span>健康度: ${ asset.health_score }%</span>
49
  </div>
50
  </div>
51
  </div>
 
60
  <!-- Header -->
61
  <header class="h-16 bg-white border-b border-gray-200 flex justify-between items-center px-8 shadow-sm z-10">
62
  <h1 class="text-lg font-semibold text-gray-700">
63
+ ${ currentAsset ? currentAsset.name + ' - 仪表盘' : '仪表盘' }
64
  </h1>
65
  <div class="flex items-center gap-4">
66
  <!-- Upload Button -->
 
95
  'text-yellow-600': currentAsset.health_score <= 80 && currentAsset.health_score > 50,
96
  'text-red-600': currentAsset.health_score <= 50
97
  }">
98
+ ${ currentAsset.health_score }%
99
  </span>
100
  <span class="text-sm text-gray-400 mb-1">vs 上周</span>
101
  </div>
 
108
  <span v-if="currentAsset.status === 'operational'" class="text-green-600">运行中</span>
109
  <span v-else-if="currentAsset.status === 'warning'" class="text-yellow-600">警告</span>
110
  <span v-else-if="currentAsset.status === 'critical'" class="text-red-600">危急</span>
111
+ <span v-else>${ currentAsset.status }</span>
112
  </div>
113
  </div>
114
 
115
  <!-- Temp -->
116
  <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
117
  <div class="text-gray-400 text-xs font-medium uppercase mb-2">平均温度 (Avg Temp)</div>
118
+ <div class="text-2xl font-bold">${ lastTemp } °C</div>
119
  </div>
120
 
121
  <!-- Vibration -->
122
  <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
123
  <div class="text-gray-400 text-xs font-medium uppercase mb-2">峰值振动 (Peak Vib)</div>
124
+ <div class="text-2xl font-bold">${ lastVib } mm/s</div>
125
  </div>
126
  </div>
127
 
 
155
  'bg-red-100 text-red-700': anomaly.severity === 'critical',
156
  'bg-yellow-100 text-yellow-700': anomaly.severity === 'warning'
157
  }">
158
+ ${ anomaly.severity === 'critical' ? '危急' : (anomaly.severity === 'warning' ? '警告' : anomaly.severity) }
159
  </span>
160
+ <span class="ml-2 text-sm text-gray-500">${ anomaly.timestamp }</span>
161
  <div class="mt-1 font-medium text-gray-800">
162
+ ${ anomaly.metric === 'Vibration' ? '振动' : (anomaly.metric === 'Temperature' ? '温度' : anomaly.metric) } ���出阈值 (${ anomaly.value } > ${ anomaly.threshold })
163
  </div>
164
  </div>
165
  <button v-if="!anomaly.diagnosis"
 
167
  class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-indigo-700 transition flex items-center gap-2"
168
  :disabled="diagnosingId === anomaly.id">
169
  <i class="fas fa-stethoscope" :class="{'animate-pulse': diagnosingId === anomaly.id}"></i>
170
+ ${ diagnosingId === anomaly.id ? '分析中...' : 'AI 智能诊断' }
171
  </button>
172
  <div v-else class="text-right">
173
  <span class="text-xs font-bold text-green-600 border border-green-200 px-2 py-1 rounded bg-green-50">已诊断</span>
 
179
  <div class="flex gap-4">
180
  <div class="flex-1">
181
  <div class="text-indigo-800 font-bold mb-1"><i class="fas fa-clipboard-check mr-1"></i> 根因分析 (Root Cause)</div>
182
+ <p class="text-indigo-700 leading-relaxed">${ anomaly.diagnosis }</p>
183
  </div>
184
  <div class="flex-1 border-l border-indigo-200 pl-4">
185
  <div class="text-indigo-800 font-bold mb-1"><i class="fas fa-tools mr-1"></i> 维修建议 (Recommendation)</div>
186
+ <p class="text-indigo-700 leading-relaxed">${ anomaly.recommendation }</p>
187
  </div>
188
  </div>
189
  </div>