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
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  1. <template>
  2. <div
  3. class="inline field margin_b_0"
  4. :class="{
  5. dataset_flex: confirmDatasetList && confirmFlag,
  6. required: required,
  7. }"
  8. >
  9. <label
  10. class="label-fix-width"
  11. style="font-weight: normal"
  12. >{{ i18n.dataset_label }}</label
  13. >
  14. <span
  15. class="dataset-train-span"
  16. v-if="confirmDatasetList && confirmFlag"
  17. >
  18. <input type="hidden" name="attachment" :value="confirmDatasetList" />
  19. <input
  20. type="hidden"
  21. name="dataset_name"
  22. :value="confirmDatasetNameList"
  23. />
  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. type="text"
  38. class="disabled"
  39. style="width: 48.5%"
  40. :placeholder="i18n.dataset_select_placeholder"
  41. :required="required"
  42. />
  43. </span>
  44. <el-button
  45. type="text"
  46. @click="openDataset"
  47. icon="el-icon-plus"
  48. :class="
  49. confirmFlag && confirmDatasetList
  50. ? 'select-dataset-button'
  51. : 'select-dataset-button-color'
  52. "
  53. >{{ i18n.dataset_select }}
  54. </el-button>
  55. <el-dialog
  56. :title="i18n.dataset_select"
  57. :visible.sync="dialogVisible"
  58. :width="dialogWidth"
  59. >
  60. <div class="ui icon input dataset-search-vue">
  61. <i
  62. class="search icon"
  63. style="cursor: pointer; pointer-events: auto"
  64. @click="searchName"
  65. ></i>
  66. <input
  67. type="text"
  68. :placeholder="i18n.dataset_search_placeholder"
  69. v-model="search"
  70. @keydown.enter.stop.prevent="searchName"
  71. />
  72. </div>
  73. <el-row>
  74. <el-col
  75. :span="17"
  76. style="
  77. padding-right: 1rem;
  78. border-right: 1px solid #f5f5f6;
  79. position: relative;
  80. "
  81. >
  82. <el-tabs v-model="activeName" @tab-click="handleClick">
  83. <!-- 当前项目的数据集 -->
  84. <el-tab-pane
  85. :label="i18n.dataset_current_repo"
  86. name="first"
  87. v-loading="loadingCurrent"
  88. >
  89. <el-row>
  90. <el-tree
  91. :data="currentDatasetList"
  92. ref="currentTree"
  93. highlight-current
  94. show-checkbox
  95. node-key="id"
  96. :default-expanded-keys="initCurrentTreeNode"
  97. :props="defaultProps"
  98. :index="20"
  99. accordion
  100. @check="onCheck"
  101. >
  102. <span slot-scope="{ node, data }" class="slot-wrap">
  103. <span v-if="data.parent" class="custom-tree-node">
  104. <el-tooltip v-if="data.Description" placement="top-start">
  105. <div slot="content" class="multiple-wrap">
  106. {{ data.Description }}
  107. </div>
  108. <span class="dataset-title dataset-nowrap"
  109. ><div class="dataset_flex">
  110. <span
  111. style="flex: inherit"
  112. class="dataset-nowrap"
  113. >{{ node.label }}</span
  114. >
  115. <img
  116. v-if="data.Recommend"
  117. style="margin-left: 0.4rem"
  118. src="/img/jian.svg"
  119. />
  120. </div>
  121. </span>
  122. </el-tooltip>
  123. <span v-else class="dataset-title dataset-nowrap"
  124. ><div class="dataset_flex">
  125. <span style="flex: inherit" class="dataset-nowrap">{{
  126. node.label
  127. }}</span>
  128. <img
  129. v-if="data.Recommend"
  130. style="margin-left: 0.4rem"
  131. src="/img/jian.svg"
  132. />
  133. </div>
  134. </span>
  135. <span
  136. class="dataset-repolink dataset-nowrap"
  137. @click.stop="return false;"
  138. >
  139. <i
  140. class="ri-links-line"
  141. style="color: #21ba45; margin-right: 0.3rem"
  142. :title="i18n.dataset_relate"
  143. v-if="
  144. '/' + data.Repo.OwnerName + '/' + data.Repo.Name !==
  145. repoLink
  146. "
  147. ></i>
  148. <a
  149. :href="
  150. '/' +
  151. data.Repo.OwnerName +
  152. '/' +
  153. data.Repo.Name +
  154. '/datasets'
  155. "
  156. target="_blank"
  157. :title="data.Repo.OwnerName + '/' + data.Repo.Alias"
  158. >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a
  159. >
  160. </span>
  161. </span>
  162. <span v-else style="display: flex">
  163. <span class="dataset-nowrap" :title="node.label">
  164. {{ node.label }}
  165. </span>
  166. <span
  167. class="zip-loading"
  168. v-if="data.DecompressState === 2"
  169. >
  170. {{ i18n.dataset_unziping }}
  171. </span>
  172. <span
  173. class="unzip-failed"
  174. v-if="data.DecompressState === 3"
  175. >
  176. {{ i18n.dataset_unzip_failed }}
  177. </span>
  178. </span>
  179. </span>
  180. </el-tree>
  181. <div></div>
  182. </el-row>
  183. <div
  184. class="ui container"
  185. style="margin-top: 25px; text-align: center"
  186. >
  187. <el-pagination
  188. background
  189. @current-change="currentChangePage"
  190. :current-page="initCurrentPage"
  191. :page-size="5"
  192. layout="total, prev, pager, next"
  193. :total="totalNumCurrent"
  194. >
  195. </el-pagination>
  196. </div>
  197. </el-tab-pane>
  198. <!-- 我上传的数据集 -->
  199. <el-tab-pane
  200. :label="i18n.dataset_my_upload"
  201. name="second"
  202. v-loading="loadingMy"
  203. >
  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: 1.5rem 0; overflow-y: auto">
  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. imageAddress: "",
  581. activeName: "first",
  582. search: "",
  583. required: true,
  584. i18n: {},
  585. type: 0,
  586. repoLink: "",
  587. selectDatasetArray: [],
  588. checkList: [],
  589. confirmChecklist: [],
  590. confirmDatasetList: "",
  591. confirmDatasetNameList: "",
  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. this.currentDatasetList = this.transformeTreeData(
  728. data,
  729. "currentTree",
  730. this.paramsCurrent.page
  731. );
  732. this.initCurrentTreeNode = this.currentDatasetList[0]?.id
  733. ? [this.currentDatasetList[0].id]
  734. : [];
  735. this.totalNumCurrent = parseInt(res.data.count);
  736. let setCheckedKeysList = this.currentDatasetList.reduce(
  737. (pre, cur) => {
  738. cur.Attachments.forEach((item) => {
  739. if (
  740. this.saveStatusList.includes(item.id) ||
  741. this.hasSelectDatasetList.includes(item.id)
  742. ) {
  743. pre.push(item.id);
  744. }
  745. });
  746. return pre;
  747. },
  748. []
  749. );
  750. this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
  751. })
  752. .catch((error) => {
  753. this.loadingCurrent = false;
  754. console.log(error);
  755. });
  756. },
  757. getMyUploadDataset() {
  758. this.loadingMy = true;
  759. let url = this.repoLink + "/datasets/my_datasets_m";
  760. this.paramsMy.type = this.type;
  761. this.$axios
  762. .get(url, {
  763. params: this.paramsMy,
  764. })
  765. .then((res) => {
  766. this.loadingMy = false;
  767. let data = JSON.parse(res.data.data);
  768. this.myDatasetList = this.transformeTreeData(
  769. data,
  770. "myTree",
  771. this.paramsMy.page
  772. );
  773. this.initMyTreeNode = this.myDatasetList[0]?.id
  774. ? [this.myDatasetList[0].id]
  775. : [];
  776. this.totalNumMy = parseInt(res.data.count);
  777. let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => {
  778. cur.Attachments.forEach((item) => {
  779. if (this.saveStatusList.includes(item.id)) {
  780. pre.push(item.id);
  781. }
  782. });
  783. return pre;
  784. }, []);
  785. this.$refs.myTree.setCheckedKeys(setCheckedKeysList);
  786. })
  787. .catch((error) => {
  788. console.log(error);
  789. });
  790. },
  791. getPublicDataset() {
  792. this.loadingPublic = true;
  793. let url = this.repoLink + "/datasets/public_datasets_m";
  794. this.paramsPublics.type = this.type;
  795. this.$axios
  796. .get(url, {
  797. params: this.paramsPublics,
  798. })
  799. .then((res) => {
  800. this.loadingPublic = false;
  801. let data = JSON.parse(res.data.data);
  802. this.publicDatasetList = this.transformeTreeData(
  803. data,
  804. "publicTree",
  805. this.paramsPublics.page
  806. );
  807. this.initPublicTreeNode = this.publicDatasetList[0]?.id
  808. ? [this.publicDatasetList[0].id]
  809. : [];
  810. this.totalNumPublic = parseInt(res.data.count);
  811. let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => {
  812. cur.Attachments.forEach((item) => {
  813. if (this.saveStatusList.includes(item.id)) {
  814. pre.push(item.id);
  815. }
  816. });
  817. return pre;
  818. }, []);
  819. this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
  820. })
  821. .catch((error) => {
  822. this.loadingPublic = false;
  823. console.log(error);
  824. });
  825. },
  826. getMyFavoriteDataset() {
  827. this.loadingFavorite = true;
  828. let url = this.repoLink + "/datasets/my_favorite_m";
  829. this.paramsFavorite.type = this.type;
  830. this.$axios
  831. .get(url, {
  832. params: this.paramsFavorite,
  833. })
  834. .then((res) => {
  835. this.loadingFavorite = false;
  836. let data = JSON.parse(res.data.data);
  837. this.MyFavoriteDatasetList = this.transformeTreeData(
  838. data,
  839. "favoriteTree",
  840. this.paramsFavorite.page
  841. );
  842. this.initFavoriteTreeNode = this.MyFavoriteDatasetList[0]?.id
  843. ? [this.MyFavoriteDatasetList[0].id]
  844. : [];
  845. this.totalNumFavorite = parseInt(res.data.count);
  846. let setCheckedKeysList = this.MyFavoriteDatasetList.reduce(
  847. (pre, cur) => {
  848. cur.Attachments.forEach((item) => {
  849. if (this.saveStatusList.includes(item.id)) {
  850. pre.push(item.id);
  851. }
  852. });
  853. return pre;
  854. },
  855. []
  856. );
  857. this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
  858. })
  859. .catch((error) => {
  860. this.loadingFavorite = false;
  861. console.log(error);
  862. });
  863. },
  864. transformeTreeData(data, ref, page) {
  865. return data.reduce((preParent, curParent) => {
  866. curParent.id = curParent.ID;
  867. curParent.disabled = true;
  868. curParent.parent = true;
  869. curParent.label = curParent.Title;
  870. let childrenData = curParent.Attachments.reduce(
  871. (preChild, curchild) => {
  872. curchild.id = curchild.UUID;
  873. if (curchild.DecompressState !== 1) {
  874. curchild.disabled = true;
  875. }
  876. curchild.ref = ref;
  877. curchild.label = curchild.Name;
  878. preChild.push(curchild);
  879. return preChild;
  880. },
  881. []
  882. );
  883. preParent.push(curParent);
  884. return preParent;
  885. }, []);
  886. },
  887. searchName() {
  888. if (this.activeName == "first") {
  889. this.paramsCurrent.q = this.search;
  890. this.paramsCurrent.page = 1;
  891. this.getCurrentRepoDataset();
  892. }
  893. if (this.activeName == "second") {
  894. this.paramsMy.q = this.search;
  895. this.paramsMy.page = 1;
  896. this.getMyUploadDataset();
  897. }
  898. if (this.activeName == "third") {
  899. this.paramsPublics.q = this.search;
  900. this.paramsPublics.page = 1;
  901. this.getPublicDataset();
  902. }
  903. if (this.activeName == "four") {
  904. this.paramsFavorite.q = this.search;
  905. this.paramsFavorite.page = 1;
  906. this.getMyFavoriteDataset();
  907. }
  908. return false;
  909. },
  910. confirmDataset() {
  911. this.confirmDatasetList = this.saveStatusList.join(";");
  912. this.confirmDatasetNameList = this.checkList.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 (
  971. this.hasSelectDatasetList.length !== 0 &&
  972. hasSelectDatasetName[0] !== ""
  973. ) {
  974. this.saveStatusList = this.hasSelectDatasetList;
  975. this.checkList = hasSelectDatasetName;
  976. this.hasSelectDatasetList.forEach((item, index) => {
  977. this.selectDatasetArray.push({
  978. id: item,
  979. label: hasSelectDatasetName[index],
  980. });
  981. });
  982. }
  983. this.confirmDataset();
  984. }
  985. if (
  986. location.href.indexOf("modelarts/notebook/create") !== -1 ||
  987. location.href.indexOf("/cloudbrain/create") !== -1 || location.href.indexOf('grampus/notebook/create') !== -1
  988. ) {
  989. this.required = false;
  990. }
  991. window.onresize = () => {
  992. return (() => {
  993. this.setDialogWidth();
  994. })();
  995. };
  996. },
  997. created() {
  998. this.setDialogWidth();
  999. if (document.documentElement.attributes["lang"].nodeValue == "en-US") {
  1000. this.i18n = this.$locale.US;
  1001. } else {
  1002. this.i18n = this.$locale.CN;
  1003. }
  1004. },
  1005. };
  1006. </script>
  1007. <style scoped>
  1008. .header-wrapper {
  1009. background-color: #f5f5f6;
  1010. padding-top: 15px;
  1011. }
  1012. .image_text {
  1013. padding: 25px 0 55px 0;
  1014. }
  1015. #header {
  1016. position: relative;
  1017. top: -40px;
  1018. }
  1019. #success {
  1020. background-color: #5bb973;
  1021. color: white;
  1022. }
  1023. .text-over {
  1024. overflow: hidden;
  1025. text-overflow: ellipsis;
  1026. vertical-align: middle;
  1027. white-space: nowrap;
  1028. }
  1029. .image_title {
  1030. display: inline-block;
  1031. width: 80%;
  1032. cursor: default;
  1033. color: rgb(66, 98, 144);
  1034. }
  1035. .image_desc {
  1036. -webkit-line-clamp: 2;
  1037. -webkit-box-orient: vertical;
  1038. display: -webkit-box;
  1039. text-overflow: ellipsis;
  1040. overflow: hidden;
  1041. }
  1042. .heart-stroke {
  1043. stroke: #666;
  1044. stroke-width: 2;
  1045. fill: #fff;
  1046. }
  1047. .stars_active {
  1048. fill: #fa8c16 !important;
  1049. stroke: #fa8c16 !important;
  1050. }
  1051. /deep/ .el-dialog__body {
  1052. position: relative;
  1053. }
  1054. .el-tree {
  1055. max-height: 400px;
  1056. overflow-y: auto;
  1057. overflow-x: hidden;
  1058. position: relative;
  1059. cursor: default;
  1060. background: #fff;
  1061. color: #606266;
  1062. font-family: SourceHanSansSC-medium;
  1063. }
  1064. .custom-tree-node {
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: space-between;
  1068. }
  1069. .custom-tree-node .dataset-title {
  1070. font-size: 14px;
  1071. color: #101010;
  1072. font-weight: 600;
  1073. flex: 1;
  1074. }
  1075. .custom-tree-node .dataset-repolink {
  1076. flex: 1;
  1077. text-align: right;
  1078. font-size: 12px;
  1079. }
  1080. .el-tree /deep/ .el-tree-node__content {
  1081. height: 40px;
  1082. background-color: #f5f5f6;
  1083. }
  1084. .el-tree /deep/ .el-tree-node__children .el-tree-node__content {
  1085. height: 30px;
  1086. background-color: #fff;
  1087. line-height: 20px;
  1088. font-size: 12px;
  1089. }
  1090. /deep/ .el-checkbox-group .el-checkbox {
  1091. max-width: 100%;
  1092. min-width: 80%;
  1093. }
  1094. /deep/ .el-checkbox-group .el-checkbox .el-checkbox__label {
  1095. max-width: 100%;
  1096. overflow: hidden;
  1097. vertical-align: middle;
  1098. text-overflow: ellipsis;
  1099. }
  1100. .dataset-nowrap {
  1101. overflow: hidden;
  1102. text-overflow: ellipsis;
  1103. }
  1104. .slot-wrap {
  1105. flex: 1;
  1106. padding-right: 2rem;
  1107. max-width: 93%;
  1108. }
  1109. .multiple-wrap {
  1110. -webkit-line-clamp: 3;
  1111. -webkit-box-orient: vertical;
  1112. display: -webkit-box;
  1113. max-width: 400px;
  1114. overflow: hidden;
  1115. }
  1116. .unzip-failed {
  1117. margin-left: 1rem;
  1118. color: red;
  1119. }
  1120. .zip-loading {
  1121. margin-left: 1rem;
  1122. color: #fcca00;
  1123. }
  1124. .dataset-search-vue {
  1125. z-index: 9999;
  1126. position: absolute;
  1127. right: 31%;
  1128. height: 30px;
  1129. top: 6px;
  1130. }
  1131. .select-dataset-label {
  1132. max-width: 100%;
  1133. overflow: hidden;
  1134. text-overflow: ellipsis;
  1135. margin-right: 1rem;
  1136. white-space: nowrap;
  1137. }
  1138. .dataset_flex {
  1139. display: flex;
  1140. align-items: center;
  1141. }
  1142. .dataset-debug-span {
  1143. display: inline-block;
  1144. width: 50%;
  1145. margin-left: 0.3rem;
  1146. }
  1147. .dataset-train-span {
  1148. display: inline-block;
  1149. width: 48.5%;
  1150. margin-left: 0.3rem;
  1151. }
  1152. .margin_b_0 {
  1153. margin-bottom: 0 !important;
  1154. }
  1155. .select-dataset-button {
  1156. margin-left: 0.3rem;
  1157. color: #0366d6;
  1158. }
  1159. .select-dataset-button-color {
  1160. color: #0366d6;
  1161. }
  1162. .multi-dataset-box {
  1163. border: 1px solid rgba(34, 36, 38, 0.15);
  1164. padding: 0.678571em 1em;
  1165. border-radius: 0.285714rem;
  1166. background: rgb(255, 255, 255);
  1167. display: flex;
  1168. flex-direction: column;
  1169. }
  1170. @media screen and (min-width: 1200px) and (max-width: 1600px) {
  1171. .dataset-search-vue {
  1172. top: -36px;
  1173. }
  1174. }
  1175. @media screen and (min-width: 1200px) and (max-width: 1400px) {
  1176. .multiple-wrap {
  1177. max-width: 200px;
  1178. }
  1179. }
  1180. </style>