🔨 添加执行用户条件.

This commit is contained in:
lijiahang
2024-12-26 14:03:47 +08:00
parent 5ee18436b8
commit 8f1e976c2f
7 changed files with 40 additions and 12 deletions

View File

@@ -56,6 +56,9 @@ public class ExecJobQueryRequest extends PageRequest {
@Schema(description = "任务状态")
private Integer status;
@Schema(description = "执行用户id")
private Long execUserId;
@Schema(description = "是否查询最近执行任务")
private Boolean queryRecentLog;

View File

@@ -408,6 +408,7 @@ public class ExecJobServiceImpl implements ExecJobService {
.like(ExecJobDO::getName, request.getName())
.like(ExecJobDO::getCommand, request.getCommand())
.eq(ExecJobDO::getStatus, request.getStatus())
.eq(ExecJobDO::getExecUserId, request.getExecUserId())
.orderByDesc(ExecJobDO::getId);
}

View File

@@ -48,6 +48,7 @@ export interface ExecJobQueryRequest extends Pagination {
name?: string;
command?: string;
status?: number;
execUserId?: number;
queryRecentLog?: boolean;
}

View File

@@ -3,7 +3,7 @@
<a-card class="general-card table-search-card">
<query-header :model="formModel"
label-align="left"
:itemOptions="{ 4: { span: 2 } }"
:itemOptions="{ 5: { span: 2 } }"
@submit="fetchTableData"
@reset="fetchTableData"
@keyup.enter="() => fetchTableData()">
@@ -33,6 +33,12 @@
allow-clear
hide-button />
</a-form-item>
<!-- 执行用户 -->
<a-form-item field="userId" label="执行用户">
<user-selector v-model="formModel.userId"
placeholder="请选择执行用户"
allow-clear />
</a-form-item>
<!-- 执行时间 -->
<a-form-item field="startTimeRange" label="执行时间">
<a-range-picker v-model="formModel.startTimeRange"
@@ -219,7 +225,8 @@
deleteExecJobLog,
getExecJobHostLogList,
getExecJobLogPage,
getExecJobLogStatus
getExecJobLogStatus,
interruptExecJob,
} from '@/api/exec/exec-job-log';
import { Message } from '@arco-design/web-vue';
import useLoading from '@/hooks/loading';
@@ -228,8 +235,8 @@
import { useExpandable, useTablePagination, useRowSelection } from '@/hooks/table';
import { useDictStore } from '@/store';
import { dateFormat, formatDuration } from '@/utils';
import { interruptExecJob } from '@/api/exec/exec-job-log';
import ExecJobHostLogTable from './exec-job-host-log-table.vue';
import UserSelector from '@/components/user/user/selector/index.vue';
const emits = defineEmits(['viewCommand', 'viewParams', 'viewLog', 'openClear']);
@@ -241,13 +248,14 @@
const pullIntervalId = ref();
const tableRef = ref();
const selectedKeys = ref<number[]>([]);
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
const selectedKeys = ref<Array<number>>([]);
const tableRenderData = ref<Array<ExecLogQueryResponse>>([]);
const formModel = reactive<ExecLogQueryRequest>({
id: undefined,
description: undefined,
command: undefined,
status: undefined,
userId: undefined,
startTimeRange: undefined,
});

View File

@@ -20,7 +20,6 @@ const columns = [
dataIndex: 'command',
slotName: 'command',
align: 'left',
ellipsis: true,
minWidth: 238,
}, {
title: '执行用户',

View File

@@ -32,6 +32,12 @@
placeholder="请选择状态"
allow-clear />
</a-form-item>
<!-- 执行用户 -->
<a-form-item field="execUserId" label="执行用户">
<user-selector v-model="formModel.execUserId"
placeholder="请选择执行用户"
allow-clear />
</a-form-item>
</query-header>
</a-card>
<!-- 表格 -->
@@ -209,26 +215,30 @@
import columns from '../types/table.columns';
import { ExecJobStatus, execJobStatusKey, execStatusKey } from '../types/const';
import { useTablePagination, useRowSelection } from '@/hooks/table';
import { useDictStore } from '@/store';
import { useDictStore, useUserStore } from '@/store';
import { useRoute } from 'vue-router';
import { copy } from '@/hooks/copy';
import { dateFormat } from '@/utils';
import UserSelector from '@/components/user/user/selector/index.vue';
const emits = defineEmits(['openAdd', 'openUpdate', 'openDetail', 'updateExecUser', 'testCron']);
const route = useRoute();
const pagination = useTablePagination();
const rowSelection = useRowSelection();
const { loading, setLoading } = useLoading();
const { hasPermission } = usePermission();
const { toOptions, getDictValue } = useDictStore();
const selectedKeys = ref<number[]>([]);
const tableRenderData = ref<ExecJobQueryResponse[]>([]);
const selectedKeys = ref<Array<number>>([]);
const tableRenderData = ref<Array<ExecJobQueryResponse>>([]);
const formModel = reactive<ExecJobQueryRequest>({
id: undefined,
name: undefined,
command: undefined,
status: undefined,
queryRecentLog: true
execUserId: undefined,
queryRecentLog: true,
});
// 删除当前行
@@ -317,6 +327,12 @@
};
onMounted(() => {
// 当前用户
const action = route.query.action as string;
if (action === 'self') {
formModel.execUserId = useUserStore().id;
}
// 查询
fetchTableData();
});

View File

@@ -13,8 +13,8 @@
@updated="() => table.reload()"
@open-host="(e) => hostModal.open(e)"
@open-template="() => templateModal.open()"
@test-cron="openNextCron"
@gen-cron="(e) => genModal.open(e)" />
@gen-cron="(e) => genModal.open(e)"
@test-cron="openNextCron" />
<!-- 任务详情模态框 -->
<exec-job-detail-drawer ref="detail" />
<!-- 修改执行用户模态框 -->