Browse Source

修改二维码展示

hjs 1 year ago
parent
commit
324869f85b

+ 1 - 1
src/layout/index.vue

@@ -2,7 +2,7 @@
   <div :class="classObj" class="app-wrapper">
     <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
     <sidebar class="sidebar-container" />
-    <div class="main-container">
+    <div class="main-container" style="min-width: 1220px;">
       <div :class="{'fixed-header':fixedHeader}">
         <navbar />
       </div>

+ 34 - 30
src/views/QRCode/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="bg">
-    <div class="container" v-if="placeType === 2 && role == 5">
-      <el-row :gutter="210">
+    <div v-if="placeType === 2 && role == 5" class="container">
+      <el-row :gutter="40">
         <el-col :span="8">
           <div class="app-container">
             <div class="title">{{ qrcodeTitle }}-微信</div>
@@ -30,42 +30,42 @@
     </div>
 
     <!-- 普通场景 -->
-    <div class="container" v-if="genericCode || regularCode || zfbGenericCode || zfbRegularCode">
-      <el-row :gutter="210">
-        <el-col :span="8">
-          <div class="app-container" v-if="genericCode">
+    <div v-if="genericCode || regularCode || zfbGenericCode || zfbRegularCode" class="container">
+      <el-row :gutter="40">
+        <el-col v-if="genericCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 微信通用码</div>
             <div class="flex-center">
               <el-image :src="genericCode" alt="加载失败" class="qrcode" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="regularCode">
+        <el-col v-if="regularCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 微信员工码</div>
             <div class="flex-center">
               <el-image :src="regularCode" class="qrcode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="zfbFkjCode">
+        <el-col v-if="zfbFkjCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 访客机开门二维码</div>
             <div class="flex-center">
               <el-image :src="zfbFkjCode" class="qrcode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="zfbGenericCode">
+        <el-col v-if="zfbGenericCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 支付宝通用码</div>
             <div class="flex-center">
               <el-image :src="zfbGenericCode" class="qrcode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="zfbRegularCode">
+        <el-col v-if="zfbRegularCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 支付宝员工码</div>
             <div class="flex-center">
               <el-image :src="zfbRegularCode" class="qrcode" alt="加载失败" />
@@ -75,8 +75,8 @@
       </el-row>
     </div>
     <!-- 预约场景 -->
-    <div class="container" v-if="reservationCode">
-      <el-row :gutter="210">
+    <div v-if="reservationCode" class="container">
+      <el-row :gutter="40">
         <el-col :span="8">
           <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 内宾码</div>
@@ -96,42 +96,42 @@
       </el-row>
     </div>
     <!-- 楼宇场景 -->
-    <div class="container" v-if="buildingCode || buildingRegularCode">
-      <el-row :gutter="210">
-        <el-col :span="8">
-          <div class="app-container" v-if="buildingCode">
+    <div v-if="buildingCode || buildingRegularCode" class="container">
+      <el-row :gutter="40">
+        <el-col v-if="buildingCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 微信通用码</div>
             <div class="flex-center">
               <el-image class="qrcode" :src="buildingCode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="ZFBbuildingCode">
+        <el-col v-if="ZFBbuildingCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 支付宝通用码</div>
             <div class="flex-center">
               <el-image class="qrcode" :src="ZFBbuildingCode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="zfbFkjCode">
+        <el-col v-if="zfbFkjCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 访客机开门二维码</div>
             <div class="flex-center">
               <el-image :src="zfbFkjCode" class="qrcode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="buildingRegularCode">
+        <el-col v-if="buildingRegularCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 微信员工码</div>
             <div class="flex-center">
               <el-image class="qrcode" :src="buildingRegularCode" alt="加载失败" />
             </div>
           </div>
         </el-col>
