一单n制等功能,接入随手拍之前我先提交一版本

This commit is contained in:
王利强
2026-08-12 14:43:53 +08:00
parent ec76d588e2
commit 47deeedb22
664 changed files with 1429 additions and 2894 deletions

View File

@@ -64,23 +64,44 @@
</view>
<up-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple imageMode="aspectFill" :maxCount="10"></up-upload>
<view v-if="formData.result === 1" class="flex margin-bottom margin-top">
<view class="text-gray">是否快速审批</view>
<view class="text-red">*</view>
</view>
<view v-if="formData.result === 1" class="flex" style="gap: 20rpx;">
<button :class="['result-btn', formData.quickApproveRadio === 'yes' ? 'active' : '']" @click="onQuickApproveChange('yes')"></button>
<button :class="['result-btn', formData.quickApproveRadio === 'no' ? 'active' : '']" @click="onQuickApproveChange('no')"></button>
</view>
<template v-if="formData.result === 1">
<view class="flex margin-bottom margin-top">
<view class="text-gray">是否结束隐患验收</view>
<view class="text-red">*</view>
</view>
<up-radio-group :key="'hazard-end-' + hazardEndRadio" v-model="hazardEndRadio" placement="row" activeColor="#2667e9" @change="onHazardEndChange">
<up-radio
label="否"
name="no"
:customStyle="{ marginRight: '48rpx' }"
></up-radio>
<up-radio label="是" name="yes"></up-radio>
</up-radio-group>
</template>
<template v-if="formData.result === 1 && hazardEndRadio !== 'yes'">
<view class="flex margin-bottom margin-top">
<view class="text-gray">是否快速审批</view>
<view class="text-red">*</view>
</view>
<up-radio-group :key="'quick-approve-' + quickApproveRadio" v-model="quickApproveRadio" placement="row" activeColor="#2667e9" @change="onQuickApproveChange">
<up-radio
label="是"
name="yes"
:customStyle="{ marginRight: '48rpx' }"
></up-radio>
<up-radio label="否" name="no"></up-radio>
</up-radio-group>
</template>
<!-- 隐藏的 Canvas用于渲染防作弊时间戳水印 -->
<canvas canvas-id="watermarkCanvas" :width="canvasWidth" :height="canvasHeight" :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', position: 'fixed', left: '-9999px', top: '-9999px' }"></canvas>
<view class="flex margin-bottom margin-top">
<view v-if="!(formData.result === 1 && hazardEndRadio === 'yes')" class="flex margin-bottom margin-top">
<view class="text-gray">下一步流程</view>
<view class="text-red">*</view>
</view>
<view class="static-field">{{ nextStepDisplay }}</view>
<view v-if="!(formData.result === 1 && hazardEndRadio === 'yes')" class="static-field">{{ nextStepDisplay }}</view>
<template v-if="showAssigneeSection">
<view class="flex margin-bottom margin-top">
@@ -96,34 +117,14 @@
</view>
</template>
<u-popup :show="showAssigneePopup" mode="bottom" round="20" @close="cancelAssigneeSelect">
<view class="user-popup">
<view class="popup-header">
<view class="popup-title text-bold">选择下一步处理人</view>
<view class="popup-close" @click="cancelAssigneeSelect">×</view>
</view>
<scroll-view class="user-list-scroll" scroll-y>
<view v-if="assigneeLoading" class="empty-tip">加载中...</view>
<view v-else-if="assigneeList.length === 0" class="empty-tip">暂无人员数据</view>
<template v-else>
<view
v-for="user in assigneeList"
:key="getAssigneeItemKey(user)"
class="user-item"
:class="{ active: String(pickerAssigneeIdentityId) === String(resolveAssigneeIdentityId(user)) }"
@click="onAssigneeItemClick(user)"
>
<text class="user-item-text">{{ formatAssigneeDisplayName(user) }}</text>
<text v-if="String(pickerAssigneeIdentityId) === String(resolveAssigneeIdentityId(user))" class="cuIcon-check text-blue"></text>
</view>
</template>
</scroll-view>
<view class="popup-footer">
<button class="btn-cancel" @click="cancelAssigneeSelect">取消</button>
<button class="btn-confirm bg-blue" @click="confirmAssigneeSelect">确定</button>
</view>
</view>
</u-popup>
<FlowAssigneePickerPopup
:show="showAssigneePopup"
:task-id="taskId"
v-model:picker-identity-id="pickerAssigneeIdentityId"
v-model:picker-name="pickerAssigneeName"
@cancel="cancelAssigneeSelect"
@confirm="confirmAssigneeSelect"
/>
<!-- 短信提醒暂不使用
<view class="flex margin-bottom margin-top">
@@ -193,7 +194,8 @@
<script setup>
import { ref, reactive, computed, nextTick, getCurrentInstance } from 'vue';
import { onLoad, onHide } from '@dcloudio/uni-app';
import { acceptanceRectification, getHiddenDangerDetail, getRectifyDetail, getFlowNextNodes, getDeptUsers } from '@/request/api.js';
import { acceptanceRectification, getHiddenDangerDetail, getRectifyDetail, getFlowNextNodes } from '@/request/api.js';
import FlowAssigneePickerPopup from '@/components/flow/FlowAssigneePickerPopup.vue';
import { toImageUrl } from '@/request/request.js';
import { buildDraftKey, buildDraftKeyCompact, DRAFT_NS } from '@/utils/draftCache.js';
import { useDraftCache } from '@/utils/useDraftCache.js';
@@ -274,40 +276,22 @@
if (formData.result === 2) {
return { pass: false };
}
if (hazardEndRadio.value === 'yes') {
return { pass: true, hazardEnd: true };
}
return {
pass: true,
quickApprove: formData.quickApproveRadio === 'yes'
quickApprove: quickApproveRadio.value === 'yes'
};
};
const getStoredUserInfo = () => {
try {
const stored = uni.getStorageSync('userInfo');
if (!stored) return {};
return typeof stored === 'string' ? JSON.parse(stored) : stored;
} catch (error) {
return {};
}
};
const getCurrentDeptId = () => {
const userInfo = getStoredUserInfo();
const identity = userInfo.userIdentity;
if (identity?.deptId != null && identity.deptId !== '') {
return String(identity.deptId);
}
if (userInfo.deptId != null && userInfo.deptId !== '') {
return String(userInfo.deptId);
}
return '';
};
const rectifierDisplayName = computed(() => rectifyData.rectifierName?.trim() || '暂无');
// 通过且快速审批时无需选择下一步处理人
// 通过且快速审批时无需选择下一步处理人;结束验收时也不显示
const showAssigneeSection = computed(() => {
if (formData.result === 1 && hazardEndRadio.value === 'yes') return false;
if (formData.result === 2) return true;
if (formData.result === 1 && formData.quickApproveRadio === 'no') return true;
if (formData.result === 1 && quickApproveRadio.value === 'no') return true;
return false;
});
@@ -316,76 +300,20 @@
const pickerAssigneeIdentityId = ref('');
const pickerAssigneeName = ref('');
const showAssigneePopup = ref(false);
const assigneeList = ref([]);
const assigneeLoading = ref(false);
const resolveAssigneeIdentityId = (user) => {
if (!user) return '';
const id = user.identityId ?? user.userIdentityId ?? user.userId ?? '';
return id === '' || id == null ? '' : String(id);
};
const getAssigneeItemKey = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (identityId) return `identity-${identityId}`;
return `user-${user.userId || user.nickName || ''}`;
};
const formatAssigneeDisplayName = (user) => {
if (!user) return '';
const name = user.nickName || user.userName || user.name || '';
const identityName = user.identityName || '';
if (name && identityName) return `${name}${identityName}`;
return name || identityName || '未知人员';
};
const resolveAssigneeDeptUserType = () => (
formData.quickApproveRadio === 'yes' ? 2 : 3
);
const fetchAssigneeList = async () => {
const deptId = getCurrentDeptId();
if (!deptId) {
assigneeList.value = [];
const openAssigneePopup = () => {
if (!taskId.value) {
uni.showToast({ title: '缺少任务ID', icon: 'none' });
return;
}
assigneeLoading.value = true;
try {
const res = await getDeptUsers(deptId, { type: resolveAssigneeDeptUserType() });
if (res.code === 0) {
assigneeList.value = res.data || [];
} else {
assigneeList.value = [];
}
} catch (error) {
console.error('获取部门人员失败:', error);
assigneeList.value = [];
} finally {
assigneeLoading.value = false;
}
};
const openAssigneePopup = async () => {
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
pickerAssigneeName.value = selectedAssigneeName.value;
showAssigneePopup.value = true;
await fetchAssigneeList();
};
const onAssigneeItemClick = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (!identityId) return;
pickerAssigneeIdentityId.value = String(identityId);
pickerAssigneeName.value = formatAssigneeDisplayName(user);
};
const confirmAssigneeSelect = () => {
if (!pickerAssigneeIdentityId.value) {
uni.showToast({ title: '请选择下一步处理人', icon: 'none' });
return;
}
selectedAssigneeIdentityId.value = pickerAssigneeIdentityId.value;
selectedAssigneeName.value = pickerAssigneeName.value;
const confirmAssigneeSelect = ({ identityId, name }) => {
selectedAssigneeIdentityId.value = identityId;
selectedAssigneeName.value = name;
showAssigneePopup.value = false;
};
@@ -396,22 +324,36 @@
const onResultChange = (result) => {
formData.result = result;
if (result === 2) {
hazardEndRadio.value = 'no';
selectedAssigneeIdentityId.value = '';
selectedAssigneeName.value = '';
} else if (!formData.quickApproveRadio) {
formData.quickApproveRadio = 'yes';
} else if (!quickApproveRadio.value) {
quickApproveRadio.value = 'yes';
}
fetchNextStep();
};
const onQuickApproveChange = (value) => {
formData.quickApproveRadio = value;
const onHazardEndChange = (value) => {
if (value === 'yes') {
quickApproveRadio.value = 'yes';
selectedAssigneeIdentityId.value = '';
selectedAssigneeName.value = '';
} else {
fetchNextStep();
}
};
const onQuickApproveChange = () => {
selectedAssigneeIdentityId.value = '';
selectedAssigneeName.value = '';
fetchNextStep();
};
const fetchNextStep = async () => {
if (formData.result === 1 && hazardEndRadio.value === 'yes') {
nextStepName.value = '';
return;
}
nextStepLoading.value = true;
try {
const currentTaskId = taskId.value;
@@ -478,11 +420,19 @@
// 整改附件
const rectifyAttachments = ref([]);
// 是否结束隐患验收
const hazardEndRadio = ref('no');
const hazardEnd = computed(() => hazardEndRadio.value === 'yes');
const normalizeHazardEndRadio = (value) => (value === 'yes' ? 'yes' : 'no');
// 是否快速审批
const quickApproveRadio = ref('yes');
const normalizeQuickApproveRadio = (value) => (value === 'no' ? 'no' : 'yes');
// 表单数据
const formData = reactive({
result: 1, // 验收结果 1.通过 2.不通过
verifyRemark: '', // 验收备注
quickApproveRadio: 'yes' // 是否快速审批 yes/no仅通过时有效
verifyRemark: '' // 验收备注
});
const fileList1 = ref([]);
@@ -564,7 +514,8 @@
formData: {
result: formData.result,
verifyRemark: formData.verifyRemark,
quickApproveRadio: formData.quickApproveRadio
hazardEndRadio: hazardEndRadio.value,
quickApproveRadio: quickApproveRadio.value
},
selectedAssigneeIdentityId: selectedAssigneeIdentityId.value,
selectedAssigneeName: selectedAssigneeName.value,
@@ -581,7 +532,8 @@
const form = data.formData || {};
formData.result = form.result !== undefined ? form.result : 1;
formData.verifyRemark = form.verifyRemark || '';
formData.quickApproveRadio = form.quickApproveRadio === 'no' ? 'no' : 'yes';
hazardEndRadio.value = normalizeHazardEndRadio(form.hazardEndRadio ?? (form.hazardEnd === true ? 'yes' : 'no'));
quickApproveRadio.value = normalizeQuickApproveRadio(form.quickApproveRadio);
selectedAssigneeIdentityId.value = data.selectedAssigneeIdentityId || '';
selectedAssigneeName.value = data.selectedAssigneeName || '';
fileList1.value = data.fileList1 || [];
@@ -602,7 +554,8 @@
clearForm: () => {
formData.result = 1;
formData.verifyRemark = '';
formData.quickApproveRadio = 'yes';
hazardEndRadio.value = 'no';
quickApproveRadio.value = 'yes';
selectedAssigneeIdentityId.value = '';
selectedAssigneeName.value = '';
fileList1.value = [];
@@ -636,7 +589,8 @@
bindAutoSave(() => [
formData.result,
formData.verifyRemark,
formData.quickApproveRadio,
hazardEndRadio.value,
quickApproveRadio.value,
selectedAssigneeIdentityId.value,
selectedAssigneeName.value,
fileList1.value,
@@ -772,11 +726,14 @@
};
const validateFormBeforeSubmit = () => {
if (formData.result === 1 && !formData.quickApproveRadio) {
if (formData.result === 1 && hazardEndRadio.value === 'yes') {
return true;
}
if (formData.result === 1 && !quickApproveRadio.value) {
uni.showToast({ title: '请选择是否快速审批', icon: 'none' });
return false;
}
if (formData.result === 1 && formData.quickApproveRadio === 'no' && !selectedAssigneeIdentityId.value) {
if (formData.result === 1 && quickApproveRadio.value === 'no' && !selectedAssigneeIdentityId.value) {
uni.showToast({ title: '请选择下一步处理人', icon: 'none' });
return false;
}
@@ -854,14 +811,19 @@
result: formData.result,
verifyRemark: formData.verifyRemark || '',
attachments: attachments,
signPath: signatureServerPath.value || '' // 电子签名路径
signPath: signatureServerPath.value || '', // 电子签名路径
hazardEnd: formData.result === 1 && hazardEndRadio.value === 'yes'
// sendMsgFlag: sendMsgFlag.value
};
if (formData.result === 1) {
params.quickApprove = formData.quickApproveRadio === 'yes';
if (formData.quickApproveRadio === 'no') {
params.assigneeIdentityId = selectedAssigneeIdentityId.value;
if (hazardEndRadio.value === 'yes') {
params.quickApprove = null;
} else {
params.quickApprove = quickApproveRadio.value === 'yes';
if (quickApproveRadio.value === 'no') {
params.assigneeIdentityId = selectedAssigneeIdentityId.value;
}
}
}
@@ -1035,6 +997,10 @@
// 页面打开时自动恢复草稿
restoreDraft();
nextTick(() => {
hazardEndRadio.value = normalizeHazardEndRadio(hazardEndRadio.value);
quickApproveRadio.value = normalizeQuickApproveRadio(quickApproveRadio.value);
});
});
</script>
@@ -1091,100 +1057,6 @@
}
}
.user-popup {
background: #fff;
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
.popup-title {
font-size: 32rpx;
color: #333;
}
.popup-close {
font-size: 40rpx;
color: #999;
line-height: 1;
}
}
.user-list-scroll {
max-height: 600rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.empty-tip {
padding: 80rpx 20rpx;
text-align: center;
color: #909399;
font-size: 26rpx;
}
.user-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
&.active {
.user-item-text {
color: #2667E9;
font-weight: 600;
}
}
.user-item-text {
flex: 1;
font-size: 28rpx;
color: #333;
}
}
.popup-footer {
display: flex;
gap: 24rpx;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
button {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
margin: 0;
padding: 0;
&::after {
border: none;
}
}
.btn-cancel {
background: #fff;
color: #2667E9;
border: 2rpx solid #2667E9;
}
.btn-confirm {
color: #fff;
border: none;
}
}
}
// 签名相关样式
.signature-box {
width: 100%;