瀏覽代碼

Merge branch 'bugfix/uploda-img' of wanglj/labsop_h5 into master

徐凯 5 月之前
父節點
當前提交
185cc56282

+ 144 - 36
src/view/entry/add.vue

@@ -8,7 +8,12 @@
 -->
 <template>
   <div class="app-container">
-    <van-form ref="formRef" @submit="onSubmit('20')" class="mt10" required="auto">
+    <van-form
+      ref="formRef"
+      @submit="onSubmit('20')"
+      class="mt10"
+      required="auto"
+    >
       <!-- <h4 class="mb8 mt8">申请人课题组信息</h4>
       <van-cell-group>
         <van-field v-model="state.form.pgName" label="课题组" placeholder="课题组" readonly :rules="[{ required: true }]" />
@@ -17,41 +22,111 @@
         <van-field v-model="state.form.mentorPhone" label="课题组负责人电话" placeholder="课题组负责人电话" readonly />
       </van-cell-group> -->
       <h4 class="mb8 mt8">申请入室平台</h4>
-      <van-cell-group v-for="(item, index) in state.form.platformList" :key="item.id">
-        <van-field label="申请平台" placeholder="申请平台">
+      <van-cell-group
+        v-for="(item, index) in state.form.platformList"
+        :key="item.id"
+      >
+        <van-field
+          label="申请平台"
+          placeholder="申请平台"
+        >
           <template #input>
-            <van-checkbox v-model="item.isChecked" name="10">{{ item.platformName }}</van-checkbox>
+            <van-checkbox
+              v-model="item.isChecked"
+              name="10"
+            >
+              {{ item.platformName }}
+            </van-checkbox>
           </template>
         </van-field>
-        <van-field v-model.number="item.platformTime" label="申请时长(月)" placeholder="申请时长(月)" type="number" :disabled="!item.isChecked">
+        <van-field
+          v-model.number="item.platformTime"
+          label="申请时长(月)"
+          placeholder="申请时长(月)"
+          type="number"
+          :disabled="!item.isChecked"
+        >
           <template #extra>个月</template>
         </van-field>
         <template v-if="item.platformType == '10'">
-          <van-field v-model="item.cellType" label="拟培养细胞种类" placeholder="拟培养细胞种类" :disabled="!item.isChecked" />
-          <van-field v-model="item.cellType" label="细胞房预约需求" placeholder="细胞房预约需求">
+          <van-field
+            v-model="item.cellType"
+            label="拟培养细胞种类"
+            placeholder="拟培养细胞种类"
+            :disabled="!item.isChecked"
+          />
+          <van-field
+            v-model="item.cellType"
+            label="细胞房预约需求"
+            placeholder="细胞房预约需求"
+          >
             <template #input>
-              <van-radio-group v-model="item.cellSourceType" :disabled="!item.isChecked" direction="horizontal">
-                <van-radio v-for="o in item.platformResourceType" :name="o.dictValue">{{ o.dictLabel }}</van-radio>
+              <van-radio-group
+                v-model="item.cellSourceType"
+                :disabled="!item.isChecked"
+                direction="horizontal"
+              >
+                <van-radio
+                  v-for="o in item.platformResourceType"
+                  :name="o.dictValue"
+                >
+                  {{ o.dictLabel }}
+                </van-radio>
               </van-radio-group>
             </template>
           </van-field>
         </template>
         <template v-else-if="item.platformType == '20'">
-          <van-field v-model="item.platOtherNeed" label="其他需求" placeholder="其他需求" :disabled="!item.isChecked" />
+          <van-field
+            v-model="item.platOtherNeed"
+            label="其他需求"
+            placeholder="其他需求"
+            :disabled="!item.isChecked"
+          />
         </template>
       </van-cell-group>
       <h4 class="mb8 mt8">申请人信息</h4>
       <van-cell-group>
