Browse Source

履职登记上传nfc扫描时间及人

jiawuxian 2 years ago
parent
commit
54803c39c1
1 changed files with 97 additions and 81 deletions
  1. 97 81
      src/views/menu/resumption/detail.vue

+ 97 - 81
src/views/menu/resumption/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="page_box">
     <div class="panel">
-      <NavBar :go="{ type: 'push', path: '/resumption' }"/>
+      <NavBar :go="{ type: 'push', path: '/resumption' }" />
       <van-panel :title="resumptionData.taskName">
         <div class="tts">
           <van-row>
@@ -22,7 +22,6 @@
                   <span class="con_num no">未扫 {{ resumptionData.noNFCNums }}</span>
                 </div>
               </div>
-
             </van-col>
           </van-row>
         </div>
@@ -30,19 +29,29 @@
     </div>
     <div class="progress">
       <van-progress
-        :percentage="((resumptionData.yesPointNums + resumptionData.yesNFCNums)/ (resumptionData.yesPointNums + resumptionData.noPointNums + resumptionData.yesNFCNums + resumptionData.noNFCNums) * 100).toFixed(2)"/>
+        :percentage="
+          (
+            ((resumptionData.yesPointNums + resumptionData.yesNFCNums) /
+              (resumptionData.yesPointNums +
+                resumptionData.noPointNums +
+                resumptionData.yesNFCNums +
+                resumptionData.noNFCNums)) *
+            100
+          ).toFixed(2)
+        "
+      />
     </div>
     <!--   检查区域   -->
     <div class="card">
       <van-panel title="巡检区域">
-        <div style="padding: 5px;">
+        <div style="padding: 5px">
           <van-row>
-            <van-col span="8" v-for="(va,i) in areas" :key="va.areaId">
-              <div :class="{'active': i === 0 } " class="check-area" @click="clickArea(va,i)">
+            <van-col span="8" v-for="(va, i) in areas" :key="va.areaId">
+              <div :class="{ active: i === 0 }" class="check-area" @click="clickArea(va, i)">
                 <div class="ysj">
-                  <van-icon name="checked" :color="areaColor.complete" v-if="va.areaStatus === '1'"/>
-                  <van-icon name="info" :color="areaColor.loading" v-if="va.areaStatus === '2'"/>
-                  <van-icon name="info" :color="areaColor.noOpen" v-if="va.areaStatus === '0'"/>
+                  <van-icon name="checked" :color="areaColor.complete" v-if="va.areaStatus === '1'" />
+                  <van-icon name="info" :color="areaColor.loading" v-if="va.areaStatus === '2'" />
+                  <van-icon name="info" :color="areaColor.noOpen" v-if="va.areaStatus === '0'" />
                 </div>
                 {{ va.areaName }}
               </div>
@@ -53,30 +62,20 @@
     </div>
     <van-action-sheet v-model="total_show">
       <div class="content">
-
         <van-tabs>
           <van-tab title="已扫描" name="a">
-            <van-list
-              finished-text="没有更多了"
-              @load="onLoad"
-            >
-              <van-cell v-for="item in yesList" :key="item.nfcCode" :title="item.nfcName">
-
-              </van-cell>
+            <van-list finished-text="没有更多了" @load="onLoad">
+              <van-cell v-for="item in yesList" :key="item.nfcCode" :title="item.nfcName"> </van-cell>
             </van-list>
           </van-tab>
           <van-tab title="未扫描" name="b">
-            <van-list
-              finished-text="没有更多了"
-              @load="onLoad"
-            >
+            <van-list finished-text="没有更多了" @load="onLoad">
               <van-cell v-for="item in noList" :key="item.nfcCode" :title="item.nfcName">
-               <!-- <img :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon"/>-->
+                <!-- <img :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon"/>-->
               </van-cell>
             </van-list>
           </van-tab>
         </van-tabs>
-
       </div>
     </van-action-sheet>
 
@@ -88,10 +87,10 @@
               <span>NFC</span>
             </template>
             <template #extra>
-              <span style="display: inline-block;color:#26850c;">{{ yesNFCnums }}</span>
-              <span style="display: inline-block;color:#0e0e0e;">/</span>
-              <span style="display: inline-block;color:#0e0e0e;">{{ NFCnums }}</span>
-              <img :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC"/>
+              <span style="display: inline-block; color: #26850c">{{ yesNFCnums }}</span>
+              <span style="display: inline-block; color: #0e0e0e">/</span>
+              <span style="display: inline-block; color: #0e0e0e">{{ NFCnums }}</span>
+              <img :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC" />
             </template>
           </van-cell>
         </van-col>
@@ -108,28 +107,35 @@
       <van-row>
         <van-col span="24">
           <van-cell v-show="currentImgNFC.length > 0" :border="false">
