新增一键完结,追加锁定工单时间
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TicketForm v-model="showAddDialog" :form-data="currentTicket" :companiesWithOperators="companywithoperatorsList"
|
||||
<TicketForm v-model="showAddDialog" :form-data="currentTicket" :companies-with-operators="companywithoperatorsList"
|
||||
:user-staffs="userStaffList" :is-editing="isEditing" @submit="handleFormSubmit" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -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 ? "<br/>检测到未锁定工单,将自动补齐锁定时间。" : ""}`,
|
||||
"批量操作",
|
||||
{ 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();
|
||||
|
||||
Reference in New Issue
Block a user