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

selectDataset.vue 37 kB

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