diff --git a/src/components/drawers/SelFacet.vue b/src/components/drawers/SelFacet.vue index eeb7414e..441eb6d2 100644 --- a/src/components/drawers/SelFacet.vue +++ b/src/components/drawers/SelFacet.vue @@ -117,7 +117,7 @@ :loading="tableDataTotal === -1 ? true : false" :pagination="false" /> -
+
{ let data = tabledata; - let tData =[]; let array = []; + let options = state.options2222; data.map((value) => { let obj = { key: value.offcourseId, @@ -447,43 +452,60 @@ export default { category:"", //需要判断content }; - let options = state.options2222; + console.log("obj",obj); + var breaked = false; + for (let i = 0; i < options.length; i++) { + for (let j = 0; j < options[i].children.length; j++) { + if ( + String(options[i].children[j].value) === + String(obj.categoryId) + ) { + console.log("obj.categoryId",obj.categoryId); + obj.category = options[i].children[j].title; + console.log("obj. obj.category ", obj.category ); + breaked = true; + break; + } + } + if(breaked){ + break; + } + } + if(!obj.category ){ + obj.category ="-"; + } + console.log("obj. obj.category22 ", obj.category ); + array.push(obj); + }); + state.classTableData = array; + }; + + + + + /** + + const getCategory=(id)=>{ + console.log("进来了"); + let category=""; + let options = state.options2222; for (let i = 0; i < options.value.length; i++) { for (let j = 0; j < options.value[i].children.length; j++) { if ( String(options.value[i].children[j].value) === - String(value.categoryId) + String(id) ) { console.log(); - value.category = options.value[i].children[j].title; + category = options.value[i].children[j].title; - return false; + return category; } } } - array.push(obj); - - }); - array.forEach((itm) => { - let options = state.options2222; - for (let i = 0; i < options.value.length; i++) { - for (let j = 0; j < options.value[i].children.length; j++) { - if ( - String(options.value[i].children[j].value) === - String(itm.categoryId) - ) { - console.log("找到了",i); - itm.category = options.value[i].children[j].title; - tData.push(itm); - return false; - } - } - } - }); - console.log("结果:",tData); - state.classTableData = tData; - }; - /** + return category; + } + + const options1 = ref([ { value: 0, @@ -526,7 +548,6 @@ export default { afterVisibleChange, closeDrawer, - columns1, getClassData, handleChange, @@ -536,6 +557,7 @@ export default { rowSelection, search, submitCourse, + // change, }; },