😎新增删除半年前定时任务日志按钮
This commit is contained in:
parent
10ac4fb99f
commit
f707e57880
@ -25,4 +25,5 @@ public class PageTaskLogInput : BasePageInput
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
public string TaskName { get; set; }
|
||||
public bool presenceLog { get; set; }
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using Admin.NET.Core;
|
||||
using Admin.NET.Core;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -43,7 +37,8 @@ public class ScheduledTaskLogService : IDynamicApiController, ITransient
|
||||
return await _scheduledTaskLogRep.AsQueryable()
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()), u => u.LogDateTime >= input.StartTime)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.LogDateTime <= input.EndTime)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.TaskName), u => u.TaskName == input.TaskName)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.TaskName), u => u.TaskName.Contains(input.TaskName))
|
||||
.WhereIF(input.presenceLog, u => u.ReturnResult != "未查询到符合条件的记录")
|
||||
.ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
|
||||
@ -56,8 +51,32 @@ public class ScheduledTaskLogService : IDynamicApiController, ITransient
|
||||
public async Task<string> GetDetail(long id)
|
||||
{
|
||||
var data= await _scheduledTaskLogRep.AsQueryable().Where(x => x.Id == id).FirstAsync();
|
||||
|
||||
return data.ReturnResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除半年前定时任务日志 🔖
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SuppressMonitor]
|
||||
[DisplayName("删除半年前定时任务日志")]
|
||||
[HttpGet]
|
||||
public async Task<string> DeleteHalfaYearTaskLog()
|
||||
{
|
||||
// 计算半年前的日期
|
||||
var halfYearAgo = DateTime.Now.AddMonths(-6);
|
||||
|
||||
// 执行删除操作并获取影响行数
|
||||
var deletedCount = await _scheduledTaskLogRep.AsDeleteable()
|
||||
.Where(x => x.LogDateTime < halfYearAgo)
|
||||
.ExecuteCommandAsync();
|
||||
if (deletedCount > 0)
|
||||
{
|
||||
return $"成功删除{deletedCount}条半年前定时任务日志";
|
||||
}
|
||||
else {
|
||||
return "未查询到半年前定时任务日志";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import request from '/@/utils/request';
|
||||
enum Api {
|
||||
PageScheduledTaskLog = '/api/scheduledTaskLog/page',
|
||||
Detail = '/api/scheduledTaskLog/detail',
|
||||
HalfaYearTaskLog = '/api/scheduledTaskLog/halfaYearTaskLog',
|
||||
}
|
||||
|
||||
export const PageScheduledTaskLog = (params?: any) =>
|
||||
@ -10,9 +11,15 @@ export const PageScheduledTaskLog = (params?: any) =>
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
export const Detail = (id?: any) =>
|
||||
export const Detail = (id?: any) =>
|
||||
request({
|
||||
url: Api.Detail+"/"+id,
|
||||
url: Api.Detail + "/" + id,
|
||||
method: 'Get',
|
||||
data: id,
|
||||
});
|
||||
export const HalfaYearTaskLog = (id?: any) =>
|
||||
request({
|
||||
url: Api.HalfaYearTaskLog,
|
||||
method: 'Get',
|
||||
data:id
|
||||
});
|
@ -22,6 +22,11 @@
|
||||
<el-input v-model="state.queryParams.taskName" placeholder="任务名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||
<el-form-item label="过滤空日志">
|
||||
<el-switch v-model="presenceLog" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
@ -49,14 +54,20 @@
|
||||
</template>
|
||||
<el-tabs v-model="state.activeTab">
|
||||
<el-scrollbar height="calc(100vh - 250px)">
|
||||
<vue-json-pretty :data="state.detail.returnResult" showLength showIcon showLineNumber showSelectController />
|
||||
<vue-json-pretty :data="state.detail.returnResult" showLength showIcon showLineNumber
|
||||
showSelectController />
|
||||
</el-scrollbar>
|
||||
</el-tabs>
|
||||
</el-dialog>
|
||||
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
||||
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" v-on="gridEvents">
|
||||
<template #toolbar_buttons>
|
||||
<el-button icon="ele-DeleteFilled" type="danger" @click="handleClear" v-auth="'sysLogOp/clear'">
|
||||
清空半年前日志 </el-button>
|
||||
</template>
|
||||
<template #toolbar_tools> </template>
|
||||
|
||||
<template #empty>
|
||||
<el-empty :image-size="200" />
|
||||
</template>
|
||||
@ -71,18 +82,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="scheduledTaskLog">
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
|
||||
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
||||
import { Local } from '/@/utils/storage';
|
||||
import { useDateTimeShortCust } from '/@/hooks/dateTimeShortCust';
|
||||
import { PageScheduledTaskLog, Detail } from '/@/api/log/scheduledTaskLog';
|
||||
import { PageScheduledTaskLog, Detail, HalfaYearTaskLog } from '/@/api/log/scheduledTaskLog';
|
||||
import { StringToObj } from '/@/utils/json-utils';
|
||||
import VueJsonPretty from 'vue-json-pretty';
|
||||
import 'vue-json-pretty/lib/styles.css';
|
||||
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
|
||||
const presenceLog = ref(true)
|
||||
// 本地存储参数
|
||||
const localPageParamKey = 'localPageParam:productDesignLibrary';
|
||||
|
||||
@ -106,7 +118,8 @@ const state = reactive({
|
||||
queryParams: {
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
taskName: undefined
|
||||
taskName: undefined,
|
||||
presenceLog: presenceLog
|
||||
},
|
||||
localPageParam: {
|
||||
pageSize: 50 as number,
|
||||
@ -127,6 +140,16 @@ const resetQuery = async () => {
|
||||
await xGrid.value?.commitProxy('reload');
|
||||
};
|
||||
|
||||
// 清空半年前日志
|
||||
const handleClear = async () => {
|
||||
options.loading = true;
|
||||
var halfaYearTaskLog = await HalfaYearTaskLog();
|
||||
options.loading = false;
|
||||
console.log(halfaYearTaskLog);
|
||||
ElMessage.success(halfaYearTaskLog.data.result);
|
||||
await handleQuery();
|
||||
}
|
||||
|
||||
const options = useVxeTable({
|
||||
id: 'scheduledTaskLog',
|
||||
name: '产品设计库管理',
|
||||
|
@ -81,8 +81,7 @@
|
||||
<el-drawer v-model="showProcessRoute" title="工艺路线" :direction="'rtl'" :visible.sync="false" size="50%">
|
||||
<!-- 这里可以放置 BOM 的具体内容 -->
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px;height: 100%;">
|
||||
<el-form :model="stateProcessRoute.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true"
|
||||
label-width="auto" style="flex: 1 1 0%;display: none" @submit.prevent="handleQueryProcessRoute">
|
||||
<el-form :model="stateProcessRoute.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" label-width="auto" style="flex: 1 1 0%;display: none" @submit.prevent="handleQueryProcessRoute">
|
||||
<el-input v-model="stateProcessRoute.queryParams.ParentGuid" placeholder="父GUID" @click="handleQueryProcessRoute" />
|
||||
</el-form>
|
||||
|
||||
|
@ -35,11 +35,9 @@
|
||||
</el-button>
|
||||
</template>
|
||||
<template #row_buttons="{ row }">
|
||||
|
||||
<el-tooltip content="同步到ERP" placement="top">
|
||||
<el-button icon="ele-Promotion" size="small" text="" type="success" @click="syncToSAP(row)"
|
||||
v-auth="'productManagement/syncToSAP'"
|
||||
v-if="row.fld005292 == 'A' && row._System_CurrentStage == '结束'"> 同步到SAP </el-button>
|
||||
v-auth="'changeNoticeEcn/syncToSAP'" v-if="row.fld005292 == 'A' && row._System_CurrentStage == '标准化审核'"> 同步到SAP </el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</vxe-grid>
|
||||
|
@ -64,7 +64,7 @@
|
||||
<!-- 这里可以放置 BOM 的具体内容 -->
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px;height: 100%;">
|
||||
<el-form :model="stateBom.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true"
|
||||
label-width="auto" style="flex: 1 1 0%" @submit.prevent="handleQueryBom">
|
||||
label-width="auto" style="flex: 1 1 0% ; display: none" @submit.prevent="handleQueryBom">
|
||||
<el-input v-model="stateBom.queryParams.ParentGuid" placeholder="父GUID" @click="handleQueryBom" />
|
||||
</el-form>
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
<!-- 这里可以放置 BOM 的具体内容 -->
|
||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px;height: 100%;">
|
||||
<el-form :model="stateProcessRoute.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true"
|
||||
label-width="auto" style="flex: 1 1 0%" @submit.prevent="handleQueryProcessRoute">
|
||||
label-width="auto" style="flex: 1 1 0% ; display: none" @submit.prevent="handleQueryProcessRoute">
|
||||
<el-input v-model="stateProcessRoute.queryParams.ParentGuid" placeholder="父GUID" @click="handleQueryProcessRoute" />
|
||||
</el-form>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user