添加 日志展示模块
This commit is contained in:
parent
42becf154a
commit
844e122d2b
|
|
@ -151,6 +151,7 @@ function firstLetterToLower(str) {
|
||||||
async function RloadTaskInfo(row: any) {
|
async function RloadTaskInfo(row: any) {
|
||||||
let res = await RowRload(row.id);
|
let res = await RowRload(row.id);
|
||||||
row.TaskInfo = res;
|
row.TaskInfo = res;
|
||||||
|
row.TaskInfo.logs = row.TaskInfo.logs.reverse();
|
||||||
row.TaskInfo.stepData = JSON.parse(JSON.stringify(stepData.value));
|
row.TaskInfo.stepData = JSON.parse(JSON.stringify(stepData.value));
|
||||||
row.TaskInfo.active = row.TaskInfo.stepData.findIndex(
|
row.TaskInfo.active = row.TaskInfo.stepData.findIndex(
|
||||||
(s) => s.title == row.TaskInfo.lastEnum
|
(s) => s.title == row.TaskInfo.lastEnum
|
||||||
|
|
@ -162,8 +163,8 @@ async function RloadTaskInfo(row: any) {
|
||||||
);
|
);
|
||||||
let i = row.TaskInfo.stepData.indexOf(element);
|
let i = row.TaskInfo.stepData.indexOf(element);
|
||||||
if (i < row.TaskInfo.active) {
|
if (i < row.TaskInfo.active) {
|
||||||
element.status = "finish";
|
element.status = "success";
|
||||||
} else if (element.value == 60) {
|
} else if (row.TaskInfo.active == 6 && element.value == 60) {
|
||||||
element.status = "success";
|
element.status = "success";
|
||||||
} else if (i == row.TaskInfo.active) {
|
} else if (i == row.TaskInfo.active) {
|
||||||
element.status = "process";
|
element.status = "process";
|
||||||
|
|
@ -265,6 +266,23 @@ const stepData = ref<StepData[]>([
|
||||||
/>
|
/>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="grid_item_full_width" v-if="props.row.TaskInfo != null">
|
||||||
|
<span>日志</span>
|
||||||
|
<div class="content">
|
||||||
|
<el-timeline
|
||||||
|
style="max-height: 200px; padding-top: 2px; overflow-y: scroll"
|
||||||
|
>
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="(activity, index) in props.row.TaskInfo.logs"
|
||||||
|
:key="index"
|
||||||
|
:timestamp="activity.createTime"
|
||||||
|
>
|
||||||
|
{{ activity.message }}
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,14 @@ namespace VideoAnalysisCore.Controllers
|
||||||
readonly Repository<VideoQuestion> videoQuestionDB;
|
readonly Repository<VideoQuestion> videoQuestionDB;
|
||||||
readonly Repository<VideoKonwPoint> videoKonwPointDB;
|
readonly Repository<VideoKonwPoint> videoKonwPointDB;
|
||||||
readonly Repository<VideoQuestionKonw> videoQuestionKonwDB;
|
readonly Repository<VideoQuestionKonw> videoQuestionKonwDB;
|
||||||
|
readonly Repository<TaskLog> taskLogDB;
|
||||||
|
|
||||||
readonly RedisManager redisManager;
|
readonly RedisManager redisManager;
|
||||||
public readonly SenseVoice senseVoice;
|
public readonly SenseVoice senseVoice;
|
||||||
private readonly IMapper mp;
|
private readonly IMapper mp;
|
||||||
public VideoTaskController(Repository<VideoTask> baseService, RedisManager redisManager,
|
public VideoTaskController(Repository<VideoTask> baseService, RedisManager redisManager,
|
||||||
Repository<VideoQuestion> videoQuestionDB,
|
Repository<VideoQuestion> videoQuestionDB,
|
||||||
Repository<VideoQuestionKonw> videoQuestionKonwDB, Repository<VideoKonwPoint> videoKonwPointDB, SenseVoice senseVoice, IMapper mp) : base(baseService)
|
Repository<VideoQuestionKonw> videoQuestionKonwDB, Repository<VideoKonwPoint> videoKonwPointDB, SenseVoice senseVoice, IMapper mp, Repository<TaskLog> taskLogDB) : base(baseService)
|
||||||
{
|
{
|
||||||
this.baseService = baseService;
|
this.baseService = baseService;
|
||||||
this.redisManager = redisManager;
|
this.redisManager = redisManager;
|
||||||
|
|
@ -47,6 +49,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
this.videoKonwPointDB = videoKonwPointDB;
|
this.videoKonwPointDB = videoKonwPointDB;
|
||||||
this.senseVoice = senseVoice;
|
this.senseVoice = senseVoice;
|
||||||
this.mp = mp;
|
this.mp = mp;
|
||||||
|
this.taskLogDB = taskLogDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -289,6 +292,17 @@ namespace VideoAnalysisCore.Controllers
|
||||||
return BadRequest("无效id");
|
return BadRequest("无效id");
|
||||||
var d = await redisManager.Redis.HMGetAsync<string>(RedisExpandKey.Task(id),
|
var d = await redisManager.Redis.HMGetAsync<string>(RedisExpandKey.Task(id),
|
||||||
"Progress", "LastEnum", "StartTime", "ErrorMessage");
|
"Progress", "LastEnum", "StartTime", "ErrorMessage");
|
||||||
|
|
||||||
|
var logArr = await taskLogDB.AsQueryable()
|
||||||
|
.Where(s => s.VideoTaskId == id)
|
||||||
|
.ToArrayAsync();
|
||||||
|
var insertData = (await redisManager.Redis
|
||||||
|
.LRangeAsync<TaskLog>(RedisExpandKey.TaskLog, 0, 99))
|
||||||
|
.Where(s => s.VideoTaskId == id);
|
||||||
|
|
||||||
|
logArr = logArr.Concat(insertData).ToArray();
|
||||||
|
|
||||||
|
|
||||||
return Ok(new
|
return Ok(new
|
||||||
{
|
{
|
||||||
Progress = d[0],
|
Progress = d[0],
|
||||||
|
|
@ -297,6 +311,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
? JsonSerializer.Deserialize<Dictionary<RedisChannelEnum, DateTime>>(d[2])
|
? JsonSerializer.Deserialize<Dictionary<RedisChannelEnum, DateTime>>(d[2])
|
||||||
: null,
|
: null,
|
||||||
ErrorMessage = d[3],
|
ErrorMessage = d[3],
|
||||||
|
Logs = logArr,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -412,6 +427,28 @@ namespace VideoAnalysisCore.Controllers
|
||||||
var data = await sqlquery.ToPageListAsync(model.PageIndex + 1, model.PageSize, total);
|
var data = await sqlquery.ToPageListAsync(model.PageIndex + 1, model.PageSize, total);
|
||||||
return new PageResult<VideoTask>() { Data = data, Total = total };
|
return new PageResult<VideoTask>() { Data = data, Total = total };
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">查询模型</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IEnumerable<TaskLog>> TaskLog(long id )
|
||||||
|
{
|
||||||
|
var logArr = await taskLogDB.AsQueryable()
|
||||||
|
.Where(s => s.VideoTaskId == id)
|
||||||
|
.ToArrayAsync();
|
||||||
|
var insertData = (await redisManager.Redis
|
||||||
|
.LRangeAsync<TaskLog>(RedisExpandKey.TaskLog, 0, 99))
|
||||||
|
.Where(s=>s.VideoTaskId == id);
|
||||||
|
|
||||||
|
return logArr.Concat(insertData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue