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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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 checkList"
  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
  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. @keyup.enter="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. confirmDatasetList: "",
  581. confirmFlag: false,
  582. saveStatusList: [],
  583. //当前项目数据集页面配置的初始化
  584. initCurrentPage: 1,
  585. totalNumCurrent: 0,
  586. paramsCurrent: { page: 1, q: "" },
  587. currentDatasetList: [],
  588. loadingCurrent: false,
  589. initCurrentTreeNode: [],
  590. //我上传的数据集页面配置的初始化
  591. initMyPage: 1,
  592. totalNumMy: 0,
  593. paramsMy: { page: 1, q: "" },
  594. myDatasetList: [],
  595. loadingMy: false,
  596. initMyTreeNode: [],
  597. //公开的数据集页面配置的初始化
  598. initPublicPage: 1,
  599. totalNumPublic: 0,
  600. paramsPublics: { page: 1, q: "" },
  601. publicDatasetList: [],
  602. loadingPublic: false,
  603. initPublicTreeNode: [],
  604. //我点赞的数据集页面配置的初始化
  605. initFavoritePage: 1,
  606. totalNumFavorite: 0,
  607. MyFavoriteDatasetList: [],
  608. paramsFavorite: { page: 1, q: "" },
  609. loadingFavorite: false,
  610. initFavoriteTreeNode: [],
  611. };
  612. },
  613. methods: {
  614. openDataset() {
  615. this.dialogVisible = true;
  616. // this.confirmFlag = false;
  617. this.getCurrentRepoDataset();
  618. },
  619. handleClick(tab, event) {
  620. this.search = "";
  621. if (tab.name == "first") {
  622. // this.paramsPublic.q = "";
  623. this.getCurrentRepoDataset();
  624. }
  625. if (tab.name == "second") {
  626. this.getMyUploadDataset();
  627. }
  628. if (tab.name == "third") {
  629. this.getPublicDataset();
  630. }
  631. if (tab.name == "four") {
  632. this.getMyFavoriteDataset();
  633. }
  634. },
  635. //tree 勾选触发事件
  636. onCheck(data, checkedInfo) {
  637. console.log("--ref------", this.$refs[data.ref]);
  638. console.log("---------oncheck-----", data, checkedInfo);
  639. console.log("start array", this.selectDatasetArray);
  640. if (
  641. this.selectDatasetArray.length === 0 ||
  642. this.selectDatasetArray.every((item) => item.id !== data.id)
  643. ) {
  644. console.log("111111111111");
  645. if (
  646. this.selectDatasetArray.some((item) => {
  647. return item.label === data.label;
  648. })
  649. ) {
  650. this.$refs[data.ref].setChecked(data.id, false, false);
  651. this.$message.warning("不能选择相同名称的数据文件");
  652. } else if (this.selectDatasetArray.length === 5) {
  653. this.$refs[data.ref].setChecked(data.id, false, false);
  654. this.$message.error("最多不超过五个文件");
  655. } else {
  656. console.log("push");
  657. this.selectDatasetArray.push(data);
  658. }
  659. } else {
  660. console.log("55555555555");
  661. let index = this.selectDatasetArray.findIndex((item) => {
  662. console.log(item.id, data.id);
  663. return item.id === data.id;
  664. });
  665. console.log("index", index);
  666. this.selectDatasetArray.splice(index, 1);
  667. console.log(this.selectDatasetArray);
  668. }
  669. this.checkList = this.selectDatasetArray.map((item) => {
  670. return item.label;
  671. });
  672. this.saveStatusList = this.selectDatasetArray.map((item) => {
  673. return item.UUID;
  674. });
  675. this.confirmDatasetList = this.saveStatusList.join(";");
  676. console.log(this.selectDatasetArray, this.checkList);
  677. console.log("this.saveStatusList", this.saveStatusList);
  678. console.log("this.confirmDatasetList", this.confirmDatasetList);
  679. console.log("======================================");
  680. },
  681. //已选择数据集checkbox group 勾选事件
  682. changeCheckbox(checked, data) {
  683. console.log(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. console.log("index", index);
  692. this.selectDatasetArray.splice(index, 1);
  693. this.saveStatusList.splice(index, 1);
  694. console.log(this.selectDatasetArray);
  695. this.confirmDatasetList = this.saveStatusList.join(";");
  696. console.log("selectDatasetArray--:", this.selectDatasetArray);
  697. console.log("saveStatusList----:", this.saveStatusList);
  698. console.log("confirmDatasetList----:", this.confirmDatasetList);
  699. console.log("==================================================");
  700. },
  701. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  702. if (rowIndex === 0) {
  703. return "background:#f5f5f6;color:#606266";
  704. }
  705. },
  706. currentChangePage(val) {
  707. this.paramsCurrent.page = val;
  708. this.getCurrentRepoDataset();
  709. },
  710. myChangePage(val) {
  711. this.paramsMy.page = val;
  712. this.getMyUploadDataset();
  713. },
  714. publicChangePage(val) {
  715. this.paramsPublics.page = val;
  716. this.getPublicDataset();
  717. },
  718. favoriteChangePage(val) {
  719. console.log(val);
  720. this.paramsFavorite.page = val;
  721. this.getMyFavoriteDataset();
  722. },
  723. getCurrentRepoDataset() {
  724. this.loadingCurrent = true;
  725. let url = this.repoLink + "/datasets/current_repo_m";
  726. this.paramsCurrent.type = this.type;
  727. this.$axios
  728. .get(url, {
  729. params: this.paramsCurrent,
  730. })
  731. .then((res) => {
  732. this.loadingCurrent = false;
  733. console.log(res);
  734. let data = JSON.parse(res.data.data);
  735. console.log(data);
  736. this.currentDatasetList = this.transformeTreeData(
  737. data,
  738. "currentTree",
  739. this.paramsCurrent.page
  740. );
  741. this.initCurrentTreeNode = [this.currentDatasetList[0].id];
  742. console.log("this.initCurrentTreeNode", this.initCurrentTreeNode);
  743. this.totalNumCurrent = parseInt(res.data.count);
  744. console.log(this.selectDatasetArray);
  745. console.log("this.currentDatasetList:", this.currentDatasetList);
  746. let setCheckedKeysList = this.currentDatasetList.reduce(
  747. (pre, cur) => {
  748. cur.Attachments.forEach((item) => {
  749. if (this.saveStatusList.includes(item.id)) {
  750. pre.push(item.id);
  751. }
  752. });
  753. return pre;
  754. },
  755. []
  756. );
  757. console.log("setCheckedKeysList", setCheckedKeysList);
  758. this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
  759. })
  760. .catch(function (error) {
  761. this.loadingCurrent = false;
  762. console.log(error);
  763. });
  764. },
  765. getMyUploadDataset() {
  766. this.loadingMy = true;
  767. let url = this.repoLink + "/datasets/my_datasets_m";
  768. this.paramsMy.type = this.type;
  769. this.$axios
  770. .get(url, {
  771. params: this.paramsMy,
  772. })
  773. .then((res) => {
  774. this.loadingMy = false;
  775. console.log(res);
  776. let data = JSON.parse(res.data.data);
  777. console.log(data);
  778. this.myDatasetList = this.transformeTreeData(
  779. data,
  780. "myTree",
  781. this.paramsMy.page
  782. );
  783. this.initMyTreeNode = [this.myDatasetList[0].id];
  784. this.totalNumMy = parseInt(res.data.count);
  785. console.log("this.myDatasetList:", this.myDatasetList);
  786. let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => {
  787. cur.Attachments.forEach((item) => {
  788. if (this.saveStatusList.includes(item.id)) {
  789. pre.push(item.id);
  790. }
  791. });
  792. return pre;
  793. }, []);
  794. console.log("setCheckedKeysList", setCheckedKeysList);
  795. this.$refs.myTree.setCheckedKeys(setCheckedKeysList);
  796. })
  797. .catch(function (error) {
  798. console.log(error);
  799. });
  800. },
  801. getPublicDataset() {
  802. this.loadingPublic = true;
  803. let url = this.repoLink + "/datasets/public_datasets_m";
  804. this.paramsPublics.type = this.type;
  805. this.$axios
  806. .get(url, {
  807. params: this.paramsPublics,
  808. })
  809. .then((res) => {
  810. this.loadingPublic = false;
  811. console.log(res);
  812. let data = JSON.parse(res.data.data);
  813. console.log(data);
  814. this.publicDatasetList = this.transformeTreeData(
  815. data,
  816. "publicTree",
  817. this.paramsPublics.page
  818. );
  819. this.initPublicTreeNode = [this.publicDatasetList[0].id];
  820. this.totalNumPublic = parseInt(res.data.count);
  821. console.log("this.publicDatasetList:", this.publicDatasetList);
  822. let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => {
  823. cur.Attachments.forEach((item) => {
  824. if (this.saveStatusList.includes(item.id)) {
  825. pre.push(item.id);
  826. }
  827. });
  828. return pre;
  829. }, []);
  830. console.log("setCheckedKeysList", setCheckedKeysList);
  831. this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
  832. })
  833. .catch(function (error) {
  834. this.loadingPublic = false;
  835. console.log(error);
  836. });
  837. },
  838. getMyFavoriteDataset() {
  839. this.loadingFavorite = true;
  840. let url = this.repoLink + "/datasets/my_favorite_m";
  841. this.paramsFavorite.type = this.type;
  842. this.$axios
  843. .get(url, {
  844. params: this.paramsFavorite,
  845. })
  846. .then((res) => {
  847. this.loadingFavorite = false;
  848. console.log(res);
  849. let data = JSON.parse(res.data.data);
  850. console.log(data);
  851. this.MyFavoriteDatasetList = this.transformeTreeData(
  852. data,
  853. "favoriteTree",
  854. this.paramsFavorite.page
  855. );
  856. this.initFavoriteTreeNode = [this.MyFavoriteDatasetList[0].id];
  857. this.totalNumFavorite = parseInt(res.data.count);
  858. console.log(
  859. "this.MyFavoriteDatasetList:",
  860. this.MyFavoriteDatasetList
  861. );
  862. let setCheckedKeysList = this.MyFavoriteDatasetList.reduce(
  863. (pre, cur) => {
  864. cur.Attachments.forEach((item) => {
  865. if (this.saveStatusList.includes(item.id)) {
  866. pre.push(item.id);
  867. }
  868. });
  869. return pre;
  870. },
  871. []
  872. );
  873. console.log("setCheckedKeysList", setCheckedKeysList);
  874. this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
  875. })
  876. .catch(function (error) {
  877. this.loadingFavorite = false;
  878. console.log(error);
  879. });
  880. },
  881. transformeTreeData(data, ref, page) {
  882. return data.reduce((preParent, curParent) => {
  883. curParent.id = curParent.ID;
  884. curParent.disabled = true;
  885. curParent.parent = true;
  886. curParent.label = curParent.Title;
  887. let childrenData = curParent.Attachments.reduce(
  888. (preChild, curchild) => {
  889. curchild.id = curchild.UUID;
  890. if (curchild.DecompressState !== 1) {
  891. curchild.disabled = true;
  892. }
  893. curchild.ref = ref;
  894. curchild.label = curchild.Name;
  895. preChild.push(curchild);
  896. return preChild;
  897. },
  898. []
  899. );
  900. preParent.push(curParent);
  901. return preParent;
  902. }, []);
  903. },
  904. searchName() {
  905. if (this.activeName == "first") {
  906. this.paramsCurrent.q = this.search;
  907. this.paramsCurrent.page = 1;
  908. this.getCurrentRepoDataset();
  909. }
  910. if (this.activeName == "second") {
  911. this.paramsMy.q = this.search;
  912. this.paramsMy.page = 1;
  913. this.getMyUploadDataset();
  914. }
  915. if (this.activeName == "third") {
  916. this.paramsPublics.q = this.search;
  917. this.paramsPublics.page = 1;
  918. this.getPublicDataset();
  919. }
  920. if (this.activeName == "four") {
  921. this.paramsFavorite.q = this.search;
  922. this.paramsFavorite.page = 1;
  923. this.getMyFavoriteDataset();
  924. }
  925. },
  926. confirmDataset() {
  927. this.dialogVisible = false;
  928. this.confirmFlag = true;
  929. },
  930. setDialogWidth() {
  931. const cWidth = document.body.clientWidth;
  932. if (cWidth > 1600) {
  933. this.dialogWidth = "1200px";
  934. } else if (cWidth < 1600 && 1200 < cWidth) {
  935. this.dialogWidth = "1127px";
  936. } else if (992 < cWidth && cWidth < 1200) {
  937. this.dialogWidth = "993px";
  938. } else {
  939. this.dialogWidth = "723px";
  940. }
  941. },
  942. },
  943. watch: {
  944. search(val) {
  945. if (!val) {
  946. switch (this.activeName) {
  947. case "first": {
  948. this.paramsCurrent.q = val;
  949. this.getCurrentRepoDataset();
  950. break;
  951. }
  952. case "second": {
  953. this.paramsMy.q = val;
  954. this.getMyUploadDataset();
  955. break;
  956. }
  957. case "third": {
  958. this.paramsPublics.q = val;
  959. this.getPublicDataset();
  960. break;
  961. }
  962. case "four": {
  963. this.paramsFavorite.q = val;
  964. this.getMyFavoriteDataset();
  965. break;
  966. }
  967. default:
  968. console.log("error");
  969. }
  970. }
  971. },
  972. },
  973. mounted() {
  974. this.type = $(".cloudbrain-type").data("cloudbrain-type");
  975. this.repoLink = $(".cloudbrain-type").data("repo-link");
  976. console.log(this.type, this.repoLink);
  977. if (
  978. location.href.indexOf("benchmark") !== -1 ||
  979. location.href.indexOf("train-job") !== -1
  980. ) {
  981. this.benchmarkNew = true;
  982. }
  983. if (location.href.indexOf("modelarts/notebook/create") !== -1) {
  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>