预算多选不限同一父级

master
weizong song 4 months ago
parent 0d83e74d91
commit 234c3028d6

@ -509,7 +509,7 @@
:on-remove="(file) => handleUploadRemove(file, element.id)" :on-remove="(file) => handleUploadRemove(file, element.id)"
:before-upload="beforeUpload" :before-upload="beforeUpload"
multiple multiple
:limit="10" :limit="50"
> >
<el-button type="primary"> <el-button type="primary">
<el-icon><Upload /></el-icon> <el-icon><Upload /></el-icon>

@ -279,7 +279,7 @@
:on-remove="(file) => handleFileRemove(field.key, file)" :on-remove="(file) => handleFileRemove(field.key, file)"
:before-upload="beforeUpload" :before-upload="beforeUpload"
multiple multiple
:limit="10" :limit="50"
class="file-upload-component" class="file-upload-component"
> >
<el-button type="primary"> <el-button type="primary">
@ -1054,7 +1054,7 @@
:on-remove="(file) => handlePaymentUploadRemove(file, element.id)" :on-remove="(file) => handlePaymentUploadRemove(file, element.id)"
:before-upload="beforeUpload" :before-upload="beforeUpload"
multiple multiple
:limit="10" :limit="50"
> >
<el-button type="primary"> <el-button type="primary">
<el-icon><Upload /></el-icon> <el-icon><Upload /></el-icon>

@ -1583,6 +1583,7 @@ const rebuildConfirmAllocationsFromSelection = async (existingMap) => {
const auths = await getDepartmentAuthorizations(node.id) const auths = await getDepartmentAuthorizations(node.id)
if (!auths || auths.length === 0) { if (!auths || auths.length === 0) {
confirmSelectionError.value = '该预算来源未配置部门授权' confirmSelectionError.value = '该预算来源未配置部门授权'
confirmSelectedBudgetIds.value = [...confirmLastValidBudgetIds.value]
setConfirmCheckedIds(confirmLastValidBudgetIds.value) setConfirmCheckedIds(confirmLastValidBudgetIds.value)
return return
} }
@ -1615,19 +1616,12 @@ const rebuildConfirmAllocationsFromSelection = async (existingMap) => {
return return
} }
// 多预算:同父、唯一授权部门
const parentId = selectedNodes[0].parent_id ?? null
const parentMismatch = selectedNodes.some((n) => (n.parent_id ?? null) !== parentId)
if (parentMismatch) {
confirmSelectionError.value = '多条预算来源必须同属一个直接父级'
setConfirmCheckedIds(confirmLastValidBudgetIds.value)
return
}
const rows = [] const rows = []
for (const node of selectedNodes) { for (const node of selectedNodes) {
const auths = await getDepartmentAuthorizations(node.id) const auths = await getDepartmentAuthorizations(node.id)
if (!auths || auths.length !== 1) { if (!auths || auths.length !== 1) {
confirmSelectionError.value = '多条预算来源时,每条预算必须且仅能授权给一个部门' confirmSelectionError.value = '多预算时,每条预算必须且仅能授权给一个部门'
confirmSelectedBudgetIds.value = [...confirmLastValidBudgetIds.value]
setConfirmCheckedIds(confirmLastValidBudgetIds.value) setConfirmCheckedIds(confirmLastValidBudgetIds.value)
return return
} }
@ -1825,6 +1819,7 @@ const onConfirmTreeCheckChange = async () => {
if (mySeq !== rebuildSeq.value) return if (mySeq !== rebuildSeq.value) return
if (confirmSelectionError.value) { if (confirmSelectionError.value) {
ElMessage.warning(confirmSelectionError.value) ElMessage.warning(confirmSelectionError.value)
confirmSelectedBudgetIds.value = [...beforeIds]
setConfirmCheckedIds(beforeIds) setConfirmCheckedIds(beforeIds)
// 回滚后不改右侧、不改 lastValid // 回滚后不改右侧、不改 lastValid
confirmSelectionError.value = '' confirmSelectionError.value = ''
@ -2131,5 +2126,3 @@ onMounted(async () => {

Loading…
Cancel
Save