提交
This commit is contained in:
1 parent
dacfdc9ff6
commit
f9676f8759
906 files changed
+533306
-12946
No files matched your search
@@ -2,7 +2,7 @@
|
||||
<el-dialog
|
||||
v-model="dialog.visible"
|
||||
:title="dialog.title"
|
||||
width="960px"
|
||||
width="1160px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -18,7 +18,7 @@
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<el-divider content-position="left">基本信息</el-divider>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-grid-3">
|
||||
<el-form-item label="客户名称" prop="customerName">
|
||||
<el-input v-model="form.customerName" placeholder="请输入客户名称" maxlength="200" />
|
||||
</el-form-item>
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
|
||||
<el-divider content-position="left">详细信息</el-divider>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-grid-3">
|
||||
<el-form-item label="客户来源" prop="source">
|
||||
<el-select v-model="form.source" placeholder="请选择客户来源" clearable>
|
||||
<el-option
|
||||
@@ -82,9 +82,16 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在园区" prop="parkArea">
|
||||
<el-select v-model="form.parkArea" placeholder="请选择所在园区" clearable filterable>
|
||||
<el-select
|
||||
v-model="form.parkArea"
|
||||
placeholder="请选择或输入所在园区"
|
||||
clearable
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in dictStore.getOptions('crm_customer_park')"
|
||||
v-for="opt in parkAreaOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
@@ -110,19 +117,13 @@
|
||||
<el-form-item label="区县" prop="district">
|
||||
<el-input v-model="form.district" placeholder="请输入区县" maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="form.address"
|
||||
placeholder="请输入详细地址"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
maxlength="255"
|
||||
/>
|
||||
<el-form-item label="详细地址" class="form-field-span-2">
|
||||
<el-input v-model="form.address" placeholder="请输入详细地址" maxlength="255" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-divider content-position="left">分配信息</el-divider>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-grid-3">
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-select v-model="form.ownerUserId" placeholder="请选择负责人" clearable filterable>
|
||||
<el-option
|
||||
@@ -142,11 +143,14 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="500" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-divider content-position="left">证件信息</el-divider>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="营业执照" prop="businessLicenseImages" class="form-col-span-2">
|
||||
<div class="form-grid-3">
|
||||
<el-form-item label="营业执照" prop="businessLicenseImages">
|
||||
<AttachmentUploadField
|
||||
ref="businessLicenseUploadRef"
|
||||
v-model="form.businessLicenseImages"
|
||||
@@ -157,7 +161,7 @@
|
||||
@update:model-value="handleCertFieldChange('businessLicenseImages')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="经营许可证" prop="businessPermitImages" class="form-col-span-2">
|
||||
<el-form-item label="经营许可证" prop="businessPermitImages">
|
||||
<AttachmentUploadField
|
||||
ref="businessPermitUploadRef"
|
||||
v-model="form.businessPermitImages"
|
||||
@@ -180,69 +184,64 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-divider content-position="left">开票信息</el-divider>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="单位名称(章)" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="invoiceForm.companyName"
|
||||
placeholder="选填;填写任意开票项时此项必填"
|
||||
maxlength="200"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位地址" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="invoiceForm.companyAddress"
|
||||
placeholder="请输入单位地址"
|
||||
maxlength="500"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="法定代表人">
|
||||
<el-input
|
||||
v-model="invoiceForm.legalRepresentative"
|
||||
placeholder="请输入法定代表人"
|
||||
maxlength="100"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="代理人">
|
||||
<el-input v-model="invoiceForm.agent" placeholder="请输入代理人" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话/传真">
|
||||
<el-input v-model="invoiceForm.phoneFax" placeholder="请输入电话/传真" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开户银行">
|
||||
<el-input v-model="invoiceForm.bankName" placeholder="请输入开户银行" maxlength="200" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号" class="form-col-span-2">
|
||||
<el-input v-model="invoiceForm.bankAccount" placeholder="请输入账号" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否默认" class="form-col-span-2">
|
||||
<el-radio-group v-model="invoiceForm.isDefault">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="开票备注" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="invoiceForm.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入开票相关备注"
|
||||
maxlength="500"
|
||||
:rows="2"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="备注" prop="remark" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
placeholder="请输入备注"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="500"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<template v-if="!form.id">
|
||||
<el-divider content-position="left">开票信息</el-divider>
|
||||
<div class="form-grid-3">
|
||||
<el-form-item label="单位名称(章)">
|
||||
<el-input
|
||||
v-model="invoiceForm.companyName"
|
||||
placeholder="请输入单位名称"
|
||||
maxlength="200"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="税号">
|
||||
<el-input v-model="invoiceForm.taxNo" placeholder="请输入税号" maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位地址">
|
||||
<el-input
|
||||
v-model="invoiceForm.companyAddress"
|
||||
placeholder="请输入单位地址"
|
||||
maxlength="500"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="法定代表人">
|
||||
<el-input
|
||||
v-model="invoiceForm.legalRepresentative"
|
||||
placeholder="请输入法定代表人"
|
||||
maxlength="100"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="代理人">
|
||||
<el-input v-model="invoiceForm.agent" placeholder="请输入代理人" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话/传真">
|
||||
<el-input v-model="invoiceForm.phoneFax" placeholder="请输入电话/传真" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开户银行">
|
||||
<el-input v-model="invoiceForm.bankName" placeholder="请输入开户银行" maxlength="200" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="invoiceForm.bankAccount" placeholder="请输入账号" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开票备注">
|
||||
<el-input
|
||||
v-model="invoiceForm.remark"
|
||||
placeholder="请输入开票信息备注"
|
||||
maxlength="500"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-divider content-position="left">开票信息</el-divider>
|
||||
<el-alert
|
||||
class="form-col-span-2"
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="开票信息请在客户详情的“开票信息”标签页维护(支持一客户多条并设置默认)。"
|
||||
/>
|
||||
</template>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@@ -260,17 +259,18 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ref, reactive, computed, nextTick } from 'vue'
|
||||
import { Close, Check } from '@element-plus/icons-vue'
|
||||
import type { FormItemRule } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fetchCustomerDetail, fetchCreateCustomer, fetchUpdateCustomer } from '@/api/crm/customer'
|
||||
import type { CustomerForm as CustomerFormType } from '@/api/crm/customerTypes'
|
||||
import {
|
||||
getInvoiceInfoByCustomerId,
|
||||
addInvoiceInfo,
|
||||
updateInvoiceInfo
|
||||
} from '@/api/crm/invoiceInfo'
|
||||
fetchCustomerDetail,
|
||||
fetchCreateCustomer,
|
||||
fetchUpdateCustomer,
|
||||
fetchParkAreaList
|
||||
} from '@/api/crm/customer'
|
||||
import type { CustomerForm as CustomerFormType } from '@/api/crm/customerTypes'
|
||||
import { addInvoiceInfo } from '@/api/crm/invoiceInfo'
|
||||
import type { InvoiceInfoForm } from '@/api/crm/invoiceInfo'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
@@ -315,104 +315,6 @@ function handleCertFieldChange(field: 'businessLicenseImages' | 'businessPermitI
|
||||
formRef.value?.validateField(field)
|
||||
}
|
||||
|
||||
/** 弹窗内维护的一条开票信息 */
|
||||
const invoiceForm = ref({
|
||||
id: undefined as number | string | undefined,
|
||||
companyName: '',
|
||||
companyAddress: '',
|
||||
legalRepresentative: '',
|
||||
agent: '',
|
||||
phoneFax: '',
|
||||
bankName: '',
|
||||
bankAccount: '',
|
||||
isDefault: '1',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
function resetInvoiceForm() {
|
||||
invoiceForm.value = {
|
||||
id: undefined,
|
||||
companyName: '',
|
||||
companyAddress: '',
|
||||
legalRepresentative: '',
|
||||
agent: '',
|
||||
phoneFax: '',
|
||||
bankName: '',
|
||||
bankAccount: '',
|
||||
isDefault: '1',
|
||||
remark: ''
|
||||
}
|
||||
}
|
||||
|
||||
/** 是否填写了任意开票字段(含单位名称) */
|
||||
function isInvoiceBlockFilled(): boolean {
|
||||
const f = invoiceForm.value
|
||||
const keys = [
|
||||
'companyName',
|
||||
'companyAddress',
|
||||
'legalRepresentative',
|
||||
'agent',
|
||||
'phoneFax',
|
||||
'bankName',
|
||||
'bankAccount',
|
||||
'remark'
|
||||
] as const
|
||||
return keys.some((k) => {
|
||||
const v = f[k]
|
||||
return v != null && String(v).trim() !== ''
|
||||
})
|
||||
}
|
||||
|
||||
/** 解析新增客户接口返回的客户 ID(兼容 HTTP 解包后的客户对象与原 CRM 仅返回 ID 字符串) */
|
||||
function resolveNewCustomerId(res: unknown): string | null {
|
||||
if (res == null) return null
|
||||
|
||||
// shanxia2.0:request 已返回 data 字段内的客户对象
|
||||
if (typeof res === 'object' && 'id' in res) {
|
||||
const id = (res as { id?: string | number | null }).id
|
||||
if (id != null && String(id).trim() !== '') {
|
||||
return String(id)
|
||||
}
|
||||
}
|
||||
|
||||
const payload = res as { data?: unknown; msg?: string }
|
||||
const { data, msg } = payload
|
||||
if (data != null) {
|
||||
if (typeof data === 'object' && data !== null && 'id' in data) {
|
||||
const nestedId = (data as { id?: string | number | null }).id
|
||||
if (nestedId != null && String(nestedId).trim() !== '') {
|
||||
return String(nestedId)
|
||||
}
|
||||
}
|
||||
const dataStr = String(data).trim()
|
||||
if (dataStr !== '' && dataStr !== '[object Object]') {
|
||||
return dataStr
|
||||
}
|
||||
}
|
||||
if (msg != null && /^\d+$/.test(String(msg).trim())) {
|
||||
return String(msg).trim()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function buildInvoicePayload(customerId: number | string): InvoiceInfoForm {
|
||||
const f = invoiceForm.value
|
||||
const cid = String(customerId)
|
||||
return {
|
||||
id: f.id,
|
||||
customerId: cid,
|
||||
companyName: f.companyName.trim(),
|
||||
companyAddress: f.companyAddress?.trim() || undefined,
|
||||
legalRepresentative: f.legalRepresentative?.trim() || undefined,
|
||||
agent: f.agent?.trim() || undefined,
|
||||
phoneFax: f.phoneFax?.trim() || undefined,
|
||||
bankName: f.bankName?.trim() || undefined,
|
||||
bankAccount: f.bankAccount?.trim() || undefined,
|
||||
isDefault: f.isDefault,
|
||||
remark: f.remark?.trim() || undefined
|
||||
}
|
||||
}
|
||||
|
||||
function unwrapApiData<T>(res: T | { data?: T }): T {
|
||||
if (res != null && typeof res === 'object' && 'data' in res && (res as { data?: T }).data !== undefined) {
|
||||
return (res as { data: T }).data
|
||||
@@ -420,42 +322,6 @@ function unwrapApiData<T>(res: T | { data?: T }): T {
|
||||
return res as T
|
||||
}
|
||||
|
||||
async function loadInvoiceForEdit(customerId: number | string) {
|
||||
resetInvoiceForm()
|
||||
try {
|
||||
const res = await getInvoiceInfoByCustomerId(customerId)
|
||||
const raw = unwrapApiData(res as any[] | { data?: any[] })
|
||||
const rows = Array.isArray(raw) ? raw : []
|
||||
const row = rows.find((i) => i.isDefault === '1') || rows[0]
|
||||
if (row) {
|
||||
invoiceForm.value = {
|
||||
id: row.id,
|
||||
companyName: row.companyName ?? '',
|
||||
companyAddress: row.companyAddress ?? '',
|
||||
legalRepresentative: row.legalRepresentative ?? '',
|
||||
agent: row.agent ?? '',
|
||||
phoneFax: row.phoneFax ?? '',
|
||||
bankName: row.bankName ?? '',
|
||||
bankAccount: row.bankAccount ?? '',
|
||||
isDefault: row.isDefault ?? '1',
|
||||
remark: row.remark ?? ''
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
async function syncInvoiceAfterCustomerSave(customerId: number | string) {
|
||||
if (!isInvoiceBlockFilled()) return
|
||||
const payload = buildInvoicePayload(customerId)
|
||||
if (invoiceForm.value.id) {
|
||||
await updateInvoiceInfo({ ...payload, id: invoiceForm.value.id })
|
||||
} else {
|
||||
await addInvoiceInfo({ ...payload, id: undefined })
|
||||
}
|
||||
}
|
||||
|
||||
// 表单校验规则
|
||||
const rules = ref<Record<string, FormItemRule[]>>({
|
||||
customerName: [{ required: true, message: '客户名称不能为空', trigger: 'blur' }],
|
||||
@@ -496,6 +362,39 @@ const rules = ref<Record<string, FormItemRule[]>>({
|
||||
|
||||
// 用户列表
|
||||
const userList = ref<any[]>([])
|
||||
const extraParkAreas = ref<string[]>([])
|
||||
|
||||
const invoiceForm = ref<InvoiceInfoForm>({
|
||||
companyName: '',
|
||||
taxNo: '',
|
||||
companyAddress: '',
|
||||
legalRepresentative: '',
|
||||
agent: '',
|
||||
phoneFax: '',
|
||||
bankName: '',
|
||||
bankAccount: '',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const parkAreaOptions = computed(() => {
|
||||
const dictOpts = dictStore.getOptions('crm_customer_park')
|
||||
const seen = new Set(dictOpts.map((opt) => opt.value))
|
||||
const options = [...dictOpts]
|
||||
|
||||
for (const area of extraParkAreas.value) {
|
||||
if (area && !seen.has(area)) {
|
||||
options.push({ label: area, value: area, tagType: 'info' })
|
||||
seen.add(area)
|
||||
}
|
||||
}
|
||||
|
||||
const current = form.value.parkArea?.trim()
|
||||
if (current && !seen.has(current)) {
|
||||
options.push({ label: current, value: current, tagType: 'info' })
|
||||
}
|
||||
|
||||
return options
|
||||
})
|
||||
|
||||
// 对话框
|
||||
const dialog = reactive({
|
||||
@@ -519,21 +418,96 @@ function hasAttachmentUploading() {
|
||||
const loadUserList = async () => {
|
||||
try {
|
||||
const res = await fetchUserOptions()
|
||||
userList.value = (res as any).map((item: any) => ({
|
||||
const options = (res as any)?.data ?? res ?? []
|
||||
userList.value = (Array.isArray(options) ? options : []).map((item: any) => ({
|
||||
userId: item.value,
|
||||
nickName: item.label
|
||||
}))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
userList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const resolveDefaultOwnerUserId = () => {
|
||||
const info = userStore.info
|
||||
const userId = info?.userId ?? info?.id
|
||||
return userId != null && userId !== '' ? String(userId) : undefined
|
||||
}
|
||||
|
||||
const applyDefaultOwnerUserId = async () => {
|
||||
const defaultOwnerUserId = resolveDefaultOwnerUserId()
|
||||
if (!defaultOwnerUserId) return
|
||||
await nextTick()
|
||||
form.value.ownerUserId = defaultOwnerUserId as CustomerFormType['ownerUserId']
|
||||
}
|
||||
|
||||
/** 加载历史园区列表 */
|
||||
const loadParkAreaList = async () => {
|
||||
try {
|
||||
const res = await fetchParkAreaList()
|
||||
const list = unwrapApiData(res as string[] | { data?: string[] })
|
||||
extraParkAreas.value = Array.isArray(list) ? list.filter(Boolean) : []
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
extraParkAreas.value = []
|
||||
}
|
||||
}
|
||||
|
||||
function hasInvoiceInfoFilled() {
|
||||
const inv = invoiceForm.value
|
||||
return Boolean(
|
||||
inv.companyName?.trim() ||
|
||||
inv.taxNo?.trim() ||
|
||||
inv.companyAddress?.trim() ||
|
||||
inv.legalRepresentative?.trim() ||
|
||||
inv.agent?.trim() ||
|
||||
inv.phoneFax?.trim() ||
|
||||
inv.bankName?.trim() ||
|
||||
inv.bankAccount?.trim() ||
|
||||
inv.remark?.trim()
|
||||
)
|
||||
}
|
||||
|
||||
function resetInvoiceForm() {
|
||||
invoiceForm.value = {
|
||||
companyName: '',
|
||||
taxNo: '',
|
||||
companyAddress: '',
|
||||
legalRepresentative: '',
|
||||
agent: '',
|
||||
phoneFax: '',
|
||||
bankName: '',
|
||||
bankAccount: '',
|
||||
remark: ''
|
||||
}
|
||||
}
|
||||
|
||||
async function syncInvoiceInfoAfterCreate(customerId: string | number) {
|
||||
if (!hasInvoiceInfoFilled()) return
|
||||
|
||||
const inv = invoiceForm.value
|
||||
await addInvoiceInfo({
|
||||
customerId: String(customerId),
|
||||
companyName: inv.companyName.trim(),
|
||||
taxNo: inv.taxNo?.trim() || undefined,
|
||||
companyAddress: inv.companyAddress?.trim() || undefined,
|
||||
legalRepresentative: inv.legalRepresentative?.trim() || undefined,
|
||||
agent: inv.agent?.trim() || undefined,
|
||||
phoneFax: inv.phoneFax?.trim() || undefined,
|
||||
bankName: inv.bankName?.trim() || undefined,
|
||||
bankAccount: inv.bankAccount?.trim() || undefined,
|
||||
remark: inv.remark?.trim() || undefined,
|
||||
isDefault: '1'
|
||||
})
|
||||
}
|
||||
|
||||
/** 打开对话框 */
|
||||
const open = async (id?: number | string) => {
|
||||
reset()
|
||||
dialog.visible = true
|
||||
|
||||
await loadUserList()
|
||||
await Promise.all([loadUserList(), loadParkAreaList()])
|
||||
|
||||
if (id) {
|
||||
dialog.title = '修改客户'
|
||||
@@ -548,14 +522,12 @@ const open = async (id?: number | string) => {
|
||||
if ((data as any)?.ownerUserId) {
|
||||
form.value.ownerUserId = (data as any).ownerUserId
|
||||
}
|
||||
await loadInvoiceForEdit(id)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
} else {
|
||||
dialog.title = '新增客户'
|
||||
resetInvoiceForm()
|
||||
form.value.ownerUserId = userStore.info.userId ? Number(userStore.info.userId) : undefined
|
||||
await applyDefaultOwnerUserId()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +545,7 @@ const submitForm = () => {
|
||||
}
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (!valid) return
|
||||
if (isInvoiceBlockFilled() && !invoiceForm.value.companyName?.trim()) {
|
||||
if (!form.value.id && hasInvoiceInfoFilled() && !invoiceForm.value.companyName?.trim()) {
|
||||
ElMessage.warning('已填写开票信息时,单位名称(章)不能为空')
|
||||
return
|
||||
}
|
||||
@@ -583,17 +555,13 @@ const submitForm = () => {
|
||||
|
||||
if (form.value.id) {
|
||||
await fetchUpdateCustomer(payload)
|
||||
await syncInvoiceAfterCustomerSave(form.value.id)
|
||||
ElMessage.success('修改成功')
|
||||
} else {
|
||||
const res = await fetchCreateCustomer(payload)
|
||||
const newId = resolveNewCustomerId(res)
|
||||
if (isInvoiceBlockFilled()) {
|
||||
if (newId == null) {
|
||||
ElMessage.warning('客户已创建,但未能获取客户 ID,开票信息未保存,请在编辑中补充')
|
||||
} else {
|
||||
await syncInvoiceAfterCustomerSave(newId)
|
||||
}
|
||||
const customerData = unwrapApiData(res as Record<string, unknown> | { data?: Record<string, unknown> })
|
||||
const customerId = (customerData as { id?: string | number })?.id
|
||||
if (customerId) {
|
||||
await syncInvoiceInfoAfterCreate(customerId)
|
||||
}
|
||||
ElMessage.success('新增成功')
|
||||
}
|
||||
@@ -648,4 +616,8 @@ const reset = () => {
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
<style scoped lang="scss">
|
||||
.form-grid-3 .form-field-span-2 {
|
||||
grid-column: span 2;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user