Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

lmm 2 mēneši atpakaļ
vecāks
revīzija
03c1ba92c5

+ 54 - 70
src/views/museums/specimeninfo/SpecimenImportForm.vue

@@ -1,6 +1,7 @@
 <template>
-  <Dialog   loading="loading"  v-model="dialogVisible" title="标本信息导入" width="600">
-    <el-alert title="可单独上传xlsx表或者图片压缩包。需确保图片命名规范,不与旧图片命名重复。" type="warning" style="margin-bottom: 10px"/>
+  <Dialog loading="loading" v-model="dialogVisible" title="标本信息导入" width="600">
+    <el-alert title="可单独上传xlsx表或者图片压缩包。需确保图片命名规范,不与旧图片命名重复。"
+              type="warning" style="margin-bottom: 10px"/>
     <el-upload
       ref="uploadRef"
       v-model:file-list="fileList"
@@ -14,14 +15,10 @@
       accept=".xlsx, .xls"
       drag
     >
-      <Icon icon="ep:upload" />
+      <Icon icon="ep:upload"/>
       <div class="el-upload__text">将xlsx表拖到此处,或<em>点击上传</em></div>
       <template #tip>
         <div class="el-upload__tip text-center">
-<!--          <div class="el-upload__tip">-->
-<!--            <el-checkbox v-model="updateSupport" />-->
-<!--            是否更新已经存在的标本数据-->
-<!--          </div>-->
           <span>仅允许导入 xls、xlsx 格式文件。</span>
           <el-link
             :underline="false"
@@ -48,20 +45,20 @@
       :headers="uploadHeaders"
       accept=".zip"
     >
-      <el-icon class="el-icon--upload" ><upload-filled /></el-icon>
+      <el-icon class="el-icon--upload">
+        <upload-filled/>
+      </el-icon>
       <div class="el-upload__text">
         <div class="el-upload__text">将图片压缩包拖到此处,或<em>点击上传</em></div>
       </div>
       <template #tip>
         <div class="el-upload__tip text-center">
-<!--          <el-checkbox v-model="updateSupport" />-->
-<!--          是否更新已经存在的标本图片-->
-        <span>仅允许导入 .zip 格式文件。</span>
+          <span>仅允许导入 .zip 格式文件。</span>
           <div class="el-upload__tip">
-            <el-checkbox v-model="updateSupport" />
+            <el-checkbox v-model="updateSupport"/>
             是否更新已经存在的标本数据
           </div>
-                </div>
+        </div>
       </template>
     </el-upload>
     <template #footer>
@@ -73,13 +70,13 @@
 
 <script lang="ts" setup>
 import download from '@/utils/download'
-import { getAccessToken, getTenantId } from '@/utils/auth'
+import {getAccessToken, getTenantId} from '@/utils/auth'
 import {SpecimenInfoApi} from "@/api/museums/specimeninfo";
-import { ref, nextTick } from 'vue';
+import {ref, nextTick} from 'vue';
 import {UploadFilled} from "@element-plus/icons-vue";
 import {useUpload} from "@/components/UploadFile/src/useUpload";
 
-defineOptions({ name: 'SpecimenImportForm' })
+defineOptions({name: 'SpecimenImportForm'})
 const loading = ref(true) // 列表的加载中
 const dialogVisible = ref(false) // 弹窗的是否展示
 const formLoading = ref(false) // 表单的加载中
@@ -88,15 +85,14 @@ const uploadimageRef = ref()
 
 const message = useMessage() // 消息弹窗
 import axios from 'axios';
+
 const updateSupport = ref(0) // 是否更新已经存在的用户数据
-//const updateImageSupport = ref()  //是否更新已经存在的标本图片
 const fileList = ref([]) // 文件列表
 const imageList = ref([])
 const uploadHeaders = ref() // 上传 Header 头
 const importUrl =
   import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/museums/specimen-info/import-specimen-with-images'
