|
|
@@ -300,7 +300,12 @@
|
|
|
<el-table-column label="手机号" align="center" prop="phone" min-width="150" />
|
|
|
<el-table-column label="固定电话" align="center" prop="officePhone" min-width="150" />
|
|
|
<el-table-column label="邮箱地址" align="center" prop="email" min-width="180" />
|
|
|
- <el-table-column label="备注信息" align="center" prop="remark" min-width="180" />
|
|
|
+ <el-table-column label="主联系人" align="center" prop="isPrimary">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.isPrimary == '0' ? '是' : '否' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column label="备注信息" align="center" prop="remark" min-width="180" /> -->
|
|
|
<el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-button link type="primary" @click="handleEditContact(row, $index)">编辑</el-button>
|
|
|
@@ -562,6 +567,17 @@ const handleLogoSelected = (files: any[]) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/** 状态修改 */
|
|
|
+const handlePrimaryChange = async (row: any) => {
|
|
|
+ if (row.isPrimary === '0') {
|
|
|
+ contactList.value.forEach((item) => {
|
|
|
+ if (item.id !== row.id) {
|
|
|
+ item.isPrimary = '1';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const handCompanyChange = async (val) => {
|
|
|
try {
|
|
|
try {
|
|
|
@@ -791,7 +807,8 @@ const loadComDeptList = async () => {
|
|
|
|
|
|
// 打开添加联系人对话框
|
|
|
const handleAddContact = () => {
|
|
|
- currentContact.value = undefined;
|
|
|
+ // 第一个联系人默认为主联系人,后面的默认为非主联系人
|
|
|
+ currentContact.value = contactList.value.length === 0 ? ({ isPrimary: '0' } as CustomerContactForm) : ({ isPrimary: '1' } as CustomerContactForm);
|
|
|
currentContactIndex.value = -1;
|
|
|
contactDialogVisible.value = true;
|
|
|
};
|
|
|
@@ -882,10 +899,12 @@ const handleEditContact = (row: CustomerContactForm, index: number) => {
|
|
|
|
|
|
// 确认添加/编辑联系人
|
|
|
const handleContactConfirm = (data: CustomerContactForm) => {
|
|
|
- // 如果新增/编辑的是主联系人(isPrimary === '0'),将其他所有联系人设置为非主联系人
|
|
|
+ // 如果新增/编辑的是主联系人,将其他联系人置为非主联系人
|
|
|
if (data.isPrimary === '0') {
|
|
|
- contactList.value.forEach((item) => {
|
|
|
- item.isPrimary = '1';
|
|
|
+ contactList.value.forEach((item, index) => {
|
|
|
+ if (index !== currentContactIndex.value) {
|
|
|
+ item.isPrimary = '1';
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|