gaoluyang
8 小时以前 44177e4d6906a1469efdfd64d652bf05bce5b065
src/views/basicData/customerFile/index.vue
@@ -32,6 +32,9 @@
                   plain
                   icon="Upload"
                   @click="handleImport">导入</el-button>
        <el-button type="warning"
                   plain
                   @click="handleSyncPublic">同步公海</el-button>
        <el-button type="danger"
                   plain
                   @click="handleDelete">删除</el-button>
@@ -670,6 +673,7 @@
    delCustomerFollow,
    addReturnVisit,
    getReturnVisit,
    throwCustomer,
  } from "@/api/basicData/customerFile.js";
  import { ElMessageBox } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
@@ -1221,6 +1225,51 @@
      });
  };
  // 同步公海 - 将选中的客户扔回公海
  const handleSyncPublic = () => {
    if (selectedRows.value.length === 0) {
      proxy.$modal.msgWarning("请选择要同步的客户");
      return;
    }
    // 检查是否有公海类型的客户
    const publicSeaData = selectedRows.value.filter(
      item => item.type === 1 || item.type === "1"
    );
    if (publicSeaData.length > 0) {
      const names = publicSeaData.map(item => item.customerName).join("、");
      proxy.$modal.msgWarning(`公海客户不能同步:${names}`);
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
    const customerNames = selectedRows.value.map(item => item.customerName).join("、");
    const confirmText = selectedRows.value.length === 1
      ? `确定要将客户【${customerNames}】同步到公海吗?`
      : `确定要将选中的 ${selectedRows.value.length} 个客户同步到公海吗?\n\n客户:${customerNames}`;
    ElMessageBox.confirm(
      confirmText,
      "同步提示",
      {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }
    )
      .then(() => {
        tableLoading.value = true;
        throwCustomer(ids)
          .then(() => {
            proxy.$modal.msgSuccess("同步公海成功");
            getList();
          })
          .finally(() => {
            tableLoading.value = false;
          });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
  // 打开回访提醒弹窗
  const openReminderDialog = row => {
    currentCustomerId.value = row.id;