style: 系统配置数值改为左右加减,用户操作收进设置菜单
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { NAlert, NButton, NModal, useDialog } from "naive-ui";
|
||||
import { NAlert, NButton, NDropdown, NIcon, NModal, useDialog, type DropdownOption } from "naive-ui";
|
||||
import { SettingsOutline } from "@vicons/ionicons5";
|
||||
|
||||
interface UserRow {
|
||||
employee_id: string;
|
||||
@@ -287,6 +288,23 @@ function confirmDelete(row: UserRow) {
|
||||
});
|
||||
}
|
||||
|
||||
function rowActions(row: UserRow): DropdownOption[] {
|
||||
const busy = checkingAll.value || checkingId.value !== "";
|
||||
return [
|
||||
{ label: "检查", key: "check", disabled: busy },
|
||||
{ label: "查看凭据", key: "credentials" },
|
||||
{ label: row.refresh_paused ? "恢复自动刷新" : "停止自动刷新", key: "refresh" },
|
||||
{ label: "删除", key: "delete", props: { style: { color: "var(--danger)" } } },
|
||||
];
|
||||
}
|
||||
|
||||
function onRowAction(row: UserRow, key: string | number) {
|
||||
if (key === "check") void checkOne(row);
|
||||
else if (key === "credentials") void openCredentials(row);
|
||||
else if (key === "refresh") confirmRefresh(row);
|
||||
else if (key === "delete") confirmDelete(row);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
@@ -320,12 +338,11 @@ onMounted(() => {
|
||||
<td class="when">{{ formatRefreshTime(row.last_refresh_at) }}</td>
|
||||
<td>{{ row.refresh_paused ? "已停止" : "开启" }}</td>
|
||||
<td>
|
||||
<div class="row-actions">
|
||||
<n-button size="small" :loading="checkingId === row.employee_id" :disabled="checkingAll || checkingId !== ''" @click="checkOne(row)">检查</n-button>
|
||||
<n-button size="small" @click="openCredentials(row)">查看凭据</n-button>
|
||||
<n-button size="small" @click="confirmRefresh(row)">{{ row.refresh_paused ? "恢复自动刷新" : "停止自动刷新" }}</n-button>
|
||||
<n-button size="small" type="error" quaternary @click="confirmDelete(row)">删除</n-button>
|
||||
</div>
|
||||
<n-dropdown trigger="click" placement="bottom-end" :options="rowActions(row)" @select="(key) => onRowAction(row, key)">
|
||||
<n-button size="small" quaternary circle :aria-label="`工号 ${row.employee_id} 的操作`">
|
||||
<template #icon><n-icon><SettingsOutline /></n-icon></template>
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user