优化定时任务、在线用户、生成器

This commit is contained in:
zjl 2024-12-12 13:59:20 +08:00
parent 7d9d2c17b7
commit 53bd8f422c
5 changed files with 98 additions and 26 deletions

View File

@ -16,7 +16,7 @@ export const columns = [
{
title: '任务名称',
key: 'jobName',
width: 150,
width: 200,
},
{
title: '任务分组',

View File

@ -132,20 +132,20 @@
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
jobName: '',
jobAlias: '',
jobGroup: undefined,
jobGroup: '',
jobTrigger: '',
status: undefined,
status: '',
cronExpression: '',
executePolicy: undefined,
executePolicy: '',
isSync: 0,
url: '',
note: '',
@ -166,11 +166,10 @@
default: 0,
},
});
const [modalRegister, { openModal, setSubLoading }] = useModal({
title: props.jobId ? '编辑任务' : '添加任务',
subBtuText: '确定',
width: 600,
});
/**
* 定义数据源
*/
const jobGroupList = [{ label: 'DEFAULT', value: 'DEFAULT' }];
const statusList = [
{ label: '未发布', value: 0 },
@ -183,6 +182,16 @@
{ label: '执行一次', value: 2 },
{ label: '放弃执行', value: 3 },
];
/**
* 定义模态
*/
const [modalRegister, { openModal, setSubLoading }] = useModal({
title: props.jobId ? '编辑任务' : '添加任务',
subBtuText: '确定',
width: 600,
});
/**
* 执行提交
*/
@ -229,7 +238,10 @@
setFormData();
}
});
//
/**
* 定义函数
*/
defineExpose({
openModal,
});

View File

@ -27,7 +27,6 @@
</template>
新建
</n-button>
<n-button
type="error"
@click="handleDelete"
@ -72,13 +71,14 @@
} from '@/api/monitor/job';
import { columns } from './columns';
import { PlusOutlined, DeleteOutlined, FormOutlined, FieldTimeOutlined } from '@vicons/antd';
import CreateModal from './CreateModal.vue';
import editDialog from './edit.vue';
import jobLog from './log/index.vue';
import { basicModal, useModal } from '@/components/Modal';
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -87,14 +87,18 @@
const editLogVisible = ref(false);
const jobId = ref(0);
const rowKeys = ref([]);
const exportLoading = ref(false);
const showModal = ref(false);
/**
* 定义查询参数
*/
const formParams = reactive({
jobName: '',
status: '',
});
/**
* 定义操作栏
*/
const actionColumn = reactive({
width: 350,
title: '操作',
@ -166,24 +170,36 @@
},
});
function addTable() {
showModal.value = true;
}
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res) => {
rowKeys.value = [];
const result = await getJobList({ ...formParams, ...res });
return result;
};
/**
* 数据行选中事件
* @param keys 参数
*/
function onCheckedRow(keys) {
rowKeys.value = keys;
}
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') {
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
}
/**
* 执行提交表单
* @param values 参数
*/
function handleSubmit(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -194,6 +210,10 @@
reloadTable();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -204,6 +224,9 @@
reloadTable();
}
/**
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 110,
@ -219,6 +242,7 @@
await nextTick();
createModalRef.value.openModal();
};
/**
* 执行编辑
*/
@ -228,6 +252,7 @@
await nextTick();
createModalRef.value.openModal();
}
/**
* 执行变更状态
* @param record 参数
@ -244,6 +269,7 @@
},
});
};
/**
* 执行一次
*/
@ -259,6 +285,7 @@
},
});
};
/**
* 执行查看日志
* @param record 参数
@ -269,6 +296,7 @@
editLogVisible.value = true;
jobId.value = record.id;
};
/**
* 执行删除
* @param id 参数

View File

@ -13,8 +13,7 @@
:style="{ minHeight: fwbHeight + 'px' }"
:paginate-single-page="false"
:data="onlineTableData.slice((pager.page - 1) * pager.size, pager.page * pager.size)"
>
</n-data-table>
/>
<pagination
style="justify-content: flex-end"
class="mt-10 flex"
@ -33,6 +32,8 @@
import { useMessage, useDialog } from 'naive-ui';
import { TableAction } from '@/components/Table';
const onlineTableData = ref([]);
const message = useMessage();
const dialog = useDialog();
/**
* 定义查询参数
@ -41,8 +42,10 @@
ipAddr: '',
username: '',
});
const message = useMessage();
const dialog = useDialog();
/**
* 定义操作栏
*/
const columns = [
{
title: '序号',
@ -111,6 +114,7 @@
},
},
];
/**
* 定义分页参数
*/

View File

@ -52,16 +52,21 @@
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
const rowKeys = ref([]);
/**
* 定义查询参数
*/
const formParams = reactive({
tableName: '',
tableComment: '',
});
/**
* 定义操作栏
*/
const actionColumn = reactive({
width: 200,
width: 100,
title: '操作',
align: 'center',
key: 'action',
@ -82,20 +87,36 @@
},
});
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res) => {
rowKeys.value = [];
const result = await getTableList({ ...formParams, ...res });
return result;
};
/**
* 数据行选中事件
* @param keys 参数
*/
function onCheckedRow(keys) {
rowKeys.value = keys;
}
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') {
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
}
/**
* 执行提交表单
* @param values 参数
*/
function handleSubmit(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -106,6 +127,10 @@
reloadTable();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -116,6 +141,9 @@
reloadTable();
}
/**
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 100,