Browse Source

fix issue

tags/v1.22.6.2^2
Gitea 3 years ago
parent
commit
7dc20ff4b8
1 changed files with 129 additions and 34 deletions
  1. +129
    -34
      web_src/js/components/dataset/selectDataset.vue

+ 129
- 34
web_src/js/components/dataset/selectDataset.vue View File

@@ -76,9 +76,9 @@
>
<span slot-scope="{ node, data }" class="slot-wrap">
<span v-if="data.parent" class="custom-tree-node">
<el-tooltip v-if="data.desc">
<el-tooltip v-if="data.Description">
<div slot="content" class="multiple-wrap">
{{ data.desc }}
{{ data.Description }}
</div>
<span class="dataset-title dataset-nowrap"
>{{ node.label }}
@@ -88,11 +88,11 @@
>{{ node.label }}
</span>
<a
href="/"
:href="'/'+data.Repo.OwnerName+'/'+data.Repo.Alias +'/datasets'"
target="_blank"
class="dataset-repolink dataset-nowrap"
title="asdasdasd"
>chen/datset</a
:title="data.Repo.OwnerName+'/'+data.Repo.Alias"
>{{data.Repo.OwnerName}}/{{data.Repo.Alias}}</a
>
</span>
<span v-else>{{ node.label }}</span>
@@ -132,9 +132,9 @@
>
<span slot-scope="{ node, data }" class="slot-wrap">
<span v-if="data.parent" class="custom-tree-node">
<el-tooltip v-if="data.desc">
<el-tooltip v-if="data.Description">
<div slot="content" class="multiple-wrap">
{{ data.desc }}
{{ data.Description }}
</div>
<span class="dataset-title dataset-nowrap"
>{{ node.label }}
@@ -144,11 +144,11 @@
>{{ node.label }}
</span>
<a
href="/"
:href="'/'+data.Repo.OwnerName+'/'+data.Repo.Alias +'/datasets'"
target="_blank"
class="dataset-repolink dataset-nowrap"
title="asdasdasd"
>chen/datset</a
:title="data.Repo.OwnerName+'/'+data.Repo.Alias"
>{{data.Repo.OwnerName}}/{{data.Repo.Alias}} </a
>
</span>
<span v-else>{{ node.label }}</span>
@@ -192,9 +192,9 @@
>
<span slot-scope="{ node, data }" class="slot-wrap">
<span v-if="data.parent" class="custom-tree-node">
<el-tooltip v-if="data.desc">
<el-tooltip v-if="data.Description">
<div slot="content" class="multiple-wrap">
{{ data.desc }}
{{ data.Description }}
</div>
<span class="dataset-title dataset-nowrap"
>{{ node.label }}
@@ -204,11 +204,11 @@
>{{ node.label }}
</span>
<a
href="/"
:href="'/'+data.Repo.OwnerName+'/'+data.Repo.Alias +'/datasets'"
target="_blank"
class="dataset-repolink dataset-nowrap"
title="asdasdasd"
>chen/datset</a
:title="data.Repo.OwnerName+'/'+data.Repo.Alias"
>{{data.Repo.OwnerName}}/{{data.Repo.Alias}}</a
>
</span>
<span v-else>{{ node.label }}</span>
@@ -252,9 +252,9 @@
>
<span slot-scope="{ node, data }" class="slot-wrap">
<span v-if="data.parent" class="custom-tree-node">
<el-tooltip v-if="data.desc">
<el-tooltip v-if="data.Description">
<div slot="content" class="multiple-wrap">
{{ data.desc }}
{{ data.Description }}
</div>
<span class="dataset-title dataset-nowrap"
>{{ node.label }}
@@ -264,11 +264,11 @@
>{{ node.label }}
</span>
<a
href="/"
:href="'/'+data.Repo.OwnerName+'/'+data.Repo.Alias +'/datasets'"
target="_blank"
class="dataset-repolink dataset-nowrap"
title="asdasdasd"
>chen/datset</a
:title="data.Repo.OwnerName+'/'+data.Repo.Alias"
>{{data.Repo.OwnerName}}/{{data.Repo.Alias}}</a
>
</span>
<span v-else>{{ node.label }}</span>
@@ -320,6 +320,7 @@
v-for="(item, index) in selectDatasetArray"
:key="index"
:label="item.label"
:title="item.label"
@change="(checked) => changeCheckbox(checked, item)"
></el-checkbox>
</el-checkbox-group>
@@ -530,6 +531,8 @@ export default {
selectDatasetArray: [],
checkList: [],
checkList1: [],

saveStutusCheck:[],
//当前项目数据集页面配置的初始化
initCurrentPage: 1,
totalNumCurrent: 0,
@@ -648,6 +651,16 @@ export default {
this.checkList1 = this.selectDatasetArray.map((item) => {
return item.id;
});
console.log()
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)
console.log(this.selectDatasetArray, this.checkList);
},
// onMyCheck(data, checkedInfo) {
@@ -687,12 +700,49 @@ export default {
//已选择数据集checkbox group 勾选事件
changeCheckbox(checked, data) {
console.log(checked, data);
if (this.data[0].children.some((item) => item.id === data.id)) {
console.log("----is data-----------");
this.$refs.currentTree.setChecked(data.id, false, false);
} else if (this.data1[0].children.some((item) => item.id === data.id)) {
console.log("----is data1-----------");
this.$refs.myTree.setChecked(data.id, false, false);
// if (this.data[0].children.some((item) => item.id === data.id)) {
// console.log("----is data-----------");
// this.$refs.currentTree.setChecked(data.id, false, false);
// } else if (this.data1[0].children.some((item) => item.id === data.id)) {
// console.log("----is data1-----------");
// this.$refs.myTree.setChecked(data.id, false, false);
// }

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:
}

let index = this.selectDatasetArray.findIndex((item) => {
@@ -742,14 +792,22 @@ export default {
console.log(data);
this.currentDatasetList = this.transformeTreeData(
data,
"currentTree"
"currentTree",
this.paramsCurrent.page
);
this.initCurrentTreeNode = [this.currentDatasetList[0].id];
console.log("this.initCurrentTreeNode", this.initCurrentTreeNode);
this.totalNumCurrent = parseInt(res.data.count);
console.log(this.selectDatasetArray);
this.$refs.currentTree.setCheckedKeys(this.checkList1);
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
},[])
console.log("setCheckedKeysList",setCheckedKeysList)
this.$refs.currentTree.setCheckedKeys(setCheckedKeysList);
})
.catch(function (error) {
this.loadingCurrent = false;
@@ -769,13 +827,23 @@ export default {
console.log(res);
let data = JSON.parse(res.data.data);
console.log(data);
this.myDatasetList = this.transformeTreeData(data, "myTree");
this.myDatasetList = this.transformeTreeData(data, "myTree",this.paramsMy.page);
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)
}
return pre
},[])
console.log("setCheckedKeysList",setCheckedKeysList)
this.$refs.myTree.setCheckedKeys(setCheckedKeysList);

})
.catch(function (error) {
this.loadingMy = false;
console.log(error);
});
},
@@ -793,10 +861,18 @@ export default {
console.log(res);
let data = JSON.parse(res.data.data);
console.log(data);
this.publicDatasetList = this.transformeTreeData(data, "publicTree");
this.publicDatasetList = this.transformeTreeData(data, "publicTree",this.paramsPublics.page);
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)
}
return pre
},[])
console.log("setCheckedKeysList",setCheckedKeysList)
this.$refs.publicTree.setCheckedKeys(setCheckedKeysList);
})
.catch(function (error) {
this.loadingPublic = false;
@@ -810,7 +886,7 @@ export default {
this.paramsFavorite.type = this.type;
this.$axios
.get(url, {
params: this.paramsCurrent,
params: this.paramsFavorite,
})
.then((res) => {
this.loadingFavorite = false;
@@ -819,7 +895,8 @@ export default {
console.log(data);
this.MyFavoriteDatasetList = this.transformeTreeData(
data,
"favoriteTree"
"favoriteTree",
this.paramsFavorite.page
);
this.initFavoriteTreeNode = [this.MyFavoriteDatasetList[0].id];
this.totalNumFavorite = parseInt(res.data.count);
@@ -827,13 +904,21 @@ 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
},[])
console.log("setCheckedKeysList",setCheckedKeysList)
this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList);
})
.catch(function (error) {
this.loadingFavorite = false;
console.log(error);
});
},
transformeTreeData(data, ref) {
transformeTreeData(data, ref,page) {
return data.reduce((preParent, curParent) => {
curParent.id = `paraent-${curParent.ID}`;
curParent.disabled = true;
@@ -843,6 +928,7 @@ export default {
(preChild, curchild) => {
curchild.id = `chilrden-${ref}-${curchild.ID}`;
curchild.ref = ref;
curchild.page = page
if (curchild.DecompressState !== 1) {
curchild.disabled = true;
}
@@ -1004,6 +1090,15 @@ export default {
line-height: 20px;
font-size: 12px;
}
/deep/ .el-checkbox-group .el-checkbox{
max-width: 100%;
}
/deep/ .el-checkbox-group .el-checkbox .el-checkbox__label{
max-width:100%;
overflow: hidden;
vertical-align: middle;
text-overflow: ellipsis;
}
.dataset-nowrap {
overflow: hidden;
text-overflow: ellipsis;


Loading…
Cancel
Save