index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <!--
  2. @Date: 2024-10-29
  3. @Author: ©WANGKANG
  4. @Email: 1686617586@qq.com
  5. -->
  6. <template>
  7. <div class="table-box">
  8. <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listTrackSequenceApi">
  9. <!-- 表格 header 按钮 -->
  10. <template #tableHeader="scope">
  11. <el-button type="primary" v-auth="['demo:trackSequence:add']" icon="CirclePlus" @click="openDialog(1, '注视轨迹序列新增')">
  12. 新增(MASC)
  13. </el-button>
  14. <el-button type="primary" v-auth="['demo:trackSequence:add']" icon="CirclePlus" @click="addCATDialog()"> 新增(CAT) </el-button>
  15. <!-- <el-button type="primary" v-auth="['demo:trackSequence:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
  16. <el-button type="primary" v-auth="['demo:trackSequence:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button> -->
  17. <el-button
  18. type="danger"
  19. v-auth="['demo:trackSequence:remove']"
  20. icon="Delete"
  21. plain
  22. :disabled="!scope.isSelected"
  23. @click="batchDelete(scope.selectedListIds)"
  24. >
  25. 批量删除
  26. </el-button>
  27. </template>
  28. <!-- 表格操作 -->
  29. <template #operation="scope">
  30. <el-button type="primary" link icon="View" v-if="scope.row.algorithmModelId != null" @click="openModelDialog(scope.row.id)">
  31. <!--@click="openStartDialog(scope.row)" -->
  32. 详情
  33. </el-button>
  34. <el-button
  35. type="primary"
  36. link
  37. icon="View"
  38. v-auth="['demo:trackSequence:start']"
  39. v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '4'"
  40. @click="startTrackSequence(scope.row)"
  41. >
  42. 开始
  43. </el-button>
  44. <el-popconfirm title="确定终止此任务吗?" @confirm="stopTrackSequence(scope.row)" v-if="scope.row.status == '1'">
  45. <template #reference>
  46. <el-button type="primary" link icon="Delete"> 终止</el-button>
  47. </template>
  48. </el-popconfirm>
  49. <el-button
  50. type="primary"
  51. link
  52. icon="View"
  53. v-auth="['demo:toInfrared:query']"
  54. @click="viewLogRef.handleOpen(scope.row.id)"
  55. v-if="scope.row.status != '0'"
  56. >
  57. 日志
  58. </el-button>
  59. <el-button
  60. type="primary"
  61. link
  62. icon="View"
  63. v-auth="['demo:trackSequence:download']"
  64. v-if="scope.row.status == '2'"
  65. @click="dowloadTrackSequence(scope.row)"
  66. >
  67. 下载
  68. </el-button>
  69. <el-button
  70. type="primary"
  71. link
  72. icon="View"
  73. v-if="scope.row.status == '2' && scope.row.type === AlgorithmType2['预测/推理']"
  74. @click="showEvaluate(scope.row)"
  75. >
  76. 评估
  77. </el-button>
  78. <el-button
  79. type="primary"
  80. link
  81. icon="View"
  82. v-auth="['demo:ToInfrared:download']"
  83. v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['训练']"
  84. @click="showModelDialog(scope.row.id)"
  85. >
  86. 模型
  87. </el-button>
  88. <!-- <el-button type="primary" link icon="View" v-auth="['demo:toInfrared:query']" @click="openDialog(3, '查看', scope.row)"> 查看 </el-button> -->
  89. <!-- <el-button type="primary" link icon="EditPen"v-auth="['demo:toInfrared:edit']" @click="openDialog(2, '编辑', scope.row)"> 编辑 </el-button> -->
  90. <el-button
  91. type="primary"
  92. link
  93. icon="Delete"
  94. v-auth="['demo:toInfrared:remove']"
  95. @click="deleteTrackSequence(scope.row)"
  96. :disabled="scope.row.status == '1'"
  97. >
  98. 删除
  99. </el-button>
  100. </template>
  101. </ProTable>
  102. <FormDialog ref="formDialogRef" />
  103. <ImportExcel ref="dialogRef" />
  104. <ViewLog ref="viewLogRef" :get-log-api="getLogTrackSequenceApi" />
  105. <el-dialog v-model="showModelDialogVisible" title="模型列表" width="1000">
  106. <el-scrollbar ref="scrollbarRef" id="scrollbarRef1" height="500px">
  107. <template v-for="model in model_list" :key="model">
  108. <el-card style="width: 100%; margin-bottom: 10px">
  109. <el-form label-width="130px" label-position="left">
  110. <el-form-item label="Model Name">
  111. {{ model.name }}
  112. </el-form-item>
  113. <el-form-item label="Model Path">
  114. {{ model.path }}
  115. </el-form-item>
  116. <el-form-item label="Model Size">
  117. {{ model.size }}
  118. </el-form-item>
  119. <el-form-item label="操作">
  120. <el-link :href="model.url" type="primary" icon="Download" :underline="false" target="_blank" style="margin-right: 20px"
  121. >下载
  122. </el-link>
  123. <el-button type="success" link @click="addModel(model.path, model.name)"
  124. ><el-icon><Plus /></el-icon>添加模型</el-button
  125. >
  126. </el-form-item>
  127. </el-form>
  128. </el-card>
  129. </template>
  130. </el-scrollbar>
  131. </el-dialog>
  132. </div>
  133. </template>
  134. <script setup lang="tsx" name="TrackSequence">
  135. import { ref, reactive, onMounted } from 'vue'
  136. import { useHandleData } from '@/hooks/useHandleData'
  137. import { useDownload } from '@/hooks/useDownload'
  138. import { ElMessage, ElMessageBox } from 'element-plus'
  139. import ProTable from '@/components/ProTable/index.vue'
  140. import ImportExcel from '@/components/ImportExcel/index.vue'
  141. import FormDialog from '@/components/FormDialog/index.vue'
  142. import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
  143. import {
  144. listTrackSequenceApi,
  145. delTrackSequenceApi,
  146. addTrackSequenceApi,
  147. updateTrackSequenceApi,
  148. importTemplateApi,
  149. importTrackSequenceDataApi,
  150. exportTrackSequenceApi,
  151. getTrackSequenceApi,
  152. startTrackSequenceApi,
  153. stopTrackSequenceApi,
  154. dowloadTrackSequenceApi,
  155. getLogTrackSequenceApi,
  156. getLDetailTrackSequenceApi,
  157. addEvaluateTrackSequenceApi,
  158. showCATModelApi
  159. } from '@/api/modules/demo/trackSequence'
  160. import { enumAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
  161. import { getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
  162. import { enumAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
  163. import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
  164. import statusEnums from '@/utils/status'
  165. import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSystem, AlgorithmType2 } from '@/views/demo/utils'
  166. import ViewLog from '@/views/demo/components/ViewLog.vue'
  167. import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
  168. import { Status } from '@/views/demo/utils'
  169. const timerRefreshTable = ref()
  170. const clearTimerRefreshTable = () => {
  171. if (timerRefreshTable.value) {
  172. clearInterval(timerRefreshTable.value)
  173. }
  174. }
  175. const refreshTable = () => {
  176. clearTimerRefreshTable()
  177. timerRefreshTable.value = setInterval(async () => {
  178. await proTable.value?.getTableList(false)
  179. console.log('refresh table')
  180. const tableData = proTable.value?.tableData
  181. let flag = false
  182. if (tableData) {
  183. console.log(tableData)
  184. for (const item of tableData) {
  185. if (item.status === Status['运行中']) {
  186. flag = true
  187. break
  188. }
  189. }
  190. }
  191. if (!flag) {
  192. clearTimerRefreshTable()
  193. }
  194. }, 7000)
  195. }
  196. const enumsAlgorithmConfigTrack_addModel____ = ref<any>([])
  197. const setItemsOptions222 = async () => {
  198. console.log('setItemsOptions222')
  199. const result = await enumAlgorithmConfigTrackApi()
  200. enumsAlgorithmConfigTrack_addModel____.value = []
  201. const tmp_data: any = result['data']
  202. for (const item of tmp_data) {
  203. if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['预测/推理']) {
  204. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
  205. enumsAlgorithmConfigTrack_addModel____.value.push(item)
  206. }
  207. }
  208. console.log(enumsAlgorithmConfigTrack_addModel____.value)
  209. itemsOptions = [
  210. {
  211. label: '算法',
  212. prop: 'algorithmId',
  213. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  214. compOptions: {
  215. elTagName: 'select',
  216. placeholder: '请输入算法',
  217. enum: enumsAlgorithmConfigTrack_addModel____
  218. }
  219. },
  220. {
  221. label: '子系统',
  222. prop: 'subSystem',
  223. rules: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
  224. compOptions: {
  225. disabled: true,
  226. elTagName: 'select',
  227. placeholder: '请输入子系统',
  228. enum: enumsSubSystem
  229. }
  230. },
  231. {
  232. label: '模型名称',
  233. prop: 'modelName',
  234. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  235. compOptions: {
  236. disabled: true,
  237. placeholder: '请输入模型名称'
  238. }
  239. },
  240. {
  241. label: '模型路径',
  242. prop: 'modelPath',
  243. rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
  244. compOptions: {
  245. placeholder: '请输入模型名称',
  246. disabled: true
  247. }
  248. },
  249. {
  250. label: '备注',
  251. prop: 'remarks',
  252. rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
  253. compOptions: {
  254. placeholder: '请输入备注'
  255. }
  256. }
  257. ]
  258. }
  259. const addModel = async (modelPath: string, modelName: string) => {
  260. console.log(modelPath, modelName)
  261. let res = { data: { modelPath, subSystem: SubSystem__['目标检测'], type: AlgorithmType2['预测/推理'], modelName: modelName } }
  262. // 重置表单
  263. await setItemsOptions222()
  264. const params = {
  265. title: '添加模型',
  266. width: 580,
  267. isEdit: true,
  268. itemsOptions: itemsOptions,
  269. model: res.data,
  270. api: addAlgorithmModelTrackApi,
  271. getTableList: proTable.value?.getTableList,
  272. closedEvent: async () => {
  273. await updateEnumsAlgorithmModelTrack()
  274. }
  275. }
  276. formDialogRef.value?.openDialog(params)
  277. }
  278. const showModelDialogVisible = ref(false)
  279. const model_list: Ref<any> = ref([])
  280. const showModelDialog = async (id: any) => {
  281. const res: any = await showCATModelApi(id)
  282. model_list.value = res.data
  283. showModelDialogVisible.value = true
  284. }
  285. const setItemsOptionsAddCAT = () => {
  286. itemsOptions = [
  287. {
  288. label: '任务名称',
  289. prop: 'name',
  290. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  291. compOptions: {
  292. placeholder: '请输入任务名称'
  293. }
  294. },
  295. {
  296. label: '选择数据集',
  297. prop: 'inputOssId',
  298. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  299. compOptions: {
  300. elTagName: 'select',
  301. placeholder: '请选择或者上传数据集',
  302. enum: datasetList,
  303. clearable: true
  304. }
  305. },
  306. {
  307. label: '上传数据集',
  308. prop: 'inputOssId',
  309. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  310. compOptions: {
  311. elTagName: 'file-upload',
  312. fileSize: 4096,
  313. fileType: ['zip'],
  314. placeholder: '请上传数据集'
  315. }
  316. },
  317. {
  318. label: '选择模型',
  319. prop: 'algorithmModelId',
  320. rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
  321. compOptions: {
  322. elTagName: 'select',
  323. placeholder: '请选择模型',
  324. enum: enumsAlgorithmModelTrack_______.value
  325. }
  326. },
  327. {
  328. label: '备注',
  329. prop: 'remarks',
  330. rules: [],
  331. compOptions: {
  332. placeholder: '请输入备注'
  333. }
  334. }
  335. ]
  336. }
  337. const enumsAlgorithmModelTrack_______ = ref([])
  338. const addCATDialog = async () => {
  339. const result: any = await enumAlgorithmModelTrackApi()
  340. // console.log(result.data);
  341. enumsAlgorithmModelTrack_______.value = []
  342. for (const item of result.data) {
  343. if (SubSystem[item['subsystem']] === '注释轨迹序列' || SubSystem[item['subsystem']] === '目标检测') {
  344. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
  345. enumsAlgorithmModelTrack_______.value.push(item)
  346. }
  347. }
  348. // 重置表单
  349. setItemsOptionsAddCAT()
  350. const params = {
  351. title: '注释轨迹序列新增',
  352. width: 580,
  353. isEdit: true,
  354. itemsOptions: itemsOptions,
  355. model: {},
  356. api: addTrackSequenceApi,
  357. getTableList: proTable.value?.getTableList
  358. }
  359. formDialogRef.value?.openDialog(params)
  360. }
  361. const showEvaluate = (row: any) => {
  362. const newItem = {
  363. id: row.id
  364. }
  365. const enumsAlgorithmConfigTrack__: Array<any> = []
  366. for (const item of enumsAlgorithmConfigTrack.value) {
  367. if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['测试']) {
  368. enumsAlgorithmConfigTrack__.push(item)
  369. }
  370. }
  371. itemsOptions = [
  372. {
  373. label: '任务名称',
  374. prop: 'name',
  375. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  376. compOptions: {
  377. placeholder: '请输入任务名称'
  378. }
  379. },
  380. {
  381. label: '选择算法',
  382. prop: 'algorithmId',
  383. rules: [{ required: true, message: '请选择算法', trigger: 'blur' }],
  384. compOptions: {
  385. disabled: false,
  386. elTagName: 'select',
  387. placeholder: '请输入算法',
  388. enum: enumsAlgorithmConfigTrack__
  389. }
  390. },
  391. {
  392. label: '备注',
  393. prop: 'remarks',
  394. rules: [],
  395. compOptions: {
  396. placeholder: '请输入备注'
  397. }
  398. }
  399. ]
  400. const params = {
  401. title: '新增评估',
  402. width: 580,
  403. isEdit: true,
  404. itemsOptions: itemsOptions,
  405. model: newItem,
  406. api: addEvaluateTrackSequenceApi,
  407. getTableList: proTable.value?.getTableList
  408. }
  409. formDialogRef.value?.openDialog(params)
  410. }
  411. const viewLogRef = ref()
  412. const enumsAlgorithmConfigTrack = ref<any>([])
  413. onMounted(async () => {
  414. const result = await enumAlgorithmConfigTrackApi()
  415. enumsAlgorithmConfigTrack.value = []
  416. const tmp_data: any = result['data']
  417. for (const item of tmp_data) {
  418. if (item.subsystem === SubSystem__['注释轨迹序列']) {
  419. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
  420. enumsAlgorithmConfigTrack.value.push(item)
  421. }
  422. }
  423. })
  424. const openModelDialog = async id => {
  425. const result: any = await getLDetailTrackSequenceApi(id)
  426. // console.log(result.data)
  427. setItemsOptionsModel()
  428. const params = {
  429. title: '模型',
  430. width: 580,
  431. isEdit: false,
  432. itemsOptions: itemsOptions,
  433. model: result.data,
  434. api: updateTrackSequenceApi,
  435. getTableList: proTable.value?.getTableList
  436. }
  437. formDialogRef.value?.openDialog(params)
  438. }
  439. const startTrackSequence = async (params: any) => {
  440. const res: any = await startTrackSequenceApi(params.id)
  441. if (res.code === 200) {
  442. ElMessage.success('任务已开始,请等待完成!')
  443. } else {
  444. ElMessage.error('任务开始失败,请检查!')
  445. }
  446. refreshTable()
  447. }
  448. const stopTrackSequence = async (params: any) => {
  449. const res: any = await stopTrackSequenceApi(params.id)
  450. if (res.code === 200) {
  451. ElMessage.success('终止任务成功!')
  452. } else {
  453. ElMessage.error('终止任务失败,请检查!')
  454. }
  455. proTable.value?.getTableList()
  456. }
  457. const dowloadTrackSequence = async (params: any) => {
  458. await useDownload(dowloadTrackSequenceApi, params.name, params.id, true, '.zip')
  459. }
  460. // ProTable 实例
  461. const proTable = ref<ProTableInstance>()
  462. // 删除注视轨迹序列信息
  463. const deleteTrackSequence = async (params: any) => {
  464. await useHandleData(delTrackSequenceApi, params.id, '删除【' + params.id + '】注视轨迹序列')
  465. proTable.value?.getTableList()
  466. }
  467. // 批量删除注视轨迹序列信息
  468. const batchDelete = async (ids: string[]) => {
  469. await useHandleData(delTrackSequenceApi, ids, '删除所选注视轨迹序列信息')
  470. proTable.value?.clearSelection()
  471. proTable.value?.getTableList()
  472. }
  473. // 导出注视轨迹序列列表
  474. const downloadFile = async () => {
  475. ElMessageBox.confirm('确认导出注视轨迹序列数据?', '温馨提示', { type: 'warning' }).then(() =>
  476. useDownload(exportTrackSequenceApi, '注视轨迹序列列表', proTable.value?.searchParam)
  477. )
  478. }
  479. // 批量添加注视轨迹序列
  480. const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
  481. const batchAdd = () => {
  482. const params = {
  483. title: '注视轨迹序列',
  484. tempApi: importTemplateApi,
  485. importApi: importTrackSequenceDataApi,
  486. getTableList: proTable.value?.getTableList
  487. }
  488. dialogRef.value?.acceptParams(params)
  489. }
  490. const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
  491. // 打开弹框的功能
  492. const openDialog = async (type: number, title: string, row?: any) => {
  493. let res = { data: {} }
  494. if (row?.id) {
  495. res = await getTrackSequenceApi(row?.id || null)
  496. }
  497. // 重置表单
  498. setItemsOptions()
  499. const params = {
  500. title,
  501. width: 580,
  502. isEdit: type !== 3,
  503. itemsOptions: itemsOptions,
  504. model: type == 1 ? {} : res.data,
  505. api: type == 1 ? addTrackSequenceApi : updateTrackSequenceApi,
  506. getTableList: proTable.value?.getTableList
  507. }
  508. formDialogRef.value?.openDialog(params)
  509. }
  510. // 表格配置项
  511. const columns = reactive<ColumnProps<any>[]>([
  512. { type: 'selection', fixed: 'left', width: 70 },
  513. { prop: 'id', label: '主键ID', width: 180 },
  514. {
  515. prop: 'name',
  516. label: '任务名称',
  517. search: {
  518. el: 'input'
  519. },
  520. width: 150
  521. },
  522. {
  523. prop: 'status',
  524. label: '任务状态',
  525. search: {
  526. el: 'select'
  527. },
  528. tag: true,
  529. enum: statusEnums,
  530. width: 150
  531. },
  532. {
  533. prop: 'type',
  534. label: '类型',
  535. tag: true,
  536. enum: enumsAlgorithmType,
  537. width: 120
  538. },
  539. {
  540. prop: 'subsystem',
  541. label: '分系统',
  542. tag: true,
  543. enum: enumsSubSystem,
  544. width: 200
  545. },
  546. {
  547. prop: 'algorithmName',
  548. label: '算法名称',
  549. width: 200
  550. },
  551. {
  552. prop: 'modelName',
  553. label: '模型名称',
  554. width: 200
  555. },
  556. // {
  557. // prop: 'algorithmModelId',
  558. // label: '模型',
  559. // search: {
  560. // el: 'input'
  561. // },
  562. // width: 150
  563. // },
  564. {
  565. prop: 'startTime',
  566. label: '开始时间',
  567. width: 180
  568. },
  569. {
  570. prop: 'endTime',
  571. label: '结束时间',
  572. width: 180
  573. },
  574. {
  575. prop: 'costSecond',
  576. label: '耗时',
  577. width: 120
  578. },
  579. {
  580. prop: 'log',
  581. label: '日志',
  582. width: 120
  583. },
  584. {
  585. prop: 'outputPath',
  586. label: '输出路径',
  587. width: 120
  588. },
  589. {
  590. prop: 'remarks',
  591. label: '备注',
  592. search: {
  593. el: 'input'
  594. },
  595. width: 120
  596. },
  597. { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
  598. ])
  599. // 表单配置项
  600. let itemsOptions: ProForm.ItemsOptions[] = []
  601. const setItemsOptions = () => {
  602. itemsOptions = [
  603. {
  604. label: '任务名称',
  605. prop: 'name',
  606. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  607. compOptions: {
  608. placeholder: '请输入任务名称'
  609. }
  610. },
  611. {
  612. label: '选择数据集',
  613. prop: 'inputOssId',
  614. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  615. compOptions: {
  616. elTagName: 'select',
  617. placeholder: '请选择或者上传数据集',
  618. enum: datasetList,
  619. clearable: true
  620. }
  621. },
  622. {
  623. label: '上传数据集',
  624. prop: 'inputOssId',
  625. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  626. compOptions: {
  627. elTagName: 'file-upload',
  628. fileSize: 4096,
  629. fileType: ['zip'],
  630. placeholder: '请上传数据集'
  631. }
  632. },
  633. {
  634. label: '选择模型',
  635. prop: 'algorithmModelId',
  636. rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
  637. compOptions: {
  638. elTagName: 'select',
  639. placeholder: '请选择模型',
  640. enum: enumsAlgorithmModelTrack
  641. }
  642. },
  643. {
  644. label: '选择算法',
  645. prop: 'algorithmId',
  646. rules: [{ required: true, message: '请选择算法', trigger: 'blur' }],
  647. compOptions: {
  648. disabled: false,
  649. elTagName: 'select',
  650. placeholder: '请输入算法',
  651. enum: enumsAlgorithmConfigTrack
  652. }
  653. },
  654. {
  655. label: '备注',
  656. prop: 'remarks',
  657. rules: [],
  658. compOptions: {
  659. placeholder: '请输入备注'
  660. }
  661. }
  662. ]
  663. }
  664. const setItemsOptionsModel = () => {
  665. itemsOptions = [
  666. {
  667. label: '算法ID',
  668. prop: 'algorithmId',
  669. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  670. compOptions: {
  671. disabled: true,
  672. placeholder: '请输入算法'
  673. }
  674. },
  675. {
  676. label: '算法名称',
  677. prop: 'algorithmName',
  678. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  679. compOptions: {
  680. disabled: true,
  681. elTagName: 'select',
  682. placeholder: '请输入算法',
  683. enum: enumsAlgorithmConfigTrack
  684. }
  685. },
  686. {
  687. label: '算法参数',
  688. prop: 'parameterConfig',
  689. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  690. compOptions: {
  691. placeholder: '请输入模型名称'
  692. }
  693. },
  694. {
  695. label: '模型ID',
  696. prop: 'id',
  697. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  698. compOptions: {
  699. placeholder: '请输入模型名称'
  700. }
  701. },
  702. {
  703. label: '模型名称',
  704. prop: 'modelName',
  705. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  706. compOptions: {
  707. placeholder: '请输入模型名称'
  708. }
  709. },
  710. {
  711. label: '模型保存路径',
  712. prop: 'modelAddress',
  713. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  714. compOptions: {
  715. placeholder: '请输入模型名称'
  716. }
  717. },
  718. {
  719. label: '备注',
  720. prop: 'remarks',
  721. rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
  722. compOptions: {
  723. placeholder: '请输入备注'
  724. }
  725. }
  726. ]
  727. }
  728. const datasetList = ref<any>([])
  729. const geDatasetList = async (subsystem: string) => {
  730. const qyery = {
  731. subsystem: SubSystem__[subsystem],
  732. pageNum: 1,
  733. pageSize: 1000
  734. }
  735. const result: any = await listDataSeqApi(qyery)
  736. const data = result['data']['list']
  737. for (const item of data) {
  738. datasetList.value.push({
  739. value: item['inputOssId'],
  740. label: item['name']
  741. })
  742. }
  743. }
  744. onMounted(async () => {
  745. await geDatasetList('注释轨迹序列')
  746. await geDatasetList('目标检测')
  747. })
  748. const enumsAlgorithmModelTrack = ref<any>([])
  749. const updateEnumsAlgorithmModelTrack = async () => {
  750. const result: any = await enumAlgorithmModelTrackApi()
  751. // console.log(result.data);
  752. enumsAlgorithmModelTrack.value = []
  753. for (const item of result.data) {
  754. if (item.type !== AlgorithmType2['预测/推理']) {
  755. continue
  756. }
  757. if (SubSystem[item['subsystem']] === '注释轨迹序列' || SubSystem[item['subsystem']] === '目标检测') {
  758. item['label'] =
  759. item['value'] + '_' + item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
  760. enumsAlgorithmModelTrack.value.push(item)
  761. }
  762. }
  763. }
  764. onMounted(async () => {
  765. updateEnumsAlgorithmModelTrack()
  766. })
  767. </script>