-// const importImageUrl =
-//   import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/museums/specimen-info/import-specimen-images'
+
 /** 打开弹窗 */
 const open = () => {
   loading.value = true
@@ -106,8 +102,8 @@ const open = () => {
   imageList.value = []
   resetForm()
 }
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
-const {  httpRequest } = useUpload()
+defineExpose({open}) // 提供 open 方法,用于打开弹窗
+const {httpRequest} = useUpload()
 
 /** 提交表单 */
 const submitForm = async () => {
@@ -123,40 +119,40 @@ const submitForm = async () => {
   formLoading.value = true
   const formData = new FormData()
   if (fileList.value.length > 0) {
-    formData.append('file', fileList.value[0].raw, fileList.value[0].name)
+    formData.append('file', fileList.value[0].raw)
   }
   if (imageList.value.length > 0) {
-    formData.append('imageFile', imageList.value[0].raw, imageList.value[0].name)
+    formData.append('imageFile', imageList.value[0].raw)
   }
 
-  axios.post(importUrl + '?updateSupport=' + updateSupport.value, formData, {
-    headers: {
-      ...uploadHeaders.value,
-      'Content-Type': 'multipart/form-data'
-    }
-  }).then((response) => {
+  try {
+    const response = await axios.post(importUrl + '?updateSupport=' + updateSupport.value, formData, {
+      headers: {
+        ...uploadHeaders.value,
+        'Content-Type': 'multipart/form-data'
+      }
+    });
     submitFormSuccess(response)
-  }).catch((error) => {
+  } catch (error) {
     submitFormError()
-  }).finally(() => {
-    formLoading.value = false
-  })
-}
-
+  } finally {
+    formLoading.value = false;
+  }
+};
 /** 文件上传成功 */
 const emits = defineEmits(['success'])
 const submitFormSuccess = (response: any) => {
-
-  console.log(response.data.code != 0 , response.data.code)
+  console.log('上传响应:', response)
+  // console.log(response.data.code != 0 , response.data.code)
+  console.log(666)
   if (response.data.code != 0) {
     message.error(response.msg)
-    formLoading.value = false
+    // formLoading.value = false
     return
   }
   // 拼接提示语
-
   const data = response.data.data
-  console.log(data)
+  // console.log(data)
   let text = '上传成功数量:' + data.createSpecimenNumbers.length + ';'
   for (let specimenInfodata of data.createSpecimenNumbers) {
     text += '标本编号:' + specimenInfodata + '、'
@@ -169,32 +165,19 @@ const submitFormSuccess = (response: any) => {
   for (const specimenInfodata in data.failureSpecimenNumbers) {
     text += '< ' + specimenInfodata + ': ' + data.failureSpecimenNumbers[specimenInfodata] + ' >'
   }
+  console.log(555)
   message.alert(text)
-  formLoading.value = false
+  // formLoading.value = false
   dialogVisible.value = false
   // 发送操作成功的事件
   emits('success')
 }
-// ///文件反馈上传
-//
-// const handleExceed = () => {
-//   message.error('最多只能上传一个文件,支持修改代码文件和压缩包分开上传!')
-// }
-//
-// const beforeUpload = (file: File) => {
-//   // 在这里添加文件类型检查逻辑
-//   // 例如,检查文件扩展名是否为 .zip 或 .txt
-//   const fileExtension = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase();
-//   if (fileExtension !== 'zip' && fileExtension !== 'txt') {
-//     message.error('只支持上传.zip或.txt文件!');
-//     return false;
-//   }
-//   return true;
-// }
+
 /** 上传错误提示 */
 const submitFormError = (): void => {
   message.error('上传失败,请您重新上传!')
   formLoading.value = false
+  dialogVisible.value = false
 }
 
 /** 重置表单 */
@@ -216,21 +199,22 @@ const importTemplate = async () => {
   download.excel(res, '标本批量导入模版.xls')
 }
 
-/** 图片上传成功 */
 
-const submitImageSuccess = (response: any) => {
-  console.log('tj',response)
-  if (response.code !== 0) {
-    message.error(response.msg)
-    formLoading.value = false
-    return
-  }
-  formLoading.value = false
-  dialogVisible.value = false
-  // 发送操作成功的事件
-
-}
+/** 图片上传成功 */
 
+// const submitImageSuccess = (response: any) => {
+//   console.log('tj',response)
+//   if (response.data.code !== 0) {
+//     message.error(response.msg)
+//     formLoading.value = false
+//
+//     return
+//   }
+//   formLoading.value = false
+//   dialogVisible.value = false
+//   // 发送操作成功的事件
+//
+// }
 
 
 </script>

+ 98 - 96
src/views/museums/specimeninfo/imageImportForm.vue

@@ -1,106 +1,108 @@
-<template>
-  <el-skeleton :loading="loading" animated>
-  <Dialog v-model="dialogVisible" title="标本图片批量导入" width="500" >
-    <el-upload
-      ref="uploadRef"
-      v-model:file-list="fileList"
-      drag
-      :action="importUrl + '?updateSupport=' + updateSupport"
-      :on-success="submitFormSuccess"
-      style="max-width:250px;max-height: 30vh;margin-left: 20px"
-      :auto-upload="false"
-      :disabled="formLoading"
-      :limit="1"
-      :on-error="submitFormError"
-       :http-request="httpRequest"
+<!--<template>-->
+<!--  <el-skeleton :loading="loading" animated>-->
+<!--  <Dialog v-model="dialogVisible" title="标本图片批量导入" width="500" >-->
+<!--    <el-upload-->
+<!--      ref="uploadRef"-->
+<!--      v-model:file-list="fileList"-->
+<!--      drag-->
+<!--      :action="importUrl + '?updateSupport=' + updateSupport"-->
+<!--      :on-success="submitFormSuccess"-->
+<!--      style="max-width:250px;max-height: 30vh;margin-left: 20px"-->
+<!--      :auto-upload="false"-->
+<!--      :disabled="formLoading"-->
+<!--      :limit="1"-->
+<!--      :on-error="submitFormError"-->
+<!--       :http-request="httpRequest"-->
 
-    >
-      <el-icon class="el-icon--upload"><upload-filled /></el-icon>
-      <div class="el-upload__text">
-        <em>点击批量上传图片</em>
-        <span>仅允许导入jpg、png、gif 格式文件。</span>
-      </div>
-      <template #tip>
-        <div class="el-upload__tip">
-          <el-checkbox v-model="updateSupport" />
-          是否更新已经存在的标本图片
-        </div>
-      </template>
-    </el-upload>
-    <template #footer >
-      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
-      <el-button @click="dialogVisible = false">取 消</el-button>
-    </template>
-  </Dialog>
-    </el-skeleton>
-</template>
+<!--    >-->
+<!--      <el-icon class="el-icon&#45;&#45;upload"><upload-filled /></el-icon>-->
+<!--      <div class="el-upload__text">-->
+<!--        <em>点击批量上传图片</em>-->
+<!--        <span>仅允许导入jpg、png、gif 格式文件。</span>-->
+<!--      </div>-->
+<!--      <template #tip>-->
+<!--        <div class="el-upload__tip">-->
+<!--          <el-checkbox v-model="updateSupport" />-->
+<!--          是否更新已经存在的标本图片-->
+<!--        </div>-->
+<!--      </template>-->
+<!--    </el-upload>-->
+<!--    <template #footer >-->
+<!--      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>-->
+<!--      <el-button @click="dialogVisible = false">取 消</el-button>-->
+<!--    </template>-->
+<!--  </Dialog>-->
+<!--    </el-skeleton>-->
+<!--</template>-->
 
-<script lang="ts" setup>
-import {UploadFilled} from "@element-plus/icons-vue";
+<!--<script lang="ts" setup>-->
+<!--import {UploadFilled} from "@element-plus/icons-vue";-->
 
-import { useUpload } from '@/components/UploadFile/src/useUpload'
+<!--import { useUpload } from '@/components/UploadFile/src/useUpload'-->
 
-import {ref} from "vue";
-const importUrl =
-  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/museums/specimen-info/import-specimen-images'
-defineOptions({ name: 'imageImportForm' })
-const dialogVisible = ref(false) // 弹窗的是否展示
-const formLoading = ref(false) // 表单的加载中
-const uploadRef = ref()
-const message = useMessage() // 消息弹窗
-const updateSupport = ref(0) // 是否更新已经存在的用户数据
-const fileList = ref([]) // 文件列表
-const loading = ref(true) // 列表的加载中
-// const uploadHeaders = ref() // 上传 Header 头
-/** 打开弹窗 */
-const open = () => {
-  dialogVisible.value = true
-  updateSupport.value = 0
-  fileList.value = []
-  resetForm()
-}
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
-const {  httpRequest } = useUpload()
+<!--import {ref} from "vue";-->
+<!--const importUrl =-->
+<!--  import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/museums/specimen-info/import-specimen-images'-->
+<!--defineOptions({ name: 'imageImportForm' })-->
+<!--const dialogVisible = ref(false) // 弹窗的是否展示-->
+<!--const formLoading = ref(false) // 表单的加载中-->
+<!--const uploadRef = ref()-->
+<!--const message = useMessage() // 消息弹窗-->
+<!--const updateSupport = ref(0) // 是否更新已经存在的用户数据-->
+<!--const fileList = ref([]) // 文件列表-->
+<!--const loading = ref(true) // 列表的加载中-->
+<!--// const uploadHeaders = ref() // 上传 Header 头-->
+<!--/** 打开弹窗 */-->
+<!--const open = () => {-->
+<!--  dialogVisible.value = true-->
+<!--  updateSupport.value = 0-->
+<!--  fileList.value = []-->
+<!--  resetForm()-->
+<!--}-->
+<!--defineExpose({ open }) // 提供 open 方法,用于打开弹窗-->
+<!--const {  httpRequest } = useUpload()-->
 
-console.log(httpRequest , importUrl)
-/** 提交表单 */
-const submitForm = async () => {
-  if (fileList.value.length == 0) {
-    message.error('请上传文件')
-    return
-  }
+<!--console.log(httpRequest , importUrl)-->
+<!--/** 提交表单 */-->
+<!--const submitForm = async () => {-->
+<!--  if (fileList.value.length == 0) {-->
+<!--    message.error('请上传文件')-->
+<!--    return-->
+<!--  }-->
 
-  formLoading.value = true
-  uploadRef.value!.submit()
-}
+<!--  formLoading.value = true-->
+<!--  uploadRef.value!.submit()-->
+<!--}-->
 
-/** 上传错误提示 */
-const submitFormError = (): void => {
-  message.error('上传失败,请您重新上传!')
-  formLoading.value = false
-}
-/** 图片上传成功 */
+<!--// /** 上传错误提示 */-->
+<!--// const submitFormError = (): void => {-->
+<!--//   message.error('上传失败,请您重新上传!')-->
+<!--//   formLoading.value = false-->
+<!--// }-->
+<!--// /** 图片上传成功 */-->
+<!--//-->
+<!--// const submitFormSuccess = (response: any) => {-->
+<!--//   console.log('33434234',response)-->
+<!--//   if (response.data.code !== 0) {-->
+<!--//     message.error(response.msg)-->
+<!--//     formLoading.value = false-->
+<!--//-->
+<!--//     return-->
+<!--//   }-->
+<!--//   formLoading.value = false-->
+<!--//   dialogVisible.value = false-->
+<!--//   console.log(2313)-->
+<!--//   // 发送操作成功的事件-->
+<!--//-->
+<!--// }-->
 
-const submitFormSuccess = (response: any) => {
-  console.log('tj',response)
-  if (response.code !== 0) {
-    message.error(response.msg)
-    formLoading.value = false
-    return
-  }
-  formLoading.value = false
-  dialogVisible.value = false
-  // 发送操作成功的事件
+<!--/** 重置表单 */-->
+<!--const resetForm = async (): Promise<void> => {-->
+<!--  // 重置上传状态和文件-->
+<!--  formLoading.value = false-->
+<!--  await nextTick()-->
+<!--  uploadRef.value?.clearFiles()-->
+<!--}-->
 
-}
 
-/** 重置表单 */
-const resetForm = async (): Promise<void> => {
-  // 重置上传状态和文件
-  formLoading.value = false
-  await nextTick()
-  uploadRef.value?.clearFiles()
-}
-
-
-</script>
+<!--</script>-->

+ 1 - 1
src/views/museums/specimeninfo/index.vue

@@ -233,7 +233,7 @@
           class="!w-240px"
         >
           <el-option
-            v-for="dict in getIntDictOptions(DICT_TYPE.MUSEUMS_SPECIMEN_INFO)"
+            v-for="dict in getIntDictOptions(DICT_TYPE.MUSEUMS_COLLECTION_STATUS)"
             :key="dict.value"
             :label="dict.label"
             :value="dict.value"

+ 3 - 1
src/views/museums/specimenoutbound/OutboundApplication.vue

@@ -275,7 +275,9 @@ const queryParams = reactive({
   returnDate: [],
   specimenCondition: undefined,
   createTime: [],
-  sampleStatus: undefined
+  sampleStatus: undefined,
+  type:undefined,
+  url:undefined
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中

+ 6 - 2
src/views/museums/specimenoutbound/OutboundForm/specimenReturnForm.vue

@@ -77,7 +77,9 @@ const formData = ref({
   returnDate: undefined,
   outgoingTime: undefined,
   specimenCondition: undefined,
-  sampleStatus: undefined
+  sampleStatus: undefined,
+  type:undefined
+
 })
 
 const formRules = reactive({
@@ -126,7 +128,9 @@ const resetForm = () => {
     receiver: undefined,
     returnDate: undefined,
     specimenCondition: undefined,
-    sampleStatus: undefined
+    sampleStatus: undefined,
+    type:undefined
+
   }
   formRef.value?.resetFields()
 }

+ 22 - 11
src/views/museums/specimenoutbound/approval.vue

@@ -8,13 +8,14 @@
       v-loading="formLoading"
       ref="formRef"
      >
+      <div  v-if="formData.status === 0">
       <el-form-item>
         <el-radio-group  v-model="approvalStatus">
           <el-radio :label="1" :value="1">通过</el-radio>
           <el-radio :label="2" :value="2">驳回</el-radio>
         </el-radio-group>
       </el-form-item>
-<div  v-if="formData.status === 0">
+
         <el-form-item  v-if="approvalStatus === 1">
           <el-input
             v-model="formData.processInstanceId"
@@ -33,11 +34,17 @@
       </el-form-item>
 </div>
       <div  v-if="formData.status === 1">
+        <el-form-item>
+        <el-radio-group  v-model="approvalStatus">
+          <el-radio :label="3" :value="3">通过</el-radio>
+          <el-radio :label="4" :value="4">驳回</el-radio>
+        </el-radio-group>
+        </el-form-item>
         <el-form-item  v-if="approvalStatus === 3">
           <el-input
             v-model="formData.rejectionReasons"
             style="width:800px; height: 200px"
-            placeholder="请输入审批建议22"
+            placeholder="请输入审批建议"
             type="textarea"
           />
         </el-form-item>
@@ -76,7 +83,7 @@ const message = useMessage() // 消息弹窗
 
 const formData = ref({
   id: undefined,
-  status : 0,
+  status : undefined,
   processInstanceId: undefined, // 审批建议
   rejectionReasons: undefined, // 驳回原因
   approveUsers: undefined, // 一审批员
@@ -112,22 +119,26 @@ defineExpose({ open })// 提供 open 方法,用于打开弹窗
 const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
 
 const submitApproval = async () => {
-  if ((approvalStatus.value === 2 && (formData.value.processInstanceId == '' || formData.value.processInstanceId == undefined  )) || (approvalStatus.value == 4 && (formData.value.rejectionReasons == '' || formData.value.rejectionReasons == undefined  ))) {
+  if ((approvalStatus.value === 2 && (formData.value.processInstanceId == '' || formData.value.processInstanceId == undefined  )) || (approvalStatus.value === 4 && (formData.value.rejectionReasons == '' || formData.value.rejectionReasons == undefined  ))) {
     message.error(t('请输入审批意见'));
     return;
   }
   try {
     formLoading.value = true;
     let statusCode;
-    console.log('tj', approvalStatus.value)
+    console.log('666')
     if (approvalStatus.value === 1) {
-      statusCode = formData.value.status === 1 ;
+      statusCode = 1;
+      console.log('111')
      } else  if (approvalStatus.value === 2){
-      statusCode = formData.value.status ===  2;
-     }   if (approvalStatus.value === 3) {
-      statusCode = formData.value.status ===  5 ;
+      statusCode = 2;
+      console.log('222')
+     } else if (approvalStatus.value === 3) {
+      statusCode = 5 ;
+      console.log('333')
     } else  if (approvalStatus.value === 4){
-      statusCode = formData.value.status ===  6;
+      statusCode = 6;
+      console.log('444')
     }
     const data = {
       ...formData.value,
@@ -156,7 +167,7 @@ const resetForm = () => {
   // uploadRef.value?.clearFiles()
   formData.value = {
     id: undefined,
-    status: 0,
+    status: undefined,
     processInstanceId: undefined,
     rejectionReasons: undefined,
     approveUsers: undefined,