zjf
2023-03-08 51468f93275c2bcfcc7ad25bf05f3d6a079ff764
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
  <div class="section">
    <div
      v-if="title && title.length > 0"
      class="section-header">
      <div
        :style="{ 'border-left-color': mColor }"
        class="section-mark"/>
      <div class="section-title">{{ title }}</div>
      <flexbox
        v-if="showF"
        class="f-container">
        <div
          v-for="(item, index) in fItems"
          :key="index"
          :class="{ 'f-item-select':fIndex==item.type }"
          class="f-item"
          @click="fClick(item)">{{ item.title }}</div>
      </flexbox>
    </div>
    <div
      :style="{ 'height': contentHeight }"
      class="content">
      <div
        v-if="showNoData"
        class="no-data-container">
        <img
          class="no-data"
          src="@/assets/img/no_data.png" >
        <div class="no-data-name">暂无数据</div>
      </div>
      <slot/>
    </div>
  </div>
</template>
<script type="text/javascript">
export default {
  name: 'Sections',
  components: {},
  props: {
    title: {
      type: String,
      default: ''
    },
    mColor: {
      type: String,
      default: '#FF6767'
    },
    /** 内容区域固定高度 */
    contentHeight: {
      type: String,
      default: '327px'
    },
    /** 展示客户工作台  重要提醒 时间筛选 */
    showF: {
      type: Boolean,
      default: false
    },
    fItems: {
      type: Array,
      default: () => {
        return []
      }
    },
    /** 展示无数据 */
    showNoData: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      fIndex: -1
    }
  },
  computed: {},
  mounted () {},
  methods: {
    fClick (item) {
      this.fIndex = item.type
      this.$emit('f-click', 'val')
    }
  }
}
</script>
<style lang="less" scoped>
.section {
  position: relative;
  background-color: white;
  margin-top: 8px;
}
.section:first-child {
  margin-top: 0;
}
 
.section-mark {
  border-left-width: 2px;
  border-left-style: solid;
  height: 16px;
}
 
.section-header {
  display: flex;
  align-items: center;
  padding: 5px 15px;
}
.section-title {
  font-size: 18px;
  color: #333;
  font-weight: 550;
  margin-left: 8px;
  flex-shrink: 0;
}
 
.f-container {
  width: auto;
  margin-left: 40px;
  .f-item {
    padding: 2px 4px;
    font-size: 12px;
    margin-right: 10px;
    color: #666;
  }
  .f-item-select {
    border-radius: 2px;
    background-color: #ff6767;
    color: white;
  }
}
 
.content {
  overflow: auto;
  .no-data-container {
    text-align: center;
    .no-data {
      margin-top: 30px;
    }
    .no-data-name {
      font-size: 12px;
      margin-top: 8px;
      color: #666;
    }
  }
}
</style>