|
|
@@ -351,7 +351,7 @@
|
|
|
|
|
|
<!-- 图片操作按钮 -->
|
|
|
<view class="image-actions" @click.stop>
|
|
|
- <!-- <u-button
|
|
|
+ <u-button
|
|
|
v-if="image.status === 'success'"
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
@@ -362,7 +362,7 @@
|
|
|
"
|
|
|
>
|
|
|
下载
|
|
|
- </u-button> -->
|
|
|
+ </u-button>
|
|
|
<u-button
|
|
|
v-if="image.status === 'error'"
|
|
|
size="mini"
|
|
|
@@ -465,7 +465,7 @@
|
|
|
|
|
|
<!-- 文件操作按钮 -->
|
|
|
<view class="image-actions" @click.stop>
|
|
|
- <!-- <u-button
|
|
|
+ <u-button
|
|
|
v-if="file.status === 'success'"
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
@@ -474,7 +474,7 @@
|
|
|
@click.stop.prevent="handleDownloadFileClick(file, $event)"
|
|
|
>
|
|
|
下载
|
|
|
- </u-button> -->
|
|
|
+ </u-button>
|
|
|
<u-button
|
|
|
v-if="file.status === 'error'"
|
|
|
size="mini"
|
|
|
@@ -566,7 +566,14 @@
|
|
|
<approval-record ref="approvalRecordRef" />
|
|
|
|
|
|
<!-- 流程选择弹窗 -->
|
|
|
- <u-popup v-model="showFlowSelectionPopup" mode="center" width="95%" border-radius="12">
|
|
|
+ <u-popup
|
|
|
+ :show="showFlowSelectionPopup"
|
|
|
+ @close="handleFlowSelectionClose"
|
|
|
+ mode="center"
|
|
|
+ width="80%"
|
|
|
+ border-radius="12"
|
|
|
+ :custom-style="{ width: '80vw' }"
|
|
|
+ >
|
|
|
<view class="flow-selection-popup">
|
|
|
<view class="popup-header">
|
|
|
<text class="popup-title">选择工作流程</text>
|
|
|
@@ -589,7 +596,7 @@
|
|
|
>
|
|
|
<view class="option-content">
|
|
|
<text class="option-label">{{ item.label }}</text>
|
|
|
- <text class="option-code">代码: {{ item.value }}</text>
|
|
|
+ <!-- <text class="option-code">代码: {{ item.value }}</text> -->
|
|
|
</view>
|
|
|
<u-icon
|
|
|
v-if="selectedFlowCode === item.value"
|
|
|
@@ -622,6 +629,7 @@ import ApprovalButton from '@/components/Process/approvalButton.vue';
|
|
|
import SubmitVerify from '@/components/Process/submitVerify.vue';
|
|
|
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
|
|
|
import weChatSDK from '@/utils/wechat.js';
|
|
|
+import { downloadFile } from '@/common/request.js';
|
|
|
|
|
|
export default {
|
|
|
name: 'LeaveEdit',
|
|
|
@@ -641,8 +649,8 @@ export default {
|
|
|
selectedFlowCode: '', // 新增:选中的流程代码
|
|
|
flowCodeOptions: [
|
|
|
// 新增:流程选项列表
|
|
|
- { label: '请假流程', value: 'hzdyjs-qj' },
|
|
|
- { label: '销假流程', value: 'hzdyjs-xj' },
|
|
|
+ { label: '学生请假流程', value: 'hzdyjs-qj' },
|
|
|
+ // { label: '销假流程', value: 'hzdyjs-xj' },
|
|
|
],
|
|
|
|
|
|
// 微信SDK相关
|
|
|
@@ -2331,73 +2339,80 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.addWechatLog('📤 开始准备下载图片...', 'info');
|
|
|
- uni.showLoading({
|
|
|
- title: '准备下载...',
|
|
|
- mask: true,
|
|
|
- });
|
|
|
+ // uni.showLoading({
|
|
|
+ // title: '准备下载...',
|
|
|
+ // mask: true,
|
|
|
+ // });
|
|
|
|
|
|
try {
|
|
|
// 如果有ossId,通过API下载
|
|
|
if (image.ossId) {
|
|
|
- const downloadUrl = `/api/resource/oss/download/${image.ossId}`;
|
|
|
+ const downloadUrl = `/resource/oss/download/${image.ossId}`;
|
|
|
this.addWechatLog(`📥 使用API下载图片,URL: ${downloadUrl}`, 'info');
|
|
|
-
|
|
|
- // 在H5环境中,直接打开下载链接
|
|
|
- // #ifdef H5
|
|
|
- const link = document.createElement('a');
|
|
|
- link.href = downloadUrl;
|
|
|
- link.download = image.name || 'image.jpg';
|
|
|
- document.body.appendChild(link);
|
|
|
- link.click();
|
|
|
- document.body.removeChild(link);
|
|
|
-
|
|
|
- this.addWechatLog('✅ H5环境图片下载已开始', 'success');
|
|
|
- uni.hideLoading();
|
|
|
- uni.showToast({
|
|
|
- title: '下载已开始',
|
|
|
- icon: 'success',
|
|
|
- });
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifndef H5
|
|
|
- // 在小程序或App中,使用downloadFile
|
|
|
- uni.downloadFile({
|
|
|
- url: downloadUrl,
|
|
|
- success: (res) => {
|
|
|
- if (res.statusCode === 200) {
|
|
|
- uni.saveImageToPhotosAlbum({
|
|
|
- filePath: res.tempFilePath,
|
|
|
- success: () => {
|
|
|
- uni.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'success',
|
|
|
- });
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- uni.showToast({
|
|
|
- title: '保存失败',
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- this.addWechatLog(
|
|
|
- '❌ 图片下载失败',
|
|
|
- 'error',
|
|
|
- error.message || error.toString(),
|
|
|
- );
|
|
|
- uni.showToast({
|
|
|
- title: '下载失败',
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- uni.hideLoading();
|
|
|
- },
|
|
|
- });
|
|
|
- // #endif
|
|
|
+ // const downloadUrl = `/resource/oss/download/${file.ossId}`;
|
|
|
+ const response = await downloadFile(downloadUrl);
|
|
|
+
|
|
|
+ // // 在H5环境中,使用blob数据创建下载链接
|
|
|
+ // // #ifdef H5
|
|
|
+ // const blob = new Blob([response], { type: 'application/octet-stream' });
|
|
|
+ // const blobUrl = URL.createObjectURL(blob);
|
|
|
+ // const link = document.createElement('a');
|
|
|
+ // link.href = blobUrl;
|
|
|
+ // link.download = image.name || 'image.jpg';
|
|
|
+ // document.body.appendChild(link);
|
|
|
+ // link.click();
|
|
|
+ // document.body.removeChild(link);
|
|
|
+
|
|
|
+ // // 释放blob URL
|
|
|
+ // URL.revokeObjectURL(blobUrl);
|
|
|
+
|
|
|
+ // this.addWechatLog('✅ H5环境图片下载已开始', 'success');
|
|
|
+ // uni.hideLoading();
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '下载已开始',
|
|
|
+ // icon: 'success',
|
|
|
+ // });
|
|
|
+ // // #endif
|
|
|
+
|
|
|
+ // // #ifndef H5
|
|
|
+ // // 在小程序或App中,使用downloadFile
|
|
|
+ // uni.downloadFile({
|
|
|
+ // url: downloadUrl,
|
|
|
+ // success: (res) => {
|
|
|
+ // if (res.statusCode === 200) {
|
|
|
+ // uni.saveImageToPhotosAlbum({
|
|
|
+ // filePath: res.tempFilePath,
|
|
|
+ // success: () => {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '保存成功',
|
|
|
+ // icon: 'success',
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // fail: () => {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '保存失败',
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: (error) => {
|
|
|
+ // this.addWechatLog(
|
|
|
+ // '❌ 图片下载失败',
|
|
|
+ // 'error',
|
|
|
+ // error.message || error.toString(),
|
|
|
+ // );
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '下载失败',
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // complete: () => {
|
|
|
+ // uni.hideLoading();
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // // #endif
|
|
|
} else {
|
|
|
// 没有ossId的情况,直接使用图片URL
|
|
|
const imageUrl = image.blobUrl || image.url;
|
|
|
@@ -3846,7 +3861,7 @@ export default {
|
|
|
// 保存数据
|
|
|
const saveData = { ...this.form };
|
|
|
saveData.status = status;
|
|
|
- saveData.approvalStatus = status;
|
|
|
+ saveData.approvalStatus = 'draft';
|
|
|
|
|
|
let response;
|
|
|
if (saveData.id) {
|
|
|
@@ -3870,19 +3885,55 @@ export default {
|
|
|
uni.showToast({
|
|
|
title: '暂存成功',
|
|
|
icon: 'success',
|
|
|
+ duration: 1500,
|
|
|
});
|
|
|
- uni.navigateBack();
|
|
|
+ // 延迟跳转,确保 Toast 能够显示,并通知上一页刷新
|
|
|
+ setTimeout(() => {
|
|
|
+ // 发送事件通知上一页刷新数据
|
|
|
+ uni.$emit('refreshLeaveList');
|
|
|
+ uni.navigateBack();
|
|
|
+ }, 1600);
|
|
|
} else {
|
|
|
+ console.log('response', response);
|
|
|
+ console.log('response.data', response.data);
|
|
|
// 设置保存后的ID
|
|
|
if (!this.form.id && response.data.id) {
|
|
|
this.form.id = response.data.id;
|
|
|
}
|
|
|
+ // 通过ID获取请假信息
|
|
|
+ try {
|
|
|
+ response = await request({
|
|
|
+ url: `/studentLeave/studentLeave/${this.form.id}`,
|
|
|
+ method: 'GET',
|
|
|
+ });
|
|
|
+
|
|
|
+ if (response.code === 200 && response.data) {
|
|
|
+ console.log('response', response);
|
|
|
+ console.log('response.data', response.data);
|
|
|
+ // 将response.data赋值给form
|
|
|
+ // this.form = response.data;
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: response.msg || '获取请假详情失败',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取请假详情失败:', error);
|
|
|
+ uni.showToast({
|
|
|
+ title: '获取请假详情失败',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 检查是否需要显示流程选择弹窗
|
|
|
+ console.log(
|
|
|
+ 'this.needShowFlowSelection(response.data) =',
|
|
|
+ this.needShowFlowSelection(response.data),
|
|
|
+ );
|
|
|
+ // 直接使用第一个流程代码,无需显示选择弹窗
|
|
|
if (this.needShowFlowSelection(response.data)) {
|
|
|
this.selectedFlowCode = this.flowCodeOptions[0].value; // 默认选择第一个
|
|
|
- this.showFlowSelectionPopup = true;
|
|
|
- return; // 等待用户选择流程
|
|
|
+ console.log('selectedFlowCode', this.selectedFlowCode);
|
|
|
}
|
|
|
|
|
|
// 启动工作流
|
|
|
@@ -3983,14 +4034,20 @@ export default {
|
|
|
|
|
|
this.taskVariables = {
|
|
|
qjts: data.leaveDuration,
|
|
|
- qjlx: data.leaveTypeName,
|
|
|
- sfxs: data.isLeaveSchool === '1',
|
|
|
- sfxy: data.needCancel === '1',
|
|
|
+ // qjlx: data.leaveTypeName,
|
|
|
+ // sfxs: data.isLeaveSchool === '1',
|
|
|
+ // sfxy: data.needCancel === '1',
|
|
|
bzrspr: classTeacherId,
|
|
|
ejxyspr: collegeApprovers,
|
|
|
};
|
|
|
|
|
|
// 启动工作流
|
|
|
+ console.log('startWorkflow - 请求参数:', {
|
|
|
+ flowCode: this.selectedFlowCode,
|
|
|
+ businessId: data.id,
|
|
|
+ variables: this.taskVariables,
|
|
|
+ });
|
|
|
+
|
|
|
const workflowResponse = await request({
|
|
|
url: '/workflow/task/startWorkFlow',
|
|
|
method: 'POST',
|
|
|
@@ -4001,15 +4058,50 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ console.log('startWorkflow - 响应结果:', workflowResponse);
|
|
|
+
|
|
|
if (workflowResponse.code === 200) {
|
|
|
this.$refs.submitVerifyRef.openDialog(workflowResponse.data.taskId);
|
|
|
+ // 启动工作流成功提示
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '工作流启动成功',
|
|
|
+ // icon: 'success',
|
|
|
+ // duration: 1500,
|
|
|
+ // });
|
|
|
+ // 延迟返回上一页,确保用户看到成功提示
|
|
|
+ // setTimeout(() => {
|
|
|
+ // // 通知上一页刷新数据
|
|
|
+ // uni.$emit('refreshLeaveList');
|
|
|
+ // uni.navigateBack();
|
|
|
+ // }, 1600);
|
|
|
+ } else {
|
|
|
+ // 启动工作流失败
|
|
|
+ // uni.showToast({
|
|
|
+ // title: workflowResponse.msg || '启动工作流失败',
|
|
|
+ // icon: 'none',
|
|
|
+ // duration: 2000,
|
|
|
+ // });
|
|
|
+ // 延迟返回上一页,确保用户看到失败提示
|
|
|
+ // setTimeout(() => {
|
|
|
+ // // 通知上一页刷新数据
|
|
|
+ // uni.$emit('refreshLeaveList');
|
|
|
+ // uni.navigateBack();
|
|
|
+ // }, 2100);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('启动工作流失败:', error);
|
|
|
uni.showToast({
|
|
|
title: '启动工作流失败',
|
|
|
icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
});
|
|
|
+
|
|
|
+ // 延迟返回上一页,确保用户看到错误提示
|
|
|
+ // setTimeout(() => {
|
|
|
+ // // 通知上一页刷新数据
|
|
|
+ // uni.$emit('refreshLeaveList');
|
|
|
+ // uni.navigateBack();
|
|
|
+ // }, 2100);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -4076,12 +4168,25 @@ export default {
|
|
|
|
|
|
// 提交回调
|
|
|
handleSubmitCallback() {
|
|
|
- // 刷新页面数据
|
|
|
- if (this.routeParams.id) {
|
|
|
- this.getLeaveDetail(this.routeParams.id);
|
|
|
- } else {
|
|
|
- uni.navigateBack();
|
|
|
- }
|
|
|
+ // 审批提交成功提示
|
|
|
+ uni.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ });
|
|
|
+
|
|
|
+ // 延迟执行后续操作,确保用户看到成功提示
|
|
|
+ setTimeout(() => {
|
|
|
+ // 发送事件通知上一页刷新数据
|
|
|
+ uni.$emit('refreshLeaveList');
|
|
|
+
|
|
|
+ // 如果是编辑模式,刷新当前页面数据;否则返回上一页
|
|
|
+ if (this.routeParams.id) {
|
|
|
+ this.getLeaveDetail(this.routeParams.id);
|
|
|
+ } else {
|
|
|
+ uni.navigateBack();
|
|
|
+ }
|
|
|
+ }, 1600);
|
|
|
},
|
|
|
|
|
|
// // 文件选择前事件 - 应该在用户点击选择图片后首先触发
|
|
|
@@ -4225,7 +4330,7 @@ export default {
|
|
|
padding: 40rpx 30rpx;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- align-items: center;
|
|
|
+ /* align-items: center; */
|
|
|
}
|
|
|
|
|
|
.popup-header {
|