Jelajahi Sumber

在职转接新增标签添加

wjj 2 minggu lalu
induk
melakukan
4b163a538d
1 mengubah file dengan 153 tambahan dan 1 penghapusan
  1. 153 1
      src/views/qw/externalContactTransfer/index.vue

+ 153 - 1
src/views/qw/externalContactTransfer/index.vue

@@ -217,6 +217,16 @@
           >分配客户</el-button
         >
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="addUserTag"
+          v-hasPermi="['qw:externalContact:myAddTag']"
+          >批量添加标签</el-button
+        >
+      </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -427,6 +437,68 @@
         <el-button @click="tagCancel()">取消</el-button>
       </div>
     </el-dialog>
+
+    <el-dialog
+      title="批量添加标签"
+      :visible.sync="tagOpen"
+      width="800px"
+      append-to-body
+    >
+      <div>
+        搜索标签:
+        <el-input
+          v-model="tagChange.tagName"
+          placeholder="请输入标签名称"
+          clearable
+          size="small"
+          style="width: 200px; margin-right: 10px"
+        />
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleSearchTags(tagChange.tagName)"
+          >搜索</el-button
+        >
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="cancelSearchTags"
+          >重置</el-button
+        >
+      </div>
+      <el-form ref="form" :model="addTagForm" label-width="80px">
+        <div v-for="item in tagGroupList" :key="item.id">
+          <div style="font-size: 20px; margin-top: 20px; margin-bottom: 20px">
+            <span class="name-background">{{ item.name }}</span>
+          </div>
+          <div class="scroll-wrapper">
+            <div class="tag-container">
+              <a
+                v-for="tagItem in item.tag"
+                class="tag-box"
+                @click="tagSelection(tagItem)"
+                :class="{ 'tag-selected': tagItem.isSelected }"
+              >
+                {{ tagItem.name }}
+              </a>
+            </div>
+          </div>
+        </div>
+      </el-form>
+      <pagination
+        v-show="tagTotal > 0"
+        :total="tagTotal"
+        :page.sync="queryTagParams.pageNum"
+        :limit.sync="queryTagParams.pageSize"
+        @pagination="getPageListTagGroup"
+      />
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
+        <el-button @click="addTagCancel">取 消</el-button>
+      </div>
+    </el-dialog>
     <!-- 添加或修改企业微信客户对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
@@ -490,12 +562,12 @@ import {
   addExternalContact,
   updateExternalContact,
   exportExternalContact,
+  addTag,
 } from "@/api/qw/externalContact";
 import {
   listTag,
   getTag,
   delTag,
-  addTag,
   updateTag,
   exportTag,
   searchTags,
@@ -596,6 +668,17 @@ export default {
       sLastReplyTime: null,
       eLastReplyTime: null,
       lastReplyTime: null,
+
+      tagOpen: false,
+      addTagForm: {
+        userIds: [],
+        tagIds: [],
+      },
+      //标签弹窗选择
+      tagChange: {
+        open: false,
+        index: null,
+      },
     };
   },
   created() {
@@ -635,6 +718,75 @@ export default {
     });
   },
   methods: {
+    //批量添加标签开始
+    addUserTag() {
+      if (this.ids == null || this.ids == "") {
+        return this.$message("请选择需要添加标签的客户");
+      }
+
+      this.getPageListTagGroup();
+
+      setTimeout(() => {
+        for (let i = 0; i < this.tagGroupList.length; i++) {
+          for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
+            this.tagGroupList[i].tag[x].isSelected = false;
+          }
+        }
+      }, 200);
+
+      this.tagOpen = true;
+    },
+    addTagCancel() {
+      this.tagOpen = false;
+
+      this.addTagForm = {
+        userIds: [],
+        tagIds: [],
+      };
+    },
+
+    addTagSubmitForm() {
+      for (let i = 0; i < this.tagGroupList.length; i++) {
+        for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
+          if (this.tagGroupList[i].tag[x].isSelected == true) {
+            this.addTagForm.tagIds.push(this.tagGroupList[i].tag[x].tagId);
+          }
+        }
+      }
+      if (
+        this.addTagForm.tagIds == [] ||
+        this.addTagForm.tagIds == null ||
+        this.addTagForm.tagIds == ""
+      ) {
+        return this.$message("请选择标签");
+      }
+
+      this.addTagForm.corpId = this.queryParams.corpId;
+      this.addTagForm.userIds = this.ids;
+
+      let loadingRock = this.$loading({
+        lock: true,
+        text: "正在执行中请稍后~~请不要刷新页面!!",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
+      addTag(this.addTagForm)
+        .then((response) => {
+          this.msgSuccess(response.msg);
+          this.tagOpen = false;
+          loadingRock.close();
+          this.addTagForm = {
+            userIds: [],
+            tagIds: [],
+          };
+          this.getList();
+        })
+        .finally((res) => {
+          loadingRock.close();
+        });
+    },
+    //批量添加标签结束
     change() {
       if (this.lastReplyTime != null) {
         this.queryParams.sLastReplyTime = this.lastReplyTime[0];