一单n制等功能,接入随手拍之前我先提交一版本
This commit is contained in:
@@ -46,35 +46,39 @@
|
||||
<up-textarea v-model="formData.selfVerifyContent" placeholder="请输入隐患治理责任单位自行验收的情况"></up-textarea>
|
||||
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">下一步流程</view>
|
||||
<view class="text-gray">是否结束销号</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<view class="static-field">{{ nextStepDisplay }}</view>
|
||||
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">下一步处理人</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<view class="select-trigger" @click="openAssigneePopup">
|
||||
<view class="select-content" :class="{ 'text-gray': !selectedAssigneeName }">
|
||||
{{ selectedAssigneeName || '请选择下一步处理人' }}
|
||||
</view>
|
||||
<text class="cuIcon-unfold"></text>
|
||||
</view>
|
||||
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">短信提醒</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<up-radio-group v-model="sendMsgFlagRadio" placement="row" activeColor="#2667e9">
|
||||
<up-radio-group :key="'hazard-end-' + hazardEndRadio" v-model="hazardEndRadio" placement="row" activeColor="#2667e9">
|
||||
<up-radio
|
||||
label="是"
|
||||
name="yes"
|
||||
label="否"
|
||||
name="no"
|
||||
:customStyle="{ marginRight: '48rpx' }"
|
||||
></up-radio>
|
||||
<up-radio label="否" name="no"></up-radio>
|
||||
<up-radio label="是" name="yes"></up-radio>
|
||||
</up-radio-group>
|
||||
|
||||
<template v-if="!hazardEnd">
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">下一步流程</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<view class="static-field">{{ nextStepDisplay }}</view>
|
||||
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">短信提醒</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<up-radio-group v-model="sendMsgFlagRadio" placement="row" activeColor="#2667e9">
|
||||
<up-radio
|
||||
label="是"
|
||||
name="yes"
|
||||
:customStyle="{ marginRight: '48rpx' }"
|
||||
></up-radio>
|
||||
<up-radio label="否" name="no"></up-radio>
|
||||
</up-radio-group>
|
||||
</template>
|
||||
|
||||
<view class="flex margin-top-xl" style="gap: 20rpx;">
|
||||
<button class="round flex-sub" @click="handleCancel">取消</button>
|
||||
<button class="bg-blue round flex-sub" @click="handleSubmit">提交申请</button>
|
||||
@@ -90,6 +94,7 @@
|
||||
@close="showHazardPicker = false"
|
||||
></up-picker>
|
||||
|
||||
<!-- 暂时注释:下一步处理人弹窗
|
||||
<u-popup :show="showAssigneePopup" mode="bottom" round="20" @close="cancelAssigneeSelect">
|
||||
<view class="user-popup">
|
||||
<view class="popup-header">
|
||||
@@ -118,11 +123,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
-->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import { ref, reactive, computed, nextTick } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import {
|
||||
applyDelete,
|
||||
@@ -145,6 +151,9 @@
|
||||
const selectableHazardList = ref([]);
|
||||
const selectedDeptName = ref('');
|
||||
const aiGenerating = ref(false);
|
||||
const hazardEndRadio = ref('no');
|
||||
const hazardEnd = computed(() => hazardEndRadio.value === 'yes');
|
||||
const normalizeHazardEndRadio = (value) => (value === 'yes' ? 'yes' : 'no');
|
||||
const sendMsgFlagRadio = ref('yes');
|
||||
const sendMsgFlag = computed(() => sendMsgFlagRadio.value === 'yes');
|
||||
|
||||
@@ -542,10 +551,11 @@
|
||||
uni.showToast({ title: '请选择隐患', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!selectedAssigneeIdentityId.value) {
|
||||
uni.showToast({ title: '请选择下一步处理人', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// 暂时注释:下一步处理人必选校验
|
||||
// if (!selectedAssigneeIdentityId.value) {
|
||||
// uni.showToast({ title: '请选择下一步处理人', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
|
||||
const params = {
|
||||
hazardId: Number(selectedHazardId.value),
|
||||
@@ -555,9 +565,14 @@
|
||||
mainTreatmentContent: formData.mainTreatmentContent || '',
|
||||
treatmentResult: formData.treatmentResult || '',
|
||||
selfVerifyContent: formData.selfVerifyContent || '',
|
||||
assigneeIdentityId: selectedAssigneeIdentityId.value,
|
||||
sendMsgFlag: sendMsgFlag.value
|
||||
hazardEnd: hazardEnd.value,
|
||||
quickApprove: hazardEnd.value ? null : true,
|
||||
sendMsgFlag: hazardEnd.value ? null : sendMsgFlag.value
|
||||
};
|
||||
// 非快速审批时需传 assigneeIdentityId
|
||||
// if (!params.quickApprove) {
|
||||
// params.assigneeIdentityId = selectedAssigneeIdentityId.value;
|
||||
// }
|
||||
|
||||
try {
|
||||
const res = await applyDelete(params);
|
||||
@@ -587,16 +602,19 @@
|
||||
const hazardFromOptions = buildWriteoffHazardFromOptions(options);
|
||||
if (hazardFromOptions?.hazardId) {
|
||||
await applySelectedHazard(hazardFromOptions);
|
||||
return;
|
||||
} else {
|
||||
if (!hazardLocked.value) {
|
||||
await fetchSelectableHazardList();
|
||||
}
|
||||
|
||||
if (taskId.value) {
|
||||
await fetchNextStep();
|
||||
}
|
||||
}
|
||||
|
||||
if (!hazardLocked.value) {
|
||||
await fetchSelectableHazardList();
|
||||
}
|
||||
|
||||
if (taskId.value) {
|
||||
await fetchNextStep();
|
||||
}
|
||||
nextTick(() => {
|
||||
hazardEndRadio.value = normalizeHazardEndRadio(hazardEndRadio.value);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -196,34 +196,14 @@
|
||||
@close="showHazardPicker = false"
|
||||
></up-picker>
|
||||
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -237,9 +217,9 @@
|
||||
getRectifyDetail,
|
||||
generateWriteoffContent,
|
||||
getFlowNextNodes,
|
||||
getDeptUsers,
|
||||
getWriteoffForm
|
||||
} from '@/request/api.js';
|
||||
import FlowAssigneePickerPopup from '@/components/flow/FlowAssigneePickerPopup.vue';
|
||||
import { uploadToCloud, toSubmitFileUrl } from '@/utils/upload.js';
|
||||
import { buildWriteoffHazardFromOptions } from '@/utils/hazardNav.js';
|
||||
|
||||
@@ -278,8 +258,6 @@
|
||||
const pickerAssigneeIdentityId = ref('');
|
||||
const pickerAssigneeName = ref('');
|
||||
const showAssigneePopup = ref(false);
|
||||
const assigneeList = ref([]);
|
||||
const assigneeLoading = ref(false);
|
||||
|
||||
const showCanvas = ref(true);
|
||||
const signatureUrl = ref('');
|
||||
@@ -435,96 +413,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
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 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 = () => {
|
||||
if (formData.approvalResult === 2) return 3;
|
||||
return quickApproveRadio.value === '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;
|
||||
};
|
||||
|
||||
@@ -1098,100 +999,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-action-btn {
|
||||
margin: 0;
|
||||
padding: 0 20rpx;
|
||||
|
||||
Reference in New Issue
Block a user