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