-        <van-field v-model="state.form.memberName" label="申请人姓名" placeholder="申请人姓名" readonly :rules="[{ required: true }]" />
-        <van-field v-model="state.form.memberType" label="人员类型" placeholder="人员类型" readonly :rules="[{ required: true }]">
+        <van-field
+          v-model="state.form.memberName"
+          label="申请人姓名"
+          placeholder="申请人姓名"
+          readonly
+          :rules="[{ required: true }]"
+        />
+        <van-field
+          v-model="state.form.memberType"
+          label="人员类型"
+          placeholder="人员类型"
+          readonly
+          :rules="[{ required: true }]"
+        >
           <template #input>{{ getDictLabel(userTypeList, state.form.memberType) }}</template>
         </van-field>
-        <van-field v-model="state.form.memberPhone" label="申请人手机号" placeholder="申请人手机号" readonly />
-        <van-field v-model="state.form.deptName" label="申请人科室" placeholder="申请人科室" readonly />
-        <van-field v-model="state.form.pgName" label="课题组" placeholder="课题组" readonly :rules="[{ required: true }]" />
+        <van-field
+          v-model="state.form.memberPhone"
+          label="申请人手机号"
+          placeholder="申请人手机号"
+          readonly
+        />
+        <van-field
+          v-model="state.form.deptName"
+          label="申请人科室"
+          placeholder="申请人科室"
+          readonly
+        />
+        <van-field
+          v-model="state.form.pgName"
+          label="课题组"
+          placeholder="课题组"
+          readonly
+          :rules="[{ required: true }]"
+        />
       </van-cell-group>
       <h4 class="mb8 mt8">安全承诺</h4>
-      <van-checkbox v-model="state.safePromise">本人承诺:如时候遵守实验室及个平台的各项规章制度,遵守在室的积分管理制度。</van-checkbox>
+      <van-checkbox v-model="state.safePromise">
+        本人承诺:如时候遵守实验室及个平台的各项规章制度,遵守在室的积分管理制度。
+      </van-checkbox>
       <!-- <h4 class="mb8 mt8">安全承诺</h4>
       <van-checkbox v-model="state.safePromise">本人承诺:如时候遵守实验室及个平台的各项规章制度,遵守在室的积分管理制度。</van-checkbox>
       <van-checkbox v-model="state.safeRead" :disabled="!state.isRead">
@@ -64,15 +139,27 @@
       </div> -->
 
       <van-action-bar placeholder>
-        <van-action-bar-icon icon="wap-home-o" text="首页" @click="router.push('/home')" />
-        <van-action-bar-icon icon="revoke" text="返回" @click="router.push('/entry')" />
+        <van-action-bar-icon
+          icon="wap-home-o"
+          text="首页"
+          @click="router.push('/home')"
+        />
+        <van-action-bar-icon
+          icon="revoke"
+          text="返回"
+          @click="router.push('/entry')"
+        />
         <!-- <van-action-bar-icon
           :icon="state.instDetail.following ? 'star' : 'star-o'"
           :class="{ follow: state.instDetail.following }"
           :text="state.instDetail.following ? '取消收藏' : '收藏'"
           @click="handleFollowInst"
         /> -->
-        <van-action-bar-button type="primary" text="立即预约" native-type="submit" />
+        <van-action-bar-button
+          type="primary"
+          text="立即预约"
+          native-type="submit"
+        />
       </van-action-bar>
     </van-form>
   </div>
@@ -81,12 +168,28 @@
     <div class="ck-editor" v-html="noticeInfo.noticeContent"></div>
   </van-dialog> -->
 
-  <van-popup v-model:show="state.needToKnowShow" round :closeable="true" position="bottom" :style="{ height: '90vh' }">
+  <van-popup
+    v-model:show="state.needToKnowShow"
+    round
+    :closeable="true"
+    position="bottom"
+    :style="{ height: '90vh' }"
+  >
     <div class="need-to-know">
       <h4 class="mt8 mb8">申请须知</h4>
-      <div class="ck-editor" v-html="noticeInfo.noticeContent"></div>
+      <div
+        class="ck-editor"
+        v-html="noticeInfo.noticeContent"
+      ></div>
       <footer>
