You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

selectDataset.vue 38 kB

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