Przeglądaj źródła

外部人员签到

cyy 1 rok temu
rodzic
commit
875c22f393

+ 35 - 0
src/api/platform/feature/signin.js

@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+/**
+ * 获取二维码数据
+ * @param {*} params
+ */
+export function queryQrcode(params) {
+  return request({
+    url: '/business/v3/employee/qRcode/query',
+    method: 'post',
+    data: params
+  })
+}
+/**
+ * 获取签到数据
+ * @param {*} params
+ */
+export function querySign(params) {
+  return request({
+    url: '/business/v3/employee/signInformation/query',
+    method: 'post',
+    data: params
+  })
+}
+/**
+ * 保存签到数据
+ * @param {*} params
+ */
+export function querySave(params) {
+  return request({
+    url: '/business/v3/employee/signInformation/save',
+    method: 'post',
+    data: params
+  })
+}

+ 58 - 46
src/views/platform/bpmn/siginin/outIndex.vue

@@ -54,9 +54,14 @@
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
+import { querySave, querySign, queryQrcode } from '@/api/platform/feature/signin'
+import ActionUtils from '@/utils/action'
 export default {
 export default {
   data() {
   data() {
+    const { userInfo } = this.$store.getters
     return {
     return {
+      userInfo,
+      qdInfo: [],
       xingMing: '',
       xingMing: '',
       keShi: '',
       keShi: '',
       zhiWu: '',
       zhiWu: '',
@@ -74,23 +79,19 @@ export default {
   },
   },
   methods: {
   methods: {
     getQdInfo() {
     getQdInfo() {
-      // 扫描二维码传递过来的codeId
-      // this.$route.query.codeId = '1244662627406184448'
-      const sql = `select * from t_qrcodeb where id_='${this.$route.query.codeId}'`
       if (this.$route.query.codeId) {
       if (this.$route.query.codeId) {
-        this.$common.request('sql', sql).then(res => {
-          console.log('根据id查询得到的数据', res)
-          const data = res.variables.data || []
+        queryQrcode(this.getSearcFormData('qrcode')).then(res => {
+          const data = res.data.dataResult || []
           if (data.length > 0) {
           if (data.length > 0) {
-            this.qdInfo = data[0].xiang_xi_xin_xi_ !== '' ? JSON.parse(data[0].xiang_xi_xin_xi_) : 0
+            this.qdInfo = data[0].xiangXiXinXi !== '' ? JSON.parse(data[0].xiangXiXinXi) : 0
             this.scanList = data[0]
             this.scanList = data[0]
-            if (data[0].zhuang_tai_ === '失效') {
+            if (data[0].zhuangTai === '失效') {
               // 二维码失效
               // 二维码失效
               this.statusCode = 3
               this.statusCode = 3
             } else {
             } else {
-              this.getAlreadyQD()
-              this.guanlianID = data[0].guan_lian_id_
-              this.yeWuBiaoMing = data[0].biao_ming_
+              this.guanlianID = data[0].guanLianId
+              this.yeWuBiaoMing = data[0].biaoMing
+              this.statusCode = 2
             }
             }
           }
           }
         })
         })
@@ -101,15 +102,36 @@ export default {
     },
     },
     getAlreadyQD() {
     getAlreadyQD() {
       // t_qdxxb签到信息表
       // t_qdxxb签到信息表
-      const sql = `select * from t_qdxxb where er_wei_ma_id_='${this.$route.query.codeId}' and ren_yuan_id_ = '${this.info.employee.id}'`
-      this.$common.request('sql', sql).then(res => {
-        // console.log("根据this.$route.query.codeId和用户id查询数据库", res);
-        const data = res.variables.data || []
+      querySign(this.getSearcFormData('sign')).then(res => {
+        const data = res.data.dataResult || []
         if (data.length > 0) {
         if (data.length > 0) {
           this.statusCode = 0
           this.statusCode = 0
         } else {
         } else {
           // 1.未获取到相关签到信息2.正常
           // 1.未获取到相关签到信息2.正常
-          this.statusCode = this.qdInfo.length > 0 ? 2 : 1
+          // this.statusCode = this.qdInfo.length > 0 ? 2 : 1
+          const paramWhere = {
+            renYuanXingMin: this.xingMing,
+            // waiBuRenYuanQ: 'data:' + this.qianMing,
+            waiBuRenYuanQ: this.qianMing,
+            xiangGuanXinXi: JSON.stringify({ keShi: this.keShi, zhiWu: this.zhiWu }),
+            parentId: this.$route.query.codeId,
+            erWeiMaId: this.$route.query.codeId,
+            qianDaoShiJian: this.getNow(),
+            guanLianId: this.guanlianID,
+            yeWuBiaoMing: this.yeWuBiaoMing
+          }
+          querySave(paramWhere).then(res => {
+            if (res.state === 200) {
+              this.$toast({
+                duration: 30000, // 持续展示 toast
+                message: '签到成功'
+              })
+              setTimeout(() => {
+                this.statusCode = 0
+                this.$router.push({ name: 'login' })
+              }, 1000)
+            }
+          })
         }
         }
       })
       })
     },
     },
@@ -119,15 +141,20 @@ export default {
           duration: 2000, // 持续展示 toast
           duration: 2000, // 持续展示 toast
           message: '请输入姓名'
           message: '请输入姓名'
         })
         })
-      } else if (this.keShi === '') {
+      } else if (this.xingMing.length > 150) {
+        this.$toast({
+          duration: 2000, // 持续展示 toast
+          message: '姓名长度超出'
+        })
+      } else if (this.zhiWu.length > 150) {
         this.$toast({
         this.$toast({
           duration: 2000, // 持续展示 toast
           duration: 2000, // 持续展示 toast
-          message: '请输入科室'
+          message: '职务长度超出'
         })
         })
-      } else if (this.zhiWu === '') {
+      } else if (this.keShi.length > 150) {
         this.$toast({
         this.$toast({
           duration: 2000, // 持续展示 toast
           duration: 2000, // 持续展示 toast
-          message: '请输入职务'
+          message: '科室长度超出'
         })
         })
       } else if (this.qianMing === '') {
       } else if (this.qianMing === '') {
         this.$toast({
         this.$toast({
@@ -135,32 +162,7 @@ export default {
           message: '请输入签名'
           message: '请输入签名'
         })
         })
       } else {
       } else {
-        const paramWhere = {
-          ren_yuan_xing_min: this.xingMing,
-          wai_bu_ren_yuan_q: this.qianMing,
-          xiang_guan_xin_xi: JSON.stringify({ keShi: this.keShi, zhiWu: this.zhiWu }),
-          parent_id_: this.$route.query.codeId,
-          er_wei_ma_id_: this.$route.query.codeId,
-          qian_dao_shi_jian: this.getNow(),
-          guan_lian_id_: this.guanlianID,
-          ye_wu_biao_ming_: this.yeWuBiaoMing
-        }
-        const addParams = {
-          tableName: 't_qdxxb',
-          paramWhere
-        }
-        this.$common.request('add', addParams).then(res => {
-          if (res.state === 200) {
-            this.$toast({
-              duration: 2000, // 持续展示 toast
-              message: '签到成功'
-            })
-            setTimeout(() => {
-              this.statusCode = 0
-              this.$router.push({ name: 'login' })
-            }, 2000)
-          }
-        })
+        this.getAlreadyQD()
       }
       }
     },
     },
     // 获取当前时间
     // 获取当前时间
@@ -174,6 +176,16 @@ export default {
       const seconds = ('0' + now.getSeconds()).slice(-2)
       const seconds = ('0' + now.getSeconds()).slice(-2)
       const formattedTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
       const formattedTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
       return formattedTime
       return formattedTime
+    },
+    /**
+     * 获取格式化参数
+     */
+    getSearcFormData(val) {
+      const params = val === 'sign' ? { 'Q^er_wei_ma_id_^SL': this.$route.query.codeId, 'Q^ren_yuan_xing_min^SL': this.xingMing } : { 'Q^id_^SL': this.$route.query.codeId }
+      return ActionUtils.formatParams(
+        params,
+        {},
+        {})
     }
     }
   }
   }
 }
 }