layui-vue/es/table/index.js

1848 lines
109 KiB
JavaScript
Raw Normal View History

2022-11-14 03:59:26 +00:00
import { w as withInstall } from "../badge/index2.js";
2023-04-21 06:04:17 +00:00
import { defineComponent, useSlots, ref, computed, resolveComponent, openBlock, createElementBlock, Fragment, createElementVNode, normalizeStyle, normalizeClass, withModifiers, renderList, createCommentVNode, unref, createBlock, createVNode, mergeProps, isRef, createTextVNode, toDisplayString, withCtx, renderSlot, withKeys, createSlots, watch, withDirectives, vShow, nextTick, onMounted, onBeforeUnmount } from "vue";
2023-11-03 03:48:11 +00:00
import { u as utils, w as writeFileSync } from "../_chunks/xlsx/index.js";
import { _ as _sfc_main$5 } from "../checkbox/index2.js";
2023-04-21 06:04:17 +00:00
import { _ as _sfc_main$a } from "../dropdown/index2.js";
import { _ as _sfc_main$b } from "../empty/index2.js";
2023-11-03 03:48:11 +00:00
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
2023-04-21 06:04:17 +00:00
import { _ as _sfc_main$6 } from "../tooltip/index2.js";
import { _ as _sfc_main$4 } from "../radio/index2.js";
2023-02-16 06:23:57 +00:00
import { _ as _export_sfc } from "../dropdownMenu/index2.js";
2023-04-21 06:04:17 +00:00
import { _ as _sfc_main$7 } from "../page/index2.js";
import { _ as _sfc_main$8 } from "../input/index2.js";
import { _ as _sfc_main$9 } from "../index2.js";
2022-11-14 03:59:26 +00:00
import "../_chunks/@vueuse/index.js";
import "../datePicker/index2.js";
import "../_chunks/dayjs/index.js";
import "../_chunks/@umijs/index.js";
import "../_chunks/vue-i18n/index.js";
import "../_chunks/@intlify/index.js";
import "../_chunks/@vue/index.js";
2023-04-21 06:04:17 +00:00
var index = /* @__PURE__ */ (() => '.layui-checkbox[size=lg]{height:18px;line-height:18px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:18px;height:18px;font-size:16px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:18px;line-height:18px;font-size:16px}.layui-checkbox[size=md]{height:16px;line-height:16px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:16px;height:16px;font-size:14px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:16px;line-height:16px;font-size:14px}.layui-checkbox[size=sm]{height:14px;line-height:14px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:14px;height:14px;font-size:12px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:14px;line-height:14px;font-size:12px}.layui-checkbox[size=xs]{height:12px;line-height:12px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:12px;height:12px;font-size:10px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:12px;line-height:12px;font-size:10px}.layui-checkbox input[type=checkbox]{display:none}.layui-form-checkbox{position:relative;height:30px;line-height:30px;margin-right:10px;padding-right:30px;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox span{padding:0 10px;height:100%;font-size:14px;border-radius:2px 0 0 2px;background-color:var(--global-neutral-color-6);color:#fff;overflow:hidden}.layui-form-checkbox:hover span{background-color:var(--global-neutral-color-8)}.layui-form-checkbox i{top:0;right:0;width:29px;height:28px;position:absolute;border-top:1px solid var(--global-neutral-color-6);border-bottom:1px solid var(--global-neutral-color-6);border-right:1px solid var(--global-neutral-color-6);border-radius:0 2px 2px 0;color:#fff;font-size:20px;text-align:center}.layui-form-checkbox:hover i{border-color:var(--global-neutral-color-8);color:var(--global-neutral-color-8)}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:28px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary] span{padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#666}.layui-form-checkbox[lay-skin=primary] i{right:auto;left:0;width:16px;height:16px;line-height:16px;border:1px solid var(--global-neutral-color-6);font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover i{border-color:var(--global-checked-color);color:#fff}.layui-form-checked,.layui-form-checked:hover{border-color:var(--global-checked-color)}.layui-form-checked i,.layui-form-checked:hover i{color:var(--global-checked-color)}.layui-form-checked span,.layui-form-checked:hover span{background-color:var(--global-checked-color)}.layui-form-checked[lay-skin=primary] i{border-color:var(--global-checked-color);background-color:var(--global-checked-color);color:#fff}.layui-form-checked[lay-skin=primary] span{background:0 0!important}.layui-checkbox-disabled[lay-skin=primary] span{background:0 0!important;color:var(--global-neutral-color-8)!important}.layui-checkbox-disabled[lay-skin=primary]:hover i{border-color:var(--global-neutral-color-6)}.layui-checkbox-disabled,.layui-checkbox-disabled i{border-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled span{background-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled em{color:var(--global-neutral-color-6)!important}.layui-checkbox-disabled:hover i{color:#fff!important}.layui-checkbox-disabled .layui-icon-ok,.layui-checkbox-disabled .layui-icon-subtraction{background-color:var(--global-neutral-color-3)!important;border-color:var(--global-neutral-color-3)!important}.layui-radio[size=lg] .layui-form-radio>i{font-size:24px}.lay
2023-10-25 03:29:28 +00:00
var TableRow_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".layui-table-cell[data-v-dc2bcd6e] .layui-input input{padding-left:0}\n")();
2023-04-21 06:04:17 +00:00
const _hoisted_1$2 = ["colspan", "rowspan"];
const _hoisted_2$2 = {
2022-11-14 03:59:26 +00:00
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
2023-04-21 06:04:17 +00:00
const _hoisted_3$2 = ["colspan", "rowspan"];
const _hoisted_4$2 = {
2022-11-14 03:59:26 +00:00
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
2023-04-21 06:04:17 +00:00
const _hoisted_5$2 = ["colspan", "rowspan"];
const _hoisted_6$2 = {
2022-11-14 03:59:26 +00:00
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
2023-04-21 06:04:17 +00:00
const _hoisted_7$2 = ["colspan", "rowspan"];
const _hoisted_8$2 = {
2022-11-14 03:59:26 +00:00
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
2023-04-21 06:04:17 +00:00
const _hoisted_9$2 = ["colspan", "rowspan", "onClick"];
2023-05-04 07:03:49 +00:00
const _hoisted_10$2 = {
2022-11-14 03:59:26 +00:00
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
2023-05-05 01:05:54 +00:00
const _hoisted_11$1 = { key: 0 };
2023-02-16 06:01:18 +00:00
const _hoisted_12$1 = { key: 1 };
const _hoisted_13$1 = {
2022-11-14 03:59:26 +00:00
key: 0,
class: "layui-table-cell-expand"
};
2023-02-16 06:01:18 +00:00
const _hoisted_14$1 = ["colspan"];
2022-11-14 03:59:26 +00:00
const __default__$2 = {
name: "TableRow"
};
2023-04-21 06:04:17 +00:00
const _sfc_main$3 = defineComponent({
2022-11-14 03:59:26 +00:00
...__default__$2,
props: {
index: null,
indentSize: null,
currentIndentSize: null,
expandSpace: { type: Boolean },
expandIndex: null,
selectedKeys: null,
selectedKey: null,
tableColumnKeys: null,
childrenColumnName: { default: "children" },
columns: null,
checkbox: { type: Boolean, default: false },
cellClassName: { type: [String, Function], default: "" },
cellStyle: { type: [String, Function], default: "" },
rowClassName: null,
rowStyle: null,
id: null,
data: null,
spanMethod: null,
defaultExpandAll: { type: Boolean },
expandKeys: null,
getCheckboxProps: null,
2023-10-25 03:21:42 +00:00
getRadioProps: null,
page: null
2022-11-14 03:59:26 +00:00
},
emits: [
"row",
"row-double",
"row-contextmenu",
"update:expandKeys",
"update:selectedKeys",
"update:selectedKey"
],
setup(__props, { emit }) {
const props = __props;
const slot = useSlots();
2023-06-12 07:58:47 +00:00
function toThousands(num) {
2023-10-10 05:29:55 +00:00
if (typeof num == "undefined") {
return "";
}
2023-06-12 07:58:47 +00:00
if (typeof num == "string") {
num = parseFloat(num || "0");
}
let xs = num.toString().split(".")[1];
let zs = num.toString().split(".")[0];
let jg = (zs || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") + (xs ? "." + xs : "");
console.log(jg);
return jg;
}
2022-11-14 03:59:26 +00:00
const tableExpandAll = ref(props.defaultExpandAll);
2023-02-16 05:55:34 +00:00
const editIndex = ref({});
2022-11-14 03:59:26 +00:00
const tableExpandKeys = computed({
get() {
return [...props.expandKeys];
},
set(val) {
emit("update:expandKeys", val);
}
});
const tableSelectedKeys = computed({
get() {
return [...props.selectedKeys];
},
set(val) {
emit("update:selectedKeys", val);
}
});
const tableSelectedKey = computed({
get() {
return props.selectedKey;
},
set(val) {
emit("update:selectedKey", val);
}
});
const isExpand = computed({
get() {
return tableExpandAll.value ? true : tableExpandKeys.value.includes(props.data[props.id]);
},
set(val) {
let newTableExpandKeys = [...tableExpandKeys.value];
if (!val) {
newTableExpandKeys.splice(newTableExpandKeys.indexOf(props.data[props.id]), 1);
} else {
newTableExpandKeys.push(props.data[props.id]);
}
tableExpandAll.value = false;
tableExpandKeys.value = newTableExpandKeys;
}
});
const slotsData = ref([]);
props.columns.map((value) => {
if (value.customSlot) {
slotsData.value.push(value.customSlot);
}
});
const rowClick = function(data, evt) {
2023-04-21 06:04:17 +00:00
let click = new Event("click");
window.dispatchEvent(click);
2022-11-14 03:59:26 +00:00
emit("row", data, evt);
};
const rowDoubleClick = function(data, evt) {
emit("row-double", data, evt);
};
const rowContextmenu = function(data, evt) {
emit("row-contextmenu", data, evt);
};
const expandIconType = computed(() => {
return isExpand.value ? "layui-icon-subtraction" : "layui-icon-addition";
});
const handleExpand = () => {
isExpand.value = !isExpand.value;
};
const renderCellStyle = (row, column, rowIndex, columnIndex) => {
if (typeof props.cellStyle === "string") {
return props.cellStyle;
}
return props.cellStyle(row, column, rowIndex, columnIndex);
};
const renderCellClassName = (row, column, rowIndex, columnIndex) => {
if (typeof props.cellClassName === "string") {
return props.cellClassName;
}
return props.cellClassName(row, column, rowIndex, columnIndex);
};
const renderRowStyle = (data, index2) => {
if (typeof props.rowStyle === "string") {
return props.rowStyle;
}
return props.rowStyle(data, index2);
};
const renderRowClassName = (data, index2) => {
if (typeof props.rowClassName === "string") {
return props.rowClassName;
}
return props.rowClassName(data, index2);
};
const childrenIndentSize = computed(() => props.currentIndentSize + props.indentSize);
const renderFixedStyle = (column, columnIndex) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed == void 0 && props.tableColumnKeys.includes(props.columns[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
const renderFixedClassName = (column, columnIndex) => {
if (column.fixed) {
if (column.fixed == "left") {
var left = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) {
left = false;
}
}
return left ? `layui-table-fixed-left-last` : "";
} else {
var right = true;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) {
right = false;
}
}
return right ? `layui-table-fixed-right-first` : "";
}
}
};
const spanMethodAttr = (row, column, rowIndex, columnIndex) => {
const attrs = props.spanMethod(row, column, rowIndex, columnIndex);
if (attrs instanceof Array) {
return { rowspan: attrs[0], colspan: attrs[1] };
} else if (attrs instanceof Object) {
return attrs;
} else {
return { rowspan: 1, colspan: 1 };
}
};
const isAutoShow = (row, column, rowIndex, columnIndex) => {
const attrs = spanMethodAttr(row, column, rowIndex, columnIndex);
if (attrs.colspan == 0 && attrs.rowspan == 0) {
return false;
} else {
return true;
}
};
const checkboxProps = props.getCheckboxProps(props.data, props.index);
const radioProps = props.getRadioProps(props.data, props.index);
return (_ctx, _cache) => {
2023-02-16 05:55:34 +00:00
const _component_lay_input = resolveComponent("lay-input");
2022-11-14 03:59:26 +00:00
const _component_table_row = resolveComponent("table-row", true);
return openBlock(), createElementBlock(Fragment, null, [
createElementVNode("tr", {
style: normalizeStyle([renderRowStyle(__props.data, __props.index)]),
class: normalizeClass([renderRowClassName(__props.data, __props.index)]),
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => rowClick(__props.data, $event), ["stop"])),
onDblclick: _cache[3] || (_cache[3] = withModifiers(($event) => rowDoubleClick(__props.data, $event), ["stop"])),
onContextmenu: _cache[4] || (_cache[4] = withModifiers(($event) => rowContextmenu(__props.data, $event), ["stop"]))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
__props.tableColumnKeys.includes(column.key) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
column.type ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
column.type == "radio" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-radio", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_2$2)) : createCommentVNode("", true),
2023-11-03 03:48:11 +00:00
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2W), {
2022-11-14 03:59:26 +00:00
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
createVNode(_sfc_main$4, mergeProps({
2022-11-14 03:59:26 +00:00
modelValue: unref(tableSelectedKey),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null)
}, unref(radioProps), {
value: __props.data[__props.id]
}), null, 16, ["modelValue", "value"])
2023-04-21 06:04:17 +00:00
], 14, _hoisted_1$2)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64)) : createCommentVNode("", true),
column.type == "checkbox" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-checkbox", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_4$2)) : createCommentVNode("", true),
2023-11-03 03:48:11 +00:00
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2W), {
2022-11-14 03:59:26 +00:00
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
createVNode(_sfc_main$5, mergeProps({
2022-11-14 03:59:26 +00:00
modelValue: unref(tableSelectedKeys),
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(tableSelectedKeys) ? tableSelectedKeys.value = $event : null)
}, unref(checkboxProps), {
value: __props.data[__props.id],
skin: "primary"
}), null, 16, ["modelValue", "value"])
2023-04-21 06:04:17 +00:00
], 14, _hoisted_3$2)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64)) : createCommentVNode("", true),
column.type == "number" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-number", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_6$2)) : createCommentVNode("", true),
2023-11-03 03:48:11 +00:00
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2W), {
2022-11-14 03:59:26 +00:00
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
2023-10-25 03:21:42 +00:00
__props.page ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
2023-10-25 03:29:28 +00:00
createTextVNode(toDisplayString(__props.index + 1 + (__props.page.current - 1) * __props.page.limit), 1)
2023-10-25 03:21:42 +00:00
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 4 }, [
createTextVNode(toDisplayString(__props.index + 1), 1)
], 64))
2023-04-21 06:04:17 +00:00
], 14, _hoisted_5$2)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64)) : createCommentVNode("", true)
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
column.customSlot ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
2022-12-12 01:08:28 +00:00
createElementVNode("div", {
style: normalizeStyle([{ "display": "flex" }, [
{ textAlign: column.align, justifyContent: column.align }
]])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_8$2)) : createCommentVNode("", true),
2023-11-03 03:48:11 +00:00
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2W), {
2022-12-12 01:08:28 +00:00
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
column.ellipsisTooltip ? (openBlock(), createBlock(_sfc_main$6, {
2022-12-12 01:08:28 +00:00
key: 3,
isAutoShow: true
}, {
content: withCtx(() => [
renderSlot(_ctx.$slots, column.customSlot, {
data: __props.data,
column
2023-02-16 06:23:57 +00:00
}, void 0, true)
2022-12-12 01:08:28 +00:00
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, column.customSlot, {
data: __props.data,
column
2023-02-16 06:23:57 +00:00
}, void 0, true)
2022-12-12 01:08:28 +00:00
]),
_: 2
}, 1024)) : renderSlot(_ctx.$slots, column.customSlot, {
key: 4,
data: __props.data,
column
2023-02-16 06:23:57 +00:00
}, void 0, true)
2022-12-12 01:08:28 +00:00
], 4)
2023-04-21 06:04:17 +00:00
], 14, _hoisted_7$2)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
2023-02-16 06:23:57 +00:00
]),
onClick: ($event) => editIndex.value[columnIndex] = true
2022-11-14 03:59:26 +00:00
}, [
2022-12-12 01:08:28 +00:00
createElementVNode("div", {
style: normalizeStyle([{ "display": "flex" }, [
{ textAlign: column.align, justifyContent: column.align }
]])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
2023-05-04 07:03:49 +00:00
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_10$2)) : createCommentVNode("", true),
2023-11-03 03:48:11 +00:00
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2W), {
2022-12-12 01:08:28 +00:00
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
column.ellipsisTooltip ? (openBlock(), createBlock(_sfc_main$6, {
2022-12-12 01:08:28 +00:00
key: 3,
content: __props.data[column.key],
isAutoShow: true
}, {
default: withCtx(() => [
2023-06-12 07:58:47 +00:00
createTextVNode(toDisplayString(column.qfw ? toThousands(__props.data[column.key]) : __props.data[column.key]), 1)
2022-12-12 01:08:28 +00:00
]),
_: 2
2023-02-16 05:55:34 +00:00
}, 1032, ["content"])) : (openBlock(), createElementBlock(Fragment, { key: 4 }, [
column.edit ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2023-06-12 08:22:36 +00:00
!editIndex.value[columnIndex] ? (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(column.qfw ? toThousands(__props.data[column.key]) : __props.data[column.key]), 1)) : (openBlock(), createBlock(_component_lay_input, {
2023-02-16 05:55:34 +00:00
key: 1,
2023-02-16 06:28:33 +00:00
autofocus: true,
2023-02-16 05:55:34 +00:00
modelValue: __props.data[column.key],
"onUpdate:modelValue": ($event) => __props.data[column.key] = $event,
onKeyup: withKeys(($event) => editIndex.value[columnIndex] = false, ["enter"]),
onBlur: ($event) => editIndex.value[columnIndex] = false
}, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup", "onBlur"]))
2023-06-12 08:22:36 +00:00
], 64)) : (openBlock(), createElementBlock("span", _hoisted_12$1, toDisplayString(column.qfw ? toThousands(__props.data[column.key]) : __props.data[column.key]), 1))
2023-02-16 05:55:34 +00:00
], 64))
2022-12-12 01:08:28 +00:00
], 4)
2023-04-21 06:04:17 +00:00
], 14, _hoisted_9$2)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64))
], 64))
], 64)) : createCommentVNode("", true)
], 64);
}), 128))
], 38),
2023-02-16 06:01:18 +00:00
unref(slot).expand && unref(isExpand) ? (openBlock(), createElementBlock("tr", _hoisted_13$1, [
2022-11-14 03:59:26 +00:00
createElementVNode("td", {
class: "layui-table-cell",
colspan: __props.columns.length
}, [
2023-02-16 06:23:57 +00:00
renderSlot(_ctx.$slots, "expand", { data: __props.data }, void 0, true)
2023-02-16 06:01:18 +00:00
], 8, _hoisted_14$1)
2022-11-14 03:59:26 +00:00
])) : createCommentVNode("", true),
__props.data[__props.childrenColumnName] && unref(isExpand) ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(__props.data[__props.childrenColumnName], (children, childrenIndex) => {
return openBlock(), createBlock(_component_table_row, {
key: childrenIndex,
id: __props.id,
data: children,
index: childrenIndex,
columns: __props.columns,
"indent-size": __props.indentSize,
"current-indent-size": unref(childrenIndentSize),
checkbox: __props.checkbox,
tableColumnKeys: __props.tableColumnKeys,
expandSpace: __props.expandSpace,
expandIndex: __props.expandIndex,
cellStyle: __props.cellStyle,
cellClassName: __props.cellClassName,
rowStyle: __props.rowStyle,
rowClassName: __props.rowClassName,
spanMethod: __props.spanMethod,
defaultExpandAll: __props.defaultExpandAll,
getCheckboxProps: __props.getCheckboxProps,
getRadioProps: __props.getRadioProps,
onRow: rowClick,
onRowDouble: rowDoubleClick,
onRowContextmenu: rowContextmenu,
expandKeys: unref(tableExpandKeys),
"onUpdate:expandKeys": _cache[5] || (_cache[5] = ($event) => isRef(tableExpandKeys) ? tableExpandKeys.value = $event : null),
selectedKeys: unref(tableSelectedKeys),
"onUpdate:selectedKeys": _cache[6] || (_cache[6] = ($event) => isRef(tableSelectedKeys) ? tableSelectedKeys.value = $event : null),
selectedKey: unref(tableSelectedKey),
"onUpdate:selectedKey": _cache[7] || (_cache[7] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null)
}, createSlots({ _: 2 }, [
renderList(slotsData.value, (name) => {
return {
name,
fn: withCtx((slotProp) => [
renderSlot(_ctx.$slots, name, {
data: slotProp.data,
column: slotProp.column
2023-02-16 06:23:57 +00:00
}, void 0, true)
2022-11-14 03:59:26 +00:00
])
};
}),
unref(slot).expand ? {
name: "expand",
fn: withCtx((slotProp) => [
renderSlot(_ctx.$slots, "expand", {
data: slotProp.data,
column: slotProp.column
2023-02-16 06:23:57 +00:00
}, void 0, true)
2022-11-14 03:59:26 +00:00
]),
key: "0"
} : void 0
]), 1032, ["id", "data", "index", "columns", "indent-size", "current-indent-size", "checkbox", "tableColumnKeys", "expandSpace", "expandIndex", "cellStyle", "cellClassName", "rowStyle", "rowClassName", "spanMethod", "defaultExpandAll", "getCheckboxProps", "getRadioProps", "expandKeys", "selectedKeys", "selectedKey"]);
}), 128)) : createCommentVNode("", true)
], 64);
};
}
});
2023-10-25 03:29:28 +00:00
var TableRow = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-dc2bcd6e"]]);
2022-11-14 03:59:26 +00:00
const __default__$1 = {
name: "TablePage"
};
2023-04-21 06:04:17 +00:00
const _sfc_main$2 = defineComponent({
2022-11-14 03:59:26 +00:00
...__default__$1,
props: {
showPage: { type: Boolean, default: true },
showSkip: { type: Boolean, default: true },
showLimit: { type: Boolean, default: true },
showCount: { type: Boolean },
showRefresh: { type: Boolean },
current: null,
limits: null,
pages: null,
total: null,
limit: null,
2022-11-15 06:58:26 +00:00
theme: null,
count: null
2022-11-14 03:59:26 +00:00
},
emits: ["update:current", "update:limit", "change"],
setup(__props, { emit }) {
const props = __props;
const current = computed({
get() {
return props.current;
},
set(val) {
emit("update:current", val);
}
});
const limit = computed({
get() {
return props.limit;
},
set(val) {
emit("update:limit", val);
}
});
const change = (pageData) => {
emit("change", pageData);
};
return (_ctx, _cache) => {
2023-04-21 06:04:17 +00:00
return openBlock(), createBlock(_sfc_main$7, {
2022-11-14 03:59:26 +00:00
total: __props.total,
"show-page": __props.showPage,
"show-skip": __props.showSkip,
"show-limit": __props.showLimit,
"show-count": __props.showCount,
"show-refresh": __props.showRefresh,
limits: __props.limits,
theme: __props.theme,
pages: __props.pages,
2022-11-15 06:58:26 +00:00
count: __props.count,
2022-11-14 03:59:26 +00:00
modelValue: unref(current),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(current) ? current.value = $event : null),
limit: unref(limit),
"onUpdate:limit": _cache[1] || (_cache[1] = ($event) => isRef(limit) ? limit.value = $event : null),
onChange: change
}, {
prev: withCtx(() => [
2023-11-03 03:48:11 +00:00
createVNode(unref(_sfc_main$2W), { type: "layui-icon-left" })
2022-11-14 03:59:26 +00:00
]),
next: withCtx(() => [
2023-11-03 03:48:11 +00:00
createVNode(unref(_sfc_main$2W), { type: "layui-icon-right" })
2022-11-14 03:59:26 +00:00
]),
_: 1
2022-11-15 06:58:26 +00:00
}, 8, ["total", "show-page", "show-skip", "show-limit", "show-count", "show-refresh", "limits", "theme", "pages", "count", "modelValue", "limit"]);
2022-11-14 03:59:26 +00:00
};
}
});
2023-05-04 07:03:49 +00:00
var soultable = /* @__PURE__ */ (() => ".soulbox{background-color:#333;color:#fff;display:inline-block;position:absolute;z-index:2147483647;min-width:160px;max-width:320px;overflow-y:auto;border:1px solid #e6e6e6;border-radius:5px;box-shadow:2px 2px 4px -2px #0003}\n")();
2023-04-21 06:04:17 +00:00
const _hoisted_1$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon soul-icon-asc" }, null, -1);
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon soul-icon-desc" }, null, -1);
2023-05-05 01:05:54 +00:00
const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("li", {
class: "soul-dropList",
style: {},
show: "select"
}, [
2023-05-05 01:18:08 +00:00
/* @__PURE__ */ createElementVNode("i", {
class: "soul-icon soul-icon-drop-list",
show: "select"
}),
2023-05-05 01:05:54 +00:00
/* @__PURE__ */ createTextVNode(" \u7B5B\u9009\u6570\u636E "),
/* @__PURE__ */ createElementVNode("i", {
class: "layui-icon layui-icon-right",
2023-05-05 01:18:08 +00:00
style: { "float": "right" },
show: "select"
2023-05-05 01:05:54 +00:00
})
], -1);
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon soul-icon-download" }, null, -1);
const _hoisted_5$1 = {
2023-04-21 06:04:17 +00:00
class: "soulbox",
style: { "left": "100%", "top": "65px" }
};
2023-05-05 01:05:54 +00:00
const _hoisted_6$1 = {
2023-04-21 06:04:17 +00:00
class: "check",
2023-05-04 07:10:01 +00:00
style: { "min-width": "190px" }
2023-04-21 06:04:17 +00:00
};
2023-05-05 01:05:54 +00:00
const _hoisted_7$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon" }, "\uE623", -1);
const _hoisted_8$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon" }, "\uE63E", -1);
const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", { class: "soul-icon" }, "\uE614", -1);
const _hoisted_10$1 = { style: { "max-height": "300px", "overflow": "auto" } };
2023-04-21 06:04:17 +00:00
const _sfc_main$1 = defineComponent({
__name: "soultable",
props: {
left: { default: 10 },
top: { default: 10 },
list: { default: [] },
2023-05-04 08:19:37 +00:00
soulkey: { default: "" },
show: { type: Boolean, default: false }
2023-04-21 06:04:17 +00:00
},
2023-05-04 07:49:04 +00:00
emits: ["asc", "desc", "sx", "daochu"],
2023-04-21 06:04:17 +00:00
setup(__props, { emit }) {
const props = __props;
function asc(event) {
emit("asc", event);
}
function desc(event) {
emit("desc", event);
}
2023-05-04 07:49:04 +00:00
function daochu() {
emit("daochu");
}
2023-04-21 06:04:17 +00:00
const sel = ref([]);
const list = ref([]);
const alllist = ref([]);
2023-05-04 08:19:37 +00:00
watch(() => [props.show], () => {
2023-04-21 06:04:17 +00:00
let set = /* @__PURE__ */ new Set();
for (let i of props.list) {
set.add(i[props.soulkey]);
}
alllist.value = Array.from(set);
list.value = alllist.value;
2023-05-05 01:05:54 +00:00
selshow.value = false;
2023-04-21 06:04:17 +00:00
}, { deep: true });
const seltext = ref("");
watch(seltext, () => {
let l = [];
if (seltext.value) {
for (let i of alllist.value) {
if (i.indexOf(seltext.value) != -1) {
l.push(i);
}
}
} else {
l = alllist.value;
}
list.value = l;
});
watch(sel, () => {
emit("sx", { key: props.soulkey, list: sel.value });
});
function select(type) {
if (type == 1) {
sel.value = [];
let t = [];
for (let i of list.value) {
t.push(i);
}
sel.value = t;
} else if (type == 3) {
let t = [];
for (let i of list.value) {
if (!sel.value.includes(i)) {
t.push(i);
}
}
sel.value = t;
} else if (type == 2) {
sel.value = [];
}
}
const selshow = ref(false);
2023-05-05 00:34:41 +00:00
function shubiao(event) {
2023-05-05 00:58:14 +00:00
console.log(event, 160);
2023-05-05 01:13:47 +00:00
if (event.target.getAttribute("show") == "select") {
2023-05-05 01:05:54 +00:00
selshow.value = true;
} else {
selshow.value = false;
}
2023-05-05 00:34:41 +00:00
}
2023-04-21 06:04:17 +00:00
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: "soulbox",
style: normalizeStyle(`top: ${props.top}px;left:${props.left}px`),
2023-05-05 01:05:54 +00:00
onClick: _cache[5] || (_cache[5] = withModifiers(() => {
2023-04-21 06:04:17 +00:00
}, ["stop"]))
}, [
2023-05-05 00:34:41 +00:00
createElementVNode("ul", { onMouseover: shubiao }, [
2023-04-21 06:04:17 +00:00
createElementVNode("li", {
onClick: asc,
class: "soul-sort",
"data-value": "asc",
style: {}
}, [
_hoisted_1$1,
createTextVNode(" \u5347\u5E8F\u6392\u5217 ")
]),
createElementVNode("li", {
onClick: desc,
class: "soul-sort",
"data-value": "desc",
style: { "border-bottom": "1px solid rgb(230, 230, 230)" }
}, [
_hoisted_2$1,
createTextVNode(" \u964D\u5E8F\u6392\u5217 ")
]),
2023-05-05 01:05:54 +00:00
_hoisted_3$1,
2023-05-04 07:49:04 +00:00
createElementVNode("li", {
onClick: daochu,
class: "soul-sort",
"data-value": "desc",
style: { "border-bottom": "1px solid rgb(230, 230, 230)" }
}, [
2023-05-05 01:05:54 +00:00
_hoisted_4$1,
2023-05-04 07:49:04 +00:00
createTextVNode(" \u5BFC\u51FAexcel ")
])
2023-05-05 00:34:41 +00:00
], 32),
2023-05-05 01:05:54 +00:00
withDirectives(createElementVNode("div", _hoisted_5$1, [
2023-04-21 06:04:17 +00:00
createVNode(_sfc_main$8, {
"prefix-icon": "layui-icon-search",
modelValue: seltext.value,
2023-05-05 01:05:54 +00:00
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => seltext.value = $event),
2023-04-21 06:04:17 +00:00
size: "sm",
placeholder: "\u5173\u952E\u5B57\u641C\u7D22"
}, null, 8, ["modelValue"]),
2023-05-05 01:05:54 +00:00
createElementVNode("div", _hoisted_6$1, [
2023-04-21 06:04:17 +00:00
createElementVNode("div", {
class: "multiOption",
"data-type": "all",
2023-05-05 01:05:54 +00:00
onClick: _cache[1] || (_cache[1] = ($event) => select(1))
2023-04-21 06:04:17 +00:00
}, [
2023-05-05 01:05:54 +00:00
_hoisted_7$1,
2023-04-21 06:53:55 +00:00
createTextVNode(" \u5168\u9009 ")
2023-04-21 06:04:17 +00:00
]),
createElementVNode("div", {
class: "multiOption",
"data-type": "none",
2023-05-05 01:05:54 +00:00
onClick: _cache[2] || (_cache[2] = ($event) => select(2))
2023-04-21 06:04:17 +00:00
}, [
2023-05-05 01:05:54 +00:00
_hoisted_8$1,
2023-04-21 06:53:55 +00:00
createTextVNode(" \u6E05\u7A7A ")
2023-04-21 06:04:17 +00:00
]),
createElementVNode("div", {
class: "multiOption",
"data-type": "reverse",
2023-05-05 01:05:54 +00:00
onClick: _cache[3] || (_cache[3] = ($event) => select(3))
2023-04-21 06:04:17 +00:00
}, [
2023-05-05 01:05:54 +00:00
_hoisted_9$1,
2023-04-21 06:53:55 +00:00
createTextVNode("\u53CD\u9009 ")
2023-04-21 06:04:17 +00:00
])
]),
2023-05-05 01:05:54 +00:00
createElementVNode("ul", _hoisted_10$1, [
2023-04-21 06:04:17 +00:00
createVNode(_sfc_main$9, {
modelValue: sel.value,
2023-05-05 01:05:54 +00:00
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => sel.value = $event)
2023-04-21 06:04:17 +00:00
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (i, j) => {
return openBlock(), createElementBlock("li", null, [
createVNode(_sfc_main$5, {
skin: "primary",
value: i
}, null, 8, ["value"]),
createTextVNode(toDisplayString(i), 1)
]);
}), 256))
]),
_: 1
}, 8, ["modelValue"])
])
], 512), [
[vShow, selshow.value]
])
], 4);
};
}
});
2022-11-14 03:59:26 +00:00
const _hoisted_1 = /* @__PURE__ */ createElementVNode("table", {
class: "layui-hide",
"lay-filter": "test"
}, null, -1);
const _hoisted_2 = {
key: 0,
class: "layui-table-tool"
};
const _hoisted_3 = { class: "layui-table-tool-temp" };
const _hoisted_4 = {
key: 0,
class: "layui-table-tool-self"
};
const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", {
class: "layui-inline",
title: "\u7B5B\u9009",
"lay-event": ""
}, [
/* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-slider" })
], -1);
const _hoisted_6 = { class: "layui-table-tool-checkbox" };
const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-export" }, null, -1);
const _hoisted_8 = [
_hoisted_7
];
const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-print" }, null, -1);
const _hoisted_10 = [
_hoisted_9
];
const _hoisted_11 = {
key: 1,
class: "layui-table-box-header"
};
const _hoisted_12 = { class: "layui-table-box" };
const _hoisted_13 = ["lay-size", "lay-skin"];
const _hoisted_14 = ["width"];
const _hoisted_15 = ["colspan", "rowspan"];
const _hoisted_16 = {
key: 0,
class: "layui-table-sort layui-inline",
"lay-sort": ""
};
const _hoisted_17 = ["onClick"];
const _hoisted_18 = ["onClick"];
2023-04-21 06:04:17 +00:00
const _hoisted_19 = {
key: 1,
class: "layui-table-sort layui-inline soul-icon"
};
const _hoisted_20 = ["onClick"];
const _hoisted_21 = ["lay-size", "lay-skin"];
const _hoisted_22 = ["width"];
const _hoisted_23 = {
2022-11-14 03:59:26 +00:00
key: 0,
class: "layui-table-total"
};
2023-04-21 06:04:17 +00:00
const _hoisted_24 = ["innerHTML"];
const _hoisted_25 = {
2022-11-14 03:59:26 +00:00
key: 2,
class: "layui-table-loading"
};
2023-04-21 06:04:17 +00:00
const _hoisted_26 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop" }, null, -1);
const _hoisted_27 = [
_hoisted_26
2022-11-14 03:59:26 +00:00
];
2023-04-21 06:04:17 +00:00
const _hoisted_28 = {
2022-11-14 03:59:26 +00:00
key: 0,
class: "layui-table-footer"
};
2023-04-21 06:04:17 +00:00
const _hoisted_29 = {
2022-11-14 03:59:26 +00:00
key: 2,
class: "layui-table-page"
};
const __default__ = {
name: "LayTable"
};
const _sfc_main = defineComponent({
...__default__,
props: {
id: { default: "id" },
skin: null,
size: { default: "md" },
page: null,
columns: null,
dataSource: { default: () => [] },
2022-12-12 01:08:28 +00:00
defaultToolbar: { type: [Boolean, Array], default: false },
2022-11-14 03:59:26 +00:00
selectedKey: { default: "" },
selectedKeys: { default: () => [] },
indentSize: { default: 30 },
childrenColumnName: { default: "children" },
height: null,
maxHeight: { default: "auto" },
even: { type: Boolean, default: false },
expandIndex: { default: 0 },
rowClassName: { type: [String, Function], default: "" },
cellClassName: { type: [String, Function], default: "" },
rowStyle: { type: [String, Function], default: "" },
cellStyle: { type: [String, Function], default: "" },
spanMethod: { type: Function, default: () => {
} },
defaultExpandAll: { type: Boolean, default: false },
expandKeys: { default: () => [] },
loading: { type: Boolean, default: false },
getCheckboxProps: { type: Function, default: () => {
} },
getRadioProps: { type: Function, default: () => {
2023-05-05 01:54:52 +00:00
} },
2023-05-29 05:24:21 +00:00
download: { default: "" },
serverpage: { type: Boolean, default: false }
2022-11-14 03:59:26 +00:00
},
emits: [
"change",
"update:expandKeys",
"update:selectedKeys",
"update:selectedKey",
"row-contextmenu",
"row-double",
2023-04-21 06:04:17 +00:00
"row",
"update:page"
2022-11-14 03:59:26 +00:00
],
setup(__props, { emit }) {
const props = __props;
const slot = useSlots();
slot.default && slot.default();
const tableRef = ref();
2023-04-21 06:04:17 +00:00
const datalist = ref([...props.dataSource]);
console.log(datalist.value, 97);
2023-06-28 07:43:29 +00:00
console.log("\u8868\u683C\u521D\u59CB\u5316", 97);
2022-11-14 03:59:26 +00:00
const allChecked = ref(false);
const hasChecked = ref(false);
const tableDataSource = ref([...props.dataSource]);
const tableColumns = computed(() => {
return [...props.columns];
});
const tableHeadColumns = ref([]);
const tableBodyColumns = ref([]);
const getLevel = (arr) => {
let maxLevel = 0;
(function callBack(arr2, level) {
++level;
maxLevel = Math.max(level, maxLevel);
for (let i = 0; i < arr2.length; i++) {
let item = arr2[i];
if (item.children && item.children.length > 0) {
callBack(item.children, level);
} else {
delete item.children;
}
}
})(arr, 0);
return maxLevel;
};
function getLeafCountTree(json) {
if (!json.children || json.children.length == 0) {
json.colspan = 1;
return 1;
} else {
var leafCount = 0;
for (var i = 0; i < json.children.length; i++) {
leafCount = leafCount + getLeafCountTree(json.children[i]);
}
json.colspan = leafCount;
return leafCount;
}
}
const findFindNode = (columns) => {
columns.forEach((column) => {
if (column.children) {
findFindNode(column.children);
} else {
tableBodyColumns.value.push(column);
}
});
};
findFindNode(tableColumns.value);
const tableColumnKeys = ref([]);
const findFindNodes = (columns) => {
columns.forEach((column) => {
if (column.children) {
tableColumnKeys.value.push(column.key);
findFindNodes(column.children);
} else {
if (!column.hide) {
tableColumnKeys.value.push(column.key);
}
}
});
};
findFindNodes(tableColumns.value);
const findFinalNode = (level, columns) => {
columns.forEach((column) => {
if (column.children) {
const colSpan = getLeafCountTree(column);
column.colspan = colSpan;
if (!tableHeadColumns.value[level]) {
tableHeadColumns.value[level] = [];
}
if (column.fixed && !column.width) {
column.type ? column.width = "50px" : column.width = "100px";
}
tableHeadColumns.value[level].push(column);
findFinalNode(level + 1, column.children);
} else {
const rowSpan = getLevel(columns);
column.rowspan = rowSpan;
if (!tableHeadColumns.value[level]) {
tableHeadColumns.value[level] = [];
}
if (column.fixed && !column.width) {
column.type ? column.width = "50px" : column.width = "100px";
}
tableHeadColumns.value[level].push(column);
}
});
};
findFinalNode(0, tableColumns.value);
2023-05-17 06:38:47 +00:00
const tableSelectedKeys = ref(props.selectedKeys);
2022-11-14 03:59:26 +00:00
const tableExpandKeys = ref([...props.expandKeys]);
watch(() => props.selectedKeys, () => {
tableSelectedKeys.value = props.selectedKeys;
}, { deep: true });
watch(() => props.expandKeys, () => {
tableExpandKeys.value = props.expandKeys;
}, { deep: true });
const tableSelectedKey = computed({
get() {
return props.selectedKey;
},
set(val) {
emit("update:selectedKey", val);
}
});
watch(() => props.dataSource, () => {
2023-06-28 06:36:16 +00:00
console.log("table\u6570\u636E\u66F4\u65B0");
2022-11-14 03:59:26 +00:00
tableDataSource.value = [...props.dataSource];
}, { deep: true });
const changeAll = (isChecked) => {
if (isChecked) {
2023-04-21 06:53:55 +00:00
const datasources = datalist.value.filter((item, index2) => {
2022-11-14 03:59:26 +00:00
var _a;
return !((_a = props.getCheckboxProps(item, index2)) == null ? void 0 : _a.disabled);
});
const ids = datasources.map((item) => {
return item[props.id];
});
tableSelectedKeys.value = [...ids];
} else {
tableSelectedKeys.value = [];
}
};
watch(tableSelectedKeys, () => {
if (tableSelectedKeys.value.length === props.dataSource.length) {
allChecked.value = true;
} else {
allChecked.value = false;
}
if (tableSelectedKeys.value.length > 0) {
hasChecked.value = true;
} else {
hasChecked.value = false;
}
if (tableSelectedKeys.value != props.selectedKeys) {
2023-05-17 06:38:47 +00:00
console.log("\u521D\u59CB\u5316\u8D4B\u503C\u89E6\u53D1\u4FEE\u6539", tableSelectedKeys.value, props.selectedKeys);
emit("update:selectedKeys", tableSelectedKeys.value);
}
2022-11-14 03:59:26 +00:00
}, { deep: true, immediate: true });
watch(tableExpandKeys, () => {
emit("update:expandKeys", tableExpandKeys.value);
}, { deep: true, immediate: true });
2023-04-21 06:04:17 +00:00
watch(tableDataSource, () => {
2023-05-29 05:37:40 +00:00
if (!props.page || props.serverpage) {
2023-04-21 06:04:17 +00:00
datalist.value = tableDataSource.value;
} else {
let tmp = { ...props.page };
tmp.total = tableDataSource.value.length;
emit("update:page", tmp);
2023-06-28 08:59:51 +00:00
sxlist.value = {};
2023-08-03 06:30:10 +00:00
change({
limit: props.page.limit,
current: props.page.current
});
2023-04-21 06:04:17 +00:00
}
});
2022-11-14 03:59:26 +00:00
const change = function(page) {
2023-05-29 05:24:21 +00:00
if (props.serverpage) {
emit("change", page);
} else {
2023-08-03 06:22:42 +00:00
page.current;
2023-05-29 05:24:21 +00:00
datalist.value = tableDataSource.value.slice(page.limit * (page.current - 1), page.limit * page.current);
}
2022-11-14 03:59:26 +00:00
};
const rowClick = function(data, evt) {
emit("row", data, evt);
};
const rowDoubleClick = function(data, evt) {
emit("row-double", data, evt);
};
const rowContextmenu = (data, evt) => {
emit("row-contextmenu", data, evt);
};
const print = () => {
let subOutputRankPrint = tableRef.value;
let newContent = subOutputRankPrint.innerHTML;
let oldContent = document.body.innerHTML;
document.body.innerHTML = newContent;
window.print();
window.location.reload();
document.body.innerHTML = oldContent;
};
2023-11-03 03:48:11 +00:00
function exportElcel(list, header, name) {
const ws = utils.json_to_sheet(list, {
header,
skipHeader: true
});
console.log(ws);
var tmpWB = {
SheetNames: ["sheet"],
Sheets: {
sheet: Object.assign({}, ws, {})
}
};
writeFileSync(tmpWB, name + ".xlsx", {
bookType: "xlsx",
type: "binary"
});
}
2022-11-14 03:59:26 +00:00
const exportData = () => {
2023-11-03 03:48:11 +00:00
let head = [];
let list = [];
let title = {};
2022-11-14 03:59:26 +00:00
for (let tableHeadColumn of tableHeadColumns.value) {
for (let column of tableHeadColumn) {
2023-11-03 03:48:11 +00:00
title[column.key] = column.title;
head.push(column.key);
2022-11-14 03:59:26 +00:00
}
}
2023-11-03 03:48:11 +00:00
list.push(title);
2023-11-03 05:24:30 +00:00
console.log(tableBodyColumns.value, tableHeadColumns.value);
2023-10-25 03:21:42 +00:00
tableDataSource.value.forEach((item, rowIndex) => {
2023-11-03 03:48:11 +00:00
let info = {};
2022-11-14 03:59:26 +00:00
tableBodyColumns.value.forEach((tableColumn, columnIndex) => {
Object.keys(item).forEach((name) => {
if (tableColumn.key === name) {
2023-11-03 03:48:11 +00:00
info[name] = item[name];
2022-11-14 03:59:26 +00:00
}
});
2023-10-24 05:28:08 +00:00
if (tableColumn.type == "number") {
2023-11-03 03:48:11 +00:00
info[item.key] = rowIndex + 1;
2023-10-24 05:28:08 +00:00
}
2022-11-14 03:59:26 +00:00
});
2023-11-03 03:48:11 +00:00
list.push(info);
2022-11-14 03:59:26 +00:00
});
2023-11-03 03:48:11 +00:00
exportElcel(list, head, props.download || "\u4E0B\u8F7D\u6587\u4EF6");
2022-11-14 03:59:26 +00:00
return;
};
2023-04-21 06:04:17 +00:00
const sortTable = (e, key, sort, issoul = false) => {
2022-11-14 03:59:26 +00:00
let currentSort = e.target.parentNode.getAttribute("lay-sort");
if (sort === "desc") {
2023-04-21 06:04:17 +00:00
if (currentSort === sort && !issoul) {
2022-11-14 03:59:26 +00:00
e.target.parentNode.setAttribute("lay-sort", "");
tableDataSource.value = [...props.dataSource];
} else {
e.target.parentNode.setAttribute("lay-sort", "desc");
tableDataSource.value.sort((x, y) => {
if (x[key] < y[key])
return 1;
else if (x[key] > y[key])
return -1;
else
return 0;
});
}
} else {
2023-04-21 06:04:17 +00:00
if (currentSort === sort && !issoul) {
2022-11-14 03:59:26 +00:00
e.target.parentNode.setAttribute("lay-sort", "");
tableDataSource.value = [...props.dataSource];
} else {
e.target.parentNode.setAttribute("lay-sort", "asc");
tableDataSource.value.sort((x, y) => {
if (x[key] < y[key])
return -1;
else if (x[key] > y[key])
return 1;
else
return 0;
});
}
}
};
let tableBody = ref(null);
let tableHeader = ref(null);
let tableHeaderTable = ref(null);
const tableBodyEmptyWidth = ref();
let scrollWidthCell = ref(0);
const getScrollWidth = () => {
var _a, _b, _c;
const clientWidth = ((_a = tableBody.value) == null ? void 0 : _a.clientWidth) || 0;
const offsetWidth = ((_b = tableBody.value) == null ? void 0 : _b.offsetWidth) || 0;
if (clientWidth < offsetWidth) {
scrollWidthCell.value = offsetWidth - clientWidth;
} else {
scrollWidthCell.value = 0;
}
tableBodyEmptyWidth.value = ((_c = tableHeaderTable.value) == null ? void 0 : _c.offsetWidth) + "px";
};
const hasl = ref(false);
const hasr = ref(false);
const classes = computed(() => {
return [
hasl.value ? "layui-table-has-fixed-left" : "",
hasr.value ? "layui-table-has-fixed-right" : ""
];
});
watch(() => [props.height, props.maxHeight, props.dataSource], () => {
nextTick(() => {
getScrollWidth();
2023-01-16 02:36:02 +00:00
getFixedColumn();
2022-11-14 03:59:26 +00:00
});
2023-01-16 02:01:19 +00:00
}, {
deep: true
2022-11-14 03:59:26 +00:00
});
onMounted(() => {
var _a, _b;
getScrollWidth();
getFixedColumn();
(_a = tableBody.value) == null ? void 0 : _a.addEventListener("scroll", () => {
getFixedColumn();
});
(_b = tableBody.value) == null ? void 0 : _b.addEventListener("transitionend", () => {
getScrollWidth();
});
window.onresize = () => {
getScrollWidth();
getFixedColumn();
};
});
const getFixedColumn = () => {
var _a, _b, _c, _d, _e, _f, _g;
tableHeader.value.scrollLeft = ((_a = tableBody.value) == null ? void 0 : _a.scrollLeft) || 0;
if (((_b = tableBody.value) == null ? void 0 : _b.scrollWidth) > ((_c = tableBody.value) == null ? void 0 : _c.clientWidth)) {
if (((_d = tableBody.value) == null ? void 0 : _d.scrollLeft) == 0) {
hasl.value = false;
hasr.value = true;
} else {
const t = ((_e = tableBody.value) == null ? void 0 : _e.scrollLeft) + ((_f = tableBody.value) == null ? void 0 : _f.offsetWidth) + 2;
const s2 = (_g = tableBody.value) == null ? void 0 : _g.scrollWidth;
if (t > s2) {
hasl.value = true;
hasr.value = false;
} else {
hasl.value = true;
hasr.value = true;
}
}
} else {
hasl.value = false;
hasr.value = false;
}
};
const slotsData = ref([]);
props.columns.map((value) => {
if (value.customSlot) {
slotsData.value.push(value.customSlot);
}
});
const currentIndentSize = ref(0);
const childrenExpandSpace = computed(() => {
return props.dataSource.find((value) => {
if (value[props.childrenColumnName]) {
return true;
}
}) != void 0;
});
const renderFixedStyle = (column, columnIndex) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed == void 0 && tableColumnKeys.value.includes(props.columns[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
2022-12-12 01:08:28 +00:00
const renderHeadFixedStyle = (column, columnIndex, tableHeadColumn) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < tableHeadColumn.length; i++) {
if (tableHeadColumn[i].fixed == void 0 && tableColumnKeys.value.includes(tableHeadColumn[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
2022-11-14 03:59:26 +00:00
const renderFixedClassName = (column, columnIndex) => {
if (column.fixed) {
if (column.fixed == "left") {
var left = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = false;
}
}
return left ? `layui-table-fixed-left-last` : "";
} else {
var right = true;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = false;
}
}
return right ? `layui-table-fixed-right-first` : "";
}
}
};
const hasTotalRow = computed(() => {
let b = false;
props.columns.forEach((item) => {
if (item.totalRow) {
b = true;
}
});
return b;
});
const renderTotalRowCell = (column) => {
if (column.totalRow) {
if (column.totalRow != true) {
return column.totalRow;
} else {
if (column.totalRowMethod) {
return column.totalRowMethod(column, tableDataSource.value);
} else {
return totalRowMethod(column, tableDataSource.value);
}
}
}
};
const totalRowMethod = (column, dataSource) => {
let total = 0;
dataSource.forEach((item) => {
total = total + Number(item[column.key]);
});
return total;
};
2022-12-12 01:08:28 +00:00
const showToolbar = (toolbarName) => {
if (props.defaultToolbar instanceof Array) {
return props.defaultToolbar.includes(toolbarName);
}
return props.defaultToolbar;
};
const toolbarStyle = (toolbarName) => {
if (props.defaultToolbar instanceof Array) {
return { order: props.defaultToolbar.indexOf(toolbarName) };
}
};
2022-11-14 03:59:26 +00:00
onBeforeUnmount(() => {
window.onresize = null;
});
2023-04-21 06:04:17 +00:00
const soulstatus = ref(false);
const soultop = ref(0);
const soulleft = ref(0);
const selcolumn = ref({});
const soulkey = ref("");
2023-06-28 08:59:51 +00:00
const sxlist = ref({});
2023-04-21 06:04:17 +00:00
function showsoul(event, column, key) {
console.log(event);
soulleft.value = event.pageX;
soultop.value = event.pageY;
soulstatus.value = true;
selcolumn.value = column;
soulkey.value = key;
}
const heddin = () => {
soulkey.value = "";
};
function asc(event) {
selcolumn.value.soulclass = "soul-icon-filter-asc";
sortTable(event, selcolumn.value.key, "asc", true);
}
function desc(event) {
selcolumn.value.soulclass = "soul-icon-filter-desc";
sortTable(event, selcolumn.value.key, "desc", true);
}
function sx(e) {
sxlist.value[e.key] = e.list;
2023-06-28 08:48:43 +00:00
console.log("\u7B5B\u9009\u4E8B\u4EF6", sxlist.value, sxlist.value.length);
2023-04-21 06:04:17 +00:00
}
2023-06-28 07:30:16 +00:00
watch(sxlist, () => {
console.log("sxlist\u66F4\u65B0");
});
2023-06-28 08:45:49 +00:00
watch([() => sxlist, () => props.dataSource], (old, new1) => {
2023-06-28 09:06:41 +00:00
if (Object.keys(sxlist.value).length == 0) {
2023-06-28 08:14:25 +00:00
return;
}
2023-04-21 06:04:17 +00:00
let list = [...props.dataSource];
let endlist = [];
for (let i in sxlist.value) {
for (let j in list) {
if (list[j] != "" && sxlist.value[i].length != 0) {
if (!sxlist.value[i].includes(list[j][i])) {
list[j] = "";
}
}
}
}
for (let i of list) {
if (i != "") {
endlist.push(i);
}
}
2023-06-25 05:36:37 +00:00
if (!props.page || props.serverpage) {
2023-06-25 05:44:41 +00:00
nextTick(() => {
datalist.value = endlist;
});
2023-04-21 06:04:17 +00:00
} else {
tableDataSource.value = endlist;
change({
limit: props.page.limit,
2023-08-03 06:22:42 +00:00
current: props.page.current,
2023-06-25 03:30:33 +00:00
isReload: true
2023-04-21 06:04:17 +00:00
});
}
2023-06-28 08:23:15 +00:00
}, {
deep: true
2023-04-21 06:04:17 +00:00
});
window.addEventListener("click", heddin);
2022-11-14 03:59:26 +00:00
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "tableRef",
ref: tableRef
}, [
_hoisted_1,
createElementVNode("div", {
class: normalizeClass(["layui-form layui-border-box layui-table-view", unref(classes)])
}, [
__props.defaultToolbar || unref(slot).toolbar ? (openBlock(), createElementBlock("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
renderSlot(_ctx.$slots, "toolbar")
]),
__props.defaultToolbar ? (openBlock(), createElementBlock("div", _hoisted_4, [
2023-04-21 06:04:17 +00:00
showToolbar("filter") ? (openBlock(), createBlock(_sfc_main$a, {
2022-12-12 01:08:28 +00:00
key: 0,
updateAtScroll: "",
style: normalizeStyle(toolbarStyle("filter"))
}, {
2022-11-14 03:59:26 +00:00
content: withCtx(() => [
createElementVNode("div", _hoisted_6, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumns.value[0], (column) => {
2023-04-21 06:04:17 +00:00
return openBlock(), createBlock(_sfc_main$5, {
2022-11-14 03:59:26 +00:00
modelValue: tableColumnKeys.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => tableColumnKeys.value = $event),
skin: "primary",
disabled: column.children,
key: column.key,
value: column.key
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(column.title), 1)
]),
_: 2
}, 1032, ["modelValue", "disabled", "value"]);
}), 128))
])
]),
default: withCtx(() => [
_hoisted_5
]),
_: 1
2022-12-12 01:08:28 +00:00
}, 8, ["style"])) : createCommentVNode("", true),
showToolbar("export") ? (openBlock(), createElementBlock("div", {
key: 1,
2022-11-14 03:59:26 +00:00
class: "layui-inline",
title: "\u5BFC\u51FA",
"lay-event": "",
2022-12-12 01:08:28 +00:00
style: normalizeStyle(toolbarStyle("export")),
2022-11-14 03:59:26 +00:00
onClick: _cache[1] || (_cache[1] = ($event) => exportData())
2022-12-12 01:08:28 +00:00
}, _hoisted_8, 4)) : createCommentVNode("", true),
showToolbar("print") ? (openBlock(), createElementBlock("div", {
key: 2,
style: normalizeStyle(toolbarStyle("print")),
2022-11-14 03:59:26 +00:00
class: "layui-inline",
title: "\u6253\u5370",
"lay-event": "",
onClick: _cache[2] || (_cache[2] = ($event) => print())
2022-12-12 01:08:28 +00:00
}, _hoisted_10, 4)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
])) : createCommentVNode("", true)
])) : createCommentVNode("", true),
unref(slot).header ? (openBlock(), createElementBlock("div", _hoisted_11, [
renderSlot(_ctx.$slots, "header")
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_12, [
createElementVNode("div", {
class: "layui-table-header",
style: normalizeStyle([{ "padding-right": `${unref(scrollWidthCell)}px` }])
}, [
createElementVNode("div", {
class: "layui-table-header-wrapper",
ref_key: "tableHeader",
ref: tableHeader
}, [
createElementVNode("table", {
class: "layui-table",
"lay-size": __props.size,
"lay-skin": __props.skin,
ref_key: "tableHeaderTable",
ref: tableHeaderTable
}, [
createElementVNode("colgroup", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableBodyColumns.value, (column) => {
return openBlock(), createElementBlock(Fragment, { key: column }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("col", {
key: 0,
width: column.width,
style: normalizeStyle({
minWidth: column.minWidth ? column.minWidth : "50px"
})
}, null, 12, _hoisted_14)) : createCommentVNode("", true)
], 64);
}), 128))
]),
createElementVNode("thead", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumns.value, (tableHeadColumn, tableHeadColumnIndex) => {
return openBlock(), createElementBlock("tr", { key: tableHeadColumnIndex }, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumn, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: column }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("th", {
key: 0,
colspan: column.colspan,
rowspan: column.rowspan,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : "",
column.type == "checkbox" ? "layui-table-cell-checkbox" : "",
column.type == "radio" ? "layui-table-cell-radio" : "",
column.type == "number" ? "layui-table-cell-number" : ""
]]),
style: normalizeStyle([
{
textAlign: column.align
},
2022-12-12 01:08:28 +00:00
renderHeadFixedStyle(column, columnIndex, tableHeadColumn)
2022-11-14 03:59:26 +00:00
])
}, [
2023-04-21 06:04:17 +00:00
column.type == "checkbox" ? (openBlock(), createBlock(_sfc_main$5, {
2022-11-14 03:59:26 +00:00
key: 0,
modelValue: hasChecked.value,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasChecked.value = $event),
"is-indeterminate": !allChecked.value,
skin: "primary",
value: "all",
onChange: changeAll
}, null, 8, ["modelValue", "is-indeterminate"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createElementVNode("span", null, [
column.titleSlot ? renderSlot(_ctx.$slots, column.titleSlot, { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createTextVNode(toDisplayString(column.title), 1)
], 64))
]),
column.sort ? (openBlock(), createElementBlock("span", _hoisted_16, [
createElementVNode("i", {
onClick: withModifiers(($event) => sortTable($event, column.key, "asc"), ["stop"]),
class: "layui-edge layui-table-sort-asc",
title: "\u5347\u5E8F"
}, null, 8, _hoisted_17),
createElementVNode("i", {
onClick: withModifiers(($event) => sortTable($event, column.key, "desc"), ["stop"]),
class: "layui-edge layui-table-sort-desc",
title: "\u964D\u5E8F"
}, null, 8, _hoisted_18)
2023-04-21 06:04:17 +00:00
])) : createCommentVNode("", true),
column.soul ? (openBlock(), createElementBlock("span", _hoisted_19, [
createElementVNode("i", {
class: normalizeClass(["soul-icon soul-box", column.soulclass || "soul-icon-filter"]),
onClick: withModifiers(($event) => showsoul($event, column, column.key), ["stop"])
}, null, 10, _hoisted_20)
2022-11-14 03:59:26 +00:00
])) : createCommentVNode("", true)
], 64))
], 14, _hoisted_15)) : createCommentVNode("", true)
], 64);
}), 128))
]);
}), 128))
])
], 8, _hoisted_13)
], 512)
], 4),
createElementVNode("div", {
class: "layui-table-body layui-table-main",
style: normalizeStyle({ height: __props.height, maxHeight: __props.maxHeight }),
ref_key: "tableBody",
ref: tableBody
}, [
2023-04-21 06:04:17 +00:00
datalist.value.length > 0 && __props.loading == false ? (openBlock(), createElementBlock("table", {
2022-11-14 03:59:26 +00:00
key: 0,
class: normalizeClass(["layui-table", { "layui-table-even": props.even }]),
"lay-size": __props.size,
"lay-skin": __props.skin
}, [
createElementVNode("colgroup", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableBodyColumns.value, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("col", {
key: 0,
width: column.width,
style: normalizeStyle({
minWidth: column.minWidth ? column.minWidth : "50px"
})
2023-04-21 06:04:17 +00:00
}, null, 12, _hoisted_22)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64);
}), 128))
]),
createElementVNode("tbody", null, [
2023-04-21 06:04:17 +00:00
(openBlock(true), createElementBlock(Fragment, null, renderList(datalist.value, (children, index2) => {
2023-02-16 06:23:57 +00:00
return openBlock(), createBlock(TableRow, {
2022-11-14 03:59:26 +00:00
key: index2,
id: __props.id,
index: index2,
data: children,
columns: tableBodyColumns.value,
"indent-size": __props.indentSize,
currentIndentSize: currentIndentSize.value,
tableColumnKeys: tableColumnKeys.value,
expandSpace: unref(childrenExpandSpace),
expandIndex: __props.expandIndex,
cellStyle: __props.cellStyle,
cellClassName: __props.cellClassName,
rowStyle: __props.rowStyle,
rowClassName: __props.rowClassName,
spanMethod: __props.spanMethod,
defaultExpandAll: __props.defaultExpandAll,
getCheckboxProps: __props.getCheckboxProps,
getRadioProps: __props.getRadioProps,
expandKeys: tableExpandKeys.value,
"onUpdate:expandKeys": _cache[4] || (_cache[4] = ($event) => tableExpandKeys.value = $event),
selectedKeys: tableSelectedKeys.value,
"onUpdate:selectedKeys": _cache[5] || (_cache[5] = ($event) => tableSelectedKeys.value = $event),
selectedKey: unref(tableSelectedKey),
"onUpdate:selectedKey": _cache[6] || (_cache[6] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null),
onRow: rowClick,
onRowDouble: rowDoubleClick,
2023-10-25 03:21:42 +00:00
onRowContextmenu: rowContextmenu,
page: __props.page
2022-11-14 03:59:26 +00:00
}, createSlots({ _: 2 }, [
renderList(slotsData.value, (name) => {
return {
name,
fn: withCtx(({ data }) => [
renderSlot(_ctx.$slots, name, { data })
])
};
}),
unref(slot).expand ? {
name: "expand",
fn: withCtx(({ data }) => [
renderSlot(_ctx.$slots, "expand", { data })
]),
key: "0"
} : void 0
2023-10-25 03:21:42 +00:00
]), 1032, ["id", "index", "data", "columns", "indent-size", "currentIndentSize", "tableColumnKeys", "expandSpace", "expandIndex", "cellStyle", "cellClassName", "rowStyle", "rowClassName", "spanMethod", "defaultExpandAll", "getCheckboxProps", "getRadioProps", "expandKeys", "selectedKeys", "selectedKey", "page"]);
2022-11-14 03:59:26 +00:00
}), 128)),
2023-04-21 06:04:17 +00:00
unref(hasTotalRow) ? (openBlock(), createElementBlock("tr", _hoisted_23, [
2022-11-14 03:59:26 +00:00
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("td", {
key: 0,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex)
]),
class: normalizeClass([
"layui-table-cell",
renderFixedClassName(column, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]),
innerHTML: renderTotalRowCell(column)
2023-04-21 06:04:17 +00:00
}, null, 14, _hoisted_24)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 64);
}), 128))
])) : createCommentVNode("", true)
])
2023-04-21 06:04:17 +00:00
], 10, _hoisted_21)) : createCommentVNode("", true),
datalist.value.length == 0 && __props.loading == false ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createVNode(_sfc_main$b),
2022-11-14 03:59:26 +00:00
createElementVNode("div", {
style: normalizeStyle({ width: tableBodyEmptyWidth.value })
}, null, 4)
], 64)) : createCommentVNode("", true),
2023-04-21 06:04:17 +00:00
__props.loading == true ? (openBlock(), createElementBlock("div", _hoisted_25, _hoisted_27)) : createCommentVNode("", true)
2022-11-14 03:59:26 +00:00
], 4),
2023-04-21 06:04:17 +00:00
unref(slot).footer ? (openBlock(), createElementBlock("div", _hoisted_28, [
2022-11-14 03:59:26 +00:00
renderSlot(_ctx.$slots, "footer")
])) : createCommentVNode("", true)
]),
2023-04-21 06:04:17 +00:00
__props.page && __props.page.total > 0 ? (openBlock(), createElementBlock("div", _hoisted_29, [
createVNode(_sfc_main$2, {
2022-11-14 03:59:26 +00:00
total: __props.page.total,
pages: __props.page.pages,
theme: __props.page.theme,
limits: __props.page.limits,
showSkip: __props.page.showSkip,
"show-page": __props.page.showPage,
showRefresh: __props.page.showRefresh,
showLimit: __props.page.showLimit,
showCount: __props.page.showCount,
2022-11-15 06:58:26 +00:00
count: __props.page.count,
2022-11-14 03:59:26 +00:00
current: __props.page.current,
"onUpdate:current": _cache[7] || (_cache[7] = ($event) => __props.page.current = $event),
limit: __props.page.limit,
"onUpdate:limit": _cache[8] || (_cache[8] = ($event) => __props.page.limit = $event),
onChange: change
2022-11-15 06:58:26 +00:00
}, null, 8, ["total", "pages", "theme", "limits", "showSkip", "show-page", "showRefresh", "showLimit", "showCount", "count", "current", "limit"])
2022-11-14 03:59:26 +00:00
])) : createCommentVNode("", true)
2023-04-21 06:04:17 +00:00
], 2),
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumns.value, (tableHeadColumn, tableHeadColumnIndex) => {
return openBlock(), createElementBlock("div", { key: tableHeadColumnIndex }, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumn, (column, columnIndex) => {
return openBlock(), createElementBlock("div", { key: column }, [
withDirectives(createVNode(_sfc_main$1, {
top: soultop.value,
left: soulleft.value,
2023-05-04 08:19:37 +00:00
show: soulkey.value == column.key,
2023-04-21 06:04:17 +00:00
onAsc: asc,
onDesc: desc,
2023-05-04 07:49:04 +00:00
onDaochu: exportData,
2023-05-04 08:10:37 +00:00
list: datalist.value,
2023-04-21 06:04:17 +00:00
soulkey: column.key,
onSx: sx
2023-05-04 08:19:37 +00:00
}, null, 8, ["top", "left", "show", "list", "soulkey"]), [
2023-04-21 06:04:17 +00:00
[vShow, soulkey.value == column.key]
])
]);
}), 128))
]);
}), 128))
2022-11-14 03:59:26 +00:00
], 512);
};
}
});
const component = withInstall(_sfc_main);
export { component as default };