-        <van-button class="w100" type="primary" round @click="confirmAppoint">我知道了</van-button>
+        <van-button
+          class="w100"
+          type="primary"
+          round
+          @click="confirmAppoint"
+        >
+          我知道了
+        </van-button>
       </footer>
     </div>
   </van-popup>
@@ -148,14 +251,14 @@
       cellSourceType: '',
       isMolecularChecked: '20',
       molecularTime: null,
-      platOtherNeed: ''
+      platOtherNeed: '',
     },
-    needToKnowShow: false
+    needToKnowShow: false,
   })
   const noticeShow = ref(false)
   const noticeInfo = reactive({
     noticeTitle: '',
-    noticeContent: ''
+    noticeContent: '',
   })
   const createEntryPayload = ref({})
 
@@ -168,17 +271,22 @@
     state.needToKnowShow = false
     showNotify({
       type: 'success',
-      message: '入室申请创建成功'
+      message: '入室申请创建成功',
     })
 
     router.push('/entry')
   }
 
   const getDicts = async () => {
-    await Promise.all([dictApi.getDictDataByType('sys_user_type'), platformApi.getAllPlatformList({ noPage: true })]).then(([type, plat]) => {
+    await Promise.all([
+      dictApi.getDictDataByType('sys_user_type'),
+      platformApi.getAllPlatformList({ noPage: true }),
+    ]).then(([type, plat]) => {
       userTypeList.value = type.data.values || []
       const platList = plat?.data?.list || []
-      platformList.value = platList.map((item: any) => {
+      const moleculesAndCells = platList.filter((item) => item.platformType === '10' || item.platformType === '20')
+
+      platformList.value = moleculesAndCells.map((item: any) => {
         const options = JSON.parse(item.platformResourceType)
         return {
           isChecked: false,
@@ -190,7 +298,7 @@
           cellSourceType: options?.length ? options[0].dictValue : '',
           platOtherNeed: '',
           platformResourceType: options,
-          platformDesc: item.platformDesc
+          platformDesc: item.platformDesc,
         }
       })
     })
@@ -222,7 +330,7 @@
       cellSourceType: '',
       isMolecularChecked: '20',
       molecularTime: null,
-      platOtherNeed: ''
+      platOtherNeed: '',
     }
     state.form.memberId = userInfos.value.id
     state.form.memberName = userInfos.value.nickName
@@ -241,7 +349,7 @@
     } else {
       showNotify({
         message: '当前用户未加入课题组,无法发起入室申请',
-        type: 'danger'
+        type: 'danger',
       })
     }
   }
@@ -257,11 +365,11 @@
     }
   }
   const onSubmit = async (type: string) => {
-    onRead();
+    onRead()
     if (!state.safePromise) {
       showNotify({
         type: 'warning',
-        message: '请阅读并勾选安全承诺!'
+        message: '请阅读并勾选安全承诺!',
       })
       return
     }
@@ -273,13 +381,13 @@
     params.platformList = arr.map((item: any) => {
       return {
         ...item,
-        isChecked: '10'
+        isChecked: '10',
       }
     })
     if (!params.platformList.length) {
       showNotify({
         type: 'warning',
-        message: '请选择平台'
+        message: '请选择平台',
       })
       return
     }
@@ -287,7 +395,7 @@
       if (!item.platformTime) {
         showNotify({
           type: 'warning',
-          message: '请选择平台预约时间'
+          message: '请选择平台预约时间',
         })
         return
       }

+ 5 - 2
src/view/laboratory/inspection/details.vue

@@ -16,8 +16,11 @@
         <van-field v-model="state.form.frcnPmName" label="负责人" placeholder="负责人" readonly />
         <van-field v-model="state.form.date" label="限定整改时间" placeholder="限定整改时间" readonly>
           <template #input>
-            {{ formatDate(new Date(state.form.frcnStartDate), 'YYYY-mm-dd') }} ~
-            {{ formatDate(new Date(state.form.frcnEndDate), 'YYYY-mm-dd') }}
+            <span v-if="state.form.frcnStartDate && state.form.frcnEndDate">
+              {{ formatDate(new Date(state.form.frcnStartDate), 'YYYY-mm-dd') }} ~
+              {{ formatDate(new Date(state.form.frcnEndDate), 'YYYY-mm-dd') }}
+            </span>
+            <span v-else>-</span>
           </template>
         </van-field>
         <van-field v-model="state.form.troubleDesc" autosize type="textarea" label="隐患说明" placeholder="隐患说明" readonly />

+ 94 - 22
src/view/laboratory/inspection/feedback.vue

@@ -8,20 +8,57 @@
 -->
 <template>
   <div class="app-container">
-    <van-form ref="formRef" @submit="onSubmit" class="mt10" required="auto">
+    <van-form
+      ref="formRef"
+      @submit="onSubmit"
+      class="mt10"
+      required="auto"
+    >
       <h4 class="mb8 mt8">隐患信息</h4>
-      <van-field v-model="state.form.taskTitle" label="任务名称" readonly />
+      <van-field
+        v-model="state.form.taskTitle"
+        label="任务名称"
+        readonly
+      />
       <van-cell-group>
-        <van-field v-model="state.form.labName" label="实验室" placeholder="实验室" readonly />
-        <van-field v-model="state.form.frcnPmName" label="负责人" placeholder="负责人" readonly />
-        <van-field v-model="state.form.date" label="限定整改时间" placeholder="限定整改时间" readonly>
+        <van-field
+          v-model="state.form.labName"
+          label="实验室"
+          placeholder="实验室"
+          readonly
+        />
+        <van-field
+          v-model="state.form.frcnPmName"
+          label="负责人"
+          placeholder="负责人"
+          readonly
+        />
+        <van-field
+          v-model="state.form.date"
+          label="限定整改时间"
+          placeholder="限定整改时间"
+          readonly
+        >
           <template #input>
-            {{ formatDate(new Date(state.form.frcnStartDate), 'YYYY-mm-dd') }} ~
-            {{ formatDate(new Date(state.form.frcnEndDate), 'YYYY-mm-dd') }}
+            <span v-if="state.form.frcnStartDate && state.form.frcnEndDate">
+              {{ formatDate(new Date(state.form.frcnStartDate), 'YYYY-mm-dd') }} ~
+              {{ formatDate(new Date(state.form.frcnEndDate), 'YYYY-mm-dd') }}
+            </span>
+            <span v-else>-</span>
           </template>
         </van-field>
-        <van-field v-model="state.form.troubleDesc" autosize type="textarea" label="隐患说明" placeholder="隐患说明" readonly />
-        <van-field name="uploader" label="隐患照片">
+        <van-field
+          v-model="state.form.troubleDesc"
+          autosize
+          type="textarea"
+          label="隐患说明"
+          placeholder="隐患说明"
+          readonly
+        />
+        <van-field
+          name="uploader"
+          label="隐患照片"
+        >
           <template #input>
             <div>
               <van-image
@@ -57,22 +94,53 @@
           placeholder="整改说明"
           :rules="[{ required: true, message: '请输入整改说明' }]"
         />
-        <van-field name="uploader" label="整改照片" :rules="[{ required: true, message: '请上传整改照片' }]">
+        <van-field
+          name="uploader"
+          label="整改照片"
+          :rules="[{ required: true, message: '请上传整改照片' }]"
+        >
           <template #input>
-            <van-uploader v-model="state.alterForm.alterPhotos" :after-read="afterRead" preview-size="60" :preview-full-image="true" :max-count="6" />
+            <van-uploader
+              v-model="state.alterForm.alterPhotos"
+              :after-read="afterRead"
+              preview-size="60"
+              :preview-full-image="true"
+              :max-count="6"
+            />
           </template>
         </van-field>
       </van-cell-group>
       <van-action-bar placeholder>
-        <van-action-bar-icon icon="wap-home-o" text="首页" @click="router.push('/home')" />
-        <van-action-bar-icon icon="revoke" text="返回" @click="router.push('/lab/inspection/home')" />
-        <van-action-bar-button type="primary" text="立即提交" :loading="loading" native-type="submit" />
+        <van-action-bar-icon
+          icon="wap-home-o"
+          text="首页"
+          @click="router.push('/home')"
+        />
+        <van-action-bar-icon
+          icon="revoke"
+          text="返回"
+          @click="router.push('/lab/inspection/home')"
+        />
+        <van-action-bar-button
+          type="primary"
+          text="立即提交"
+          :loading="loading"
+          native-type="submit"
+        />
       </van-action-bar>
     </van-form>
   </div>
   <!-- 所在时间 -->
-  <van-popup v-model:show="showAddDatePicker" position="bottom">
-    <van-date-picker v-model="date" title="选择日期" @confirm="onConfirmDate" @cancel="showAddDatePicker = false" />
+  <van-popup
+    v-model:show="showAddDatePicker"
+    position="bottom"
+  >
+    <van-date-picker
+      v-model="date"
+      title="选择日期"
+      @confirm="onConfirmDate"
+      @cancel="showAddDatePicker = false"
+    />
   </van-popup>
 </template>
 
@@ -101,15 +169,15 @@
       frcnEndDate: '',
       labName: '',
       troubleDesc: '',
-      frcnPmName: ''
+      frcnPmName: '',
     },
     alterForm: {
       alterDesc: '',
       frcnCompleteDate: '',
-      alterPhotos: [] as any
+      alterPhotos: [] as any,
     },
     shwoLab: false,