-        <el-col :span="8">
-          <div class="app-container" v-if="ZFBbuildingRegularCode">
+        <el-col v-if="ZFBbuildingRegularCode" :span="8">
+          <div class="app-container">
             <div class="title">{{ qrcodeTitle }} - 支付宝员工码</div>
             <div class="flex-center">
               <el-image class="qrcode" :src="ZFBbuildingRegularCode" alt="加载失败" />
@@ -173,7 +173,7 @@ export default {
   },
   methods: {
     pinyin,
-    //获取微信二维码
+    // 获取微信二维码
     getWXQRCode() {
       getInfo().then(({ data }) => {
         this.qrcodeTitle = data.username;
@@ -214,6 +214,10 @@ export default {
 </script>
 
 <style scoped>
+.el-col {
+  display: flex;
+  justify-content: center;
+}
 .bg {
   height: calc(100vh - 50px);
   background-image: url("../../assets/bg.png");
@@ -221,7 +225,7 @@ export default {
   background-repeat: no-repeat;
 }
 .container {
-  padding: 0 120px;
+  padding: 0 80px;
   height: calc(100vh - 60px);
 }
 .app-container {

+ 2 - 4
src/views/basic_setup/index.vue

@@ -827,10 +827,8 @@ export default {
         if (type) {
           this.$message.success("重置成功!")
         } else {
-          if (this.user_form.openThirdLinkPlatform) {
-            this.selectedPlatformAreaList = []
-            this.getPlatformList(this.$store.getters.adminId)
-          }
+          this.selectedPlatformAreaList = []
+          this.getPlatformList(this.$store.getters.adminId)
           if (this.user_form.clockWayPushInterfaceAddresses && this.user_form.clockWayPushInterfaceAddresses.length > 0) {
             this.user_form.clockWayPushInterfaceAddresses = this.user_form.clockWayPushInterfaceAddresses.map(item => {
               return {

+ 2 - 2
src/views/login/index.vue

@@ -260,8 +260,8 @@ $cursor: #fff;
       caret-color: black;
 
       &:-webkit-autofill {
-        box-shadow: 0 0 0px 1000px $bg inset !important;
-        -webkit-text-fill-color: $cursor !important;
+        box-shadow: 0 0 0px 1000px rgb(222,229,246) inset !important;
+        -webkit-text-fill-color: #000 !important;
       }
     }
   }

+ 2 - 21
src/views/visitee_list/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <addModal ref="addModel" :user-list="user_list" :area-list="areaList" :floor-list="floorList" @success="modalSuccess" />
+    <addModal ref="addModel" :user-list="user_list" :area-list="areaList" @success="modalSuccess" />
     <uploadModal ref="uploadModal" :user-list="user_list" :area-list="areaList" @finish="modalSuccess(false)" />
     <!--搜索区-->
     <el-select
@@ -18,14 +18,7 @@
       />
     </el-select>
     <el-input v-model="form.company" placeholder="请输入单位名称" class="margin-left input" />
-    <el-select v-model="form.floor" filterable clearable placeholder="请选择楼层" class="margin-left input" no-data-text="“选择楼层”为空">
-      <el-option
-        v-for="(item, index) in floorList"
-        :key="index"
-        :label="item.key"
-        :value="item.value"
-      />
-    </el-select>
+    <el-input v-model="form.floor" placeholder="请输入楼层" class="margin-left input" />
     <el-input v-model="form.name" placeholder="请输入姓名" class="margin-left input" />
     <el-input v-model="form.phone" placeholder="请输入手机号" class="margin-left input" />
     <el-input v-model="form.idNumber" placeholder="请输入身份证号" class="margin-left input" />
@@ -181,18 +174,6 @@ export default {
       }
     }
   },
-  computed: {
-    floorList() {
-      const temp = []
-      for (let i = 1; i <= 50; i++) {
-        temp.push({
-          key: `${i}楼`,
-          value: `${i}`
-        })
-      }
-      return temp
-    }
-  },
   methods: {
     // 查询权限
     checkRole,

+ 56 - 18
src/views/visitee_list/modal/AddModal.vue

@@ -23,7 +23,7 @@
         <el-input v-model="form.name" :disabled="nameReadOnly" placeholder="请输入姓名" maxlength="10" show-word-limit />
       </el-form-item>
       <el-form-item label="手机号" prop="phone">
-        <el-input v-model="form.phone" :disabled="phoneReadOnly" placeholder="请输入手机号" maxlength="15" show-word-limit />
+        <el-input v-model="form.phone" :disabled="phoneReadOnly" placeholder="请输入手机号" maxlength="11" show-word-limit />
       </el-form-item>
       <el-form-item label="身份证号" prop="idNumber">
         <el-input v-model="form.idNumber" :disabled="idNumberReadOnly" placeholder="请输入身份证号" maxlength="18" show-word-limit />
@@ -35,9 +35,7 @@
         <el-input v-model="form.unitName" placeholder="请输入部门" maxlength="20" show-word-limit />
       </el-form-item>
       <el-form-item label="楼层" prop="floor" required>
-        <el-select v-model="form.floor" class="filter-item" placeholder="请选择楼层" clearable>
-          <el-option v-for="(item, index) in floorList" :key="index" :label="item.key" :value="item.value" />
-        </el-select>
+        <el-input v-model="form.floor" placeholder="请输入楼层" maxlength="10" />
       </el-form-item>
       <el-form-item label="房间号" prop="room">
         <el-input v-model="form.room" placeholder="请输入房间号" maxlength="20" show-word-limit />
@@ -68,10 +66,6 @@ import { addOrUpdate } from '@/api/visitee'
 
 export default {
   props: {
-    floorList: {
-      type: Array,
-      default: () => []
-    },
     userList: {
       type: Array,
       default: () => []
@@ -99,13 +93,32 @@ export default {
         showTitle: null,
         selectAreaList: []
       },
-      rules: {
+      visible: false,
+      submitLoading: false,
+      isEdit: false
+    }
+  },
+  computed: {
+    rules() {
+      return {
         adminId: [
           { required: true, type: 'number', message: '不能为空!', trigger: ['change', 'blur'] }
         ],
+        phone: [
+          { required: false, len: 11, trigger: ['change', 'blur'], validator: (rule, value, callback) => {
+            if (!value || this.phoneReadOnly) {
+              return callback()
+            }
+            const reg = /^1[3-9]\d{9}$/
+            if (!reg.test(value)) {
+              return callback('手机号格式错误!')
+            }
+            return callback()
+          } }
+        ],
         idNumber: [
-          { max: 18, trigger: ['change', 'blur'], validator: (rule, value, callback) => {
-            if (!value) {
+          { required: false, max: 18, trigger: ['change', 'blur'], validator: (rule, value, callback) => {
+            if (!value || this.idNumberReadOnly) {
               return callback()
             }
             if (value.length === 15) {
@@ -125,7 +138,12 @@ export default {
           } }
         ],
         floor: [
-          { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
+          { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] },
+          {
+            pattern: /^-?[1-9]\d*$/,
+            message: '楼层只能为整数',
+            trigger: ['change', 'blur']
+          }
         ],
         showTitle: [
           { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
@@ -133,10 +151,7 @@ export default {
         selectAreaList: [
           { required: true, type: 'array', message: '不能为空!', trigger: ['change', 'blur'] }
         ]
-      },
-      visible: false,
-      submitLoading: false,
-      isEdit: false
+      }
     }
   },
   methods: {
@@ -157,18 +172,24 @@ export default {
           if (areas) {
             this.form.selectAreaList = JSON.parse(areas)
           } else {
-            this.form.selectAreaList = []
+            this.form.selectAreaList = [0]
           }
           // console.info('form-->', this.form)
           this.isEdit = true
           if (obj.name) {
             this.nameReadOnly = true
+          } else {
+            this.nameReadOnly = false
           }
           if (obj.phone) {
             this.phoneReadOnly = true
+          } else {
+            this.phoneReadOnly = false
           }
           if (obj.idNumber) {
             this.idNumberReadOnly = true
+          } else {
+            this.idNumberReadOnly = false
           }
         } else {
           this.isEdit = false
@@ -209,7 +230,24 @@ export default {
           }
         }
         try {
-          await addOrUpdate({ ...this.form, selectAreaList: null, zoneIds: zoneIds ? `[${zoneIds.join(',')}]` : null, zoneNames: zoneNames ? zoneNames.join(',') : null })
+          const params = {
+            ...this.form,
+            selectAreaList: null,
+            zoneIds: zoneIds ? `[${zoneIds.join(',')}]` : null,
+            zoneNames: zoneNames ? zoneNames.join(',') : null
+          }
+          if (this.isEdit) {
+            if (this.nameReadOnly) {
+              params.name = null
+            }
+            if (this.phoneReadOnly) {
+              params.phone = null
+            }
+            if (this.idNumberReadOnly) {
+              params.idNumber = null
+            }
+          }
+          await addOrUpdate(params)
           this.visible = false
           this.form.selectAreaList = []
           this.$emit('success', this.isEdit)

+ 24 - 11
src/views/visitee_list/modal/UploadModal.vue

@@ -185,23 +185,36 @@ export default {
     async doSubmitUrl(correctList, index) {
       if (index <= correctList.correct.length - 1) {
         const item = correctList.correct[index]
-        if (item['楼层'] && item['显示标题'] && item['区域']) {
+        if (item['楼层'] && item['显示标题']) {
           // 组装数据上传
           const data = JSON.parse(JSON.stringify(this.form))
-          data.name = item['姓名'] || null
-          data.phone = item['手机号'] || null
-          data.idNumber = item['身份证号'] || null
-          data.company = item['单位名称'] || null
-          data.unitName = item['部门'] || null
+          data.name = item['姓名'] ? item['姓名'].trim() : null
+          data.phone = item['手机号'] ? item['手机号'].trim() : null
+          data.idNumber = item['身份证号'] ? item['身份证号'].trim() : null
+          data.company = item['单位名称'] ? item['单位名称'].trim() : null
+          data.unitName = item['部门'] ? item['部门'].trim() : null
           data.floor = item['楼层']
-          data.room = item['房间号'] || null
+          data.room = item['房间号'] ? item['房间号'].trim() : null
           data.showTitle = item['显示标题']
-          data.zoneNames = item['区域'] || null
+          data.zoneNames = item['区域'] ? item['区域'].trim() : null
           delete data.correctList
 
           let hasValidate = true
+          // let error = {
+          //   floor: data.floor,
+          //   showTitle: data.showTitle,
+          //   idNumber: data.idNumber,
+          //   err: ''
+          // }
+          // if (data.floor) {
+          //   const idreg = /^-?[1-9]\d*$/
+          //   if (!idreg.test(data.floor)) {
+          //     error.err = '楼层只能为整数'
+          //     hasValidate = false
+          //   }
+          // }
           if (data.idNumber) {
-            if (data.idNumber === 15) {
+            if (data.idNumber.length === 15) {
               const idreg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/
               if (!idreg.test(data.idNumber)) {
                 this.batchUploadResultList.push({
@@ -212,7 +225,7 @@ export default {
                 })
                 hasValidate = false
               }
-            } else if (data.idNumber === 18) {
+            } else if (data.idNumber.length === 18) {
               const idreg = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
               if (!idreg.test(data.idNumber)) {
                 this.batchUploadResultList.push({
@@ -256,7 +269,7 @@ export default {
             room: item['房间号'] || '',
             showTitle: item['显示标题'] || '',
             zoneNames: item['区域'] || '',
-            err: '不包含 "楼层" 或 "显示标题" 或 "区域" 字段'
+            err: '不包含 "楼层" 或 "显示标题" 字段'
           })
         }
         this.hasDealNumber += 1