Commit aaa985a4 by 张立顺

tab 组件

1 parent 1f20755c
...@@ -326,7 +326,7 @@ export default { ...@@ -326,7 +326,7 @@ export default {
} }
} }
</script> </script>
<style> <style scoped>
.dateItem { .dateItem {
display: flex; display: flex;
} }
...@@ -334,9 +334,9 @@ export default { ...@@ -334,9 +334,9 @@ export default {
display: flex; display: flex;
margin-left: 0 !important; margin-left: 0 !important;
} }
::v-deep .accountDailog {
/*下拉选择框-多选-内容过长-用...代替 begin */ /*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info { .el-tag.el-tag--info {
background-color: #f4f4f5; background-color: #f4f4f5;
border-color: #e9e9eb; border-color: #e9e9eb;
color: #909399; color: #909399;
...@@ -344,22 +344,23 @@ export default { ...@@ -344,22 +344,23 @@ export default {
/* white-space: nowrap; /* white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden;*/ overflow: hidden;*/
} }
.el-tag.el-tag--info { .el-tag.el-tag--info {
width: calc(100% - 200px); width: calc(100% - 200px);
} }
.el-tag.el-tag--info .el-select__tags-text { .el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px); width: calc(100% - 20px);
float: left; float: left;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
/*下拉选择框-多选-内容过长-用...代替 end */ /*下拉选择框-多选-内容过长-用...代替 end */
.accountDailog .el-dialog { .accountDailog .el-dialog {
min-width: 700px; min-width: 700px;
} }
.accountDailog .el-select-dropdown__item { .accountDailog .el-select-dropdown__item {
width: 395px !important; width: 395px !important;
}
} }
</style> </style>
<template> <template>
<div class="classificationCptContainer"> <div class="classificationCptContainer">
<div>classificationCpt</div>
<el-form ref="classification"
:model="classificationObj"
:rules="rules"
label-suffix=":"
label-width="180px">
<p class="edit-sub-title">
分账品类
<!-- <span class="title-tips"></span> -->
</p>
<el-form-item label="选择商品:"
prop="goodsTypeGroupRelations"
required>
<!-- collapse-tags -->
<el-select v-model="classificationObj.goodsTypeGroupRelations"
@change="goodsSelectChange"
value-key="goodsType"
multiple
placeholder="请选择商品">
<el-option v-for="item in goodsList"
:key="item.goodsType"
:label="2222"
:value="item" />
</el-select>
</el-form-item>
</el-form>
<!-- <div>classificationCpt</div> -->
<!-- <div class="headerContainer"></div> <!-- <div class="headerContainer"></div>
<div class="publicContainer"></div> <div class="publicContainer"></div>
<el-tabs type="border-card"> <el-tabs type="border-card">
...@@ -22,6 +50,23 @@ import { mapActions, mapState, mapMutations } from 'vuex' ...@@ -22,6 +50,23 @@ import { mapActions, mapState, mapMutations } from 'vuex'
export default { export default {
name: 'ClassificationCpt', name: 'ClassificationCpt',
// isNeedVuex: true, // isNeedVuex: true,
props: {
goodsList: {
type: Array,
// 必要
required: true
}
},
data() {
return {
classificationObj: {
goodsTypeGroupRelations: []
},
rules: {
goodsTypeGroupRelations: [{ required: true, message: '请选择商品', trigger: 'change' }]
}
}
},
computed: { computed: {
...mapState({ ...mapState({
...@@ -31,6 +76,7 @@ export default { ...@@ -31,6 +76,7 @@ export default {
} }
}) })
}, },
mounted() { mounted() {
// console.log(this.test, 'test') // console.log(this.test, 'test')
}, },
...@@ -38,10 +84,18 @@ export default { ...@@ -38,10 +84,18 @@ export default {
methods: { methods: {
...mapActions('FinancialRules', ['reset']), ...mapActions('FinancialRules', ['reset']),
...mapMutations('FinancialRules', ['toggle', 'set']) ...mapMutations('FinancialRules', ['toggle', 'set']),
goodsSelectChange() {
this.$forceUpdate()
console.log(this.classificationObj)
}
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.edit-sub-title {
padding-bottom: 15px;
border-bottom: 1px solid #e8e8ea;
}
</style> </style>
...@@ -102,18 +102,31 @@ ...@@ -102,18 +102,31 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-tabs type="border-card"> <!-- @tab-click="clickTab" -->
<el-tab-pane> <el-tabs v-model="editableTabsValue"
<span slot="label"><i class="el-icon-date" /> 我的行程</span> type="card"
我的行程 @tab-remove="removeTab"
:before-leave="beforeLeave"
class="my-tab-pane">
<!-- closable -->
<el-tab-pane v-for="(item, idx) in editableTabs"
:key="item.name"
:label="item.title"
:name="item.name"
:closable="idx!=0">
<span slot="label"><i class="el-icon-warning car-error-txt" />{{ item.title }} </span>
</el-tab-pane>
<el-tab-pane key="add"
name="add">
<!-- //这是增加的按钮 -->
<span slot="label"
style="padding: 8px;font-size:20px;font-weight:bold;">+</span>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="消息中心">消息中心</el-tab-pane>
<el-tab-pane label="角色管理">角色管理</el-tab-pane>
<el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane>
</el-tabs> </el-tabs>
<div class="classificationCptContainer"> <div class="classificationCptContainer">
<classificationCpt /> <classificationCpt :goods-list="goodsTypeGroupRelations" />
</div> </div>
<div class="footer"> <div class="footer">
<el-button>取消</el-button> <el-button>取消</el-button>
<el-button type="primary">确认</el-button> <el-button type="primary">确认</el-button>
...@@ -158,7 +171,26 @@ export default { ...@@ -158,7 +171,26 @@ export default {
merchantTestVisible: false, merchantTestVisible: false,
financialCalculationVisible: false, financialCalculationVisible: false,
tipsDialogVisible: false, tipsDialogVisible: false,
goodsTypeGroupRelations: [
{ goodsType: 1, goodsTypeName: '商品1', label: '商品1' },
{ goodsType: 2, goodsTypeName: '商品2', label: '商品1' },
{ goodsType: 3, goodsTypeName: '商品3', label: '商品1' },
{ goodsType: 4, goodsTypeName: '商品4', label: '商品1' },
{ goodsType: 5, goodsTypeName: '商品5', label: '商品1' },
{ goodsType: 6, goodsTypeName: '商品6', label: '商品1' }
],
sceneList: Object.freeze(sceneList), sceneList: Object.freeze(sceneList),
tabsList: [{ name: '全部商品分类', showIcon: false }],
// tabsIndex: '1',
editableTabsValue: '1',
currentIndex: 1,
addIndex: 1,
tabIndex: 1,
editableTabs: [{
title: '全部分类',
name: '1'
}],
financialObj: { financialObj: {
smsCode: '', smsCode: '',
merchantId: '123456', merchantId: '123456',
...@@ -343,6 +375,63 @@ export default { ...@@ -343,6 +375,63 @@ export default {
}) })
} }
}) })
},
/* 函数定义 */
/* 活动标签切换时触发 */
beforeLeave(currentName, oldName) { // 通过tab标签的切换事件触发增加的函数
console.log(currentName)
// 如果name是add,则调用增加tab的函数
if (currentName == "add") {
this.addTab()
return false
} else {
this.currentIndex = currentName
}
console.log(this.currentIndex)
},
addTab() {
const newTabIndex = ++this.tabIndex + ''
this.editableTabs.push({
title: '特殊品类' + ++this.addIndex,
name: newTabIndex
})
this.editableTabsValue = newTabIndex
this.currentIndex = newTabIndex
},
removeTab(targetName) {
if (this.editableTabs.length <= 1) {
return false
}
var self = this
const tabs = self.editableTabs
let activeName = self.editableTabsValue
if (activeName === targetName) {
tabs.forEach((tab, index) => {
if (tab.name === targetName) {
const nextTab = tabs[index + 1] || tabs[index - 1]
if (nextTab) {
activeName = nextTab.name
}
}
})
}
self.editableTabsValue = activeName
self.editableTabs = tabs.filter(tab => tab.name !== targetName)
self.editableTabs.map((tab, index) => {
tab.title = "特殊品类" + (index + 1)
self.addIndex = (index + 1)
})
self.currentIndex = self.editableTabsValue
self.editableTabs.map((tab, index) => {
console.log(tab, index, self.currentIndex)
if (self.currentIndex === tab.name) {
self.currentFlag = index
}
})
self.$message({
type: 'success',
message: '删除成功!'
})
} }
} }
} }
......
...@@ -139,9 +139,9 @@ export default { ...@@ -139,9 +139,9 @@ export default {
display: flex; display: flex;
margin-left: 0 !important; margin-left: 0 !important;
} }
::v-deep .categoryVisible {
/*下拉选择框-多选-内容过长-用...代替 begin */ /*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info { .el-tag.el-tag--info {
background-color: #f4f4f5; background-color: #f4f4f5;
border-color: #e9e9eb; border-color: #e9e9eb;
color: #909399; color: #909399;
...@@ -149,22 +149,24 @@ export default { ...@@ -149,22 +149,24 @@ export default {
/* white-space: nowrap; /* white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden;*/ overflow: hidden;*/
} }
.el-tag.el-tag--info { .el-tag.el-tag--info {
width: calc(100% - 200px); width: calc(100% - 200px);
} }
.el-tag.el-tag--info .el-select__tags-text { .el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px); width: calc(100% - 20px);
float: left; float: left;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
}
} }
/*下拉选择框-多选-内容过长-用...代替 end */ /*下拉选择框-多选-内容过长-用...代替 end */
.categoryDailog .el-dialog { ::v-deep .categoryDailog .el-dialog {
min-width: 700px; min-width: 700px;
} }
.categoryDailog .el-select-dropdown__item { ::v-deep .categoryDailog .el-select-dropdown__item {
width: 395px !important; width: 395px !important;
} }
</style> </style>
...@@ -407,9 +407,9 @@ export default { ...@@ -407,9 +407,9 @@ export default {
.delete-dialog .delete-title { .delete-dialog .delete-title {
font-size: 16px; font-size: 16px;
} }
::v-deep .service-manage {
/*下拉选择框-多选-内容过长-用...代替 begin */ /*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info { .el-tag.el-tag--info {
background-color: #f4f4f5; background-color: #f4f4f5;
border-color: #e9e9eb; border-color: #e9e9eb;
color: #909399; color: #909399;
...@@ -417,20 +417,21 @@ export default { ...@@ -417,20 +417,21 @@ export default {
/* white-space: nowrap; /* white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden;*/ overflow: hidden;*/
} }
.el-tag.el-tag--info { .el-tag.el-tag--info {
width: calc(100% - 200px); width: calc(100% - 200px);
} }
.el-tag.el-tag--info .el-select__tags-text { .el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px); width: calc(100% - 20px);
float: left; float: left;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
/*下拉选择框-多选-内容过长-用...代替 end */ /*下拉选择框-多选-内容过长-用...代替 end */
.el-select-dropdown__item { .el-select-dropdown__item {
width: 395px !important; width: 395px !important;
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!