(filename, action)
| 289 | |
| 290 | // 凭证操作 |
| 291 | async action(filename, action) { |
| 292 | try { |
| 293 | const response = await fetch(`${this.getEndpoint('action')}?${this.getModeParam()}`, { |
| 294 | method: 'POST', |
| 295 | headers: getAuthHeaders(), |
| 296 | body: JSON.stringify({ filename, action }) |
| 297 | }); |
| 298 | |
| 299 | const data = await response.json(); |
| 300 | |
| 301 | if (response.ok) { |
| 302 | showStatus(data.message || `操作成功: ${action}`, 'success'); |
| 303 | await this.refresh(); |
| 304 | } else { |
| 305 | showStatus(`操作失败: ${data.detail || data.error || '未知错误'}`, 'error'); |
| 306 | } |
| 307 | } catch (error) { |
| 308 | showStatus(`网络错误: ${error.message}`, 'error'); |
| 309 | } |
| 310 | }, |
| 311 | |
| 312 | // 批量操作 |
| 313 | async batchAction(action) { |
nothing calls this directly
no test coverage detected