20260729173317
This commit is contained in:
1 parent
f6b79ea09a
commit
1c839b707a
26 files changed
+1902
-29
No files matched your search
@@ -1,7 +1,93 @@
|
||||
<script setup>
|
||||
import { computed, ref } from "vue";
|
||||
import { message, Modal } from "antdv-next";
|
||||
import { Trash2 } from "@lucide/vue";
|
||||
import FmsModuleListPage from "@/components/fms-module-list/FmsModuleListPage.vue";
|
||||
import { saveObjectApi } from "@/services/api";
|
||||
import { useAppStore } from "@/stores/app";
|
||||
|
||||
const appStore = useAppStore();
|
||||
const listRef = ref(null);
|
||||
const selectedRowKeys = ref([]);
|
||||
const saving = ref(false);
|
||||
|
||||
const rowSelection = computed(() => {
|
||||
return {
|
||||
selectedRowKeys: selectedRowKeys.value,
|
||||
onChange: (keys) => {
|
||||
selectedRowKeys.value = keys;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
async function reloadList() {
|
||||
selectedRowKeys.value = [];
|
||||
if (listRef.value) await listRef.value.reload();
|
||||
}
|
||||
|
||||
function batchDelete() {
|
||||
if (saving.value || !selectedRowKeys.value.length) return;
|
||||
const keys = [...selectedRowKeys.value];
|
||||
Modal.confirm({
|
||||
title: `${appStore.t("common.confirmBatchDelete", "确定删除选中的记录?")} (${keys.length})`,
|
||||
okText: appStore.t("common.delete", "删除"),
|
||||
okType: "danger",
|
||||
cancelText: appStore.t("common.cancel", "取消"),
|
||||
onOk: async () => {
|
||||
saving.value = true;
|
||||
try {
|
||||
const deletes = keys.map((b_id) => ({ b_id }));
|
||||
await saveObjectApi([
|
||||
{
|
||||
table: "s_log_login",
|
||||
key_field: "b_id",
|
||||
inserts: [],
|
||||
updates: [],
|
||||
deletes,
|
||||
},
|
||||
]);
|
||||
message.success(appStore.t("common.deleteSuccess", "删除成功"));
|
||||
await reloadList();
|
||||
} catch (error) {
|
||||
message.error(
|
||||
appStore.t("common.deleteFailed", "删除失败") + ":" + (error?.message || error),
|
||||
);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FmsModuleListPage />
|
||||
<div class="login-log-page">
|
||||
<FmsModuleListPage
|
||||
ref="listRef"
|
||||
:row-selection="rowSelection"
|
||||
@loaded="selectedRowKeys = []"
|
||||
>
|
||||
<template #actions="{ loading }">
|
||||
<a-space>
|
||||
<a-button
|
||||
danger
|
||||
:disabled="loading || saving || !selectedRowKeys.length"
|
||||
@click="batchDelete"
|
||||
>
|
||||
<Trash2 :size="16" />
|
||||
{{ appStore.t("common.batchDelete", "批量删除")
|
||||
}}{{ selectedRowKeys.length ? `(${selectedRowKeys.length})` : "" }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</FmsModuleListPage>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.login-log-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user