1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027 |
- <!--
- @Date: 2024-10-29
- @Author: ©WANGKANG
- @Email: 1686617586@qq.com
- -->
- <template>
- <div class="table-box">
- <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listTrackSequenceApi">
- <!-- 表格 header 按钮 -->
- <template #tableHeader="scope">
- <el-button type="primary" v-auth="['demo:trackSequence:add']" icon="CirclePlus" @click="openDialog(1, '注视轨迹序列新增')"> 新增 </el-button>
- <!-- <el-button type="primary" v-auth="['demo:trackSequence:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
- <el-button type="primary" v-auth="['demo:trackSequence:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button> -->
- <el-button
- type="danger"
- v-auth="['demo:trackSequence:remove']"
- icon="Delete"
- plain
- :disabled="!scope.isSelected"
- @click="batchDelete(scope.selectedListIds)"
- >
- 批量删除
- </el-button>
- </template>
- <!-- 表格操作 -->
- <template #operation="scope">
- <el-button type="primary" link icon="View" @click="openDialog(3, '详情', scope.row)">
- <!--@click="openStartDialog(scope.row)" -->
- 详情
- </el-button>
- <el-button type="primary" link icon="EditPen" @click="openDialog(2, '编辑', scope.row)"> 编辑 </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:trackSequence:start']"
- v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '4'"
- @click="startTrackSequence(scope.row)"
- >
- 开始
- </el-button>
- <el-popconfirm title="确定终止此任务吗?" @confirm="stopTrackSequence(scope.row)" v-if="scope.row.status == '1'">
- <template #reference>
- <el-button type="primary" link icon="Delete"> 终止</el-button>
- </template>
- </el-popconfirm>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:DataSeq:query']"
- v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['测试']"
- @click="showEvaluateResultRef.get_statistics_result(scope.row.id)"
- >
- 结果
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:DataSeq:query']"
- v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['预测/推理']"
- @click="preview(scope.row)"
- >
- 预览
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:DataSeq:query']"
- v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['预测/推理']"
- @click="showStatisticResultRef.get_statistics_result(scope.row.id)"
- >
- 结果
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:toInfrared:query']"
- @click="viewLogRef.handleOpen(scope.row.id)"
- v-if="scope.row.status != '0'"
- >
- 日志
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:trackSequence:download']"
- v-if="scope.row.status == '2'"
- @click="dowloadTrackSequence(scope.row)"
- >
- 下载
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-if="scope.row.status == '2' && scope.row.type === AlgorithmType2['预测/推理']"
- @click="showEvaluate(scope.row)"
- >
- 评估
- </el-button>
- <el-button
- type="primary"
- link
- icon="View"
- v-auth="['demo:ToInfrared:download']"
- v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['训练']"
- @click="showModelDialog(scope.row.id)"
- >
- 模型
- </el-button>
- <el-button
- type="primary"
- link
- icon="Delete"
- v-auth="['demo:toInfrared:remove']"
- @click="deleteTrackSequence(scope.row)"
- :disabled="scope.row.status == '1'"
- >
- 删除
- </el-button>
- </template>
- </ProTable>
- <FormDialog ref="formDialogRef" />
- <ImportExcel ref="dialogRef" />
- <ViewLog ref="viewLogRef" :get-log-api="getLogTrackSequenceApi" />
- <PreviewCompareImages ref="previewImagesRef" />
- <ShowStatisticResult ref="showStatisticResultRef" :api="getStatisticsResultTrackSequenceApi" />
- <ShowStatisticResult ref="showEvaluateResultRef" :api="previewEvaluateTrackSequenceApi" title="评估结果" />
- <el-dialog v-model="showModelDialogVisible" title="模型列表" width="1000">
- <el-scrollbar ref="scrollbarRef" id="scrollbarRef1" height="500px">
- <template v-for="model in model_list" :key="model">
- <el-card style="width: 100%; margin-bottom: 10px">
- <el-form label-width="130px" label-position="left">
- <el-form-item label="Model Name">
- {{ model.name }}
- </el-form-item>
- <el-form-item label="Model Path">
- {{ model.path }}
- </el-form-item>
- <el-form-item label="Model Size">
- {{ model.size }}
- </el-form-item>
- <el-form-item label="操作">
- <el-link :href="model.url" type="primary" icon="Download" :underline="false" target="_blank" style="margin-right: 20px"
- >下载
- </el-link>
- <el-button type="success" link @click="addModel(model.path, model.name)">
- <el-icon>
- <Plus />
- </el-icon>
- 添加模型
- </el-button>
- </el-form-item>
- </el-form>
- </el-card>
- </template>
- </el-scrollbar>
- </el-dialog>
- </div>
- </template>
- <script setup lang="tsx" name="TrackSequence">
- import { ref, reactive, onMounted } from 'vue'
- import { useHandleData } from '@/hooks/useHandleData'
- import { useDownload } from '@/hooks/useDownload'
- import { ElMessage, ElMessageBox } from 'element-plus'
- import ProTable from '@/components/ProTable/index.vue'
- import ImportExcel from '@/components/ImportExcel/index.vue'
- import FormDialog from '@/components/FormDialog/index.vue'
- import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
- import {
- listTrackSequenceApi,
- delTrackSequenceApi,
- addTrackSequenceApi,
- updateTrackSequenceApi,
- importTemplateApi,
- importTrackSequenceDataApi,
- exportTrackSequenceApi,
- getTrackSequenceApi,
- startTrackSequenceApi,
- stopTrackSequenceApi,
- dowloadTrackSequenceApi,
- getLogTrackSequenceApi,
- getLDetailTrackSequenceApi,
- addEvaluateTrackSequenceApi,
- showCATModelApi,
- previewPredictResultTrackSequenceModelApi,
- previewEvaluateTrackSequenceApi,
- getStatisticsResultTrackSequenceApi
- } from '@/api/modules/demo/trackSequence'
- import { enumAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
- import { getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
- import { enumAlgorithmConfigTrackApi, getAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
- import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
- import statusEnums from '@/utils/status'
- import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSystem, AlgorithmType2 } from '@/views/demo/utils'
- import ViewLog from '@/views/demo/components/ViewLog.vue'
- import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
- import useWebSocketStore from '@/stores/modules/websocket'
- import { resetHeart } from '@/utils/websocket'
- import PreviewCompareImages from '@/views/demo/components/PreviewCompareImages.vue'
- import ShowStatisticResult from '@/views/demo/components/ShowStatisticResult.vue'
- import { getTargetDetectionApi } from '@/api/modules/demo/TargetDetection'
- import { getDictsApi } from '@/api/modules/system/dictData'
- const zipFileDescDict = ref<any>({})
- onMounted(async () => {
- const res = await getDictsApi('zip_file_format_description')
- for (let i = 0; i < res.data.length; i++) {
- const item = res.data[i]
- zipFileDescDict.value[item.dictValue] = item.remark
- }
- })
- const showStatisticResultRef = ref()
- const showEvaluateResultRef = ref()
- const previewImagesRef = ref()
- const preview = async row => {
- previewImagesRef.value?.handleOpen(previewPredictResultTrackSequenceModelApi, row.id)
- }
- onMounted(() => {
- const websocketStore = useWebSocketStore()
- websocketStore.websocket.onmessage = (e: any) => {
- if (e.data.indexOf('heartbeat') > 0) {
- resetHeart()
- }
- if (e.data.indexOf('ping') > 0) {
- return
- }
- console.log(e)
- proTable.value?.getTableList(true)
- }
- })
- const enumsAlgorithmConfigTrack_addModel____ = ref<any>([])
- const setItemsOptions222 = async () => {
- console.log('setItemsOptions222')
- const result = await enumAlgorithmConfigTrackApi()
- enumsAlgorithmConfigTrack_addModel____.value = []
- const tmp_data: any = result['data']
- for (const item of tmp_data) {
- if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['预测/推理']) {
- item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
- enumsAlgorithmConfigTrack_addModel____.value.push(item)
- }
- }
- console.log(enumsAlgorithmConfigTrack_addModel____.value)
- itemsOptions = [
- {
- label: '算法',
- prop: 'algorithmId',
- rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请输入算法',
- enum: enumsAlgorithmConfigTrack_addModel____
- }
- },
- {
- label: '子系统',
- prop: 'subSystem',
- rules: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
- compOptions: {
- disabled: true,
- elTagName: 'select',
- placeholder: '请输入子系统',
- enum: enumsSubSystem
- }
- },
- {
- label: '模型名称',
- prop: 'modelName',
- rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
- compOptions: {
- disabled: false,
- placeholder: '请输入模型名称'
- }
- },
- {
- label: '模型路径',
- prop: 'modelPath',
- rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入模型名称',
- disabled: true
- }
- },
- {
- label: '备注',
- prop: 'remarks',
- rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入备注'
- }
- }
- ]
- }
- const addModel = async (modelPath: string, modelName: string) => {
- console.log(modelPath, modelName)
- let res = { data: { modelPath, subSystem: SubSystem__['目标检测'], type: AlgorithmType2['预测/推理'], modelName: modelName } }
- // 重置表单
- await setItemsOptions222()
- const params = {
- title: '添加模型',
- width: 580,
- isEdit: true,
- itemsOptions: itemsOptions,
- model: res.data,
- api: addAlgorithmModelTrackApi,
- getTableList: proTable.value?.getTableList,
- closedEvent: async () => {
- await updateEnumsAlgorithmModelTrack()
- }
- }
- formDialogRef.value?.openDialog(params)
- }
- const showModelDialogVisible = ref(false)
- const model_list: Ref<any> = ref([])
- const showModelDialog = async (id: any) => {
- const res: any = await showCATModelApi(id)
- model_list.value = res.data
- showModelDialogVisible.value = true
- }
- const setItemsOptionsAddCAT = () => {
- itemsOptions = [
- {
- label: '任务名称',
- prop: 'name',
- rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入任务名称'
- }
- },
- {
- label: '选择数据集',
- prop: 'inputOssId',
- rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择或者上传数据集',
- enum: datasetList,
- clearable: true
- }
- },
- {
- label: '上传数据集',
- prop: 'inputOssId',
- rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
- tooltip: zipFileDescDict.value['track_sequence'],
- compOptions: {
- elTagName: 'file-upload',
- fileSize: 4096,
- fileType: ['zip'],
- placeholder: '请上传数据集'
- }
- },
- {
- label: '选择模型',
- prop: 'algorithmModelId',
- rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择模型',
- enum: enumsAlgorithmModelTrack_______.value
- }
- },
- {
- label: '备注',
- prop: 'remarks',
- rules: [],
- compOptions: {
- placeholder: '请输入备注'
- }
- }
- ]
- }
- const enumsAlgorithmModelTrack_______ = ref([])
- const addCATDialog = async () => {
- const result: any = await enumAlgorithmModelTrackApi()
- // console.log(result.data);
- enumsAlgorithmModelTrack_______.value = []
- for (const item of result.data) {
- if (SubSystem[item['subsystem']] === '注释轨迹序列' || SubSystem[item['subsystem']] === '目标检测') {
- item['label'] =
- item['value'] + '_' + item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
- enumsAlgorithmModelTrack_______.value.push(item)
- }
- }
- // 重置表单
- setItemsOptionsAddCAT()
- const params = {
- title: '注释轨迹序列新增',
- width: 580,
- isEdit: true,
- itemsOptions: itemsOptions,
- model: {},
- api: addTrackSequenceApi,
- getTableList: proTable.value?.getTableList
- }
- formDialogRef.value?.openDialog(params)
- }
- const showEvaluate = (row: any) => {
- const newItem = {
- predictTaskId: row.id
- }
- const enumsAlgorithmConfigTrack__: Array<any> = []
- for (const item of enumsAlgorithmConfigTrack.value) {
- if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['测试']) {
- enumsAlgorithmConfigTrack__.push(item)
- }
- }
- itemsOptions = [
- {
- label: '任务名称',
- prop: 'name',
- rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入任务名称'
- }
- },
- {
- label: '选择算法',
- prop: 'algorithmId',
- rules: [{ required: true, message: '请选择算法', trigger: 'blur' }],
- compOptions: {
- disabled: false,
- elTagName: 'select',
- placeholder: '请输入算法',
- enum: enumsAlgorithmConfigTrack__
- }
- },
- {
- label: '选择Label文件',
- prop: 'inputLabelOssId',
- rules: [{ required: false, message: 'Label文件不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择或者上传Label文件',
- enum: datasetList,
- clearable: true
- }
- },
- {
- label: '上传Label文件',
- prop: 'inputLabelOssId',
- rules: [{ required: false, message: '请上传Label文件', trigger: 'blur' }],
- compOptions: {
- elTagName: 'file-upload',
- fileSize: 4096,
- fileType: ['txt', 'xlsx', 'xls'],
- placeholder: '请上传数据集'
- }
- },
- {
- label: '备注',
- prop: 'remarks',
- rules: [],
- compOptions: {
- placeholder: '请输入备注'
- }
- }
- ]
- const params = {
- title: '新增评估',
- width: 580,
- isEdit: true,
- itemsOptions: itemsOptions,
- model: newItem,
- api: addTrackSequenceApi,
- getTableList: proTable.value?.getTableList
- }
- formDialogRef.value?.openDialog(params)
- }
- const viewLogRef = ref()
- const enumsAlgorithmConfigTrack = ref<any>([])
- onMounted(async () => {
- const result = await enumAlgorithmConfigTrackApi()
- enumsAlgorithmConfigTrack.value = []
- const tmp_data: any = result['data']
- for (const item of tmp_data) {
- if (item.subsystem === SubSystem__['注释轨迹序列']) {
- item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
- enumsAlgorithmConfigTrack.value.push(item)
- }
- }
- })
- const openModelDialog = async id => {
- const result: any = await getLDetailTrackSequenceApi(id)
- // console.log(result.data)
- setItemsOptionsModel()
- const params = {
- title: '模型',
- width: 580,
- isEdit: false,
- itemsOptions: itemsOptions,
- model: result.data,
- api: updateTrackSequenceApi,
- getTableList: proTable.value?.getTableList
- }
- formDialogRef.value?.openDialog(params)
- }
- const startTrackSequence = async (params: any) => {
- const res: any = await startTrackSequenceApi(params.id)
- if (res.code === 200) {
- ElMessage.success('任务已开始,请等待完成!')
- } else {
- ElMessage.error('任务开始失败,请检查!')
- }
- proTable.value?.getTableList()
- }
- const stopTrackSequence = async (params: any) => {
- const res: any = await stopTrackSequenceApi(params.id)
- if (res.code === 200) {
- ElMessage.success('终止任务成功!')
- } else {
- ElMessage.error('终止任务失败,请检查!')
- }
- proTable.value?.getTableList()
- }
- const dowloadTrackSequence = async (params: any) => {
- await useDownload(dowloadTrackSequenceApi, params.name, params.id, true, '.zip')
- }
- // ProTable 实例
- const proTable = ref<ProTableInstance>()
- // 删除注视轨迹序列信息
- const deleteTrackSequence = async (params: any) => {
- await useHandleData(delTrackSequenceApi, params.id, '删除【' + params.id + '】注视轨迹序列')
- proTable.value?.getTableList()
- }
- // 批量删除注视轨迹序列信息
- const batchDelete = async (ids: string[]) => {
- await useHandleData(delTrackSequenceApi, ids, '删除所选注视轨迹序列信息')
- proTable.value?.clearSelection()
- proTable.value?.getTableList()
- }
- // 导出注视轨迹序列列表
- const downloadFile = async () => {
- ElMessageBox.confirm('确认导出注视轨迹序列数据?', '温馨提示', { type: 'warning' }).then(() =>
- useDownload(exportTrackSequenceApi, '注视轨迹序列列表', proTable.value?.searchParam)
- )
- }
- // 批量添加注视轨迹序列
- const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
- const batchAdd = () => {
- const params = {
- title: '注视轨迹序列',
- tempApi: importTemplateApi,
- importApi: importTrackSequenceDataApi,
- getTableList: proTable.value?.getTableList
- }
- dialogRef.value?.acceptParams(params)
- }
- const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
- // 打开弹框的功能
- const openDialog = async (type: number, title: string, row?: any) => {
- let res = { data: {} }
- if (row?.id) {
- res = await getTrackSequenceApi(row.id || null)
- const params = JSON.parse(res.data['algorithmParameters'])
- if (params.otherParams) {
- res.data = { ...res.data, ...params.otherParams }
- }
- }
- // 重置表单
- setItemsOptions()
- if (row?.id) {
- itemsOptions = await updateItemsOptions(row.algorithmId)
- }
- const params = {
- title,
- width: 580,
- isEdit: type !== 3,
- itemsOptions: itemsOptions,
- model: type == 1 ? {} : res.data,
- api: type == 1 ? addTrackSequenceApi : updateTrackSequenceApi,
- getTableList: proTable.value?.getTableList
- }
- formDialogRef.value?.openDialog(params)
- }
- // 表格配置项
- const columns = reactive<ColumnProps<any>[]>([
- { type: 'selection', fixed: 'left', width: 70 },
- { prop: 'id', label: '主键ID', width: 180 },
- {
- prop: 'name',
- label: '任务名称',
- search: {
- el: 'input'
- },
- width: 150
- },
- {
- prop: 'status',
- label: '任务状态',
- search: {
- el: 'select'
- },
- tag: true,
- enum: statusEnums,
- width: 150
- },
- {
- prop: 'type',
- label: '类型',
- tag: true,
- enum: enumsAlgorithmType,
- width: 120
- },
- {
- prop: 'subsystem',
- label: '分系统',
- tag: true,
- enum: enumsSubSystem,
- width: 200
- },
- {
- prop: 'algorithmName',
- label: '算法名称',
- width: 200
- },
- {
- prop: 'modelName',
- label: '模型名称',
- width: 200
- },
- {
- prop: 'algorithmParameters',
- label: '算法参数',
- search: {
- el: 'input'
- },
- width: 150
- },
- // {
- // prop: 'algorithmModelId',
- // label: '模型',
- // search: {
- // el: 'input'
- // },
- // width: 150
- // },
- {
- prop: 'startTime',
- label: '开始时间',
- width: 180
- },
- {
- prop: 'endTime',
- label: '结束时间',
- width: 180
- },
- {
- prop: 'costSecond',
- label: '耗时',
- width: 120
- },
- {
- prop: 'log',
- label: '日志',
- width: 120
- },
- {
- prop: 'outputPath',
- label: '输出路径',
- width: 120
- },
- {
- prop: 'remarks',
- label: '备注',
- search: {
- el: 'input'
- },
- width: 120
- },
- { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
- ])
- const remove_unnecessary_parameters = (itemsOptions: ProForm.ItemsOptions[]): ProForm.ItemsOptions[] => {
- try {
- const endIndex = itemsOptions.findIndex(option => option['label'] === '备注')
- if (endIndex !== -1) {
- itemsOptions = itemsOptions.slice(0, endIndex + 1)
- }
- return itemsOptions
- } catch (error) {
- console.error('移除不必要的参数时出错:', error)
- // ElMessage.error('移除不必要的参数时出错,请检查!');
- return itemsOptions // 返回原始选项,避免进一步的问题
- }
- }
- const updateItemsOptions = async (algorithmId: any) => {
- try {
- const result = await getAlgorithmConfigTrackApi(algorithmId)
- if (result.code === 200) {
- // 处理结果
- const parameters = JSON.parse(result.data['parameters'])
- // console.log('parameters: ', parameters)
- const itemsOptions_new = remove_unnecessary_parameters(itemsOptions)
- for (const item of parameters) {
- // 添加新的表单项选项
- itemsOptions_new.push({
- label: item['name'],
- prop: item['agName'],
- rules: [{ required: item['required'], message: item['agName'] + '不能为空', trigger: 'blur' }],
- tooltip: item['prompt'],
- compOptions: {
- elTagName: 'input',
- placeholder: item['defaultValue']
- // value: item['defaultValue']
- }
- })
- }
- formDialogRef.value?.updateItemOptions(itemsOptions_new)
- return itemsOptions_new
- }
- } catch (err) {
- console.log(err)
- ElMessage.error('获取算法配置失败,请检查!')
- }
- }
- // 表单配置项
- let itemsOptions: ProForm.ItemsOptions[] = []
- const setItemsOptions = () => {
- itemsOptions = [
- {
- label: '任务名称',
- prop: 'name',
- rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入任务名称'
- }
- },
- {
- label: '选择数据集',
- prop: 'inputOssId',
- rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择或者上传数据集',
- enum: datasetList,
- clearable: true
- }
- },
- {
- label: '上传数据集',
- prop: 'inputOssId',
- rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
- tooltip: zipFileDescDict.value['track_sequence'],
- compOptions: {
- elTagName: 'file-upload',
- fileSize: 4096,
- fileType: ['zip'],
- placeholder: '请上传数据集'
- }
- },
- {
- label: '选择算法',
- prop: 'algorithmId',
- rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择算法',
- enum: enumsAlgorithmConfigTrack,
- clearable: true,
- onChange: async (value: any) => {
- if (value != undefined && value != null && value != '') {
- await updateItemsOptions(value)
- }
- }
- }
- },
- {
- label: '任务类型',
- prop: 'type',
- rules: [{ required: true, message: '任务类型不能为空', trigger: 'blur' }],
- compOptions: {
- disabled: true,
- elTagName: 'select',
- placeholder: '请选择任务类型',
- enum: enumsAlgorithmType,
- clearable: true,
- value: ''
- },
- show: params => {
- if (params.value.algorithmId != undefined) {
- for (let i = 0; i < enumsAlgorithmConfigTrack.value.length; i++) {
- if (enumsAlgorithmConfigTrack.value[i]['value'] === params.value.algorithmId) {
- params.value.type = enumsAlgorithmConfigTrack.value[i]['type']
- return true
- }
- }
- }
- return false
- }
- },
- {
- label: '视觉模型',
- prop: 'algorithmModelId',
- rules: [{ required: false, message: '模型不能为空', trigger: 'blur' }],
- show: params => {
- if (params.value.type == AlgorithmType2['预测/推理']) {
- return true
- }
- params.value.algorithmModelId = ''
- return false
- },
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择模型',
- enum: enumsAlgorithmModelTrack,
- clearable: true
- }
- },
- {
- label: '目标检测模型',
- prop: 'algorithmModelTargetDetectionId',
- rules: [{ required: true, message: '目标检测模型不能为空', trigger: 'blur' }],
- show: params => {
- if (params.value.type == AlgorithmType2['预测/推理']) {
- return true
- }
- params.value.algorithmModelTargetDetectionId = ''
- return false
- },
- compOptions: {
- elTagName: 'select',
- placeholder: '请选择目标检测模型',
- enum: enumsAlgorithmModelTrack_TD,
- clearable: true
- }
- },
- {
- label: '上传标签',
- prop: 'inputLabelOssId',
- rules: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
- tooltip: zipFileDescDict.value['track_sequence_label'],
- show: params => {
- if (params.value.type == AlgorithmType2['测试']) {
- return true
- }
- return false
- },
- compOptions: {
- elTagName: 'file-upload',
- fileSize: 4096,
- fileType: ['txt', 'xlsx', 'xls'],
- placeholder: '请上传标签'
- }
- },
- {
- label: '备注',
- prop: 'remarks',
- rules: [],
- compOptions: {
- placeholder: '请输入备注'
- }
- }
- ]
- }
- const setItemsOptionsModel = () => {
- itemsOptions = [
- {
- label: '算法ID',
- prop: 'algorithmId',
- rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
- compOptions: {
- disabled: true,
- placeholder: '请输入算法'
- }
- },
- {
- label: '算法名称',
- prop: 'algorithmName',
- rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
- compOptions: {
- disabled: true,
- elTagName: 'select',
- placeholder: '请输入算法',
- enum: enumsAlgorithmConfigTrack
- }
- },
- {
- label: '算法参数',
- prop: 'parameterConfig',
- rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入模型名称'
- }
- },
- {
- label: '模型ID',
- prop: 'id',
- rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入模型名称'
- }
- },
- {
- label: '模型名称',
- prop: 'modelName',
- rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入模型名称'
- }
- },
- {
- label: '模型保存路径',
- prop: 'modelAddress',
- rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入模型名称'
- }
- },
- {
- label: '备注',
- prop: 'remarks',
- rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
- compOptions: {
- placeholder: '请输入备注'
- }
- }
- ]
- }
- const datasetList = ref<any>([])
- const getImageData = async (subsystem: string) => {
- const qyery = {
- subsystem: SubSystem__[subsystem],
- pageNum: 1,
- pageSize: 1000
- }
- const result: any = await listDataSeqApi(qyery)
- const data = result['data']['list']
- for (const item of data) {
- datasetList.value.push({
- value: item['inputOssId'],
- label: item['name'] + '-' + subsystem
- })
- }
- }
- onMounted(async () => {
- await getImageData('可见光转红外')
- await getImageData('目标检测')
- await getImageData('注释轨迹序列')
- })
- const enumsAlgorithmModelTrack = ref<any>([])
- const enumsAlgorithmModelTrack_TD = ref<any>([])
- const updateEnumsAlgorithmModelTrack = async () => {
- const result: any = await enumAlgorithmModelTrackApi()
- // console.log(result.data);
- enumsAlgorithmModelTrack.value = []
- for (const item of result.data) {
- if (item.type !== AlgorithmType2['预测/推理']) {
- continue
- }
- if (SubSystem[item['subsystem']] === '注释轨迹序列') {
- item['label'] =
- item['value'] + '_' + item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
- enumsAlgorithmModelTrack.value.push(item)
- }
- if (SubSystem[item['subsystem']] === '目标检测') {
- item['label'] =
- item['value'] + '_' + item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
- enumsAlgorithmModelTrack_TD.value.push(item)
- }
- }
- }
- onMounted(async () => {
- updateEnumsAlgorithmModelTrack()
- })
- </script>
- <style lang="scss" scoped>
- .evaluate-data {
- span {
- margin-bottom: 20px;
- font-size: 20px;
- line-height: 2;
- }
- }
- </style>
|