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

@@ -18,8 +18,10 @@ export default {
let obj;
if (this.attr === "image_count") {
let rs = await this.$getdata(this.api, {
ref: this.row.id,
file__type: 2,
filter: {
ref: this.row.id,
file__type: 2,
},
});
if (rs.length > 0) {
obj = {

View File

@@ -40,8 +40,10 @@ export default {
},
async created() {
this.files = await this.$getdata(this.api, {
ref: this.row.id,
file__type: 1,
filter: {
ref: this.row.id,
file__type: 1,
},
});
if (this.files.length > 0)
this.vbind = {

View File

@@ -41,7 +41,7 @@ export default {
};
},
async created() {
this.record = await this.$getdata("file", { id: this.row.file || this.row.id }, undefined, true);
this.record = await this.$getdata("file", { filter: { id: this.row.file || this.row.id }, first: true });
},
methods: {
async save() {

View File

@@ -23,8 +23,10 @@ export default {
async created() {
this.pagedata = this.$getpage();
this.files = await this.$getdata(this.api, {
ref: this.row.id,
file__type: 1,
filter: {
ref: this.row.id,
file__type: 1,
},
});
this.vbind = {
pagename: this.pagename1,
@@ -62,7 +64,7 @@ export default {
});
if (this.pagename) {
let vapi = this.api.replace("file", "");
let ele = await this.$getdata(vapi, { id: this.row.id }, undefined, true);
let ele = await this.$getdata(vapi, { filter: { id: this.row.id }, first: true });
this.$updatepage(this.pagename, ele);
}
},

View File

@@ -67,7 +67,7 @@ export default {
},
},
async created() {
this.files = await this.$getdata(this.api, { ref: this.row.id }); //file__type: 2
this.files = await this.$getdata(this.api, { filter: { ref: this.row.id } }); //file__type: 2
},
methods: {
async remove(v, i) {
@@ -85,7 +85,7 @@ export default {
this.files = this.files.concat(rs);
if (this.pagename) {
let vapi = this.vapi ? this.vapi : this.api.replace("file", "");
let ele = await this.$getdata(vapi, { id: this.row.id }, undefined, true);
let ele = await this.$getdata(vapi, { filter: { id: this.row.id }, first: true });
this.$updatepage(this.pagename, ele);
}
},

View File

@@ -206,10 +206,12 @@ const layoutMode = ref(layoutModes.GRID);
const convertToWebp = ref(false);
const webpQuality = ref(80);
const project = await $getdata("project", { id: props.projectId }, undefined, true);
const project = await $getdata("project", { filter: { id: props.projectId }, first: true });
const images = ref([]);
const isForProduct = computed(() => props.productId !== undefined);
const product = isForProduct.value ? await $getdata("product", { id: props.productId }, undefined, true) : undefined;
const product = isForProduct.value
? await $getdata("product", { filter: { id: props.productId }, first: true })
: undefined;
const showmodal = ref();
const imgshow = ref([]);
const hashtag = ref();
@@ -219,17 +221,21 @@ async function loadImages() {
const values =
"id,file__hashtag,file__code,file,create_time,file__code,file__type,file__doc_type,file__name,file__file,file__size,file__caption,file__user__fullname,";
const projectImages = await $getdata("projectfile", undefined, {
filter: { project: project.id, file__type: 2 },
values: values + "project",
sort: "-create_time",
const projectImages = await $getdata("projectfile", {
params: {
filter: { project: project.id, file__type: 2 },
values: values + "project",
sort: "-create_time",
},
});
if (isForProduct.value) {
const productImages = await $getdata("productfile", undefined, {
filter: { product: props.productId, file__type: 2 },
values: values + "product",
sort: "-create_time",
params: {
filter: { product: props.productId, file__type: 2 },
values: values + "product",
sort: "-create_time",
},
});
const sameTemplateImages = projectImages.filter((img) => img.file__name.startsWith(product.template_name));

View File

@@ -63,7 +63,7 @@ export default {
},
async created() {
let arr = [];
let files = await this.$getdata("file", { file__in: this.image });
let files = await this.$getdata("file", { filter: { file__in: this.image } });
this.image.map((v) => {
let found = this.$find(files, { file: v });
arr.push({ image: `${this.$getpath()}download/?name=${v}`, file: found });

View File

@@ -298,9 +298,9 @@ export default {
this.timer = setTimeout(() => this.startSearch(e.target.value), 150);
},
async startSearch(value) {
let filter = { user: this.login.id };
const filter = { user: this.login.id };
if (!this.$empty(value)) filter.name__icontains = value.toLowerCase();
this.data = await this.$getdata("file", filter);
this.data = await this.$getdata("file", { filter });
},
displayInput() {
this.showUrl = true;