liukangdong
2025-03-12 908ce43ff21c2068ef5148b0a417423c8ed9eae5
h5/pages/visitorApplication/visitorApplication.vue
@@ -430,8 +430,135 @@
            if (type === 'day') {
               return `${value}日`
            }
<<<<<<< HEAD
            this.$forceUpdate()
            this.closeInput()
         },
         closeInput() {
            this.$refs.keyboard.close()
         },
         uploadImg(file) {
            this.$refs.cropper.close()
            uni.showLoading({ title: '上传中', mask: true });
            uni.uploadFile({
               url: `${this.$baseUrl}public/api/uploadFtp.do`,
               filePath: file.tempFilePath,
               name: 'file',
               formData: {
                  folderCode: 'MEMBER_IMG'
               },
               success: (uploadFileRes) => {
                  let res = JSON.parse(uploadFileRes.data)
                  this.withUserList.faceImg = res.data.halfPath
                  this.withUserList.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
               },
               complete() {
                  uni.hideLoading();
               }
            });
         },
         closeMJ() {
            this.show = false
            this.columns.forEach(item => {
               item.active = false
            })
         },
         submit() {
            if (!this.form1.receptMemberId) return uni.showToast({
               title: '请填写有效的访问人',
               icon: 'none'
            })
            if (!this.form1.starttime) return uni.showToast({
               title: '入场时间不能为空',
               icon: 'none'
            })
            if (!this.form1.endtime) return uni.showToast({
               title: '离场时间不能为空',
               icon: 'none'
            })
            if (!this.form1.doorSelectName && this.accessControl == 1) return uni.showToast({
               title: '访问门禁不能为空',
               icon: 'none'
            })
            if (!this.form1.reason) return uni.showToast({
               title: '拜访事由不能为空',
               icon: 'none'
            })
            // this.form1.starttime = this.form1.starttime + ':00'
            // this.form1.endtime = this.form1.endtime + ':00'
            let data = JSON.parse(JSON.stringify(this.form1))
            data.starttime = data.starttime + ':00'
            data.endtime = data.endtime + ':00'
            this.$u.api.createFk({
               ...this.form,
               ...data,
               openid: this.$store.state.openId,
               withUserList: this.personnel
            }).then(res => {
               if (res.code === 200) {
                  uni.reLaunch({
                     url: `/pages/appointmentDetails/appointmentDetails?id=${res.data}`
                  })
               }
            })
         },
         deleUser(i) {
            this.personnel.splice(i, 1)
         },
         getVisit1() {
            // 是否需要答题
            this.$u.api.getSystemDictData({
               dictCode: 'SYSTEM',
               label: 'HEALTH_CARD'
            }).then(res => {
               if (res.code === 200) {
                  this.visit = res.data.code
               }
            })
            // 起始时间时长
            this.$u.api.getSystemDictData({
               dictCode: 'VISIT_CONFIG',
               label: 'VALIDATE_VISIT'
            }).then(res => {
               if (res.code === 200) {
                  this.day = Number(res.data.code)
                  console.log(this.day)
                  // console.log(nextDay('after', true, this.day))
               }
            })
         },
         submitUser() {
            if (!this.withUserList.name) return uni.showToast({
               title: '姓名不能为空',
               icon: 'none'
            })
            if (!this.withUserList.phone) return uni.showToast({
               title: '手机号不能为空',
               icon: 'none'
            })
            const regExp = /^1[3456789]\d{9}$/;
            if (!regExp.test(this.withUserList.phone)) return uni.showToast({
               title: '手机号格式错误',
               icon: 'none'
            })
            if (!String(this.withUserList.idcardType)) return uni.showToast({
               title: '证件类型不能为空',
               icon: 'none'
            })
            if (!this.withUserList.idcardNo) return uni.showToast({
               title: '证件号码不能为空',
               icon: 'none'
            })
            if (this.withUserList.idcardType === 0) {
               const regex = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}[\dxX]$/;
               if (!regex.test(this.withUserList.idcardNo)) return uni.showToast({
                  title: '证件号码格式错误',
                  icon: 'none'
               })
=======
            if (type === 'hour') {
               return `${value}时`
>>>>>>> f0f08cc1ff84d45de32d8bff4a40e6a7d0d7a9e6
            }
            if (type === 'minute') {
               return `${value}分`
@@ -1315,7 +1442,225 @@
                  color: #222222;
               }
            }
