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