签入版本
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import { http } from '@/utils/http/axios';
|
||||
|
||||
/**
|
||||
* @description: 列表
|
||||
*/
|
||||
export function getDataSourceList(params?) {
|
||||
return http.request({
|
||||
url: '/data/source/page',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据ID获取详情
|
||||
*/
|
||||
export function getDataSourceDetail(id) {
|
||||
return http.request({
|
||||
url: '/data/source/detail/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 添加
|
||||
*/
|
||||
export function dataSourceAdd(data: any) {
|
||||
return http.request({
|
||||
url: '/data/source/add',
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新
|
||||
*/
|
||||
export function dataSourceUpdate(data: any) {
|
||||
return http.request({
|
||||
url: '/data/source/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除
|
||||
*/
|
||||
export function dataSourceDelete(id) {
|
||||
return http.request({
|
||||
url: '/data/source/delete/' + id,
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 批量删除
|
||||
*/
|
||||
export function dataSourceBatchDelete(data: any) {
|
||||
return http.request({
|
||||
url: '/data/source/batchDelete',
|
||||
method: 'DELETE',
|
||||
data,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { h } from 'vue';
|
||||
import { ElTag } from 'element-plus';
|
||||
|
||||
export const columns = [
|
||||
{
|
||||
type: 'selection',
|
||||
},
|
||||
{
|
||||
label: 'ID',
|
||||
prop: 'id',
|
||||
fixed: 'left',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
label: '任务名称',
|
||||
prop: 'jobName',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
label: '任务组名',
|
||||
prop: 'jobGroup',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
label: '任务触发器',
|
||||
prop: 'jobTrigger',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
label: '任务日志信息',
|
||||
prop: 'jobMessage',
|
||||
minWidth: 300,
|
||||
},
|
||||
{
|
||||
label: '执行表达式',
|
||||
prop: 'cronExpression',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
label: '执行状态',
|
||||
prop: 'status',
|
||||
minWidth: 100,
|
||||
render(record) {
|
||||
let typeText = '';
|
||||
switch (record.row.status) {
|
||||
case 0:
|
||||
typeText = '未发布';
|
||||
break;
|
||||
case 1:
|
||||
typeText = '运行中';
|
||||
break;
|
||||
case 2:
|
||||
typeText = '暂停';
|
||||
break;
|
||||
case 3:
|
||||
typeText = '删除';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return h('span', typeText || '-');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '任务开始时间',
|
||||
prop: 'startTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
label: '任务结束时间',
|
||||
prop: 'endTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
label: '任务执行时间',
|
||||
prop: 'createTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
label: '任务执行耗时',
|
||||
prop: 'consumeTime',
|
||||
minWidth: 120,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="props.visible"
|
||||
title="日志详情"
|
||||
width="750"
|
||||
:close-on-click-modal="false"
|
||||
:before-close="dialogClose"
|
||||
>
|
||||
<el-descriptions class="margin-top" :column="2" border>
|
||||
<el-descriptions-item label="任务名称" label-class-name="des-width">
|
||||
{{ formData.jobName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务组名" label-class-name="des-width">
|
||||
{{ formData.jobGroup }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务触发器">
|
||||
{{ formData.jobTrigger }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务日志信息">
|
||||
{{ formData.jobMessage }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行表达式">
|
||||
{{ formData.cronExpression }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行状态">
|
||||
<el-tag :type="formData.status ? 'danger' : 'success'">{{
|
||||
formData.status ? '异常' : '正常'
|
||||
}}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务开始时间">
|
||||
{{ formData.startTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务结束时间">
|
||||
{{ formData.endTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务执行时间">
|
||||
{{ formData.createTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行耗时"> {{ formData.consumeTime }}ms </el-descriptions-item>
|
||||
<el-descriptions-item label="执行异常信息" :span="3">
|
||||
{{ formData.exceptionInfo }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogClose">取消</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getJobLogDetail } from '@/api/monitor/job';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = ref({
|
||||
id: '',
|
||||
jobName: '',
|
||||
jobGroup: '',
|
||||
jobTrigger: '',
|
||||
jobMessage: '',
|
||||
status: '',
|
||||
cronExpression: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
createTime: '',
|
||||
consumeTime: '',
|
||||
exceptionInfo: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
logId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getJobLogDetail(props.logId);
|
||||
formData.value = data;
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (props.logId) {
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.des-width) {
|
||||
width: 120px;
|
||||
}
|
||||
:deep(.el-descriptions__body .el-descriptions__table .el-descriptions__cell) {
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="props.visible"
|
||||
title="日志详情"
|
||||
width="750"
|
||||
:close-on-click-modal="false"
|
||||
:before-close="dialogClose"
|
||||
>
|
||||
<el-descriptions column="2">
|
||||
<el-descriptions-item label="任务名称:">{{ formData.jobName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务组名:">{{ formData.jobGroup }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务触发器:">{{ formData.jobTrigger }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务信息:">{{ formData.jobMessage }}</el-descriptions-item>
|
||||
<el-descriptions-item label="cron执行表达式:">{{
|
||||
formData.cronExpression
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务开始时间:">{{ formData.startTime }}</el-descriptions-item>
|
||||
<el-descriptions-item label="任务结束时间:">{{ formData.endTime }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogClose">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getJobLogDetail } from '@/api/monitor/job';
|
||||
import { onMounted, reactive, shallowRef } from 'vue';
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
jobName: '',
|
||||
jobGroup: '',
|
||||
jobTrigger: '',
|
||||
jobMessage: '',
|
||||
cronExpression: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:visible']);
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
logId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
const setFormData = async () => {
|
||||
const data = await getJobLogDetail(props.logId);
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
const getReviceType = (type) => {
|
||||
let typeText = '';
|
||||
switch (type) {
|
||||
case 1:
|
||||
typeText = '系统用户';
|
||||
break;
|
||||
case 2:
|
||||
typeText = '会员用户';
|
||||
break;
|
||||
case 3:
|
||||
typeText = '其他';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return typeText;
|
||||
};
|
||||
const getTyepText = (type) => {
|
||||
let typeText = '';
|
||||
switch (type) {
|
||||
case 1:
|
||||
typeText = '登录';
|
||||
break;
|
||||
case 2:
|
||||
typeText = '注册';
|
||||
break;
|
||||
case 3:
|
||||
typeText = '找回密码';
|
||||
break;
|
||||
case 4:
|
||||
typeText = '业务';
|
||||
break;
|
||||
case 5:
|
||||
typeText = '其他';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return typeText;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (props.logId) {
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,215 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="props.visible"
|
||||
title="调度日志"
|
||||
direction="rtl"
|
||||
:size="size"
|
||||
:close-on-click-modal="false"
|
||||
:before-close="dialogClose"
|
||||
>
|
||||
<el-card :bordered="false" class="pt-3 mb-3 proCard">
|
||||
<BasicForm @register="register" @submit="handleSubmit" @reset="handleReset" />
|
||||
</el-card>
|
||||
<el-card :bordered="false" class="proCard">
|
||||
<BasicTable
|
||||
:columns="columns"
|
||||
:request="loadDataTable"
|
||||
:row-key="(row) => row.id"
|
||||
ref="tableRef"
|
||||
:actionColumn="actionColumn"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<template #tableTitle>
|
||||
<el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length">
|
||||
<template #icon>
|
||||
<el-icon class="el-input__icon">
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</template>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</el-card>
|
||||
<editDialog v-if="editVisible" :logId="logId" v-model:visible="editVisible" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, h, nextTick, defineAsyncComponent } from 'vue';
|
||||
import { ColProps } from 'element-plus';
|
||||
import { schemas } from './querySchemas';
|
||||
import { useForm } from '@/components/Form/index';
|
||||
import { TableAction } from '@/components/Table';
|
||||
import { getJobLogList, jobLogDelete, jobLogBatchDelete } from '@/api/monitor/job';
|
||||
import { columns } from './columns';
|
||||
import { message, confirm } from '@/utils/auth';
|
||||
|
||||
/**
|
||||
* 导入组件
|
||||
*/
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
const emit = defineEmits(['update:visible']);
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
jobId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义参数变量
|
||||
*/
|
||||
const editVisible = ref(false);
|
||||
const logId = ref(0);
|
||||
const size = document.body.clientWidth - 500;
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
jobName: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
label: '操作',
|
||||
prop: 'action',
|
||||
fixed: 'right',
|
||||
render(record) {
|
||||
return h(TableAction, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '详情',
|
||||
icon: 'View',
|
||||
type: 'warning',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
ifShow: () => {
|
||||
return true;
|
||||
},
|
||||
// auth: ['sys:smsLog:detail'],
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
icon: 'Delete',
|
||||
type: 'danger',
|
||||
onClick: handleDelete.bind(null, record),
|
||||
// 根据业务控制是否显示 isShow 和 auth 是并且关系
|
||||
ifShow: () => {
|
||||
return true;
|
||||
},
|
||||
// 根据权限控制是否显示: 有权限,会显示,支持多个
|
||||
// auth: ['basic_list'],
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
*加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getJobLogList({ ...formParams, jobId: props.jobId, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 100,
|
||||
layout: 'horizontal',
|
||||
colProps: { span: 6 } as ColProps,
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
formParams[key] = values[key];
|
||||
}
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行查询详情
|
||||
*/
|
||||
const handleDetail = async (record: Recordable) => {
|
||||
logId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
ids = selectionData.value.map(({ id }) => id);
|
||||
}
|
||||
await confirm('确定要删除?');
|
||||
record ? await jobLogDelete(record.row.id) : await jobLogBatchDelete(ids);
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,30 @@
|
||||
import { FormSchema } from '@/components/Form/index';
|
||||
export const schemas: FormSchema[] = [
|
||||
{
|
||||
field: 'jobName',
|
||||
component: 'Input',
|
||||
label: '任务名称',
|
||||
componentProps: {
|
||||
placeholder: '请输入任务名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
component: 'Select',
|
||||
label: '任务状态',
|
||||
componentProps: {
|
||||
placeholder: '请选择任务状态',
|
||||
clearable: true,
|
||||
options: [
|
||||
{
|
||||
label: '正常',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '失败',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user