-            <div v-if="v.areaId === areaId && v.img" class="nfc-img" v-for="(v,i) in nfcs" :key="v.img"
-                 @click="preViewNFC(i)">
-              <img :src="imgUrl(v.img)" alt="">
+            <div
+              v-if="v.areaId === areaId && v.img"
+              class="nfc-img"
+              v-for="(v, i) in nfcs"
+              :key="v.img"
+              @click="preViewNFC(i)"
+            >
+              <img :src="imgUrl(v.img)" alt="" />
               <span>{{ v.nfcName }}</span>
               <div v-if="enable" class="cancel_icon" @click="cancelImg(v)">
-                <van-icon name="clear"/>
+                <van-icon name="clear" />
               </div>
-
             </div>
           </van-cell>
         </van-col>
       </van-row>
 
       <van-collapse v-model="activeNames">
-        <van-collapse-item v-show="areaId === item.areaId" v-for="(item) in checks"
-                           :title="item.itemName + '(' + (item.points.length) + ')'"
-                           :name="item.itemName">
-          <div v-for="(point,index) in item.points">
+        <van-collapse-item
+          v-show="areaId === item.areaId"
+          v-for="item in checks"
+          :title="item.itemName + '(' + item.points.length + ')'"
+          :name="item.itemName"
+        >
+          <div v-for="(point, index) in item.points">
             <van-cell :title="point.pointName">
               <template #right-icon>
                 <van-switch
-                  style="margin-left: 10px;"
+                  style="margin-left: 10px"
                   v-model="point.resValue"
                   v-show="point.dataStatus === 2"
                   v-if="enable"
@@ -140,11 +146,11 @@
                   size="18"
                 />
                 <span v-else>
-                      <van-tag v-if="point.resValue === 1" type="warning">隐患</van-tag>
-                      <van-tag v-else type="success">正常</van-tag>
-                    </span>
+                  <van-tag v-if="point.resValue === 1" type="warning">隐患</van-tag>
+                  <van-tag v-else type="success">正常</van-tag>
+                </span>
                 <van-switch
-                  style="margin-left: 10px;"
+                  style="margin-left: 10px"
                   v-model="point.dataStatus"
                   v-show="point.dataStatus === 1"
                   :active-value="2"
@@ -157,23 +163,34 @@
               </template>
             </van-cell>
             <van-cell-group v-show="point.resValue">
-              <select-cell :required = enable :disabled="!enable" title="整改期限" v-model="point.rectificationDeadline"
-                           :data-list="dayList"/>
+              <select-cell
+                :required="enable"
+                :disabled="!enable"
+                title="整改期限"
+                v-model="point.rectificationDeadline"
+                :data-list="dayList"
+              />
               <van-field
-                :required = enable
+                :required="enable"
                 v-model="point.resRemark"
                 rows="1"
                 autosize
                 label="情况描述:"
                 type="textarea"
-                placeholder="请输入"/>
+                placeholder="请输入"
+              />
               <div class="upload-box">
-                <uploader :maxCount="5" v-if="enable" v-model="point.imgs"/>
+                <uploader :maxCount="5" v-if="enable" v-model="point.imgs" />
                 <van-cell v-else>
-                      <div class="nfc-img van-hairline--surround" v-for="(v,i) in point.imgs" :key="v.imgPath" @click="clickWarnImage(point.imgs,i)">
-                        <img :src="imgUrl(v.imgPath)" alt="" >
-                        <span>{{v.checkName}}</span>
-                      </div>
+                  <div
+                    class="nfc-img van-hairline--surround"
+                    v-for="(v, i) in point.imgs"
+                    :key="v.imgPath"
+                    @click="clickWarnImage(point.imgs, i)"
+                  >
+                    <img :src="imgUrl(v.imgPath)" alt="" />
+                    <span>{{ v.checkName }}</span>
+                  </div>
                 </van-cell>
               </div>
             </van-cell-group>
@@ -182,7 +199,6 @@
       </van-collapse>
     </div>
 
-
     <div class="bottomClass" v-if="enable">
       <van-row>
         <van-col span="12">
@@ -196,8 +212,6 @@
     <!--  nfc弹窗  -->
     <nfc-popup v-if="enable" ref="NfcPopup" @change="changeNfcImg"></nfc-popup>
   </div>
-
-
 </template>
 
 <script>
@@ -209,6 +223,8 @@ import { getDict } from '@/api/toConsult'
 import { saveTask, taskDetail } from '@/views/menu/resumption/api'
 import NfcPopup from '@/components/nfcPopup/more'
 import { imgUrl } from '@/utils'
+import dayjs from 'dayjs'
+import { mapGetters } from 'vuex'
 
 export default {
   components: {
@@ -253,6 +269,9 @@ export default {
       }
     }
   },
+  computed: {
+    ...mapGetters(['id'])
+  },
   mounted() {
     this.getResumptionData()
   },
