Commit 409ca0e0 authored by 耿迪迪's avatar 耿迪迪

视频分类添加

parent 59c84b03
......@@ -29,6 +29,11 @@ public class TVideoManage extends BaseEntity
@Excel(name = "类型",readConverterExp = "1=华鑫,2=鸿海")
private String videoType;
@Excel(name = "分类",dictType = "t_video_kind")
private String kind;
private String sort;
/** 是否删除(0正常,1删除) */
private String isDel;
......@@ -90,6 +95,22 @@ public class TVideoManage extends BaseEntity
this.videoType = videoType;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -13,10 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="videoType" column="video_type" />
<result property="kind" column="kind" />
<result property="sort" column="sort" />
</resultMap>
<sql id="selectTVideoManageVo">
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks, video_type from t_video_manage
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks, video_type, kind, sort from t_video_manage
</sql>
<select id="selectTVideoManageList" parameterType="TVideoManage" resultMap="TVideoManageResult">
......@@ -27,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="videoType != null and videoType != ''"> and video_type = #{videoType}</if>
<if test="kind != null and kind != ''"> and kind = #{kind}</if>
</where>
</select>
......@@ -45,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="videoType != null">video_type,</if>
<if test="kind != null">kind,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="videoName != null">#{videoName},</if>
......@@ -54,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="videoType != null">#{videoType},</if>
<if test="kind != null">#{kind},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
......@@ -66,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="videoType != null">video_type = #{videoType},</if>
<if test="kind != null">kind = #{kind},</if>
<if test="sort != null">sort = #{sort},</if>
</trim>
where video_id = #{videoId}
</update>
......
......@@ -94,6 +94,8 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="视频分类" align="center" prop="kind" :formatter="kindFormat" />
<el-table-column label="视频排序" align="center" prop="sort" />
<el-table-column label="备注" align="center" prop="remarks">
<template slot-scope="scope">
<span v-if="scope.row.remarks">{{ scope.row.remarks }}</span>
......@@ -138,11 +140,29 @@
<el-input v-model="form.videoResource" placeholder="请输入视频资源号" />
</el-form-item>
<el-form-item label="视频资类型" prop="videoType">
<el-select v-model="form.videoType" placeholder="请选择视频资类型" style="width: 100%">
<el-select
v-model="form.videoType"
placeholder="请选择视频资类型"
style="width: 100%"
@change="form.kind = null"
>
<el-option label="华鑫" value="1" />
<el-option label="鸿海" value="2" />
</el-select>
</el-form-item>
<el-form-item label="视频分类" prop="kind">
<el-select v-model="form.kind" placeholder="请选择视频分类" style="width: 100%">
<el-option
v-for="dict in form.videoType == '1' ? huaxinKindOptions : honghaiKindOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="视频排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入视频排序" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
......@@ -208,10 +228,18 @@ export default {
videoType: [
{ required: true, message: "请选择视频类型", trigger: "change" }
]
}
},
huaxinKindOptions: [],
honghaiKindOptions: [],
};
},
created() {
this.getDicts("t_huaxin_video_kind").then(response => {
this.huaxinKindOptions = response.data;
});
this.getDicts("t_honghai_video_kind").then(response => {
this.honghaiKindOptions = response.data;
});
this.getList();
},
methods: {
......@@ -224,6 +252,13 @@ export default {
this.loading = false;
});
},
// 视频分类字典翻译
kindFormat(row, column) {
if(row.videoType == '2'){
return this.selectDictLabel(this.honghaiKindOptions, row.kind);
}
return this.selectDictLabel(this.huaxinKindOptions, row.kind);
},
// 取消按钮
cancel() {
this.open = false;
......@@ -239,7 +274,7 @@ export default {
createTime: null,
isDel: null,
remarks: null,
videoType: null
videoType: '1'
};
this.resetForm("form");
},
......
......@@ -51,7 +51,8 @@ export default {
videoType: "1",
isDel: "0"
},
activeName: "1"
activeName: "1",
kindOptions: []
};
},
created(){
......@@ -59,14 +60,30 @@ export default {
},
methods: {
handleNodeClick(data) {
if(data.videoResource){
this.$emit('playVideo',data);
}
},
getVideoInfo(){
videoInfoList(this.params).then(res =>{
if(res.code == 200 && res.data){
this.data = res.data;
//this.data = res.data;
this.getKindByType(res.data);
}
})
},
// 获取树数据
getTreeData(data){
let treeData = [];
this.kindOptions.forEach(item =>{
let kindData = {videoName: item.dictLabel,children: []};
let videoInfo = data.filter(video => video.kind == item.dictValue ).sort((a, b) => Number(a.sort) - Number(b.sort));
if(videoInfo){
kindData.children = videoInfo
}
treeData.push(kindData);
})
this.data = treeData;
},
search(){
this.params.videoName = this.videoName;
......@@ -75,6 +92,19 @@ export default {
handleClick(tab, event) {
this.params.videoType = tab.name;
this.getVideoInfo();
},
getKindByType(data){
if(this.activeName == '1'){
this.getDicts("t_huaxin_video_kind").then(response => {
this.kindOptions = response.data;
this.getTreeData(data);
});
}else{
this.getDicts("t_honghai_video_kind").then(response => {
this.kindOptions = response.data;
this.getTreeData(data);
});
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment