Vanessa 2025-09-02 18:36:38 +08:00
parent 8d2e3bfd20
commit 7b2e48d54e

View file

@ -219,33 +219,46 @@ export const setFilter = async (options: {
}); });
return; return;
} }
let targetAVId = ""; if (colData.rollup.calc?.operator && colData.rollup.calc.operator !== "Range") {
fields.find((column) => { if (["Count all", "Count empty", "Count not empty", "Count values", "Count unique values", "Percent empty",
if (column.id === colData.rollup.relationKeyID) { "Percent not empty", "Percent unique values", "Percent checked", "Percent unchecked", "Sum", "Average", "Median",
targetAVId = column.relation.avID; "Min", "Max"].includes(colData.rollup.calc.operator)) {
return true; filterValue.type = "number";
} else if (["Checked", "Unchecked"].includes(colData.rollup.calc.operator)) {
filterValue.type = "checkbox";
} else if (["Earliest", "Latest"].includes(colData.rollup.calc.operator)) {
filterValue.type = "date";
} }
}); } else {
const response = await fetchSyncPost("/api/av/getAttributeView", {id: targetAVId}); let targetAVId = "";
response.data.av.keyValues.find((item: { fields.find((column) => {
key: { if (column.id === colData.rollup.relationKeyID) {
id: string, targetAVId = column.relation.avID;
name: string, return true;
type: TAVCol,
options: {
name: string,
color: string,
}[]
}
}) => {
if (item.key.id === colData.rollup.keyID) {
filterValue.type = item.key.type;
if (item.key.type === "select") {
colData.options = item.key.options;
} }
return true; });
} const response = await fetchSyncPost("/api/av/getAttributeView", {id: targetAVId});
}); response.data.av.keyValues.find((item: {
key: {
id: string,
name: string,
type: TAVCol,
options: {
name: string,
color: string,
}[]
}
}) => {
if (item.key.id === colData.rollup.keyID) {
filterValue.type = item.key.type;
if (item.key.type === "select") {
colData.options = item.key.options;
}
return true;
}
});
}
options.data.view.filters.find(item => { options.data.view.filters.find(item => {
if (item.column === colData.id && item.value.type === "rollup") { if (item.column === colData.id && item.value.type === "rollup") {
if (!item.value.rollup || !item.value.rollup.contents || item.value.rollup.contents.length === 0) { if (!item.value.rollup || !item.value.rollup.contents || item.value.rollup.contents.length === 0) {