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
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  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.ref = ref;
  808. curchild.label = curchild.Name;
  809. preChild.push(curchild);
  810. return preChild;
  811. },
  812. []
  813. );
  814. preParent.push(curParent);
  815. return preParent;
  816. }, []);
  817. },
  818. searchName() {
  819. if (this.activeName == "first") {
  820. this.paramsCurrent.q = this.search;
  821. this.paramsCurrent.page = 1;
  822. this.getCurrentRepoDataset();
  823. }
  824. if (this.activeName == "second") {
  825. this.paramsMy.q = this.search;
  826. this.paramsMy.page = 1;
  827. this.getMyUploadDataset();
  828. }
  829. if (this.activeName == "third") {
  830. this.paramsPublics.q = this.search;
  831. this.paramsPublics.page = 1;
  832. this.getPublicDataset();
  833. }
  834. if (this.activeName == "four") {
  835. this.paramsFavorite.q = this.search;
  836. this.paramsFavorite.page = 1;
  837. this.getMyFavoriteDataset();
  838. }
  839. },
  840. confirmDataset() {
  841. this.dialogVisible = false;
  842. this.confirmFlag = true;
  843. },
  844. setDialogWidth() {
  845. const cWidth = document.body.clientWidth;
  846. if (cWidth > 1600) {
  847. this.dialogWidth = "1200px";
  848. } else if (cWidth < 1600 && 1200 < cWidth) {
  849. this.dialogWidth = "1127px";
  850. } else if (992 < cWidth && cWidth < 1200) {
  851. this.dialogWidth = "993px";
  852. } else {
  853. this.dialogWidth = "723px";
  854. }
  855. },
  856. },
  857. watch: {
  858. search(val) {
  859. if (!val) {
  860. switch (this.activeName) {
  861. case "first": {
  862. this.paramsCurrent.q = val;
  863. this.getCurrentRepoDataset();
  864. break;
  865. }
  866. case "second": {
  867. this.paramsMy.q = val;
  868. this.getMyUploadDataset();
  869. break;
  870. }
  871. case "third": {
  872. this.paramsPublics.q = val;
  873. this.getPublicDataset();
  874. break;
  875. }
  876. case "four": {
  877. this.paramsFavorite.q = val;
  878. this.getMyFavoriteDataset();
  879. break;
  880. }
  881. default:
  882. console.log("error");
  883. }
  884. }
  885. },
  886. },
  887. mounted() {
  888. this.type = $(".cloudbrain-type").data("cloudbrain-type");
  889. this.repoLink = $(".cloudbrain-type").data("repo-link");
  890. console.log(this.type, this.repoLink);
  891. if (
  892. location.href.indexOf("benchmark") !== -1 ||
  893. location.href.indexOf("train-job") !== -1
  894. ) {
  895. this.benchmarkNew = true;
  896. }
  897. if (location.href.indexOf("modelarts/notebook/create") !== -1) {
  898. this.required = false;
  899. }
  900. window.onresize = () => {
  901. return (() => {
  902. this.setDialogWidth();
  903. })();
  904. };
  905. },
  906. created() {
  907. this.setDialogWidth();
  908. },
  909. };
  910. </script>
  911. <style scoped>
  912. .header-wrapper {
  913. background-color: #f5f5f6;
  914. padding-top: 15px;
  915. }
  916. .image_text {
  917. padding: 25px 0 55px 0;
  918. }
  919. #header {
  920. position: relative;
  921. top: -40px;
  922. }
  923. #success {
  924. background-color: #5bb973;
  925. color: white;
  926. }
  927. .text-over {
  928. overflow: hidden;
  929. text-overflow: ellipsis;
  930. vertical-align: middle;
  931. white-space: nowrap;
  932. }
  933. .image_title {
  934. display: inline-block;
  935. width: 80%;
  936. cursor: default;
  937. color: rgb(66, 98, 144);
  938. }
  939. .image_desc {
  940. -webkit-line-clamp: 2;
  941. -webkit-box-orient: vertical;
  942. display: -webkit-box;
  943. text-overflow: ellipsis;
  944. overflow: hidden;
  945. }
  946. .heart-stroke {
  947. stroke: #666;
  948. stroke-width: 2;
  949. fill: #fff;
  950. }
  951. .stars_active {
  952. fill: #fa8c16 !important;
  953. stroke: #fa8c16 !important;
  954. }
  955. /deep/ .el-dialog__body {
  956. position: relative;
  957. }
  958. .el-tree {
  959. max-height: 400px;
  960. overflow-y: auto;
  961. overflow-x: hidden;
  962. position: relative;
  963. cursor: default;
  964. background: #fff;
  965. color: #606266;
  966. font-family: SourceHanSansSC-medium;
  967. }
  968. .custom-tree-node {
  969. display: flex;
  970. align-items: center;
  971. justify-content: space-between;
  972. }
  973. .custom-tree-node .dataset-title {
  974. font-size: 14px;
  975. color: #101010;
  976. font-weight: 600;
  977. flex: 1;
  978. }
  979. .custom-tree-node .dataset-repolink {
  980. flex: 1;
  981. text-align: right;
  982. font-size: 12px;
  983. }
  984. .el-tree /deep/ .el-tree-node__content {
  985. height: 40px;
  986. background-color: #f5f5f6;
  987. }
  988. .el-tree /deep/ .el-tree-node__children .el-tree-node__content {
  989. height: 30px;
  990. background-color: #fff;
  991. line-height: 20px;
  992. font-size: 12px;
  993. }
  994. /deep/ .el-checkbox-group .el-checkbox {
  995. max-width: 100%;
  996. min-width: 80%;
  997. }
  998. /deep/ .el-checkbox-group .el-checkbox .el-checkbox__label {
  999. max-width: 100%;
  1000. overflow: hidden;
  1001. vertical-align: middle;
  1002. text-overflow: ellipsis;
  1003. }
  1004. .dataset-nowrap {
  1005. overflow: hidden;
  1006. text-overflow: ellipsis;
  1007. }
  1008. .slot-wrap {
  1009. flex: 1;
  1010. padding-right: 2rem;
  1011. max-width: 93%;
  1012. }
  1013. .multiple-wrap {
  1014. -webkit-line-clamp: 3;
  1015. -webkit-box-orient: vertical;
  1016. display: -webkit-box;
  1017. max-width: 400px;
  1018. overflow: hidden;
  1019. }
  1020. .unzip-failed {
  1021. margin-left: 1rem;
  1022. color: red;
  1023. }
  1024. .zip-loading {
  1025. margin-left: 1rem;
  1026. color: #fcca00;
  1027. }
  1028. .dataset-search-vue {
  1029. z-index: 9999;
  1030. position: absolute;
  1031. right: 31%;
  1032. height: 30px;
  1033. top: 6px;
  1034. }
  1035. .select-dataset-label {
  1036. max-width: 100%;
  1037. overflow: hidden;
  1038. text-overflow: ellipsis;
  1039. margin-right: 1rem;
  1040. white-space: nowrap;
  1041. }
  1042. .dataset_flex {
  1043. display: flex;
  1044. align-items: center;
  1045. }
  1046. .dataset-debug-span {
  1047. display: inline-block;
  1048. width: 50%;
  1049. margin-left: 0.3rem;
  1050. }
  1051. .dataset-train-span {
  1052. display: inline-block;
  1053. width: 48.5%;
  1054. margin-left: 0.3rem;
  1055. }
  1056. .margin_b_0 {
  1057. margin-bottom: 0 !important;
  1058. }
  1059. .select-dataset-button {
  1060. margin-left: 0.3rem;
  1061. color: #0366d6;
  1062. }
  1063. .select-dataset-button-color {
  1064. color: #0366d6;
  1065. }
  1066. .multi-dataset-box {
  1067. border: 1px solid rgba(34, 36, 38, 0.15);
  1068. padding: 0.678571em 1em;
  1069. border-radius: 0.285714rem;
  1070. background: rgb(255, 255, 255);
  1071. display: flex;
  1072. flex-direction: column;
  1073. }
  1074. @media screen and (min-width: 1200px) and (max-width: 1600px) {
  1075. .dataset-search-vue {
  1076. top: -36px;
  1077. }
  1078. }
  1079. @media screen and (min-width: 1200px) and (max-width: 1400px) {
  1080. .multiple-wrap {
  1081. max-width: 200px;
  1082. }
  1083. }
  1084. </style>