|
|
@@ -40,14 +40,24 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="开票类型" prop="invoiceTypeId">
|
|
|
<el-select v-model="form.invoiceTypeId" placeholder="请选择开票类型" class="w-full">
|
|
|
- <el-option v-for="item in invoiceTypeList" :key="item.id" :label="item.invoiceTypeName" :value="item.id" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in invoiceTypeList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="`${item.invoiceTypeNo} , ${item.invoiceTypeName}`"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="企业规模" prop="enterpriseScaleId">
|
|
|
<el-select v-model="form.enterpriseScaleId" placeholder="请选择企业规模" class="w-full" filterable>
|
|
|
- <el-option v-for="item in enterpriseScaleList" :key="item.id" :label="item.enterpriseScaleName" :value="item.id" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in enterpriseScaleList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="`${item.enterpriseScaleCode} , ${item.enterpriseScaleName}`"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -56,22 +66,27 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="客户类别" prop="customerTypeId">
|
|
|
- <el-select v-model="form.customerTypeId" placeholder="请选择客户类别" class="w-full">
|
|
|
- <el-option v-for="dict in customer_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <el-select v-model="form.customerTypeId" placeholder="请选择客户类别" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in customerTypeList" :key="item.id" :label="`${item.typeCode} , ${item.typeName}`" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="行业类别" prop="industryCategoryId">
|
|
|
<el-select v-model="form.industryCategoryId" placeholder="请选择行业类别" class="w-full" filterable>
|
|
|
- <el-option v-for="item in industryCategoryList" :key="item.id" :label="item.industryCategoryName" :value="item.id" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in industryCategoryList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="`${item.industryCode} , ${item.industryCategoryName}`"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="客户等级" prop="customerLevelId">
|
|
|
- <el-select v-model="form.customerLevelId" placeholder="请选择客户等级" class="w-full">
|
|
|
- <el-option v-for="dict in customer_level" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <el-select v-model="form.customerLevelId" placeholder="请选择客户等级" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in customerLevelList" :key="item.id" :label="`${item.levelCode} , ${item.levelName}`" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -282,32 +297,26 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="业务人员" prop="salesPersonId">
|
|
|
- <el-select v-model="salesForm.salesPersonId" placeholder="请选择业务人员" class="w-full" filterable>
|
|
|
- <el-option label="张三" value="1" />
|
|
|
- <el-option label="李四" value="2" />
|
|
|
- <el-option label="王五" value="3" />
|
|
|
- <el-option label="赵六" value="4" />
|
|
|
+ <el-select v-model="salesForm.salesPersonId" placeholder="请选择业务人员" class="w-full" filterable @change="handleSalesPersonChange">
|
|
|
+ <el-option v-for="item in comStaffList" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="客服人员" prop="serviceStaffId">
|
|
|
<el-select v-model="salesForm.serviceStaffId" placeholder="请选择客服人员" class="w-full" filterable>
|
|
|
- <el-option label="客服A" value="1" />
|
|
|
- <el-option label="客服B" value="2" />
|
|
|
- <el-option label="客服C" value="3" />
|
|
|
- <el-option label="客服D" value="4" />
|
|
|
+ <el-option v-for="item in comStaffList" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="所属部门" prop="belongingDepartmentId">
|
|
|
<el-select v-model="salesForm.belongingDepartmentId" placeholder="请选择所属部门" class="w-full" filterable disabled>
|
|
|
- <el-option label="销售部" value="1" />
|
|
|
- <el-option label="市场部" value="2" />
|
|
|
- <el-option label="客服部" value="3" />
|
|
|
- <el-option label="技术部" value="4" />
|
|
|
+ <el-option v-for="item in comDeptList" :key="item.id" :label="item.deptName" :value="String(item.id)" />
|
|
|
</el-select>
|
|
|
+ <div v-if="salesForm.belongingDepartmentId && !comDeptList.length" style="color: #606266; font-size: 14px; margin-top: 4px">
|
|
|
+ {{ getDeptName(salesForm.belongingDepartmentId) }}
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -315,11 +324,13 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="信用等级" prop="creditManagement">
|
|
|
- <el-select v-model="salesForm.creditManagement" placeholder="请选择信用等级" class="w-full">
|
|
|
- <el-option label="A级" value="A" />
|
|
|
- <el-option label="B级" value="B" />
|
|
|
- <el-option label="C级" value="C" />
|
|
|
- <el-option label="D级" value="D" />
|
|
|
+ <el-select v-model="salesForm.creditManagement" placeholder="请选择信用等级" class="w-full" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in creditLevelList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="`${item.creditLevelNo} , ${item.creditLevelName}`"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -357,7 +368,9 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="收款条件" prop="accountPeriod">
|
|
|
- <el-input v-model="salesForm.accountPeriod" placeholder="请输入收款条件" />
|
|
|
+ <el-select v-model="salesForm.accountPeriod" placeholder="请选择收款条件" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in settlementMethodList" :key="item.id" :label="item.settlementName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -365,7 +378,9 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="结算方式" prop="payDays">
|
|
|
- <el-select v-model="salesForm.creditManagement" placeholder="请选择结算方式" class="w-full"> </el-select>
|
|
|
+ <el-select v-model="salesForm.payDays" placeholder="请选择结算方式" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in settlementMethodList" :key="item.id" :label="item.settlementName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -419,6 +434,14 @@ import type { CustomerInfoForm } from '@/api/customer/customerFile/customerInfo/
|
|
|
import type { BusinessInfoForm } from '@/api/customer/customerFile/businessInfo/types';
|
|
|
import type { SalesInfoForm } from '@/api/customer/customerFile/salesInfo/types';
|
|
|
import type { InvoiceInfoForm } from '@/api/customer/customerFile/invoiceInfo/types';
|
|
|
+import { listSettlementMethod } from '@/api/customer/settlementMethod';
|
|
|
+import { SettlementMethodVO, SettlementMethodQuery, SettlementMethodForm } from '@/api/customer/settlementMethod/types';
|
|
|
+import { listCustomerLevel, getCustomerLevel } from '@/api/customer/customerLevel';
|
|
|
+import { CustomerLevelVO, CustomerLevelQuery, CustomerLevelForm } from '@/api/customer/customerLevel/types';
|
|
|
+import { listCustomerType, getCustomerType } from '@/api/customer/customerType';
|
|
|
+import { CustomerTypeVO, CustomerTypeQuery, CustomerTypeForm } from '@/api/customer/customerType/types';
|
|
|
+import { listCreditLevel } from '@/api/customer/creditLevel';
|
|
|
+import { CreditLevelVO, CreditLevelQuery } from '@/api/customer/creditLevel/types';
|
|
|
import AddInvoiceDialog from '../components/addInvoiceDialog.vue';
|
|
|
import { regionData } from 'element-china-area-data';
|
|
|
import { listEnterpriseScale } from '@/api/customer/customerCategory/enterpriseScale';
|
|
|
@@ -427,8 +450,12 @@ import { listInvoiceType } from '@/api/customer/invoiceType';
|
|
|
import type { EnterpriseScaleVO } from '@/api/customer/customerCategory/enterpriseScale/types';
|
|
|
import type { IndustryCategoryVO } from '@/api/customer/customerCategory/industryCategory/types';
|
|
|
import type { InvoiceTypeVO } from '@/api/customer/invoiceType/types';
|
|
|
-import { listSysCompany } from '@/api/company/sysCompany';
|
|
|
-import type { SysCompanyVO } from '@/api/company/sysCompany/types';
|
|
|
+import { listCompany } from '@/api/company/company';
|
|
|
+import { CompanyVO } from '@/api/company/company/types';
|
|
|
+import { listComStaff } from '@/api/company/comStaff';
|
|
|
+import { ComStaffVO, ComStaffQuery } from '@/api/company/comStaff/types';
|
|
|
+import { listComDept } from '@/api/company/comDept';
|
|
|
+import { ComDeptVO } from '@/api/company/comDept/types';
|
|
|
import FileSelector from '@/components/FileSelector/index.vue';
|
|
|
import { Plus, Delete } from '@element-plus/icons-vue';
|
|
|
|
|
|
@@ -453,7 +480,13 @@ const codeArr = ref([]);
|
|
|
const enterpriseScaleList = ref<EnterpriseScaleVO[]>([]);
|
|
|
const industryCategoryList = ref<IndustryCategoryVO[]>([]);
|
|
|
const invoiceTypeList = ref<InvoiceTypeVO[]>([]);
|
|
|
-const companyList = ref<SysCompanyVO[]>([]);
|
|
|
+const companyList = ref<CompanyVO[]>([]);
|
|
|
+const settlementMethodList = ref<SettlementMethodVO[]>([]);
|
|
|
+const creditLevelList = ref<CreditLevelVO[]>([]);
|
|
|
+const customerLevelList = ref<CustomerLevelVO[]>([]);
|
|
|
+const customerTypeList = ref<CustomerTypeVO[]>([]);
|
|
|
+const comStaffList = ref<ComStaffVO[]>([]);
|
|
|
+const comDeptList = ref<ComDeptVO[]>([]);
|
|
|
|
|
|
// 企业基本信息(用于显示)
|
|
|
const customerInfo = reactive<any>({
|
|
|
@@ -574,6 +607,12 @@ onMounted(async () => {
|
|
|
await loadIndustryCategoryList();
|
|
|
await loadInvoiceTypeList();
|
|
|
await loadCompanyList();
|
|
|
+ await loadSettlementMethodList();
|
|
|
+ await loadCreditLevelList();
|
|
|
+ await loadCustomerLevelList();
|
|
|
+ await loadCustomerTypeList();
|
|
|
+ await loadComStaffList();
|
|
|
+ await loadComDeptList();
|
|
|
|
|
|
// 优先使用props传递的customerId,否则从路由获取
|
|
|
const id = props.customerId || route.query.id;
|
|
|
@@ -627,13 +666,78 @@ const loadInvoiceTypeList = async () => {
|
|
|
// 加载公司列表
|
|
|
const loadCompanyList = async () => {
|
|
|
try {
|
|
|
- const res = await listSysCompany();
|
|
|
+ const query: any = { isShow: '0' };
|
|
|
+ const res = await listCompany();
|
|
|
companyList.value = res.rows || [];
|
|
|
} catch (error) {
|
|
|
console.error('加载公司列表失败:', error);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+// 加载结算方式列表
|
|
|
+const loadSettlementMethodList = async () => {
|
|
|
+ try {
|
|
|
+ const query: any = { isShow: '0' };
|
|
|
+ const res = await listSettlementMethod(query);
|
|
|
+ settlementMethodList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载结算方式列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载信用等级列表
|
|
|
+const loadCreditLevelList = async () => {
|
|
|
+ try {
|
|
|
+ const query: CreditLevelQuery = { isShow: '0' };
|
|
|
+ const res = await listCreditLevel(query);
|
|
|
+ creditLevelList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载信用等级列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载客户等级列表
|
|
|
+const loadCustomerLevelList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listCustomerLevel();
|
|
|
+ customerLevelList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载客户等级列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载客户类别列表
|
|
|
+const loadCustomerTypeList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listCustomerType();
|
|
|
+ customerTypeList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载客户类别列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载员工列表
|
|
|
+const loadComStaffList = async () => {
|
|
|
+ try {
|
|
|
+ const query: ComStaffQuery = { status: '0' };
|
|
|
+ const res = await listComStaff(query);
|
|
|
+ comStaffList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载员工列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载部门列表
|
|
|
+const loadComDeptList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listComDept();
|
|
|
+ // 处理可能的不同返回结构
|
|
|
+ comDeptList.value = res.rows || res.data || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载部门列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
// 加载客户数据
|
|
|
const loadCustomerData = async (id: string) => {
|
|
|
try {
|
|
|
@@ -768,6 +872,16 @@ const handleChange = (val: string[]) => {
|
|
|
form.provincialCityCounty = names.join('/');
|
|
|
};
|
|
|
|
|
|
+// 处理业务人员选择变化
|
|
|
+const handleSalesPersonChange = (staffId: any) => {
|
|
|
+ // 根据选中的业务人员ID,找到对应的部门ID
|
|
|
+ const selectedStaff = comStaffList.value.find((staff) => staff.staffId === staffId);
|
|
|
+ if (selectedStaff) {
|
|
|
+ // 确保 deptId 的类型一致
|
|
|
+ salesForm.belongingDepartmentId = String(selectedStaff.deptId);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
// 打开添加开票信息对话框
|
|
|
const handleAddInvoice = () => {
|
|
|
currentInvoice.value = undefined;
|