Commit 54d85c77 by Jaxon

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

1 parent 9de37e9e
......@@ -31,83 +31,154 @@ function parseDatetime(value) {
return "-";
}
function renderText(h, { data, schemaItem, schema }) {
return h("span", schemaItem.meta.fieldValue || "-");
}
function renderDatetime(h, { data, schemaItem, schema }) {
const formatted = parseDatetime(schemaItem.meta.fieldValue);
return h("span", formatted);
}
function renderLink(h, { data, schemaItem, schema }) {
const { fieldValue, linkAlias } = schemaItem.meta;
if (!fieldValue)
return h("span", "-");
const linkProps = {
attrs: {
href: fieldValue,
target: "_blank",
type: "primary",
// tooltip: true,
// parentProps: {
// style: {
// display: "inline-block",
// height: "32px",
// width: "auto",
// maxWidth: "100%",
// verticalAlign: "top",
// },
// },
// // tooltipProps: el-tooltip 的传参
// render: (h, { data, schemaItem, schema }) => {
// return h("div", { class: "text-hide" }, data.description || "-");
// },
function renderText() {
return {
tooltip: true,
tooltipProps: {
render: (h, { data, schemaItem, schema }) => {
return h("div", schemaItem.meta.fieldValue || "-");
},
},
on: {
click: (e) => {
e.preventDefault();
window.open(fieldValue, "_blank");
parentProps: {
style: {
display: "inline-block",
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 }) {
const { fieldValue } = schemaItem.meta;
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) {
return h("span", "-");
}
return h(DescriptionImageList, { props: { list: fieldValue, size: 80 } });
function renderDatetime() {
return {
render: (h, { data, schemaItem, schema }) => {
const formatted = parseDatetime(schemaItem.meta.fieldValue);
return h("span", formatted);
},
};
}
function renderAttachment(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", {
function renderLink() {
return {
tooltip: true,
tooltipProps: {
render: (h, { data, schemaItem, schema }) => {
return h("div", schemaItem.meta.fieldValue || "-");
},
},
parentProps: {
style: {
display: "inline-block",
height: "32px",
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: {
class: "file-name text-hide",
title: fileName,
style: "max-width: 50%",
href: fieldValue,
target: "_blank",
type: "primary",
},
}, fileName),
];
rowChildren.push(
h("el-link", {
attrs: { href: fileUrl, target: "_blank" },
props: { type: "primary", underline: false },
style: { marginLeft: "8px", lineHeight: 1 },
on: {
click: (e) => {
if (!fileUrl)
return;
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 {
......
......@@ -69,7 +69,7 @@ export default {
},
labelWidth: "120px",
meta: item,
render: cover2Descriptions[toUpper(item.fieldType)],
...cover2Descriptions?.[toUpper(item.fieldType)]?.(),
})));
this.descriptionSchema = schema;
} else {
......@@ -238,6 +238,29 @@ export default {
margin: 0 0 12px;
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 {
margin-bottom: 12px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!