Commit aaa985a4 by 张立顺

tab 组件

1 parent 1f20755c
......@@ -326,7 +326,7 @@ export default {
}
}
</script>
<style>
<style scoped>
.dateItem {
display: flex;
}
......@@ -334,32 +334,33 @@ export default {
display: flex;
margin-left: 0 !important;
}
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
::v-deep .accountDailog {
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;*/
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
/*下拉选择框-多选-内容过长-用...代替 end */
.accountDailog .el-dialog {
min-width: 700px;
}
.accountDailog .el-select-dropdown__item {
width: 395px !important;
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
/*下拉选择框-多选-内容过长-用...代替 end */
.accountDailog .el-dialog {
min-width: 700px;
}
.accountDailog .el-select-dropdown__item {
width: 395px !important;
}
}
</style>
<template>
<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="publicContainer"></div>
<el-tabs type="border-card">
......@@ -22,6 +50,23 @@ import { mapActions, mapState, mapMutations } from 'vuex'
export default {
name: 'ClassificationCpt',
// isNeedVuex: true,
props: {
goodsList: {
type: Array,
// 必要
required: true
}
},
data() {
return {
classificationObj: {
goodsTypeGroupRelations: []
},
rules: {
goodsTypeGroupRelations: [{ required: true, message: '请选择商品', trigger: 'change' }]
}
}
},
computed: {
...mapState({
......@@ -31,6 +76,7 @@ export default {
}
})
},
mounted() {
// console.log(this.test, 'test')
},
......@@ -38,10 +84,18 @@ export default {
methods: {
...mapActions('FinancialRules', ['reset']),
...mapMutations('FinancialRules', ['toggle', 'set'])
...mapMutations('FinancialRules', ['toggle', 'set']),
goodsSelectChange() {
this.$forceUpdate()
console.log(this.classificationObj)
}
}
}
</script>
<style scoped lang="scss">
.edit-sub-title {
padding-bottom: 15px;
border-bottom: 1px solid #e8e8ea;
}
</style>
......@@ -102,18 +102,31 @@
</el-form-item>
</el-form>
</div>
<el-tabs type="border-card">
<el-tab-pane>
<span slot="label"><i class="el-icon-date" /> 我的行程</span>
我的行程
<!-- @tab-click="clickTab" -->
<el-tabs v-model="editableTabsValue"
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 label="消息中心">消息中心</el-tab-pane>
<el-tab-pane label="角色管理">角色管理</el-tab-pane>
<el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane>
</el-tabs>
<div class="classificationCptContainer">
<classificationCpt />
<classificationCpt :goods-list="goodsTypeGroupRelations" />
</div>
<div class="footer">
<el-button>取消</el-button>
<el-button type="primary">确认</el-button>
......@@ -158,7 +171,26 @@ export default {
merchantTestVisible: false,
financialCalculationVisible: 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),
tabsList: [{ name: '全部商品分类', showIcon: false }],
// tabsIndex: '1',
editableTabsValue: '1',
currentIndex: 1,
addIndex: 1,
tabIndex: 1,
editableTabs: [{
title: '全部分类',
name: '1'
}],
financialObj: {
smsCode: '',
merchantId: '123456',
......@@ -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,32 +139,34 @@ export default {
display: flex;
margin-left: 0 !important;
}
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
::v-deep .categoryVisible {
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;*/
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
/*下拉选择框-多选-内容过长-用...代替 end */
.categoryDailog .el-dialog {
::v-deep .categoryDailog .el-dialog {
min-width: 700px;
}
.categoryDailog .el-select-dropdown__item {
::v-deep .categoryDailog .el-select-dropdown__item {
width: 395px !important;
}
</style>
......@@ -407,30 +407,31 @@ export default {
.delete-dialog .delete-title {
font-size: 16px;
}
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
::v-deep .service-manage {
/*下拉选择框-多选-内容过长-用...代替 begin */
.el-tag.el-tag--info {
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
max-width: calc(100% - 50px);
/* white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;*/
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
/*下拉选择框-多选-内容过长-用...代替 end */
}
.el-tag.el-tag--info {
width: calc(100% - 200px);
}
.el-tag.el-tag--info .el-select__tags-text {
width: calc(100% - 20px);
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
/*下拉选择框-多选-内容过长-用...代替 end */
.el-select-dropdown__item {
width: 395px !important;
.el-select-dropdown__item {
width: 395px !important;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!