提交
This commit is contained in:
1 parent
7b1d4c8729
commit
ffc89d9b57
75 files changed
+12263
-7950
No files matched your search
@@ -5,14 +5,17 @@
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
label-width="120px"
|
||||
class="crm-dialog-form quote-form-body"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<el-divider content-position="left">基本信息</el-divider>
|
||||
<el-divider content-position="left">
|
||||
<span class="quote-section-title">基本信息</span>
|
||||
</el-divider>
|
||||
<div class="form-grid-4">
|
||||
<el-form-item class="quote-type-item form-col-span-4" label="报价类型" prop="quoteType" required>
|
||||
<!-- 第一行:报价类型、报价单编号、报价主题、关联商机 -->
|
||||
<el-form-item class="quote-type-item" label="报价类型" prop="quoteType" required>
|
||||
<el-radio-group v-model="form.quoteType" @change="handleQuoteTypeChange">
|
||||
<el-radio-button v-for="item in quoteTypeOptions" :key="item.value" :label="item.value">
|
||||
{{ item.label }}
|
||||
@@ -25,6 +28,27 @@
|
||||
<el-form-item :label="basicLabels.quoteTitle" prop="quoteTitle">
|
||||
<el-input v-model="form.quoteTitle" placeholder="可不填,系统将自动生成" maxlength="100" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.opportunity" prop="opportunityId">
|
||||
<el-input v-model="opportunityDisplayName" placeholder="请选择商机(可选)" readonly clearable>
|
||||
<template #append>
|
||||
<el-button text @click="handleSelectOpportunity">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<!-- 第二行:采购主体/报价主体、客户/供货商名称、联系人、负责人 -->
|
||||
<el-form-item :label="basicLabels.supplier" prop="supplierId" required>
|
||||
<el-select
|
||||
v-model="form.supplierId"
|
||||
:placeholder="`请选择${basicLabels.supplier}`"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="handleSupplierChange"
|
||||
>
|
||||
<el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.supplierName" :value="supplier.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.customerName" prop="customerId" required>
|
||||
<el-input v-model="form.customerName" placeholder="请选择客户" readonly>
|
||||
<template #append>
|
||||
@@ -43,15 +67,6 @@
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.opportunity" prop="opportunityId">
|
||||
<el-input v-model="opportunityDisplayName" placeholder="请选择商机(可选)" readonly clearable>
|
||||
<template #append>
|
||||
<el-button text @click="handleSelectOpportunity">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.ownerUser" prop="ownerUserId" required>
|
||||
<el-select
|
||||
v-model="form.ownerUserId"
|
||||
@@ -64,6 +79,10 @@
|
||||
<el-option v-for="user in userList" :key="user.userId" :label="user.nickName" :value="user.userId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 第三行:运费、询价/报价日期、有效期(天) -->
|
||||
<el-form-item label="运费(元)" prop="freight">
|
||||
<el-input-number v-model="form.freight" :min="0" :step="0.01" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.quoteDate" prop="quoteDate" required>
|
||||
<el-date-picker
|
||||
v-model="form.quoteDate"
|
||||
@@ -76,25 +95,11 @@
|
||||
<el-form-item :label="basicLabels.validityDays" prop="validityDays" required>
|
||||
<el-input-number v-model="form.validityDays" :min="1" :max="365" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="basicLabels.supplier" prop="supplierId" required>
|
||||
<el-select
|
||||
v-model="form.supplierId"
|
||||
:placeholder="`请选择${basicLabels.supplier}`"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="handleSupplierChange"
|
||||
>
|
||||
<el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.supplierName" :value="supplier.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="运费(元)" prop="freight">
|
||||
<el-input-number v-model="form.freight" :min="0" :step="0.01" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 产品明细 -->
|
||||
<el-divider content-position="left">
|
||||
<span style="font-size: 16px; font-weight: bold; color: #67c23a">
|
||||
<span class="quote-section-title">
|
||||
<el-icon><GoodsFilled /></el-icon> 产品明细
|
||||
</span>
|
||||
</el-divider>
|
||||
@@ -236,7 +241,7 @@
|
||||
|
||||
<!-- 报价条款 -->
|
||||
<el-divider content-position="left">
|
||||
<span style="font-size: 16px; font-weight: bold; color: #67c23a">
|
||||
<span class="quote-section-title">
|
||||
<el-icon><List /></el-icon> 报价条款
|
||||
</span>
|
||||
</el-divider>
|
||||
@@ -891,8 +896,8 @@ const handleCustomerConfirm = async (customer: CustomerVO) => {
|
||||
if (customer) {
|
||||
form.value.customerId = customer.id;
|
||||
form.value.customerName = customer.customerName;
|
||||
// 保存客户简称
|
||||
customerShortName.value = customer.shortName || customer.customerName || '';
|
||||
// 保存客户简称(报价主题依赖简称,不可回退为客户全称)
|
||||
customerShortName.value = customer.shortName?.trim() || '';
|
||||
// 清空联系人和商机
|
||||
form.value.contactId = undefined;
|
||||
form.value.contactName = '';
|
||||
@@ -963,6 +968,39 @@ const handleOwnerChange = (userId: string | number | undefined) => {
|
||||
form.value.ownerUserName = user?.nickName || ''
|
||||
}
|
||||
|
||||
/** 当前登录用户 ID(后端 current-user 返回 id,兼容历史 userId 字段) */
|
||||
const resolveCurrentUserId = (): string => {
|
||||
const info = userStore.info || ({} as Api.Auth.UserInfo & Record<string, unknown>)
|
||||
const fromInfo = String(info.id || info.userId || '')
|
||||
if (fromInfo) return fromInfo
|
||||
const token = userStore.accessToken
|
||||
if (!token || token.split('.').length < 2) return ''
|
||||
try {
|
||||
const payload = token.split('.')[1]
|
||||
const b64 = payload.replace(/-/g, '+').replace(/_/g, '/')
|
||||
const pad = '='.repeat((4 - (b64.length % 4)) % 4)
|
||||
const obj = JSON.parse(atob(b64 + pad))
|
||||
return String(obj?.sub || '')
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
/** 新增时默认负责人为当前登录人 */
|
||||
const applyDefaultOwnerUser = () => {
|
||||
const currentUserId = resolveCurrentUserId()
|
||||
if (!currentUserId) return
|
||||
const matched = userList.value.find((item) => String(item.userId) === currentUserId)
|
||||
if (matched) {
|
||||
form.value.ownerUserId = matched.userId as QuoteForm['ownerUserId']
|
||||
form.value.ownerUserName = matched.nickName || ''
|
||||
return
|
||||
}
|
||||
form.value.ownerUserId = currentUserId as QuoteForm['ownerUserId']
|
||||
const info = userStore.info as Record<string, string | undefined>
|
||||
form.value.ownerUserName = info?.realName || info?.userName || info?.username || ''
|
||||
}
|
||||
|
||||
const formatApproverOptionLabel = (user: { nickName?: string; userName?: string }) => {
|
||||
const nick = (user.nickName || '').trim()
|
||||
const account = (user.userName || '').trim()
|
||||
@@ -1610,6 +1648,7 @@ const initNew = async () => {
|
||||
form.value.quoteDate = getTodayDate();
|
||||
await dictStore.loadAllDict();
|
||||
await Promise.all([loadSupplierList(), loadUserList()]);
|
||||
applyDefaultOwnerUser();
|
||||
};
|
||||
|
||||
const initEdit = async (id: string | number) => {
|
||||
@@ -1674,11 +1713,27 @@ onMounted(async () => {
|
||||
getQuoteInfoForCopy(copyId);
|
||||
} else {
|
||||
form.value.quoteDate = getTodayDate();
|
||||
applyDefaultOwnerUser();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.quote-form-body {
|
||||
:deep(.el-form-item__label) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.quote-section-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: var(--primary-dark, #059669);
|
||||
}
|
||||
|
||||
.box-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
@@ -1708,17 +1763,19 @@ onMounted(async () => {
|
||||
.quote-type-item :deep(.el-form-item__content) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.quote-type-item :deep(.el-radio-group) {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.quote-type-item :deep(.el-radio-button__inner) {
|
||||
padding: 14px 26px;
|
||||
font-size: 16px;
|
||||
padding: 8px 16px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.quote-type-wrapper {
|
||||
@@ -2027,11 +2084,6 @@ onMounted(async () => {
|
||||
gap: 8px 12px;
|
||||
}
|
||||
|
||||
.quote-type-item :deep(.el-radio-group) {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.approval-dialog-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
Reference in new issue
Block a user