|
@@ -37,7 +37,7 @@
|
|
<el-tree
|
|
<el-tree
|
|
ref="privateTree"
|
|
ref="privateTree"
|
|
class="target-tree"
|
|
class="target-tree"
|
|
- :empty-text="$t('Slides.no_categories_empty-')"
|
|
|
|
|
|
+ :empty-text="$t('Slides.no_categories_empty')"
|
|
:data="privateList"
|
|
:data="privateList"
|
|
node-key="nodeKeyId"
|
|
node-key="nodeKeyId"
|
|
:expand-on-click-node="false"
|
|
:expand-on-click-node="false"
|
|
@@ -120,22 +120,40 @@ export default {
|
|
},
|
|
},
|
|
searchTitle(newVal){
|
|
searchTitle(newVal){
|
|
if(!newVal) return
|
|
if(!newVal) return
|
|
- let data = null
|
|
|
|
- this.privateList.forEach((item)=>{
|
|
|
|
- item.children.forEach(i=>{
|
|
|
|
- if(i.PptId===newVal){
|
|
|
|
- data = i
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ let data = this.findPptById(this.privateList || [],newVal) || {};
|
|
this.$refs.privateTree.setCurrentKey('ppt'+newVal)
|
|
this.$refs.privateTree.setCurrentKey('ppt'+newVal)
|
|
const node = this.$refs.privateTree.getCurrentNode()
|
|
const node = this.$refs.privateTree.getCurrentNode()
|
|
|
|
+ if(!node) return;
|
|
!this.privateExpandKeys.includes(node.catalogId)&&this.privateExpandKeys.push(node.catalogId)
|
|
!this.privateExpandKeys.includes(node.catalogId)&&this.privateExpandKeys.push(node.catalogId)
|
|
this.choosedItem = data
|
|
this.choosedItem = data
|
|
this.searchOptions=[]
|
|
this.searchOptions=[]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ findPptById(data, newVal){
|
|
|
|
+ let result = null;
|
|
|
|
+ function traverse(node) {
|
|
|
|
+ if (!node || result) return;
|
|
|
|
+
|
|
|
|
+ if (node.PptId == newVal) {
|
|
|
|
+ result = node;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Array.isArray(node.children)) {
|
|
|
|
+ for (const child of node.children) {
|
|
|
|
+ traverse(child);
|
|
|
|
+ if (result) break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (const item of data) {
|
|
|
|
+ traverse(item);
|
|
|
|
+ if (result) break;
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ },
|
|
cancelHandle(){this.$emit('cancel')},
|
|
cancelHandle(){this.$emit('cancel')},
|
|
saveHandle(){
|
|
saveHandle(){
|
|
if(this.value.length===0){
|
|
if(this.value.length===0){
|
|
@@ -151,17 +169,17 @@ export default {
|
|
},
|
|
},
|
|
async searchHandle(keyword){
|
|
async searchHandle(keyword){
|
|
this.searchLoading = true
|
|
this.searchLoading = true
|
|
- const param = {
|
|
|
|
- AdminId:Number(localStorage.getItem("AdminId")),
|
|
|
|
|
|
+ pptInterface.getPptListV2({
|
|
Keyword:keyword,
|
|
Keyword:keyword,
|
|
- IsPrivate:true
|
|
|
|
- }
|
|
|
|
- const res = this.$parent.currentLang!=='en'
|
|
|
|
- ?await pptInterface.searchPPTByKeyWorld(param)
|
|
|
|
- :await pptEnInterface.searchPPTByKeyWorld(param)
|
|
|
|
- if(res.Ret!==200) return
|
|
|
|
- this.searchOptions = res.Data.List||[]
|
|
|
|
- this.searchLoading = false
|
|
|
|
|
|
+ PageSize: 100,
|
|
|
|
+ CurrentIndex: 1,
|
|
|
|
+ Source: 1,
|
|
|
|
+ ClassifyId: 0,
|
|
|
|
+ }).then(res => {
|
|
|
|
+ this.searchLoading = false;
|
|
|
|
+ if(res.Ret!==200) return
|
|
|
|
+ this.searchOptions = res.Data.List||[];
|
|
|
|
+ })
|
|
},
|
|
},
|
|
nodeChange(data,node){
|
|
nodeChange(data,node){
|
|
if(data.PptId){
|
|
if(data.PptId){
|
|
@@ -193,12 +211,24 @@ export default {
|
|
},
|
|
},
|
|
async getPrivateList(){
|
|
async getPrivateList(){
|
|
const res = this.$parent.currentLang!=='en'
|
|
const res = this.$parent.currentLang!=='en'
|
|
- ?await pptInterface.getCatalogsList()
|
|
|
|
|
|
+ ?await pptInterface.getCatalogsListV2({Source: 1})
|
|
:await pptEnInterface.getCatalogsList()
|
|
:await pptEnInterface.getCatalogsList()
|
|
if(res.Ret!==200) return
|
|
if(res.Ret!==200) return
|
|
- this.privateList = changeCatalogArr(res.Data.PrivateList)
|
|
|
|
|
|
+ let tempArr = this.getFilteredData(res.Data||[]);
|
|
|
|
+ this.privateList = changeCatalogArr(tempArr||[]);
|
|
this.listloading = false
|
|
this.listloading = false
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ getFilteredData(data) {
|
|
|
|
+ const temp = JSON.parse(JSON.stringify(data));
|
|
|
|
+ return temp.map(item => this.filterPptList(item)).filter(item => item != null);
|
|
|
|
+ },
|
|
|
|
+ filterPptList(node) {
|
|
|
|
+ if (!node) return null;
|
|
|
|
+ if (Array.isArray(node.Child)) {
|
|
|
|
+ node.Child = node.Child.map(child => this.filterPptList(child)) .filter(child => child != null);
|
|
|
|
+ }
|
|
|
|
+ return (Array.isArray(node.PptList) && node.PptList.length > 0) || (node.Child && node.Child.length > 0) ? node : null;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|