Explorar el Código

客户管理添加 多选客户来源

xgb hace 1 día
padre
commit
a6900333d6

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

@@ -107,7 +107,7 @@
         <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>
+            <el-tag prop="source" v-for="(item, index) in sourceOptions"  :key="'source'+index"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
           </template>
         </el-table-column>
 

+ 17 - 5
src/views/crm/components/addOrEditCustomer.vue

@@ -43,8 +43,8 @@
                         <el-radio :label="item.dictValue" v-for="item in statusOptions">{{item.dictLabel}}</el-radio>
                     </el-radio-group>
                 </el-form-item> -->
-                <el-form-item label="客户来源" prop="source">
-                <el-select v-model="form.source" placeholder="请选择客户来源" clearable size="small">
+                <el-form-item label="客户来源" prop="sourceArr">
+                <el-select multiple v-model="form.sourceArr" placeholder="请选择客户来源" clearable size="small">
                     <el-option
                         v-for="item in sourceOptions"
                         :key="item.dictValue"
@@ -167,7 +167,7 @@
                     mobile: [
                     { required: true, message: "手机号不能为空", trigger: "blur" }
                     ],
-                    source: [
+                    sourceArr: [
                     { required: true, message: "客户来源不能为空", trigger: "blur" }
                     ],
                 }
@@ -275,6 +275,7 @@
                     companyId: null,
                     isLine: null,
                     source: null,
+                    sourceArr: [],
                     tags: null,
                     
                 };
@@ -315,8 +316,10 @@
                     if(this.form.sex!=null){
                      this.form.sex = this.form.sex.toString();
                     }
