|
@@ -1,11 +1,15 @@
|
|
|
<template>
|
|
|
- <Dialog :title="dialogTitle" v-model="dialogVisible" ref="formRef" >
|
|
|
+
|
|
|
+ <Dialog :title="dialogTitle" v-model="dialogVisible" v-loading="formLoading">
|
|
|
<el-form
|
|
|
ref="formRef"
|
|
|
:model="formData"
|
|
|
:rules="formRules"
|
|
|
label-width="100px"
|
|
|
- v-loading="formLoading">
|
|
|
+ >
|
|
|
+ <el-form-item label="标本ID" prop="infoId">
|
|
|
+ <el-input v-model="formData.infoId" placeholder="请输入标本ID"/>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="退还人" prop="returner">
|
|
|
<el-input v-model="formData.returner" placeholder="请输入退还人"/>
|
|
|
</el-form-item>
|
|
@@ -23,53 +27,56 @@
|
|
|
<el-form-item label="标本情况" prop="specimenCondition">
|
|
|
<el-input v-model="formData.specimenCondition" placeholder="请输入标本情况"/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="备注信息" prop="remarks">
|
|
|
+ <el-input v-model="formData.remarks" placeholder="备注信息"/>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
</template>
|
|
|
</Dialog>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import {onMounted} from 'vue';
|
|
|
import {SpecimenOutboundApi, SpecimenOutboundVO} from '@/api/museums/specimenoutbound'
|
|
|
-import {ref,reactive} from "vue"
|
|
|
+import {ref, reactive} from "vue"
|
|
|
+
|
|
|
/** 标本出库回库信息 表单 */
|
|
|
-defineOptions({ name: 'ReturnForm' })
|
|
|
+defineOptions({name: 'ReturnForm'})
|
|
|
const {t} = useI18n() // 国际化
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
+
|
|
|
const formData = ref({
|
|
|
-id: undefined,
|
|
|
-infoId: undefined,
|
|
|
-chineseName: undefined,
|
|
|
-specimenNumber: undefined,
|
|
|
-applicantName: undefined,
|
|
|
-applicationDate: undefined,
|
|
|
-applicationUsage: undefined,
|
|
|
-attachments: undefined,
|
|
|
-status: undefined,
|
|
|
-remarks: undefined,
|
|
|
-processInstanceId: undefined,
|
|
|
-operator: undefined,
|
|
|
-outgoingTime: undefined,
|
|
|
-returner: undefined,
|
|
|
-receiver: undefined,
|
|
|
-returnDate: undefined,
|
|
|
-specimenCondition: undefined,
|
|
|
-sampleStatus: undefined
|
|
|
+ infoId: undefined,
|
|
|
+ applicantName: undefined,
|
|
|
+ applicationDate: undefined,
|
|
|
+ applicationUsage: undefined,
|
|
|
+ attachments: undefined,
|
|
|
+ status: undefined,
|
|
|
+ remarks: undefined,
|
|
|
+ processInstanceId: undefined,
|
|
|
+ operator: undefined,
|
|
|
+ returner: undefined,
|
|
|
+ receiver: undefined,
|
|
|
+ returnDate: undefined,
|
|
|
+ specimenCondition: undefined,
|
|
|
+ sampleStatus: undefined
|
|
|
})
|
|
|
|
|
|
const formRules = reactive({
|
|
|
- operator: [{ required: true, message: '出库员不能为空', trigger: 'blur' }],
|
|
|
- returner: [{ required: true, message: '退还人不能为空', trigger: 'blur' }],
|
|
|
- receiver: [{ required: true, message: '点收人不能为空', trigger: 'blur' }],
|
|
|
- returnDate: [{ required: true, message: '退还日期不能为空', trigger: 'blur' }]
|
|
|
+ operator: [{required: true, message: '出库员不能为空', trigger: 'blur'}],
|
|
|
+ returner: [{required: true, message: '退还人不能为空', trigger: 'blur'}],
|
|
|
+ receiver: [{required: true, message: '点收人不能为空', trigger: 'blur'}],
|
|
|
+ returnDate: [{required: true, message: '退还日期不能为空', trigger: 'blur'}]
|
|
|
})
|
|
|
-const formRef = ref() // 表单 Ref
|
|
|
+
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
const open = async (type: string, id?: number) => {
|
|
@@ -86,55 +93,64 @@ const open = async (type: string, id?: number) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
+defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
/** 重置表单 */
|
|
|
+// const resetForm = () => {
|
|
|
+// formData.value = {
|
|
|
+// id: undefined,
|
|
|
+// infoId: undefined,
|
|
|
+// chineseName: undefined,
|
|
|
+// specimenNumber: undefined,
|
|
|
+// applicantName: undefined,
|
|
|
+// applicationDate: undefined,
|
|
|
+// applicationUsage: undefined,
|
|
|
+// attachments: undefined,
|
|
|
+// status: undefined,
|
|
|
+// remarks: undefined,
|
|
|
+// processInstanceId: undefined,
|
|
|
+// operator: undefined,
|
|
|
+// outgoingTime: undefined,
|
|
|
+// returner: undefined,
|
|
|
+// receiver: undefined,
|
|
|
+// returnDate: undefined,
|
|
|
+// specimenCondition: undefined,
|
|
|
+// sampleStatus: undefined
|
|
|
+// }
|
|
|
+// formRef.value?.resetFields()
|
|
|
+// }
|
|
|
+const formRef = ref() // 表单 Ref
|
|
|
const resetForm = () => {
|
|
|
- formData.value = {
|
|
|
- id: undefined,
|
|
|
- infoId: undefined,
|
|
|
- chineseName: undefined,
|
|
|
- specimenNumber: undefined,
|
|
|
- applicantName: undefined,
|
|
|
- applicationDate: undefined,
|
|
|
- applicationUsage: undefined,
|
|
|
- attachments: undefined,
|
|
|
- status: undefined,
|
|
|
- remarks: undefined,
|
|
|
- processInstanceId: undefined,
|
|
|
- operator: undefined,
|
|
|
- outgoingTime: undefined,
|
|
|
- returner: undefined,
|
|
|
- receiver: undefined,
|
|
|
- returnDate: undefined,
|
|
|
- specimenCondition: undefined,
|
|
|
- sampleStatus: undefined
|
|
|
- }
|
|
|
- formRef.value?.resetFields()
|
|
|
-}
|
|
|
+ if (formRef.value) {
|
|
|
|
|
|
+ formRef.value.resetFields();
|
|
|
+ }
|
|
|
+};
|
|
|
/** 提交回库表单 */
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
const submitForm = async () => {
|
|
|
-
|
|
|
// 提交请求
|
|
|
formLoading.value = true
|
|
|
try {
|
|
|
const data = formData.value as unknown as SpecimenOutboundVO
|
|
|
- if (formType.value === 'create') {
|
|
|
- await SpecimenOutboundApi.updateSpecimenOutbound(data)
|
|
|
- message.success(t('common.createSuccess'))
|
|
|
- } else {
|
|
|
- await SpecimenOutboundApi.updateSpecimenOutbound(data)
|
|
|
- message.success(t('common.updateSuccess'))
|
|
|
- }
|
|
|
+ console.log(formType.value)
|
|
|
+
|
|
|
+ await SpecimenOutboundApi.updateSpecimenOutbound(data)
|
|
|
+ message.success(t('回库成功'))
|
|
|
+
|
|
|
dialogVisible.value = false
|
|
|
// 发送操作成功的事件
|
|
|
emit('success')
|
|
|
+ } catch (error) {
|
|
|
+ // 错误处理
|
|
|
+ console.error('提交表单失败:', error);
|
|
|
+ message.error(t('回库失败'));
|
|
|
} finally {
|
|
|
formLoading.value = false
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+onMounted(() => {
|
|
|
+ resetForm();
|
|
|
+})
|
|
|
</script>
|