Commit 54d85c77 by Jaxon

feat(任务中心): 极限数据情况处理

1 parent 9de37e9e
...@@ -31,83 +31,154 @@ function parseDatetime(value) { ...@@ -31,83 +31,154 @@ function parseDatetime(value) {
return "-"; return "-";
} }
function renderText(h, { data, schemaItem, schema }) { // tooltip: true,
return h("span", schemaItem.meta.fieldValue || "-"); // parentProps: {
} // style: {
// display: "inline-block",
function renderDatetime(h, { data, schemaItem, schema }) { // height: "32px",
const formatted = parseDatetime(schemaItem.meta.fieldValue); // width: "auto",
return h("span", formatted); // maxWidth: "100%",
} // verticalAlign: "top",
function renderLink(h, { data, schemaItem, schema }) { // },
const { fieldValue, linkAlias } = schemaItem.meta; // },
if (!fieldValue) // // tooltipProps: el-tooltip 的传参
return h("span", "-"); // render: (h, { data, schemaItem, schema }) => {
const linkProps = { // return h("div", { class: "text-hide" }, data.description || "-");
attrs: { // },
href: fieldValue,
target: "_blank", function renderText() {
type: "primary", return {
tooltip: true,
tooltipProps: {
render: (h, { data, schemaItem, schema }) => {
return h("div", schemaItem.meta.fieldValue || "-");
},
}, },
on: { parentProps: {
click: (e) => { style: {
e.preventDefault(); display: "inline-block",
window.open(fieldValue, "_blank"); height: "32px",
width: "auto",
maxWidth: "100%",
verticalAlign: "top",
}, },
}, },
render: (h, { data, schemaItem, schema }) => {
return h("div", { class: "text-hide" }, schemaItem.meta.fieldValue || "-");
},
}; };
return h("el-link", linkProps, linkAlias || fieldValue);
} }
function renderImage(h, { data, schemaItem, schema }) { function renderDatetime() {
const { fieldValue } = schemaItem.meta; return {
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) { render: (h, { data, schemaItem, schema }) => {
return h("span", "-"); const formatted = parseDatetime(schemaItem.meta.fieldValue);
} return h("span", formatted);
return h(DescriptionImageList, { props: { list: fieldValue, size: 80 } }); },
};
} }
function renderLink() {
function renderAttachment(h, { data, schemaItem, schema }) { return {
const { fieldValue } = schemaItem.meta; tooltip: true,
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) { tooltipProps: {
return h("span", "-"); render: (h, { data, schemaItem, schema }) => {
} return h("div", schemaItem.meta.fieldValue || "-");
},
const containerChildren = fieldValue.map((item, index) => { },
const fileName = item.name || item.fileName || item.url || `附件${index + 1}`; parentProps: {
const fileUrl = item.value || item.url || ""; style: {
display: "inline-block",
const rowChildren = [ height: "32px",
h("span", { width: "auto",
maxWidth: "100%",
verticalAlign: "top",
},
},
render: (h, { data, schemaItem, schema }) => {
const { fieldValue, linkAlias } = schemaItem.meta;
if (!fieldValue)
return h("span", "-");
const linkProps = {
class: "text-hide link-type",
style: {
width: "100%",
},
attrs: { attrs: {
class: "file-name text-hide", href: fieldValue,
title: fileName, target: "_blank",
style: "max-width: 50%", type: "primary",
}, },
}, fileName),
];
rowChildren.push(
h("el-link", {
attrs: { href: fileUrl, target: "_blank" },
props: { type: "primary", underline: false },
style: { marginLeft: "8px", lineHeight: 1 },
on: { on: {
click: (e) => { click: (e) => {
if (!fileUrl)
return;
e.preventDefault(); e.preventDefault();
window.open(fileUrl, "_blank"); window.open(fieldValue, "_blank");
}, },
}, },
}, "下载"), };
); return h("el-link", linkProps, linkAlias || fieldValue);
},
};
}
return h("div", { attrs: { class: "attachment-item", style: "display: flex; align-items: center; margin-bottom: 8px;" } }, rowChildren); function renderImage() {
}); return {
render: (h, { data, schemaItem, schema }) => {
const { fieldValue } = schemaItem.meta;
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) {
return h("span", "-");
}
return h(DescriptionImageList, { props: { list: fieldValue, size: 80 } });
},
};
}
return h("div", { attrs: { class: "attachment-list" } }, containerChildren); function renderAttachment() {
return {
render: (h, { data, schemaItem, schema }) => {
const { fieldValue } = schemaItem.meta;
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) {
return h("span", "-");
}
const containerChildren = fieldValue.map((item, index) => {
const fileName = item.name || item.fileName || item.url || `附件${index + 1}`;
const fileUrl = item.value || item.url || "";
const rowChildren = [
h("span", {
attrs: {
class: "file-name text-hide",
title: fileName,
style: "max-width: 50%",
},
}, fileName),
];
rowChildren.push(
h("el-link", {
attrs: { href: fileUrl, target: "_blank", title: fileUrl },
props: { type: "primary", underline: false },
style: { marginLeft: "8px", lineHeight: 1 },
on: {
click: (e) => {
if (!fileUrl)
return;
e.preventDefault();
window.open(fileUrl, "_blank");
},
},
}, "下载"),
);
return h("div", { attrs: { class: "attachment-item" } }, rowChildren);
});
return h("div", { attrs: { class: "attachment-list" } }, containerChildren);
},
};
} }
export default { export default {
......
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
}, },
labelWidth: "120px", labelWidth: "120px",
meta: item, meta: item,
render: cover2Descriptions[toUpper(item.fieldType)], ...cover2Descriptions?.[toUpper(item.fieldType)]?.(),
}))); })));
this.descriptionSchema = schema; this.descriptionSchema = schema;
} else { } else {
...@@ -238,6 +238,29 @@ export default { ...@@ -238,6 +238,29 @@ export default {
margin: 0 0 12px; margin: 0 0 12px;
background-color: #ebeef5; background-color: #ebeef5;
} }
::v-deep .link-type {
overflow: hidden;
.el-link--inner {
display: inline-block;
height: 32px;
width: auto;
max-width: 100%;
vertical-align: top;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
::v-deep .attachment-list {
.attachment-item {
margin-bottom: 8px;
display: flex;
align-items: center;
&:last-child {
margin-bottom: 0;
}
}
}
::v-deep .form-item { ::v-deep .form-item {
margin-bottom: 12px; margin-bottom: 12px;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!