| | |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { Refresh, Search } from "@element-plus/icons-vue"; |
| | | import http from "../api/http"; |
| | | import { normalizeFormData } from "../utils/formHelper"; |
| | | import { useAuthStore } from "../stores/auth"; |
| | | |
| | | type VisitorRow = { |
| | |
| | | } |
| | | saving.value = true; |
| | | try { |
| | | await http.put(`/sys/visitor-users/${editingId.value}`, { |
| | | const payload = normalizeFormData({ |
| | | uuid: form.uuid, |
| | | userName: form.userName.trim(), |
| | | mobile: form.mobile.trim(), |
| | | gender: form.gender || undefined, |
| | | companyName: form.companyName.trim() || undefined, |
| | | }); |
| | | await http.put(`/sys/visitor-users/${editingId.value}`, payload); |
| | | const nextStatus = form.statusEnabled ? 1 : 0; |
| | | if (nextStatus !== originalStatus.value) { |
| | | await http.patch(`/sys/visitor-users/${editingId.value}/status`, { |
| | | const statusPayload = normalizeFormData({ |
| | | uuid: form.uuid, |
| | | status: nextStatus, |
| | | }); |
| | | await http.patch(`/sys/visitor-users/${editingId.value}/status`, statusPayload); |
| | | } |
| | | ElMessage.success("已保存"); |
| | | dlg.value = false; |