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
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  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="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.native="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. if (!this.confirmDatasetList) {
  617. this.confirmFlag = false;
  618. }
  619. this.getCurrentRepoDataset();
  620. },
  621. handleClick(tab, event) {
  622. this.search = "";
  623. if (tab.name == "first") {
  624. // this.paramsPublic.q = "";
  625. this.getCurrentRepoDataset();
  626. }
  627. if (tab.name == "second") {
  628. this.getMyUploadDataset();
  629. }
  630. if (tab.name == "third") {
  631. this.getPublicDataset();
  632. }
  633. if (tab.name == "four") {
  634. this.getMyFavoriteDataset();
  635. }
  636. },
  637. //tree 勾选触发事件
  638. onCheck(data, checkedInfo) {
  639. console.log("--ref------", this.$refs[data.ref]);
  640. console.log("---------oncheck-----", data, checkedInfo);
  641. console.log("start array", this.selectDatasetArray);
  642. if (
  643. this.selectDatasetArray.length === 0 ||
  644. this.selectDatasetArray.every((item) => item.id !== data.id)
  645. ) {
  646. console.log("111111111111");
  647. if (
  648. this.selectDatasetArray.some((item) => {
  649. console.log(item.label.split(".")[0], data.label.split(".")[0]);
  650. return item.label.split(".")[0] === data.label.split(".")[0];
  651. })
  652. ) {
  653. this.$refs[data.ref].setChecked(data.id, false, false);
  654. this.$message.warning("不能选择相同名称的数据文件");
  655. } else if (this.selectDatasetArray.length === 5) {
  656. this.$refs[data.ref].setChecked(data.id, false, false);
  657. this.$message.error("最多不超过五个文件");
  658. } else {
  659. console.log("push");
  660. this.selectDatasetArray.push(data);
  661. }
  662. } else {
  663. console.log("55555555555");
  664. let index = this.selectDatasetArray.findIndex((item) => {
  665. console.log(item.id, data.id);
  666. return item.id === data.id;
  667. });
  668. console.log("index", index);
  669. this.selectDatasetArray.splice(index, 1);
  670. console.log(this.selectDatasetArray);
  671. }
  672. this.checkList = this.selectDatasetArray.map((item) => {
  673. return item.label;
  674. });
  675. this.saveStatusList = this.selectDatasetArray.map((item) => {
  676. return item.UUID;
  677. });
  678. this.confirmDatasetList = this.saveStatusList.join(";");
  679. console.log(this.selectDatasetArray, this.checkList);
  680. console.log("this.saveStatusList", this.saveStatusList);
  681. console.log("this.confirmDatasetList", this.confirmDatasetList);
  682. console.log("======================================");
  683. },
  684. //已选择数据集checkbox group 勾选事件
  685. changeCheckbox(checked, data) {
  686. console.log(checked, data);
  687. this.$refs.currentTree.setChecked(data.id, false, false);
  688. this.$refs.myTree.setChecked(data.id, false, false);
  689. this.$refs.publicTree.setChecked(data.id, false, false);
  690. this.$refs.favoriteTree.setChecked(data.id, false, false);
  691. let index = this.selectDatasetArray.findIndex((item) => {
  692. return item.id === data.id;
  693. });
  694. console.log("index", index);
  695. this.selectDatasetArray.splice(index, 1);
  696. this.saveStatusList.splice(index, 1);
  697. console.log(this.selectDatasetArray);
  698. this.confirmDatasetList = this.saveStatusList.join(";");
  699. console.log("selectDatasetArray--:", this.selectDatasetArray);
  700. console.log("saveStatusList----:", this.saveStatusList);
  701. console.log("confirmDatasetList----:", this.confirmDatasetList);
  702. console.log("==================================================");
  703. },
  704. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  705. if (rowIndex === 0) {
  706. return "background:#f5f5f6;color:#606266";
  707. }
  708. },
  709. currentChangePage(val) {
  710. this.paramsCurrent.page = val;
  711. this.getCurrentRepoDataset();
  712. },
  713. myChangePage(val) {
  714. this.paramsMy.page = val;
  715. this.getMyUploadDataset();
  716. },
  717. publicChangePage(val) {
  718. this.paramsPublics.page = val;
  719. this.getPublicDataset();
  720. },
  721. favoriteChangePage(val) {
  722. console.log(val);
  723. this.paramsFavorite.page = val;
  724. this.getMyFavoriteDataset();
  725. },
  726. getCurrentRepoDataset() {
  727. this.loadingCurrent = true;
  728. let url = this.repoLink + "/datasets/current_repo_m";
  729. this.paramsCurrent.type = this.type;
  730. this.$axios
  731. .get(url, {
  732. params: this.paramsCurrent,
  733. })
  734. .then((res) => {
  735. this.loadingCurrent = false;
  736. console.log(res);
  737. let data = JSON.parse(res.data.data);
  738. console.log(data);
  739. this.currentDatasetList = this.transformeTreeData(
  740. data,
  741. "currentTree",
  742. this.paramsCurrent.page
  743. );
  744. this.initCurrentTreeNode = [this.currentDatasetList[0].id];
  745. console.log("this.initCurrentTreeNode", this.initCurrentTreeNode);
  746. this.totalNumCurrent = parseInt(res.data.count);
  747. console.log(this.selectDatasetArray);
  748. console.log("this.currentDatasetList:", this.currentDatasetList);
  749. let setCheckedKeysList = this.currentDatasetList.reduce(
  750. (pre, cur) => {
  751. cur.Attachments.forEach((item) => {
  752. if (this.saveStatusList.includes(item.id)) {
  753. pre.push(item.id);
  754. }
  755. });
  756. return pre;
  757. },
  758. []
  759. );
  760. console.log("setCheckedKeysList", setCheckedKeysList);
  761. this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
  762. })
  763. .catch(function (error) {
  764. this.loadingCurrent = false;
  765. console.log(error);
  766. });
  767. },
  768. getMyUploadDataset() {
  769. this.loadingMy = true;
  770. let url = this.repoLink + "/datasets/my_datasets_m";
  771. this.paramsMy.type = this.type;
  772. this.$axios
  773. .get(url, {
  774. params: this.paramsMy,
  775. })
  776. .then((res) => {
  777. this.loadingMy = false;
  778. console.log(res);
  779. let data = JSON.parse(res.data.data);
  780. console.log(data);
  781. this.myDatasetList = this.transformeTreeData(
  782. data,
  783. "myTree",
  784. this.paramsMy.page
  785. );
  786. this.initMyTreeNode = [this.myDatasetList[0].id];
  787. this.totalNumMy = parseInt(res.data.count);
  788. console.log("this.myDatasetList:", this.myDatasetList);
  789. let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => {
  790. cur.Attachments.forEach((item) => {
  791. if (this.saveStatusList.includes(item.id)) {
  792. pre.push(item.id);
  793. }
  794. });
  795. return pre;
  796. }, []);
  797. console.log("setCheckedKeysList", setCheckedKeysList);
  798. this.$refs.myTree.setCheckedKeys(setCheckedKeysList);
  799. })
  800. .catch(function (error) {
  801. console.log(error);
  802. });
  803. },
  804. getPublicDataset() {
  805. this.loadingPublic = true;
  806. let url = this.repoLink + "/datasets/public_datasets_m";
  807. this.paramsPublics.type = this.type;
  808. this.$axios
  809. .get(url, {
  810. params: this.paramsPublics,
  811. })
  812. .then((res) => {
  813. this.loadingPublic = false;
  814. console.log(res);
  815. let data = JSON.parse(res.data.data);
  816. console.log(data);
  817. this.publicDatasetList = this.transformeTreeData(
  818. data,
  819. "publicTree",
  820. this.paramsPublics.page
  821. );
  822. this.initPublicTreeNode = [this.publicDatasetList[0].id];
  823. this.totalNumPublic = parseInt(res.data.count);
  824. console.log("this.publicDatasetList:", this.publicDatasetList);
  825. let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => {
  826. cur.Attachments.forEach((item) => {
  827. if (this.saveStatusList.includes(item.id)) {
  828. pre.push(item.id);
  829. }
  830. });
  831. return pre;
  832. }, []);
  833. console.log("setCheckedKeysList", setCheckedKeysList);
  834. this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
  835. })
  836. .catch(function (error) {
  837. this.loadingPublic = false;
  838. console.log(error);
  839. });
  840. },
  841. getMyFavoriteDataset() {
  842. this.loadingFavorite = true;
  843. let url = this.repoLink + "/datasets/my_favorite_m";
  844. this.paramsFavorite.type = this.type;
  845. this.$axios
  846. .get(url, {
  847. params: this.paramsFavorite,
  848. })
  849. .then((res) => {
  850. this.loadingFavorite = false;
  851. console.log(res);
  852. let data = JSON.parse(res.data.data);
  853. console.log(data);
  854. this.MyFavoriteDatasetList = this.transformeTreeData(
  855. data,
  856. "favoriteTree",
  857. this.paramsFavorite.page
  858. );
  859. this.initFavoriteTreeNode = [this.MyFavoriteDatasetList[0].id];
  860. this.totalNumFavorite = parseInt(res.data.count);
  861. console.log(
  862. "this.MyFavoriteDatasetList:",
  863. this.MyFavoriteDatasetList
  864. );
  865. let setCheckedKeysList = this.MyFavoriteDatasetList.reduce(
  866. (pre, cur) => {
  867. cur.Attachments.forEach((item) => {
  868. if (this.saveStatusList.includes(item.id)) {
  869. pre.push(item.id);
  870. }
  871. });
  872. return pre;
  873. },
  874. []
  875. );
  876. console.log("setCheckedKeysList", setCheckedKeysList);
  877. this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
  878. })
  879. .catch(function (error) {
  880. this.loadingFavorite = false;
  881. console.log(error);
  882. });
  883. },
  884. transformeTreeData(data, ref, page) {
  885. return data.reduce((preParent, curParent) => {
  886. curParent.id = curParent.ID;
  887. curParent.disabled = true;
  888. curParent.parent = true;
  889. curParent.label = curParent.Title;
  890. let childrenData = curParent.Attachments.reduce(
  891. (preChild, curchild) => {
  892. curchild.id = curchild.UUID;
  893. if (curchild.DecompressState !== 1) {
  894. curchild.disabled = true;
  895. }
  896. curchild.ref = ref;
  897. curchild.label = curchild.Name;
  898. preChild.push(curchild);
  899. return preChild;
  900. },
  901. []
  902. );
  903. preParent.push(curParent);
  904. return preParent;
  905. }, []);
  906. },
  907. searchName() {
  908. if (this.activeName == "first") {
  909. this.paramsCurrent.q = this.search;
  910. this.paramsCurrent.page = 1;
  911. this.getCurrentRepoDataset();
  912. }
  913. if (this.activeName == "second") {
  914. this.paramsMy.q = this.search;
  915. this.paramsMy.page = 1;
  916. this.getMyUploadDataset();
  917. }
  918. if (this.activeName == "third") {
  919. this.paramsPublics.q = this.search;
  920. this.paramsPublics.page = 1;
  921. this.getPublicDataset();
  922. }
  923. if (this.activeName == "four") {
  924. this.paramsFavorite.q = this.search;
  925. this.paramsFavorite.page = 1;
  926. this.getMyFavoriteDataset();
  927. }
  928. return false;
  929. },
  930. confirmDataset() {
  931. this.dialogVisible = false;
  932. this.confirmFlag = true;
  933. },
  934. setDialogWidth() {
  935. const cWidth = document.body.clientWidth;
  936. if (cWidth > 1600) {
  937. this.dialogWidth = "1200px";
  938. } else if (cWidth < 1600 && 1200 < cWidth) {
  939. this.dialogWidth = "1127px";
  940. } else if (992 < cWidth && cWidth < 1200) {
  941. this.dialogWidth = "993px";
  942. } else {
  943. this.dialogWidth = "723px";
  944. }
  945. },
  946. },
  947. watch: {
  948. search(val) {
  949. if (!val) {
  950. switch (this.activeName) {
  951. case "first": {
  952. this.paramsCurrent.q = val;
  953. this.getCurrentRepoDataset();
  954. break;
  955. }
  956. case "second": {
  957. this.paramsMy.q = val;
  958. this.getMyUploadDataset();
  959. break;
  960. }
  961. case "third": {
  962. this.paramsPublics.q = val;
  963. this.getPublicDataset();
  964. break;
  965. }
  966. case "four": {
  967. this.paramsFavorite.q = val;
  968. this.getMyFavoriteDataset();
  969. break;
  970. }
  971. default:
  972. console.log("error");
  973. }
  974. }
  975. },
  976. },
  977. mounted() {
  978. this.type = $(".cloudbrain-type").data("cloudbrain-type");
  979. this.repoLink = $(".cloudbrain-type").data("repo-link");
  980. console.log(this.type, this.repoLink);
  981. if (
  982. location.href.indexOf("benchmark") !== -1 ||
  983. location.href.indexOf("train-job") !== -1
  984. ) {
  985. this.benchmarkNew = true;
  986. }
  987. if (location.href.indexOf("modelarts/notebook/create") !== -1) {
  988. this.required = false;
  989. }
  990. window.onresize = () => {
  991. return (() => {
  992. this.setDialogWidth();
  993. })();
  994. };
  995. },
  996. created() {
  997. this.setDialogWidth();
  998. },
  999. };
  1000. </script>
  1001. <style scoped>
  1002. .header-wrapper {
  1003. background-color: #f5f5f6;
  1004. padding-top: 15px;
  1005. }
  1006. .image_text {
  1007. padding: 25px 0 55px 0;
  1008. }
  1009. #header {
  1010. position: relative;
  1011. top: -40px;
  1012. }
  1013. #success {
  1014. background-color: #5bb973;
  1015. color: white;
  1016. }
  1017. .text-over {
  1018. overflow: hidden;
  1019. text-overflow: ellipsis;
  1020. vertical-align: middle;
  1021. white-space: nowrap;
  1022. }
  1023. .image_title {
  1024. display: inline-block;
  1025. width: 80%;
  1026. cursor: default;
  1027. color: rgb(66, 98, 144);
  1028. }
  1029. .image_desc {
  1030. -webkit-line-clamp: 2;
  1031. -webkit-box-orient: vertical;
  1032. display: -webkit-box;
  1033. text-overflow: ellipsis;
  1034. overflow: hidden;
  1035. }
  1036. .heart-stroke {
  1037. stroke: #666;
  1038. stroke-width: 2;
  1039. fill: #fff;
  1040. }
  1041. .stars_active {
  1042. fill: #fa8c16 !important;
  1043. stroke: #fa8c16 !important;
  1044. }
  1045. /deep/ .el-dialog__body {
  1046. position: relative;
  1047. }
  1048. .el-tree {
  1049. max-height: 400px;
  1050. overflow-y: auto;
  1051. overflow-x: hidden;
  1052. position: relative;
  1053. cursor: default;
  1054. background: #fff;
  1055. color: #606266;
  1056. font-family: SourceHanSansSC-medium;
  1057. }
  1058. .custom-tree-node {
  1059. display: flex;
  1060. align-items: center;
  1061. justify-content: space-between;
  1062. }
  1063. .custom-tree-node .dataset-title {
  1064. font-size: 14px;
  1065. color: #101010;
  1066. font-weight: 600;
  1067. flex: 1;
  1068. }
  1069. .custom-tree-node .dataset-repolink {
  1070. flex: 1;
  1071. text-align: right;
  1072. font-size: 12px;
  1073. }
  1074. .el-tree /deep/ .el-tree-node__content {
  1075. height: 40px;
  1076. background-color: #f5f5f6;
  1077. }
  1078. .el-tree /deep/ .el-tree-node__children .el-tree-node__content {
  1079. height: 30px;
  1080. background-color: #fff;
  1081. line-height: 20px;
  1082. font-size: 12px;
  1083. }
  1084. /deep/ .el-checkbox-group .el-checkbox {
  1085. max-width: 100%;
  1086. min-width: 80%;
  1087. }
  1088. /deep/ .el-checkbox-group .el-checkbox .el-checkbox__label {
  1089. max-width: 100%;
  1090. overflow: hidden;
  1091. vertical-align: middle;
  1092. text-overflow: ellipsis;
  1093. }
  1094. .dataset-nowrap {
  1095. overflow: hidden;
  1096. text-overflow: ellipsis;
  1097. }
  1098. .slot-wrap {
  1099. flex: 1;
  1100. padding-right: 2rem;
  1101. max-width: 93%;
  1102. }
  1103. .multiple-wrap {
  1104. -webkit-line-clamp: 3;
  1105. -webkit-box-orient: vertical;
  1106. display: -webkit-box;
  1107. max-width: 400px;
  1108. overflow: hidden;
  1109. }
  1110. .unzip-failed {
  1111. margin-left: 1rem;
  1112. color: red;
  1113. }
  1114. .zip-loading {
  1115. margin-left: 1rem;
  1116. color: #fcca00;
  1117. }
  1118. .dataset-search-vue {
  1119. z-index: 9999;
  1120. position: absolute;
  1121. right: 31%;
  1122. height: 30px;
  1123. top: 6px;
  1124. }
  1125. .select-dataset-label {
  1126. max-width: 100%;
  1127. overflow: hidden;
  1128. text-overflow: ellipsis;
  1129. margin-right: 1rem;
  1130. white-space: nowrap;
  1131. }
  1132. .dataset_flex {
  1133. display: flex;
  1134. align-items: center;
  1135. }
  1136. .dataset-debug-span {
  1137. display: inline-block;
  1138. width: 50%;
  1139. margin-left: 0.3rem;
  1140. }
  1141. .dataset-train-span {
  1142. display: inline-block;
  1143. width: 48.5%;
  1144. margin-left: 0.3rem;
  1145. }
  1146. .margin_b_0 {
  1147. margin-bottom: 0 !important;
  1148. }
  1149. .select-dataset-button {
  1150. margin-left: 0.3rem;
  1151. color: #0366d6;
  1152. }
  1153. .select-dataset-button-color {
  1154. color: #0366d6;
  1155. }
  1156. .multi-dataset-box {
  1157. border: 1px solid rgba(34, 36, 38, 0.15);
  1158. padding: 0.678571em 1em;
  1159. border-radius: 0.285714rem;
  1160. background: rgb(255, 255, 255);
  1161. display: flex;
  1162. flex-direction: column;
  1163. }
  1164. @media screen and (min-width: 1200px) and (max-width: 1600px) {
  1165. .dataset-search-vue {
  1166. top: -36px;
  1167. }
  1168. }
  1169. @media screen and (min-width: 1200px) and (max-width: 1400px) {
  1170. .multiple-wrap {
  1171. max-width: 200px;
  1172. }
  1173. }
  1174. </style>