Commit 83471743 authored by 徐一鸣's avatar 徐一鸣

up

parent 66b65a0f
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<ul <ul
class="ces_filter_container" class="ces_filter_container"
ref="filterContainer" ref="filterContainer"
v-if="filterList && filterList.length" v-if="filterList && filterData && filterToggle"
v-show="showFliterList" v-show="showFliterList"
> >
<li v-for="(item, index) in filterList" :key="'f_l_' + index"> <li v-for="(item, index) in filterList" :key="'f_l_' + index">
...@@ -48,13 +48,32 @@ ...@@ -48,13 +48,32 @@
<span v-text="item.name + ':'"></span> <span v-text="item.name + ':'"></span>
</div> </div>
<ul class="ces_filter_data"> <ul class="ces_filter_data">
<li v-for="(v, i) in item.data" :key="'f_l_d_' + index + '_' + i"> <li
v-for="(v, i) in item.data"
:key="'f_l_d_' + index + '_' + i"
v-show="filterToggle[item.prop] || i <= filterLength"
>
<a <a
:class="{ current: isCurrentFilter(item.prop, v) }" :class="{ current: isCurrentFilter(item.prop, v) }"
@click.prevent="selectFilter(item.prop, v)" @click.prevent="selectFilter(item.prop, v)"
v-text="v" v-text="v"
></a> ></a>
</li> </li>
<div
class="toggle_bar"
v-if="item.data.length > filterLength"
@click="filterToggleAction(item.prop)"
>
<span>{{ filterToggle[item.prop] ? "收起" : "展开" }}</span>
<i
:class="
filterToggle[item.prop]
? 'el-icon-caret-bottom'
: 'el-icon-caret-top'
"
></i>
</div>
</ul> </ul>
</li> </li>
</ul> </ul>
...@@ -159,7 +178,9 @@ ...@@ -159,7 +178,9 @@
trigger="hover" trigger="hover"
:content="scope.row[item.prop]" :content="scope.row[item.prop]"
> >
<div slot="reference" class="overlit">{{scope.row[item.prop]}}</div> <div slot="reference" class="overlit">
{{ scope.row[item.prop] }}
</div>
</el-popover> </el-popover>
<!-- others --> <!-- others -->
<span v-else>{{ scope.row[item.prop] }}</span> <span v-else>{{ scope.row[item.prop] }}</span>
...@@ -342,8 +363,8 @@ export default { ...@@ -342,8 +363,8 @@ export default {
}, },
showHeader: { showHeader: {
type: Boolean, type: Boolean,
default: true default: true,
} },
}, },
data() { data() {
return { return {
...@@ -374,7 +395,9 @@ export default { ...@@ -374,7 +395,9 @@ export default {
search: "", search: "",
times: null, times: null,
showFliterList: false, showFliterList: false,
filterData: null, filterData: null, // 筛选条件
filterToggle: null, // 控制筛选条件的展开和收起
filterLength: 0, // 每行最多可容纳多少个过滤条件
}; };
}, },
mounted() { mounted() {
...@@ -540,16 +563,24 @@ export default { ...@@ -540,16 +563,24 @@ export default {
this.$refs.filterContainer.getBoundingClientRect().width - this.$refs.filterContainer.getBoundingClientRect().width -
20 * 2 - // 两侧padding 20 * 2 - // 两侧padding
100 - // 左侧标题 100 - // 左侧标题
20; // 距左侧标题的边距 20 - // 距左侧标题的边距
console.log("每行最多可容纳" + Math.floor(width / 110) + "个filter"); 110; // 折叠按钮的宽度
this.filterLength = Math.floor(width / 110) - 1;
console.log("每行最多可容纳" + this.filterLength + "个filter");
}); });
} }
}, },
filterToggleAction(prop) {
this.$set(this.filterToggle, prop, !this.filterToggle[prop]);
},
initFilterData() { initFilterData() {
if (this.filterList && this.filterList.length) { if (this.filterList && this.filterList.length) {
this.filterData = {}; this.filterData = {};
this.filterToggle = {};
this.filterList.forEach((item) => { this.filterList.forEach((item) => {
this.$set(this.filterData, item.prop, []); this.$set(this.filterData, item.prop, []);
this.$set(this.filterToggle, item.prop, false);
}); });
} }
}, },
...@@ -759,13 +790,16 @@ em { ...@@ -759,13 +790,16 @@ em {
} }
.ces_filter_data { .ces_filter_data {
width: calc(100% - 120px); width: calc(100% - 120px);
padding-right: 110px;
box-sizing: border-box;
margin-left: 20px; margin-left: 20px;
flex-grow: 1; flex-grow: 1;
flex-wrap: wrap;
display: inline-flex; display: inline-flex;
flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
padding-bottom: 11px; padding-bottom: 11px;
position: relative;
} }
.ces_filter_container > li:not(:last-child) > .ces_filter_data { .ces_filter_container > li:not(:last-child) > .ces_filter_data {
border-bottom: 1px solid #e9ecf3; border-bottom: 1px solid #e9ecf3;
...@@ -774,6 +808,16 @@ em { ...@@ -774,6 +808,16 @@ em {
flex-shrink: 0; flex-shrink: 0;
padding-right: 20px; padding-right: 20px;
} }
.ces_filter_data > .toggle_bar {
height: 30px;
position: absolute;
top: 0;
right: 0;
font-size: 14px;
line-height: 30px;
color: #0f2683;
cursor: pointer;
}
.ces_filter_data > li > a { .ces_filter_data > li > a {
display: block; display: block;
height: 30px; height: 30px;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
:autoAdd="false" :autoAdd="false"
:isDialog="true" :isDialog="true"
:confirmOptions="confirmOptions" :confirmOptions="confirmOptions"
:detailsUrl="detailsUrl" detailsUrl="/servicedetail/"
@primary-edit="editItem" @primary-edit="editItem"
@sold-out="soldOutItem" @sold-out="soldOutItem"
:emptyText="emptyText" :emptyText="emptyText"
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
}, },
methods: { methods: {
editItem(item) { editItem(item) {
console.log(item); this.$router.push("/serviceEdit");
}, },
soldOutItem(item) { soldOutItem(item) {
console.log(item); console.log(item);
......
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