xukai 5 mēneši atpakaļ
vecāks
revīzija
8e73ffce03
1 mainītis faili ar 77 papildinājumiem un 20 dzēšanām
  1. 77 20
      src/view/laboratory/inspection/addInspTask.vue

+ 77 - 20
src/view/laboratory/inspection/addInspTask.vue

@@ -8,9 +8,19 @@
 -->
 <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="任务名称" placeholder="任务名称" :rules="[{ required: true, message: '请输入任务名称' }]" />
+      <van-field
+        v-model="state.form.taskTitle"
+        label="任务名称"
+        placeholder="任务名称"
+        :rules="[{ required: true, message: '请输入任务名称' }]"
+      />
       <van-cell-group>
         <van-field
           v-model="state.form.labName"
@@ -47,30 +57,77 @@
           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.form.photos" :after-read="afterRead" preview-size="60" :preview-full-image="true" :max-count="6" />
+            <van-uploader
+              v-model="state.form.photos"
+              :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="state.shwoLab" position="bottom">
-    <van-picker :columns="labList" :columns-field-names="{ text: 'labName', value: 'id' }" @confirm="pickLab" @cancel="state.shwoLab = false" />
+  <van-popup
+    v-model:show="state.shwoLab"
+    position="bottom"
+  >
+    <van-picker
+      :columns="labList"
+      :columns-field-names="{ text: 'labName', value: 'id' }"
+      @confirm="pickLab"
+      @cancel="state.shwoLab = false"
+    />
   </van-popup>
   <!-- 负责人 -->
-  <van-popup v-model:show="state.shwoUser" position="bottom">
-    <van-picker :columns="userList" :columns-field-names="{ text: 'name', value: 'id' }" @confirm="pickUser" @cancel="state.shwoUser = false" />
+  <van-popup
+    v-model:show="state.shwoUser"
+    position="bottom"
+  >
+    <van-picker
+      :columns="userList"
+      :columns-field-names="{ text: 'name', value: 'id' }"
+      @confirm="pickUser"
+      @cancel="state.shwoUser = false"
+    />
   </van-popup>
   <!-- 所在时间 -->
-  <van-popup v-model:show="showAddDatePicker" position="bottom">
-    <van-calendar v-model:show="showAddDatePicker" @confirm="onConfirmDate" @cancel="showAddDatePicker = false" type="range" />
+  <van-popup
+    v-model:show="showAddDatePicker"
+    position="bottom"
+  >
+    <van-calendar
+      v-model:show="showAddDatePicker"
+      @confirm="onConfirmDate"
+      @cancel="showAddDatePicker = false"
+      type="range"
+    />
   </van-popup>
 </template>
 
@@ -111,10 +168,10 @@
       frcnEndDate: '',
       labName: '',
       troubleDesc: '',
-      frcnPmName: ''
+      frcnPmName: '',
     },
     shwoLab: false,
-    shwoUser: false
+    shwoUser: false,
   })
   const loading = ref(false) // 加载状态
 
@@ -129,7 +186,7 @@
       frcnEndDate: '',
       labName: '',
       troubleDesc: '',
-      frcnPmName: ''
+      frcnPmName: '',
     }
   }
 
@@ -154,20 +211,20 @@
     const [errValid] = await to(formRef.value.validate())
     if (errValid) return
     let params = JSON.parse(JSON.stringify(state.form))
-    console.log(params)
-    const files = params.photos.map((item: any) => {
+    params.photos = params.photos.map((item: any) => {
       return {
         name: item.name,
-        url: item.url
+        url: item.url,
       }
     })
+    console.log(params)
     loading.value = true
     const [err, res]: ToResponse = await to(rectificationApi.onCreate(params))
     loading.value = false
     if (err) return
     showNotify({
       type: 'success',
-      message: '巡检隐患信息已提交,请耐心等待处理'
+      message: '巡检隐患信息已提交,请耐心等待处理',
     })
     setTimeout(() => {
       router.push('/lab/inspection/home')