ソースを参照

Merge branch 'master' of http://1.14.104.71:10880/txl/ylrz_saas_his_scrm_companyUI

lmx 1 ヶ月 前
コミット
f51ec786e6

+ 8 - 0
src/api/crm/customer.js

@@ -22,6 +22,14 @@ export function listCustomerAll(query) {
     params: query
   })
 }
+
+export function listNoPage(query) {
+  return request({
+    url: '/crm/customer/listNoPage',
+    method: 'get',
+    params: query
+  })
+}
 export function getCustomerList(query) {
   return request({
     url: '/crm/customer/getCustomerList',

+ 36 - 1
src/views/company/companyVoiceRobotic/index.vue

@@ -478,7 +478,20 @@
 
     <el-drawer title="呼叫客户列表" size="60%" :visible.sync="callees.show" width="800px" append-to-body>
       <el-table v-loading="callees.loading" :data="callees.list">
-        <el-table-column label="电话号码" align="center" prop="phone"/>
+        <el-table-column label="电话号码" align="center" prop="phone" width="150">
+          <template slot-scope="scope">
+            <span>{{ scope.row.phone }}</span>
+            <el-button
+              v-if="scope.row.userId"
+              icon="el-icon-search"
+              size="mini"
+              circle
+              style="margin-left: 5px;"
+              v-hasPermi="['crm:customer:queryPhone']"
+              @click="handleQueryPhone(scope.row)"
+            />
+          </template>
+        </el-table-column>
         <el-table-column label="客户名称" align="center" prop="userName"/>
         <el-table-column label="客户ID" align="center" prop="userId"/>
         <el-table-column label="客户意向度" align="center">
@@ -700,6 +713,15 @@
                           <span class="meta-item phone">
                             <i class="el-icon-phone-outline"></i>
                             {{ record.customerPhone }}
+                            <el-button
+                              v-if="record.customerId"
+                              icon="el-icon-search"
+                              size="mini"
+                              circle
+                              style="margin-left: 5px;"
+                              v-hasPermi="['crm:customer:queryPhone']"
+                              @click.stop="handleQueryPhone(record)"
+                            />
                           </span>
                           <span class="meta-divider">|</span>
                           <span class="meta-item node">
@@ -905,6 +927,7 @@ 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 { queryPhone } from "@/api/crm/customer";
 import {getDicts} from "@/api/system/dict/data";
 import { optionList, getWorkflowNodeTypeCodes } from '@/api/company/companyWorkflow'
 import {wxListQw} from "../../../api/company/companyVoiceRobotic";
@@ -1423,6 +1446,18 @@ export default {
         this.callees.loading = false;
       });
     },
+    handleQueryPhone(row) {
+      const customerId = row.customerId || row.userId;
+      if (!customerId) {
+        this.$message.warning("客户ID不存在");
+        return;
+      }
+      queryPhone(customerId).then(response => {
+        this.$alert(response.mobile, "手机号", {
+          confirmButtonText: "确定"
+        });
+      });
+    },
     wxOpen(id, isWeCom) {
       console.log("isWeCom="+isWeCom)
       if (isWeCom === 2) {

+ 36 - 1
src/views/company/companyVoiceRobotic/myIndex.vue

@@ -478,7 +478,20 @@
 
     <el-drawer title="呼叫客户列表" size="60%" :visible.sync="callees.show" width="800px" append-to-body>
       <el-table v-loading="callees.loading" :data="callees.list">
-        <el-table-column label="电话号码" align="center" prop="phone"/>
+        <el-table-column label="电话号码" align="center" prop="phone" width="150">
+          <template slot-scope="scope">
+            <span>{{ scope.row.phone }}</span>
+            <el-button
+              v-if="scope.row.userId"
+              icon="el-icon-search"
+              size="mini"
+              circle
+              style="margin-left: 5px;"
+              v-hasPermi="['crm:customer:queryPhone']"
+              @click="handleQueryPhone(scope.row)"
+            />
+          </template>
+        </el-table-column>
         <el-table-column label="客户名称" align="center" prop="userName"/>
         <el-table-column label="客户ID" align="center" prop="userId"/>
         <el-table-column label="客户意向度" align="center">
@@ -700,6 +713,15 @@
                           <span class="meta-item phone">
                             <i class="el-icon-phone-outline"></i>
                             {{ record.customerPhone }}
+                            <el-button
+                              v-if="record.customerId"
+                              icon="el-icon-search"
+                              size="mini"
+                              circle
+                              style="margin-left: 5px;"
+                              v-hasPermi="['crm:customer:queryPhone']"
+                              @click.stop="handleQueryPhone(record)"
+                            />
                           </span>
                           <span class="meta-divider">|</span>
                           <span class="meta-item node">
@@ -907,6 +929,7 @@ 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 { queryPhone } from "@/api/crm/customer";
 import {getDicts} from "@/api/system/dict/data";
 import { optionList, getWorkflowNodeTypeCodes } from '@/api/company/companyWorkflow'
 import {wxListQw} from "../../../api/company/companyVoiceRobotic";
@@ -1424,6 +1447,18 @@ export default {
         this.callees.loading = false;
       });
     },
+    handleQueryPhone(row) {
+      const customerId = row.customerId || row.userId;
+      if (!customerId) {
+        this.$message.warning("客户ID不存在");
+        return;
+      }
+      queryPhone(customerId).then(response => {
+        this.$alert(response.mobile, "手机号", {
+          confirmButtonText: "确定"
+        });
+      });
+    },
     wxOpen(id, isWeCom) {
       console.log("isWeCom="+isWeCom)
       if (isWeCom === 2) {

+ 91 - 82
src/views/crm/components/CustomerSelect.vue

@@ -96,6 +96,7 @@
           plain
           icon="el-icon-edit"
           size="mini"
+          :loading="conditionLoading"
           @click="checkWithCondition()"
         >按筛选条件选中
         </el-button>
@@ -151,6 +152,14 @@
           </template>
         </el-table-column>
       </el-table>
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        :page-sizes="pageSizes"
+        @pagination="getList"
+      />
       <div slot="footer" class="dialog-footer" style="width: 100%;display: flex;flex-direction: row-reverse;margin-top: 20px;z-index: 9898989;padding-top: 5px">
         <el-button type="primary" @click="submitForm" style="margin-bottom: 5px">确 定</el-button>
       </div>
@@ -213,9 +222,12 @@ export default {
       // 遮罩层
       loading: true,
       // 选中数组
+      rows: [],
       ids: [],
       names: [],
       userIds: [],
+      conditionLoading: false,
+      isSyncingSelection: false,
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -232,6 +244,8 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        pageNum: 1,
+        pageSize: 10,
         customerCode: null,
         customerName: null,
         mobile: null,
@@ -314,11 +328,49 @@ export default {
       this.getList();
     },
     initSelect(){
-      if(this.rows && this.rows.length > 0){
-        this.rows.forEach(row => {
-          this.$refs.table.toggleRowSelection(row);
-        })
+      this.syncTableSelection();
+    },
+    syncTableSelection(){
+      if (!this.$refs.table) {
+        return;
       }
+      this.isSyncingSelection = true;
+      const selectedIds = new Set((this.rows || []).map(item => item.customerId));
+      this.$refs.table.clearSelection();
+      this.$nextTick(() => {
+        this.customerList.forEach(row => {
+          if (selectedIds.has(row.customerId)) {
+            this.$refs.table.toggleRowSelection(row, true);
+          }
+        });
+        this.$nextTick(() => {
+          this.isSyncingSelection = false;
+        });
+      });
+    },
+    buildQueryParams(extraParams = {}) {
+      const params = Object.assign({}, this.queryParams, extraParams);
+      if (this.receiveTimeRange != null && this.receiveTimeRange.length === 2) {
+        params.receiveTimeRange = this.receiveTimeRange[0] + "--" + this.receiveTimeRange[1];
+      } else {
+        params.receiveTimeRange = null;
+      }
+      if (this.ctsTypeArr.length > 0) {
+        params.customerType = this.ctsTypeArr.toString();
+      } else {
+        params.customerType = null;
+      }
+      if (this.sourceArr.length > 0) {
+        params.source = this.sourceArr.toString();
+      } else {
+        params.source = null;
+      }
+      if (this.tagIds.length > 0) {
+        params.tags = this.tagIds.toString();
+      } else {
+        params.tags = null;
+      }
+      return params;
     },
     getRowKeys(item){
       return item.customerId;
@@ -382,32 +434,8 @@ export default {
     /** 查询客户列表 */
     getList() {
       this.loading = true;
-      if(this.receiveTimeRange!=null&&this.receiveTimeRange.length==2){
-        this.queryParams.receiveTimeRange=this.receiveTimeRange[0]+"--"+this.receiveTimeRange[1]
-      }
-      else{
-        this.queryParams.receiveTimeRange=null;
-      }
-      if(this.ctsTypeArr.length>0){
-        this.queryParams.customerType=this.ctsTypeArr.toString();
-      }
-      else{
-        this.queryParams.customerType=null
-      }
-
-      if(this.sourceArr.length>0){
-        this.queryParams.source=this.sourceArr.toString();
-      }
-      else{
-        this.queryParams.source=null
-      }
-      if(this.tagIds.length>0){
-        this.queryParams.tags=this.tagIds.toString();
-      }
-      else{
-        this.queryParams.tags=null
-      }
-      listCustomerAll(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      const params = this.buildQueryParams();
+      listCustomerAll(this.addDateRange(params, this.dateRange)).then(response => {
         this.customerList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -421,6 +449,7 @@ export default {
     },
     /** 搜索按钮操作 */
     handleQuery() {
+      this.queryParams.pageNum = 1;
       this.getList();
     },
     /** 重置按钮操作 */
@@ -429,11 +458,14 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      if (this.isSyncingSelection) {
+        return;
+      }
       this.rows = selection;
-      this.ids = selection.map(item => item.customerId)
-      this.names = selection.map(item => item.customerName)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
+      this.ids = selection.map(item => item.customerId);
+      this.names = selection.map(item => item.customerName);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
     },
     getTreeselect() {
         var that=this;
@@ -456,58 +488,35 @@ export default {
           this.getList();
     },
     submitForm(){
-      console.log(this.ids);
+      if (!this.rows || this.rows.length === 0) {
+        this.$message.warning("请至少选择一位客户");
+        return;
+      }
+      this.$emit("success", { ids: this.ids, names: this.names, rows: this.rows });
+      this.shows = false;
       this.$nextTick(() => {
-        this.$emit("success", {ids: this.ids, names: this.names, rows: this.rows})
-        this.shows = false;
-        this.$refs.table.clearSelection();
-      })
+        if (this.$refs.table) {
+          this.$refs.table.clearSelection();
+        }
+      });
     },
-    //按照筛选条件选择客户
+    // 按照筛选条件选择客户
     checkWithCondition(){
-
-    let queryParamNoPage = {};
-    queryParamNoPage = this.queryParams;
-    if(this.receiveTimeRange!=null&&this.receiveTimeRange.length==2){
-        queryParamNoPage.receiveTimeRange=this.receiveTimeRange[0]+"--"+this.receiveTimeRange[1]
-      }
-      else{
-        queryParamNoPage.receiveTimeRange=null;
-      }
-      if(this.ctsTypeArr.length>0){
-        queryParamNoPage.customerType=this.ctsTypeArr.toString();
-      }
-      else{
-        queryParamNoPage.customerType=null
-      }
-
-      if(this.sourceArr.length>0){
-        queryParamNoPage.source=this.sourceArr.toString();
-      }
-      else{
-        queryParamNoPage.source=null
-      }
-      if(this.tagIds.length>0){
-        queryParamNoPage.tags=this.tagIds.toString();
-      }
-      else{
-        queryParamNoPage.tags=null
-      }
-      listNoPage(this.addDateRange(queryParamNoPage, this.dateRange)).then(response => {
-        let resList = response.rows; 
-        this.ids = [];
-        this.names = [];
-        this.rows = [];
-        if(!!resList){
-          this.ids = resList.map(item => item.customerId);
-          this.names = resList.map(item => item.customerName);
-          this.rows = resList;
+      this.conditionLoading = true;
+      const params = this.buildQueryParams();
+      listNoPage(this.addDateRange(params, this.dateRange)).then(response => {
+        const resList = response.rows || [];
+        this.rows = resList;
+        this.ids = resList.map(item => item.customerId);
+        this.names = resList.map(item => item.customerName);
+        this.syncTableSelection();
+        if (resList.length === 0) {
+          this.$message.warning("当前筛选条件下没有可选择的客户");
+        } else {
+          this.$message.success(`已按筛选条件选中 ${resList.length} 位客户,点击确定完成回传`);
         }
-        this.$nextTick(() => {
-        this.$emit("success", {ids: this.ids, names: this.names, rows: this.rows})
-        this.shows = false;
-        this.$refs.table.clearSelection();
-      })
+      }).finally(() => {
+        this.conditionLoading = false;
       });
     }
   }

+ 9 - 3
src/views/crm/components/customerDetails.vue

@@ -19,9 +19,15 @@
                         <span class="meta-item">
                             <i class="el-icon-phone"></i>
                             {{ item.mobile || '未填写' }}
-                            <el-button type="text" v-hasPermi="['crm:customer:queryPhone']" size="mini"
-                                       @click="handleQueryPhone(item)" icon="el-icon-view"
-                            >查看</el-button>
+                            <el-button
+                              v-if="item.customerId"
+                              icon="el-icon-search"
+                              size="mini"
+                              circle
+                              style="margin-left: 8px;"
+                              v-hasPermi="['crm:customer:queryPhone']"
+                              @click="handleQueryPhone(item)"
+                            />
                           <!-- <el-button type="text" v-if="isReceive" size="mini"
                                      @click="callNumber(item.customerId,null,null,null)" icon="el-icon-phone-outline"
                           >拨打</el-button>