@ganwei-web/gw-base-components-plus 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs +520 -30
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.css +62 -6
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +520 -30
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.js +522 -32
- package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -1
- package/package.json +1 -1
|
@@ -288,6 +288,21 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
|
288
288
|
});
|
|
289
289
|
const index_vue_vue_type_style_index_0_lang$d = "";
|
|
290
290
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
291
|
+
var _sfc_main187 = /* @__PURE__ */ vue.defineComponent({
|
|
292
|
+
name: "Operation",
|
|
293
|
+
__name: "operation",
|
|
294
|
+
setup(__props) {
|
|
295
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
296
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
297
|
+
viewBox: "0 0 1024 1024"
|
|
298
|
+
}, [
|
|
299
|
+
vue.createElementVNode("path", {
|
|
300
|
+
fill: "currentColor",
|
|
301
|
+
d: "M389.44 768a96.064 96.064 0 0 1 181.12 0H896v64H570.56a96.064 96.064 0 0 1-181.12 0H128v-64zm192-288a96.064 96.064 0 0 1 181.12 0H896v64H762.56a96.064 96.064 0 0 1-181.12 0H128v-64zm-320-288a96.064 96.064 0 0 1 181.12 0H896v64H442.56a96.064 96.064 0 0 1-181.12 0H128v-64z"
|
|
302
|
+
})
|
|
303
|
+
]));
|
|
304
|
+
}
|
|
305
|
+
}), operation_default = _sfc_main187;
|
|
291
306
|
var _sfc_main197 = /* @__PURE__ */ vue.defineComponent({
|
|
292
307
|
name: "Picture",
|
|
293
308
|
__name: "picture",
|
|
@@ -307,7 +322,7 @@ var _sfc_main197 = /* @__PURE__ */ vue.defineComponent({
|
|
|
307
322
|
]));
|
|
308
323
|
}
|
|
309
324
|
}), picture_default = _sfc_main197;
|
|
310
|
-
const _hoisted_1 = { class: "error-slot" };
|
|
325
|
+
const _hoisted_1$1 = { class: "error-slot" };
|
|
311
326
|
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
312
327
|
__name: "index",
|
|
313
328
|
props: {
|
|
@@ -364,7 +379,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
|
364
379
|
!_ctx.$slots.error ? {
|
|
365
380
|
name: "error",
|
|
366
381
|
fn: vue.withCtx(() => [
|
|
367
|
-
vue.createElementVNode("div", _hoisted_1, [
|
|
382
|
+
vue.createElementVNode("div", _hoisted_1$1, [
|
|
368
383
|
vue.createVNode(_component_el_icon, null, {
|
|
369
384
|
default: vue.withCtx(() => [
|
|
370
385
|
vue.createVNode(vue.unref(picture_default))
|
|
@@ -706,30 +721,31 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
706
721
|
};
|
|
707
722
|
}
|
|
708
723
|
});
|
|
709
|
-
function useResizeTable() {
|
|
724
|
+
function useResizeTable(props) {
|
|
710
725
|
const instance = vue.getCurrentInstance();
|
|
711
|
-
const height = vue.ref();
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
726
|
+
const height = vue.ref(props.height);
|
|
727
|
+
if (props.autoHeight) {
|
|
728
|
+
vue.onMounted(() => {
|
|
729
|
+
resizeTable();
|
|
730
|
+
window.addEventListener("resize", resizeTable);
|
|
731
|
+
});
|
|
732
|
+
vue.onBeforeUnmount(() => {
|
|
733
|
+
window.removeEventListener("resize", resizeTable);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
720
736
|
function getPxNumber(value) {
|
|
721
737
|
if (value.endsWith("px")) {
|
|
722
738
|
return Number(value.slice(0, -2));
|
|
723
739
|
}
|
|
724
740
|
return 0;
|
|
725
741
|
}
|
|
726
|
-
function getElementHeight(
|
|
727
|
-
const stylesheet = getComputedStyle(
|
|
728
|
-
return
|
|
742
|
+
function getElementHeight(el) {
|
|
743
|
+
const stylesheet = getComputedStyle(el);
|
|
744
|
+
return el.clientHeight || getPxNumber(stylesheet.height);
|
|
729
745
|
}
|
|
730
746
|
function resizeTable() {
|
|
731
747
|
var _a, _b;
|
|
732
|
-
el = (_b = (_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.$el) == null ? void 0 : _b.parentElement;
|
|
748
|
+
let el = (_b = (_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.$el) == null ? void 0 : _b.parentElement;
|
|
733
749
|
if (el) {
|
|
734
750
|
const stylesheet = getComputedStyle(el);
|
|
735
751
|
height.value = getElementHeight(el) - getPxNumber(stylesheet.paddingTop) - getPxNumber(stylesheet.paddingBottom);
|
|
@@ -737,35 +753,509 @@ function useResizeTable() {
|
|
|
737
753
|
}
|
|
738
754
|
return height;
|
|
739
755
|
}
|
|
756
|
+
const _hoisted_1 = { class: "gw-table-container" };
|
|
757
|
+
const _hoisted_2 = { class: "column-filter-content" };
|
|
758
|
+
const _hoisted_3 = { class: "filter-input-container" };
|
|
759
|
+
const _hoisted_4 = { class: "equipList-table-group-checkbox" };
|
|
760
|
+
const _hoisted_5 = { class: "equipList-table-group-botton" };
|
|
740
761
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
741
762
|
__name: "index",
|
|
742
763
|
props: {
|
|
743
764
|
height: {
|
|
744
765
|
type: Number,
|
|
745
766
|
default: null
|
|
767
|
+
},
|
|
768
|
+
autoHeight: {
|
|
769
|
+
type: Boolean,
|
|
770
|
+
default: true
|
|
771
|
+
},
|
|
772
|
+
showColumnFilter: {
|
|
773
|
+
type: Boolean,
|
|
774
|
+
default: false
|
|
775
|
+
},
|
|
776
|
+
tableName: {
|
|
777
|
+
type: String,
|
|
778
|
+
default: "default-table"
|
|
779
|
+
},
|
|
780
|
+
columns: {
|
|
781
|
+
type: Array,
|
|
782
|
+
default: () => []
|
|
783
|
+
},
|
|
784
|
+
onFetchColumns: {
|
|
785
|
+
type: Function,
|
|
786
|
+
default: null
|
|
787
|
+
},
|
|
788
|
+
onSaveColumns: {
|
|
789
|
+
type: Function,
|
|
790
|
+
default: null
|
|
791
|
+
},
|
|
792
|
+
onColumnChange: {
|
|
793
|
+
type: Function,
|
|
794
|
+
default: null
|
|
746
795
|
}
|
|
747
796
|
},
|
|
748
797
|
setup(__props, { expose: __expose }) {
|
|
749
798
|
const proxyElement = vue.ref();
|
|
799
|
+
const attrs = vue.useAttrs();
|
|
800
|
+
const tableAttrs = vue.computed(() => {
|
|
801
|
+
const { height, autoHeight, showColumnFilter, tableName, columns, onFetchColumns, onSaveColumns, onColumnChange, ...restAttrs } = attrs;
|
|
802
|
+
return restAttrs;
|
|
803
|
+
});
|
|
750
804
|
const expose = useExpose(proxyElement);
|
|
751
805
|
__expose(expose);
|
|
752
|
-
const
|
|
806
|
+
const props = __props;
|
|
807
|
+
const popoverVisible = vue.ref(false);
|
|
808
|
+
const filterKeyword = vue.ref("");
|
|
809
|
+
const checkedColumns = vue.ref([]);
|
|
810
|
+
const allColumns = vue.ref([]);
|
|
811
|
+
const contentLoading = vue.ref(false);
|
|
812
|
+
const resetLoading = vue.ref(false);
|
|
813
|
+
const loading = vue.ref(false);
|
|
814
|
+
const filteredColumnsList = vue.computed(() => {
|
|
815
|
+
if (!filterKeyword.value) {
|
|
816
|
+
return allColumns.value;
|
|
817
|
+
}
|
|
818
|
+
return allColumns.value.filter(
|
|
819
|
+
(column) => column.label.toLowerCase().includes(filterKeyword.value.toLowerCase())
|
|
820
|
+
);
|
|
821
|
+
});
|
|
822
|
+
const toggleFilterPopover = () => {
|
|
823
|
+
popoverVisible.value = !popoverVisible.value;
|
|
824
|
+
if (popoverVisible.value && allColumns.value.length === 0) {
|
|
825
|
+
initColumns();
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
const initColumns = () => {
|
|
829
|
+
if (props.columns && props.columns.length > 0) {
|
|
830
|
+
allColumns.value = [...props.columns];
|
|
831
|
+
checkedColumns.value = allColumns.value.map((col) => col.prop || col.label);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
vue.nextTick(() => {
|
|
835
|
+
if (proxyElement.value) {
|
|
836
|
+
const tableHeader = proxyElement.value.$el.querySelector(".el-table__header-wrapper");
|
|
837
|
+
if (tableHeader) {
|
|
838
|
+
const thElements = tableHeader.querySelectorAll("th");
|
|
839
|
+
const columns = [];
|
|
840
|
+
thElements.forEach((th, index2) => {
|
|
841
|
+
if (index2 > 0) {
|
|
842
|
+
const cell = th.querySelector(".cell");
|
|
843
|
+
if (cell) {
|
|
844
|
+
const label = cell.textContent.trim();
|
|
845
|
+
if (label) {
|
|
846
|
+
columns.push({
|
|
847
|
+
prop: `col_${index2}`,
|
|
848
|
+
label
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
if (columns.length > 0) {
|
|
855
|
+
allColumns.value = columns;
|
|
856
|
+
checkedColumns.value = columns.map((col) => col.prop);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
});
|
|
861
|
+
};
|
|
862
|
+
const fetchPageColumns = async () => {
|
|
863
|
+
if (!props.tableName || !props.onFetchColumns)
|
|
864
|
+
return;
|
|
865
|
+
contentLoading.value = true;
|
|
866
|
+
try {
|
|
867
|
+
const data = await props.onFetchColumns(props.tableName);
|
|
868
|
+
if (data && Array.isArray(data)) {
|
|
869
|
+
const selectedProps = data;
|
|
870
|
+
checkedColumns.value = allColumns.value.filter((col) => selectedProps.includes(col.label || col.prop)).map((col) => col.prop);
|
|
871
|
+
if (checkedColumns.value.length === 0 && allColumns.value.length > 0) {
|
|
872
|
+
checkedColumns.value = [allColumns.value[0].prop];
|
|
873
|
+
}
|
|
874
|
+
applyColumnFilter();
|
|
875
|
+
}
|
|
876
|
+
} catch (error) {
|
|
877
|
+
console.error("获取列配置失败:", error);
|
|
878
|
+
checkedColumns.value = allColumns.value.map((col) => col.prop);
|
|
879
|
+
applyColumnFilter();
|
|
880
|
+
} finally {
|
|
881
|
+
contentLoading.value = false;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const savePageColumns = async () => {
|
|
885
|
+
if (!props.tableName || !props.onSaveColumns) {
|
|
886
|
+
popoverVisible.value = false;
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
loading.value = true;
|
|
890
|
+
try {
|
|
891
|
+
const selectedLabels = checkedColumns.value.map((prop) => {
|
|
892
|
+
const column = allColumns.value.find((col) => col.prop === prop);
|
|
893
|
+
return column ? column.label : prop;
|
|
894
|
+
});
|
|
895
|
+
await props.onSaveColumns(props.tableName, selectedLabels);
|
|
896
|
+
popoverVisible.value = false;
|
|
897
|
+
} catch (error) {
|
|
898
|
+
console.error("保存列配置失败:", error);
|
|
899
|
+
} finally {
|
|
900
|
+
loading.value = false;
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
const resetColumns = () => {
|
|
904
|
+
resetLoading.value = true;
|
|
905
|
+
checkedColumns.value = allColumns.value.map((col) => col.prop);
|
|
906
|
+
applyColumnFilter();
|
|
907
|
+
setTimeout(() => {
|
|
908
|
+
savePageColumns();
|
|
909
|
+
}, 300);
|
|
910
|
+
};
|
|
911
|
+
const saveColumns = () => {
|
|
912
|
+
applyColumnFilter();
|
|
913
|
+
savePageColumns();
|
|
914
|
+
};
|
|
915
|
+
const handleColumnChange = (value) => {
|
|
916
|
+
if (value.length === 0) {
|
|
917
|
+
checkedColumns.value = [allColumns.value[0].prop];
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
applyColumnFilter();
|
|
921
|
+
};
|
|
922
|
+
const applyColumnFilter = () => {
|
|
923
|
+
if (!proxyElement.value)
|
|
924
|
+
return;
|
|
925
|
+
const tableHeader = proxyElement.value.$el.querySelector(".el-table__header-wrapper");
|
|
926
|
+
const tableBody = proxyElement.value.$el.querySelector(".el-table__body-wrapper");
|
|
927
|
+
if (!tableHeader || !tableBody)
|
|
928
|
+
return;
|
|
929
|
+
const thElements = tableHeader.querySelectorAll("th");
|
|
930
|
+
const trElements = tableBody.querySelectorAll("tr");
|
|
931
|
+
const propToTableIndex = {};
|
|
932
|
+
thElements.forEach((th, index2) => {
|
|
933
|
+
if (index2 > 0) {
|
|
934
|
+
const cell = th.querySelector(".cell");
|
|
935
|
+
if (cell) {
|
|
936
|
+
const label = cell.textContent.trim();
|
|
937
|
+
const column = allColumns.value.find((col) => col.label === label);
|
|
938
|
+
if (column) {
|
|
939
|
+
propToTableIndex[column.prop] = index2;
|
|
940
|
+
} else {
|
|
941
|
+
propToTableIndex[`col_${index2}`] = index2;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
thElements.forEach((th, index2) => {
|
|
947
|
+
if (index2 > 0) {
|
|
948
|
+
const cell = th.querySelector(".cell");
|
|
949
|
+
if (cell) {
|
|
950
|
+
const label = cell.textContent.trim();
|
|
951
|
+
const column = allColumns.value.find((col) => col.label === label);
|
|
952
|
+
const prop = column ? column.prop : `col_${index2}`;
|
|
953
|
+
th.style.display = checkedColumns.value.includes(prop) ? "" : "none";
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
trElements.forEach((row) => {
|
|
958
|
+
const tdElements = row.querySelectorAll("td");
|
|
959
|
+
tdElements.forEach((td, index2) => {
|
|
960
|
+
if (index2 > 0) {
|
|
961
|
+
const prop = `col_${index2}`;
|
|
962
|
+
td.style.display = checkedColumns.value.includes(prop) ? "" : "none";
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
const data = {
|
|
967
|
+
tableName: props.tableName,
|
|
968
|
+
checkedColumns: [...checkedColumns.value]
|
|
969
|
+
};
|
|
970
|
+
if (props.onColumnChange) {
|
|
971
|
+
props.onColumnChange(data);
|
|
972
|
+
}
|
|
973
|
+
vue.nextTick(() => {
|
|
974
|
+
adjustTableWidth();
|
|
975
|
+
});
|
|
976
|
+
};
|
|
977
|
+
const adjustTableWidth = () => {
|
|
978
|
+
if (!proxyElement.value)
|
|
979
|
+
return;
|
|
980
|
+
const tableContainer = proxyElement.value.$el.querySelector(".el-table");
|
|
981
|
+
if (!tableContainer)
|
|
982
|
+
return;
|
|
983
|
+
tableContainer.classList.add("el-table--auto-width");
|
|
984
|
+
const tableWidth = tableContainer.offsetWidth;
|
|
985
|
+
const allThElements = proxyElement.value.$el.querySelectorAll(".el-table__header-wrapper th");
|
|
986
|
+
const visibleColumns = [];
|
|
987
|
+
allThElements.forEach((th, index2) => {
|
|
988
|
+
if (index2 > 0 && th.style.display !== "none") {
|
|
989
|
+
const cell = th.querySelector(".cell");
|
|
990
|
+
if (cell) {
|
|
991
|
+
const label = cell.textContent.trim();
|
|
992
|
+
const column = allColumns.value.find((col) => col.label === label);
|
|
993
|
+
if (column) {
|
|
994
|
+
visibleColumns.push({
|
|
995
|
+
index: index2,
|
|
996
|
+
prop: column.prop,
|
|
997
|
+
label,
|
|
998
|
+
minWidth: 80
|
|
999
|
+
// 最小宽度
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
if (visibleColumns.length === 0)
|
|
1006
|
+
return;
|
|
1007
|
+
const firstColumnWidth = allThElements[0] ? allThElements[0].offsetWidth : 50;
|
|
1008
|
+
const availableWidth = tableWidth - firstColumnWidth - 20;
|
|
1009
|
+
const minTotalWidth = visibleColumns.reduce((sum, col) => sum + col.minWidth, 0);
|
|
1010
|
+
const table = proxyElement.value.$el.querySelector(".el-table__body-wrapper table");
|
|
1011
|
+
if (table) {
|
|
1012
|
+
table.style.tableLayout = "fixed";
|
|
1013
|
+
}
|
|
1014
|
+
const tableBody = proxyElement.value.$el.querySelector(".el-table__body");
|
|
1015
|
+
const tableHeader = proxyElement.value.$el.querySelector(".el-table__header");
|
|
1016
|
+
if (tableBody) {
|
|
1017
|
+
tableBody.style.width = "100%";
|
|
1018
|
+
}
|
|
1019
|
+
if (tableHeader) {
|
|
1020
|
+
tableHeader.style.width = "100%";
|
|
1021
|
+
}
|
|
1022
|
+
allThElements.forEach((th, index2) => {
|
|
1023
|
+
if (index2 > 0) {
|
|
1024
|
+
th.style.width = "auto";
|
|
1025
|
+
th.style.minWidth = "80px";
|
|
1026
|
+
th.style.maxWidth = "none";
|
|
1027
|
+
const tdElements = proxyElement.value.$el.querySelectorAll(`.el-table__body-wrapper tr td:nth-child(${index2 + 1})`);
|
|
1028
|
+
tdElements.forEach((td) => {
|
|
1029
|
+
td.style.width = "auto";
|
|
1030
|
+
td.style.minWidth = "80px";
|
|
1031
|
+
td.style.maxWidth = "none";
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
vue.nextTick(() => {
|
|
1036
|
+
var _a;
|
|
1037
|
+
if (availableWidth <= minTotalWidth) {
|
|
1038
|
+
visibleColumns.forEach((col) => {
|
|
1039
|
+
const th = allThElements[col.index];
|
|
1040
|
+
if (th) {
|
|
1041
|
+
th.style.width = `${col.minWidth}px`;
|
|
1042
|
+
th.style.minWidth = `${col.minWidth}px`;
|
|
1043
|
+
th.style.maxWidth = "none";
|
|
1044
|
+
const tdElements = proxyElement.value.$el.querySelectorAll(`.el-table__body-wrapper tr td:nth-child(${col.index + 1})`);
|
|
1045
|
+
tdElements.forEach((td) => {
|
|
1046
|
+
td.style.width = `${col.minWidth}px`;
|
|
1047
|
+
td.style.minWidth = `${col.minWidth}px`;
|
|
1048
|
+
td.style.maxWidth = "none";
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
} else {
|
|
1053
|
+
let totalWeight = 0;
|
|
1054
|
+
visibleColumns.forEach((col) => {
|
|
1055
|
+
const contentLength = Math.max(col.label.length, 5);
|
|
1056
|
+
col.weight = Math.max(contentLength * 10, col.minWidth);
|
|
1057
|
+
totalWeight += col.weight;
|
|
1058
|
+
});
|
|
1059
|
+
let allocatedWidth = 0;
|
|
1060
|
+
visibleColumns.forEach((col, i) => {
|
|
1061
|
+
const th = allThElements[col.index];
|
|
1062
|
+
if (th) {
|
|
1063
|
+
let newWidth;
|
|
1064
|
+
if (i === visibleColumns.length - 1) {
|
|
1065
|
+
newWidth = availableWidth - allocatedWidth;
|
|
1066
|
+
} else {
|
|
1067
|
+
const weightedWidth = col.weight / totalWeight * availableWidth;
|
|
1068
|
+
newWidth = Math.max(weightedWidth, col.minWidth);
|
|
1069
|
+
allocatedWidth += newWidth;
|
|
1070
|
+
}
|
|
1071
|
+
newWidth = Math.max(newWidth, col.minWidth);
|
|
1072
|
+
th.style.width = `${newWidth}px`;
|
|
1073
|
+
th.style.minWidth = `${col.minWidth}px`;
|
|
1074
|
+
th.style.maxWidth = "none";
|
|
1075
|
+
const tdElements = proxyElement.value.$el.querySelectorAll(`.el-table__body-wrapper tr td:nth-child(${col.index + 1})`);
|
|
1076
|
+
tdElements.forEach((td) => {
|
|
1077
|
+
td.style.width = `${newWidth}px`;
|
|
1078
|
+
td.style.minWidth = `${col.minWidth}px`;
|
|
1079
|
+
td.style.maxWidth = "none";
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
if (table) {
|
|
1085
|
+
table.style.width = "100%";
|
|
1086
|
+
const tableInstance = (_a = tableContainer.__vueParentComponent) == null ? void 0 : _a.ctx;
|
|
1087
|
+
if (tableInstance && tableInstance.doLayout) {
|
|
1088
|
+
tableInstance.doLayout();
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
};
|
|
1093
|
+
vue.watch(() => props.columns, (newVal) => {
|
|
1094
|
+
if (newVal && newVal.length > 0) {
|
|
1095
|
+
allColumns.value = [...newVal];
|
|
1096
|
+
checkedColumns.value = allColumns.value.map((col) => col.prop || col.label);
|
|
1097
|
+
if (props.showColumnFilter) {
|
|
1098
|
+
fetchPageColumns();
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
}, { immediate: true, deep: true });
|
|
1102
|
+
vue.watch(() => props.showColumnFilter, (newVal) => {
|
|
1103
|
+
if (newVal && allColumns.value.length > 0) {
|
|
1104
|
+
fetchPageColumns();
|
|
1105
|
+
}
|
|
1106
|
+
}, { immediate: true });
|
|
1107
|
+
const tableHeight = useResizeTable(props);
|
|
1108
|
+
vue.onMounted(() => {
|
|
1109
|
+
if (props.showColumnFilter) {
|
|
1110
|
+
const observer = new MutationObserver((_mutations, obs) => {
|
|
1111
|
+
var _a;
|
|
1112
|
+
const tableHeader = (_a = proxyElement.value.$el) == null ? void 0 : _a.querySelector(".el-table__header-wrapper");
|
|
1113
|
+
if (tableHeader) {
|
|
1114
|
+
obs.disconnect();
|
|
1115
|
+
requestAnimationFrame(() => {
|
|
1116
|
+
setTimeout(() => {
|
|
1117
|
+
initColumns();
|
|
1118
|
+
fetchPageColumns();
|
|
1119
|
+
}, 300);
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
observer.observe(proxyElement.value.$el, {
|
|
1124
|
+
childList: true,
|
|
1125
|
+
subtree: true
|
|
1126
|
+
});
|
|
1127
|
+
setTimeout(() => {
|
|
1128
|
+
var _a;
|
|
1129
|
+
if (!((_a = proxyElement.value.$el) == null ? void 0 : _a.querySelector(".el-table__header-wrapper"))) {
|
|
1130
|
+
observer.disconnect();
|
|
1131
|
+
requestAnimationFrame(() => {
|
|
1132
|
+
initColumns();
|
|
1133
|
+
fetchPageColumns();
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
}, 1e3);
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
753
1139
|
useDataTestId();
|
|
754
1140
|
return (_ctx, _cache) => {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
vue.renderSlot(_ctx.$slots,
|
|
1141
|
+
const _directive_loading = vue.resolveDirective("loading");
|
|
1142
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
1143
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
1144
|
+
vue.createVNode(vue.unref(elementPlus.ElTable), vue.mergeProps(tableAttrs.value, {
|
|
1145
|
+
height: vue.unref(tableHeight),
|
|
1146
|
+
ref_key: "proxyElement",
|
|
1147
|
+
ref: proxyElement
|
|
1148
|
+
}), vue.createSlots({
|
|
1149
|
+
empty: vue.withCtx(() => [
|
|
1150
|
+
vue.renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
1151
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("div", { class: "noDataTips" }, null, -1))
|
|
1152
|
+
])
|
|
1153
|
+
]),
|
|
1154
|
+
_: 2
|
|
1155
|
+
}, [
|
|
1156
|
+
vue.renderList(_ctx.$slots, (_, key) => {
|
|
1157
|
+
return {
|
|
1158
|
+
name: key,
|
|
1159
|
+
fn: vue.withCtx((slotProps) => [
|
|
1160
|
+
vue.renderSlot(_ctx.$slots, key, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
|
|
1161
|
+
])
|
|
1162
|
+
};
|
|
1163
|
+
})
|
|
1164
|
+
]), 1040, ["height"]),
|
|
1165
|
+
__props.showColumnFilter ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1166
|
+
key: 0,
|
|
1167
|
+
class: "filter-icon",
|
|
1168
|
+
onClick: toggleFilterPopover
|
|
1169
|
+
}, [
|
|
1170
|
+
vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
|
|
1171
|
+
default: vue.withCtx(() => [
|
|
1172
|
+
vue.createVNode(vue.unref(operation_default))
|
|
1173
|
+
]),
|
|
1174
|
+
_: 1
|
|
1175
|
+
})
|
|
1176
|
+
])) : vue.createCommentVNode("", true)
|
|
1177
|
+
]),
|
|
1178
|
+
vue.createVNode(vue.unref(elementPlus.ElPopover), {
|
|
1179
|
+
visible: popoverVisible.value,
|
|
1180
|
+
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => popoverVisible.value = $event),
|
|
1181
|
+
placement: "bottom-end",
|
|
1182
|
+
width: 220,
|
|
1183
|
+
trigger: "click",
|
|
1184
|
+
"popper-class": "equipList-table-popover",
|
|
1185
|
+
teleported: true
|
|
1186
|
+
}, {
|
|
1187
|
+
reference: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
1188
|
+
vue.createElementVNode("div", { style: { "display": "none" } }, null, -1)
|
|
1189
|
+
])]),
|
|
1190
|
+
default: vue.withCtx(() => [
|
|
1191
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
1192
|
+
_cache[7] || (_cache[7] = vue.createElementVNode("p", { class: "filter-title" }, "展示列表", -1)),
|
|
1193
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
1194
|
+
vue.createVNode(vue.unref(elementPlus.ElInput), {
|
|
1195
|
+
modelValue: filterKeyword.value,
|
|
1196
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterKeyword.value = $event),
|
|
1197
|
+
placeholder: "搜索列名...",
|
|
1198
|
+
clearable: "",
|
|
1199
|
+
size: "small"
|
|
1200
|
+
}, null, 8, ["modelValue"])
|
|
1201
|
+
]),
|
|
1202
|
+
vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
1203
|
+
vue.createVNode(vue.unref(elementPlus.ElCheckboxGroup), {
|
|
1204
|
+
modelValue: checkedColumns.value,
|
|
1205
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => checkedColumns.value = $event),
|
|
1206
|
+
onChange: handleColumnChange
|
|
1207
|
+
}, {
|
|
1208
|
+
default: vue.withCtx(() => [
|
|
1209
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredColumnsList.value, (column) => {
|
|
1210
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1211
|
+
key: column.prop,
|
|
1212
|
+
class: "checkbox-item"
|
|
1213
|
+
}, [
|
|
1214
|
+
vue.createVNode(vue.unref(elementPlus.ElCheckbox), {
|
|
1215
|
+
label: column.prop
|
|
1216
|
+
}, {
|
|
1217
|
+
default: vue.withCtx(() => [
|
|
1218
|
+
vue.createTextVNode(vue.toDisplayString(column.label), 1)
|
|
1219
|
+
]),
|
|
1220
|
+
_: 2
|
|
1221
|
+
}, 1032, ["label"])
|
|
1222
|
+
]);
|
|
1223
|
+
}), 128))
|
|
1224
|
+
]),
|
|
1225
|
+
_: 1
|
|
1226
|
+
}, 8, ["modelValue"])
|
|
1227
|
+
])), [
|
|
1228
|
+
[_directive_loading, contentLoading.value]
|
|
1229
|
+
]),
|
|
1230
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
1231
|
+
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
1232
|
+
type: "primary",
|
|
1233
|
+
size: "small",
|
|
1234
|
+
onClick: resetColumns,
|
|
1235
|
+
loading: resetLoading.value
|
|
1236
|
+
}, {
|
|
1237
|
+
default: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
1238
|
+
vue.createTextVNode("重置", -1)
|
|
1239
|
+
])]),
|
|
1240
|
+
_: 1
|
|
1241
|
+
}, 8, ["loading"]),
|
|
1242
|
+
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
1243
|
+
type: "primary",
|
|
1244
|
+
size: "small",
|
|
1245
|
+
onClick: saveColumns,
|
|
1246
|
+
loading: loading.value
|
|
1247
|
+
}, {
|
|
1248
|
+
default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
1249
|
+
vue.createTextVNode("确认", -1)
|
|
1250
|
+
])]),
|
|
1251
|
+
_: 1
|
|
1252
|
+
}, 8, ["loading"])
|
|
1253
|
+
])
|
|
765
1254
|
])
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
1255
|
+
]),
|
|
1256
|
+
_: 1
|
|
1257
|
+
}, 8, ["visible"])
|
|
1258
|
+
], 64);
|
|
769
1259
|
};
|
|
770
1260
|
}
|
|
771
1261
|
});
|