2023-06-08 18:21:10 +08:00
|
|
|
import {fetchPost} from "../../../util/fetch";
|
2023-07-07 11:12:49 +08:00
|
|
|
import {getColIconByType, showColMenu} from "./col";
|
2023-07-01 23:15:21 +08:00
|
|
|
import {Constants} from "../../../constants";
|
2023-07-15 23:18:35 +08:00
|
|
|
import {getCalcValue} from "./cell";
|
2023-07-22 22:56:15 +08:00
|
|
|
import * as dayjs from "dayjs";
|
2023-06-08 18:21:10 +08:00
|
|
|
|
2023-06-11 23:17:51 +08:00
|
|
|
export const avRender = (element: Element, cb?: () => void) => {
|
2023-06-07 11:55:45 +08:00
|
|
|
let avElements: Element[] = [];
|
|
|
|
|
if (element.getAttribute("data-type") === "NodeAttributeView") {
|
|
|
|
|
// 编辑器内代码块编辑渲染
|
|
|
|
|
avElements = [element];
|
|
|
|
|
} else {
|
|
|
|
|
avElements = Array.from(element.querySelectorAll('[data-type="NodeAttributeView"]'));
|
|
|
|
|
}
|
|
|
|
|
if (avElements.length === 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (avElements.length > 0) {
|
2023-06-08 22:55:31 +08:00
|
|
|
avElements.forEach((e: HTMLElement) => {
|
2023-06-07 11:55:45 +08:00
|
|
|
if (e.getAttribute("data-render") === "true") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-31 23:58:45 +08:00
|
|
|
fetchPost("/api/av/renderAttributeView", {
|
|
|
|
|
id: e.getAttribute("data-av-id"),
|
|
|
|
|
nodeID: e.getAttribute("data-node-id")
|
|
|
|
|
}, (response) => {
|
2023-07-11 21:34:22 +08:00
|
|
|
const data = response.data.view as IAVTable;
|
2023-06-08 19:21:33 +08:00
|
|
|
// header
|
2023-07-15 00:07:27 +08:00
|
|
|
let tableHTML = '<div class="av__row av__row--header"><div class="av__firstcol"><svg style="height: 32px"><use xlink:href="#iconUncheck"></use></svg></div>';
|
2023-07-15 23:19:40 +08:00
|
|
|
let calcHTML = "";
|
2023-06-08 18:25:33 +08:00
|
|
|
data.columns.forEach((column: IAVColumn) => {
|
2023-06-08 22:55:31 +08:00
|
|
|
if (column.hidden) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-09 23:54:32 +08:00
|
|
|
tableHTML += `<div class="av__cell" data-col-id="${column.id}" data-dtype="${column.type}"
|
2023-07-02 23:58:00 +08:00
|
|
|
style="width: ${column.width || "200px"};
|
2023-07-02 22:37:17 +08:00
|
|
|
${column.wrap ? "" : "white-space: nowrap;"}">
|
2023-07-02 23:58:00 +08:00
|
|
|
<div draggable="true" class="av__cellheader">
|
|
|
|
|
<svg><use xlink:href="#${column.icon || getColIconByType(column.type)}"></use></svg>
|
|
|
|
|
<span class="av__celltext">${column.name}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="av__widthdrag"></div>
|
2023-06-08 22:56:52 +08:00
|
|
|
</div>`;
|
2023-07-15 23:18:35 +08:00
|
|
|
calcHTML += `<div class="av__calc${calcHTML ? "" : " av__calc--show"}${column.calc && column.calc.operator !== "" ? " av__calc--ashow" : ""}" data-col-id="${column.id}" data-dtype="${column.type}" data-operator="${column.calc?.operator || ""}"
|
|
|
|
|
style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use xlink:href="#iconDown"></use></svg>' + window.siyuan.languages.calc}</div>`;
|
2023-06-08 18:21:10 +08:00
|
|
|
});
|
2023-07-15 00:07:27 +08:00
|
|
|
tableHTML += `<div class="block__icons" style="min-height: auto">
|
2023-06-08 19:21:33 +08:00
|
|
|
<div class="block__icon block__icon--show" data-type="av-header-add"><svg><use xlink:href="#iconAdd"></use></svg></div>
|
2023-06-08 12:03:04 +08:00
|
|
|
<div class="fn__space"></div>
|
2023-06-08 19:21:33 +08:00
|
|
|
<div class="block__icon block__icon--show" data-type="av-header-more"><svg><use xlink:href="#iconMore"></use></svg></div>
|
2023-06-08 12:03:04 +08:00
|
|
|
</div>
|
|
|
|
|
</div>`;
|
2023-06-08 19:21:33 +08:00
|
|
|
// body
|
2023-06-08 18:25:33 +08:00
|
|
|
data.rows.forEach((row: IAVRow) => {
|
2023-06-11 22:01:30 +08:00
|
|
|
tableHTML += `<div class="av__row" data-id="${row.id}">
|
2023-07-12 11:46:58 +08:00
|
|
|
<div class="av__gutters ariaLabel" draggable="true" data-position="right" aria-label="${window.siyuan.languages.rowTip}">
|
2023-06-11 22:01:30 +08:00
|
|
|
<button><svg><use xlink:href="#iconLine"></use></svg></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
|
2023-06-08 18:21:10 +08:00
|
|
|
row.cells.forEach((cell, index) => {
|
2023-07-02 20:52:16 +08:00
|
|
|
if (data.columns[index].hidden) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-12 00:08:00 +08:00
|
|
|
let text = "";
|
2023-06-30 16:26:35 +08:00
|
|
|
if (cell.valueType === "text") {
|
2023-07-09 23:54:32 +08:00
|
|
|
text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
|
2023-07-30 23:09:37 +08:00
|
|
|
} else if (cell.valueType === "url") {
|
|
|
|
|
text = `<span class="av__celltext av__celltext--url">${cell.value?.url.content || ""}</span>`;
|
|
|
|
|
if (cell.value?.url.content) {
|
|
|
|
|
text += `<span class="b3-chip b3-chip--info b3-chip--small" data-type="a" data-href="${cell.value.url.content}">${window.siyuan.languages.openBy}</span>`;
|
|
|
|
|
}
|
2023-06-30 16:26:35 +08:00
|
|
|
} else if (cell.valueType === "block") {
|
2023-07-18 11:47:47 +08:00
|
|
|
text = `<span class="av__celltext">${cell.value?.block.content || ""}</span>`;
|
2023-07-17 20:23:27 +08:00
|
|
|
if (cell.value?.block.id) {
|
2023-07-28 15:20:34 +08:00
|
|
|
text += `<span class="b3-chip b3-chip--info b3-chip--small" data-type="block-ref" data-id="${cell.value.block.id}" data-subtype="s">${window.siyuan.languages.openBy}</span>`;
|
2023-07-17 20:23:27 +08:00
|
|
|
}
|
2023-07-01 12:04:23 +08:00
|
|
|
} else if (cell.valueType === "number") {
|
2023-07-09 23:54:32 +08:00
|
|
|
text = `<span class="av__celltext">${cell.value?.number.content || ""}</span>`;
|
2023-07-10 23:22:04 +08:00
|
|
|
} else if (cell.valueType === "mSelect" || cell.valueType === "select") {
|
2023-07-11 00:03:11 +08:00
|
|
|
cell.value?.mSelect?.forEach((item: { content: string, color: string }) => {
|
2023-07-13 23:16:07 +08:00
|
|
|
text += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;
|
2023-07-10 00:17:54 +08:00
|
|
|
});
|
2023-07-10 23:22:04 +08:00
|
|
|
if (!text) {
|
2023-07-12 00:08:00 +08:00
|
|
|
text = '<span class="av__celltext"></span>';
|
2023-07-13 23:16:07 +08:00
|
|
|
} else {
|
|
|
|
|
text = `<span class="av__celltext">${text}</span>`;
|
2023-07-10 23:22:04 +08:00
|
|
|
}
|
2023-07-01 12:04:23 +08:00
|
|
|
} else if (cell.valueType === "date") {
|
2023-07-22 22:56:15 +08:00
|
|
|
text = '<span class="av__celltext">';
|
|
|
|
|
if (cell.value?.date.content) {
|
|
|
|
|
text += dayjs(cell.value.date.content).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
}
|
|
|
|
|
if (cell.value?.date.hasEndDate) {
|
|
|
|
|
text += `<svg style="margin-left: 5px"><use xlink:href="#iconForward"></use></svg>${dayjs(cell.value.date.content2).format("YYYY-MM-DD HH:mm")}</span>`;
|
|
|
|
|
}
|
2023-07-25 20:40:28 +08:00
|
|
|
text += "</span>";
|
2023-06-30 16:26:35 +08:00
|
|
|
}
|
2023-07-09 23:54:32 +08:00
|
|
|
tableHTML += `<div class="av__cell" data-id="${cell.id}" data-col-id="${data.columns[index].id}"
|
2023-07-02 22:37:17 +08:00
|
|
|
${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""}
|
2023-07-02 23:58:00 +08:00
|
|
|
style="width: ${data.columns[index].width || "200px"};
|
2023-07-02 22:37:17 +08:00
|
|
|
${cell.bgColor ? `background-color:${cell.bgColor};` : ""}
|
2023-07-02 23:58:00 +08:00
|
|
|
${data.columns[index].wrap ? "" : "white-space: nowrap;"}
|
2023-07-09 23:54:32 +08:00
|
|
|
${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
2023-06-08 18:21:10 +08:00
|
|
|
});
|
2023-06-08 22:56:52 +08:00
|
|
|
tableHTML += "<div></div></div>";
|
2023-06-08 10:07:26 +08:00
|
|
|
});
|
2023-07-12 00:08:00 +08:00
|
|
|
let tabHTML = "";
|
2023-07-11 23:13:19 +08:00
|
|
|
response.data.views.forEach((item: IAVView) => {
|
|
|
|
|
tabHTML += `<div data-id="${response.data.viewID}" class="item${item.id === response.data.viewID ? " item--focus" : ""}">
|
2023-07-11 21:34:22 +08:00
|
|
|
<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>
|
|
|
|
|
<span class="item__text">${item.name}</span>
|
2023-07-12 00:08:00 +08:00
|
|
|
</div>`;
|
|
|
|
|
});
|
2023-06-11 22:01:30 +08:00
|
|
|
const paddingLeft = e.parentElement.style.paddingLeft;
|
|
|
|
|
const paddingRight = e.parentElement.style.paddingRight;
|
|
|
|
|
e.style.width = e.parentElement.clientWidth + "px";
|
2023-06-08 18:21:10 +08:00
|
|
|
e.style.alignSelf = "center";
|
|
|
|
|
e.firstElementChild.outerHTML = `<div>
|
2023-06-30 23:57:11 +08:00
|
|
|
<div class="av__header" style="padding-left: ${paddingLeft};padding-right: ${paddingRight};">
|
|
|
|
|
<div class="layout-tab-bar fn__flex">
|
2023-07-11 21:34:22 +08:00
|
|
|
${tabHTML}
|
2023-07-02 20:52:16 +08:00
|
|
|
<div class="fn__flex-1"></div>
|
2023-07-03 20:54:57 +08:00
|
|
|
<span data-type="av-filter" class="block__icon block__icon--show b3-tooltips b3-tooltips__w${data.filters.length > 0 ? " block__icon--active" : ""}" aria-label="${window.siyuan.languages.filter}">
|
2023-07-02 20:52:16 +08:00
|
|
|
<svg><use xlink:href="#iconFilter"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="fn__space"></div>
|
2023-07-03 20:54:57 +08:00
|
|
|
<span data-type="av-sort" class="block__icon block__icon--show b3-tooltips b3-tooltips__w${data.sorts.length > 0 ? " block__icon--active" : ""}" aria-label="${window.siyuan.languages.sort}">
|
2023-07-02 20:52:16 +08:00
|
|
|
<svg><use xlink:href="#iconSort"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="fn__space"></div>
|
|
|
|
|
<span data-type="av-more" class="block__icon block__icon--show b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.more}">
|
|
|
|
|
<svg><use xlink:href="#iconMore"></use></svg>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="fn__space"></div>
|
2023-06-08 10:07:26 +08:00
|
|
|
</div>
|
2023-07-11 21:34:22 +08:00
|
|
|
<div contenteditable="true" class="av__title" data-title="${data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>
|
2023-06-30 23:57:11 +08:00
|
|
|
<div class="av__counter fn__none"></div>
|
2023-06-08 10:07:26 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="av__scroll">
|
2023-06-11 22:01:30 +08:00
|
|
|
<div style="padding-left: ${paddingLeft};padding-right: ${paddingRight};float: left;">
|
2023-06-08 10:07:26 +08:00
|
|
|
${tableHTML}
|
2023-07-15 00:07:27 +08:00
|
|
|
<div class="av__row--add">
|
|
|
|
|
<svg><use xlink:href="#iconAdd"></use></svg>
|
2023-06-08 12:03:04 +08:00
|
|
|
${window.siyuan.languages.addAttr}
|
|
|
|
|
</div>
|
2023-07-15 22:24:54 +08:00
|
|
|
<div class="av__row--footer"><div style="width: 24px"></div>${calcHTML}</div>
|
2023-06-08 10:07:26 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`;
|
2023-06-08 18:21:10 +08:00
|
|
|
e.setAttribute("data-render", "true");
|
2023-06-11 23:17:51 +08:00
|
|
|
if (cb) {
|
|
|
|
|
cb();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-02 23:59:01 +08:00
|
|
|
let lastParentID: string;
|
|
|
|
|
let lastElement: HTMLElement;
|
2023-06-11 23:17:51 +08:00
|
|
|
export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
2023-07-01 23:15:21 +08:00
|
|
|
if (lastParentID === operation.parentID && protyle.contentElement.isSameNode(lastElement)) {
|
2023-07-02 23:59:01 +08:00
|
|
|
return;
|
2023-07-01 20:48:44 +08:00
|
|
|
}
|
2023-07-01 23:15:21 +08:00
|
|
|
lastElement = protyle.contentElement;
|
|
|
|
|
lastParentID = operation.parentID;
|
2023-07-11 23:13:19 +08:00
|
|
|
const avId = operation.avID;
|
2023-06-11 23:17:51 +08:00
|
|
|
if (operation.action === "addAttrViewCol") {
|
2023-07-03 20:54:57 +08:00
|
|
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
2023-06-11 23:17:51 +08:00
|
|
|
item.removeAttribute("data-render");
|
|
|
|
|
avRender(item, () => {
|
2023-07-17 11:33:38 +08:00
|
|
|
showColMenu(protyle, item, item.querySelector(`.av__row--header .av__cell[data-col-id="${operation.id}"]`));
|
2023-06-08 22:55:31 +08:00
|
|
|
});
|
2023-06-07 11:55:45 +08:00
|
|
|
});
|
2023-07-02 23:58:00 +08:00
|
|
|
} else if (operation.action === "setAttrViewColWidth") {
|
2023-07-03 20:54:57 +08:00
|
|
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
2023-07-09 23:54:32 +08:00
|
|
|
const cellElement = item.querySelector(`.av__cell[data-col-id="${operation.id}"]`) as HTMLElement;
|
2023-07-02 23:58:00 +08:00
|
|
|
if (!cellElement || cellElement.style.width === operation.data) {
|
2023-07-02 23:59:01 +08:00
|
|
|
return;
|
2023-07-02 23:58:00 +08:00
|
|
|
}
|
|
|
|
|
item.querySelectorAll(".av__row").forEach(rowItem => {
|
2023-07-09 23:54:32 +08:00
|
|
|
(rowItem.querySelector(`[data-col-id="${operation.id}"]`) as HTMLElement).style.width = operation.data;
|
2023-07-02 23:59:01 +08:00
|
|
|
});
|
2023-07-02 23:58:00 +08:00
|
|
|
});
|
2023-07-11 22:48:48 +08:00
|
|
|
} else if (operation.action === "setAttrViewName") {
|
2023-07-03 23:02:19 +08:00
|
|
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
|
|
|
|
const titleElement = item.querySelector(".av__title") as HTMLElement;
|
2023-07-11 22:48:48 +08:00
|
|
|
if (!titleElement || titleElement.textContent.trim() === operation.data) {
|
2023-07-03 23:02:19 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2023-07-11 22:48:48 +08:00
|
|
|
titleElement.textContent = operation.data;
|
|
|
|
|
titleElement.dataset.title = operation.data;
|
2023-07-03 23:02:19 +08:00
|
|
|
});
|
2023-07-01 12:15:31 +08:00
|
|
|
} else {
|
2023-07-03 20:54:57 +08:00
|
|
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
|
2023-06-11 23:17:51 +08:00
|
|
|
item.removeAttribute("data-render");
|
|
|
|
|
avRender(item);
|
|
|
|
|
});
|
2023-06-07 11:55:45 +08:00
|
|
|
}
|
2023-07-01 23:15:21 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
|
lastParentID = null;
|
|
|
|
|
}, Constants.TIMEOUT_TRANSITION);
|
2023-06-07 11:56:34 +08:00
|
|
|
};
|
2023-07-30 22:39:37 +08:00
|
|
|
|
|
|
|
|
const genAVValueHTML = (value: IAVCellValue) => {
|
2023-07-31 11:32:36 +08:00
|
|
|
let html = "";
|
2023-07-30 22:39:37 +08:00
|
|
|
switch (value.type) {
|
|
|
|
|
case "text":
|
|
|
|
|
html = `<input value="${value.text.content}" class="b3-text-field b3-text-field--text fn__flex-1">`;
|
|
|
|
|
break;
|
|
|
|
|
case "number":
|
|
|
|
|
html = `<input value="${value.number.content}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">`;
|
|
|
|
|
break;
|
|
|
|
|
case "mSelect":
|
|
|
|
|
case "select":
|
2023-07-31 11:10:38 +08:00
|
|
|
value.mSelect?.forEach(item => {
|
2023-07-30 22:39:37 +08:00
|
|
|
html += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;
|
2023-07-31 11:32:36 +08:00
|
|
|
});
|
2023-07-30 22:39:37 +08:00
|
|
|
break;
|
|
|
|
|
case "date":
|
2023-07-31 23:58:45 +08:00
|
|
|
html = `${dayjs(value.date.content).format("YYYY-MM-DD HH:mm")}`;
|
2023-07-30 22:39:37 +08:00
|
|
|
if (value.date.hasEndDate) {
|
2023-07-31 23:58:45 +08:00
|
|
|
html += `<svg class="custom-attr__avarrow"><use xlink:href="#iconForward"></use></svg>${dayjs(value.date.content2).format("YYYY-MM-DD HH:mm")}`;
|
2023-07-30 22:39:37 +08:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "url":
|
|
|
|
|
html = `<input value="${value.url.content}" class="b3-text-field b3-text-field--text fn__flex-1">`;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return html;
|
2023-07-31 11:32:36 +08:00
|
|
|
};
|
2023-07-30 22:39:37 +08:00
|
|
|
|
|
|
|
|
export const renderAVAttribute = (element: HTMLElement, id: string) => {
|
|
|
|
|
fetchPost("/api/av/getAttributeViewKeys", {id}, (response) => {
|
2023-07-31 11:32:36 +08:00
|
|
|
let html = "";
|
2023-07-30 22:39:37 +08:00
|
|
|
response.data.forEach((table: {
|
|
|
|
|
keyValues: {
|
|
|
|
|
key: {
|
|
|
|
|
type: TAVCol,
|
|
|
|
|
name: string
|
|
|
|
|
},
|
2023-07-31 23:58:45 +08:00
|
|
|
values: { keyID: string, id: string, blockID: string, type?: TAVCol & IAVCellValue } []
|
2023-07-30 22:39:37 +08:00
|
|
|
}[],
|
2023-07-31 23:58:45 +08:00
|
|
|
avID: string
|
2023-07-30 22:39:37 +08:00
|
|
|
avName: string
|
|
|
|
|
}) => {
|
2023-07-31 11:10:38 +08:00
|
|
|
html += `<div class="block__logo custom-attr__avheader">
|
|
|
|
|
<svg><use xlink:href="#iconDatabase"></use></svg>
|
2023-07-31 11:18:26 +08:00
|
|
|
<span>${table.avName || window.siyuan.languages.database}</span>
|
2023-07-31 11:10:38 +08:00
|
|
|
</div>`;
|
2023-07-30 22:39:37 +08:00
|
|
|
table.keyValues?.forEach(item => {
|
|
|
|
|
html += `<div class="block__icons">
|
|
|
|
|
<div class="block__logo">
|
|
|
|
|
<svg><use xlink:href="#${getColIconByType(item.key.type)}"></use></svg>
|
2023-07-31 11:10:38 +08:00
|
|
|
<span>${item.key.name}</span>
|
2023-07-30 22:39:37 +08:00
|
|
|
</div>
|
2023-07-31 23:58:45 +08:00
|
|
|
<div data-av-id="${table.avID}" data-key-id="${item.values[0].keyID}" data-block-id="${item.values[0].blockID}" data-block-id="${item.values[0].id}" data-type="${item.values[0].type}"
|
|
|
|
|
class="fn__flex-1 fn__flex${["url", "text", "number"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}">
|
2023-07-30 22:39:37 +08:00
|
|
|
${genAVValueHTML(item.values[0])}
|
|
|
|
|
</div>
|
2023-07-31 11:32:36 +08:00
|
|
|
</div>`;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
element.innerHTML = html;
|
2023-07-31 23:58:45 +08:00
|
|
|
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
|
|
|
|
|
item.addEventListener("change", () => {
|
|
|
|
|
let value
|
|
|
|
|
if (item.parentElement.dataset.type === "url") {
|
|
|
|
|
value = {
|
|
|
|
|
url: {
|
|
|
|
|
content: item.value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (item.parentElement.dataset.type === "text") {
|
|
|
|
|
value = {
|
|
|
|
|
text: {
|
|
|
|
|
content: item.value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (item.parentElement.dataset.type === "number") {
|
|
|
|
|
value = {
|
|
|
|
|
number: {
|
|
|
|
|
content: parseFloat(item.value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fetchPost("/api/av/setAttributeViewBlockAttr", {
|
|
|
|
|
avID: item.parentElement.dataset.avId,
|
|
|
|
|
keyID: item.parentElement.dataset.keyId,
|
|
|
|
|
rowID: item.parentElement.dataset.blockId,
|
|
|
|
|
cellID: id,
|
|
|
|
|
value
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
2023-07-31 11:32:36 +08:00
|
|
|
});
|
|
|
|
|
};
|