zjf
2023-02-24 2126cd24b8a0174ac0597340917c0a4595f72254
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<template>
  <div class="tabs-content">
    <div
      v-for="(item, index) in listData"
      :key="index"
      class="list">
      <template v-if="item.type === 1">
        <tab-journal
          :margin-defaults="true"
          :journal-data="[item]"/>
      </template>
      <template v-else>
        <div
          v-photo="item.createUser"
          v-lazy:background-image="$options.filters.filterUserLazyImg(item.createUser.img)"
          class="div-photo"/>
        <div class="img-text">
          <div class="name-time">
            <p class="name-behavior">
              <span
                v-if="item.createUser.realname"
                class="name">{{ item.createUser.realname }}</span>
              <span class="behavior">{{ item.actionContent }}</span>
            </p>
            <p class="time">{{ item.createTime }}</p>
          </div>
          <div class="log-title">
            <img
              v-if="item.type === 1"
              src="@/assets/img/work_log.png">
            <img
              v-else-if="item.type === 2"
              src="@/assets/img/work_schedule.png">
            <img
              v-else-if="item.type === 3"
              src="@/assets/img/work_notice.png">
            <img
              v-else-if="item.type === 4"
              src="@/assets/img/work_task.png">
            <img
              v-else-if="item.type === 5"
              class="img-5"
              src="@/assets/img/work_examine.png">
            <span class="type-name">{{ item.typeName }}</span>
          </div>
          <div
            v-if="item.title"
            class="title">
            <span
              ref="taskRow"
              @click="rowFun(item)">{{ item.title }}</span>
          </div>
        </div>
      </template>
    </div>
    <slot name="workbenchLoad"/>
    <!-- 公告详情 -->
    <v-details
      v-if="dialog"
      :btn-show="false"
      :title-list="titleList"
      @close="close"/>
    <!-- 日程详情 -->
    <schedule-details
      v-if="showScheduleDetails"
      :btn-show="false"
      :dialog-visible="dialogVisible"
      :list-data="scheduleData"
      @handleClose="scheduleClose"/>
    <!-- 任务详情 -->
    <particulars
      v-if="taskDetailShow"
      ref="particulars"
      :id="taskID"
      @close="taskDetailShow = false"/>
    <!-- 审批详情 -->
    <examine-detail
      v-if="showExamine"
      :id="examineData.id"
      :no-listener-class="['tabs-content']"
      @hide-view="showExamine=false"/>
  </div>
</template>
 
<script>
import VDetails from '../notice/details'
import ScheduleDetails from '../schedule/components/details'
import ExamineDetail from '../examine/components/examineDetail'
// 任务详情
import particulars from '../task/components/particulars'
 
import tabJournal from './tabsJournal'
export default {
  components: {
    VDetails,
    ScheduleDetails,
    particulars,
    tabJournal,
    ExamineDetail
  },
  props: {
    listData: Array
  },
  data () {
    return {
      // 公告详情
      dialog: false,
      titleList: {},
      // 日程详情
      dialogVisible: false,
      scheduleData: {},
      // 任务 -- 详情数据
      taskID: '',
      taskDetailShow: false,
      // 是否显示日程详情
      showScheduleDetails: false,
      // 是否显示审批
      examineData: {},
      showExamine: false
    }
  },
  mounted () {
    document
      .getElementById('workbench-main-container')
      .addEventListener('click', this.taskShowHandle, false)
  },
  methods: {
    rowFun (val) {
      switch (val.type) {
        // 日程
        case 2:
          {
            this.dialogVisible = true
            this.scheduleData = val
            const list = []
            list.push(val.startTime, val.endTime)
            this.scheduleData.time = list
            this.showScheduleDetails = true
          }
          break
        // 公告
        case 3:
          this.dialog = true
          this.titleList = {
            title: val.title,
            createTime: val.createTime,
            content: val.annContent
          }
          break
        // 任务
        case 4:
          this.taskID = val.actionId
          this.taskDetailShow = true
          break
        // 审批
        case 5:
          this.examineData = { id: val.actionId }
          this.showExamine = true
          break
      }
    },
    // 点击空白处关闭详情
    taskShowHandle (e) {
      if (
        this.$refs.particulars &&
        !this.$refs.particulars.$el.contains(e.target)
      ) {
        let hidden = true
        const items = document.getElementsByClassName('tabs-content')
        for (let index = 0; index < items.length; index++) {
          const element = items[index]
          if (element.contains(e.target)) {
            hidden = false
            break
          }
        }
        this.taskDetailShow = !hidden
      }
    },
    // 公告详情关闭
    close () {
      this.dialog = false
    },
    // 日程详情关闭
    scheduleClose () {
      this.dialogVisible = false
    }
  }
}
</script>
 
<style scoped lang="scss">
.tabs-content {
  margin: 0 30px;
  .list {
    font-size: 13px;
    padding: 20px 0;
    border-bottom: 1px solid #f1f1f1;
    .div-photo {
      width: 35px;
      height: 35px;
      border-radius: 17.5px;
      float: left;
    }
    .img-text {
      margin-left: 50px;
      .name-time {
        display: inline-block;
        .name-behavior {
          margin-bottom: 6px;
          .name {
            margin-right: 10px;
            color: #333;
            font-size: 15px;
          }
          .behavior {
            color: #666;
          }
        }
        .time {
          color: #999;
          font-size: 12px;
        }
      }
      .log-title {
        float: right;
        margin-top: 6px;
        img,
        .type-name {
          vertical-align: middle;
        }
        .img-5 {
          margin-bottom: 3px;
        }
      }
      .title {
        margin: 20px 0 0;
        color: #4D88FF;
        white-space: pre-wrap;
        word-wrap: break-word;
        letter-spacing: 0.5px;
        line-height: 18px;
        background-color: #f4f7fd;
        padding: 10px;
        border-radius: 2px;
        span {
          cursor: pointer;
        }
      }
      .title :hover {
        text-decoration: underline;
      }
    }
  }
  .list:last-child .title {
    border: 0;
  }
  .list:first-child {
    padding-top: 5px;
  }
}
</style>