This commit is contained in:
Viet An
2026-05-15 11:18:33 +07:00
parent 869138c003
commit 0ef1d29850
18 changed files with 175 additions and 111 deletions

View File

@@ -570,7 +570,10 @@ export default defineNuxtPlugin((nuxtApp) => {
commit: "product",
url: "data/Product/",
url_detail: "data-detail/Product/",
params: {},
params: {
values:
"id,code,name,manufacturer,manufacturer__name,os,os__name,battery,battery__code,screen,cpu,cpu__name,gpu,gpu__name,camera_system,camera_system__code,sim,sim__code,network_technology,network_technology__name,charging_technology,charging_technology__code,external_storage,external_storage__max_capacity,ip_rating,ip_rating__code,design,create_time,update_time",
},
},
{
name: "Product_Variant",
@@ -1188,7 +1191,7 @@ export default defineNuxtPlugin((nuxtApp) => {
// insert data
const insertapi = async function (name, data, values, notify) {
try {
let found = findapi(name);
const found = findapi(name);
const curpath = found.path ? paths.find((x) => x.name === found.path).url : path;
let rs;
if (!Array.isArray(data)) {
@@ -1464,13 +1467,13 @@ export default defineNuxtPlugin((nuxtApp) => {
});
}
if (found.commit) {
let copy = JSON.parse(JSON.stringify($store[found.commit]));
const copy = $copy($store[found.commit]);
if (!Array.isArray(id)) {
let index = copy.findIndex((v) => v.id === id);
const index = copy.findIndex((v) => v.id === id);
if (index >= 0) $remove(copy, index);
} else {
rs.forEach((element) => {
let index = copy.findIndex((v) => v.id === element.id);
const index = copy.findIndex((v) => v.id === element.id);
if (index >= 0) $remove(copy, index);
});
}
@@ -1478,7 +1481,7 @@ export default defineNuxtPlugin((nuxtApp) => {
}
return id;
} catch (err) {
console.log(err);
console.error(err);
if (err.response) {
let content = `<span>Đã xảy ra lỗi, xóa dữ liệu không thành công</span>`;
if (err.response.data)