feat(web-admin): prefill quote submit approvers from tenant setting
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
209f5cb7a8
commit
98f33644f1
3 files changed
+71
-14
No files matched your search
@@ -463,6 +463,14 @@
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<el-alert
|
||||
v-if="submitPrefillTip"
|
||||
type="success"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="已按「报价单审批人设置」预填审批人,可修改后提交"
|
||||
style="margin-bottom: 12px"
|
||||
/>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item prop="approverIds" class="form-col-span-2">
|
||||
<template #label>
|
||||
@@ -495,7 +503,7 @@
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { ref, computed, onMounted, type ComponentInternalInstance } from 'vue';
|
||||
import { getQuote, addQuote, updateQuote, submitQuote } from '@/api/crm/quote';
|
||||
import { getQuote, addQuote, updateQuote, submitQuote, getQuoteApproverSetting } from '@/api/crm/quote';
|
||||
import type { QuoteForm, QuoteProductForm } from '@/api/crm/quote';
|
||||
import type { FormInstance } from 'element-plus';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
@@ -689,6 +697,7 @@ const submitForm = ref({
|
||||
const submitRules = ref({
|
||||
approverIds: [{ required: true, message: '请选择审批人', trigger: 'change' }]
|
||||
});
|
||||
const submitPrefillTip = ref(false);
|
||||
const submitFormRef = ref<FormInstance>();
|
||||
|
||||
// 用户列表(负责人 + 审批人候选)
|
||||
@@ -1099,6 +1108,17 @@ const loadUserList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
async function resolvePrefillApproverIds(userList: { userId: string | number }[]) {
|
||||
try {
|
||||
const { data } = await getQuoteApproverSetting();
|
||||
if (!data || String(data.status) !== '0') return [] as string[];
|
||||
const valid = new Set(userList.map((u) => String(u.userId)));
|
||||
return (data.approverIds || []).map(String).filter((id) => valid.has(id));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/** 加载供方信息列表 */
|
||||
const loadSupplierList = async () => {
|
||||
try {
|
||||
@@ -1692,15 +1712,14 @@ const handleSubmit = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 重置提交表单
|
||||
await loadUserList();
|
||||
const prefillIds = await resolvePrefillApproverIds(userList.value);
|
||||
submitForm.value = {
|
||||
id: form.value.id,
|
||||
approverIds: [],
|
||||
approverIds: prefillIds,
|
||||
remark: ''
|
||||
};
|
||||
|
||||
// 加载用户列表
|
||||
await loadUserList();
|
||||
submitPrefillTip.value = prefillIds.length > 0;
|
||||
|
||||
// 打开审批对话框
|
||||
submitDialog.value.visible = true;
|
||||
|
||||
Reference in new issue
Block a user