zjf
2023-03-08 92b359a6458fb985b78431e0a2f54b548e01b1ca
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<template>
  <div class="schedule-calendar">
    <div class="title">
      <span>日程</span>
      <div
        class="rt"
        @click="addSchedule">
        <span class="el-icon-plus"/>
        <span>创建</span>
      </div>
    </div>
    <div>
      <Calendar
        :mark-date-more="calendarArr"
        @changeMonth="changeMonth"
        @choseDay="clickDay"/>
      <div v-loading="loading">
        <div
          v-for="(item, index) in scheduleList"
          v-if="index < 1"
          :key="index"
          class="list"
          @click="rowFun(item)">
          <p class="list-title">{{ item.title }}</p>
          <div>
            <span class="time">{{ item.startTime }} - {{ item.endTime }}</span>
            <span>{{ item.realnames }}</span>
          </div>
        </div>
        <p
          v-if="scheduleList.length >= 1"
          class="see-more"
          @click="seeMore">查看更多</p>
      </div>
    </div>
    <!-- 新建日程 -->
    <create-schedule
      v-if="showDialog"
      :text="newText"
      :form-data="formData"
      @onSubmit="onSubmit"
      @closeDialog="closeDialog"/>
  </div>
</template>
 
<script>
import Calendar from 'vue-calendar-component'
import createSchedule from '../schedule/components/createSchedule'
// import { scheduleDayList } from '@/api/oamanagement/workbench'
// import moment from 'moment'
 
export default {
  components: {
    Calendar,
    createSchedule
  },
  props: {
    calendarArr: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      // 日历事件
      scheduleList: [],
      currentMonthDate: new Date(),
      // 新建日程
      formData: {},
      showDialog: false,
      newText: '',
      // 详情
      dialogVisible: false,
      loading: false
    }
  },
  mounted () {
    this.clickDay(new Date())
  },
  methods: {
    // 点击哪一天
    clickDay (date) {
      this.loading = true
      // scheduleDayList({ day: moment(date).format('YYYY-MM-DD') })
      //   .then(res => {
      //     this.scheduleList = res.data
      //     for (const item of document.getElementsByClassName('wh_item_date')) {
      //       item.classList.remove('wh_isToday')
      //     }
      //     this.loading = false
      //   })
      //   .catch(() => {
      //     this.loading = false
      //   })
    },
    // 查看更多
    seeMore () {
      this.$router.push('schedule')
    },
    // 创建日程
    addSchedule () {
      this.formData = {}
      this.showDialog = true
      this.newText = '创建日程'
    },
    // 关闭新建日程弹框
    closeDialog () {
      this.showDialog = false
    },
    onSubmit () {
      this.$emit('changeMonth', this.currentMonthDate)
      this.closeDialog()
    },
    // 查看详情
    rowFun (val) {
      this.dialogVisible = true
    },
    // 切换月份
    changeMonth (val) {
      this.scheduleList = []
      this.currentMonthDate = new Date(val)
      this.$emit('changeMonth', this.currentMonthDate)
    }
  }
}
</script>
 
<style scoped lang="scss">
.schedule-calendar {
  padding-bottom: 20px;
  .title {
    height: 44px;
    line-height: 44px;
    border-bottom: 1px solid #e6e6e6;
    .rt {
      color: #4D88FF;
      margin-right: 0;
      cursor: pointer;
      .el-icon-plus {
        font-weight: 700;
      }
    }
  }
  .list {
    color: #999;
    padding: 10px 11%;
    font-size: 13px;
    cursor: pointer;
    .list-title {
      margin-bottom: 5px;
    }
    .time {
      margin-right: 10px;
      font-size: 12px;
    }
  }
  .see-more {
    color: #999;
    text-align: center;
    cursor: pointer;
  }
}
.schedule-calendar /deep/ .wh_container {
  max-width: max-content;
  .wh_content_all {
    background: #fff;
    .wh_top_changge {
      text-align: center;
      display: block;
      margin: 15px 0 10px;
      li {
        color: #3c8be3;
        display: inline-block;
        height: 13px;
        .wh_jiantou1,
        .wh_jiantou2 {
          border-color: #3c8be3;
          width: 8px;
          height: 8px;
          margin-top: 4px;
        }
      }
      .wh_content_li {
        margin: 0 30px;
        font-weight: 700;
        font-size: 15px;
      }
    }
    .wh_content {
      justify-content: center;
      .wh_content_item {
        color: #333;
        font-size: 14px;
        margin-top: 3px;
        height: 30px;
        position: relative;
        .wh_top_tag {
          color: #bfbfbf;
        }
        .wh_item_date {
          background: transparent;
          width: 30px;
          height: 30px;
        }
        .wh_item_date:hover {
          background: transparent;
          color: #3c8be3;
        }
        .wh_isToday,
        .wh_isToday:hover {
          background: #3487e2;
          border-radius: 30px;
          color: #fff;
        }
        .wh_chose_day,
        .wh_chose_day:hover {
          background: #3487e2;
          border-radius: 40px;
          color: #fff;
        }
        .mark1:after {
          content: ' ';
          background-color: #3c8be3;
          width: 5px;
          height: 5px;
          position: absolute;
          bottom: 0;
          border-radius: 50%;
        }
      }
    }
  }
}
</style>