diff --git a/src/views/TicketManagement.vue b/src/views/TicketManagement.vue
index fc5c21b..5450be6 100644
--- a/src/views/TicketManagement.vue
+++ b/src/views/TicketManagement.vue
@@ -73,7 +73,7 @@
-
@@ -268,9 +268,10 @@ const handleAdd = () => {
isEditing.value = false;
currentTicket.value = {
website: "",
- operator: "",
- staff_id: null,
- is_complete: "未分配",
+ company_id: null,
+ operator_id: null,
+ user_id: null,
+ status: 0,
remark: "",
};
showAddDialog.value = true;
@@ -324,18 +325,25 @@ const handleDelete = async (id) => {
};
const handleBatchFinish = async () => {
- const ids = selectedTickets.value.map((t) => t.id);
+ const selected = selectedTickets.value;
+ const ids = selected.map((t) => t.id);
+ const hasUnlocked = selected.some((t) => !t.lock_time || t.lock_time === "0");
+
try {
await ElMessageBox.confirm(
- `确认将选中的 ${ids.length} 个工单一键已完结?`,
+ `确认将选中的 ${ids.length} 个工单一键已完结?${hasUnlocked ? "
检测到未锁定工单,将自动补齐锁定时间。" : ""}`,
"批量操作",
- { type: "warning", confirmButtonText: "确认已完结" }
+ {
+ type: "warning",
+ confirmButtonText: "确认已完结",
+ dangerouslyUseHTMLString: true,
+ }
);
- const res = await ticketApi.batchUpdateTicket({
- ids,
- status: "已完结",
- remark: "批量结单",
- });
+ const payload = { ids, status: 3 };
+ if (hasUnlocked) {
+ payload.lock_time = String(Math.floor(Date.now() / 1000));
+ }
+ const res = await ticketApi.batchUpdateTicket(payload);
if (res.code === 200) {
ElMessage.success(res.data?.msg || `成功完结 ${ids.length} 个工单`);
ticketListRef.value.clearSelection();