优化分类、布局、标签、通知、多数据源、定时任务

This commit is contained in:
zjl 2024-12-13 10:17:55 +08:00
parent 06f2d71325
commit 030cd1b4d7
12 changed files with 137 additions and 42 deletions

View File

@ -5,6 +5,7 @@ export const columns = [
{
title: '分类名称',
key: 'name',
align: 'left',
width: 200,
},
{
@ -15,7 +16,7 @@ export const columns = [
{
title: '分类备注',
key: 'note',
width: 100,
width: 200,
},
{
title: '创建人',

View File

@ -14,8 +14,12 @@
label-placement="left"
label-width="85px"
>
<n-form-item label="描述" path="description">
<n-input type="textarea" v-model:value="formData.description" placeholder="请输入描述" />
<n-form-item label="位置描述" path="description">
<n-input
type="textarea"
v-model:value="formData.description"
placeholder="请输入位置描述"
/>
</n-form-item>
<n-form-item
label="位置编号"

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const layoutId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -38,19 +38,19 @@
/>
</n-form-item>
<n-form-item
label="推荐文章"
label="推荐内容"
path="typeId"
:rule="{
key: 'typeId',
type: 'number',
required: true,
message: '请选择推荐文章',
message: '请选择推荐内容',
trigger: 'blur',
}"
>
<n-input
v-model:value="formData.typeText"
placeholder="请选择推荐文章"
placeholder="请选择推荐内容"
@click="getLayoutItem"
/>
</n-form-item>

View File

@ -15,12 +15,12 @@ export const columns2 = [
fixed: 'left',
},
{
title: '标题',
title: '通知标题',
key: 'title',
width: 200,
},
{
title: '类型',
title: '通知类型',
key: 'type',
width: 100,
render(record) {
@ -36,7 +36,7 @@ export const columns2 = [
},
},
{
title: '状态',
title: '通知状态',
key: 'status',
render(record) {
return h(

View File

@ -16,7 +16,7 @@ export const columns = [
{
title: '标签名称',
key: 'name',
width: 100,
width: 200,
},
{
title: '排序',

View File

@ -9,17 +9,17 @@ export const columns = [
{
title: '字典名称',
key: 'name',
width: 100,
width: 150,
},
{
title: '字典编码',
key: 'dictCode',
width: 100,
width: 150,
},
{
title: '字典项值',
key: 'value',
width: 100,
width: 150,
},
{
title: '排序',

View File

@ -1,5 +1,6 @@
import { h } from 'vue';
import { NTag } from 'naive-ui';
import { NImage, NTag } from 'naive-ui';
export const columns = [
{
type: 'selection',
@ -13,12 +14,25 @@ export const columns = [
width: 50,
},
{
title: '标题',
title: '通知标题',
key: 'title',
width: 250,
},
{
title: '类型',
title: '通知封面',
key: 'cover',
width: 100,
render(record) {
return h(NImage, {
width: 48,
src: record.cover,
shape: 'square',
fit: 'fill',
});
},
},
{
title: '通知类型',
key: 'type',
width: 100,
render(record) {
@ -34,7 +48,7 @@ export const columns = [
},
},
{
title: '状态',
title: '通知状态',
key: 'status',
width: 100,
render(record) {

View File

@ -74,7 +74,7 @@ export const columns = [
{
title: '备注',
key: 'note',
width: 100,
width: 200,
},
{
title: '创建人',

View File

@ -9,27 +9,38 @@ export const columns = [
{
title: 'ID',
key: 'id',
fixed: 'left',
width: 100,
},
{
title: '任务名称',
key: 'jobName',
width: 200,
},
{
title: '任务组名',
key: 'jobGroup',
width: 100,
},
{
title: '任务触发器',
key: 'jobTrigger',
width: 200,
},
{
title: '任务信息',
title: '任务日志信息',
key: 'jobMessage',
width: 300,
},
{
title: '执行表达式',
key: 'cronExpression',
width: 150,
},
{
title: '执行状态',
key: 'status',
width: 100,
render(record) {
let typeText = '';
switch (record.status) {
@ -52,7 +63,23 @@ export const columns = [
},
},
{
title: '执行时间',
title: '任务开始时间',
key: 'startTime',
width: 180,
},
{
title: '任务结束时间',
key: 'endTime',
width: 180,
},
{
title: '任务执行时间',
key: 'createTime',
width: 180,
},
{
title: '任务执行耗时',
key: 'consumeTime',
width: 120,
},
];

View File

@ -1,16 +1,28 @@
<template>
<basicModal @register="modalRegister" ref="modalRef" class="basicModal basicFormModal">
<template #default>
<n-descriptions :column="2" bordered label-placement="left" :labelStyle="{ width: '130px' }">
<n-descriptions :column="2" bordered label-placement="left" :labelStyle="{ width: '150px' }">
<n-descriptions-item label="任务名称:">{{ formData.jobName }}</n-descriptions-item>
<n-descriptions-item label="任务组名:">{{ formData.jobGroup }}</n-descriptions-item>
<n-descriptions-item label="任务触发器:">{{ formData.jobTrigger }}</n-descriptions-item>
<n-descriptions-item label="任务信息:">{{ formData.jobMessage }}</n-descriptions-item>
<n-descriptions-item label="cron执行表达式:">{{
<n-descriptions-item label="任务日志信息:">{{ formData.jobMessage }}</n-descriptions-item>
<n-descriptions-item label="任务执行表达式:">{{
formData.cronExpression
}}</n-descriptions-item>
<n-descriptions-item label="任务请求状态">
<n-tag :type="formData.status ? 'danger' : 'success'">{{
formData.status ? '异常' : '正常'
}}</n-tag>
</n-descriptions-item>
<n-descriptions-item label="任务开始时间:">{{ formData.startTime }}</n-descriptions-item>
<n-descriptions-item label="任务结束时间:">{{ formData.endTime }}</n-descriptions-item>
<n-descriptions-item label="任务执行时间:">{{ formData.createTime }}</n-descriptions-item>
<n-descriptions-item label="任务执行耗时:"
>{{ formData.consumeTime }}ms</n-descriptions-item
>
<n-descriptions-item label="执行异常信息:" :span="3">{{
formData.exceptionInfo
}}</n-descriptions-item>
</n-descriptions>
</template>
<template #action>
@ -32,14 +44,21 @@
jobGroup: '',
jobTrigger: '',
jobMessage: '',
status: '',
cronExpression: '',
startTime: '',
endTime: '',
createTime: '',
consumeTime: '',
exceptionInfo: '',
});
/**
* 定义模态
*/
const [modalRegister, { openModal, setSubLoading }] = useModal({
title: '日志详情',
width: 800,
width: 850,
});
const emit = defineEmits(['update:visible']);
@ -87,7 +106,10 @@
setFormData();
}
});
//
/**
* 定义函数
*/
defineExpose({
openModal,
});

View File

@ -58,12 +58,13 @@
import { getJobLogList, jobLogDelete, jobLogBatchDelete } from '@/api/monitor/job';
import { columns } from './columns';
import { PlusOutlined, DeleteOutlined, EyeOutlined } from '@vicons/antd';
import CreateModal from './CreateModal.vue';
import editDialog from './edit.vue';
import { basicModal, useModal } from '@/components/Modal';
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -72,14 +73,16 @@
const logId = ref(0);
const size = document.body.clientWidth - 500;
const rowKeys = ref([]);
const exportLoading = ref(false);
const showModal = ref(false);
const formParams = reactive({
name: '',
dbType: '',
});
const emit = defineEmits(['update:visible']);
/**
* 定义查询参数
*/
const formParams = reactive({
jobName: '',
status: '',
});
/**
* 定义接收的参数
*/
@ -95,6 +98,10 @@
default: 0,
},
});
/**
* 定义操作栏
*/
const actionColumn = reactive({
width: 200,
title: '操作',
@ -109,7 +116,7 @@
label: '详情',
icon: renderIcon(EyeOutlined),
type: 'info',
onClick: handleEdit.bind(null, record),
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
@ -122,24 +129,36 @@
},
});
function addTable() {
showModal.value = true;
}
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res) => {
rowKeys.value = [];
const result = await getJobLogList({ ...formParams, jobId: props.jobId, ...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] = '';
@ -150,6 +169,10 @@
reloadTable();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -160,6 +183,9 @@
reloadTable();
}
/**
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 110,
@ -168,15 +194,17 @@
const handleClose = () => {
emit('update:visible', false);
};
/**
* 执行编辑
* 执行查看详情
*/
async function handleEdit(record: Recordable) {
async function handleDetail(record: Recordable) {
logId.value = record.id;
editVisible.value = true;
await nextTick();
createModalRef.value.openModal();
}
/**
* 执行删除
* @param id 参数