feat: 自定义表格

This commit is contained in:
wf 2024-06-03 12:55:19 +08:00
parent 73e8c1e1fe
commit 5765b67c2b

View File

@ -157,7 +157,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { deepClone } from "@/utils"; import { deepClone } from "@/utils";
// import Sortable from "sortablejs"; import Sortable from "sortablejs";
const formData = reactive({ const formData = reactive({
form: { form: {
serial: "", serial: "",
@ -229,6 +229,8 @@ const columns = ref([
checked: true checked: true
} }
]); ]);
// columns
//
const deepColumns = () => { const deepColumns = () => {
columnsShow.value = deepClone(columns.value); columnsShow.value = deepClone(columns.value);
}; };
@ -370,20 +372,34 @@ const onCheckbox = (checked: any, row: any, index: any) => {
}; };
// //
const popupVisibleChange = (visible: boolean) => { const popupVisibleChange = (visible: boolean) => {
console.log("文字气泡窗打开?", visible); if (visible) {
// if (visible) { nextTick(() => {
// nextTick(() => { // dom
// const el = document.getElementById("tableSetting") as HTMLElement; const el = document.getElementById("tableSetting") as HTMLElement;
// new Sortable(el, { new Sortable(el, {
// onEnd(e: any) { onEnd(e: any) {
// const { oldIndex, newIndex } = e; //
// console.log("", oldIndex, newIndex); const { oldIndex, newIndex } = e;
// // exchangeArray(cloneColumns.value, oldIndex, newIndex); console.log("移动",columns.value, columnsShow.value);
// // exchangeArray(showColumns.value, oldIndex, newIndex); // columnscolumns
// } exchangeArray(columns.value, oldIndex, newIndex);
// }); exchangeArray(columnsShow.value, oldIndex, newIndex);
// }); }
// } });
});
}
};
//
const exchangeArray = (columns: Array<any>, oldIndex: number, newIndex: number) => {
//
let temp = columns[newIndex];
// newIndexoldIndex
columns[newIndex] = columns[oldIndex];
// newIndex
columns[oldIndex] = temp;
}; };
</script> </script>