Commit e61bb143 by zhangquan

发现改版

1 parent 1c5e8a57
...@@ -9,16 +9,21 @@ ...@@ -9,16 +9,21 @@
<div class="big-title">产品详情内容配置</div> <div class="big-title">产品详情内容配置</div>
</div> </div>
<div slot="moduleSlot" class="radio-slot"> <div slot="moduleSlot" class="radio-slot">
<el-radio-group @change="menuRadioChange" v-model="formObj.menuId"> <el-radio-group @change="menuRadioChange('firstMenu')" v-model="routeInfo.menuId">
<el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="zoneSlot" class="radio-slot"> <div slot="attrSlot" class="radio-slot">
<el-radio-group v-model="formObj.subMenuId"> <el-radio-group @change="menuRadioChange()" v-model="routeInfo.secondaryMenuId">
<el-radio v-for="item in subMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in secondaryMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="contZoneSlot" class="radio-slot"> <div slot="sceneSlot" class="radio-slot">
<el-radio-group v-model="routeInfo.thirdMenuId">
<el-radio v-for="item in thirdMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="contentSlot" class="radio-slot">
<el-radio-group v-model="formObj.type"> <el-radio-group v-model="formObj.type">
<el-radio :label="formObj.type">{{contentType[formObj.type]}}</el-radio> <el-radio :label="formObj.type">{{contentType[formObj.type]}}</el-radio>
</el-radio-group> </el-radio-group>
...@@ -26,9 +31,13 @@ ...@@ -26,9 +31,13 @@
<div slot="businessSlot" class="business-slot"> <div slot="businessSlot" class="business-slot">
<span class="module">{{routeInfo.menuName}}</span> <span class="module">{{routeInfo.menuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<span class="module">{{routeInfo.subMenuName}}</span> <span class="module">{{routeInfo.secondaryMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<span class="module active">特色产品</span> <template v-if="routeInfo.thirdMenuId">
<span class="module">{{routeInfo.thirdMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
</template>
<span class="module active">特色方案</span>
</div> </div>
<div slot="coverDetailSlot" class="cover-Slot"> <div slot="coverDetailSlot" class="cover-Slot">
<Upload v-if="!formObj.prodImg" :empty="true" @clickEvent="openCoverDialog" :default-style="{width: '84px', height: '84px'}" :formObj="formObj" btnName="创建封面" attr="coverDetail"></Upload> <Upload v-if="!formObj.prodImg" :empty="true" @clickEvent="openCoverDialog" :default-style="{width: '84px', height: '84px'}" :formObj="formObj" btnName="创建封面" attr="coverDetail"></Upload>
...@@ -135,7 +144,7 @@ export default { ...@@ -135,7 +144,7 @@ export default {
routeInfo: {}, routeInfo: {},
coverDeatilFormObj: {}, coverDeatilFormObj: {},
contentType: { contentType: {
1: '特色产品', 1: '特色方案',
2: '案例视频', 2: '案例视频',
3: '营销海报', 3: '营销海报',
4: '操作指引' 4: '操作指引'
...@@ -149,22 +158,38 @@ export default { ...@@ -149,22 +158,38 @@ export default {
{ {
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (!this.formObj.menuId) { callback()
callback(new Error('未选择业务板块'))
} else if (!this.formObj.subMenuId) {
callback(new Error('未选择业务专区'))
} else if (!this.formObj.type) {
callback(new Error('未选择内容专区'))
} else{
callback()
}
}, },
trigger: 'change' trigger: 'change'
} }
], ],
module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
zone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], zone: [{
required: true,
validator: (rule, value, callback) => {
if (!this.routeInfo.secondaryMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
scene: [
{
required: true,
validator: (rule, value, callback) => {
if (this.thirdMenuList.length && !this.routeInfo.thirdMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
title: [ title: [
{ {
required: true, required: true,
...@@ -274,16 +299,22 @@ export default { ...@@ -274,16 +299,22 @@ export default {
addHtml: 'moduleSlot' addHtml: 'moduleSlot'
}, },
{ {
label: '业务专区', label: '业务属性',
name: 'zone', name: 'zone',
isHide: true, isHide: true,
addHtml: 'zoneSlot' addHtml: 'attrSlot'
},
{
label: '场景细分',
name: 'scene',
isHide: true,
addHtml: 'sceneSlot'
}, },
{ {
label: '内容专区', label: '内容专区',
name: 'contZone', name: 'contZone',
isHide: true, isHide: true,
addHtml: 'contZoneSlot' addHtml: 'contentSlot'
}, },
{ {
label: '业务模块', label: '业务模块',
...@@ -380,9 +411,13 @@ export default { ...@@ -380,9 +411,13 @@ export default {
} }
}, },
computed: { computed: {
subMenuList(){ secondaryMenuList(){
const target = this.menuList.find(item => item.id == this.formObj.menuId) const target = this.menuList.find(item => item.id == this.routeInfo.menuId)
return target?.childList || [] return target?.subList || []
},
thirdMenuList(){
const target = this.secondaryMenuList.find(item => item.id == this.routeInfo.secondaryMenuId)
return target?.subList || []
} }
}, },
created(){ created(){
...@@ -394,7 +429,7 @@ export default { ...@@ -394,7 +429,7 @@ export default {
this.formObj.type = 1 this.formObj.type = 1
if(id) { if(id) {
this.formData.forEach(item => { this.formData.forEach(item => {
const hideItemList = ['module', 'zone', 'contZone'] const hideItemList = ['module', 'zone', 'contZone', 'scene']
if(hideItemList.includes(item.name)){ if(hideItemList.includes(item.name)){
item.isHide = false item.isHide = false
} }
...@@ -421,11 +456,9 @@ export default { ...@@ -421,11 +456,9 @@ export default {
} }
}) })
}, },
menuRadioChange(e){ menuRadioChange(level){
const target = this.menuList.find(item => item.id == e) this.routeInfo.thirdMenuId = ''
if(target?.childList?.length) { if(level=='firstMenu') this.routeInfo.secondaryMenuId = ''
this.formObj.subMenuId = target?.childList[0]?.id
}
}, },
eventListener(e){ eventListener(e){
if (!this.$refs?.btnRef?.contains(e.target) && !this.$refs?.btnNameRef?.contains(e.target)) this.btnShow = false; if (!this.$refs?.btnRef?.contains(e.target) && !this.$refs?.btnNameRef?.contains(e.target)) this.btnShow = false;
...@@ -545,7 +578,8 @@ export default { ...@@ -545,7 +578,8 @@ export default {
imageUrl: isImage ? this.formObj.imageUrl : '', imageUrl: isImage ? this.formObj.imageUrl : '',
vedioUrl: isImage ? '' : this.formObj.imageUrl, vedioUrl: isImage ? '' : this.formObj.imageUrl,
mediaType: isImage ? 1 : 2, mediaType: isImage ? 1 : 2,
detailList: selectedtypeList detailList: selectedtypeList,
subMenuId: this.routeInfo.thirdMenuId || this.routeInfo.secondaryMenuId
} }
if(this.routeInfo.id) params.id = this.routeInfo.id if(this.routeInfo.id) params.id = this.routeInfo.id
this.$apis.discover.addContentApi(params).then(res => { this.$apis.discover.addContentApi(params).then(res => {
...@@ -591,8 +625,8 @@ export default { ...@@ -591,8 +625,8 @@ export default {
this.isEditType = true this.isEditType = true
}, },
goListPage(){ goListPage(){
const { menuId , subMenuId } = this.formObj const { menuId , thirdMenuId, secondaryMenuId} = this.routeInfo
window.localStorage.setItem('menuInfo', JSON.stringify({menuId , subMenuId})) window.localStorage.setItem('menuInfo', JSON.stringify({menuId , thirdMenuId, secondaryMenuId}))
this.$router.push({path: '/discoverManager/index'}) this.$router.push({path: '/discoverManager/index'})
} }
} }
......
...@@ -2,16 +2,21 @@ ...@@ -2,16 +2,21 @@
<GLDialog mode="mid" :close-on-click-modal="false" :title="title" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel"> <GLDialog mode="mid" :close-on-click-modal="false" :title="title" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel">
<glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules"> <glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules">
<div slot="moduleSlot" class="radio-slot"> <div slot="moduleSlot" class="radio-slot">
<el-radio-group @change="menuRadioChange" v-model="formObj.menuId"> <el-radio-group @change="menuRadioChange('firstMenu')" v-model="contentObj.menuId">
<el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="zoneSlot" class="radio-slot"> <div slot="attrSlot" class="radio-slot">
<el-radio-group v-model="formObj.subMenuId"> <el-radio-group @change="menuRadioChange()" v-model="contentObj.secondaryMenuId">
<el-radio v-for="item in subMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in secondaryMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="contZoneSlot" class="radio-slot"> <div slot="sceneSlot" class="radio-slot">
<el-radio-group v-model="contentObj.thirdMenuId">
<el-radio v-for="item in thirdMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="contentSlot" class="radio-slot">
<el-radio-group v-model="formObj.type"> <el-radio-group v-model="formObj.type">
<el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio> <el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio>
</el-radio-group> </el-radio-group>
...@@ -19,8 +24,12 @@ ...@@ -19,8 +24,12 @@
<div slot="businessSlot" class="global-menu"> <div slot="businessSlot" class="global-menu">
<span class="module">{{contentObj.menuName}}</span> <span class="module">{{contentObj.menuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<span class="module">{{contentObj.subMenuName}}</span> <span class="module">{{contentObj.secondaryMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<template v-if="contentObj.thirdMenuId">
<span class="module">{{contentObj.thirdMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
</template>
<span class="module active">{{contentType[contentObj.type]}}</span> <span class="module active">{{contentType[contentObj.type]}}</span>
</div> </div>
<div slot="mainVideoSlot" class="main-video-slot"> <div slot="mainVideoSlot" class="main-video-slot">
...@@ -80,16 +89,22 @@ export default { ...@@ -80,16 +89,22 @@ export default {
addHtml: 'moduleSlot' addHtml: 'moduleSlot'
}, },
{ {
label: '业务专区', label: '业务属性',
name: 'zone', name: 'zone',
isHide: true, isHide: true,
addHtml: 'zoneSlot' addHtml: 'attrSlot'
},
{
label: '场景细分',
name: 'scene',
isHide: true,
addHtml: 'sceneSlot'
}, },
{ {
label: '内容专区', label: '内容专区',
name: 'contZone', name: 'contZone',
isHide: true, isHide: true,
addHtml: 'contZoneSlot' addHtml: 'contentSlot'
}, },
{ {
label: '业务模块', label: '业务模块',
...@@ -123,10 +138,32 @@ export default { ...@@ -123,10 +138,32 @@ export default {
proName: [{ required: true, message: '请输入海报标题', trigger: 'change' }], proName: [{ required: true, message: '请输入海报标题', trigger: 'change' }],
business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
zone: [{required: true, validator: (rule, value, callback) => { zone: [{
return callback() required: true,
}, trigger: 'change'}], validator: (rule, value, callback) => {
if (!this.contentObj.secondaryMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
scene: [
{
required: true,
validator: (rule, value, callback) => {
if (this.thirdMenuList.length && !this.contentObj.thirdMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
prodImg: [ prodImg: [
{ {
required: true, required: true,
...@@ -148,21 +185,25 @@ export default { ...@@ -148,21 +185,25 @@ export default {
title(){ title(){
return `${this.formObj.id ? '编辑': '新增'}${this.formObj.type==5 ? 'banner' : '内容'}` return `${this.formObj.id ? '编辑': '新增'}${this.formObj.type==5 ? 'banner' : '内容'}`
}, },
subMenuList(){ secondaryMenuList(){
const target = this.menuList.find(item => item.id == this.formObj.menuId) const target = this.menuList.find(item => item.id == this.contentObj.menuId)
return target?.childList || [] return target?.subList || []
},
thirdMenuList(){
const target = this.secondaryMenuList.find(item => item.id == this.contentObj.secondaryMenuId)
return target?.subList || []
} }
}, },
created() { created() {
const {menuId, subMenuId , type} = this.contentObj const { secondaryMenuId ,thirdMenuId , type} = this.contentObj
this.formObj = {...this.formObj, menuId, subMenuId , type} this.formObj = {...this.formObj, subMenuId: thirdMenuId || secondaryMenuId, type}
if(this.contentObj.id) { if(this.contentObj.id) {
this.formData.forEach(item => { this.formData.forEach(item => {
if(type==5){ if(type==5){
item.isHide = !(item.name == 'isLink' || item.name == 'prodImg') item.isHide = !(item.name == 'isLink' || item.name == 'prodImg')
if(item.name == 'prodImg') item.label == 'banner' if(item.name == 'prodImg') item.label == 'banner'
}else{ }else{
const hideItemList = ['module', 'zone', 'contZone'] const hideItemList = ['module', 'zone', 'contZone', 'scene']
if(hideItemList.includes(item.name)){ if(hideItemList.includes(item.name)){
item.isHide = false item.isHide = false
} }
...@@ -173,11 +214,9 @@ export default { ...@@ -173,11 +214,9 @@ export default {
} }
}, },
methods: { methods: {
menuRadioChange(e){ menuRadioChange(level){
const target = this.menuList.find(item => item.id == e) this.contentObj.thirdMenuId = ''
if(target?.childList?.length) { if(level=='firstMenu') this.contentObj.secondaryMenuId = ''
this.formObj.subMenuId = target?.childList[0]?.id
}
}, },
getMenuList() { getMenuList() {
this.$apis.discover.getMenuListApi({}).then(res => { this.$apis.discover.getMenuListApi({}).then(res => {
...@@ -208,6 +247,7 @@ export default { ...@@ -208,6 +247,7 @@ export default {
this.$refs.videoRef.$refs.formRef.validate(valid => { this.$refs.videoRef.$refs.formRef.validate(valid => {
if(valid) { if(valid) {
const params = JSON.parse(JSON.stringify(this.formObj)) const params = JSON.parse(JSON.stringify(this.formObj))
params.subMenuId = this.contentObj.thirdMenuId || this.contentObj.secondaryMenuId
if(!this.contentObj.id) delete params.id if(!this.contentObj.id) delete params.id
if(this.contentObj.type==3){ if(this.contentObj.type==3){
delete params.isLink delete params.isLink
......
...@@ -2,16 +2,21 @@ ...@@ -2,16 +2,21 @@
<GLDialog mode="mid" :close-on-click-modal="false" :title="title" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel"> <GLDialog mode="mid" :close-on-click-modal="false" :title="title" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel">
<glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules"> <glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules">
<div slot="moduleSlot" class="radio-slot"> <div slot="moduleSlot" class="radio-slot">
<el-radio-group @change="menuRadioChange" v-model="formObj.menuId"> <el-radio-group @change="menuRadioChange('firstMenu')" v-model="contentObj.menuId">
<el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="zoneSlot" class="radio-slot"> <div slot="attrSlot" class="radio-slot">
<el-radio-group v-model="formObj.subMenuId"> <el-radio-group @change="menuRadioChange()" v-model="contentObj.secondaryMenuId">
<el-radio v-for="item in subMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in secondaryMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div slot="contZoneSlot" class="radio-slot"> <div slot="sceneSlot" class="radio-slot">
<el-radio-group v-model="contentObj.thirdMenuId">
<el-radio v-for="item in thirdMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="contentSlot" class="radio-slot">
<el-radio-group v-model="formObj.type"> <el-radio-group v-model="formObj.type">
<el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio> <el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio>
</el-radio-group> </el-radio-group>
...@@ -19,8 +24,12 @@ ...@@ -19,8 +24,12 @@
<div slot="businessSlot" class="global-menu"> <div slot="businessSlot" class="global-menu">
<span class="module">{{contentObj.menuName}}</span> <span class="module">{{contentObj.menuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<span class="module">{{contentObj.subMenuName}}</span> <span class="module">{{contentObj.secondaryMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i> <i class="el-icon-arrow-right arrow-right"></i>
<template v-if="contentObj.thirdMenuId">
<span class="module">{{contentObj.thirdMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
</template>
<span class="module active">{{contentType[contentObj.type]}}</span> <span class="module active">{{contentType[contentObj.type]}}</span>
</div> </div>
<div slot="mainVideoSlot" class="main-video-slot"> <div slot="mainVideoSlot" class="main-video-slot">
...@@ -82,16 +91,22 @@ export default { ...@@ -82,16 +91,22 @@ export default {
addHtml: 'moduleSlot' addHtml: 'moduleSlot'
}, },
{ {
label: '业务专区', label: '业务属性',
name: 'zone', name: 'zone',
isHide: true, isHide: true,
addHtml: 'zoneSlot' addHtml: 'attrSlot'
},
{
label: '场景细分',
name: 'scene',
isHide: true,
addHtml: 'sceneSlot'
}, },
{ {
label: '内容专区', label: '内容专区',
name: 'contZone', name: 'contZone',
isHide: true, isHide: true,
addHtml: 'contZoneSlot' addHtml: 'contentSlot'
}, },
{ {
label: '业务模块', label: '业务模块',
...@@ -158,10 +173,32 @@ export default { ...@@ -158,10 +173,32 @@ export default {
view: [{ required: true, message: '请输入观看人数', trigger: 'change' }], view: [{ required: true, message: '请输入观看人数', trigger: 'change' }],
business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
zone: [{required: true, validator: (rule, value, callback) => { zone: [{
return callback() required: true,
}, trigger: 'change'}], validator: (rule, value, callback) => {
if (!this.contentObj.secondaryMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}], contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
scene: [
{
required: true,
validator: (rule, value, callback) => {
if (this.thirdMenuList.length && !this.contentObj.thirdMenuId) {
return callback(new Error('请选择场景细分'))
}else {
return callback()
}
},
trigger: 'change'
}
],
mainVideo: [ mainVideo: [
{ {
required: true, required: true,
...@@ -185,17 +222,21 @@ export default { ...@@ -185,17 +222,21 @@ export default {
title(){ title(){
return `${this.formObj.id ? '编辑': '新增'}${this.contentObj.type==2 ? '案例视频' : '操作指引'}` return `${this.formObj.id ? '编辑': '新增'}${this.contentObj.type==2 ? '案例视频' : '操作指引'}`
}, },
subMenuList(){ secondaryMenuList(){
const target = this.menuList.find(item => item.id == this.formObj.menuId) const target = this.menuList.find(item => item.id == this.contentObj.menuId)
return target?.childList || [] return target?.subList || []
},
thirdMenuList(){
const target = this.secondaryMenuList.find(item => item.id == this.contentObj.secondaryMenuId)
return target?.subList || []
} }
}, },
created() { created() {
const {menuId, subMenuId , type} = this.contentObj const { secondaryMenuId ,thirdMenuId , type} = this.contentObj
this.formObj = {...this.formObj, menuId, subMenuId , type} this.formObj = {...this.formObj, subMenuId: thirdMenuId || secondaryMenuId, type}
if(this.contentObj.id) { if(this.contentObj.id) {
this.formData.forEach(item => { this.formData.forEach(item => {
const hideItemList = ['module', 'zone', 'contZone'] const hideItemList = ['module', 'zone', 'contZone', 'scene']
if(hideItemList.includes(item.name)){ if(hideItemList.includes(item.name)){
item.isHide = false item.isHide = false
} }
...@@ -205,11 +246,9 @@ export default { ...@@ -205,11 +246,9 @@ export default {
} }
}, },
methods: { methods: {
menuRadioChange(e){ menuRadioChange(level){
const target = this.menuList.find(item => item.id == e) this.contentObj.thirdMenuId = ''
if(target?.childList?.length) { if(level=='firstMenu') this.contentObj.secondaryMenuId = ''
this.formObj.subMenuId = target?.childList[0]?.id
}
}, },
getMenuList() { getMenuList() {
this.$apis.discover.getMenuListApi({}).then(res => { this.$apis.discover.getMenuListApi({}).then(res => {
...@@ -223,7 +262,7 @@ export default { ...@@ -223,7 +262,7 @@ export default {
this.detailVisible = false this.detailVisible = false
}, },
onCancel(){ onCancel(){
console.log(this.formObj) console.log(this.contentObj)
this.contentObj.videoDialogVisible = false this.contentObj.videoDialogVisible = false
// this.$emit('closeVideoDialog') // this.$emit('closeVideoDialog')
}, },
...@@ -242,6 +281,7 @@ export default { ...@@ -242,6 +281,7 @@ export default {
this.$refs.videoRef.$refs.formRef.validate(valid => { this.$refs.videoRef.$refs.formRef.validate(valid => {
if(valid) { if(valid) {
const params = JSON.parse(JSON.stringify(this.formObj)) const params = JSON.parse(JSON.stringify(this.formObj))
params.subMenuId = this.contentObj.thirdMenuId || this.contentObj.secondaryMenuId
if(!this.contentObj.id) delete params.id if(!this.contentObj.id) delete params.id
this.$apis.discover.addContentApi(params).then(res => { this.$apis.discover.addContentApi(params).then(res => {
if(res) { if(res) {
......
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
:data="menuList" :data="menuList"
node-key="id" node-key="id"
default-expand-all default-expand-all
:props="defaultProps" :props="defaultProps">
:expand-on-click-node="false"> <span :class="['custom-tree-node',{'menu-active': (!curModuleInfo.thirdMenuId && node.level ==2 && curModuleInfo.secondaryMenuId == data.id) || (curModuleInfo.thirdMenuId== data.id && node.level ==3)}]" slot-scope="{ node, data }" @click="selectedSubmenu('tree' ,node)" >
<span :class="['custom-tree-node',{'menu-active': curModuleInfo.subMenuId == data.id}]" slot-scope="{ node, data }" @click="slectedSubmenu(node, data, 'tree')" >
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
<span class="son-operate-wrap"> <span class="son-operate-wrap">
<img class="operate-btn" @click.stop="showOperateDialog(node, data)" :src="require('@/assets/draggable.png')" /> <img class="operate-btn" @click.stop="showOperateDialog(node, data)" :src="require('@/assets/draggable.png')" />
<div class="son-operate-dialog" ref="menuOpRef" v-show="boxShow && menuForm.id == data.id"> <div class="son-operate-dialog" ref="menuOpRef" v-show="boxShow && menuForm.id == data.id">
<ul> <ul>
<li class="operate-item" v-for="oItem in node.level ==1 ? primaryLevelOpList : secondLevelOpList" :key="oItem.name" @click.stop="addMenu(oItem)">{{ oItem.name }}</li> <li class="operate-item" v-for="oItem in node.level ==1 ? primaryLevelOpList : node.level ==2 ? secondLevelOpList : secondLevelOpList.slice(1, 4)" :key="oItem.name" @click.stop="addMenu(oItem)">{{ oItem.name }}</li>
</ul> </ul>
</div> </div>
</span> </span>
...@@ -49,7 +48,7 @@ ...@@ -49,7 +48,7 @@
return { return {
menuVisible: false, menuVisible: false,
defaultProps: { defaultProps: {
children: 'childList', children: 'subList',
label: 'name' label: 'name'
}, },
menuForm: { menuForm: {
...@@ -88,6 +87,11 @@ ...@@ -88,6 +87,11 @@
], ],
secondLevelOpList:[ secondLevelOpList:[
{ {
name: '新增子级',
type: 'add',
position: 1
},
{
name: '下方新增同级', name: '下方新增同级',
type: 'add', type: 'add',
position: 3 position: 3
...@@ -106,8 +110,10 @@ ...@@ -106,8 +110,10 @@
curModuleInfo: { curModuleInfo: {
menuName: '', menuName: '',
menuId: '', menuId: '',
subMenuName: '', secondaryMenuName: '',
subMenuId: '' secondaryMenuId: '',
thirdMenuName: '',
thirdMenuId: '',
}, },
boxShow: false boxShow: false
} }
...@@ -130,34 +136,70 @@ ...@@ -130,34 +136,70 @@
eventListener(e){ eventListener(e){
if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false; if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false;
}, },
allowDrop(draggingNode, dropNode, type) {
console.log(draggingNode, dropNode, type)
if (draggingNode.level === dropNode.level) {
return type === 'prev' || type === 'next'
} else if (draggingNode.level == 2 && dropNode.level==1) {
return type === 'inner'
} else {
return false
}
},
getMenuList(type, menuInfo) { getMenuList(type, menuInfo) {
this.$apis.discover.getMenuListApi({}).then(res => { this.$apis.discover.getMenuListApi({}).then(res => {
if(res?.length){ if(res?.length){
this.menuList = res this.menuList = res
let menuItem = res[0]
let subMenuItem = res[0]?.childList[0] || {} let menuItem = res[0] || {}
let secondaryMenuItem = menuItem?.subList[0] || {}
let thirdMenuItem = secondaryMenuItem?.subList[0] || {}
if(type=='rename') { if(type=='rename') {
let menuId = menuInfo ? menuInfo.menuId : this.curModuleInfo.menuId let curItem = menuInfo ? menuInfo : this.curModuleInfo
let subMenuId = menuInfo ? menuInfo.subMenuId : this.curModuleInfo.subMenuId const {menuId, secondaryMenuId, thirdMenuId} = curItem
menuItem = res.find(item => item.id == menuId) menuItem = res.find(item => item.id == menuId)
subMenuItem = menuItem?.childList?.find(item => item.id == subMenuId) secondaryMenuItem = menuItem?.subList?.find(item => item.id == secondaryMenuId)
thirdMenuItem = secondaryMenuItem?.subList?.find(item => item.id == thirdMenuId)
window.localStorage.removeItem('menuInfo') window.localStorage.removeItem('menuInfo')
} }
this.slectedSubmenu(menuItem, subMenuItem) // else{
// res.forEach(item => {
// item.subList.forEach(ele => {
// if(ele.subList?.length){
// menuItem = item
// secondaryMenuItem = ele
// thirdMenuItem = ele.subList[0]
// }
// })
// })
// }
this.selectedSubmenu('', menuItem, secondaryMenuItem, thirdMenuItem)
} }
}) })
}, },
slectedSubmenu(menuItem, subMenuItem = {},type){ selectedSubmenu(type, menuItem={}, secondaryMenuItem={}, thirdMenuItem={}){
console.log(menuItem, subMenuItem) console.log(menuItem)
let firstMenuItem = menuItem
if(type=='tree') { if(type=='tree') {
if(menuItem.level==1) return if(menuItem.level==1) return
menuItem = menuItem?.parent?.data || {} if(menuItem.level==2) {
if(menuItem.data.subList?.length) return;
firstMenuItem = menuItem?.parent?.data || {}
secondaryMenuItem = menuItem.data
}else{
firstMenuItem = menuItem?.parent?.parent?.data || {}
secondaryMenuItem = menuItem?.parent?.data || {}
thirdMenuItem = menuItem.data
}
} }
console.log(firstMenuItem, secondaryMenuItem, thirdMenuItem)
this.curModuleInfo = { this.curModuleInfo = {
menuName: menuItem.name, menuName: firstMenuItem.name,
menuId: menuItem.id, menuId: firstMenuItem.id,
subMenuName: subMenuItem.name, secondaryMenuName: secondaryMenuItem.name,
subMenuId: subMenuItem.id secondaryMenuId: secondaryMenuItem.id,
thirdMenuName: thirdMenuItem.name || '',
thirdMenuId: thirdMenuItem.id || '',
} }
this.$parent.handleSearch(); this.$parent.handleSearch();
}, },
...@@ -259,10 +301,8 @@ ...@@ -259,10 +301,8 @@
/deep/ .el-tree-node__children{ /deep/ .el-tree-node__children{
overflow: unset; overflow: unset;
.el-tree-node__content{ .el-tree-node__content{
padding-left: 0!important; // padding-left: 0!important;
.custom-tree-node{ .custom-tree-node{
margin-left: 30px;
padding-left: 10px;
&:hover{ &:hover{
background-color: #F5F7FA; background-color: #F5F7FA;
} }
...@@ -272,7 +312,7 @@ ...@@ -272,7 +312,7 @@
background-color: #fff!important; background-color: #fff!important;
} }
.el-tree-node__expand-icon { .el-tree-node__expand-icon {
display: none; // display: none;
} }
} }
/deep/ .el-tree-node.is-current > .el-tree-node__content { /deep/ .el-tree-node.is-current > .el-tree-node__content {
...@@ -284,6 +324,19 @@ ...@@ -284,6 +324,19 @@
} }
} }
/deep/ .menu-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__children>.el-tree-node{
.el-tree-node__expand-icon {
display: none;
}
.custom-tree-node{
margin-left: 10px;
padding-left: 10px;
&:hover{
background-color: #F5F7FA;
}
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
const CONTENT_LIST = [ const CONTENT_LIST = [
{ {
id: '1', id: '1',
name: '特色产品' name: '特色方案'
}, },
{ {
id: '2', id: '2',
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
} }
if(isEdit) params.id = item.id if(isEdit) params.id = item.id
const queryStr = encodeURIComponent(JSON.stringify(params)) const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/discoverManager/addProd/`+queryStr,query: { $title: isEdit ? '编辑特色产品' : '新增特色产品' }}) this.$router.push({ path: `/discoverManager/addProd/`+queryStr,query: { $title: isEdit ? '编辑特色方案' : '新增特色方案' }})
} }
}, },
updateStatus(id, status) { updateStatus(id, status) {
...@@ -263,7 +263,8 @@ export default { ...@@ -263,7 +263,8 @@ export default {
}, },
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchFormObj)) var params = JSON.parse(JSON.stringify(this.searchFormObj))
params.subMenuId = this.$refs.menuRef.curModuleInfo.subMenuId const { secondaryMenuId, thirdMenuId } = this.$refs.menuRef.curModuleInfo
params.subMenuId = thirdMenuId || secondaryMenuId
return params return params
}, },
beforeSearchFn() { beforeSearchFn() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!