You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.js 4.0 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /** Copyright 2020 Tianshu AI Platform. All Rights Reserved.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. * =============================================================
  15. */
  16. import { getEmptyFormatter, ALGORITHM_RESOURCE_ENUM } from '@/utils';
  17. import { algList } from '@/config';
  18. export function getColumns({
  19. doEdit,
  20. createTrain,
  21. doDownload,
  22. doFork,
  23. doDelete,
  24. active,
  25. allAlgorithmUsageList,
  26. isAdmin,
  27. }) {
  28. const data = JSON.parse(JSON.stringify(algList));
  29. data.forEach((item) => {
  30. item.label = item.auxInfo;
  31. item.value = item.id;
  32. });
  33. const dropdownList = data;
  34. const isPreset = active === String(ALGORITHM_RESOURCE_ENUM.PRESET);
  35. return [
  36. {
  37. label: 'ID',
  38. prop: 'id',
  39. width: 80,
  40. sortable: 'custom',
  41. fixed: true,
  42. hide: isPreset, // 预置算法隐藏 ID 列
  43. },
  44. {
  45. label: '名称',
  46. prop: 'algorithmName',
  47. fixed: true,
  48. minWidth: '160px',
  49. },
  50. {
  51. label: '模型类别',
  52. prop: 'algorithmUsage',
  53. formatter: getEmptyFormatter(),
  54. minWidth: '100px',
  55. // dropdownList: allAlgorithmUsageList,
  56. dropdownList: [
  57. {
  58. label: '全部',
  59. value: '',
  60. },
  61. {
  62. label: '健康状态',
  63. value: '健康状态',
  64. },
  65. {
  66. label: '安全预警',
  67. value: '安全预警',
  68. },
  69. {
  70. label: '异常检测',
  71. value: '异常检测',
  72. },
  73. {
  74. label: '其他',
  75. value: '其他',
  76. },
  77. ],
  78. },
  79. {
  80. label: '是否支持推理',
  81. prop: 'inference',
  82. formatter(value) {
  83. return value ? '支持' : '不支持';
  84. },
  85. minWidth: '140px',
  86. dropdownList: [
  87. {
  88. label: '全部',
  89. value: null,
  90. },
  91. {
  92. label: '支持',
  93. value: true,
  94. },
  95. {
  96. label: '不支持',
  97. value: false,
  98. },
  99. ],
  100. },
  101. {
  102. label: '描述',
  103. prop: 'description',
  104. minWidth: '200px',
  105. },
  106. {
  107. label: '创建时间',
  108. prop: 'createTime',
  109. type: 'time',
  110. minWidth: '160px',
  111. sortable: 'custom',
  112. },
  113. {
  114. label: '创建人',
  115. prop: 'originUserId',
  116. hide: !isAdmin,
  117. },
  118. {
  119. label: '操作',
  120. type: 'operation',
  121. width: '370px',
  122. fixed: 'right',
  123. operations: [
  124. {
  125. label: '在线编辑',
  126. func: doEdit,
  127. hide: isPreset,
  128. iconAfter: 'externallink',
  129. },
  130. {
  131. label: '创建训练任务',
  132. func: createTrain,
  133. },
  134. {
  135. label: '下载',
  136. func: doDownload,
  137. },
  138. {
  139. label: 'Fork',
  140. func: doFork,
  141. },
  142. {
  143. label: '删除',
  144. func: doDelete,
  145. hide: isPreset && !isAdmin,
  146. },
  147. ],
  148. },
  149. ];
  150. }
  151. export function getQueryFormItems({ active }) {
  152. return [
  153. {
  154. prop: 'algorithmName',
  155. placeholder:
  156. active === String(ALGORITHM_RESOURCE_ENUM.PRESET)
  157. ? '请输入算法名称'
  158. : '请输入算法名称或 ID',
  159. class: 'w-200',
  160. change: 'query',
  161. },
  162. {
  163. type: 'button',
  164. btnText: '重置',
  165. func: 'resetQuery',
  166. },
  167. {
  168. type: 'button',
  169. btnText: '搜索',
  170. btnType: 'primary',
  171. func: 'query',
  172. },
  173. ];
  174. }

一站式算法开发平台、高性能分布式深度学习框架、先进算法模型库、视觉模型炼知平台、数据可视化分析平台等一系列平台及工具,在模型高效分布式训练、数据处理和可视分析、模型炼知和轻量化等技术上形成独特优势,目前已在产学研等各领域近千家单位及个人提供AI应用赋能