@@ -271,21 +290,27 @@ export default {
     getResumptionData() {
       let data = {
         taskId: this.$route.query.id,
-        taskDate:this.$route.query.taskDate
+        taskDate: this.$route.query.taskDate
       }
       taskDetail(data).then(res => {
-        let { taskId, taskName, yesPointNums, noPointNums, yesNFCNums, noNFCNums,status } = res.data
+        let { taskId, taskName, yesPointNums, noPointNums, yesNFCNums, noNFCNums, status } = res.data
         this.resumptionData = {
-          taskId, taskName, yesPointNums, noPointNums, yesNFCNums, noNFCNums,status
+          taskId,
+          taskName,
+          yesPointNums,
+          noPointNums,
+          yesNFCNums,
+          noNFCNums,
+          status
         }
-        this.enable = this.resumptionData.status === 1 || this.resumptionData.status === 2;
+        this.enable = this.resumptionData.status === 1 || this.resumptionData.status === 2
         this.checks = res.data.checks
         this.nfcs = res.data.nfcs
         this.areas = res.data.areas
         this.activeArea(this.areas[0], 0)
 
-        if(!this.enable){
-          this.openCollapseItems();
+        if (!this.enable) {
+          this.openCollapseItems()
         }
       })
     },
@@ -319,10 +344,10 @@ export default {
     validateArea(areaId) {
       let total = 0
       let yes = 0
-      this.checks.forEach((item) => {
+      this.checks.forEach(item => {
         let pointList = item.points
 
-        pointList.forEach((point) => {
+        pointList.forEach(point => {
           if (item.areaId === areaId) {
             total++
             if (point.dataStatus === 2) {
@@ -332,7 +357,6 @@ export default {
         })
       })
 
-
       let noNfc = this.nfcs.filter((item, index) => {
         return item.areaId === areaId && item.status === 0
       })
@@ -340,10 +364,10 @@ export default {
       let areaStatus = '0'
       if (total === yes && noNfc.length === 0) {
         areaStatus = '1'
-      } else if( yes === 0 && noNfc.length ===  this.NFCnums){
+      } else if (yes === 0 && noNfc.length === this.NFCnums) {
         areaStatus = '0'
-      }else{
-        areaStatus = '2';
+      } else {
+        areaStatus = '2'
       }
 
       this.areas.forEach((item, index) => {
@@ -378,7 +402,7 @@ export default {
           v.scanMethod = null
         }
       })
-      let now = this.currentImgNFC.filter((v) => {
+      let now = this.currentImgNFC.filter(v => {
         return v.nfcCode !== imgItem.nfcCode
       })
       this.currentImgNFC = now
@@ -396,6 +420,8 @@ export default {
           v.img = imgItem.url
           v.status = 1
           v.scanMethod = 1
+          v.submitTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
+          v.submitBy = this.id
           this.currentImgNFC.push(v)
         }
       })
@@ -470,7 +496,6 @@ export default {
         this.$toast('保存成功')
         this.$router.go(-1)
       })
-
     },
     submitResumptionData() {
       //验证数据
@@ -484,9 +509,9 @@ export default {
         return
       }
       let isOk = true
-      this.checks.forEach((item) => {
+      this.checks.forEach(item => {
         let pointList = item.points
-        pointList.forEach((point) => {
+        pointList.forEach(point => {
           if (point.dataStatus === 1) {
             isOk = false
           }
@@ -508,19 +533,15 @@ export default {
               this.$router.go(-1)
             })
           })
-          .catch(() => {
-
-          })
+          .catch(() => {})
       } else {
         saveTask(data).then(res => {
           this.$toast('提交成功')
           this.$router.go(-1)
         })
       }
-
     }
   }
-
 }
 </script>
 
@@ -539,7 +560,6 @@ export default {
 
 .content {
   padding: 16px 16px 10px;
-
 }
 
 .panel {
@@ -561,7 +581,6 @@ export default {
 
   .title {
     padding-top: 10px;
-
   }
 
   .content {
@@ -585,7 +604,6 @@ export default {
 .card {
   box-shadow: 0 10px 10px #eaeaea;
   height: 50px;
-
 }
 
 .van-popup {
@@ -641,13 +659,12 @@ export default {
   }
 }
 
-
 .okAll {
   background-color: #fff;
   display: flex;
   justify-content: center;
   align-items: center;
-  height: 50px
+  height: 50px;
 }
 
 .nfc-img {
@@ -670,7 +687,7 @@ export default {
     left: 0;
     display: block;
     width: 100%;
-    background-color: rgba(0, 0, 0, .2);
+    background-color: rgba(0, 0, 0, 0.2);
     color: #eaeaea;
     font-size: 5px;
     overflow: hidden;
@@ -687,5 +704,4 @@ export default {
     top: 2px;
   }
 }
-
 </style>