Browse Source

添加禁用

凉纪 2 years ago
parent
commit
8729245c81

+ 1 - 1
src/components/dateCell/index.vue

@@ -27,7 +27,7 @@ import {formatDate} from "@/filters/filter";
 export default {
   props:{
     disabled:{
-      type: Boolean,
+      type: [Boolean,String],
       default: false,
     },
     //默认值

+ 1 - 1
src/components/selectCell/index.vue

@@ -22,7 +22,7 @@ export default {
   props:{
     //禁用
     disabled:{
-      type: Boolean,
+      type: [Boolean,String],
       default: false,
     },
     //双向绑定的数据

+ 2 - 1
src/main.js

@@ -11,9 +11,10 @@ import router from './router'
 import store from './store'
 import dayjs from "dayjs";
 // 设置 js中可以访问 $cdn
-import { $cdn } from '@/config'
+import config, { $cdn } from '@/config'
 Vue.prototype.$cdn = $cdn
 Vue.prototype.dayjs = dayjs
+
 // 移动端适配
 import 'amfe-flexible'
 

+ 12 - 0
src/utils/index.js

@@ -2,6 +2,8 @@
  * Created by PanJiaChen on 16/11/18.
  */
 
+import config from "@/config";
+
 /**
  * Parse the time to string
  * @param {(Object|string|number)} time
@@ -96,3 +98,13 @@ export function param2Obj(url) {
       '"}'
   )
 }
+/**
+ * @param {string} url
+ * @returns {string}
+ * */
+//根据当前环境拼接图片地址
+export function imgUrl(url){
+  return  process.env.NODE_ENV === "development"
+    ?  config.baseUrl + url
+    :  window.origin + url;
+}

+ 20 - 11
src/views/menu/LZRegister/edit.vue

@@ -49,12 +49,12 @@
               </template>
               <template #extra>
                 <span style="display: inline-block;color:#969799;">{{NFCNum}}</span>
-                <img v-if="NFCNum" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC"/>
+                <img v-if="enable && NFCNum" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC"/>
               </template>
 
             </van-cell>
             <van-cell v-show="nfcImage.length > 0" :border="false" >
-              <img class="nfc-img" v-for="(v,i) in nfcImage" :src="v.url" alt="" :key="v.url">
+              <img v-if="enable" class="nfc-img" v-for="(v,i) in nfcImage" :src="v.url" alt="" :key="v.url">
             </van-cell>
           </div>
         </van-panel>
@@ -95,7 +95,7 @@
 
 
       <!--  检查项目2    -->
-      <fieldset class="fieldset"  >
+      <fieldset class="fieldset"  :disabled="!enable">
         <div class="card" v-if="selectArea">
           <van-collapse v-model="activeNames" v-for="v in checkList" :key="v.itemid">
             <van-collapse-item :title="v.itemname" :name="v.itemname" >
@@ -103,6 +103,7 @@
                 <van-cell :title="item.pointname">
                   <template #right-icon>
                     <van-switch
+                      v-if="enable"
                       v-model="item.resvalue"
                       :active-value="1"
                       :inactive-value="0"
@@ -123,15 +124,15 @@
                   <div class="upload-box" >
                     <uploader v-model="item.imgData"/>
                   </div>
-                  <select-cell  title="整改期限" v-model="item.rectificationDeadline"  :dict="'rectification_deadline'" />
+                  <select-cell :disabled="enable" title="整改期限" v-model="item.rectificationDeadline"  :dict="'rectification_deadline'" />
                 </van-cell-group>
-                <date-cell v-if="item.businessType === 1" v-for="(val,ind) in item.protectionVo" :title="val.protectionName"  v-model="val.statusUpdateTime" :key="val.id" date-type="datetime" />
+                <date-cell :disabled="enable" v-if="item.businessType === 1" v-for="(val,ind) in item.protectionVo" :title="val.protectionName"  v-model="val.statusUpdateTime" :key="val.id" date-type="datetime" />
               </div>
             </van-collapse-item>
           </van-collapse>
         </div >
-        <p v-if="disabled" class="warning-msg">需要完成所有区域的履职内容才能提交内容</p>
-        <div v-if="disabled" class="flex-box">
+        <p v-if="enable" class="warning-msg">需要完成所有区域的履职内容才能提交内容</p>
+        <div v-if="enable" class="flex-box">
           <van-button type="default" style="width: 28%;" plain  @click="goBack">取消</van-button>
           <van-button type="info" style="width: 28%;" plain hairline @click="saveData">保存</van-button>
           <van-button type="info" style="width: 28%;"  @click="submitData">提交</van-button>
@@ -140,7 +141,7 @@
     </div>
 
     <!--  nfc弹窗  -->
-    <nfc-popup ref="NfcPopup" @change="changeNfcImg"></nfc-popup>
+    <nfc-popup v-if="enable" ref="NfcPopup" @change="changeNfcImg"></nfc-popup>
   </div>
 </template>
 
@@ -152,6 +153,7 @@ import Uploader from '@/components/upload';
 import NfcPopup from '@/components/nfcPopup/more';
 import {taskDetails,saveTaskData} from "@/views/menu/LZRegister/api";
 import {formatDate} from "@/filters/filter";
+import {imgUrl} from "@/utils";
 export default {
   components:{NavBar,SelectCell,DateCell,Uploader,NfcPopup},
   data(){
@@ -179,11 +181,10 @@ export default {
       checkNum:0,
       //nfc图片
       nfcImage:[],
-      disabled:false,
+      enable:false,
     }
   },
   mounted() {
-    this.disabled = this.$route.query.disabled;
     this.getData();
   },
   computed:{
@@ -216,6 +217,7 @@ export default {
           ...res.data.taskObj
         }
         this.taskInfo.nfcScaning = res.data.nfcScaning;
+        this.enable = this.taskInfo.status === 1 || this.taskInfo.status === 2;
         this.areaList = res.data.taskarealist;
         this.activeArea(this.areaList[0],0);
         this.getAllCheckItemNum();
@@ -285,7 +287,14 @@ export default {
       this.checkList = area.checklist;
       //设置默认展开项
       this.activeNames = this.checkList.map(v=>v.itemname);
-      //this.NFCList = area.nfclist;
+      //回显nfc图片
+      area.nfclist.forEach( v =>{
+        if(v.img){
+          v.url = v.img;
+          this.nfcImage.push(v)
+        }
+      });
+      console.log(this.nfcImage,'nfcImage')
       //获取当前区域检查项数量
       this.getCheckItemNum();
       //获取当前区域nfc数量

+ 6 - 6
src/views/menu/LZRegister/index.vue

@@ -19,7 +19,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:false}}"
+                  :to="{path:path,query:{id:v.id,enable:1}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>
@@ -34,7 +34,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:true}}"
+                  :to="{path:path,query:{id:v.id}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>
@@ -49,7 +49,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'HH:mm')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:true}}"
+                  :to="{path:path,query:{id:v.id}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>
@@ -71,7 +71,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:false}}"
+                  :to="{path:path,query:{id:v.id,enable:1}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>
@@ -86,7 +86,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:true}}"
+                  :to="{path:path,query:{id:v.id}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>
@@ -101,7 +101,7 @@
                   :title="v.planName"
                   :label="formatTime(v.planStartTime,v.planEndTime,'YYYY-MM-DD')"
                   is-link
-                  :to="{path:path,query:{id:v.id,disabled:true}}"
+                  :to="{path:path,query:{id:v.id}}"
                   :value="getDicts(v.status,'resumption_status')"
                   :value-class="`title-orange`"/>
               </van-cell-group>