index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  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 useWebSocketStore from '@/stores/modules/websocket'
  169. import { resetHeart } from '@/utils/websocket'
  170. onMounted(() => {
  171. const websocketStore = useWebSocketStore()
  172. websocketStore.websocket.onmessage = (e: any) => {
  173. if (e.data.indexOf('heartbeat') > 0) {
  174. resetHeart()
  175. }
  176. if (e.data.indexOf('ping') > 0) {
  177. return
  178. }
  179. // console.log(e)
  180. proTable.value?.getTableList(true)
  181. }
  182. })
  183. const enumsAlgorithmConfigTrack_addModel____ = ref<any>([])
  184. const setItemsOptions222 = async () => {
  185. console.log('setItemsOptions222')
  186. const result = await enumAlgorithmConfigTrackApi()
  187. enumsAlgorithmConfigTrack_addModel____.value = []
  188. const tmp_data: any = result['data']
  189. for (const item of tmp_data) {
  190. if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['预测/推理']) {
  191. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
  192. enumsAlgorithmConfigTrack_addModel____.value.push(item)
  193. }
  194. }
  195. console.log(enumsAlgorithmConfigTrack_addModel____.value)
  196. itemsOptions = [
  197. {
  198. label: '算法',
  199. prop: 'algorithmId',
  200. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  201. compOptions: {
  202. elTagName: 'select',
  203. placeholder: '请输入算法',
  204. enum: enumsAlgorithmConfigTrack_addModel____
  205. }
  206. },
  207. {
  208. label: '子系统',
  209. prop: 'subSystem',
  210. rules: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
  211. compOptions: {
  212. disabled: true,
  213. elTagName: 'select',
  214. placeholder: '请输入子系统',
  215. enum: enumsSubSystem
  216. }
  217. },
  218. {
  219. label: '模型名称',
  220. prop: 'modelName',
  221. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  222. compOptions: {
  223. disabled: true,
  224. placeholder: '请输入模型名称'
  225. }
  226. },
  227. {
  228. label: '模型路径',
  229. prop: 'modelPath',
  230. rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
  231. compOptions: {
  232. placeholder: '请输入模型名称',
  233. disabled: true
  234. }
  235. },
  236. {
  237. label: '备注',
  238. prop: 'remarks',
  239. rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
  240. compOptions: {
  241. placeholder: '请输入备注'
  242. }
  243. }
  244. ]
  245. }
  246. const addModel = async (modelPath: string, modelName: string) => {
  247. console.log(modelPath, modelName)
  248. let res = { data: { modelPath, subSystem: SubSystem__['目标检测'], type: AlgorithmType2['预测/推理'], modelName: modelName } }
  249. // 重置表单
  250. await setItemsOptions222()
  251. const params = {
  252. title: '添加模型',
  253. width: 580,
  254. isEdit: true,
  255. itemsOptions: itemsOptions,
  256. model: res.data,
  257. api: addAlgorithmModelTrackApi,
  258. getTableList: proTable.value?.getTableList,
  259. closedEvent: async () => {
  260. await updateEnumsAlgorithmModelTrack()
  261. }
  262. }
  263. formDialogRef.value?.openDialog(params)
  264. }
  265. const showModelDialogVisible = ref(false)
  266. const model_list: Ref<any> = ref([])
  267. const showModelDialog = async (id: any) => {
  268. const res: any = await showCATModelApi(id)
  269. model_list.value = res.data
  270. showModelDialogVisible.value = true
  271. }
  272. const setItemsOptionsAddCAT = () => {
  273. itemsOptions = [
  274. {
  275. label: '任务名称',
  276. prop: 'name',
  277. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  278. compOptions: {
  279. placeholder: '请输入任务名称'
  280. }
  281. },
  282. {
  283. label: '选择数据集',
  284. prop: 'inputOssId',
  285. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  286. compOptions: {
  287. elTagName: 'select',
  288. placeholder: '请选择或者上传数据集',
  289. enum: datasetList,
  290. clearable: true
  291. }
  292. },
  293. {
  294. label: '上传数据集',
  295. prop: 'inputOssId',
  296. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  297. compOptions: {
  298. elTagName: 'file-upload',
  299. fileSize: 4096,
  300. fileType: ['zip'],
  301. placeholder: '请上传数据集'
  302. }
  303. },
  304. {
  305. label: '选择模型',
  306. prop: 'algorithmModelId',
  307. rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
  308. compOptions: {
  309. elTagName: 'select',
  310. placeholder: '请选择模型',
  311. enum: enumsAlgorithmModelTrack_______.value
  312. }
  313. },
  314. {
  315. label: '备注',
  316. prop: 'remarks',
  317. rules: [],
  318. compOptions: {
  319. placeholder: '请输入备注'
  320. }
  321. }
  322. ]
  323. }
  324. const enumsAlgorithmModelTrack_______ = ref([])
  325. const addCATDialog = async () => {
  326. const result: any = await enumAlgorithmModelTrackApi()
  327. // console.log(result.data);
  328. enumsAlgorithmModelTrack_______.value = []
  329. for (const item of result.data) {
  330. if (SubSystem[item['subsystem']] === '注释轨迹序列' || SubSystem[item['subsystem']] === '目标检测') {
  331. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
  332. enumsAlgorithmModelTrack_______.value.push(item)
  333. }
  334. }
  335. // 重置表单
  336. setItemsOptionsAddCAT()
  337. const params = {
  338. title: '注释轨迹序列新增',
  339. width: 580,
  340. isEdit: true,
  341. itemsOptions: itemsOptions,
  342. model: {},
  343. api: addTrackSequenceApi,
  344. getTableList: proTable.value?.getTableList
  345. }
  346. formDialogRef.value?.openDialog(params)
  347. }
  348. const showEvaluate = (row: any) => {
  349. const newItem = {
  350. id: row.id
  351. }
  352. const enumsAlgorithmConfigTrack__: Array<any> = []
  353. for (const item of enumsAlgorithmConfigTrack.value) {
  354. if (item.subsystem === SubSystem__['注释轨迹序列'] && item.type === AlgorithmType2['测试']) {
  355. enumsAlgorithmConfigTrack__.push(item)
  356. }
  357. }
  358. itemsOptions = [
  359. {
  360. label: '任务名称',
  361. prop: 'name',
  362. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  363. compOptions: {
  364. placeholder: '请输入任务名称'
  365. }
  366. },
  367. {
  368. label: '选择算法',
  369. prop: 'algorithmId',
  370. rules: [{ required: true, message: '请选择算法', trigger: 'blur' }],
  371. compOptions: {
  372. disabled: false,
  373. elTagName: 'select',
  374. placeholder: '请输入算法',
  375. enum: enumsAlgorithmConfigTrack__
  376. }
  377. },
  378. {
  379. label: '备注',
  380. prop: 'remarks',
  381. rules: [],
  382. compOptions: {
  383. placeholder: '请输入备注'
  384. }
  385. }
  386. ]
  387. const params = {
  388. title: '新增评估',
  389. width: 580,
  390. isEdit: true,
  391. itemsOptions: itemsOptions,
  392. model: newItem,
  393. api: addEvaluateTrackSequenceApi,
  394. getTableList: proTable.value?.getTableList
  395. }
  396. formDialogRef.value?.openDialog(params)
  397. }
  398. const viewLogRef = ref()
  399. const enumsAlgorithmConfigTrack = ref<any>([])
  400. onMounted(async () => {
  401. const result = await enumAlgorithmConfigTrackApi()
  402. enumsAlgorithmConfigTrack.value = []
  403. const tmp_data: any = result['data']
  404. for (const item of tmp_data) {
  405. if (item.subsystem === SubSystem__['注释轨迹序列']) {
  406. item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
  407. enumsAlgorithmConfigTrack.value.push(item)
  408. }
  409. }
  410. })
  411. const openModelDialog = async id => {
  412. const result: any = await getLDetailTrackSequenceApi(id)
  413. // console.log(result.data)
  414. setItemsOptionsModel()
  415. const params = {
  416. title: '模型',
  417. width: 580,
  418. isEdit: false,
  419. itemsOptions: itemsOptions,
  420. model: result.data,
  421. api: updateTrackSequenceApi,
  422. getTableList: proTable.value?.getTableList
  423. }
  424. formDialogRef.value?.openDialog(params)
  425. }
  426. const startTrackSequence = async (params: any) => {
  427. const res: any = await startTrackSequenceApi(params.id)
  428. if (res.code === 200) {
  429. ElMessage.success('任务已开始,请等待完成!')
  430. } else {
  431. ElMessage.error('任务开始失败,请检查!')
  432. }
  433. proTable.value?.getTableList()
  434. }
  435. const stopTrackSequence = async (params: any) => {
  436. const res: any = await stopTrackSequenceApi(params.id)
  437. if (res.code === 200) {
  438. ElMessage.success('终止任务成功!')
  439. } else {
  440. ElMessage.error('终止任务失败,请检查!')
  441. }
  442. proTable.value?.getTableList()
  443. }
  444. const dowloadTrackSequence = async (params: any) => {
  445. await useDownload(dowloadTrackSequenceApi, params.name, params.id, true, '.zip')
  446. }
  447. // ProTable 实例
  448. const proTable = ref<ProTableInstance>()
  449. // 删除注视轨迹序列信息
  450. const deleteTrackSequence = async (params: any) => {
  451. await useHandleData(delTrackSequenceApi, params.id, '删除【' + params.id + '】注视轨迹序列')
  452. proTable.value?.getTableList()
  453. }
  454. // 批量删除注视轨迹序列信息
  455. const batchDelete = async (ids: string[]) => {
  456. await useHandleData(delTrackSequenceApi, ids, '删除所选注视轨迹序列信息')
  457. proTable.value?.clearSelection()
  458. proTable.value?.getTableList()
  459. }
  460. // 导出注视轨迹序列列表
  461. const downloadFile = async () => {
  462. ElMessageBox.confirm('确认导出注视轨迹序列数据?', '温馨提示', { type: 'warning' }).then(() =>
  463. useDownload(exportTrackSequenceApi, '注视轨迹序列列表', proTable.value?.searchParam)
  464. )
  465. }
  466. // 批量添加注视轨迹序列
  467. const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
  468. const batchAdd = () => {
  469. const params = {
  470. title: '注视轨迹序列',
  471. tempApi: importTemplateApi,
  472. importApi: importTrackSequenceDataApi,
  473. getTableList: proTable.value?.getTableList
  474. }
  475. dialogRef.value?.acceptParams(params)
  476. }
  477. const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
  478. // 打开弹框的功能
  479. const openDialog = async (type: number, title: string, row?: any) => {
  480. let res = { data: {} }
  481. if (row?.id) {
  482. res = await getTrackSequenceApi(row?.id || null)
  483. }
  484. // 重置表单
  485. setItemsOptions()
  486. const params = {
  487. title,
  488. width: 580,
  489. isEdit: type !== 3,
  490. itemsOptions: itemsOptions,
  491. model: type == 1 ? {} : res.data,
  492. api: type == 1 ? addTrackSequenceApi : updateTrackSequenceApi,
  493. getTableList: proTable.value?.getTableList
  494. }
  495. formDialogRef.value?.openDialog(params)
  496. }
  497. // 表格配置项
  498. const columns = reactive<ColumnProps<any>[]>([
  499. { type: 'selection', fixed: 'left', width: 70 },
  500. { prop: 'id', label: '主键ID', width: 180 },
  501. {
  502. prop: 'name',
  503. label: '任务名称',
  504. search: {
  505. el: 'input'
  506. },
  507. width: 150
  508. },
  509. {
  510. prop: 'status',
  511. label: '任务状态',
  512. search: {
  513. el: 'select'
  514. },
  515. tag: true,
  516. enum: statusEnums,
  517. width: 150
  518. },
  519. {
  520. prop: 'type',
  521. label: '类型',
  522. tag: true,
  523. enum: enumsAlgorithmType,
  524. width: 120
  525. },
  526. {
  527. prop: 'subsystem',
  528. label: '分系统',
  529. tag: true,
  530. enum: enumsSubSystem,
  531. width: 200
  532. },
  533. {
  534. prop: 'algorithmName',
  535. label: '算法名称',
  536. width: 200
  537. },
  538. {
  539. prop: 'modelName',
  540. label: '模型名称',
  541. width: 200
  542. },
  543. // {
  544. // prop: 'algorithmModelId',
  545. // label: '模型',
  546. // search: {
  547. // el: 'input'
  548. // },
  549. // width: 150
  550. // },
  551. {
  552. prop: 'startTime',
  553. label: '开始时间',
  554. width: 180
  555. },
  556. {
  557. prop: 'endTime',
  558. label: '结束时间',
  559. width: 180
  560. },
  561. {
  562. prop: 'costSecond',
  563. label: '耗时',
  564. width: 120
  565. },
  566. {
  567. prop: 'log',
  568. label: '日志',
  569. width: 120
  570. },
  571. {
  572. prop: 'outputPath',
  573. label: '输出路径',
  574. width: 120
  575. },
  576. {
  577. prop: 'remarks',
  578. label: '备注',
  579. search: {
  580. el: 'input'
  581. },
  582. width: 120
  583. },
  584. { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
  585. ])
  586. // 表单配置项
  587. let itemsOptions: ProForm.ItemsOptions[] = []
  588. const setItemsOptions = () => {
  589. itemsOptions = [
  590. {
  591. label: '任务名称',
  592. prop: 'name',
  593. rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
  594. compOptions: {
  595. placeholder: '请输入任务名称'
  596. }
  597. },
  598. {
  599. label: '选择数据集',
  600. prop: 'inputOssId',
  601. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  602. compOptions: {
  603. elTagName: 'select',
  604. placeholder: '请选择或者上传数据集',
  605. enum: datasetList,
  606. clearable: true
  607. }
  608. },
  609. {
  610. label: '上传数据集',
  611. prop: 'inputOssId',
  612. rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
  613. compOptions: {
  614. elTagName: 'file-upload',
  615. fileSize: 4096,
  616. fileType: ['zip'],
  617. placeholder: '请上传数据集'
  618. }
  619. },
  620. {
  621. label: '选择模型',
  622. prop: 'algorithmModelId',
  623. rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
  624. compOptions: {
  625. elTagName: 'select',
  626. placeholder: '请选择模型',
  627. enum: enumsAlgorithmModelTrack
  628. }
  629. },
  630. {
  631. label: '选择算法',
  632. prop: 'algorithmId',
  633. rules: [{ required: true, message: '请选择算法', trigger: 'blur' }],
  634. compOptions: {
  635. disabled: false,
  636. elTagName: 'select',
  637. placeholder: '请输入算法',
  638. enum: enumsAlgorithmConfigTrack
  639. }
  640. },
  641. {
  642. label: '备注',
  643. prop: 'remarks',
  644. rules: [],
  645. compOptions: {
  646. placeholder: '请输入备注'
  647. }
  648. }
  649. ]
  650. }
  651. const setItemsOptionsModel = () => {
  652. itemsOptions = [
  653. {
  654. label: '算法ID',
  655. prop: 'algorithmId',
  656. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  657. compOptions: {
  658. disabled: true,
  659. placeholder: '请输入算法'
  660. }
  661. },
  662. {
  663. label: '算法名称',
  664. prop: 'algorithmName',
  665. rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
  666. compOptions: {
  667. disabled: true,
  668. elTagName: 'select',
  669. placeholder: '请输入算法',
  670. enum: enumsAlgorithmConfigTrack
  671. }
  672. },
  673. {
  674. label: '算法参数',
  675. prop: 'parameterConfig',
  676. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  677. compOptions: {
  678. placeholder: '请输入模型名称'
  679. }
  680. },
  681. {
  682. label: '模型ID',
  683. prop: 'id',
  684. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  685. compOptions: {
  686. placeholder: '请输入模型名称'
  687. }
  688. },
  689. {
  690. label: '模型名称',
  691. prop: 'modelName',
  692. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  693. compOptions: {
  694. placeholder: '请输入模型名称'
  695. }
  696. },
  697. {
  698. label: '模型保存路径',
  699. prop: 'modelAddress',
  700. rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
  701. compOptions: {
  702. placeholder: '请输入模型名称'
  703. }
  704. },
  705. {
  706. label: '备注',
  707. prop: 'remarks',
  708. rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
  709. compOptions: {
  710. placeholder: '请输入备注'
  711. }
  712. }
  713. ]
  714. }
  715. const datasetList = ref<any>([])
  716. const geDatasetList = async (subsystem: string) => {
  717. const qyery = {
  718. subsystem: SubSystem__[subsystem],
  719. pageNum: 1,
  720. pageSize: 1000
  721. }
  722. const result: any = await listDataSeqApi(qyery)
  723. const data = result['data']['list']
  724. for (const item of data) {
  725. datasetList.value.push({
  726. value: item['inputOssId'],
  727. label: item['name']
  728. })
  729. }
  730. }
  731. onMounted(async () => {
  732. await geDatasetList('注释轨迹序列')
  733. await geDatasetList('目标检测')
  734. })
  735. const enumsAlgorithmModelTrack = ref<any>([])
  736. const updateEnumsAlgorithmModelTrack = async () => {
  737. const result: any = await enumAlgorithmModelTrackApi()
  738. // console.log(result.data);
  739. enumsAlgorithmModelTrack.value = []
  740. for (const item of result.data) {
  741. if (item.type !== AlgorithmType2['预测/推理']) {
  742. continue
  743. }
  744. if (SubSystem[item['subsystem']] === '注释轨迹序列' || SubSystem[item['subsystem']] === '目标检测') {
  745. item['label'] =
  746. item['value'] + '_' + item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']] + '-' + item['algorithmName']
  747. enumsAlgorithmModelTrack.value.push(item)
  748. }
  749. }
  750. }
  751. onMounted(async () => {
  752. updateEnumsAlgorithmModelTrack()
  753. })
  754. </script>