Selaa lähdekoodia

跨公司转接接替员工列表缓存问题处理

Long 1 viikko sitten
vanhempi
commit
cbb12bf8bd

+ 4 - 1
src/views/qw/externalContactTransfer/companyTransfer.vue

@@ -230,7 +230,7 @@
           </div>
         </el-form-item>
         <el-card>
-          <companyTransferQwUserSelect :corpId="queryParams.corpId" :companyId="companyId" @selectUser="selectUser"/>
+          <companyTransferQwUserSelect ref="companyTransferSelect" @selectUser="selectUser"/>
         </el-card>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -415,6 +415,9 @@ export default {
       this.submitLoading = false
       this.title = "分配客户"
       this.open = true
+      this.$nextTick(() => {
+        this.$refs.companyTransferSelect.load(this.queryParams.corpId, this.companyId)
+      })
     },
     selectUser(selection) {
       this.form.qwUserId = selection.id

+ 13 - 21
src/views/qw/externalContactTransfer/companyTransferQwUserSelect.vue

@@ -61,16 +61,6 @@ import { getCompanyListByCorId } from '@/api/company/company'
 
 export default {
   name: "companyTransferQwUserSelect",
-  props: {
-    corpId: {
-      type: String,
-      default: null
-    },
-    companyId: {
-      type: Number,
-      default: null
-    }
-  },
   data() {
     return {
       // 遮罩层
@@ -92,17 +82,19 @@ export default {
       },
     };
   },
-  created() {
-    getCompanyListByCorId(this.corpId).then(response => {
-      this.companyList = response.data.filter(item => item.dictValue !== this.companyId)
-      if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
-        return
-      }
-      this.queryParams.companyId = this.companyList[0].dictValue;
-      this.handleQuery();
-    })
-  },
   methods: {
+    load(corpId, companyId) {
+      getCompanyListByCorId(corpId).then(response => {
+        this.companyList = response.data.filter(item => item.dictValue !== companyId)
+        if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
+          this.userList = []
+          return
+        }
+        this.queryParams.corpId = corpId;
+        this.queryParams.companyId = this.companyList[0].dictValue;
+        this.handleQuery();
+      })
+    },
     /** 查询企微用户列表 */
     getList() {
       this.loading = true;
@@ -120,8 +112,8 @@ export default {
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
-      this.queryParams.corpId = this.corpId;
       if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
+        this.userList = []
         return
       }
       this.getList();

+ 4 - 1
src/views/qw/externalContactUnassigned/companyUnassigned.vue

@@ -216,7 +216,7 @@
           </div>
         </el-form-item>
         <el-card>
-          <companyTransferQwUserSelect :corpId="queryParams.corpId" :companyId="companyId" @selectUser="selectUser"/>
+          <companyTransferQwUserSelect ref="companyTransferSelect" @selectUser="selectUser"/>
         </el-card>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -432,6 +432,9 @@ export default {
       this.submitLoading = false
       this.title = "分配该员工所有客户"
       this.open = true
+      this.$nextTick(() => {
+        this.$refs.companyTransferSelect.load(this.queryParams.corpId, this.companyId)
+      })
     },
     selectUser(selection) {
       this.form.qwUserId = selection.id