|
@@ -1,47 +1,90 @@
|
|
<template>
|
|
<template>
|
|
- <OCRDialog ref="ocrDialog" :title="'OCR任务'" :queue_category="queueData.queue_category"
|
|
|
|
|
|
+ <OCRDialog ref="ocrDialog" :title="queueData.title" :queue_category="queueData.queue_category"
|
|
:queue_name="queueData.queue_name" @success="jobCreated"></OCRDialog>
|
|
:queue_name="queueData.queue_name" @success="jobCreated"></OCRDialog>
|
|
<QueueSelectDialog ref="queueSelectDialog" :title="'选择队列'" @success="jobMoved" :queue_data="queueIdNameDict">
|
|
<QueueSelectDialog ref="queueSelectDialog" :title="'选择队列'" @success="jobMoved" :queue_data="queueIdNameDict">
|
|
</QueueSelectDialog>
|
|
</QueueSelectDialog>
|
|
<TextViewDialog ref="textViewDialog" :title="'查看文件'" :content="textViewData"></TextViewDialog>
|
|
<TextViewDialog ref="textViewDialog" :title="'查看文件'" :content="textViewData"></TextViewDialog>
|
|
<el-row>
|
|
<el-row>
|
|
<span style="text-align: right;">
|
|
<span style="text-align: right;">
|
|
- <h2>工作队列- {{ queueData.title }} </h2>
|
|
|
|
|
|
+ <h2>工作队列- {{ pageTitle }} </h2>
|
|
</span>
|
|
</span>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+
|
|
<el-row style="margin:15px;">
|
|
<el-row style="margin:15px;">
|
|
- <el-button v-if="allowCreateJob" type="primary" @click="handleCreateJob">新建工作</el-button>
|
|
|
|
- <el-button @click="handleRefreshTable">刷新</el-button>
|
|
|
|
- </el-row>
|
|
|
|
|
|
+ <el-form :model="searchForm" :inline="true" label-position="right">
|
|
|
|
+ <el-form-item label="任务名称" prop="job_name" :label-width="70" style="margin-left:0px;margin-right:0px;">
|
|
|
|
+ <el-input v-model="searchForm.job_name" placeholder="请输入任务名称" :maxlength="32"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="任务类型" prop="start_category" :label-width="70"
|
|
|
|
+ style="margin-left:5px;margin-right:0px;">
|
|
|
|
+ <el-select v-model="searchForm.start_category" placeholder="请选择任务类型" style="width:100px;">
|
|
|
|
+ <el-option v-for="item in jobStartCategoryList" :key="item.id" :label="item.label"
|
|
|
|
+ :value="item.id"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="工序" prop="job_category" :label-width="50" style="margin-left:5px;margin-right:0px;">
|
|
|
|
+ <el-select v-model="searchForm.job_category" placeholder="请选择任务类型" style="width:120px;margin:0px;">
|
|
|
|
+ <el-option v-for="item in jobCategoryList" :key="item.id" :label="item.label"
|
|
|
|
+ :value="item.id"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="状态" prop="status" :label-width="50" style="margin-left:5px;margin-right:0px;">
|
|
|
|
+ <el-select v-model="searchForm.status" placeholder="请选择状态" style="width:120px;">
|
|
|
|
+ <el-option v-for="item in jobStatusList" :key="item.value" :label="item.label"
|
|
|
|
+ :value="item.value"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item style="justify-items: right;margin-left:10px;">
|
|
|
|
+ <el-button type="primary" @click="handleSearch">搜索</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleSearchReset" style="margin-left:5px;">重置</el-button>
|
|
|
|
+ <el-dropdown style="margin-left:5px;">
|
|
|
|
+ <el-button type="primary">
|
|
|
|
+ 新建<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
+ </el-button>
|
|
|
|
+ <template #dropdown>
|
|
|
|
+ <el-dropdown-menu>
|
|
|
|
+ <el-dropdown-item @click="handleCreateJob('SYSTEM', 'OCR', 'PDF 任务')">PDF
|
|
|
|
+ 任务</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item @click="handleCreateJob('SYSTEM', 'WORD', 'Word 任务')">Word
|
|
|
|
+ 任务</el-dropdown-item>
|
|
|
|
+ </el-dropdown-menu>
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
+ </el-dropdown>
|
|
|
|
+ <el-button @click="handleRefreshTable" style="margin-left:5px;" type="success">刷新</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-row>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-table :data="pageData.records" height="650" highlight-current-row @current-change="handleCurrentChange">
|
|
|
|
|
|
+ <el-table :data="pageData.records" height="650" style="width: 100%;" highlight-current-row
|
|
|
|
+ @current-change="handleCurrentChange">
|
|
<el-table-column prop="id" label="ID" width="50"></el-table-column>
|
|
<el-table-column prop="id" label="ID" width="50"></el-table-column>
|
|
- <el-table-column prop="job_category" label="工作类型" width="200"></el-table-column>
|
|
|
|
- <el-table-column prop="job_name" label="工作名称" width="200"></el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="job_name" label="文件名称"></el-table-column>
|
|
|
|
+ <el-table-column prop="start_category" label="任务类型" width="200">
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
+ {{ formatJobCategory(scope.row.start_category) }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="job_category" label="当前工序" width="200">
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
+ {{ formatJobCategory(scope.row.job_category) }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column prop="job_creator" label="创建人" width="100"></el-table-column>
|
|
<el-table-column prop="job_creator" label="创建人" width="100"></el-table-column>
|
|
<el-table-column prop="status" label="状态" width="100">
|
|
<el-table-column prop="status" label="状态" width="100">
|
|
<template v-slot="scope">
|
|
<template v-slot="scope">
|
|
<el-tag :type="getJobStatusTag(scope.row.status)">{{ formatStatus(scope.row.status) }}</el-tag>
|
|
<el-tag :type="getJobStatusTag(scope.row.status)">{{ formatStatus(scope.row.status) }}</el-tag>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="操作" width="500">
|
|
|
|
|
|
+ <el-table-column label="操作">
|
|
<template v-slot="scope">
|
|
<template v-slot="scope">
|
|
<el-menu mode="horizontal">
|
|
<el-menu mode="horizontal">
|
|
-
|
|
|
|
<el-sub-menu index="1">
|
|
<el-sub-menu index="1">
|
|
<template #title>操作</template>
|
|
<template #title>操作</template>
|
|
<el-menu-item index="1-1" @click="handleViewJob(scope.row)">查看</el-menu-item>
|
|
<el-menu-item index="1-1" @click="handleViewJob(scope.row)">查看</el-menu-item>
|
|
- <el-menu-item index="1-2" @click="handlePutJobIntoQueue(scope.row)">移入队列</el-menu-item>
|
|
|
|
|
|
+ <!-- <el-menu-item index="1-2" @click="handlePutJobIntoQueue(scope.row)">移入队列</el-menu-item> -->
|
|
<el-menu-item index="1-3" @click="handleDeleteJob(scope.row)">删除</el-menu-item>
|
|
<el-menu-item index="1-3" @click="handleDeleteJob(scope.row)">删除</el-menu-item>
|
|
</el-sub-menu>
|
|
</el-sub-menu>
|
|
- <el-sub-menu index="4">
|
|
|
|
- <template #title>变更状态</template>
|
|
|
|
- <template v-for="item in jobStatusList">
|
|
|
|
- <el-menu-item v-if="item.could_be_set" index="4-{{item.id}}"
|
|
|
|
- @click="handleJobSetStatus(scope.row, item.value)">{{ item.label }}</el-menu-item>
|
|
|
|
- </template>
|
|
|
|
- </el-sub-menu>
|
|
|
|
</el-menu>
|
|
</el-menu>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -49,25 +92,28 @@
|
|
|
|
|
|
</el-row>
|
|
</el-row>
|
|
<el-row style="margin-top:30px;">
|
|
<el-row style="margin-top:30px;">
|
|
- <el-pagination background layout="prev, pager, next" :total="pageData.total" :page-size="pageData.page_size"
|
|
|
|
- @current-change="handleCurrentPageChange" :current-page.sync="pageData.page">
|
|
|
|
- </el-pagination>
|
|
|
|
|
|
+ <div class="pagination">
|
|
|
|
+ <el-pagination background layout="prev, pager, next" :total="pageData.total" :page-size="pageData.page_size"
|
|
|
|
+ @current-change="handleCurrentPageChange" :current-page.sync="pageData.page">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ <span style="margin-right: 20px;">{{ pageData.total }}条记录</span>
|
|
|
|
+ </div>
|
|
</el-row>
|
|
</el-row>
|
|
<el-drawer title="工作详情" v-model="showDrawer" :direction="showDrawerDirection" size="45%">
|
|
<el-drawer title="工作详情" v-model="showDrawer" :direction="showDrawerDirection" size="45%">
|
|
<el-tabs type="border-card" v-model="jobDetailsActivateTab">
|
|
<el-tabs type="border-card" v-model="jobDetailsActivateTab">
|
|
<el-tab-pane label="基本信息" name="basic_info">
|
|
<el-tab-pane label="基本信息" name="basic_info">
|
|
<div class="prop_header">任务类型</div>
|
|
<div class="prop_header">任务类型</div>
|
|
- <div>{{ currentJob.job_category }}</div>
|
|
|
|
|
|
+ <div>{{ currentJob?.start_category }}</div>
|
|
<div class="prop_header">任务名称</div>
|
|
<div class="prop_header">任务名称</div>
|
|
- <div>{{ currentJob.job_name }}</div>
|
|
|
|
|
|
+ <div>{{ currentJob?.job_name }}</div>
|
|
<div class="prop_header">创建人</div>
|
|
<div class="prop_header">创建人</div>
|
|
- <div>{{ currentJob.job_creator }}</div>
|
|
|
|
|
|
+ <div>{{ currentJob?.job_creator }}</div>
|
|
<div class="prop_header">创建时间</div>
|
|
<div class="prop_header">创建时间</div>
|
|
- <div>{{ formatDate(currentJob.created) }}</div>
|
|
|
|
|
|
+ <div>{{ formatDate(currentJob?.created) }}</div>
|
|
<div class="prop_header">更新时间</div>
|
|
<div class="prop_header">更新时间</div>
|
|
- <div>{{ formatDate(currentJob.updated) }}</div>
|
|
|
|
|
|
+ <div>{{ formatDate(currentJob?.updated) }}</div>
|
|
<div class="prop_header">日志</div>
|
|
<div class="prop_header">日志</div>
|
|
- <div><el-input type="textarea" v-model="currentJob.job_logs" :rows="20"></el-input></div>
|
|
|
|
|
|
+ <div><el-input type="textarea" :rows="20">{{ currentJob?.job_logs }}</el-input></div>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<el-tab-pane label="文件夹" name="file_browse">
|
|
<el-tab-pane label="文件夹" name="file_browse">
|
|
<el-row>
|
|
<el-row>
|
|
@@ -77,6 +123,9 @@
|
|
<el-col :span="20">
|
|
<el-col :span="20">
|
|
<el-table v-if="jobFileInDir.length > 0" :data="jobFileInDir" highlight-current-row
|
|
<el-table v-if="jobFileInDir.length > 0" :data="jobFileInDir" highlight-current-row
|
|
style="width: 100%;">
|
|
style="width: 100%;">
|
|
|
|
+ <el-table-column prop="type" label="类型" width="50">
|
|
|
|
+
|
|
|
|
+ </el-table-column>
|
|
<el-table-column prop="name" label="名称" width="250">
|
|
<el-table-column prop="name" label="名称" width="250">
|
|
|
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -101,11 +150,12 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
|
|
-import { ref, onMounted, watch } from 'vue'
|
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
|
|
|
+import { ref, onMounted, watch, watchEffect } from 'vue'
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
import {
|
|
import {
|
|
getJob,
|
|
getJob,
|
|
getJobs,
|
|
getJobs,
|
|
|
|
+ getStartQueueJobs,
|
|
getQueue,
|
|
getQueue,
|
|
browseJobFile,
|
|
browseJobFile,
|
|
getJobStatus,
|
|
getJobStatus,
|
|
@@ -114,9 +164,11 @@ import {
|
|
deleteJob,
|
|
deleteJob,
|
|
updateJob,
|
|
updateJob,
|
|
updateJobStatus,
|
|
updateJobStatus,
|
|
|
|
+ searchJobs,
|
|
getFileContent
|
|
getFileContent
|
|
} from '@/api/AgentApi'
|
|
} from '@/api/AgentApi'
|
|
-import type { JobData, } from '@/api/AgentApi'
|
|
|
|
|
|
+import type { JobData, SearchData } from '@/api/AgentApi'
|
|
|
|
+
|
|
import OCRDialog from '@/dialogs/OCRDialog.vue'
|
|
import OCRDialog from '@/dialogs/OCRDialog.vue'
|
|
import QueueSelectDialog from '@/dialogs/QueueSelectDialog.vue'
|
|
import QueueSelectDialog from '@/dialogs/QueueSelectDialog.vue'
|
|
import TextViewDialog from '@/dialogs/TextViewDialog.vue'
|
|
import TextViewDialog from '@/dialogs/TextViewDialog.vue'
|
|
@@ -124,27 +176,42 @@ import { ElNotification, ElMessageBox } from 'element-plus'
|
|
import { formatTime } from 'element-plus/es/components/countdown/src/utils.mjs'
|
|
import { formatTime } from 'element-plus/es/components/countdown/src/utils.mjs'
|
|
import { formatDate } from '@/utils/misc'
|
|
import { formatDate } from '@/utils/misc'
|
|
import { getSessionVar, saveSessionVar } from '@/utils/session'
|
|
import { getSessionVar, saveSessionVar } from '@/utils/session'
|
|
-//从路由参数中获取队列ID
|
|
|
|
|
|
|
|
-const sessionId = ref<any>("")
|
|
|
|
|
|
+const router = useRouter()
|
|
|
|
+//从路由参数中获取队列ID
|
|
|
|
+interface ViewJobData {
|
|
|
|
+ id: number,
|
|
|
|
+ job_category: string,
|
|
|
|
+ job_name: string,
|
|
|
|
+ job_creator: string,
|
|
|
|
+ created: string,
|
|
|
|
+ updated: string,
|
|
|
|
+ job_logs: string,
|
|
|
|
+ start_category: string,
|
|
|
|
+}
|
|
|
|
+const sessionId = ref("")
|
|
const ocrDialog = ref()
|
|
const ocrDialog = ref()
|
|
|
|
+const pageTitle = ref("全部工作")
|
|
const allowCreateJob = ref(false)
|
|
const allowCreateJob = ref(false)
|
|
const queueSelectDialog = ref()
|
|
const queueSelectDialog = ref()
|
|
const textViewDialog = ref()
|
|
const textViewDialog = ref()
|
|
-const queueId = ref<any>("")
|
|
|
|
|
|
+//const queueId = ref("")
|
|
const queueData = ref({ id: "0", queue_category: "", queue_name: "", title: "" })
|
|
const queueData = ref({ id: "0", queue_category: "", queue_name: "", title: "" })
|
|
const showDrawer = ref(false)
|
|
const showDrawer = ref(false)
|
|
const showDrawerDirection = ref('rtl')
|
|
const showDrawerDirection = ref('rtl')
|
|
const jobDetailsActivateTab = ref('basic_info')
|
|
const jobDetailsActivateTab = ref('basic_info')
|
|
const queueIdNameDict = ref([
|
|
const queueIdNameDict = ref([
|
|
- { id: "0", name: "DEFAULT", category: 'SYSTEM', title: "全部工作", dialog: null },
|
|
|
|
- { id: "1", name: "OCR", category: 'SYSTEM', title: "文档OCR", dialog: ocrDialog },
|
|
|
|
- { id: "2", name: "OCR_RESULTS", title: "OCR结果校对", category: 'SYSTEM', dialog: null },
|
|
|
|
- { id: "3", name: "CHUNKS", title: "文本切片队列", category: 'SYSTEM', dialog: null },
|
|
|
|
- { id: "4", name: "KB_EXTRACT", title: "知识抽取", category: 'SYSTEM', dialog: null },
|
|
|
|
- { id: "5", name: "KB_BUILD", title: "图谱数据构建", category: 'SYSTEM', dialog: null },
|
|
|
|
- { id: "6", name: "WORD", title: "WORD文档抽取", category: 'SYSTEM', dialog: ocrDialog },
|
|
|
|
|
|
+ { id: "0", name: "DEFAULT", category: 'SYSTEM', title: "全部工作", dialog: null, is_start: false },
|
|
|
|
+ { id: "1", name: "OCR", category: 'SYSTEM', title: "文档OCR", dialog: ocrDialog, is_start: true },
|
|
|
|
+ { id: "2", name: "OCR_RESULTS", title: "OCR结果校对", category: 'SYSTEM', dialog: null, is_start: false },
|
|
|
|
+ { id: "3", name: "CHUNKS", title: "文本切片队列", category: 'SYSTEM', dialog: null, is_start: false },
|
|
|
|
+ { id: "4", name: "KB_EXTRACT", title: "知识抽取", category: 'SYSTEM', dialog: null, is_start: false },
|
|
|
|
+ { id: "5", name: "KB_BUILD", title: "图谱数据构建", category: 'SYSTEM', dialog: null, is_start: false },
|
|
|
|
+ { id: "6", name: "WORD", title: "WORD文档抽取", category: 'SYSTEM', dialog: ocrDialog, is_start: true },
|
|
])
|
|
])
|
|
|
|
+const searchForm = ref<SearchData>({ job_name: "", start_category: "SYSTEM_ALL", status: 9999, job_category: "SYSTEM_ALL" })
|
|
|
|
+const jobStartCategoryList = ref([{ id: "SYSTEM_ALL", label: "所有类型" }, { id: "SYSTEM_WORD", label: "WORD文档抽取" }, { id: "SYSTEM_OCR", label: "PDF文档抽取" }])
|
|
|
|
+const jobCategoryList = ref([{ id: "SYSTEM_ALL", label: "所有工序" }, { id: "SYSTEM_CHUNKS", label: "文档切片" }, { id: "SYSTEM_KB_EXTRACT", label: "知识抽取" }, { id: "SYSTEM_KB_BUILD", label: "知识构建" }])
|
|
var textViewContent = "hello"
|
|
var textViewContent = "hello"
|
|
const textViewData = ref(textViewContent)
|
|
const textViewData = ref(textViewContent)
|
|
const jobStatusList = ref(JobSatus)
|
|
const jobStatusList = ref(JobSatus)
|
|
@@ -155,24 +222,36 @@ const jobFileTree = ref({
|
|
const pageData = ref({ page: 1, pages: 1, page_size: 10, total: 0, records: [] })
|
|
const pageData = ref({ page: 1, pages: 1, page_size: 10, total: 0, records: [] })
|
|
const jobFileData = ref([])
|
|
const jobFileData = ref([])
|
|
const jobFileInDir = ref([])
|
|
const jobFileInDir = ref([])
|
|
-const currentJob = ref<any>({ id: 0, job_category: "USER", job_name: "" })
|
|
|
|
|
|
+const currentJob = ref<ViewJobData>({ id: 0, job_category: "USER", job_name: "", job_creator: "", created: "", updated: "", job_logs: "no job logs", start_category: "" })
|
|
const currentActionJob = ref({ id: 0, job_category: "USER", job_name: "" })
|
|
const currentActionJob = ref({ id: 0, job_category: "USER", job_name: "" })
|
|
|
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
|
|
-watch(route, (newValue, oldValue) => {
|
|
|
|
- let para = newValue.params.id as string | undefined
|
|
|
|
|
|
+// watchEffect(route, (newValue, oldValue) => {
|
|
|
|
+// let para = newValue.params.id as string | undefined
|
|
|
|
+// if (para == undefined) {
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// console.log('route changed')
|
|
|
|
+// //queueId.value = para
|
|
|
|
+// queueData.value.id = "0"
|
|
|
|
+// loadQueueData()
|
|
|
|
+// })
|
|
|
|
+watchEffect(() => {
|
|
|
|
+ let para = route.params.id as string | undefined
|
|
if (para == undefined) {
|
|
if (para == undefined) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- console.log('route changed')
|
|
|
|
- queueId.value = para
|
|
|
|
|
|
+ // console.log('route changed')
|
|
|
|
+ //queueId.value = para
|
|
queueData.value.id = "0"
|
|
queueData.value.id = "0"
|
|
|
|
+ // queueData.value.queue_category = "SYSTEM"
|
|
|
|
+ // queueData.value.queue_name = "ALL"
|
|
|
|
+ // queueData.value.title = "全部工作"
|
|
loadQueueData()
|
|
loadQueueData()
|
|
})
|
|
})
|
|
|
|
|
|
-
|
|
|
|
-const handleCreateJob = () => {
|
|
|
|
|
|
+const handleCreateJob = (category: string, name: string, dialog_title: string) => {
|
|
if (queueData.value.id == "0") {
|
|
if (queueData.value.id == "0") {
|
|
ElNotification.info({
|
|
ElNotification.info({
|
|
title: '消息',
|
|
title: '消息',
|
|
@@ -180,13 +259,15 @@ const handleCreateJob = () => {
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- let queue_data = queueIdNameDict.value.find((item) => item.id == queueId.value)
|
|
|
|
|
|
+ queueData.value.queue_category = category
|
|
|
|
+ queueData.value.queue_name = name
|
|
|
|
+ queueData.value.title = dialog_title
|
|
|
|
+ let queue_data = queueIdNameDict.value.find((item) => item.category == category && item.name == name)
|
|
if (queue_data == undefined) {
|
|
if (queue_data == undefined) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // console.log(queue_data)
|
|
|
|
|
|
+ // console.log("HHHH")
|
|
if (queue_data.dialog != undefined) {
|
|
if (queue_data.dialog != undefined) {
|
|
- // console.log(queue_data.dialog)
|
|
|
|
queue_data.dialog.showDialog()
|
|
queue_data.dialog.showDialog()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -201,36 +282,71 @@ const handleViewFile = (job: any, path: string) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
const handleRefreshTable = () => {
|
|
const handleRefreshTable = () => {
|
|
- loadQueueData()
|
|
|
|
|
|
+ handleCurrentPageChange(pageData.value.page)
|
|
}
|
|
}
|
|
function formatStatus(status: number) {
|
|
function formatStatus(status: number) {
|
|
return getJobStatus(status)
|
|
return getJobStatus(status)
|
|
}
|
|
}
|
|
-function formatFolderName(name: string) {
|
|
|
|
|
|
+function formatJobCategory(category: string) {
|
|
|
|
+ var title = ""
|
|
|
|
+ queueIdNameDict.value.forEach((item) => {
|
|
|
|
+ // console.log(category, 'category')
|
|
|
|
+ if ((item.category + "_" + item.name) == category) {
|
|
|
|
+ // console.log(item.title)
|
|
|
|
+ title = item.title
|
|
|
|
|
|
- var translate: any = {
|
|
|
|
- logs: "日志",
|
|
|
|
- results: "结果", chunks: "切片", files: "文件",
|
|
|
|
- ocr_output: "文本转换结果", kb_extract: "知识抽取", kb_build: "知识构建",
|
|
|
|
- upload: '文件上传', output: '输出'
|
|
|
|
- }
|
|
|
|
- // console.log(translate[name])
|
|
|
|
- if (name in translate) {
|
|
|
|
- return translate[name] as string
|
|
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return title
|
|
|
|
+}
|
|
|
|
+function formatFolderName(name: string) {
|
|
|
|
+ let translate = new Map([
|
|
|
|
+ ["logs", "日志"],
|
|
|
|
+ ["results", "结果"],
|
|
|
|
+ ["chunks", "切片"],
|
|
|
|
+ ["files", "文件"],
|
|
|
|
+ ["ocr_output", "文本转换结果"],
|
|
|
|
+ ["kb_extract", "知识抽取"],
|
|
|
|
+ ["kb_build", "知识构建"],
|
|
|
|
+ ["upload", "文件上传"],
|
|
|
|
+ ["output", "输出"]]
|
|
|
|
+ )
|
|
|
|
+ if (translate.get(name) != undefined) {
|
|
|
|
+ return translate.get(name)
|
|
}
|
|
}
|
|
return name
|
|
return name
|
|
}
|
|
}
|
|
|
|
+function resetViewData() {
|
|
|
|
+ jobFileData.value = []
|
|
|
|
+ jobFileInDir.value = []
|
|
|
|
+ currentJob.value = { id: 0, job_category: "USER", job_name: "", job_creator: "", created: "", updated: "", job_logs: "no job logs", start_category: "" }
|
|
|
|
+ searchForm.value = { job_name: "", start_category: "SYSTEM_ALL", status: 9999, job_category: "SYSTEM_ALL" }
|
|
|
|
+ pageData.value.page = 1
|
|
|
|
+ pageData.value.page_size = 10
|
|
|
|
+}
|
|
|
|
+function loadJobs(reset: boolean) {
|
|
|
|
+ // console.log("searchJobs")
|
|
|
|
+ if (reset) {
|
|
|
|
+ resetViewData()
|
|
|
|
+ }
|
|
|
|
+ searchJobs(searchForm.value, pageData.value.page, pageData.value.page_size).then((res) => {
|
|
|
|
+ pageData.value.page = res.meta.page
|
|
|
|
+ pageData.value.pages = res.meta.pages
|
|
|
|
+ pageData.value.total = res.meta.total
|
|
|
|
+ pageData.value.records = res.records
|
|
|
|
+ })
|
|
|
|
+}
|
|
function loadQueueData() {
|
|
function loadQueueData() {
|
|
|
|
|
|
jobFileData.value = []
|
|
jobFileData.value = []
|
|
jobFileInDir.value = []
|
|
jobFileInDir.value = []
|
|
- currentJob.value = { id: 0, job_category: "USER", job_name: "" }
|
|
|
|
|
|
+ //currentJob.value = {id:0,job_category:"USER",job_name:""}
|
|
currentActionJob.value = { id: 0, job_category: "USER", job_name: "" }
|
|
currentActionJob.value = { id: 0, job_category: "USER", job_name: "" }
|
|
// 根据队列ID获取队列数据
|
|
// 根据队列ID获取队列数据
|
|
- let queue_data = queueIdNameDict.value.find((item) => item.id == queueId.value)
|
|
|
|
|
|
+ let queue_data = queueIdNameDict.value.find((item) => item.category == queueData.value.queue_category && item.name == queueData.value.queue_name)
|
|
|
|
|
|
if (queue_data == undefined) {
|
|
if (queue_data == undefined) {
|
|
- queueData.value = { id: "999", queue_category: 'SYSTEM', queue_name: 'UNKNOWN', title: "未知队列" }
|
|
|
|
|
|
+ queueData.value = { id: "999", queue_category: 'SYSTEM', queue_name: 'ALL', title: "未知队列" }
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -248,14 +364,10 @@ function loadQueueData() {
|
|
queueData.value.queue_category = res.records[0].queue_category
|
|
queueData.value.queue_category = res.records[0].queue_category
|
|
queueData.value.queue_name = res.records[0].queue_name
|
|
queueData.value.queue_name = res.records[0].queue_name
|
|
queueData.value.title = queue_data.title
|
|
queueData.value.title = queue_data.title
|
|
|
|
+ // console.log(queueData.value, ' queueData')
|
|
|
|
+ handleCurrentPageChange(1)
|
|
})
|
|
})
|
|
- getJobs(queue_data.category, queue_data.name, pageData.value.page, pageData.value.page_size).then((res) => {
|
|
|
|
- pageData.value.page = res.meta.page
|
|
|
|
- pageData.value.pages = res.meta.pages
|
|
|
|
- pageData.value.total = res.meta.total
|
|
|
|
- pageData.value.records = res.records
|
|
|
|
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
function jobMoved() {
|
|
function jobMoved() {
|
|
queueSelectDialog.value.showDialog(null, false)
|
|
queueSelectDialog.value.showDialog(null, false)
|
|
@@ -269,7 +381,7 @@ function jobMoved() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
function jobCreated() {
|
|
function jobCreated() {
|
|
- let queue_data = queueIdNameDict.value.find((item) => item.id == queueId.value)
|
|
|
|
|
|
+ let queue_data = queueIdNameDict.value.find((item) => item.category == queueData.value.queue_category && item.name == queueData.value.queue_name)
|
|
if (queue_data == undefined) {
|
|
if (queue_data == undefined) {
|
|
|
|
|
|
ElNotification.info({
|
|
ElNotification.info({
|
|
@@ -336,12 +448,28 @@ function handleTreeNodeClick(data: any) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function handleCurrentPageChange(page: number) {
|
|
function handleCurrentPageChange(page: number) {
|
|
- getJobs(queueData.value.queue_category, queueData.value.queue_name, page).then((res) => {
|
|
|
|
- pageData.value.page = res.meta.page
|
|
|
|
- pageData.value.pages = res.meta.pages
|
|
|
|
- pageData.value.total = res.meta.total
|
|
|
|
- pageData.value.records = res.records
|
|
|
|
- })
|
|
|
|
|
|
+ pageData.value.page = page
|
|
|
|
+ loadJobs(false)
|
|
|
|
+ // let queue_data = queueIdNameDict.value.find((item) => item.id == queueId.value)
|
|
|
|
+ // console.log(queue_data)
|
|
|
|
+ // if (queue_data == undefined) {
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // if (queue_data?.is_start == false) {
|
|
|
|
+ // getJobs(queueData.value.queue_category, queueData.value.queue_name, page).then((res) => {
|
|
|
|
+ // pageData.value.page = res.meta.page
|
|
|
|
+ // pageData.value.pages = res.meta.pages
|
|
|
|
+ // pageData.value.total = res.meta.total
|
|
|
|
+ // pageData.value.records = res.records
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // getStartQueueJobs(queueData.value.queue_category, queueData.value.queue_name, page).then((res) => {
|
|
|
|
+ // pageData.value.page = res.meta.page
|
|
|
|
+ // pageData.value.pages = res.meta.pages
|
|
|
|
+ // pageData.value.total = res.meta.total
|
|
|
|
+ // pageData.value.records = res.records
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
function handleJobMenuSelect(key: string, keyPath: string[]) {
|
|
function handleJobMenuSelect(key: string, keyPath: string[]) {
|
|
// console.log(key, keyPath)
|
|
// console.log(key, keyPath)
|
|
@@ -350,21 +478,22 @@ function handleViewJob(job: JobData) {
|
|
if (job == null) {
|
|
if (job == null) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- jobFileData.value = []
|
|
|
|
- jobFileInDir.value = []
|
|
|
|
- getJob(job.id).then((res) => {
|
|
|
|
- currentJob.value = res.records[0]
|
|
|
|
- showDrawer.value = true
|
|
|
|
- browseJobFile({ job_id: job.id, path: "" }).then((res) => {
|
|
|
|
- for (let i = 0; i < res.records.length; i++) {
|
|
|
|
- res.records[i]['label'] = res.records[i].name
|
|
|
|
- res.records[i]['children'] = []
|
|
|
|
- res.records[i]['display_name'] = formatFolderName(res.records[i].name)
|
|
|
|
- }
|
|
|
|
- jobFileData.value = res.records
|
|
|
|
- // console.log("show drawer")
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ router.push({ name: 'job-view', params: { id: job.id } })
|
|
|
|
+ // jobFileData.value = []
|
|
|
|
+ // jobFileInDir.value = []
|
|
|
|
+ // getJob(job.id).then((res) => {
|
|
|
|
+ // currentJob.value = res.records[0]
|
|
|
|
+ // showDrawer.value = true
|
|
|
|
+ // browseJobFile({ job_id:job.id, path:""}).then((res) => {
|
|
|
|
+ // for (let i = 0; i < res.records.length; i++) {
|
|
|
|
+ // res.records[i]['label'] = res.records[i].name
|
|
|
|
+ // res.records[i]['children'] = []
|
|
|
|
+ // res.records[i]['display_name'] = formatFolderName(res.records[i].name)
|
|
|
|
+ // }
|
|
|
|
+ // jobFileData.value = res.records
|
|
|
|
+ // console.log("show drawer")
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
function handleCurrentChange(data: any) {
|
|
function handleCurrentChange(data: any) {
|
|
if (data == null) {
|
|
if (data == null) {
|
|
@@ -373,10 +502,28 @@ function handleCurrentChange(data: any) {
|
|
|
|
|
|
//currentJob.value = data
|
|
//currentJob.value = data
|
|
}
|
|
}
|
|
|
|
+function handleSearch() {
|
|
|
|
+ pageData.value.page = 1
|
|
|
|
+ pageData.value.pages = 0
|
|
|
|
+ pageData.value.total = 0
|
|
|
|
+ pageData.value.records = []
|
|
|
|
+ pageTitle.value = "搜索结果"
|
|
|
|
+ loadJobs(false)
|
|
|
|
+}
|
|
|
|
+function handleSearchReset() {
|
|
|
|
+ pageData.value.page = 1
|
|
|
|
+ pageData.value.pages = 0
|
|
|
|
+ pageData.value.total = 0
|
|
|
|
+ pageData.value.records = []
|
|
|
|
+ resetViewData()
|
|
|
|
+ pageTitle.value = "全部工作"
|
|
|
|
+ loadJobs(false)
|
|
|
|
+}
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- sessionId.value = getSessionVar("session_id") as string | undefined
|
|
|
|
- queueId.value = route.params.id as string | undefined
|
|
|
|
- loadQueueData()
|
|
|
|
|
|
+ sessionId.value = getSessionVar("session_id") as string | ""
|
|
|
|
+
|
|
|
|
+ //loadQueueData()
|
|
|
|
+ loadJobs(true)
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -386,4 +533,25 @@ onMounted(() => {
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
margin-bottom: 5px;
|
|
margin-bottom: 5px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.el-dropdown {
|
|
|
|
+ vertical-align: top;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-dropdown+.el-dropdown {
|
|
|
|
+ margin-left: 15px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-icon-arrow-down {
|
|
|
|
+ font-size: 12px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.pagination {
|
|
|
|
+ margin-left: auto;
|
|
|
|
+ display: flex;
|
|
|
|
+ /* text-align: right; */
|
|
|
|
+ justify-content: end;
|
|
|
|
+ align-items: center;
|
|
|
|
+ gap: 10px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|