This commit is contained in:
Viet An
2026-06-04 13:57:27 +07:00
parent 2981d9790a
commit 2a1f85c2af
44 changed files with 99 additions and 102 deletions

View File

@@ -83,7 +83,7 @@ export default {
form.append("type", "image");
form.append("size", 100);
form.append("user", this.$store.state.login.id);
let result = await this.$insertapi("upload", form);
let result = await this.$insertapi("upload", { data: form });
if (result === "error") return;
let row = result.rows[0];
const file = new File([blod], name, { type: "image/png" });

View File

@@ -129,7 +129,7 @@ export default {
form.append("type", "file");
form.append("size", this.selected.size);
form.append("user", this.$store.state.login.id);
let result = await this.$insertapi("upload", form);
let result = await this.$insertapi("upload", { data: form });
this.loading = false;
if (result === "error") return;
this.$emit("modalevent", { name: "image", data: result.rows[0] });

View File

@@ -70,7 +70,7 @@ export default {
return { ref: this.row.id, file: v.id };
});
let found = this.$findapi(this.api);
let rs = await this.$insertapi(this.api, arr, found.params.values);
let rs = await this.$insertapi(this.api, { data: arr, values: found.params.values });
if (rs !== "error") {
this.files = this.files.concat(rs);
this.vbind = undefined;

View File

@@ -54,7 +54,7 @@ export default {
return { ref: this.row.id, file: v.id };
});
let found = this.$findapi(this.api);
let rs = await this.$insertapi(this.api, arr, found.params.values);
let rs = await this.$insertapi(this.api, { data: arr, values: found.params.values });
if (rs === "error") return;
this.files = this.files.concat(rs);
this.$store.commit("updateState", {

View File

@@ -80,7 +80,7 @@ export default {
return { ref: this.row.id, file: v.id };
});
let found = this.$findapi(this.api);
let rs = await this.$insertapi(this.api, arr, found.params.values);
let rs = await this.$insertapi(this.api, { data: arr, values: found.params.values });
if (rs === "error") return;
this.files = this.files.concat(rs);
if (this.pagename) {

View File

@@ -275,7 +275,7 @@ async function attachFiles(files) {
product: isForProduct.value ? product.id : undefined,
}));
const result = await $insertapi(isForProduct.value ? "productfile" : "projectfile", payload);
const result = await $insertapi(isForProduct.value ? "productfile" : "projectfile", { data: payload });
if (result === "error") {
throw new Error("Không thể liên kết tệp");
}

View File

@@ -349,14 +349,14 @@ export default {
form.append("type", "image");
form.append("size", 100);
form.append("user", this.$store.login.id);
let result = await this.$insertapi("upload", form);
let result = await this.$insertapi("upload", { data: form });
if (result === "error") return;
this.updateImage(result.rows[0]);
this.showUrl = false;
},
async uploadImage(file) {
this.loading = true;
let result = await this.$insertapi("upload", file.form);
let result = await this.$insertapi("upload", { data: file.form });
this.data.splice(0, 0, result.rows[0]);
this.loading = false;
},

View File

@@ -56,7 +56,7 @@ if (!found) upload();
async function doUpload(v, i) {
const file = props.files[i];
const rs = await $insertapi("upload", file.form, undefined, false);
const rs = await $insertapi("upload", { data: file.form, notify: false });
v.status = rs === "error" ? "error" : "success";
vfiles.value[i] = v;
const obj = rs.rows[0];