|
|
|
@ -43,6 +43,23 @@ interface RowData {
|
|
|
|
|
updatetime: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const sortData = (row) => {
|
|
|
|
|
console.log("sortData", row);
|
|
|
|
|
if (row.order == "descend") {
|
|
|
|
|
tableData.value.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
new Date(a[row.columnKey]).getTime() - new Date(b[row.columnKey]).getTime()
|
|
|
|
|
);
|
|
|
|
|
} else if (row.order == "ascend") {
|
|
|
|
|
tableData.value.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
new Date(b[row.columnKey]).getTime() - new Date(a[row.columnKey]).getTime()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
tableData.value.sort((a, b) => Number((a as any).reorder) - Number((b as any).reorder));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns: DataTableColumns<RowData> = [
|
|
|
|
|
{
|
|
|
|
|
type: "selection",
|
|
|
|
@ -73,6 +90,12 @@ const columns: DataTableColumns<RowData> = [
|
|
|
|
|
title: "创建时间",
|
|
|
|
|
key: "createtime",
|
|
|
|
|
width: 180,
|
|
|
|
|
sorter: (row1, row2) => {
|
|
|
|
|
// tableData.value.sort(
|
|
|
|
|
// (a, b) => new Date(a?.createtime).getTime() - new Date(b?.createtime).getTime()
|
|
|
|
|
// );
|
|
|
|
|
return new Date(row1?.createtime).getTime() - new Date(row2?.createtime).getTime();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "更新者",
|
|
|
|
@ -177,7 +200,7 @@ function editSelection(id) {
|
|
|
|
|
// closeModal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteSelection(id = '') {
|
|
|
|
|
function deleteSelection(id = "") {
|
|
|
|
|
// eslint-disable-next-line dot-notation
|
|
|
|
|
if (selectionIds.value.length === 0) {
|
|
|
|
|
deleteCondition({ ids: id }).then(() => {
|
|
|
|
@ -272,7 +295,6 @@ defineExpose({
|
|
|
|
|
showModal,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const inputHandler = debounce((word) => {
|
|
|
|
|
keyword.value = word;
|
|
|
|
|
query(1, 5);
|
|
|
|
@ -340,7 +362,7 @@ const inputHandler = debounce((word) => {
|
|
|
|
|
@update:page="handlePageChange"
|
|
|
|
|
@update-page-size="handlePageSizeChange"
|
|
|
|
|
@update:checked-row-keys="handleCheck"
|
|
|
|
|
|
|
|
|
|
@update:sorter="sortData"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -418,4 +440,7 @@ const inputHandler = debounce((word) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
::v-deep(.n-data-table .n-data-table-th){
|
|
|
|
|
font-weight: bold !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|