Browse Source

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc_app into V0.0.2

coys 1 year ago
parent
commit
356d61860c

+ 4 - 0
src/assets/css/index.scss

@@ -39,6 +39,10 @@ pre{
   -border: 1px solid #008cd6;
 }
 
+.van-field__label{
+  color:#323233;
+}
+
 .van-picker__confirm{
   color: #008cd6;
 }

+ 8 - 9
src/components/Calendar/index.vue

@@ -75,13 +75,16 @@ export default {
     copyMouth(formDate){
       let arr =  [];
       this.attrs.forEach(v=>{
-        v.customData.workTime = formDate.workTime;
         v.customData.isEnable = formDate.isEnable;
+        v.customData.openTime = formDate.openTime;
+        v.customData.closeTime = formDate.closeTime;
+        v.customData.workTime = formDate.workTime;
         v.customData.workOffTime = formDate.workOffTime;
-        arr.push(v.customData)
-      })
+        v.customData.isDuty = formDate.isDuty;
+        arr.push(v.customData);
+      });
       this.$toast.success('复制成功,请点击提交');
-      this.$emit('copy',arr)
+      this.$emit('copy',arr);
     },
     //初始化数据
     initData(){
@@ -132,11 +135,7 @@ export default {
       day.attributes.forEach(v=>{
         if(v.key != 'select-drag'){
           dayInfo = JSON.parse(JSON.stringify(v.customData));
-          if(day.isDisabled){
-            dayInfo.isDisabled = true;
-          }else {
-            dayInfo.isDisabled = false;
-          }
+          dayInfo.isDisabled = !!day.isDisabled;
         }
       })
       this.$emit('change',dayInfo)

+ 11 - 27
src/components/TopBar.vue

@@ -13,7 +13,7 @@
             <van-icon name="arrow" size="20" />
           </p>
           <p class="van-multi-ellipsis--l2 introduce-info ">
-            <span v-for="item in rolesList" :key="item.roleId">{{ item.roleName }}</span>
+            <span v-for="item in roleList" :key="item.roleId">{{ item.roleName }}</span>
           </p>
         </div>
       </div>
@@ -68,29 +68,24 @@ export default {
   },
   data() {
     return {
-      list: [],
       show: false,
       info: '',
       active: this.defaultActive,
-      rolesList: [],
       color: '#ecf9ff',
       background: 'rgba(78,162,248,0.63)'
     }
   },
   computed: {
-    ...mapGetters(['userName', 'orgName', 'orgId'])
-  },
-  created() {},
-  mounted() {
-    setTimeout(() => {
-      if(this.orgId){
-
-        this.getTheWeather()
-      }
-    }, 100);
-
-
-    // this.rolesList=JSON.parse(window.sessionStorage.getItem('SET_USER_ROLELIST'))||[]
+    ...mapGetters(['userName', 'orgName','roleList', 'orgId']),
+    //获取天气数据
+    list() {
+      if(!this.orgId)return [];
+      let lists = [];
+      getTheAreaWeather(this.orgId).then(res => {
+       lists = res.data
+      })
+      return lists;
+    }
   },
   methods: {
     onChange(index){
@@ -125,17 +120,6 @@ export default {
       this.info = item.alarmContent
       this.show = true
     },
-
-    //获取天气数据
-    getTheWeather() {
-      getTheAreaWeather(this.orgId).then(res => {
-        this.list = res.data || [];
-        setTimeout(() => {
-          this.rolesList = JSON.parse(window.sessionStorage.getItem('SET_USER_ROLELIST')) || []
-        }, 100)
-        console.log(this.rolesList)
-      })
-    }
   }
 }
 </script>

+ 13 - 5
src/components/nfcPopup/more.vue

@@ -78,11 +78,18 @@ export default {
   },
   methods:{
     openCameraCallBack(data){
-      let img =  JSON.parse(data);
-      this.content = data;
-      let params = {
-        extension:img.extension,
-        content:img.content,
+      let params = {};
+      try{
+        let img = JSON.parse(data);
+        params = {
+          extension: img.extension,
+          content: img.content,
+        }
+      }catch (e) {
+        params = {
+          extension: data.extension,
+          content: data.content,
+        }
       }
       this.$toast.loading({
         duration: 0, // 持续展示 toast
@@ -118,6 +125,7 @@ export default {
       let parms = {};
       if(actionType){
         parms.actionType = actionType;
+        parms.compressKb = "500";
       }
       let system = this.isAndroidOrIos();
       if(system === 1){

+ 7 - 7
src/router/router.config.js

@@ -212,7 +212,7 @@ export let routers = [
         path: '/securityCheckRegister',
         name: 'securityCheckRegister',
         component: () => import('@/views/menu/securityCheckRegister/index'),
-        meta: { title: '安全检查登记', keepAlive: false }
+        meta: { title: '安全检查登记', keepAlive: true }
       },
       {
         path: '/securityDetail',
@@ -230,7 +230,7 @@ export let routers = [
         path: '/problemItem',
         name: 'problemItem',
         component: () => import('@/views/menu/problemItem/index'),
-        meta: { title: '隐患问题清单', keepAlive: false }
+        meta: { title: '隐患问题清单', keepAlive: true }
       },
       {
         path: '/problemDetail',
@@ -254,7 +254,7 @@ export let routers = [
         path: '/safetyBook',
         name: 'safetyBook',
         component: () => import('@/views/menu/safetyBook/index.vue'),
-        meta: { title: '安全责任书', keepAlive: false ,hideTabBar:false}
+        meta: { title: '安全责任书', keepAlive: true ,hideTabBar:false}
       },
       {
         path: '/safetyBookDetail',
@@ -266,7 +266,7 @@ export let routers = [
         path: '/visitRegister',
         name: 'visitRegister',
         component: () => import('@/views/menu/visitRegister/index.vue'),
-        meta: { title: '出入事项申请', keepAlive: false ,hideTabBar:false}
+        meta: { title: '出入事项申请', keepAlive: true ,hideTabBar:false}
       },
       {
         path: '/visitAdd',
@@ -284,7 +284,7 @@ export let routers = [
         path: '/visitCheck',
         name: 'visitCheck',
         component: () => import('@/views/menu/visitCheck/index.vue'),
-        meta: { title: '出入审批', keepAlive: false ,hideTabBar:false}
+        meta: { title: '出入审批', keepAlive: true ,hideTabBar:false}
       },
       {
         path: '/visitCheckDetail',
@@ -296,7 +296,7 @@ export let routers = [
         path: '/visitRecord',
         name: 'visitRecord',
         component: () => import('@/views/menu/visitRecord/index.vue'),
-        meta: { title: '出入登记', keepAlive: false ,hideTabBar:false}
+        meta: { title: '出入登记', keepAlive: true ,hideTabBar:false}
       },
       {
         path: '/visitRecordDetail',
@@ -310,7 +310,7 @@ export let routers = [
         component: () => import('@/views/menu/visitRecord/add.vue'),
         meta: { title: '人员登记', keepAlive: false ,hideTabBar:true}
       },
-      
+
     ],
   },
 ]

+ 6 - 5
src/utils/globalMixins.js

@@ -94,19 +94,20 @@ export default {
     },
     //调用NFC
     useNFC() {
+
       let system = this.isAndroidOrIos()
       const parms = {
-        iOS_SessionType: '0'
+        "iOS_SessionType": "0"
       }
       if (system === 1) {
         //android
         // 判断当前环境是是否存在 js桥 'sap'
-        const hasSap = window.hasOwnProperty('sap')
+        const hasSap = window.hasOwnProperty('sap');
         if (hasSap) {
           // 判断是否存在方法 ?preview
-          const fun = sap.hasOwnProperty('openNFCScan')
+          const fun = sap.hasOwnProperty('openNFCScan');
           if (fun) {
-            sap.openNFCScan(JSON.stringify(parms))
+            sap.openNFCScan(JSON.stringify(parms));
           }
         }
       }
@@ -127,7 +128,7 @@ export default {
       let parms = {}
       if (actionType) {
         parms.actionType = actionType
-        parms.compressKb = '500'
+        parms.compressKb = '1024'
       }
       let system = this.isAndroidOrIos()
       if (system === 1) {

+ 10 - 6
src/views/menu/resumption/detail.vue

@@ -104,7 +104,7 @@
             <van-cell>
               <div class="okAll">
                 <van-radio-group v-if="enable" v-model="selectRadio" @change="changeSwitch">
-                  <van-radio name="1" icon-size="20px">一键填充</van-radio>
+                  <van-radio name="1" icon-size="20px">一键正常</van-radio>
                 </van-radio-group>
               </div>
             </van-cell>
@@ -134,9 +134,10 @@
           <van-collapse-item
             v-show="areaId === item.areaId"
             v-for="item in checks"
-            :title="item.itemName + '(' + item.points.length + ')'"
+            :title="item.itemName"
             :name="item.itemName"
             :key="item.areaId"
+            :value="item.points.length + '项'"
           >
             <div v-for="(point, index) in item.points">
               <van-cell>
@@ -301,7 +302,7 @@ export default {
     ...mapGetters(['id'])
   },
   mounted() {
-    this.getResumptionData()
+    this.getResumptionData();
     window.openNFCScanCallBack = this.openNFCScanCallBack;
   },
   created() {
@@ -469,9 +470,10 @@ export default {
         this.areasMap = obj;
         this.activeArea(this.areas[0], 0)
 
-        if (!this.enable) {
+        /*if (!this.enable) {
           this.openCollapseItems()
-        }
+        }*/
+        this.openCollapseItems()
         this.updateNFC(0);
       })
     },
@@ -568,13 +570,15 @@ export default {
           //新增扫描到的标签
           if(nfcCode === item.nfcCode){
             item.status = 1
-            item.scanMethod = 1
             item.submitTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
             item.submitBy = this.id
             if(imgItem){
+              item.scanMethod = 1
               //拍照NFC特殊处理
               item.img = imgItem.url
               this.currentImgNFC.push(item)
+            }else{
+              item.scanMethod = 0
             }
           }
         }

+ 44 - 51
src/views/menu/securityCheckRegister/detail.vue

@@ -27,16 +27,16 @@
           />
         </van-cell-group>
       </div>
-      <!--  搜索框  -->
-      <van-search v-model="itemName" class="van-hairline--bottom" placeholder="请输入检查项名称"/>
       <!--  检查项目    -->
       <fieldset class="fieldset" :disabled="!enable">
         <div class="card">
           <p class="legend">检查项目 <span v-if="enable" @click="addCheck">添加检查内容</span></p>
+          <!--  搜索框  -->
+          <van-search v-model="itemName" class="van-hairline--top" placeholder="请输入检查项名称" />
           <van-collapse v-model="activeNames" v-for="v in resultList" :key="v.itemId">
             <van-collapse-item :title="v.itemName" :name="v.itemName">
-              <div v-for="(item, index) in v.pointList" :key="item.pointId">
-                <van-cell>
+              <div v-for="(item, index) in v.pointList" :key="item.pointId" class="collapse-box" :class="{'van-hairline--bottom':item.status}">
+                <van-cell :border="Boolean(item.status)">
                   <template #title>
                     <pre>{{ item.pointName }}</pre>
                   </template>
@@ -86,22 +86,23 @@
                     v-model="item.remark"
                     rows="1"
                     autosize
-                    label="情况描述"
+                    label="情况描述"
                     type="textarea"
                     placeholder="请输入(255字以内)"
                   />
                   <select-cell
                     required
                     :disabled="!enable"
+                    is-row
                     title="整改期限"
                     v-model="item.rectificationDeadline"
-                    :data-list="getDictItem('rectification_deadline')"
+                    :data-list="dateList"
                   />
                   <div class="upload-box">
                     <uploader v-if="enable" :maxCount="5" v-model="item.imgData" />
                     <van-cell v-else-if="item.imgData">
                       <div
-                        class="nfc-img van-hairline--surround"
+                        class="nfc-img"
                         v-for="(v, i) in item.imgData"
                         :key="v.imgPath"
                         @click="clickWarnImage(item.imgData, i)"
@@ -184,6 +185,7 @@ export default {
       showPreView: false,
       selected: null,
       active: true,
+      dateList:[],
       go: {
         type: 'replace',
         path: '/securityCheckRegister'
@@ -238,19 +240,18 @@ export default {
         return false
       }
     },
+    //获取NFC已扫描数据
     getNfcState(arr){
         arr = arr || [];
-        let num = 0;
-        arr.forEach(v=>{
-          if(v.status === 1){
-            num++
-          }
-        })
-        return num;
+        let nums = arr.filter(v=>{return v.status === 1});
+        return nums.length;
     },
+    //调用nfc
     checkNFC(){
+      //设置nfc调用后的回调
       window.openNFCScanCallBack = this.openNFCScanCallBack;
-      this.useNFC();
+
+      //设置loading弹窗
       this.$toast.loading({
         duration: 0, // 持续展示 toast
         position: 'top',
@@ -270,9 +271,12 @@ export default {
         }
       }, 1000);
 
+      //挂载nfc
+      this.useNFC();
     },
-
+    //调用nfc后的回调
     openNFCScanCallBack(nfcStr){
+      //alert(JSON.stringify(nfcStr))
       clearInterval(this.timer);
       let nfcCode = '';
       try{
@@ -286,45 +290,28 @@ export default {
       //alert(nfcCode)
       this.checkNfcFilter(nfcCode);
     },
-
+    //验证nfc数据
     checkNfcFilter(nfcCode){
-      let areaId = null;
+      //let areaId = null;
       let checkOk =  false;
+      //alert(JSON.stringify(this.NFCList,'NFCList'));
       this.NFCList.forEach(v => {
         if(v.nfcCode === nfcCode){
-          areaId = v.areaId;
-          this.switchArea(areaId);
           if(v.status === 1){
             this.$toast.fail('NFC点位:' + v.nfcName + '已扫描,请勿重复扫描!');
             throw new Error('NFC点位:' + v.nfcName + '已扫描,请勿重复扫描!');
           }
           v.status = 1;
           v.scanMethod = 0;
-          v.submitTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
-          v.submitBy = this.id;
-          this.$toast.success('NFC点位:' + v.nfcName + '扫描成功!');
+          this.$toast('NFC点位:' + v.nfcName + '扫描成功!');
           checkOk = true;
         }
       });
-
-      if(checkOk){
-        this.yesNFCnums++
-        this.resumptionData.yesNFCNums++
-        this.resumptionData.noNFCNums--
-      }else{
-        this.$toast.fail(nfcCode + ",不在本次履职范围内!");
+      if(!checkOk){
+        this.$toast.fail( "扫描结果不在本次检查范围内!");
       }
-      this.validateArea(areaId)
-    },
-    switchArea(areaId){
-      this.areas.forEach((area, i) => {
-        if (areaId === area.areaId) {
-          this.activeArea(area, i)
-        }
-      })
     },
 
-
     //是否显示nfc图标
     nfcState(item){
       if(item.nfcList && item.nfcList.length > 0){
@@ -334,6 +321,7 @@ export default {
       }
       return false
     },
+
     //格式化时间范围
     formatTime(start,end,format){
       format = format || 'YYYY-MM-DD'
@@ -382,9 +370,9 @@ export default {
           return '#008cd6';
         case '进行中':
           return '#bc9f71';
-        case '完成':
+        case '完成':
           return '#009240';
-        case '已期':
+        case '已期':
           return '#D7000F';
       }
     },
@@ -412,6 +400,7 @@ export default {
         this.taskInfo = res.data;
         this.enable = this.taskInfo.status === 1 || this.taskInfo.status === 2; //是否可编辑
         this.checkList = res.data.checkList;
+        this.dateList = this.getDictItem('rectification_deadline');
         //设置默认展开项
         this.activeNames = this.checkList.map(v => v.itemName);
       })
@@ -443,20 +432,21 @@ export default {
     //提交数据
     submitData() {
       //验证必填项
-      let pointData = []
-      this.checkList.forEach(v => {
-        v.pointList.forEach(item => {
-          pointData.push(item)
-        })
-      })
+      let pointData = this.checkList.flatMap(v => v.pointList);
+      let allNfcList = pointData.flatMap(v=>v.nfcList);
+      let result = allNfcList.some(v=>v.status != 1);
+      //some函数的用法
+      if(result){
+        this.$toast('请先扫描NFC标签');
+        return;
+      }
       let arr = pointData.filter(v => {
         if (v.status === 1) {
           return !v.remark || !v.rectificationDeadline
         }
       })
-      if (arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`)
-      //console.log( this.taskInfo,' this.taskInfo')
-      this.taskInfo.isSubmit = 1
+      if (arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`);
+      this.taskInfo.isSubmit = 1;
       registerSubmit(this.taskInfo).then(res => {
         this.$toast('提交成功')
         this.$router.replace({
@@ -563,6 +553,9 @@ export default {
       margin-bottom: 0;
     }
   }
+  .collapse-box{
+    -padding-bottom: 10px;
+  }
   .check-area {
     background-color: #f1f1f1;
     margin: 10px;
@@ -584,7 +577,7 @@ export default {
     vertical-align: middle;
   }
   .upload-box {
-    margin: 30px;
+    padding: 30px;
   }
   .warning-msg {
     color: orange;

+ 2 - 2
src/views/menu/securityCheckRegister/index.vue

@@ -135,9 +135,9 @@ export default {
           return '#008cd6';
         case '进行中':
           return '#bc9f71';
-        case '完成':
+        case '完成':
           return '#009240';
-        case '已期':
+        case '已期':
           return '#D7000F';
       }
     },

+ 0 - 24
src/views/menu/workTime/index.vue

@@ -129,30 +129,6 @@ export default {
       this.$refs.calendar.copyMouth(this.formData);
       this.isCopy = true;
     },
-    // //获取机构树
-    // getTreeList(){
-    //   deptTreeList(this.orgId).then(res=>{
-    //     this.options = res.data;
-    //     this.orgInfo.orgId = this.orgId;
-    //     this.orgInfo.orgName = this.orgName;
-    //     console.log(res,'3333')
-    //   })
-    // },
-    // //改变机构后将重新发起请求
-    // changeTree({selectedOptions}){
-    //   console.log(selectedOptions,'aaaaaa')
-    //   this.formData.orgId = selectedOptions[selectedOptions.length-1].id;
-    //   this.formData.orgName = selectedOptions[selectedOptions.length-1].name;
-    // },
-    // 全部选项选择完毕后,会触发 finish 事件
-    // onFinish({ selectedOptions }) {
-    //   this.showOrg = false;
-    //   this.fieldValue = selectedOptions.map((option) => option.text).join('/');
-    // },
-    // //显示机构选择
-    // showPopup() {
-    //   this.showOrg = true;
-    // },
     //提交
     onsubmit(){
       if(!this.formData.orgId) return this.$toast('请选择机构');