Browse Source

优化益寿缘销售端信息采集表校验

cgp 1 day ago
parent
commit
89a8a8ae76

+ 16 - 1
src/views/qw/externalContact/collection.vue

@@ -114,6 +114,10 @@ export default {
       callback();
     };
     return {
+      extraParams: {
+        companyId: null,
+        companyUserId: null
+      },
       form: {
         id: null,
         questionId: null,
@@ -182,6 +186,11 @@ export default {
     this.getAllPrivatePackge();
   },
   methods: {
+    // 新增:用于接收主页面传来的公司id和销售id
+    setExtraParams(params) {
+      console.log('【collection】接收到 extraParams:', params);
+      this.extraParams = { ...params };
+    },
     handleIsPackageChange(value) {
       if (value === 0) {
         this.form.packageId = null;
@@ -287,6 +296,7 @@ export default {
         allergy: '',
         remark: ''
       };
+      this.extraParams = { companyId: null, companyUserId: null };
     },
 
     //选择问答模板
@@ -332,7 +342,12 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           // 深拷贝表单数据,避免直接修改原始 form
-          const submitData = { ...this.form };
+          const submitData = {
+            ...this.form,
+            userId: this.userId,
+            companyId: this.extraParams.companyId,
+            companyUserId: this.extraParams.companyUserId
+          };
           submitData.userId = this.userId;
 
           // 如果未关联产品疗法,清除相关字段(避免传 null/0 等无效值)

+ 13 - 5
src/views/qw/externalContact/index.vue

@@ -1240,13 +1240,21 @@ export default {
                  this.$refs.userDetails.getDetails(row.fsUserId);
             }, 1);
     },
-    handleInfoCollection(row){
-      this.collection.title = "信息采集";
+    handleInfoCollection(row) {
       this.collection.open = true;
+      this.collection.title = "信息采集";
       this.userId = row.fsUserId;
-      setTimeout(() => {
-                 this.$refs.collection.getCollectionInfo(row.fsUserId);
-            }, 1);
+      this.$nextTick(() => {
+        if (this.$refs.collection) {
+          this.$refs.collection.setExtraParams({
+            companyId: row.companyId,
+            companyUserId: row.companyUserId
+          });
+          this.$refs.collection.getCollectionInfo(row.fsUserId);
+        } else {
+          console.error('$refs.collection 不存在!');
+        }
+      });
     },
     closeCollection(){
       this.collection.open = false;

+ 13 - 5
src/views/qw/externalContact/myExternalContact.vue

@@ -921,7 +921,7 @@
         />
       </div>
     </el-drawer>
-    
+
     <el-drawer
         :with-header="false"
         size="75%"
@@ -1314,12 +1314,20 @@ export default {
     },
 
     handleInfoCollection(row){
-      this.collection.title = "信息采集";
       this.collection.open = true;
+      this.collection.title = "信息采集";
       this.userId = row.fsUserId;
-      setTimeout(() => {
-                 this.$refs.collection.getCollectionInfo(row.fsUserId);
-            }, 1);
+      this.$nextTick(() => {
+        if (this.$refs.collection) {
+          this.$refs.collection.setExtraParams({
+            companyId: row.companyId,
+            companyUserId: row.companyUserId
+          });
+          this.$refs.collection.getCollectionInfo(row.fsUserId);
+        } else {
+          console.error('$refs.collection 不存在!');
+        }
+      });
     },
     closeCollection(){
       this.collection.open = false;