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