视频分类查询视频优化

This commit is contained in:
xiezhijun 2021-06-15 18:48:45 +08:00
parent 5bb89cbcc8
commit 1151507eb6
3 changed files with 35 additions and 6 deletions

View File

@ -42,7 +42,11 @@
and snv.show_flag = #{showFlag}
</if>
<if test="cateId != null">
and snv.cate_id = #{cateId}
and snv.cate_id in (
select id from sys_video_classify where del_flag = 0
and (id = #{cateId} or id in (select s.id from sys_video_classify s where s.parent_id = #{cateId} and s.del_flag = 0)
or id in (select ss.id from sys_video_classify ss where ss.del_flag = 0 and ss.parent_id in (select a.id from sys_video_classify a where a.parent_id = #{cateId} and a.del_flag = 0 )))
)
</if>
<if test="payLevel != null">
and snv.pay_level = #{payLevel}

View File

@ -21,14 +21,22 @@
</el-select>
</el-form-item>
<el-form-item label="视频类别" prop="cateId">
<el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
<!-- <el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
<el-option
v-for="classify in classifyList"
:key="classify.id"
:label="classify.cateName"
:value="classify.id"
/>
</el-select>
</el-select>-->
<treeselect
v-model="queryParams.cateId"
:options="classifyList"
:normalizer="normalizer"
:show-count="true"
placeholder="选择分类"
style="width:200px"
/>
</el-form-item>
<el-form-item label="视频权限" prop="payLevel">
<el-select v-model="queryParams.payLevel" clearable filterable placeholder="请选择权限">
@ -257,6 +265,9 @@
import UploadFile from "@/components/FileUpload/UploadFile";
import VideoClassify from "../videoClassify";
import AutoHideMessage from "@/components/AutoHideMessage";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
export default {
name: "NutritionalVideo",
data() {
@ -320,7 +331,7 @@
});
},
components: {
UploadVideo,UploadFile,VideoClassify,AutoHideMessage
UploadVideo,UploadFile,VideoClassify,AutoHideMessage,Treeselect, IconSelect
},
methods: {
/** 查询营养视频列表 */
@ -339,7 +350,10 @@
getAllVideoClassify(){
getAllClassify().then(response => {
if(response.code == 200){
this.classifyList = response.data;
this.classifyList = [];
const classify = { id: 0, cateName: '主分类', children: [] };
classify.children = this.handleTree(response.data, "id");
this.classifyList.push(classify);
}
});
},
@ -413,6 +427,17 @@
}
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.cateName,
children: node.children
};
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {

View File

@ -353,7 +353,7 @@
});
}
});
console.log(this.threeLevelClassify.length);
//console.log(this.threeLevelClassify.length);
this.classifyOptions.push(classify);
});
},