This commit is contained in:
Viet An
2026-05-25 15:23:12 +07:00
parent 5f2a98977b
commit 6685a43360
48 changed files with 732 additions and 2901 deletions

View File

@@ -256,7 +256,10 @@ async function update() {
if (checkError()) return;
if (!record.value.id) {
if (record.value.phone) record.value.phone = record.value.phone.trim();
let obj = await $getdata("company", { phone: record.value.phone }, undefined, true);
const obj = await $getdata("company", {
first: true,
filter: { phone: record.value.phone },
});
if (obj) {
existedCustomer = obj;
errors.phone = "Số điện thoại đã tồn tại trong hệ thống.";
@@ -271,7 +274,10 @@ async function update() {
if (rs === "error") return;
if (!record.value.id) $snackbar(`Khách hàng đã được khởi tạo với mã <b>${rs.code}</b>`, "Success");
record.value.id = rs.id;
let ele = await $getdata("company", { id: rs.id }, null, true);
let ele = await $getdata("company", {
first: true,
filter: { id: rs.id },
});
emit("update", ele);
emit("modalevent", { name: "dataevent", data: ele });
}