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 37 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
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  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. >数据集</label
  15. >
  16. <label v-else>数据集</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="选择数据集文件"
  42. required
  43. />
  44. <input
  45. v-else
  46. type="text"
  47. class="disabled"
  48. :required="required"
  49. 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. >选择数据集
  62. </el-button>
  63. <el-dialog
  64. title="选择数据集"
  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="搜数据集名称/描述..."
  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="本项目" 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="关联数据集"
  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. 正在解压缩
  175. </span>
  176. <span
  177. class="unzip-failed"
  178. v-if="data.DecompressState === 3"
  179. >
  180. 解压失败
  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="我上传的" 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. 正在解压缩
  277. </span>
  278. <span
  279. class="unzip-failed"
  280. v-if="data.DecompressState === 3"
  281. >
  282. 解压失败
  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="公开数据集"
  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. 正在解压缩
  383. </span>
  384. <span
  385. class="unzip-failed"
  386. v-if="data.DecompressState === 3"
  387. >
  388. 解压失败
  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="我收藏的"
  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. 正在解压缩
  489. </span>
  490. <span
  491. class="unzip-failed"
  492. v-if="data.DecompressState === 3"
  493. >
  494. 解压失败
  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. 已选数据文件
  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. >确定</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. type: 0,
  586. repoLink: "",
  587. selectDatasetArray: [],
  588. checkList: [],
  589. confirmChecklist: [],
  590. confirmDatasetList: "",
  591. confirmFlag: false,
  592. saveStatusList: [],
  593. //当前项目数据集页面配置的初始化
  594. initCurrentPage: 1,
  595. totalNumCurrent: 0,
  596. paramsCurrent: { page: 1, q: "" },
  597. currentDatasetList: [],
  598. loadingCurrent: false,
  599. initCurrentTreeNode: [],
  600. //我上传的数据集页面配置的初始化
  601. initMyPage: 1,
  602. totalNumMy: 0,
  603. paramsMy: { page: 1, q: "" },
  604. myDatasetList: [],
  605. loadingMy: false,
  606. initMyTreeNode: [],
  607. //公开的数据集页面配置的初始化
  608. initPublicPage: 1,
  609. totalNumPublic: 0,
  610. paramsPublics: { page: 1, q: "" },
  611. publicDatasetList: [],
  612. loadingPublic: false,
  613. initPublicTreeNode: [],
  614. //我点赞的数据集页面配置的初始化
  615. initFavoritePage: 1,
  616. totalNumFavorite: 0,
  617. MyFavoriteDatasetList: [],
  618. paramsFavorite: { page: 1, q: "" },
  619. loadingFavorite: false,
  620. initFavoriteTreeNode: [],
  621. };
  622. },
  623. methods: {
  624. openDataset() {
  625. this.dialogVisible = true;
  626. if (!this.confirmDatasetList) {
  627. this.confirmFlag = false;
  628. }
  629. this.getCurrentRepoDataset();
  630. },
  631. handleClick(tab, event) {
  632. this.search = "";
  633. if (tab.name == "first") {
  634. // this.paramsPublic.q = "";
  635. this.getCurrentRepoDataset();
  636. }
  637. if (tab.name == "second") {
  638. this.getMyUploadDataset();
  639. }
  640. if (tab.name == "third") {
  641. this.getPublicDataset();
  642. }
  643. if (tab.name == "four") {
  644. this.getMyFavoriteDataset();
  645. }
  646. },
  647. //tree 勾选触发事件
  648. onCheck(data, checkedInfo) {
  649. if (
  650. this.selectDatasetArray.length === 0 ||
  651. this.selectDatasetArray.every((item) => item.id !== data.id)
  652. ) {
  653. if (
  654. this.selectDatasetArray.some((item) => {
  655. return item.label.split(".")[0] === data.label.split(".")[0];
  656. })
  657. ) {
  658. this.$refs[data.ref].setChecked(data.id, false, false);
  659. this.$message.warning("不能选择相同名称的数据文件");
  660. } else if (this.selectDatasetArray.length === 5) {
  661. this.$refs[data.ref].setChecked(data.id, false, false);
  662. this.$message.error("最多不超过五个文件");
  663. } else {
  664. this.selectDatasetArray.push(data);
  665. }
  666. } else {
  667. let index = this.selectDatasetArray.findIndex((item) => {
  668. return item.id === data.id;
  669. });
  670. this.selectDatasetArray.splice(index, 1);
  671. }
  672. this.checkList = this.selectDatasetArray.map((item) => {
  673. return item.label;
  674. });
  675. this.saveStatusList = this.selectDatasetArray.map((item) => {
  676. return item.UUID;
  677. });
  678. // this.confirmDatasetList = this.saveStatusList.join(";");
  679. },
  680. //已选择数据集checkbox group 勾选事件
  681. changeCheckbox(checked, data) {
  682. this.$refs.currentTree.setChecked(data.id, false, false);
  683. this.$refs.myTree.setChecked(data.id, false, false);
  684. this.$refs.publicTree.setChecked(data.id, false, false);
  685. this.$refs.favoriteTree.setChecked(data.id, false, false);
  686. let index = this.selectDatasetArray.findIndex((item) => {
  687. return item.id === data.id;
  688. });
  689. this.selectDatasetArray.splice(index, 1);
  690. this.saveStatusList.splice(index, 1);
  691. // this.confirmDatasetList = this.saveStatusList.join(";");
  692. },
  693. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  694. if (rowIndex === 0) {
  695. return "background:#f5f5f6;color:#606266";
  696. }
  697. },
  698. currentChangePage(val) {
  699. this.paramsCurrent.page = val;
  700. this.getCurrentRepoDataset();
  701. },
  702. myChangePage(val) {
  703. this.paramsMy.page = val;
  704. this.getMyUploadDataset();
  705. },
  706. publicChangePage(val) {
  707. this.paramsPublics.page = val;
  708. this.getPublicDataset();
  709. },
  710. favoriteChangePage(val) {
  711. this.paramsFavorite.page = val;
  712. this.getMyFavoriteDataset();
  713. },
  714. getCurrentRepoDataset() {
  715. this.loadingCurrent = true;
  716. let url = this.repoLink + "/datasets/current_repo_m";
  717. this.paramsCurrent.type = this.type;
  718. this.$axios
  719. .get(url, {
  720. params: this.paramsCurrent,
  721. })
  722. .then((res) => {
  723. this.loadingCurrent = false;
  724. let data = JSON.parse(res.data.data);
  725. console.log(data);
  726. this.currentDatasetList = this.transformeTreeData(
  727. data,
  728. "currentTree",
  729. this.paramsCurrent.page
  730. );
  731. this.initCurrentTreeNode = this.currentDatasetList[0]?.id
  732. ? [this.currentDatasetList[0].id]
  733. : [];
  734. this.totalNumCurrent = parseInt(res.data.count);
  735. let setCheckedKeysList = this.currentDatasetList.reduce(
  736. (pre, cur) => {
  737. cur.Attachments.forEach((item) => {
  738. if (this.saveStatusList.includes(item.id)) {
  739. pre.push(item.id);
  740. }
  741. });
  742. return pre;
  743. },
  744. []
  745. );
  746. this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
  747. })
  748. .catch((error) => {
  749. this.loadingCurrent = false;
  750. console.log(error);
  751. });
  752. },
  753. getMyUploadDataset() {
  754. this.loadingMy = true;
  755. let url = this.repoLink + "/datasets/my_datasets_m";
  756. this.paramsMy.type = this.type;
  757. this.$axios
  758. .get(url, {
  759. params: this.paramsMy,
  760. })
  761. .then((res) => {
  762. this.loadingMy = false;
  763. let data = JSON.parse(res.data.data);
  764. this.myDatasetList = this.transformeTreeData(
  765. data,
  766. "myTree",
  767. this.paramsMy.page
  768. );
  769. this.initMyTreeNode = this.myDatasetList[0]?.id
  770. ? [this.myDatasetList[0].id]
  771. : [];
  772. this.totalNumMy = parseInt(res.data.count);
  773. let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => {
  774. cur.Attachments.forEach((item) => {
  775. if (this.saveStatusList.includes(item.id)) {
  776. pre.push(item.id);
  777. }
  778. });
  779. return pre;
  780. }, []);
  781. this.$refs.myTree.setCheckedKeys(setCheckedKeysList);
  782. })
  783. .catch((error) => {
  784. console.log(error);
  785. });
  786. },
  787. getPublicDataset() {
  788. this.loadingPublic = true;
  789. let url = this.repoLink + "/datasets/public_datasets_m";
  790. this.paramsPublics.type = this.type;
  791. this.$axios
  792. .get(url, {
  793. params: this.paramsPublics,
  794. })
  795. .then((res) => {
  796. this.loadingPublic = false;
  797. let data = JSON.parse(res.data.data);
  798. this.publicDatasetList = this.transformeTreeData(
  799. data,
  800. "publicTree",
  801. this.paramsPublics.page
  802. );
  803. this.initPublicTreeNode = this.publicDatasetList[0]?.id
  804. ? [this.publicDatasetList[0].id]
  805. : [];
  806. this.totalNumPublic = parseInt(res.data.count);
  807. let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => {
  808. cur.Attachments.forEach((item) => {
  809. if (this.saveStatusList.includes(item.id)) {
  810. pre.push(item.id);
  811. }
  812. });
  813. return pre;
  814. }, []);
  815. this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
  816. })
  817. .catch((error) => {
  818. this.loadingPublic = false;
  819. console.log(error);
  820. });
  821. },
  822. getMyFavoriteDataset() {
  823. this.loadingFavorite = true;
  824. let url = this.repoLink + "/datasets/my_favorite_m";
  825. this.paramsFavorite.type = this.type;
  826. this.$axios
  827. .get(url, {
  828. params: this.paramsFavorite,
  829. })
  830. .then((res) => {
  831. this.loadingFavorite = false;
  832. let data = JSON.parse(res.data.data);
  833. this.MyFavoriteDatasetList = this.transformeTreeData(
  834. data,
  835. "favoriteTree",
  836. this.paramsFavorite.page
  837. );
  838. this.initFavoriteTreeNode = this.MyFavoriteDatasetList[0]?.id
  839. ? [this.MyFavoriteDatasetList[0].id]
  840. : [];
  841. this.totalNumFavorite = parseInt(res.data.count);
  842. let setCheckedKeysList = this.MyFavoriteDatasetList.reduce(
  843. (pre, cur) => {
  844. cur.Attachments.forEach((item) => {
  845. if (this.saveStatusList.includes(item.id)) {
  846. pre.push(item.id);
  847. }
  848. });
  849. return pre;
  850. },
  851. []
  852. );
  853. this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
  854. })
  855. .catch((error) => {
  856. this.loadingFavorite = false;
  857. console.log(error);
  858. });
  859. },
  860. transformeTreeData(data, ref, page) {
  861. return data.reduce((preParent, curParent) => {
  862. curParent.id = curParent.ID;
  863. curParent.disabled = true;
  864. curParent.parent = true;
  865. curParent.label = curParent.Title;
  866. let childrenData = curParent.Attachments.reduce(
  867. (preChild, curchild) => {
  868. curchild.id = curchild.UUID;
  869. if (curchild.DecompressState !== 1) {
  870. curchild.disabled = true;
  871. }
  872. curchild.ref = ref;
  873. curchild.label = curchild.Name;
  874. preChild.push(curchild);
  875. return preChild;
  876. },
  877. []
  878. );
  879. preParent.push(curParent);
  880. return preParent;
  881. }, []);
  882. },
  883. searchName() {
  884. if (this.activeName == "first") {
  885. this.paramsCurrent.q = this.search;
  886. this.paramsCurrent.page = 1;
  887. this.getCurrentRepoDataset();
  888. }
  889. if (this.activeName == "second") {
  890. this.paramsMy.q = this.search;
  891. this.paramsMy.page = 1;
  892. this.getMyUploadDataset();
  893. }
  894. if (this.activeName == "third") {
  895. this.paramsPublics.q = this.search;
  896. this.paramsPublics.page = 1;
  897. this.getPublicDataset();
  898. }
  899. if (this.activeName == "four") {
  900. this.paramsFavorite.q = this.search;
  901. this.paramsFavorite.page = 1;
  902. this.getMyFavoriteDataset();
  903. }
  904. return false;
  905. },
  906. confirmDataset() {
  907. this.confirmDatasetList = this.saveStatusList.join(";");
  908. this.confirmChecklist = this.checkList;
  909. this.dialogVisible = false;
  910. this.confirmFlag = true;
  911. },
  912. setDialogWidth() {
  913. const cWidth = document.body.clientWidth;
  914. if (cWidth > 1600) {
  915. this.dialogWidth = "1200px";
  916. } else if (cWidth < 1600 && 1200 < cWidth) {
  917. this.dialogWidth = "1127px";
  918. } else if (992 < cWidth && cWidth < 1200) {
  919. this.dialogWidth = "993px";
  920. } else {
  921. this.dialogWidth = "723px";
  922. }
  923. },
  924. },
  925. watch: {
  926. search(val) {
  927. if (!val) {
  928. switch (this.activeName) {
  929. case "first": {
  930. this.paramsCurrent.q = val;
  931. this.getCurrentRepoDataset();
  932. break;
  933. }
  934. case "second": {
  935. this.paramsMy.q = val;
  936. this.getMyUploadDataset();
  937. break;
  938. }
  939. case "third": {
  940. this.paramsPublics.q = val;
  941. this.getPublicDataset();
  942. break;
  943. }
  944. case "four": {
  945. this.paramsFavorite.q = val;
  946. this.getMyFavoriteDataset();
  947. break;
  948. }
  949. default:
  950. console.log("error");
  951. }
  952. }
  953. },
  954. },
  955. mounted() {
  956. this.type = $(".cloudbrain-type").data("cloudbrain-type");
  957. this.repoLink = $(".cloudbrain-type").data("repo-link");
  958. console.log("this.repolink", this.repoLink);
  959. if (
  960. location.href.indexOf("benchmark") !== -1 ||
  961. location.href.indexOf("train-job") !== -1
  962. ) {
  963. this.benchmarkNew = true;
  964. }
  965. if (
  966. location.href.indexOf("modelarts/notebook/create") !== -1 ||
  967. location.href.indexOf("/cloudbrain/create") !== -1
  968. ) {
  969. this.required = false;
  970. }
  971. window.onresize = () => {
  972. return (() => {
  973. this.setDialogWidth();
  974. })();
  975. };
  976. },
  977. created() {
  978. this.setDialogWidth();
  979. },
  980. };
  981. </script>
  982. <style scoped>
  983. .header-wrapper {
  984. background-color: #f5f5f6;
  985. padding-top: 15px;
  986. }
  987. .image_text {
  988. padding: 25px 0 55px 0;
  989. }
  990. #header {
  991. position: relative;
  992. top: -40px;
  993. }
  994. #success {
  995. background-color: #5bb973;
  996. color: white;
  997. }
  998. .text-over {
  999. overflow: hidden;
  1000. text-overflow: ellipsis;
  1001. vertical-align: middle;
  1002. white-space: nowrap;
  1003. }
  1004. .image_title {
  1005. display: inline-block;
  1006. width: 80%;
  1007. cursor: default;
  1008. color: rgb(66, 98, 144);
  1009. }
  1010. .image_desc {
  1011. -webkit-line-clamp: 2;
  1012. -webkit-box-orient: vertical;
  1013. display: -webkit-box;
  1014. text-overflow: ellipsis;
  1015. overflow: hidden;
  1016. }
  1017. .heart-stroke {
  1018. stroke: #666;
  1019. stroke-width: 2;
  1020. fill: #fff;
  1021. }
  1022. .stars_active {
  1023. fill: #fa8c16 !important;
  1024. stroke: #fa8c16 !important;
  1025. }
  1026. /deep/ .el-dialog__body {
  1027. position: relative;
  1028. }
  1029. .el-tree {
  1030. max-height: 400px;
  1031. overflow-y: auto;
  1032. overflow-x: hidden;
  1033. position: relative;
  1034. cursor: default;
  1035. background: #fff;
  1036. color: #606266;
  1037. font-family: SourceHanSansSC-medium;
  1038. }
  1039. .custom-tree-node {
  1040. display: flex;
  1041. align-items: center;
  1042. justify-content: space-between;
  1043. }
  1044. .custom-tree-node .dataset-title {
  1045. font-size: 14px;
  1046. color: #101010;
  1047. font-weight: 600;
  1048. flex: 1;
  1049. }
  1050. .custom-tree-node .dataset-repolink {
  1051. flex: 1;
  1052. text-align: right;
  1053. font-size: 12px;
  1054. }
  1055. .el-tree /deep/ .el-tree-node__content {
  1056. height: 40px;
  1057. background-color: #f5f5f6;
  1058. }
  1059. .el-tree /deep/ .el-tree-node__children .el-tree-node__content {
  1060. height: 30px;
  1061. background-color: #fff;
  1062. line-height: 20px;
  1063. font-size: 12px;
  1064. }
  1065. /deep/ .el-checkbox-group .el-checkbox {
  1066. max-width: 100%;
  1067. min-width: 80%;
  1068. }
  1069. /deep/ .el-checkbox-group .el-checkbox .el-checkbox__label {
  1070. max-width: 100%;
  1071. overflow: hidden;
  1072. vertical-align: middle;
  1073. text-overflow: ellipsis;
  1074. }
  1075. .dataset-nowrap {
  1076. overflow: hidden;
  1077. text-overflow: ellipsis;
  1078. }
  1079. .slot-wrap {
  1080. flex: 1;
  1081. padding-right: 2rem;
  1082. max-width: 93%;
  1083. }
  1084. .multiple-wrap {
  1085. -webkit-line-clamp: 3;
  1086. -webkit-box-orient: vertical;
  1087. display: -webkit-box;
  1088. max-width: 400px;
  1089. overflow: hidden;
  1090. }
  1091. .unzip-failed {
  1092. margin-left: 1rem;
  1093. color: red;
  1094. }
  1095. .zip-loading {
  1096. margin-left: 1rem;
  1097. color: #fcca00;
  1098. }
  1099. .dataset-search-vue {
  1100. z-index: 9999;
  1101. position: absolute;
  1102. right: 31%;
  1103. height: 30px;
  1104. top: 6px;
  1105. }
  1106. .select-dataset-label {
  1107. max-width: 100%;
  1108. overflow: hidden;
  1109. text-overflow: ellipsis;
  1110. margin-right: 1rem;
  1111. white-space: nowrap;
  1112. }
  1113. .dataset_flex {
  1114. display: flex;
  1115. align-items: center;
  1116. }
  1117. .dataset-debug-span {
  1118. display: inline-block;
  1119. width: 50%;
  1120. margin-left: 0.3rem;
  1121. }
  1122. .dataset-train-span {
  1123. display: inline-block;
  1124. width: 48.5%;
  1125. margin-left: 0.3rem;
  1126. }
  1127. .margin_b_0 {
  1128. margin-bottom: 0 !important;
  1129. }
  1130. .select-dataset-button {
  1131. margin-left: 0.3rem;
  1132. color: #0366d6;
  1133. }
  1134. .select-dataset-button-color {
  1135. color: #0366d6;
  1136. }
  1137. .multi-dataset-box {
  1138. border: 1px solid rgba(34, 36, 38, 0.15);
  1139. padding: 0.678571em 1em;
  1140. border-radius: 0.285714rem;
  1141. background: rgb(255, 255, 255);
  1142. display: flex;
  1143. flex-direction: column;
  1144. }
  1145. @media screen and (min-width: 1200px) and (max-width: 1600px) {
  1146. .dataset-search-vue {
  1147. top: -36px;
  1148. }
  1149. }
  1150. @media screen and (min-width: 1200px) and (max-width: 1400px) {
  1151. .multiple-wrap {
  1152. max-width: 200px;
  1153. }
  1154. }
  1155. </style>