|
@@ -46,7 +46,7 @@ import { ref, defineEmits, nextTick } from 'vue'
|
|
|
|
|
|
import {SpecimenOutboundApi} from "@/api/museums/specimenoutbound";
|
|
import {SpecimenOutboundApi} from "@/api/museums/specimenoutbound";
|
|
const {t} = useI18n() // 国际化
|
|
const {t} = useI18n() // 国际化
|
|
-const approvalStatus = ref(0);
|
|
|
|
|
|
+const approvalStatus = ref(1);
|
|
// const uploadRef = ref()
|
|
// const uploadRef = ref()
|
|
const formLoading = ref(false) // 表单的加载中
|
|
const formLoading = ref(false) // 表单的加载中
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
@@ -71,14 +71,15 @@ const open = async (id?: number) => {
|
|
approvalStatus.value = 1
|
|
approvalStatus.value = 1
|
|
chkRemarks.value = '';
|
|
chkRemarks.value = '';
|
|
formData.value.id = id;
|
|
formData.value.id = id;
|
|
- // resetForm()
|
|
|
|
- console.log(id)
|
|
|
|
|
|
+ await resetForm()
|
|
|
|
+
|
|
if (id) {
|
|
if (id) {
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
console.log('hhh', formData.value)
|
|
console.log('hhh', formData.value)
|
|
- formData.value.id = id
|
|
|
|
|
|
+ // formData.value.id = id
|
|
formData.value = await SpecimenOutboundApi.getSpecimenOutbound(id)
|
|
formData.value = await SpecimenOutboundApi.getSpecimenOutbound(id)
|
|
|
|
+
|
|
} finally {
|
|
} finally {
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
}
|
|
}
|
|
@@ -88,29 +89,7 @@ defineExpose({ open })// 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
/** 提交审批 */
|
|
/** 提交审批 */
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
-// const submitApproval = async () => {
|
|
|
|
-// // 检查是否有驳回原因
|
|
|
|
-// if (approvalStatus.value === 2 && !formData.value.rejectionReasons.trim()) {
|
|
|
|
-// message.error(t('请输入驳回原因'))
|
|
|
|
-// return// 阻止表单提交
|
|
|
|
-// }
|
|
|
|
-// try {
|
|
|
|
-// formLoading.value = true;
|
|
|
|
-// const data = {
|
|
|
|
-// ...formData.value,
|
|
|
|
-// status: approvalStatus.value, // 确保传入审批状态
|
|
|
|
-// processInstanceId: approvalStatus.value === 2 ? formData.value.rejectionReasons : formData.value.processInstanceId // 如果是驳回,则传入驳回原因
|
|
|
|
-// };
|
|
|
|
-// console.log(data,"wozaizheli")
|
|
|
|
-// await SpecimenOutboundApi.ApprovalSpecimenOutbound(data)
|
|
|
|
-// message.success(t('审批成功'));
|
|
|
|
-// dialogVisible.value = false
|
|
|
|
-// // 发送操作成功的事件
|
|
|
|
-// emit('success')
|
|
|
|
-// } finally {
|
|
|
|
-// formLoading.value = false
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
const submitApproval = async () => {
|
|
const submitApproval = async () => {
|
|
if (approvalStatus.value === 2 && !formData.value.rejectionReasons.trim()) {
|
|
if (approvalStatus.value === 2 && !formData.value.rejectionReasons.trim()) {
|
|
message.error(t('请输入驳回原因'));
|
|
message.error(t('请输入驳回原因'));
|
|
@@ -120,21 +99,21 @@ const submitApproval = async () => {
|
|
formLoading.value = true;
|
|
formLoading.value = true;
|
|
let statusCode;
|
|
let statusCode;
|
|
let processInstanceId;
|
|
let processInstanceId;
|
|
|
|
+ let rejectionReasons;
|
|
console.log('tj', approvalStatus.value)
|
|
console.log('tj', approvalStatus.value)
|
|
- if (approvalStatus.value === 0) {
|
|
|
|
- statusCode = formData.value.status === 1 ? 1 : 2 ;
|
|
|
|
- processInstanceId = formData.value.status === 1 ?
|
|
|
|
- formData.value.processInstanceId : formData.value.rejectionReasons;
|
|
|
|
- } else if (approvalStatus.value === 1){
|
|
|
|
- statusCode = formData.value.status === 1 ? 5 : 1;
|
|
|
|
- processInstanceId = formData.value.status === 2 ?
|
|
|
|
- formData.value.rejectionReasons : formData.value.processInstanceId;
|
|
|
|
|
|
+ if (approvalStatus.value === 1) {
|
|
|
|
+ statusCode = formData.value.status === 0 ? 1 : 5 ;
|
|
|
|
+ processInstanceId = formData.value.processInstanceId
|
|
|
|
+ } else if (approvalStatus.value === 2){
|
|
|
|
+ statusCode = formData.value.status === 0 ? 2 : 6;
|
|
|
|
+ rejectionReasons = formData.value.rejectionReasons
|
|
}
|
|
}
|
|
const data = {
|
|
const data = {
|
|
...formData.value,
|
|
...formData.value,
|
|
status: statusCode,
|
|
status: statusCode,
|
|
processInstanceId: processInstanceId,
|
|
processInstanceId: processInstanceId,
|
|
- };
|
|
|
|
|
|
+ rejectionReasons: rejectionReasons,
|
|
|
|
+ };
|
|
await SpecimenOutboundApi.ApprovalSpecimenOutbound(data);
|
|
await SpecimenOutboundApi.ApprovalSpecimenOutbound(data);
|
|
message.success(t('审批成功'));
|
|
message.success(t('审批成功'));
|
|
dialogVisible.value = false;
|
|
dialogVisible.value = false;
|
|
@@ -149,5 +128,15 @@ const resetForm = async (): Promise<void> => {
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
await nextTick()
|
|
await nextTick()
|
|
// uploadRef.value?.clearFiles()
|
|
// uploadRef.value?.clearFiles()
|
|
|
|
+ formData.value = {
|
|
|
|
+ id: undefined,
|
|
|
|
+ status: 0,
|
|
|
|
+ processInstanceId: undefined,
|
|
|
|
+ rejectionReasons: undefined,
|
|
|
|
+ approveUsers: undefined,
|
|
|
|
+ twoApproveUsers: undefined,
|
|
|
|
+ approvalTime: null,
|
|
|
|
+ twoApprovalTime: null,
|
|
|
|
+ };
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|