-    shwoUser: false
+    shwoUser: false,
   })
   const loading = ref(false) // 加载状态
   const date = ref([])
@@ -118,7 +186,7 @@
     if (!id)
       return showNotify({
         type: 'warning',
-        message: '未指定巡检信息'
+        message: '未指定巡检信息',
       })
     const [err, res]: ToResponse = await to(rectificationApi.getDetail({ id }))
     if (err) return
@@ -132,6 +200,10 @@
     const [errValid] = await to(formRef.value.validate())
     if (errValid) return
     let params = { ...state.alterForm, id: Number(router.currentRoute.value.query.id), frcnStatus: '40' }
+    params.alterPhotos = params.alterPhotos.map((item) => ({
+      name: item.name,
+      url: item.url,
+    }))
     console.log(params)
     loading.value = true
     const [err, res]: ToResponse = await to(rectificationApi.onUpdated(params))
@@ -139,7 +211,7 @@
     if (err) return
     showNotify({
       type: 'success',
-      message: '整改信息提交成功'
+      message: '整改信息提交成功',
     })
     setTimeout(() => {
       router.push('/lab/inspection/home')
@@ -185,7 +257,7 @@
     const images = JSON.parse(photos).map((item: any) => item.url)
     showImagePreview({
       images,
-      startPosition: index
+      startPosition: index,
     })
   }
   onMounted(async () => {

+ 82 - 19
src/view/laboratory/inspection/index.vue

@@ -9,43 +9,101 @@
 <template>
   <div class="entry-container">
     <div class="search-wrap">
-      <van-search placeholder="请输入任务名称" v-model="state.queryParams.taskTitle" :clearabled="true" style="padding: 0; flex: 1" class="mr10"></van-search>
+      <van-search
+        placeholder="请输入任务名称"
+        v-model="state.queryParams.taskTitle"
+        :clearabled="true"
+        style="padding: 0; flex: 1"
+        class="mr10"
+      ></van-search>
       <div>
-        <van-button type="primary" style="width: 60px" shape="circle" size="small" @click="onLoad"> 搜索 </van-button>
+        <van-button
+          type="primary"
+          style="width: 60px"
+          shape="circle"
+          size="small"
+          @click="onLoad"
+        >
+          搜索
+        </van-button>
       </div>
     </div>
-    <van-tabs v-model:active="state.queryParams.frcnStatus" @change="changeType">
-      <van-tab title="待整改" name="10"></van-tab>
-      <van-tab title="整改完成" name="40"></van-tab>
-      <van-tab title="全部" name=""></van-tab>
+    <van-tabs
+      v-model:active="state.queryParams.frcnStatus"
+      @change="changeType"
+    >
+      <van-tab
+        title="待整改"
+        name="10"
+      ></van-tab>
+      <van-tab
+        title="整改完成"
+        name="40"
+      ></van-tab>
+      <van-tab
+        title="全部"
+        name=""
+      ></van-tab>
     </van-tabs>
     <div class="list-container">
-      <van-list v-model:loading="state.loading" :finished="state.finished" finished-text="没有更多了" @load="onLoad">
-        <van-cell v-for="item in state.list" :key="item" @click.stop="toDetails(item.id)">
+      <van-list
+        v-model:loading="state.loading"
+        :finished="state.finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+      >
+        <van-cell
+          v-for="item in state.list"
+          :key="item"
+          @click.stop="toDetails(item.id)"
+        >
           <template #default>
             <div class="list">
               <header class="flex justify-between">
                 <strong class="title">{{ `${item.taskTitle}` }}</strong>
-                <van-tag v-if="item.frcnStatus == 10" type="primary">待整改</van-tag>
-                <van-tag v-else-if="item.frcnStatus == 40" type="success">整改完成</van-tag>
+                <van-tag
+                  v-if="item.frcnStatus == 10"
+                  type="primary"
+                >
+                  待整改
+                </van-tag>
+                <van-tag
+                  v-else-if="item.frcnStatus == 40"
+                  type="success"
+                >
+                  整改完成
+                </van-tag>
               </header>
               <p class="inst-title">
                 <span>实验室名称</span>
-                <span class="title ml8"> {{ item.labName }} </span>
+                <span class="title ml8">{{ item.labName }}</span>
               </p>
               <p class="inst-title">
                 <span>实验室负责人</span>
-                <span class="title ml8"> {{ item.frcnPmName }}</span>
+                <span class="title ml8">{{ item.frcnPmName }}</span>
               </p>
               <p class="inst-title">
                 <span>限定整改时间</span>
-                <span class="title ml8">
-                  {{ formatDate(new Date(item.frcnStartDate), 'YYYY-mm-dd') }}~{{ formatDate(new Date(item.frcnEndDate), 'YYYY-mm-dd') }}</span
+                <span
+                  v-if="item.frcnStartDate && item.frcnEndDate"
+                  class="title ml8"
+                >
+                  {{ formatDate(new Date(item.frcnStartDate), 'YYYY-mm-dd') }}~{{
+                    formatDate(new Date(item.frcnEndDate), 'YYYY-mm-dd')
+                  }}
+                </span>
+                <span
+                  v-else
+                  class="title ml8"
                 >
+                  -
+                </span>
               </p>
               <p class="inst-title">
                 <span>实际整改时间</span>
-                <span class="title ml8">{{ formatDate(new Date(item.frcnCompleteDate), 'YYYY-mm-dd') }}</span>
+                <span class="title ml8">
+                  {{ item.frcnCompleteDate ? formatDate(new Date(item.frcnCompleteDate), 'YYYY-mm-dd') : '-' }}
+                </span>
               </p>
               <!-- <footer class="flex justify-between mt4">
                 <span class="title">{{ item.createdName }}</span>
@@ -67,7 +125,12 @@
         </van-cell>
       </van-list>
     </div>
-    <van-floating-bubble v-model:offset="offset" icon="plus" @click="onAdd" axis="y" />
+    <van-floating-bubble
+      v-model:offset="offset"
+      icon="plus"
+      @click="onAdd"
+      axis="y"
+    />
   </div>
 </template>
 
@@ -91,11 +154,11 @@
       taskTitle: '',
       frcnStatus: '10',
       pageNum: 1,
-      pageSize: 10
+      pageSize: 10,
     },
     finished: false,
     loading: true,
-    list: [] as any[]
+    list: [] as any[],
   })
 
   const changeType = () => {
@@ -139,7 +202,7 @@
     const images = JSON.parse(fullPhoto).map((item: any) => item.url)
     showImagePreview({
       images,
-      startPosition: index
+      startPosition: index,
     })
   }