|
@@ -0,0 +1,99 @@
|
|
|
+<template>
|
|
|
+ <Dialog
|
|
|
+ v-model="dialogVisible"
|
|
|
+ title="是否审批通过"
|
|
|
+ width="800"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+
|
|
|
+ :action="approvalUrl + '?updateSupport=' + updateSupport">
|
|
|
+ <el-form-item>
|
|
|
+ <el-radio-group v-model="approvalStatus">
|
|
|
+ <el-radio :label="1">通过</el-radio>
|
|
|
+ <el-radio :label="2">驳回</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="approvalStatus === 2">
|
|
|
+ <el-input
|
|
|
+ v-model="chkRemarks"
|
|
|
+ style="width:800px ;height: 200px"
|
|
|
+ placeholder="请输入驳回原因"
|
|
|
+
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <el-button :disabled="formLoading" type="primary" @click="submitApproval">确定</el-button>
|
|
|
+ <el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </Dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { getAccessToken, getTenantId } from '@/utils/auth'
|
|
|
+import { ref } from 'vue'
|
|
|
+const approvalUrl =
|
|
|
+ import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/museums/specimen-outbound/reject'
|
|
|
+
|
|
|
+const {t} = useI18n() // 国际化
|
|
|
+const approvalStatus = ref(0);
|
|
|
+const uploadRef = ref()
|
|
|
+const formLoading = ref(false) // 表单的加载中
|
|
|
+const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
+const dialogTitle = ref('') // 弹窗的标题
|
|
|
+const chkRemarks = ref('')
|
|
|
+const message = useMessage() // 消息弹窗
|
|
|
+const processInstanceId = ref([]) // 文件列表
|
|
|
+const uploadHeaders = ref() // 上传 Header 头
|
|
|
+const updateSupport = ref(0) // 是否更新已经存在的用户数据
|
|
|
+/** 打开弹窗 */
|
|
|
+const open = async (type: string, ) => {
|
|
|
+ dialogVisible.value = true
|
|
|
+ formLoading.value = true
|
|
|
+ approvalStatus.value = 0
|
|
|
+ dialogVisible.value = true
|
|
|
+ updateSupport.value = 0
|
|
|
+ dialogTitle.value = t('action.' + type)
|
|
|
+ processInstanceId.value = []
|
|
|
+ resetForm()
|
|
|
+}
|
|
|
+defineExpose({ open })// 提供 open 方法,用于打开弹窗
|
|
|
+
|
|
|
+
|
|
|
+/** 提交审批 */
|
|
|
+const submitApproval = async () => {
|
|
|
+ if (approvalStatus.value === 2 && !chkRemarks.value.trim()) {
|
|
|
+ message.error('请输入驳回原因')
|
|
|
+ formLoading.value = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 提交请求
|
|
|
+ uploadHeaders.value = {
|
|
|
+ Authorization: 'Bearer ' + getAccessToken(),
|
|
|
+ 'tenant-id': getTenantId()
|
|
|
+ }
|
|
|
+ formLoading.value = true
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 这里应该添加实际的请求发送代码,例如使用 axios 或其他 HTTP 库
|
|
|
+ // await axios.post(approvalUrl, { approvalStatus, chkRemarks, updateSupport }, { headers })
|
|
|
+ console.log('提交审批请求...')
|
|
|
+ dialogVisible.value = false;
|
|
|
+ } catch (error) {
|
|
|
+ message.error('审批提交失败')
|
|
|
+ } finally {
|
|
|
+ formLoading.value = false
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+/** 重置表单 */
|
|
|
+const resetForm = async (): Promise<void> => {
|
|
|
+ // 重置上传状态和文件
|
|
|
+ formLoading.value = false
|
|
|
+ await nextTick()
|
|
|
+ uploadRef.value?.clearFiles()
|
|
|
+}
|
|
|
+</script>
|