Przeglądaj źródła

修复随访过期用户不可填写

张田田 8 miesięcy temu
rodzic
commit
5d004f0911
1 zmienionych plików z 17 dodań i 9 usunięć
  1. 17 9
      src/components/Follow.vue

+ 17 - 9
src/components/Follow.vue

@@ -36,6 +36,14 @@ onBeforeMount(() => {
 const activeKey = ref<number>();
 const activeIndex = ref<number>();
 const activeObj = ref<any>({ fillin: {}, symptomsData: [] });
+// 过期判定与只读
+const isExpired = computed(() => {
+  const t = activeObj.value?.arrangeTime;
+  if (!t) return false;
+  const ts = new Date(t as any).getTime();
+  return !Number.isNaN(ts) && ts < Date.now();
+});
+const isReadOnly = computed(() => isExpired.value || activeObj.value?.progress === '2' || activeObj.value?.progress === '0');
 // 切换侧边栏任务
 const changeTab = (data: any, index: number) => {
   activeKey.value = data.id;
@@ -275,12 +283,12 @@ const previewImg = ref<string>('');
             <!-- 症状选择器 -->
             <div class="symptom-container flex flex-wrap">
               <div v-for="item in activeObj?.symptomsData" :key="item.name" class="symptom-item">
-                <div class="symptom-button" @click="activeObj.progress !== '0' ? handleParentClick(item.name) : ''" :class="{ 'disabled': activeObj.progress === '0' }">
+                <div class="symptom-button" @click="!isReadOnly ? handleParentClick(item.name) : ''" :class="{ 'disabled': isReadOnly }">
                   <span>{{ item.name }}</span>
                   <span v-if="item.selectedValue" class="selected-value">: {{ item.selectedValue }}</span>
                 </div>
                 <div v-show="symptomsValue.parent === item.name" class="symptom-options">
-                  <a-radio-group :model-value="item.selectedId" @change="activeObj.progress !== '0' && handleChildChange($event)" class="flex flex-wrap" :disabled="activeObj.progress === '0'">
+                  <a-radio-group :model-value="item.selectedId" @change="!isReadOnly && handleChildChange($event)" class="flex flex-wrap" :disabled="isReadOnly">
                     <a-radio :value="tag.value" v-for="tag in item.child" :key="tag.value" class="mr-4">
                       {{ tag.label }}
                     </a-radio>
@@ -306,7 +314,7 @@ const previewImg = ref<string>('');
         <div class="border-1 border-solid border-gray:50 pl-2 pd-10 ml-2">
           <div class="mb-3">2、请问有没有出现<span class="text-red-600">新</span>的症状?</div>
           <div class="mb-8 ml-4 flex">
-            <div v-for="symptoms in selectSymptomsData" :key="symptoms.name" class="mr-4" @click="activeObj?.progress === '1' ? changeTag(symptoms) : ''">
+            <div v-for="symptoms in selectSymptomsData" :key="symptoms.name" class="mr-4" @click="!isReadOnly ? changeTag(symptoms) : ''">
               <div>
                 <div class="border-solid b-1 w-20 text-center" :class="[activeObj.fillin.isHaveNewSyndrome === symptoms.id ? 'bg-blue text-#fff' : '', activeObj.progress === '0' ? 'disabled' : '']">
                   {{ symptoms.name }}
@@ -319,14 +327,14 @@ const previewImg = ref<string>('');
         <div class="border-1 border-solid border-gray:50 pl-2 pd-10 ml-2" v-if="activeObj.fillin?.isHaveNewSyndrome === 'Y'">
           <div class="mb-3">3、请描述新的症状</div>
           <div class="mb-4 ml-4">
-            <a-input v-model:value="activeObj.fillin.newSyndrome" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }" :disabled="activeObj.progress === '2' || activeObj.progress === '0'" />
+            <a-input v-model:value="activeObj.fillin.newSyndrome" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }" :disabled="isReadOnly" />
           </div>
         </div>
         <!--      第四个-->
         <div class="border-1 border-solid border-gray:50 pl-2 pd-10 ml-2">
           <div class="mb-3">4、如果有其他情况,请留言</div>
           <div class="mb-4 ml-4">
-            <a-input v-model:value="activeObj.fillin.otherDesc" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }" :disabled="activeObj.progress === '2' || activeObj.progress === '0'" />
+            <a-input v-model:value="activeObj.fillin.otherDesc" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }" :disabled="isReadOnly" />
           </div>
         </div>
         <!--      第五个-->
@@ -344,7 +352,7 @@ const previewImg = ref<string>('');
                   @preview="handlePreview"
                   :maxCount="1"
                   :customRequest="customUpload"
-                  :disabled="activeObj.progress === '2' || activeObj.progress === '0'"
+                  :disabled="isReadOnly"
                 >
                   <div v-if="upImgList.length < 1">
                     <plus-outlined />
@@ -361,7 +369,7 @@ const previewImg = ref<string>('');
                   @preview="handlePreview"
                   :maxCount="1"
                   :customRequest="customUpload"
-                  :disabled="activeObj.progress === '2' || activeObj.progress === '0'"
+                  :disabled="isReadOnly"
                 >
                   <div v-if="downImageList.length < 1">
                     <plus-outlined />
@@ -378,7 +386,7 @@ const previewImg = ref<string>('');
                   @preview="handlePreview"
                   :maxCount="1"
                   :customRequest="customUpload"
-                  :disabled="activeObj.progress === '2' || activeObj.progress === '0'"
+                  :disabled="isReadOnly"
                 >
                   <div v-if="faceImageList.length < 1">
                     <plus-outlined />
@@ -410,7 +418,7 @@ const previewImg = ref<string>('');
         </div>
       </div>
     </div>
-    <div class="flex items-center justify-center mt-6 mb-6">
+    <div class="flex items-center justify-center mt-6 mb-6" v-if="!isReadOnly">
       <a-button size="small" class="mr-4" @click="cancelFollowContent">取消</a-button>
       <a-button type="primary" size="small" @click="subFollowContent" v-show="activeObj.progress === '1'">提交 </a-button>
     </div>