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.

selectDataset.vue 38 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. <template>
  2. <div
  3. class="inline field"
  4. :class="{
  5. dataset_flex: confirmDatasetList && confirmFlag,
  6. required: required,
  7. margin_b_0: benchmarkNew,
  8. }"
  9. >
  10. <label
  11. v-if="benchmarkNew"
  12. class="label-fix-width"
  13. style="font-weight: normal"
  14. >{{i18n.dataset_label}}</label
  15. >
  16. <label v-else>{{i18n.dataset_label}}</label>
  17. <span
  18. :class="
  19. benchmarkNew === true ? 'dataset-train-span' : 'dataset-debug-span'
  20. "
  21. v-if="confirmDatasetList && confirmFlag"
  22. >
  23. <input type="hidden" name="attachment" :value="confirmDatasetList" />
  24. <div class="multi-dataset-box">
  25. <span
  26. v-for="(item, index) in confirmChecklist"
  27. :key="index"
  28. class="select-dataset-label"
  29. :title="item"
  30. style="padding: 0.2rem 0"
  31. >{{ item }};
  32. </span>
  33. </div>
  34. </span>
  35. <span v-else>
  36. <input
  37. v-if="benchmarkNew"
  38. type="text"
  39. class="disabled"
  40. style="width: 48.5%"
  41. :placeholder="i18n.dataset_select_placeholder"
  42. required
  43. />
  44. <input
  45. v-else
  46. type="text"
  47. class="disabled"
  48. :required="required"
  49. :placeholder="i18n.dataset_select_placeholder"
  50. />
  51. </span>
  52. <el-button
  53. type="text"
  54. @click="openDataset"
  55. icon="el-icon-plus"
  56. :class="
  57. confirmFlag && confirmDatasetList
  58. ? 'select-dataset-button'
  59. : 'select-dataset-button-color'
  60. "
  61. >{{i18n.dataset_select}}
  62. </el-button>
  63. <el-dialog
  64. :title="i18n.dataset_select"
  65. :visible.sync="dialogVisible"
  66. :width="dialogWidth"
  67. >
  68. <div class="ui icon input dataset-search-vue">
  69. <i
  70. class="search icon"
  71. style="cursor: pointer; pointer-events: auto"
  72. @click="searchName"
  73. ></i>
  74. <input
  75. type="text"
  76. :placeholder="i18n.dataset_search_placeholder"
  77. v-model="search"
  78. @keydown.enter.stop.prevent="searchName"
  79. />
  80. </div>
  81. <el-row>
  82. <el-col
  83. :span="17"
  84. style="
  85. padding-right: 1rem;
  86. border-right: 1px solid #f5f5f6;
  87. position: relative;
  88. "
  89. >
  90. <el-tabs v-model="activeName" @tab-click="handleClick">
  91. <!-- 当前项目的数据集 -->
  92. <el-tab-pane :label="i18n.dataset_current_repo" name="first" v-loading="loadingCurrent">
  93. <el-row>
  94. <el-tree
  95. :data="currentDatasetList"
  96. ref="currentTree"
  97. highlight-current
  98. show-checkbox
  99. node-key="id"
  100. :default-expanded-keys="initCurrentTreeNode"
  101. :props="defaultProps"
  102. :index="20"
  103. accordion
  104. @check="onCheck"
  105. >
  106. <span slot-scope="{ node, data }" class="slot-wrap">
  107. <span v-if="data.parent" class="custom-tree-node">
  108. <el-tooltip v-if="data.Description" placement="top-start">
  109. <div slot="content" class="multiple-wrap">
  110. {{ data.Description }}
  111. </div>
  112. <span class="dataset-title dataset-nowrap"
  113. ><div class="dataset_flex">
  114. <span
  115. style="flex: inherit"
  116. class="dataset-nowrap"
  117. >{{ node.label }}</span
  118. >
  119. <img
  120. v-if="data.Recommend"
  121. style="margin-left: 0.4rem"
  122. src="/img/jian.svg"
  123. />
  124. </div>
  125. </span>
  126. </el-tooltip>
  127. <span v-else class="dataset-title dataset-nowrap"
  128. ><div class="dataset_flex">
  129. <span style="flex: inherit" class="dataset-nowrap">{{
  130. node.label
  131. }}</span>
  132. <img
  133. v-if="data.Recommend"
  134. style="margin-left: 0.4rem"
  135. src="/img/jian.svg"
  136. />
  137. </div>
  138. </span>
  139. <span
  140. class="dataset-repolink dataset-nowrap"
  141. @click.stop="return false;"
  142. >
  143. <i
  144. class="ri-links-line"
  145. style="color: #21ba45; margin-right: 0.3rem"
  146. :title="i18n.dataset_relate"
  147. v-if="
  148. '/' + data.Repo.OwnerName + '/' + data.Repo.Name !==
  149. repoLink
  150. "
  151. ></i>
  152. <a
  153. :href="
  154. '/' +
  155. data.Repo.OwnerName +
  156. '/' +
  157. data.Repo.Name +
  158. '/datasets'
  159. "
  160. target="_blank"
  161. :title="data.Repo.OwnerName + '/' + data.Repo.Alias"
  162. >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a
  163. >
  164. </span>
  165. </span>
  166. <span v-else style="display: flex">
  167. <span class="dataset-nowrap" :title="node.label">
  168. {{ node.label }}
  169. </span>
  170. <span
  171. class="zip-loading"
  172. v-if="data.DecompressState === 2"
  173. >
  174. {{i18n.dataset_unziping}}
  175. </span>
  176. <span
  177. class="unzip-failed"
  178. v-if="data.DecompressState === 3"
  179. >
  180. {{i18n.dataset_unzip_failed}}
  181. </span>
  182. </span>
  183. </span>
  184. </el-tree>
  185. <div></div>
  186. </el-row>
  187. <div
  188. class="ui container"
  189. style="margin-top: 25px; text-align: center"
  190. >
  191. <el-pagination
  192. background
  193. @current-change="currentChangePage"
  194. :current-page="initCurrentPage"
  195. :page-size="5"
  196. layout="total, prev, pager, next"
  197. :total="totalNumCurrent"
  198. >
  199. </el-pagination>
  200. </div>
  201. </el-tab-pane>
  202. <!-- 我上传的数据集 -->
  203. <el-tab-pane :label="i18n.dataset_my_upload" name="second" v-loading="loadingMy">
  204. <el-row>
  205. <el-tree
  206. :data="myDatasetList"
  207. ref="myTree"
  208. highlight-current
  209. show-checkbox
  210. node-key="id"
  211. :default-expanded-keys="initMyTreeNode"
  212. :props="defaultProps"
  213. :index="20"
  214. accordion
  215. @check="onCheck"
  216. >
  217. <span slot-scope="{ node, data }" class="slot-wrap">
  218. <span v-if="data.parent" class="custom-tree-node">
  219. <el-tooltip v-if="data.Description" placement="top-start">
  220. <div slot="content" class="multiple-wrap">
  221. {{ data.Description }}
  222. </div>
  223. <span class="dataset-title dataset-nowrap"
  224. ><div class="dataset_flex">
  225. <span
  226. style="flex: inherit"
  227. class="dataset-nowrap"
  228. >{{ node.label }}</span
  229. >
  230. <img
  231. v-if="data.Recommend"
  232. style="margin-left: 0.4rem"
  233. src="/img/jian.svg"
  234. />
  235. </div>
  236. </span>
  237. </el-tooltip>
  238. <span v-else class="dataset-title dataset-nowrap"
  239. ><div class="dataset_flex">
  240. <span style="flex: inherit" class="dataset-nowrap">{{
  241. node.label
  242. }}</span>
  243. <img
  244. v-if="data.Recommend"
  245. style="margin-left: 0.4rem"
  246. src="/img/jian.svg"
  247. />
  248. </div>
  249. </span>
  250. <span
  251. class="dataset-repolink dataset-nowrap"
  252. @click.stop="return false;"
  253. >
  254. <a
  255. :href="
  256. '/' +
  257. data.Repo.OwnerName +
  258. '/' +
  259. data.Repo.Name +
  260. '/datasets'
  261. "
  262. target="_blank"
  263. :title="data.Repo.OwnerName + '/' + data.Repo.Alias"
  264. >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a
  265. >
  266. </span>
  267. </span>
  268. <span v-else style="display: flex">
  269. <span class="dataset-nowrap" :title="node.label">
  270. {{ node.label }}
  271. </span>
  272. <span
  273. class="zip-loading"
  274. v-if="data.DecompressState === 2"
  275. >
  276. {{i18n.dataset_unziping}}
  277. </span>
  278. <span
  279. class="unzip-failed"
  280. v-if="data.DecompressState === 3"
  281. >
  282. {{i18n.dataset_unzip_failed}}
  283. </span>
  284. </span>
  285. </span>
  286. </el-tree>
  287. <div></div>
  288. </el-row>
  289. <div
  290. class="ui container"
  291. style="margin-top: 25px; text-align: center"
  292. >
  293. <el-pagination
  294. background
  295. @current-change="myChangePage"
  296. :current-page="initMyPage"
  297. :page-size="5"
  298. layout="total, prev, pager, next"
  299. :total="totalNumMy"
  300. >
  301. </el-pagination>
  302. </div>
  303. </el-tab-pane>
  304. <!-- 公开的数据集 -->
  305. <el-tab-pane
  306. :label="i18n.dataset_public"
  307. name="third"
  308. v-loading="loadingPublic"
  309. >
  310. <el-row>
  311. <el-tree
  312. :data="publicDatasetList"
  313. ref="publicTree"
  314. highlight-current
  315. show-checkbox
  316. node-key="id"
  317. :default-expanded-keys="initPublicTreeNode"
  318. :props="defaultProps"
  319. :index="20"
  320. accordion
  321. @check="onCheck"
  322. >
  323. <span slot-scope="{ node, data }" class="slot-wrap">
  324. <span v-if="data.parent" class="custom-tree-node">
  325. <el-tooltip v-if="data.Description" placement="top-start">
  326. <div slot="content" class="multiple-wrap">
  327. {{ data.Description }}
  328. </div>
  329. <span class="dataset-title dataset-nowrap"
  330. ><div class="dataset_flex">
  331. <span
  332. style="flex: inherit"
  333. class="dataset-nowrap"
  334. >{{ node.label }}</span
  335. >
  336. <img
  337. v-if="data.Recommend"
  338. style="margin-left: 0.4rem"
  339. src="/img/jian.svg"
  340. />
  341. </div>
  342. </span>
  343. </el-tooltip>
  344. <span v-else class="dataset-title dataset-nowrap"
  345. ><div class="dataset_flex">
  346. <span style="flex: inherit" class="dataset-nowrap">{{
  347. node.label
  348. }}</span>
  349. <img
  350. v-if="data.Recommend"
  351. style="margin-left: 0.4rem"
  352. src="/img/jian.svg"
  353. />
  354. </div>
  355. </span>
  356. <span
  357. class="dataset-repolink dataset-nowrap"
  358. @click.stop="return false;"
  359. >
  360. <a
  361. :href="
  362. '/' +
  363. data.Repo.OwnerName +
  364. '/' +
  365. data.Repo.Name +
  366. '/datasets'
  367. "
  368. target="_blank"
  369. :title="data.Repo.OwnerName + '/' + data.Repo.Alias"
  370. >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a
  371. >
  372. </span>
  373. </span>
  374. <span v-else style="display: flex">
  375. <span class="dataset-nowrap" :title="node.label">
  376. {{ node.label }}
  377. </span>
  378. <span
  379. class="zip-loading"
  380. v-if="data.DecompressState === 2"
  381. >
  382. {{i18n.dataset_unziping}}
  383. </span>
  384. <span
  385. class="unzip-failed"
  386. v-if="data.DecompressState === 3"
  387. >
  388. {{i18n.dataset_unzip_failed}}
  389. </span>
  390. </span>
  391. </span>
  392. </el-tree>
  393. <div></div>
  394. </el-row>
  395. <div
  396. class="ui container"
  397. style="margin-top: 25px; text-align: center"
  398. >
  399. <el-pagination
  400. background
  401. @current-change="publicChangePage"
  402. :current-page="initPublicPage"
  403. :page-size="5"
  404. layout="total, prev, pager, next"
  405. :total="totalNumPublic"
  406. >
  407. </el-pagination>
  408. </div>
  409. </el-tab-pane>
  410. <!-- 我点赞的数据集 -->
  411. <el-tab-pane
  412. :label="i18n.dataset_collected"
  413. name="four"
  414. v-loading="loadingFavorite"
  415. >
  416. <el-row>
  417. <el-tree
  418. :data="MyFavoriteDatasetList"
  419. ref="favoriteTree"
  420. highlight-current
  421. show-checkbox
  422. node-key="id"
  423. :default-expanded-keys="initFavoriteTreeNode"
  424. :props="defaultProps"
  425. :index="20"
  426. accordion
  427. @check="onCheck"
  428. >
  429. <span slot-scope="{ node, data }" class="slot-wrap">
  430. <span v-if="data.parent" class="custom-tree-node">
  431. <el-tooltip v-if="data.Description" placement="top-start">
  432. <div slot="content" class="multiple-wrap">
  433. {{ data.Description }}
  434. </div>
  435. <span class="dataset-title dataset-nowrap"
  436. ><div class="dataset_flex">
  437. <span
  438. style="flex: inherit"
  439. class="dataset-nowrap"
  440. >{{ node.label }}</span
  441. >
  442. <img
  443. v-if="data.Recommend"
  444. style="margin-left: 0.4rem"
  445. src="/img/jian.svg"
  446. />
  447. </div>
  448. </span>
  449. </el-tooltip>
  450. <span v-else class="dataset-title dataset-nowrap"
  451. ><div class="dataset_flex">
  452. <span style="flex: inherit" class="dataset-nowrap">{{
  453. node.label
  454. }}</span>
  455. <img
  456. v-if="data.Recommend"
  457. style="margin-left: 0.4rem"
  458. src="/img/jian.svg"
  459. />
  460. </div>
  461. </span>
  462. <span
  463. class="dataset-repolink dataset-nowrap"
  464. @click.stop="return false;"
  465. >
  466. <a
  467. :href="
  468. '/' +
  469. data.Repo.OwnerName +
  470. '/' +
  471. data.Repo.Name +
  472. '/datasets'
  473. "
  474. target="_blank"
  475. :title="data.Repo.OwnerName + '/' + data.Repo.Alias"
  476. >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a
  477. >
  478. </span>
  479. </span>
  480. <span v-else style="display: flex">
  481. <span class="dataset-nowrap" :title="node.label">
  482. {{ node.label }}
  483. </span>
  484. <span
  485. class="zip-loading"
  486. v-if="data.DecompressState === 2"
  487. >
  488. {{i18n.dataset_unziping}}
  489. </span>
  490. <span
  491. class="unzip-failed"
  492. v-if="data.DecompressState === 3"
  493. >
  494. {{i18n.dataset_unzip_failed}}
  495. </span>
  496. </span>
  497. </span>
  498. </el-tree>
  499. <div></div>
  500. </el-row>
  501. <div
  502. class="ui container"
  503. style="margin-top: 25px; text-align: center"
  504. >
  505. <el-pagination
  506. background
  507. @current-change="favoriteChangePage"
  508. :current-page="initFavoritePage"
  509. :page-size="5"
  510. layout="total, prev, pager, next"
  511. :total="totalNumFavorite"
  512. >
  513. </el-pagination>
  514. </div>
  515. </el-tab-pane>
  516. </el-tabs>
  517. </el-col>
  518. <el-col
  519. :span="7"
  520. style="
  521. display: flex;
  522. flex-direction: column;
  523. height: 100%;
  524. right: 0;
  525. position: absolute;
  526. padding: 0 1.5rem;
  527. "
  528. >
  529. <div
  530. style="
  531. font-size: 14px;
  532. height: 40px;
  533. text-align: left;
  534. color: #0066ff;
  535. line-height: 40px;
  536. "
  537. >
  538. {{i18n.dataset_selected}}
  539. </div>
  540. <div style="flex: 1; margin-top: 1.5rem">
  541. <el-checkbox-group v-model="checkList">
  542. <el-checkbox
  543. v-for="(item, index) in selectDatasetArray"
  544. :key="index"
  545. :label="item.label"
  546. :title="item.label"
  547. @change="(checked) => changeCheckbox(checked, item)"
  548. ></el-checkbox>
  549. </el-checkbox-group>
  550. </div>
  551. <div style="text-align: end">
  552. <el-button
  553. @click.native="confirmDataset"
  554. size="small"
  555. style="
  556. background: #389e0d;
  557. color: #fff;
  558. border: 1px solid #389e0d;
  559. "
  560. >{{i18n.dataset_ok}}</el-button
  561. >
  562. </div>
  563. </el-col>
  564. </el-row>
  565. </el-dialog>
  566. </div>
  567. </template>
  568. <script>
  569. const { _AppSubUrl, _StaticUrlPrefix, csrf } = window.config;
  570. export default {
  571. components: {},
  572. data() {
  573. return {
  574. defaultProps: {
  575. children: "Attachments",
  576. label: "label",
  577. },
  578. dialogWidth: "65%",
  579. dialogVisible: false,
  580. benchmarkNew: false,
  581. imageAddress: "",
  582. activeName: "first",
  583. search: "",
  584. required: true,
  585. i18n: {},
  586. type: 0,
  587. repoLink: "",
  588. selectDatasetArray: [],
  589. checkList: [],
  590. confirmChecklist: [],
  591. confirmDatasetList: "",
  592. confirmFlag: false,
  593. saveStatusList: [],
  594. // 初始化已选择的数据集列表
  595. hasSelectDatasetList: [],
  596. //当前项目数据集页面配置的初始化
  597. initCurrentPage: 1,
  598. totalNumCurrent: 0,
  599. paramsCurrent: { page: 1, q: "" },
  600. currentDatasetList: [],
  601. loadingCurrent: false,
  602. initCurrentTreeNode: [],
  603. //我上传的数据集页面配置的初始化
  604. initMyPage: 1,
  605. totalNumMy: 0,
  606. paramsMy: { page: 1, q: "" },
  607. myDatasetList: [],
  608. loadingMy: false,
  609. initMyTreeNode: [],
  610. //公开的数据集页面配置的初始化
  611. initPublicPage: 1,
  612. totalNumPublic: 0,
  613. paramsPublics: { page: 1, q: "" },
  614. publicDatasetList: [],
  615. loadingPublic: false,
  616. initPublicTreeNode: [],
  617. //我点赞的数据集页面配置的初始化
  618. initFavoritePage: 1,
  619. totalNumFavorite: 0,
  620. MyFavoriteDatasetList: [],
  621. paramsFavorite: { page: 1, q: "" },
  622. loadingFavorite: false,
  623. initFavoriteTreeNode: [],
  624. };
  625. },
  626. methods: {
  627. openDataset() {
  628. this.dialogVisible = true;
  629. if (!this.confirmDatasetList) {
  630. this.confirmFlag = false;
  631. }
  632. this.getCurrentRepoDataset();
  633. },
  634. handleClick(tab, event) {
  635. this.search = "";
  636. if (tab.name == "first") {
  637. // this.paramsPublic.q = "";
  638. this.getCurrentRepoDataset();
  639. }
  640. if (tab.name == "second") {
  641. this.getMyUploadDataset();
  642. }
  643. if (tab.name == "third") {
  644. this.getPublicDataset();
  645. }
  646. if (tab.name == "four") {
  647. this.getMyFavoriteDataset();
  648. }
  649. },
  650. //tree 勾选触发事件
  651. onCheck(data, checkedInfo) {
  652. this.hasSelectDatasetList = [];
  653. if (
  654. this.selectDatasetArray.length === 0 ||
  655. this.selectDatasetArray.every((item) => item.id !== data.id)
  656. ) {
  657. if (
  658. this.selectDatasetArray.some((item) => {
  659. return item.label.split(".")[0] === data.label.split(".")[0];
  660. })
  661. ) {
  662. this.$refs[data.ref].setChecked(data.id, false, false);
  663. this.$message.warning(this.i18n.dataset_not_equal_file);
  664. } else if (this.selectDatasetArray.length === 5) {
  665. this.$refs[data.ref].setChecked(data.id, false, false);
  666. this.$message.error(this.i18n.dataset_most);
  667. } else {
  668. this.selectDatasetArray.push(data);
  669. }
  670. } else {
  671. let index = this.selectDatasetArray.findIndex((item) => {
  672. return item.id === data.id;
  673. });
  674. this.selectDatasetArray.splice(index, 1);
  675. }
  676. this.checkList = this.selectDatasetArray.map((item) => {
  677. return item.label;
  678. });
  679. this.saveStatusList = this.selectDatasetArray.map((item) => {
  680. return item.id;
  681. });
  682. },
  683. //已选择数据集checkbox group 勾选事件
  684. changeCheckbox(checked, data) {
  685. this.$refs.currentTree.setChecked(data.id, false, false);
  686. this.$refs.myTree.setChecked(data.id, false, false);
  687. this.$refs.publicTree.setChecked(data.id, false, false);
  688. this.$refs.favoriteTree.setChecked(data.id, false, false);
  689. let index = this.selectDatasetArray.findIndex((item) => {
  690. return item.id === data.id;
  691. });
  692. this.selectDatasetArray.splice(index, 1);
  693. this.saveStatusList.splice(index, 1);
  694. },
  695. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  696. if (rowIndex === 0) {
  697. return "background:#f5f5f6;color:#606266";
  698. }
  699. },
  700. currentChangePage(val) {
  701. this.paramsCurrent.page = val;
  702. this.getCurrentRepoDataset();
  703. },
  704. myChangePage(val) {
  705. this.paramsMy.page = val;
  706. this.getMyUploadDataset();
  707. },
  708. publicChangePage(val) {
  709. this.paramsPublics.page = val;
  710. this.getPublicDataset();
  711. },
  712. favoriteChangePage(val) {
  713. this.paramsFavorite.page = val;
  714. this.getMyFavoriteDataset();
  715. },
  716. getCurrentRepoDataset() {
  717. this.loadingCurrent = true;
  718. let url = this.repoLink + "/datasets/current_repo_m";
  719. this.paramsCurrent.type = this.type;
  720. this.$axios
  721. .get(url, {
  722. params: this.paramsCurrent,
  723. })
  724. .then((res) => {
  725. this.loadingCurrent = false;
  726. let data = JSON.parse(res.data.data);
  727. console.log(data);
  728. this.currentDatasetList = this.transformeTreeData(
  729. data,
  730. "currentTree",
  731. this.paramsCurrent.page
  732. );
  733. this.initCurrentTreeNode = this.currentDatasetList[0]?.id
  734. ? [this.currentDatasetList[0].id]
  735. : [];
  736. this.totalNumCurrent = parseInt(res.data.count);
  737. let setCheckedKeysList = this.currentDatasetList.reduce(
  738. (pre, cur) => {
  739. cur.Attachments.forEach((item) => {
  740. if (
  741. this.saveStatusList.includes(item.id) ||
  742. this.hasSelectDatasetList.includes(item.id)
  743. ) {
  744. pre.push(item.id);
  745. }
  746. });
  747. return pre;
  748. },
  749. []
  750. );
  751. this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
  752. })
  753. .catch((error) => {
  754. this.loadingCurrent = false;
  755. console.log(error);
  756. });
  757. },
  758. getMyUploadDataset() {
  759. this.loadingMy = true;
  760. let url = this.repoLink + "/datasets/my_datasets_m";
  761. this.paramsMy.type = this.type;
  762. this.$axios
  763. .get(url, {
  764. params: this.paramsMy,
  765. })
  766. .then((res) => {
  767. this.loadingMy = false;
  768. let data = JSON.parse(res.data.data);
  769. this.myDatasetList = this.transformeTreeData(
  770. data,
  771. "myTree",
  772. this.paramsMy.page
  773. );
  774. this.initMyTreeNode = this.myDatasetList[0]?.id
  775. ? [this.myDatasetList[0].id]
  776. : [];
  777. this.totalNumMy = parseInt(res.data.count);
  778. let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => {
  779. cur.Attachments.forEach((item) => {
  780. if (this.saveStatusList.includes(item.id)) {
  781. pre.push(item.id);
  782. }
  783. });
  784. return pre;
  785. }, []);
  786. this.$refs.myTree.setCheckedKeys(setCheckedKeysList);
  787. })
  788. .catch((error) => {
  789. console.log(error);
  790. });
  791. },
  792. getPublicDataset() {
  793. this.loadingPublic = true;
  794. let url = this.repoLink + "/datasets/public_datasets_m";
  795. this.paramsPublics.type = this.type;
  796. this.$axios
  797. .get(url, {
  798. params: this.paramsPublics,
  799. })
  800. .then((res) => {
  801. this.loadingPublic = false;
  802. let data = JSON.parse(res.data.data);
  803. this.publicDatasetList = this.transformeTreeData(
  804. data,
  805. "publicTree",
  806. this.paramsPublics.page
  807. );
  808. this.initPublicTreeNode = this.publicDatasetList[0]?.id
  809. ? [this.publicDatasetList[0].id]
  810. : [];
  811. this.totalNumPublic = parseInt(res.data.count);
  812. let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => {
  813. cur.Attachments.forEach((item) => {
  814. if (this.saveStatusList.includes(item.id)) {
  815. pre.push(item.id);
  816. }
  817. });
  818. return pre;
  819. }, []);
  820. this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
  821. })
  822. .catch((error) => {
  823. this.loadingPublic = false;
  824. console.log(error);
  825. });
  826. },
  827. getMyFavoriteDataset() {
  828. this.loadingFavorite = true;
  829. let url = this.repoLink + "/datasets/my_favorite_m";
  830. this.paramsFavorite.type = this.type;
  831. this.$axios
  832. .get(url, {
  833. params: this.paramsFavorite,
  834. })
  835. .then((res) => {
  836. this.loadingFavorite = false;
  837. let data = JSON.parse(res.data.data);
  838. this.MyFavoriteDatasetList = this.transformeTreeData(
  839. data,
  840. "favoriteTree",
  841. this.paramsFavorite.page
  842. );
  843. this.initFavoriteTreeNode = this.MyFavoriteDatasetList[0]?.id
  844. ? [this.MyFavoriteDatasetList[0].id]
  845. : [];
  846. this.totalNumFavorite = parseInt(res.data.count);
  847. let setCheckedKeysList = this.MyFavoriteDatasetList.reduce(
  848. (pre, cur) => {
  849. cur.Attachments.forEach((item) => {
  850. if (this.saveStatusList.includes(item.id)) {
  851. pre.push(item.id);
  852. }
  853. });
  854. return pre;
  855. },
  856. []
  857. );
  858. this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
  859. })
  860. .catch((error) => {
  861. this.loadingFavorite = false;
  862. console.log(error);
  863. });
  864. },
  865. transformeTreeData(data, ref, page) {
  866. return data.reduce((preParent, curParent) => {
  867. curParent.id = curParent.ID;
  868. curParent.disabled = true;
  869. curParent.parent = true;
  870. curParent.label = curParent.Title;
  871. let childrenData = curParent.Attachments.reduce(
  872. (preChild, curchild) => {
  873. curchild.id = curchild.UUID;
  874. if (curchild.DecompressState !== 1) {
  875. curchild.disabled = true;
  876. }
  877. curchild.ref = ref;
  878. curchild.label = curchild.Name;
  879. preChild.push(curchild);
  880. return preChild;
  881. },
  882. []
  883. );
  884. preParent.push(curParent);
  885. return preParent;
  886. }, []);
  887. },
  888. searchName() {
  889. if (this.activeName == "first") {
  890. this.paramsCurrent.q = this.search;
  891. this.paramsCurrent.page = 1;
  892. this.getCurrentRepoDataset();
  893. }
  894. if (this.activeName == "second") {
  895. this.paramsMy.q = this.search;
  896. this.paramsMy.page = 1;
  897. this.getMyUploadDataset();
  898. }
  899. if (this.activeName == "third") {
  900. this.paramsPublics.q = this.search;
  901. this.paramsPublics.page = 1;
  902. this.getPublicDataset();
  903. }
  904. if (this.activeName == "four") {
  905. this.paramsFavorite.q = this.search;
  906. this.paramsFavorite.page = 1;
  907. this.getMyFavoriteDataset();
  908. }
  909. return false;
  910. },
  911. confirmDataset() {
  912. this.confirmDatasetList = this.saveStatusList.join(";");
  913. this.confirmChecklist = this.checkList;
  914. this.dialogVisible = false;
  915. this.confirmFlag = true;
  916. },
  917. setDialogWidth() {
  918. const cWidth = document.body.clientWidth;
  919. if (cWidth > 1600) {
  920. this.dialogWidth = "1200px";
  921. } else if (cWidth < 1600 && 1200 < cWidth) {
  922. this.dialogWidth = "1127px";
  923. } else if (992 < cWidth && cWidth < 1200) {
  924. this.dialogWidth = "993px";
  925. } else {
  926. this.dialogWidth = "723px";
  927. }
  928. },
  929. },
  930. watch: {
  931. search(val) {
  932. if (!val) {
  933. switch (this.activeName) {
  934. case "first": {
  935. this.paramsCurrent.q = val;
  936. this.getCurrentRepoDataset();
  937. break;
  938. }
  939. case "second": {
  940. this.paramsMy.q = val;
  941. this.getMyUploadDataset();
  942. break;
  943. }
  944. case "third": {
  945. this.paramsPublics.q = val;
  946. this.getPublicDataset();
  947. break;
  948. }
  949. case "four": {
  950. this.paramsFavorite.q = val;
  951. this.getMyFavoriteDataset();
  952. break;
  953. }
  954. default:
  955. console.log("error");
  956. }
  957. }
  958. },
  959. },
  960. mounted() {
  961. this.type = $(".cloudbrain-type").data("cloudbrain-type");
  962. this.repoLink = $(".cloudbrain-type").data("repo-link");
  963. if ($(".cloudbrain-type").data("dataset-uuid")) {
  964. this.hasSelectDatasetList = $(".cloudbrain-type")
  965. .data("dataset-uuid")
  966. .split(";");
  967. let hasSelectDatasetName = $(".cloudbrain-type")
  968. .data("dataset-name")
  969. .split(";");
  970. if (this.hasSelectDatasetList.length !== 0) {
  971. this.saveStatusList = this.hasSelectDatasetList;
  972. this.checkList = hasSelectDatasetName;
  973. this.hasSelectDatasetList.forEach((item, index) => {
  974. this.selectDatasetArray.push({
  975. id: item,
  976. label: hasSelectDatasetName[index],
  977. });
  978. });
  979. }
  980. this.confirmDataset();
  981. }
  982. if (
  983. location.href.indexOf("benchmark") !== -1 ||
  984. location.href.indexOf("train-job") !== -1 ||
  985. location.href.indexOf("inference") !== -1
  986. ) {
  987. console.log("this.benchmarkNew");
  988. this.benchmarkNew = true;
  989. }
  990. if (
  991. location.href.indexOf("modelarts/notebook/create") !== -1 ||
  992. location.href.indexOf("/cloudbrain/create") !== -1
  993. ) {
  994. this.required = false;
  995. }
  996. window.onresize = () => {
  997. return (() => {
  998. this.setDialogWidth();
  999. })();
  1000. };
  1001. },
  1002. created() {
  1003. this.setDialogWidth();
  1004. if (document.documentElement.attributes["lang"].nodeValue == "en-US") {
  1005. this.i18n = this.$locale.US;
  1006. } else {
  1007. this.i18n = this.$locale.CN;
  1008. }
  1009. },
  1010. };
  1011. </script>
  1012. <style scoped>
  1013. .header-wrapper {
  1014. background-color: #f5f5f6;
  1015. padding-top: 15px;
  1016. }
  1017. .image_text {
  1018. padding: 25px 0 55px 0;
  1019. }
  1020. #header {
  1021. position: relative;
  1022. top: -40px;
  1023. }
  1024. #success {
  1025. background-color: #5bb973;
  1026. color: white;
  1027. }
  1028. .text-over {
  1029. overflow: hidden;
  1030. text-overflow: ellipsis;
  1031. vertical-align: middle;
  1032. white-space: nowrap;
  1033. }
  1034. .image_title {
  1035. display: inline-block;
  1036. width: 80%;
  1037. cursor: default;
  1038. color: rgb(66, 98, 144);
  1039. }
  1040. .image_desc {
  1041. -webkit-line-clamp: 2;
  1042. -webkit-box-orient: vertical;
  1043. display: -webkit-box;
  1044. text-overflow: ellipsis;
  1045. overflow: hidden;
  1046. }
  1047. .heart-stroke {
  1048. stroke: #666;
  1049. stroke-width: 2;
  1050. fill: #fff;
  1051. }
  1052. .stars_active {
  1053. fill: #fa8c16 !important;
  1054. stroke: #fa8c16 !important;
  1055. }
  1056. /deep/ .el-dialog__body {
  1057. position: relative;
  1058. }
  1059. .el-tree {
  1060. max-height: 400px;
  1061. overflow-y: auto;
  1062. overflow-x: hidden;
  1063. position: relative;
  1064. cursor: default;
  1065. background: #fff;
  1066. color: #606266;
  1067. font-family: SourceHanSansSC-medium;
  1068. }
  1069. .custom-tree-node {
  1070. display: flex;
  1071. align-items: center;
  1072. justify-content: space-between;
  1073. }
  1074. .custom-tree-node .dataset-title {
  1075. font-size: 14px;
  1076. color: #101010;
  1077. font-weight: 600;
  1078. flex: 1;
  1079. }
  1080. .custom-tree-node .dataset-repolink {
  1081. flex: 1;
  1082. text-align: right;
  1083. font-size: 12px;
  1084. }
  1085. .el-tree /deep/ .el-tree-node__content {
  1086. height: 40px;
  1087. background-color: #f5f5f6;
  1088. }
  1089. .el-tree /deep/ .el-tree-node__children .el-tree-node__content {
  1090. height: 30px;
  1091. background-color: #fff;
  1092. line-height: 20px;
  1093. font-size: 12px;
  1094. }
  1095. /deep/ .el-checkbox-group .el-checkbox {
  1096. max-width: 100%;
  1097. min-width: 80%;
  1098. }
  1099. /deep/ .el-checkbox-group .el-checkbox .el-checkbox__label {
  1100. max-width: 100%;
  1101. overflow: hidden;
  1102. vertical-align: middle;
  1103. text-overflow: ellipsis;
  1104. }
  1105. .dataset-nowrap {
  1106. overflow: hidden;
  1107. text-overflow: ellipsis;
  1108. }
  1109. .slot-wrap {
  1110. flex: 1;
  1111. padding-right: 2rem;
  1112. max-width: 93%;
  1113. }
  1114. .multiple-wrap {
  1115. -webkit-line-clamp: 3;
  1116. -webkit-box-orient: vertical;
  1117. display: -webkit-box;
  1118. max-width: 400px;
  1119. overflow: hidden;
  1120. }
  1121. .unzip-failed {
  1122. margin-left: 1rem;
  1123. color: red;
  1124. }
  1125. .zip-loading {
  1126. margin-left: 1rem;
  1127. color: #fcca00;
  1128. }
  1129. .dataset-search-vue {
  1130. z-index: 9999;
  1131. position: absolute;
  1132. right: 31%;
  1133. height: 30px;
  1134. top: 6px;
  1135. }
  1136. .select-dataset-label {
  1137. max-width: 100%;
  1138. overflow: hidden;
  1139. text-overflow: ellipsis;
  1140. margin-right: 1rem;
  1141. white-space: nowrap;
  1142. }
  1143. .dataset_flex {
  1144. display: flex;
  1145. align-items: center;
  1146. }
  1147. .dataset-debug-span {
  1148. display: inline-block;
  1149. width: 50%;
  1150. margin-left: 0.3rem;
  1151. }
  1152. .dataset-train-span {
  1153. display: inline-block;
  1154. width: 48.5%;
  1155. margin-left: 0.3rem;
  1156. }
  1157. .margin_b_0 {
  1158. margin-bottom: 0 !important;
  1159. }
  1160. .select-dataset-button {
  1161. margin-left: 0.3rem;
  1162. color: #0366d6;
  1163. }
  1164. .select-dataset-button-color {
  1165. color: #0366d6;
  1166. }
  1167. .multi-dataset-box {
  1168. border: 1px solid rgba(34, 36, 38, 0.15);
  1169. padding: 0.678571em 1em;
  1170. border-radius: 0.285714rem;
  1171. background: rgb(255, 255, 255);
  1172. display: flex;
  1173. flex-direction: column;
  1174. }
  1175. @media screen and (min-width: 1200px) and (max-width: 1600px) {
  1176. .dataset-search-vue {
  1177. top: -36px;
  1178. }
  1179. }
  1180. @media screen and (min-width: 1200px) and (max-width: 1400px) {
  1181. .multiple-wrap {
  1182. max-width: 200px;
  1183. }
  1184. }
  1185. </style>