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