<<<<<<< HEAD
            let arr = JSON.parse(JSON.stringify(this.withUserList))
            this.personnel.push(arr)
            this.show3 = false
            this.withUserList.name = ''
            this.withUserList.phone = ''
            this.withUserList.idcardType = ''
            this.withUserList.idcardTypeName = ''
            this.withUserList.companyName = ''
            this.withUserList.idcardNo = ''
            this.withUserList.faceImg = ''
            this.withUserList.faceImgUrl = ''
            this.withUserList.imgurl = ''
            this.withUserList.imgurlUrl = ''
         },
         upload(type) {
            this.type = type
            if (type === 'faceImg') {
               this.$refs.cropper.open()
               return
            }
            uni.chooseImage({
               success: (chooseImageRes) => {
                  // if (type === 'faceImg') {
                  //    this.photoSrc = chooseImageRes.tempFilePaths[0];
                  //    this.$refs.tlyPictureCut.showPop();
                  //    return
                  // }
                  uni.showLoading({ title: '上传中', mask: true });
                  for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
                     uni.uploadFile({
                        url: `${this.$baseUrl}public/api/uploadFtp.do`,
                        filePath: chooseImageRes.tempFilePaths[i],
                        name: 'file',
                        formData: {
                           folderCode: 'MEMBER_IMG'
                        },
                        success: (uploadFileRes) => {
                           let res = JSON.parse(uploadFileRes.data)
                           if (type === 'faceImg') {
                              this.withUserList.faceImg = res.data.halfPath
                              this.withUserList.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
                           } else {
                              this.withUserList.imgurl = res.data.halfPath
                              this.withUserList.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
                           }
                        },
                        complete() {
                           if (i === chooseImageRes.tempFilePaths.length - 1) {
                              uni.hideLoading();
                           }
                        }
                     });
                  }
               }
            });
         },
         seleIdcard(e) {
            this.withUserList.idcardType = e.value[0].id
            this.withUserList.idcardTypeName = e.value[0].name
            this.show6 = false
         },
         submitCart() {
            if (!this.carName) return uni.showToast({
               title: '请输入车牌号码',
               icon: 'none'
            })
            this.cars.push(this.carName)
            this.form1.carNos = this.cars.join(',')
            this.carName = ''
            this.show2 = false
         },
         deleCars(i) {
            this.cars.splice(i, 1)
            this.form1.carNos = this.cars.join(',')
         },
         submitMJ() {
            let arr = []
            let names = []
            this.columns.forEach(item => {
               if (item.active) {
                  arr.push(item.id)
                  names.push(item.name)
               }
            })
            if (arr.length === 0) return uni.showToast({
               title: '请选择门禁',
               icon: 'none'
            })
            this.form1.doorSelectName = names.join(',')
            this.form1.doors = arr.join(',')
            this.show = false
         },
         seleMJ(i) {
            this.columns.forEach((item,index) => {
               if (index === i) {
                  item.active = !item.active
               }
            })
         },
         openLC() {
            if (!this.form1.starttime) return uni.showToast({
               title: '请先选择入厂时间',
               icon: 'none'
            })
            this.show5 = true
         },
         setinDate(e) {
            this.form1.starttime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
            this.maxTime = getDaysAfterDate(uni.$u.timeFormat(e.value, 'yyyy-mm-dd'), this.day - 1)
            this.show4 = false
         },
         setoutDate(e) {
            this.form1.endtime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
            this.show5 = false
         },
         formatTimeStamp(date) {
             return Date.parse(new Date(`${date}`)) || Date.parse(new Date(`${date.replace(/-/g,'/')}`))
         },
         // 查询用户
         getUser() {
            if (this.verify === '0') {
               if (this.form1.phone1) {
                  this.$u.api.getVisitedMember({
                     mobile: this.form1.phone1
                  }).then(res => {
                     if (res.code === 200) {
                        this.form1.receptMemberId = res.data.id
                        this.form1.receptMemberName = res.data.name
                     }
                  })
               }
            } else {
               if (this.form1.phone1 && this.form1.receptMemberName) {
                  this.$u.api.getVisitedMember({
                     mobile: this.form1.phone1,
                     name: this.form1.receptMemberName
                  }).then(res => {
                     if (res.code === 200) {
                        this.form1.receptMemberId = res.data.id
                        this.form1.receptMemberName = res.data.name
                     }
                  })
               }
            }
         },
         // 被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验)
         getUserValid() {
            this.$u.api.getSystemDictData({
               dictCode: 'SYSTEM',
               label: 'BEVISITED_USER_VALID'
            }).then(res => {
               if (res.code === 200) {
                  this.verify = res.data.code
               }
            })
         },
         // 获取是否需要选择门禁/门禁列表
         getvisit() {
            this.$u.api.getSystemDictData({
               dictCode: 'SYSTEM',
               label: 'SELECT_DOORS_VISIT_REQUIRED'
            }).then(res => {
               if (res.code === 200) {
                  this.accessControl = res.data.code
                  if (res.data.code === '1') {
                     this.$u.api.deviceRoleList({ type: 1 })
                        .then(device => {
                           if (device.code === 200) {
                              if (device.data.length > 0) {
                                 device.data.forEach(item => {
                                    item.active = false
                                 })
                                 this.columns = device.data
                              }
                           }
                        })
                  }
               }
            })
         },
         confirm(e) {
            this.show = false
         }
      }
   }
</script>
<style>
   page {
      background-color: #F7F7F7 !important;
   }
   .u-upload__button {
      margin: 0 !important;
   }
</style>
<style lang="scss" scoped>
   .visit {
      width: 100%;
      .menjin {
         width: 100%;
         .respondent-title {
            width: 100%;
            height: 100rpx;
            line-height: 100rpx;
            text-align: center;
            font-size: 32rpx;
            font-weight: 500;
            color: #222222;
         }
         .list {
            width: 100%;
            height: 400rpx;
            display: flex;
            flex-direction: column;
            .list_item {
               width: 100%;
=======
            .checkbox_wrap{
>>>>>>> f0f08cc1ff84d45de32d8bff4a40e6a7d0d7a9e6
               display: flex;
               align-items: center;
               .check_item{