-                    if(this.form.source!=null){
-                        this.form.source = this.form.source.toString();
+                    if(this.form.crmSource!=null){
+                        this.$set(this.form, 'sourceArr', this.form.crmSource.split(","));
+                    } else {
+                        this.$set(this.form, 'sourceArr', []);
                     }
                     if(this.form.tags!=null){
                         this.tags = this.form.tags.split(",")
@@ -358,6 +361,9 @@
                     if (valid) {
                         if (this.form.customerId != null) {
                             this.form.extJson=JSON.stringify(this.exts);
+                            if(this.form.sourceArr && this.form.sourceArr.length>0){
+                                this.form.crmSource=this.form.sourceArr.join(",");
+                            }
                             updateCustomer(this.form).then(response => {
                                 if (response.code === 200) {
                                     this.msgSuccess("操作成功");
@@ -367,6 +373,9 @@
                         } else {
                             this.form.extJson=JSON.stringify(this.exts);
                             if(this.addType==1){
+                                if(this.form.sourceArr && this.form.sourceArr.length>0){
+                                    this.form.crmSource=this.form.sourceArr.join(",");
+                                }
                                 addCustomer(this.form).then(response => {
                                     if (response.code === 200) {
                                         this.msgSuccess("操作成功");
@@ -375,6 +384,9 @@
                                 });
                             }
                             else if(this.addType==2){
+                                if(this.form.sourceArr && this.form.sourceArr.length>0){
+                                    this.form.crmSource=this.form.sourceArr.join(",");
+                                }
                                 addMyCustomer(this.form).then(response => {
                                     if (response.code === 200) {
                                         this.msgSuccess("操作成功");

+ 1 - 1
src/views/crm/components/customerDetails.vue

@@ -42,7 +42,7 @@
             </el-descriptions-item>
             <el-descriptions-item label="客户来源" >
                 <span v-if="item!=null">
-                    <el-tag  v-for="(dict, index) in sourceOptions"    v-if="item.source==dict.dictValue">{{dict.dictLabel}}</el-tag>
+                    <el-tag  v-for="(dict, index) in sourceOptions"    v-if="item.crmSource && (','+item.crmSource+',').indexOf(','+dict.dictValue+',') !== -1">{{dict.dictLabel}}</el-tag>
                 </span>
             </el-descriptions-item>
             <el-descriptions-item label="客户类型" >

+ 16 - 11
src/views/crm/components/editSource.vue

@@ -4,8 +4,8 @@
             <el-form-item label="客户数量" >
                 {{ids.length}}个
             </el-form-item>
-            <el-form-item label="客户来源" prop="source">
-                <el-select v-model="form.source" placeholder="请选择客户来源" clearable size="small">
+            <el-form-item label="客户来源" prop="sourceArr">
+                <el-select multiple v-model="form.sourceArr" placeholder="请选择客户来源" clearable size="small">
                     <el-option
                         v-for="item in sourceOptions"
                         :key="item.dictValue"
@@ -24,17 +24,19 @@
   
 <script>
 import { updateCustomerSource  } from "@/api/crm/customer";
-export default {
-        name: "customerVisit",
-        data() {
-            return {
-                sourceOptions:[],
-                ids:[],
-                // 表单参数
-                form: {},
+    export default {
+            name: "customerVisit",
+            data() {
+                return {
+                    sourceOptions:[],
+                    ids:[],
+                    // 表单参数
+                    form: {
+                        sourceArr: [],
+                    },
                 // 表单校验
                 rules: {
-                    source: [
+                    sourceArr: [
                     { required: true, message: "客户来源不能为空", trigger: "blur" }
                     ],
                 }
@@ -66,6 +68,9 @@ export default {
                             background: 'rgba(0, 0, 0, 0.7)'
                         });
                         this.form.ids=this.ids.toString();
+                        if(this.form.sourceArr && this.form.sourceArr.length>0){
+                            this.form.crmSource=this.form.sourceArr.join(",");
+                        }
                         updateCustomerSource(this.form).then(response => {
                             this.myloading.close()
                             if (response.code === 200) {

+ 1 - 1
src/views/crm/customer/assist.vue

@@ -188,7 +188,7 @@
       </el-table-column>
       <el-table-column  label="客户来源" align="center" prop="source">
         <template slot-scope="scope">
-            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
       <el-table-column  label="跟进阶段"  width="200" align="center" prop="visitStatus">

+ 1 - 1
src/views/crm/customer/full.vue

@@ -164,7 +164,7 @@
           </el-table-column>
           <el-table-column  label="客户来源" align="center" prop="source">
             <template slot-scope="scope">
-                <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+                <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
             </template>
           </el-table-column>
           <el-table-column  label="跟进阶段"  align="center" prop="visitStatus">

+ 4 - 11
src/views/crm/customer/index.vue

@@ -108,7 +108,7 @@
             </el-date-picker>
           </el-form-item>
           <el-form-item label="客户来源" prop="source">
-            <el-select style="width:220px" filterable multiple v-model="sourceArr" placeholder="请选择客户来源" clearable size="small">
+            <el-select style="width:220px" filterable v-model="queryParams.source" placeholder="请选择客户来源" clearable size="small">
               <el-option
                     v-for="item in sourceOptions"
                     :key="item.dictValue"
@@ -221,7 +221,7 @@
           </el-table-column>
           <el-table-column  label="客户来源" align="center" prop="source">
             <template slot-scope="scope">
-                <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+                <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
             </template>
           </el-table-column>
           <el-table-column  label="跟进阶段"  width="200" align="center" prop="visitStatus">
@@ -405,7 +405,7 @@ export default {
       tags:[],
       visitStatusArr:[],
       ctsTypeArr:[],
-      sourceArr:[],
+      sourceArr:[],// 保留供修改客户来源弹窗使用
       inputVisible: false,
       inputValue: '',
       receiveOptions:[],
@@ -683,13 +683,6 @@ export default {
         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();
       }
@@ -752,7 +745,7 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
-      this.sourceArr =  [];
+      this.queryParams.source = null;
       this.visitStatusArr =  [];
       this.tagIds =  [];
       this.ctsTypeArr =  [];

+ 1 - 1
src/views/crm/customer/line.vue

@@ -174,7 +174,7 @@
         </el-table-column>
         <el-table-column  label="客户来源" align="center" prop="source">
           <template slot-scope="scope">
-              <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+              <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
           </template>
         </el-table-column>
         <el-table-column  label="跟进阶段"  align="center" prop="visitStatus" >

+ 1 - 1
src/views/crm/customer/my.vue

@@ -172,7 +172,7 @@
       </el-table-column>
       <el-table-column  label="客户来源" align="center" prop="source">
         <template slot-scope="scope">
-            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
       <el-table-column  label="跟进阶段"  width="200" align="center" prop="visitStatus">

+ 1 - 1
src/views/qw/externalContact/customerDetails.vue

@@ -45,7 +45,7 @@
             </el-descriptions-item>
             <el-descriptions-item label="客户来源" >
                 <span v-if="item!=null">
-                    <el-tag  v-for="(dict, index) in sourceOptions"    v-if="item.source==dict.dictValue">{{dict.dictLabel}}</el-tag>
+                    <el-tag  v-for="(dict, index) in sourceOptions"    v-if="item.crmSource && (','+item.crmSource+',').indexOf(','+dict.dictValue+',') !== -1">{{dict.dictLabel}}</el-tag>
                 </span>
             </el-descriptions-item>
             <el-descriptions-item label="客户类型" >

+ 1 - 1
src/views/qw/externalContact/mycustomer.vue

@@ -45,7 +45,7 @@
       </el-table-column>
       <el-table-column  label="客户来源" align="center" prop="source">
         <template slot-scope="scope">
-            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
+            <el-tag prop="status" v-for="(item, index) in sourceOptions"    v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
       <el-table-column  label="跟进阶段"  width="200" align="center" prop="visitStatus">