ソースを参照

个微管理增加企微+个微的页面绑定

peicj 17 時間 前
コミット
7303bdba68

+ 7 - 0
src/api/company/companyVoiceRobotic.js

@@ -149,3 +149,10 @@ export function getExecRecords(roboticId) {
     params: { roboticId }
   })
 }
+export function wxListQw(params) {
+  return request({
+    url: 'company/companyVoiceRobotic/wxListQw',
+    method: 'get',
+    params
+  })
+}

+ 12 - 3
src/api/qw/qwUser.js

@@ -8,11 +8,20 @@ export function getQwUserAll() {
   })
 }
 
-// 根据条件查询企微用户列表
-export function getQwList(params) {
+// 查销售所在企业
+export function queryQwList(params) {
   return request({
-    url: '/qw/user/qwList',
+    url: '/qw/user/queryQwList',
     method: 'get',
     params: params
   })
 }
+//查全部
+export function getUserList(params) {
+  return request({
+    url: '/qw/user/userList',
+    method: 'get',
+    params: params
+  })
+}
+

+ 133 - 21
src/views/company/companyVoiceRobotic/index.vue

@@ -85,6 +85,12 @@
           <el-tag v-if="scope.row.addType == 1">意向</el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="添加类型" align="center" prop="isWeCom">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.isWeCom == 1">个微</el-tag>
+          <el-tag v-if="scope.row.isWeCom == 2">企微</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="任务状态" align="center">
         <template slot-scope="scope">
             <el-tag v-if="scope.row.taskStatus == 0">未启动</el-tag>
@@ -117,7 +123,7 @@
           <el-button
             size="mini"
             type="text"
-            @click="wxOpen(scope.row.id)"
+            @click="wxOpen(scope.row.id,scope.row.isWeCom)"
             v-hasPermi="['system:companyVoiceRobotic:list']"
           >加微管理</el-button>
           <el-button
@@ -249,8 +255,21 @@
             <div class="section-title">
               <i class="el-icon-user-solid"></i>
               <span>分配账号</span>
-              <el-button type="primary" size="mini" icon="el-icon-plus" @click="addQwUser" plain>添加</el-button>
             </div>
+            <el-form-item label="添加类型" prop="isWeCom">
+              <el-radio-group v-model="form.isWeCom">
+                <el-radio :label="1" border>
+                  <i class="el-icon-pie-chart"></i>
+                  个微
+                </el-radio>
+                <el-radio :label="2" border>
+                  <i class="el-icon-star-on"></i>
+                  企微
+                </el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-button type="primary" size="mini" icon="el-icon-plus" @click="addQwUser" plain>添加</el-button>
+
             <div class="account-list" v-if="form.qwUser && form.qwUser.length">
               <div v-for="(item, index) in form.qwUser" :key="index" class="account-item">
                 <el-row :gutter="12">
@@ -261,7 +280,7 @@
                   </el-col>
                   <el-col :span="form.addType == 1 ? 7 : 10">
                     <el-button icon="el-icon-user" @click="openQwUserSelect(index)" size="small" style="width: 100%;">
-                      选择企微
+                      选择账号
                       <el-tag v-if="item.companyUserId && item.companyUserId.length" type="success" size="mini" style="margin-left: 6px;">
                         {{ item.companyUserId.length }}
                       </el-tag>
@@ -316,7 +335,11 @@
       </div>
     </el-drawer>
     <customer-select @success="selectFun" ref="customer"/>
-    <qw-user-select @success="selectQwUserFun" ref="qwUserSelect"/>
+    <component
+      :is="getCurrentComponent()"
+      @success="selectQwUserFun"
+      ref="dynamicQwUserSelect"
+    />
 
     <el-drawer title="呼叫客户列表" size="60%" :visible.sync="callees.show" width="800px" append-to-body>
       <el-table v-loading="callees.loading" :data="callees.list">
@@ -347,7 +370,7 @@
         @pagination="getCalleesList"
       />
     </el-drawer>
-    <el-drawer title="加微详情" size="60%" :visible.sync="wx.show" append-to-body>
+    <el-drawer title="加微详情" size="60%" :visible.sync="wx.show" append-to-body>
       <el-table v-loading="wx.loading" :data="wx.list">
         <el-table-column label="意向等级" align="center" prop="intention"/>
         <el-table-column label="微信昵称" align="center" prop="wxNickName"/>
@@ -367,6 +390,25 @@
         @pagination="getWxList"
       />
     </el-drawer>
+    <el-drawer title="加企微详情" size="60%" :visible.sync="qw.show" append-to-body>
+      <el-table v-loading="qw.loading" :data="qw.list">
+        <el-table-column label="意向等级" align="center" prop="intention"/>
+        <el-table-column label="企微昵称" align="center" prop="wxNickName"/>
+        <el-table-column label="企微id" align="center" prop="wxNo"/>
+        <el-table-column label="手机号" align="center" prop="phone"/>
+        <el-table-column label="话术" align="center" prop="dialogName"/>
+        <el-table-column label="分配数量" align="center" prop="num"/>
+        <el-table-column label="添加数量" align="center" prop="addNum"/>
+      </el-table>
+
+      <pagination
+        v-show="qw.total>0"
+        :total="qw.total"
+        :page.sync="qw.queryParams.pageNum"
+        :limit.sync="qw.queryParams.pageSize"
+        @pagination="getWxListQw"
+      />
+    </el-drawer>
 
     <!-- 执行日志对话框 -->
     <el-drawer
@@ -538,13 +580,15 @@ import draggable from 'vuedraggable'
 import { listAll } from '@/api/company/wxDialog';
 import customerSelect from '@/views/crm/components/CustomerSelect.vue';
 import qwUserSelect from '@/views/components/QwUserSelect.vue';
+import qwUserSelectTwo from '@/views/components/QwUserSelectTwo.vue';
 import customerDetails from "@/views/crm/components/customerDetails.vue";
 import {getDicts} from "@/api/system/dict/data";
 import { optionList } from '@/api/company/companyWorkflow'
+import {wxListQw} from "../../../api/company/companyVoiceRobotic";
 
 export default {
   name: "Robotic",
-  components: { draggable, customerDetails, customerSelect, qwUserSelect},
+  components: { draggable, customerDetails, customerSelect, qwUserSelect,qwUserSelectTwo},
   data() {
     return {
       // 遮罩层
@@ -603,7 +647,7 @@ export default {
       // 表单参数
       form: {},
       taskFlowList: [{key: "cellPhone", value: "外呼"}, {key: "sendMsg", value: "发短信"}, {key: "addWx", value: "加微"}],
-      taskFlowMap: {cellPhone: "外呼", sendMsg: "发短信", addWx: "加微"},
+      taskFlowMap: {cellPhone: "外呼", sendMsg: "发短信", addWx: "加微", qwAddWx: "企微加个微"},
       statusObj: {},
       levelList: {},
       robotList: [],
@@ -639,6 +683,17 @@ export default {
           pageSize: 10,
         },
       },
+      qw: {
+        show: false,
+        list: [],
+        loading: false,
+        total: 0,
+        queryParams: {
+          id: null,
+          pageNum: 1,
+          pageSize: 10,
+        },
+      },
       execLogs: {
         show: false,
         loading: false,
@@ -697,6 +752,32 @@ export default {
       console.log(res);
     });
   },
+  watch: {
+    // 监听添加类型的切换,清空选择器数据
+    'form.isWeCom': {
+      handler(newVal, oldVal) {
+        // 只有当值真正发生变化时才执行清空操作
+        if (newVal !== oldVal && oldVal !== undefined) {
+          // 清空 qwUser 数组中的选择数据
+          if (this.form.qwUser && this.form.qwUser.length > 0) {
+            this.form.qwUser.forEach(item => {
+              item.companyUserId = []; // 清空已选择的账号ID
+            });
+          }
+
+          // 清空选择器列表数据
+          this.selectQwUserList = [];
+
+          // 重置当前选择索引
+          this.thisQwUserIndex = 0;
+
+          // 强制更新视图
+          this.$forceUpdate();
+        }
+      },
+      immediate: false
+    }
+  },
   methods: {
     getSmsTempDropList(){
       getSmsTempList().then(res=>{
@@ -765,7 +846,8 @@ export default {
         userTableList: [],
         companyAiWorkflowId: null,
         runtimeRangeStart:null,
-        runtimeRangeEnd:null
+        runtimeRangeEnd:null,
+        isWeCom: 1,
       };
       this.resetForm("form");
     },
@@ -808,13 +890,13 @@ export default {
           if (this.form.weekDay && this.form.weekDay.length > 0) {
             this.form.weekDay1 = this.form.weekDay.join(",")
           }
-          
+
           // 验证加微方案
           if(!this.form.qwUser || this.form.qwUser.length == 0){
             this.msgError("请添加分配账号");
             return;
           }
-          
+
           // 验证每个账号是否选择了企微和话术
           for(let i = 0; i < this.form.qwUser.length; i++) {
             const account = this.form.qwUser[i];
@@ -827,7 +909,7 @@ export default {
             //   return;
             // }
           }
-          
+
           let list = [];
           this.form.qwUser.forEach(l => {
             list = list.concat(l.companyUserId.map(e => {return {intention: l.intention, companyUserId: e,wxDialogId: l.wxDialogId,smsTempId:l.smsTempId}}))
@@ -898,12 +980,12 @@ export default {
     openSelect() {
       this.$refs.customer.setRows(this.form.userTableList || []);
     },
-    openQwUserSelect(index) {
-      this.thisQwUserIndex = index;
-      this.$nextTick(() => {
-        this.$refs.qwUserSelect.setRows(this.selectQwUserList[index]);
-      })
-    },
+    // openQwUserSelect(index) {
+    //   this.thisQwUserIndex = index;
+    //   this.$nextTick(() => {
+    //     this.$refs.qwUserSelect.setRows(this.selectQwUserList[index]);
+    //   })
+    // },
     selectFun(e) {
       this.form.userIds = e.ids;
       this.form.userNames = e.names;
@@ -928,10 +1010,25 @@ export default {
         this.callees.loading = false;
       });
     },
-    wxOpen(id){
-      this.wx.show = true;
-      this.wx.queryParams.id = id;
-      this.getWxList();
+    wxOpen(id, isWeCom) {
+      console.log("isWeCom="+isWeCom)
+      if (isWeCom === 2) {
+        this.qw.show = true;
+        this.qw.queryParams.id = id;
+        this.getWxListQw();
+      } else {
+        this.wx.show = true;
+        this.wx.queryParams.id = id;
+        this.getWxList();
+      }
+    },
+    getWxListQw() {
+      this.qw.loading = true;
+      wxListQw(this.qw.queryParams).then(response => {
+        this.qw.list = response.rows;
+        this.qw.total = response.total;
+        this.qw.loading = false;
+      });
     },
     getWxList() {
       this.wx.loading = true;
@@ -1058,6 +1155,21 @@ export default {
       const remainSeconds = seconds % 60;
       return minutes + 'm' + remainSeconds + 's';
     },
+    // 获取当前应该使用的组件
+    getCurrentComponent() {
+      return this.form.isWeCom === 2 ? 'qwUserSelectTwo' : 'qwUserSelect';
+    },
+
+    openQwUserSelect(index) {
+      this.thisQwUserIndex = index;
+      this.$nextTick(() => {
+        // 根据 isWeCom 的值选择对应的组件引用
+        const componentRef = this.form.isWeCom === 2 ? this.$refs.dynamicQwUserSelect : this.$refs.dynamicQwUserSelect;
+        if (componentRef && typeof componentRef.setRows === 'function') {
+          componentRef.setRows(this.selectQwUserList[index]);
+        }
+      })
+    },
     // 获取头像颜色
     getAvatarColor(index) {
       const colors = ['#1890ff', '#52c41a', '#faad14', '#722ed1', '#eb2f96'];

+ 3 - 3
src/views/components/QwUserSelect.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-drawer size="75%" title="选择微账号" :visible.sync="shows" append-to-body destroy-on-close class="qw-user-select-drawer">
+  <el-drawer size="75%" title="选择微账号" :visible.sync="shows" append-to-body destroy-on-close class="qw-user-select-drawer">
     <div class="drawer-container">
       <!-- 搜索表单 -->
       <el-card shadow="never" class="search-card">
@@ -62,10 +62,10 @@
         </el-form>
       </el-card>
 
-      <!-- 微账号列表 -->
+      <!-- 微账号列表 -->
       <el-card shadow="never" class="table-card">
         <div slot="header" class="card-header">
-          <span>微账号列表</span>
+          <span>微账号列表</span>
           <el-tag v-if="selectedRows.length" type="success">已选择 {{ selectedRows.length }} 个账号</el-tag>
         </div>
         <el-table border v-loading="loading" :data="customerList" :row-key="getRowKeys" @selection-change="handleSelectionChange" size="small" ref="table" height="500">

+ 218 - 0
src/views/components/QwUserSelectTwo.vue

@@ -0,0 +1,218 @@
+<template>
+  <el-drawer size="75%" title="选择企微账号" :visible.sync="shows" append-to-body destroy-on-close class="qw-user-select-drawer">
+    <div class="drawer-container">
+      <!-- 搜索表单 -->
+      <el-card shadow="never" class="search-card">
+        <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px" class="search-form">
+          <el-row :gutter="16">
+            <el-col :span="6">
+            <el-form-item label="销售公司" prop="companyId">
+              <el-select v-model="queryParams.companyId" placeholder="销售公司" size="small" @change="handleCompanyChange">
+                <el-option
+                  v-for="dict in qwCompanyList"
+                  :key="dict.companyId"
+                  :label="dict.companyName"
+                  :value="dict.companyId"
+                />
+              </el-select>
+            </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="企微用户名" prop="qwUserName">
+                <el-input v-model="queryParams.qwUserName" placeholder="请输入企微用户名" clearable size="small" @keyup.enter.native="handleQuery"/>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="企微用户 ID" prop="qwUserId">
+                <el-input v-model="queryParams.qwUserId" placeholder="请输入企微用户 ID" clearable size="small" @keyup.enter.native="handleQuery"/>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item>
+                <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
+                <el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </el-card>
+
+      <!-- 企微账号列表 -->
+      <el-card shadow="never" class="table-card">
+        <div slot="header" class="card-header">
+          <span>企微账号列表</span>
+          <el-tag v-if="selectedRows.length" type="success">已选择 {{ selectedRows.length }} 个账号</el-tag>
+        </div>
+        <el-table border v-loading="loading" :data="qwUserList" :row-key="getRowKeys" @selection-change="handleSelectionChange" size="small" ref="table" height="500">
+          <el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
+          <el-table-column label="企微用户名" align="center" prop="qwUserName"/>
+          <el-table-column label="企微用户id" align="center" prop="qwUserId"/>
+          <el-table-column label="uid" align="center" prop="uid"/>
+          <el-table-column label="ipad服务器id" align="center" prop="server_id"/>
+        </el-table>
+
+        <!-- 分页组件 -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+          style="margin-top: 20px;"
+        />
+      </el-card>
+
+      <!-- 底部按钮 -->
+      <div class="footer-actions">
+        <el-button @click="shows = false">取 消</el-button>
+        <el-button type="primary" @click="submitForm">确定选择</el-button>
+      </div>
+    </div>
+  </el-drawer>
+</template>
+
+<script>
+import {queryQwList} from "../../api/qw/qwUser";
+import {listCompany} from "../../api/company/company";
+
+export default {
+  name: "QwUserSelectTwo",
+  data() {
+    return {
+      rows: [], // 已选择的行数据
+      selectedRows: [], // 已选择的行数据(别名)
+      shows: false,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 总条数
+      total: 0,
+      // 企微账号表格数据
+      qwUserList: [],
+      qwCompanyList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        companyId: null,
+        qwUserName: null,
+        qwUserId: null
+      }
+    };
+  },
+  methods: {
+    // 获取企业数据
+    getCompanyData() {
+      listCompany().then(response => {
+        this.qwCompanyList = response.rows;
+        // 默认选中第一个企业
+        if (this.qwCompanyList && this.qwCompanyList.length > 0) {
+          this.queryParams.companyId = this.qwCompanyList[0].companyId;
+          // 重新加载页面数据
+          this.handleQuery();
+        }
+      });
+    },
+    // 企业改变时触发查询
+    handleCompanyChange() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    setRows(rows){
+      this.shows = true;
+      this.rows = rows || [];
+      this.selectedRows = rows || []; // 同步更新
+      this.getList();
+      // 获取企业列表并默认选中第一个
+      this.getCompanyData();
+    },
+    initSelect(){
+      let row = this.rows;
+      if(row && row.length > 0 && this.$refs.table){
+        row.forEach(row => {
+          this.$refs.table.toggleRowSelection(row, true);
+        })
+      }
+    },
+    getRowKeys(item){
+      return item.id;
+    },
+    /** 查询企微账号列表 */
+    getList() {
+      this.loading = true;
+      queryQwList(this.queryParams).then(response => {
+        if (this.$refs.table) {
+          this.$refs.table.clearSelection();
+        }
+        this.qwUserList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+        this.initSelect();
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.queryParams.pageNum = 1;
+      this.queryParams.pageSize = 10;
+      // 重置后选中第一个企业
+      if (this.qwCompanyList && this.qwCompanyList.length > 0) {
+        this.queryParams.companyId = this.qwCompanyList[0].companyId;
+      }
+      this.getList();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.rows = selection;
+      this.selectedRows = selection; // 同步更新
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    submitForm(){
+      this.$nextTick(() => {
+        this.$emit("success", {ids: this.ids, rows: this.rows})
+        this.shows = false;
+        this.$refs.table.clearSelection();
+      })
+    },
+  }
+};
+</script>
+<style scoped>
+  .el-tag + .el-tag {
+    margin-left: 10px;
+  }
+  .button-new-tag {
+    margin-left: 10px;
+    height: 32px;
+    line-height: 30px;
+    padding-top: 0;
+    padding-bottom: 0;
+  }
+  .input-new-tag {
+    width: 90px;
+    margin-left: 10px;
+    vertical-align: bottom;
+  }
+  .el-dialog__wrapper{
+    z-index: 100000;
+  }
+  .app-container{padding: 0}
+  .dialog-footer{
+    position: absolute;
+    bottom: 0;
+    right: 20px;
+    background: #FFF;
+  }
+</style>

+ 2 - 2
src/views/crm/components/CustomerSelect.vue

@@ -104,7 +104,7 @@
         </el-table-column>
         <el-table-column label="微信号" align="center" prop="weixin" width="95"/>
         <el-table-column label="所在地" align="center" prop="address" />
-        <el-table-column label="标签" align="center" prop="tags" width="100" show-overflow-tooltip="true"/>
+        <el-table-column label="标签" align="center" prop="tags" width="100" :show-overflow-tooltip="true"/>
         <el-table-column  label="客户来源" align="center" prop="source">
           <template slot-scope="scope">
             <el-tag prop="source" v-for="(item, index) in sourceOptions"  :key="'source'+index"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
@@ -285,7 +285,7 @@ export default {
       this.companys = response.data;
     });
     this.getCitys();
-    // this.getList();
+    this.getList();
   },
   methods: {
     setRows(rows){