index.vue 22 KB

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