|
@@ -40,8 +40,15 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
+ <!-- 企微主体(变更时只清空助手相关,不加载列表) -->
|
|
|
<el-form-item label="企微主体" prop="corpId">
|
|
<el-form-item label="企微主体" prop="corpId">
|
|
|
- <el-select v-model="queryParams.corpId" placeholder="请选择所属公司" filterable size="small">
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.corpId"
|
|
|
|
|
+ placeholder="请选择所属公司"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @change="handleCorpChange"
|
|
|
|
|
+ >
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="(option, index) in corpOptions"
|
|
v-for="(option, index) in corpOptions"
|
|
|
:key="index"
|
|
:key="index"
|
|
@@ -51,6 +58,25 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
+ <!-- 获客链接助手(点击下拉框才加载) -->
|
|
|
|
|
+ <el-form-item label="获客链接助手" prop="qwAcquisitionAssistantId" v-if="queryParams.corpId">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.qwAcquisitionAssistantId"
|
|
|
|
|
+ placeholder="请选择获客链接助手"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @change="handleQuery"
|
|
|
|
|
+ @visible-change="handleAssistantVisibleChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in qwAssistantOptions"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.linkName"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
<!-- 企微用户名:仅在“企微用户统计”Tab 下显示 -->
|
|
<!-- 企微用户名:仅在“企微用户统计”Tab 下显示 -->
|
|
|
<el-form-item label="企微用户名" prop="qwUserName" v-if="activeTab === 'account'">
|
|
<el-form-item label="企微用户名" prop="qwUserName" v-if="activeTab === 'account'">
|
|
|
<el-input
|
|
<el-input
|
|
@@ -175,7 +201,12 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { treeselect } from "@/api/company/companyDept";
|
|
import { treeselect } from "@/api/company/companyDept";
|
|
|
import { listCompanyUser } from "@/api/company/companyUser";
|
|
import { listCompanyUser } from "@/api/company/companyUser";
|
|
|
-import { getSalesStatistics, salesUserDetail, getSalesAccountStat } from "@/api/company/statistics";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ getSalesStatistics,
|
|
|
|
|
+ salesUserDetail,
|
|
|
|
|
+ getSalesAccountStat,
|
|
|
|
|
+ listSalesAcquisitionAssistants // 新增接口
|
|
|
|
|
+} from "@/api/company/statistics";
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import { allCorp } from "@/api/qw/qwCompany";
|
|
import { allCorp } from "@/api/qw/qwCompany";
|
|
@@ -211,9 +242,12 @@ export default {
|
|
|
orderByColumn: null,
|
|
orderByColumn: null,
|
|
|
isAsc: null,
|
|
isAsc: null,
|
|
|
corpId: null,
|
|
corpId: null,
|
|
|
- qwUserName: null
|
|
|
|
|
|
|
+ qwUserName: null,
|
|
|
|
|
+ qwAcquisitionAssistantId: null // 获客链接助手主键
|
|
|
},
|
|
},
|
|
|
corpOptions: [],
|
|
corpOptions: [],
|
|
|
|
|
+ qwAssistantOptions: [], // 获客链接助手列表
|
|
|
|
|
+ assistantLoadedCorpId: null, // 记录已加载助手列表的 corpId,避免重复加载
|
|
|
// 详情弹窗
|
|
// 详情弹窗
|
|
|
detailVisible: false,
|
|
detailVisible: false,
|
|
|
detailLoading: false,
|
|
detailLoading: false,
|
|
@@ -240,11 +274,9 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
/** 切换 Tab */
|
|
/** 切换 Tab */
|
|
|
handleTabClick() {
|
|
handleTabClick() {
|
|
|
- // 切换回汇总时,清空企微用户名搜索条件
|
|
|
|
|
if (this.activeTab === 'summary') {
|
|
if (this.activeTab === 'summary') {
|
|
|
this.queryParams.qwUserName = null;
|
|
this.queryParams.qwUserName = null;
|
|
|
}
|
|
}
|
|
|
- // 清空当前表格数据和分页,但不发送请求
|
|
|
|
|
if (this.activeTab === 'summary') {
|
|
if (this.activeTab === 'summary') {
|
|
|
this.summaryList = [];
|
|
this.summaryList = [];
|
|
|
} else {
|
|
} else {
|
|
@@ -302,8 +334,41 @@ export default {
|
|
|
this.userLoading = false;
|
|
this.userLoading = false;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- // 移除 this.handleQuery()
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+ /** 企微主体变更:清空助手相关数据,不加载列表 */
|
|
|
|
|
+ handleCorpChange(corpId) {
|
|
|
|
|
+ this.qwAssistantOptions = [];
|
|
|
|
|
+ this.queryParams.qwAcquisitionAssistantId = null;
|
|
|
|
|
+ this.assistantLoadedCorpId = null; // 标志重置
|
|
|
|
|
+ // 如果 corpId 被清空,无需额外操作;如果选择了新的,等待用户点击助手框再加载
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 获客链接助手下拉框可见性变化事件 */
|
|
|
|
|
+ handleAssistantVisibleChange(visible) {
|
|
|
|
|
+ if (!visible) return; // 仅处理展开
|
|
|
|
|
+
|
|
|
|
|
+ // 没有选择企微主体时,清空列表并返回
|
|
|
|
|
+ if (!this.queryParams.corpId) {
|
|
|
|
|
+ this.qwAssistantOptions = [];
|
|
|
|
|
+ this.assistantLoadedCorpId = null;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 若已加载过当前主体且列表不为空,则不再重复请求
|
|
|
|
|
+ if (this.assistantLoadedCorpId === this.queryParams.corpId && this.qwAssistantOptions.length > 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 请求接口加载列表
|
|
|
|
|
+ listSalesAcquisitionAssistants(this.queryParams.corpId).then(response => {
|
|
|
|
|
+ this.qwAssistantOptions = response.data || [];
|
|
|
|
|
+ this.assistantLoadedCorpId = this.queryParams.corpId;
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.qwAssistantOptions = [];
|
|
|
|
|
+ this.assistantLoadedCorpId = null;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
/** 进粉时间变更 */
|
|
/** 进粉时间变更 */
|
|
|
changeAddTime(val) {
|
|
changeAddTime(val) {
|
|
|
if (val) {
|
|
if (val) {
|
|
@@ -337,17 +402,18 @@ export default {
|
|
|
this.userList = [];
|
|
this.userList = [];
|
|
|
this.queryParams.orderByColumn = null;
|
|
this.queryParams.orderByColumn = null;
|
|
|
this.queryParams.isAsc = null;
|
|
this.queryParams.isAsc = null;
|
|
|
- // 重置后保留 queryForm 已清空 qwUserName,再手动确保
|
|
|
|
|
this.queryParams.qwUserName = null;
|
|
this.queryParams.qwUserName = null;
|
|
|
|
|
+ this.queryParams.qwAcquisitionAssistantId = null;
|
|
|
|
|
+ this.qwAssistantOptions = [];
|
|
|
|
|
+ this.assistantLoadedCorpId = null;
|
|
|
this.handleQuery();
|
|
this.handleQuery();
|
|
|
},
|
|
},
|
|
|
/** 获取列表数据(根据 activeTab 调不同接口) */
|
|
/** 获取列表数据(根据 activeTab 调不同接口) */
|
|
|
getList() {
|
|
getList() {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- // 构建请求参数,确保汇总标签不传入 qwUserName
|
|
|
|
|
const params = { ...this.queryParams };
|
|
const params = { ...this.queryParams };
|
|
|
if (this.activeTab === "summary") {
|
|
if (this.activeTab === "summary") {
|
|
|
- params.qwUserName = undefined; // 移除该字段
|
|
|
|
|
|
|
+ params.qwUserName = undefined;
|
|
|
}
|
|
}
|
|
|
const request = this.activeTab === "summary"
|
|
const request = this.activeTab === "summary"
|
|
|
? getSalesStatistics(params)
|
|
? getSalesStatistics(params)
|
|
@@ -367,7 +433,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
/** 打开详情弹窗 */
|
|
/** 打开详情弹窗 */
|
|
|
handleDetail(row) {
|
|
handleDetail(row) {
|
|
|
- // 兼容汇总表 (userId) 和账号表 (companyUserId)
|
|
|
|
|
const userId = row.userId || row.companyUserId;
|
|
const userId = row.userId || row.companyUserId;
|
|
|
if (!userId) return;
|
|
if (!userId) return;
|
|
|
this.detailVisible = true;
|
|
this.detailVisible = true;
|