jiangping
2024-10-15 38ac48eeebbf0f046cc75f280e782bc64783af97
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<template>
  <GlobalWindow
    :title="title"
    width="70%"
    :visible.sync="visible"
    append-to-body
    :confirm-working="isWorking"
    @confirm="confirm"
  >
    <div class="list">
      <div class="list_item">
        <div class="list_item_label">拜访信息</div>
        <div class="list_item_val" v-if="info" style="display: inline-block">
          <div class="list_item_val_item">
            拜访对方:{{ info.receptMemberName }} -
            {{ info.receptMemberDepartment }}
          </div>
          <div class="list_item_val_item">
            预约时间:{{ info.starttime }} 至 {{ info.endtime }}
          </div>
          <div class="list_item_val_item" v-if="info.inDate && info.outDate">
            签到时间:{{ info.inDate }} 至 {{ info.outDate }}
          </div>
          <div class="list_item_val_item" v-else>签到时间:-</div>
          <div class="list_item_val_item">拜访事由:{{ info.reason }}</div>
          <div class="list_item_val_item">
            申请人员:{{ info.name }} {{ info.companyName }}
          </div>
          <div class="list_item_val_item">
            申请门禁:{{
              info.deviceRoleList
                ? info.deviceRoleList.map((item) => item.name).join(" | ")
                : "-"
            }}
          </div>
          <div class="list_item_val_item">创建时间:{{ info.createDate }}</div>
        </div>
        <div
          class="list_item_val"
          v-if="info"
          style="display: inline-block; float: right"
        >
          <div class="list_item_val_item" id="qrcode2" ref="qrcode2"></div>
        </div>
      </div>
      <div class="list_item">
        <div class="list_item_label">访客信息</div>
        <div class="list_item_table" v-if="info">
          <el-table
            :data="info.withUserList ? info.withUserList : []"
            border
            :header-cell-style="{
              background: '#dcdde2',
              color: 'rgb(51, 51, 51)',
            }"
            style="width: 100%"
          >
            <el-table-column prop="status" label="状态" min-width="100px">
              <template slot-scope="{ row }">
                <span
                  style="color: rgba(245, 154, 35, 0.996)"
                  v-if="row.status === 0"
                  >待提交审批</span
                >
                <span v-if="row.status === 1">审批中</span>
                <span v-if="row.status === 2">审核通过</span>
                <span style="color: red" v-if="row.status === 3"
                  >审核不通过</span
                >
                <span v-if="row.status === 4">取消</span>
                <span v-if="row.status === 5">预约成功</span>
                <span v-if="row.status === 6">预约失败</span>
                <span v-if="row.status === 7">拜访中</span>
                <span v-if="row.status === 8">已签离</span>
                <span v-if="row.status === 9">已失效</span>
              </template>
            </el-table-column>
            <el-table-column width="150" label="姓名">
              <template slot-scope="{ row }">
                <span>{{ row.name }}</span>
                <span
                  style="
                    border-radius: 5px;
                    padding: 2px 5px;
                    box-sizing: border-box;
                    border: 1px solid #0d68ff;
                    color: #0d68ff;
                    margin-left: 5px;
                  "
                  v-if="info.memberId === row.memberId"
                  >申请人</span
                >
              </template>
            </el-table-column>
            <el-table-column label="性别">
              <template slot-scope="{ row }">
                <span v-if="row.sex === 1">男</span>
                <span v-if="row.sex === 2">女</span>
              </template>
            </el-table-column>
            <el-table-column prop="birthday" label="年龄">
              <template slot-scope="{ row }">
                <span>{{ getAge(row.birthday) }}</span>
              </template>
            </el-table-column>
            <el-table-column width="150" prop="phone" label="手机号">
            </el-table-column>
            <el-table-column label="证件类型">
              <template slot-scope="{ row }">
                <span v-if="row.idcardType === 0">身份证</span>
                <span v-if="row.idcardType === 1">港澳证件</span>
                <span v-if="row.idcardType === 2">护照</span>
              </template>
            </el-table-column>
            <el-table-column width="160" prop="idcardDecode" label="身份证号码">
            </el-table-column>
            <el-table-column width="150" prop="companyName" label="组织">
            </el-table-column>
            <el-table-column width="150" prop="carNos" label="随行车辆">
            </el-table-column>
            <el-table-column width="150" label="访客二维码">
              <template slot-scope="{ row }">
                <div :id="`qrcode${row.id}`" :ref="`qrcode${row.id}`"></div>
              </template>
            </el-table-column>
            <el-table-column width="150" label="人脸照片">
              <template slot-scope="{ row }">
                <el-image
                  v-if="row.faceImg"
                  style="width: 100px; height: 100px"
                  :src="info.prefixUrl + row.faceImg"
                  :preview-src-list="[info.prefixUrl + row.faceImg]"
                >
                </el-image>
              </template>
            </el-table-column>
            <el-table-column width="150" label="健康证">
              <template slot-scope="{ row }">
                <el-image
                  v-if="row.imgurl"
                  style="width: 100px; height: 100px"
                  :src="info.prefixUrl + row.imgurl"
                  :preview-src-list="[info.prefixUrl + row.imgurl]"
                >
                </el-image>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <!--            <div class="list_item">-->
      <!--                <div class="list_item_label">审批流程</div>-->
      <!--                <div class="list_item_status">-->
      <!--                    <div class="list_item_status_item" v-for="(item, index) in 3" :key="index">-->
      <!--                        <div class="dian"></div>-->
      <!--                        <div class="xian"></div>-->
      <!--                        <div class="status_info">-->
      <!--                            <span class="status_info_a">张三提交的劳务在园申请</span>-->
      <!--                            <span class="status_info_b">王经理(已同意)</span>-->
      <!--                            <div class="status_info_c">来访参观工厂,望领导批准</div>-->
      <!--                        </div>-->
      <!--                    </div>-->
      <!--                </div>-->
      <!--            </div>-->
    </div>
  </GlobalWindow>
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { queryById } from '@/api/business/visits'
import QRCode from "qrcodejs2"
export default {
  name: 'OperaVisitsWindow',
  extends: BaseOpera,
  components: { GlobalWindow },
  data() {
    return {
      list: [],
      info: null,
      innerVisible: false
    }
  },
  created() {
  },
  methods: {
    getAge(val) {
      if (!val) return ''
      const currentYear = new Date().getFullYear() // 当前的年份
      const calculationYear = new Date(val).getFullYear() // 计算的年份
      const wholeTime = currentYear + val.substring(4) // 周岁时间
      const calculationAge = currentYear - calculationYear // 按照年份计算的年龄
      // 判断是否过了生日
      if (new Date().getTime() > new Date(wholeTime).getTime()) {
        return calculationAge
      } else {
        return calculationAge - 1
      }
    },
    crateQrcodeShow(div, qrcode1) {
      if (qrcode1 == null || qrcode1 == '') {
        return
      }
      this.qr = new QRCode(div, {
        width: 90,
        height: 90,
        text: qrcode1
      })
    },
 
    open(title, id) {
      this.title = title
      this.visible = true
      queryById(id)
        .then(res => {
          console.log(res)
          this.info = res
          this.$nextTick(() => {
            // this.$refs.qrcode2.innerHTML = ''
            // this.crateQrcodeShow('qrcode2',res.qrcode)
            if (this.info.withUserList) {
              this.info.withUserList.forEach(row => {
                this.$refs['qrcode' + row.id].innerHTML = ''
                this.crateQrcodeShow('qrcode' + row.id, row.qrcode)
              })
            }
          })
        })
    }
  }
}
</script>
<style>
.el-image-viewer__wrapper {
  z-index: 3000 !important;
}
</style>
<style lang="scss" scoped>
.list {
  width: 100%;
  display: flex;
  flex-direction: column;
  .list_item {
    width: 100%;
    margin-bottom: 30px;
    &:last-child {
      margin-bottom: 0 !important;
    }
    .list_item_label {
      font-size: 18px;
      font-weight: 600;
      color: #000000;
      margin-bottom: 15px;
    }
    .list_item_info {
      font-size: 14px;
      color: #222222;
      margin-bottom: 10px;
    }
    .list_item_status {
      width: 100%;
      display: flex;
      flex-direction: column;
      .list_item_status_item {
        width: 100%;
        max-height: 100px;
        position: relative;
        margin-bottom: 30px;
        .dian {
          width: 15px;
          height: 15px;
          border-radius: 50%;
          background: #ffb447;
          position: absolute;
          left: 0;
          top: 50%;
          transform: translate(0, -50%);
        }
        .xian {
          width: 1px;
          height: calc(100% + 30px);
          background: #ffb447;
          position: absolute;
          top: 50%;
          left: 7px;
          transform: translate(-50%, 0);
        }
        .status_info {
          /*width: 100%;*/
          height: 100%;
          display: flex;
          flex-direction: column;
          margin-left: 30px;
          box-sizing: border-box;
          .status_info_a {
            font-size: 16px;
            color: black;
            margin-bottom: 10px;
          }
          .status_info_b {
            font-size: 13px;
            color: #666666;
            margin-bottom: 10px;
          }
          .status_info_c {
            padding: 5px 10px;
            background: #ececec;
            font-size: 13px;
            color: black;
            border-radius: 5px;
            box-sizing: border-box;
          }
        }
      }
    }
    .list_item_val {
      width: 100%;
      margin-bottom: 15px;
      &:last-child {
        margin-bottom: 0 !important;
      }
      .list_item_val_item {
        font-size: 14px;
        color: #222222;
        margin-bottom: 5px;
        &:last-child {
          margin-bottom: 0 !important;
        }
      }
    }
  }
}
</style>