| @@ -54,7 +54,11 @@ | |||
| " | |||
| >选择数据集 | |||
| </el-button> | |||
| <el-dialog title="选择数据集" :visible.sync="dialogVisible" width="50%"> | |||
| <el-dialog | |||
| title="选择数据集" | |||
| :visible.sync="dialogVisible" | |||
| :width="dialogWidth" | |||
| > | |||
| <div class="ui icon input dataset-search-vue"> | |||
| <i | |||
| class="search icon" | |||
| @@ -70,7 +74,7 @@ | |||
| </div> | |||
| <el-row> | |||
| <el-col | |||
| :span="18" | |||
| :span="17" | |||
| style=" | |||
| padding-right: 1rem; | |||
| border-right: 1px solid #f5f5f6; | |||
| @@ -106,7 +110,7 @@ | |||
| <span v-else class="dataset-title dataset-nowrap" | |||
| >{{ node.label }} | |||
| </span> | |||
| <a | |||
| <!-- <a | |||
| :href=" | |||
| '/' + | |||
| data.Repo.OwnerName + | |||
| @@ -118,7 +122,24 @@ | |||
| class="dataset-repolink dataset-nowrap" | |||
| :title="data.Repo.OwnerName + '/' + data.Repo.Alias" | |||
| >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a | |||
| > --> | |||
| <span | |||
| class="dataset-repolink dataset-nowrap" | |||
| @click.stop="return false;" | |||
| > | |||
| <a | |||
| :href=" | |||
| '/' + | |||
| data.Repo.OwnerName + | |||
| '/' + | |||
| data.Repo.Alias + | |||
| '/datasets' | |||
| " | |||
| target="_blank" | |||
| :title="data.Repo.OwnerName + '/' + data.Repo.Alias" | |||
| >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a | |||
| > | |||
| </span> | |||
| </span> | |||
| <span v-else style="display: flex"> | |||
| <span class="dataset-nowrap" :title="node.label"> | |||
| @@ -401,7 +422,7 @@ | |||
| </el-tabs> | |||
| </el-col> | |||
| <el-col | |||
| :span="6" | |||
| :span="7" | |||
| style=" | |||
| display: flex; | |||
| flex-direction: column; | |||
| @@ -414,12 +435,13 @@ | |||
| <div | |||
| style=" | |||
| font-size: 14px; | |||
| height: 20px; | |||
| height: 40px; | |||
| text-align: left; | |||
| color: #0066ff; | |||
| line-height: 40px; | |||
| " | |||
| > | |||
| 已选择数据集 | |||
| 已选数据文件 | |||
| </div> | |||
| <div style="flex: 1; margin-top: 1.5rem"> | |||
| <el-checkbox-group v-model="checkList"> | |||
| @@ -461,7 +483,7 @@ export default { | |||
| children: "Attachments", | |||
| label: "label", | |||
| }, | |||
| dialogWidth: "65%", | |||
| dialogVisible: false, | |||
| benchmarkNew: false, | |||
| imageAddress: "", | |||
| @@ -476,7 +498,7 @@ export default { | |||
| confirmDatasetList: "", | |||
| confirmFlag: false, | |||
| saveStutusCheck: [], | |||
| saveStatusList: [], | |||
| //当前项目数据集页面配置的初始化 | |||
| initCurrentPage: 1, | |||
| totalNumCurrent: 0, | |||
| @@ -541,7 +563,11 @@ export default { | |||
| this.selectDatasetArray.every((item) => item.id !== data.id) | |||
| ) { | |||
| console.log("111111111111"); | |||
| if (this.selectDatasetArray.some((item) => item.label === data.label)) { | |||
| if ( | |||
| this.selectDatasetArray.some((item) => { | |||
| return item.label === data.label && item.id === data.id; | |||
| }) | |||
| ) { | |||
| this.$refs[data.ref].setChecked(data.id, false, false); | |||
| this.$message.warning("不能选择相同名称的数据文件"); | |||
| } else if (this.selectDatasetArray.length === 5) { | |||
| @@ -564,70 +590,35 @@ export default { | |||
| this.checkList = this.selectDatasetArray.map((item) => { | |||
| return item.label; | |||
| }); | |||
| this.confirmDatasetList = this.selectDatasetArray | |||
| .map((item) => { | |||
| return item.UUID; | |||
| }) | |||
| .join(";"); | |||
| console.log("this.confirmDatasetList", this.confirmDatasetList); | |||
| this.saveStutusCheck = this.selectDatasetArray.reduce((pre, cur) => { | |||
| let checkedKeys = {}; | |||
| checkedKeys.treeRef = cur.ref; | |||
| checkedKeys.id = cur.id; | |||
| checkedKeys.page = cur.page; | |||
| pre.push(checkedKeys); | |||
| return pre; | |||
| }, []); | |||
| console.log("this.saveStutusCheck", this.saveStutusCheck); | |||
| this.saveStatusList = this.selectDatasetArray.map((item) => { | |||
| return item.UUID; | |||
| }); | |||
| this.confirmDatasetList = this.saveStatusList.join(";"); | |||
| console.log(this.selectDatasetArray, this.checkList); | |||
| console.log("this.saveStatusList", this.saveStatusList); | |||
| console.log("this.confirmDatasetList", this.confirmDatasetList); | |||
| console.log("======================================"); | |||
| }, | |||
| //已选择数据集checkbox group 勾选事件 | |||
| changeCheckbox(checked, data) { | |||
| console.log(checked, data); | |||
| switch (data.ref) { | |||
| case "currentTree": { | |||
| this.$refs.currentTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "myTree": { | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "publicTree": { | |||
| this.$refs.publicTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "favoriteTree": { | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| default: | |||
| } | |||
| this.$refs.currentTree.setChecked(data.id, false, false); | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| this.$refs.publicTree.setChecked(data.id, false, false); | |||
| this.$refs.favoriteTree.setChecked(data.id, false, false); | |||
| let index = this.selectDatasetArray.findIndex((item) => { | |||
| console.log(item.id, data.id); | |||
| return item.id === data.id; | |||
| }); | |||
| console.log("index", index); | |||
| this.selectDatasetArray.splice(index, 1); | |||
| this.saveStatusList.splice(index, 1); | |||
| console.log(this.selectDatasetArray); | |||
| this.confirmDatasetList = this.selectDatasetArray | |||
| .map((item) => { | |||
| return item.UUID; | |||
| }) | |||
| .join(";"); | |||
| this.confirmDatasetList = this.saveStatusList.join(";"); | |||
| console.log("selectDatasetArray--:", this.selectDatasetArray); | |||
| console.log("saveStatusList----:", this.saveStatusList); | |||
| console.log("confirmDatasetList----:", this.confirmDatasetList); | |||
| console.log("=================================================="); | |||
| }, | |||
| tableHeaderStyle({ row, column, rowIndex, columnIndex }) { | |||
| if (rowIndex === 0) { | |||
| @@ -676,15 +667,17 @@ export default { | |||
| this.totalNumCurrent = parseInt(res.data.count); | |||
| console.log(this.selectDatasetArray); | |||
| console.log("this.currentDatasetList:", this.currentDatasetList); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "currentTree" && | |||
| cur.page === this.paramsCurrent.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| return pre; | |||
| }, []); | |||
| let setCheckedKeysList = this.currentDatasetList.reduce( | |||
| (pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, | |||
| [] | |||
| ); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| this.$refs.currentTree.setCheckedKeys(setCheckedKeysList); | |||
| }) | |||
| @@ -714,11 +707,12 @@ export default { | |||
| this.initMyTreeNode = [this.myDatasetList[0].id]; | |||
| this.totalNumMy = parseInt(res.data.count); | |||
| console.log("this.myDatasetList:", this.myDatasetList); | |||
| console.log("this.aveStutusCheck:", this.saveStutusCheck); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if (cur.treeRef === "myTree" && cur.page === this.paramsMy.page) { | |||
| pre.push(cur.id); | |||
| } | |||
| let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, []); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| @@ -750,13 +744,13 @@ export default { | |||
| this.initPublicTreeNode = [this.publicDatasetList[0].id]; | |||
| this.totalNumPublic = parseInt(res.data.count); | |||
| console.log("this.publicDatasetList:", this.publicDatasetList); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "publicTree" && | |||
| cur.page === this.paramsPublics.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, []); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| @@ -792,15 +786,18 @@ export default { | |||
| "this.MyFavoriteDatasetList:", | |||
| this.MyFavoriteDatasetList | |||
| ); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "favoriteTree" && | |||
| cur.page === this.paramsFavorite.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| return pre; | |||
| }, []); | |||
| let setCheckedKeysList = this.MyFavoriteDatasetList.reduce( | |||
| (pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, | |||
| [] | |||
| ); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList); | |||
| }) | |||
| @@ -811,15 +808,13 @@ export default { | |||
| }, | |||
| transformeTreeData(data, ref, page) { | |||
| return data.reduce((preParent, curParent) => { | |||
| curParent.id = `paraent-${curParent.ID}`; | |||
| curParent.id = curParent.ID; | |||
| curParent.disabled = true; | |||
| curParent.parent = true; | |||
| curParent.label = curParent.Title; | |||
| let childrenData = curParent.Attachments.reduce( | |||
| (preChild, curchild) => { | |||
| curchild.id = `chilrden-${ref}-${curchild.ID}`; | |||
| curchild.ref = ref; | |||
| curchild.page = page; | |||
| curchild.id = curchild.UUID; | |||
| if (curchild.DecompressState !== 1) { | |||
| curchild.disabled = true; | |||
| } | |||
| @@ -860,6 +855,18 @@ export default { | |||
| this.dialogVisible = false; | |||
| this.confirmFlag = true; | |||
| }, | |||
| setDialogWidth() { | |||
| const cWidth = document.body.clientWidth; | |||
| if (cWidth > 1600) { | |||
| this.dialogWidth = "1200px"; | |||
| } else if (cWidth < 1600 && 1200 < cWidth) { | |||
| this.dialogWidth = "1127px"; | |||
| } else if (992 < cWidth && cWidth < 1200) { | |||
| this.dialogWidth = "993px"; | |||
| } else { | |||
| this.dialogWidth = "723px"; | |||
| } | |||
| }, | |||
| }, | |||
| watch: { | |||
| search(val) { | |||
| @@ -904,8 +911,15 @@ export default { | |||
| if (location.href.indexOf("modelarts/notebook/create") !== -1) { | |||
| this.required = false; | |||
| } | |||
| window.onresize = () => { | |||
| return (() => { | |||
| this.setDialogWidth(); | |||
| })(); | |||
| }; | |||
| }, | |||
| created() { | |||
| this.setDialogWidth(); | |||
| }, | |||
| created() {}, | |||
| }; | |||
| </script> | |||
| @@ -1037,7 +1051,7 @@ export default { | |||
| .dataset-search-vue { | |||
| z-index: 9999; | |||
| position: absolute; | |||
| right: 28%; | |||
| right: 31%; | |||
| height: 30px; | |||
| top: 6px; | |||
| } | |||
| @@ -1046,6 +1060,7 @@ export default { | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| margin-right: 1rem; | |||
| white-space: nowrap; | |||
| } | |||
| .dataset_flex { | |||
| display: flex; | |||
| @@ -1079,9 +1094,10 @@ export default { | |||
| display: flex; | |||
| flex-direction: column; | |||
| } | |||
| @media screen and (min-width: 1200px) and (max-width: 1600px) { | |||
| .dataset-search-vue { | |||
| top: -30px; | |||
| top: -36px; | |||
| } | |||
| } | |||
| @media screen and (min-width: 1200px) and (max-width: 1400px) { | |||