zyp 2 veckor sedan
förälder
incheckning
437dabc316

+ 34 - 2
src/views/qw/sopUserLogs/sopUserLogsSchedule.vue

@@ -51,11 +51,28 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-s-promotion"
+          size="medium"
+          :disabled="multiple"
+          @click="handleCampSendMsg"
+          v-if="filterMode == 1"
+          v-hasPermi="['qw:sopUserLogsInfo:msg']"
+        >营期一键群发</el-button>
+      </el-col>
+
+    </el-row>
+
+
     <el-table border v-loading="loading" :data="sopUserLogsList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="营期编号" align="center" prop="id" />
 <!--      <el-table-column label="模板编号" align="center" prop="sopTempId" />-->
       <el-table-column label="企微员工账号" align="center" prop="qwUserId" />
+      <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
       <el-table-column label="群聊" align="center" prop="chatName" v-if="filterMode == 2" />
       <el-table-column label="营期时间" align="center" prop="startTime" width="180">
         <template slot-scope="scope">
@@ -118,6 +135,7 @@
       <sop-user-logs-info-details ref="SopUserLogsInfoDetails" :rowDetailFrom="logsInfoDetailsOpen.item" @flashNotify="flashNotify"></sop-user-logs-info-details>
     </el-drawer>
 
+    <send-msg-open-tool ref="sendMsgOpenTool" ></send-msg-open-tool>
 
   </div>
 </template>
@@ -135,9 +153,10 @@ import {
 import sopLogsDetails from "@/views/qw/sopLogs/sopLogsList.vue";
 import SopUserLogsInfoDetails from "@/views/qw/sopUserLogsInfo/sopUserLogsInfoDetails.vue";
 import {syncMyExternalContact} from "@/api/qw/externalContact";
+import SendMsgOpenTool from "@/views/qw/sopUserLogsInfo/sendMsgOpenTool.vue";
 export default {
   name: "sopUserLogsSchedule",
-  components: {SopUserLogsInfoDetails, sopLogsDetails},
+  components: {SendMsgOpenTool, SopUserLogsInfoDetails, sopLogsDetails},
   props:{
     rowDetailFrom:{},
   },
@@ -216,9 +235,9 @@ export default {
     });
     this.queryParams.sopId = this.$route.params.id;
     this.filterMode = this.$route.query.filterMode;
-    console.info(this.$route.query)
     this.sopName = this.$route.query.name;
     this.tempId = this.$route.query.tempId;
+    this.queryParams.corpId= this.$route.query.corpId;
     this.getList()
 
   },
@@ -232,6 +251,19 @@ export default {
         this.loading = false;
       });
     },
+
+
+    /**
+     * 营期一键群发
+     */
+    handleCampSendMsg(){
+
+      setTimeout(() => {
+        this.$refs.sendMsgOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+      }, 500);
+
+    },
+
     // 取消按钮
     cancel() {
       this.open = false;

+ 526 - 82
src/views/qw/sopUserLogsInfo/sopUserLogsInfoDetails.vue

@@ -36,13 +36,28 @@
         />
       </el-form-item>
       <el-form-item label="标签" prop="tagIds">
-        <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable  style="width: 100%;">
-          <el-option
-            v-for="dict in tagList"
-            :label="dict.name"
-            :value="dict.tagId">
-          </el-option>
-        </el-select>
+<!--        <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable  style="width: 100%;">-->
+<!--          <el-option-->
+<!--            v-for="dict in tagList"-->
+<!--            :label="dict.name"-->
+<!--            :value="dict.tagId">-->
+<!--          </el-option>-->
+<!--        </el-select>-->
+
+        <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
+          <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
+            <el-tag type="success"
+                    closable
+                    :disable-transitions="false"
+                    v-for="list in this.selectTags"
+                    :key="list.tagId"
+                    @close="handleCloseTags(list)"
+                    style="margin: 3px;"
+            >{{list.name}}
+            </el-tag>
+          </div>
+        </div>
+
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -54,7 +69,7 @@
       <el-col :span="1.5">
         <el-button
           type="warning"
-          icon="el-icon-s-platform"
+          icon="el-icon-s-promotion"
           size="medium"
           :disabled="multiple"
           @click="handleSendMsg"
@@ -73,6 +88,7 @@
           v-hasPermi="['qw:sopUserLogsInfo:edit']"
         >批量修改客户营期</el-button>
       </el-col>
+
 <!--      <el-col :span="1.5">-->
 <!--        <el-button-->
 <!--          type="success"-->
@@ -90,7 +106,7 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="编号" align="center" prop="id" width="100"/>
 <!--      <el-table-column label="企微员工账号" align="center" prop="qwUserId" width="100"/>-->
-      <el-table-column label="客户账号" align="center" prop="externalId" width="100"/>
+      <el-table-column label="客户ID" align="center" prop="externalId" width="100"/>
 <!--      <el-table-column label="客户小程序id" align="center" prop="fsUserId" width="100">-->
 <!--        <template slot-scope="scope">-->
 <!--          <el-tag type="success">-->
@@ -100,23 +116,10 @@
 <!--      </el-table-column>-->
       <el-table-column label="客户名称" align="center" prop="externalUserName" />
       <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column label="客户标签" align="center" prop="tagIds" width="240">
+      <el-table-column label="客户标签" align="center" prop="tagIdsName" width="250px">
         <template slot-scope="scope">
-          <div v-if="scope.row.tagIds && scope.row.tagIds !== '无标签'">
-            <div v-for="i in JSON.parse(scope.row.tagIds)" :key="i" style="display: inline;">
-              <el-tag
-                type="success"
-                v-for="ii in tagList"
-                :key="ii.id"
-                style="margin: 3px;"
-                v-if="ii.tagId == i"
-              >
-                {{ ii.name }}
-              </el-tag>
-            </div>
-          </div>
-          <div v-else>
-            <span style="color: red;">无标签</span>
+          <div v-for="name in scope.row.tagIdsName" style="display: inline;">
+            <el-tag type="success">{{ name }}</el-tag>
           </div>
         </template>
       </el-table-column>
@@ -173,10 +176,9 @@
       <el-table-column label="进线时间" align="center" prop="inComTime" width="180"/>
     </el-table>
 
-    <pagination
+    <pagination-more
       v-show="total>0"
       :total="total"
-      :page-sizes="[10,30,50,100,300,500,1000,5000]"
       :page.sync="queryParams.pageNum"
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
@@ -185,7 +187,7 @@
     <el-dialog :title="sendMsgOpen.title" :visible.sync="sendMsgOpen.open"  width="1000px" append-to-body>
         <el-form ref="msgForm" :model="msgForm" :rules="msgRules" label-width="100px">
           <el-form-item label="选择课程">
-            <el-select  v-model="msgForm.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini"  @change="courseChange()">
+            <el-select  v-model="msgForm.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini" remote  filterable  @change="courseChange()">
               <el-option
                 v-for="dict in courseList"
                 :key="dict.dictValue"
@@ -193,7 +195,7 @@
                 :value="parseInt(dict.dictValue)"
               />
             </el-select>
-            <el-select  v-model="msgForm.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" @change="videoIdChange()"  >
+            <el-select  v-model="msgForm.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" remote  filterable @change="videoIdChange()"  >
               <el-option
                 v-for="dict in videoList"
                 :key="dict.dictValue"
@@ -210,12 +212,6 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="只发送注册用户" prop="isRegister" label-width="120px" >
-                  <el-radio-group v-model="msgForm.isRegister">
-                     <el-radio v-model="msgForm.isRegister" :label="1">是</el-radio>
-                     <el-radio v-model="msgForm.isRegister" :label="2">否</el-radio>
-                  </el-radio-group>
-          </el-form-item>
           <el-form-item label="规则" prop="setting"  >
             <div v-for="(item, index) in setting" :key="index" style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
               <el-row>
@@ -227,11 +223,38 @@
                       </el-radio-group>
                     </el-form-item>
                     <el-form-item label="内容" style="margin-bottom: 2%" >
-                      <el-input v-if="item.contentType == 1 " v-model="item.value" type="textarea" :rows="3" placeholder="内容" style="width: 90%;margin-top: 10px;"/>
+                      <el-input
+                        v-if="item.contentType == 1"
+                        v-model="item.value"
+                        type="textarea"
+                        :rows="3"
+                        placeholder="内容"
+                        style="width: 90%; margin-top: 10px;"
+                        @keydown.native="handleKeydown($event, index)"
+                        :ref="`textarea-${index}`"
+                      >
+                      </el-input>
+                      <el-link
+                        v-if="item.contentType == 1"
+                        type="primary"
+                        @click="toggleSalesCall(index)"
+                        style="margin-top: 10px;"
+                      >
+                        {{ item.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
+                      </el-link>
+                      <el-link
+                        v-if="item.contentType == 1"
+                        type="primary"
+                        @click="toggleSalesCallCustomer(index)"
+                        style="margin-top: 10px;margin-left: 2%"
+                      >
+                        {{ item.isSalesCallCustomerAdded ? '移除#客户称呼#' : '添加#客户称呼#' }}
+                      </el-link>
+
 
                       <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1"  :width="150" :height="150" />
 
-                      <div v-if="item.contentType == 3 ">
+                      <div v-if="item.contentType == 3 || item.contentType ==9 ">
                         <el-card class="box-card">
                           <el-form-item label="链接标题:"  label-width="100px">
                             <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
@@ -248,7 +271,20 @@
                         </el-card>
                       </div>
                       <div v-if="item.contentType == 4">
-
+                        <el-card class="box-card">
+                          <el-form-item label="标题" prop="miniprogramTitle">
+                            <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字"  />
+                          </el-form-item>
+                          <el-form-item label="封面" prop="miniprogramPicUrl">
+                            <ImageUpload v-model="item.miniprogramPicUrl"  type="image" :num="10" :width="150" :height="150" />
+                          </el-form-item>
+                          <el-form-item label="appid" prop="miniprogramAppid" v-show="false" >
+                            <el-input v-model="item.miniprogramAppid='wx73f85f8d62769119' " disabled />
+                          </el-form-item>
+                          <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px" >
+                            <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径"  disabled />
+                          </el-form-item>
+                        </el-card>
                       </div>
                       <div v-if="item.contentType == 5 ">
 
@@ -293,23 +329,10 @@
                           placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
                           @input="handleInputVideoText(item.value,item)"/>
                       </div>
+                      <div v-if="item.contentType == 8">
 
-                      <div v-if="item.contentType == 10 ">
-                        <el-card class="box-card">
-                          <el-form-item label="链接标题:"  label-width="100px">
-                            <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
-                          </el-form-item>
-                          <el-form-item label="链接描述:"   label-width="100px" >
-                            <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述" style="width: 90%;margin-top: 1%;"/>
-                          </el-form-item>
-                          <el-form-item label="链接封面:"   label-width="100px">
-                            <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150" :height="150" style="margin-top: 1%;" />
-                          </el-form-item>
-                          <el-form-item label="链接地址:"  label-width="100px" >
-                            <el-tag type="warning" >链接地址自动生成</el-tag>
-                          </el-form-item>
-                        </el-card>
                       </div>
+
                     </el-form-item>
 
                     <el-form-item label="添加短链" v-if="item.contentType == 1 "  >
@@ -331,9 +354,7 @@
                                                           && item.contentType != 2
                                                           && item.contentType != 5
                                                           && item.contentType != 6
-                                                          && item.contentType != 8
-                                                          && item.contentType != 9
-                                                          && item.contentType != 10"
+                                                          && item.contentType != 8"
                                   style="margin-top: 1%" label-width="100px">
                       <el-row>
                         <el-input-number  v-model="item.expiresDays"  :min="1" :max="100" ></el-input-number>
@@ -377,6 +398,45 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
+    <!--  搜索标签   -->
+    <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" style="width:100%;height: 100%" append-to-body>
+
+      <div>搜索标签:
+        <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
+      </div>
+      <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="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>
+
+      <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="tagSubmitForm()">确 定</el-button>
+        <el-button @click="tagCancel()">取消</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -391,7 +451,10 @@ import {
 } from "@/api/qw/sopUserLogsInfo";
 import ImageUpload from "@/views/qw/sop/ImageUpload.vue";
 import {courseList, videoList} from "@/api/qw/sop";
+import {addCourseFinishTemp, updateCourseFinishTemp} from "@/api/course/courseFinishTemp";
+import {allListTagGroup} from "@/api/qw/tagGroup";
 import {listTag} from "@/api/qw/tag";
+import {searchTags} from "../../../api/qw/tag";
 
 export default {
   name: "sopUserLogsInfoDetails",
@@ -419,7 +482,8 @@ export default {
       // sopUserLogsInfo表格数据
       sopUserLogsInfoList: [],
       sysFsSopWatchStatus: [],
-      tagList:[],
+      isSalesCallAdded:false,
+      isSalesCallCustomerAdded:false,
       selectTags:[],
       // 弹出层标题
       title: "",
@@ -445,6 +509,24 @@ export default {
         createTime: null,
       },
 
+      tagGroupList: [],
+
+      tagTotal:0,
+
+      //标签
+      changeTagDialog:{
+        title:"",
+        open:false,
+      },
+
+      queryTagParams:{
+        pageNum: 1,
+        pageSize: 10,
+        total:0,
+        name:null,
+        corpId:null,
+      },
+
       courseList:[],
       videoList:[],
       //插件版
@@ -468,7 +550,6 @@ export default {
         ids:null,
         sopId: null,
         startTime: null,
-        isRegister:2
       },
       // 表单校验
       rules: {},
@@ -480,6 +561,7 @@ export default {
       msgRules:{},
     };
   },
+
   created() {
     this.getDicts("sys_qwSopAi_contentType").then(response => {
       this.sysQwSopAiContentType = response.data;
@@ -512,12 +594,6 @@ export default {
       });
 
 
-      //标签
-      const listTagFrom = {corpId: val.corpId};
-      listTag(listTagFrom).then(response => {
-        this.tagList = response.rows;
-      });
-
       this.queryParams.qwUserId=val.qwUserId;
       this.queryParams.corpId=val.corpId;
       //用于一键群发
@@ -526,14 +602,153 @@ export default {
       this.queryParams.corpIdParam=val.corpId;
 
     },
+
+    //搜索的标签
+    hangleChangeTags(){
+
+      this.changeTagDialog.title="搜索的标签"
+      this.changeTagDialog.open=true;
+
+      // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
+      const selectedTagIds = new Set(
+        (this.selectTags || []).map(tagItem => tagItem?.tagId)
+      );
+
+      this.queryTagParams.name=null;
+      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 = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
+          }
+        }
+      }, 200);
+
+
+    },
+
+    tagSelection(row){
+
+      row.isSelected= !row.isSelected;
+      this.$forceUpdate();
+    },
+
+
+    //确定选择标签
+    tagSubmitForm(){
+
+      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) {
+
+            if (!this.selectTags) {
+              this.selectTags = [];
+            }
+
+            // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
+            let tagExists = this.selectTags.some(
+              tag => tag.id === this.tagGroupList[i].tag[x].id
+            );
+
+            // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+            if (!tagExists) {
+              this.selectTags.push(this.tagGroupList[i].tag[x]);
+            }
+          }
+        }
+      }
+      if (!this.selectTags || this.selectTags.length === 0) {
+        return this.$message('请选择标签');
+      }
+
+      this.changeTagDialog.open = false;
+    },
+
+    //取消选择标签
+    tagCancel(){
+      this.changeTagDialog.open = false;
+    },
+
+    //删除一些选择的标签
+    handleCloseTags(list){
+      const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
+      if (ls !== -1) {
+        this.selectTags.splice(ls, 1);
+        this.selectTags = [...this.selectTags];
+      }
+
+      if (this.selectTags!=null && this.selectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.tagIds) {
+          this.queryParams.tagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.tagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.selectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.tagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.tagIds=this.queryParams.tagIds.join(",");
+      }else {
+        this.queryParams.tagIds=null;
+      }
+
+    },
+
+    handleSearchTags(name){
+
+      searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
+        this.tagGroupList = response.rows;
+      });
+
+    },
+
+
+    cancelSearchTags(){
+
+      this.resetSearchQueryTag()
+
+      this.getPageListTagGroup();
+
+    },
+
+    getPageListTagGroup(){
+      this.queryTagParams.corpId=this.queryParams.corpId
+      allListTagGroup(this.queryTagParams).then(response => {
+        this.tagGroupList = response.rows;
+        this.tagTotal = response.total;
+      });
+    },
+
+    resetSearchQueryTag(){
+
+      this.queryTagParams= {
+        pageNum: 1,
+        pageSize: 10,
+        total:0,
+        name:null,
+      };
+    },
+
+
     courseChange() {
       if (this.msgForm.courseId != null ) {
         const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的标题/封面上值
-          if (selectedCourse && this.setting[i].contentType == 3 && this.msgForm.courseId != null) {
-            this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
-            this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
+          if (selectedCourse && this.msgForm.courseId != null) {
+            if ( this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
+              this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
+              this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
+            }
+
+            if ( this.setting[i].contentType == 4 ){
+              this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
+            }
           }
 
         }
@@ -551,8 +766,16 @@ export default {
 
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的描述上值
-          if (selectedVideo && this.setting[i].contentType == 3  && this.msgForm.videoId != null) {
-            this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
+          if (selectedVideo && this.msgForm.videoId != null) {
+            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
+              this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
+            }
+
+            if (this.setting[i].contentType == 4){
+              this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
+            }
+
+
           }
         }
       }
@@ -629,6 +852,127 @@ export default {
 
     },
 
+
+    handleKeydown(event, index) {
+      const item = this.setting[index];
+      const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
+      const cursorPosition = textarea.selectionStart;
+
+      // 检查是否按下了 Backspace 或 Delete 键
+      if (event.key === 'Backspace' || event.key === 'Delete') {
+        const tags = ['#销售称呼#', '#客户称呼#']; // 需要检查的标签
+        const value = item.value;
+
+        // 遍历标签,检查是否需要删除
+        for (const tag of tags) {
+          let start, end;
+
+          if (event.key === 'Backspace') {
+            // 检查光标前是否是当前标签的一部分
+            start = cursorPosition - tag.length;
+            if (start >= 0 && value.slice(start, cursorPosition) === tag) {
+              // 删除整个标签
+              item.value = value.slice(0, start) + value.slice(cursorPosition);
+              // 更新光标位置
+              this.$nextTick(() => {
+                textarea.setSelectionRange(start, start);
+              });
+              // 更新状态
+              if (tag === '#销售称呼#') item.isSalesCallAdded = false;
+              if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
+              event.preventDefault(); // 阻止默认删除行为
+              break; // 找到匹配的标签后退出循环
+            }
+          } else if (event.key === 'Delete') {
+            // 检查光标后是否是当前标签的一部分
+            end = cursorPosition + tag.length;
+            if (end <= value.length && value.slice(cursorPosition, end) === tag) {
+              // 删除整个标签
+              item.value = value.slice(0, cursorPosition) + value.slice(end);
+              // 更新状态
+              if (tag === '#销售称呼#') item.isSalesCallAdded = false;
+              if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
+              event.preventDefault(); // 阻止默认删除行为
+              break; // 找到匹配的标签后退出循环
+            }
+          }
+
+          // 检查光标是否位于标签的中间
+          for (let i = 0; i <= tag.length; i++) {
+            const tagStart = cursorPosition - i;
+            const tagEnd = tagStart + tag.length;
+            if (
+              tagStart >= 0 &&
+              tagEnd <= value.length &&
+              value.slice(tagStart, tagEnd) === tag
+            ) {
+              // 删除整个标签
+              item.value = value.slice(0, tagStart) + value.slice(tagEnd);
+              // 更新光标位置
+              this.$nextTick(() => {
+                textarea.setSelectionRange(tagStart, tagStart);
+              });
+              // 更新状态
+              if (tag === '#销售称呼#') item.isSalesCallAdded = false;
+              if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
+              event.preventDefault(); // 阻止默认删除行为
+              break; // 找到匹配的标签后退出循环
+            }
+          }
+        }
+      }
+    },
+
+    // 切换添加销售称呼按钮点击事件
+    toggleSalesCall(index) {
+      const item = this.setting[index];
+      const salesCall = '#销售称呼#';
+      const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
+
+      // 获取当前光标位置
+      const cursorPosition = textarea.selectionStart;
+
+      if (item.isSalesCallAdded) {
+        // 移除所有的 #销售称呼#
+        item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
+      } else {
+        // 添加 #销售称呼#
+        item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
+      }
+
+      // 切换状态
+      item.isSalesCallAdded = !item.isSalesCallAdded;
+
+      // 保持光标位置
+      this.$nextTick(() => {
+        textarea.setSelectionRange(cursorPosition, cursorPosition);
+      });
+    },
+    toggleSalesCallCustomer(index) {
+      const item = this.setting[index];
+      const salesCall = '#客户称呼#';
+      const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
+
+      // 获取当前光标位置
+      const cursorPosition = textarea.selectionStart;
+
+      if (item.isSalesCallCustomerAdded) {
+        // 移除所有的 #销售称呼#
+        item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
+      } else {
+        // 添加 #客户称呼#
+        item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
+      }
+
+      // 切换状态
+      item.isSalesCallCustomerAdded = !item.isSalesCallCustomerAdded;
+
+      // 保持光标位置
+      this.$nextTick(() => {
+        textarea.setSelectionRange(cursorPosition, cursorPosition);
+      });
+    },
+
     handleContentTypeChange() {
 
       //如果是链接的才上
@@ -636,9 +980,17 @@ export default {
         const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的标题/封面上值
-          if (selectedCourse && this.setting[i].contentType == 3 && this.msgForm.courseId != null) {
-            this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
-            this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
+          if (selectedCourse  && this.msgForm.courseId != null) {
+
+            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
+              this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
+              this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
+            }
+            if (this.setting[i].contentType == 4){
+              this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
+            }
+
+
           }
 
         }
@@ -650,14 +1002,23 @@ export default {
 
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的描述上值
-          if (selectedVideo && this.setting[i].contentType == 3  && this.msgForm.videoId != null) {
-            this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
+          if (selectedVideo  && this.msgForm.videoId != null) {
+
+            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
+              this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
+            }
+            if (this.setting[i].contentType == 4){
+              this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
+            }
+
           }
         }
       }
 
 
     },
+
+
     /** 查询sopUserLogsInfo列表 */
     getList() {
       this.loading = true;
@@ -705,7 +1066,27 @@ export default {
 
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.tagIds=this.selectTags.join(',')
+
+      if (this.selectTags!=null && this.selectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.tagIds) {
+          this.queryParams.tagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.tagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.selectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.tagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.tagIds=this.queryParams.tagIds.join(",");
+      }else {
+        this.queryParams.tagIds=null;
+      }
+
+
       this.getList();
     },
     /** 重置按钮操作 */
@@ -773,18 +1154,25 @@ export default {
             if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
               return this.$message.error("图片不能为空")
             }
-            if (this.setting[i].contentType == 3 && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
+            if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9  ) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
               return this.$message.error("链接标题不能为空")
             }
-            if (this.setting[i].contentType == 3 && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
+            if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
               return this.$message.error("链接描述不能为空")
             }
-            if (this.setting[i].contentType == 3 && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
+            if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
               return this.$message.error("链接图片不能为空")
             }
-            if (this.setting[i].contentType == 3 && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
+            if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 )&& this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
               return this.$message.error("链接地址不能为空")
             }
+
+            if (this.setting[i].contentType == 4 && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
+              return this.$message.error("小程序消息标题不能为空")
+            }
+            if (this.setting[i].contentType == 4 && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
+              return this.$message.error("小程序封面地址不能为空")
+            }
             if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
               return this.$message.error("文件不能为空")
             }
@@ -814,8 +1202,6 @@ export default {
               courseId:null,
               courseType:null,
               setting:null,
-              isRegister:2,
-
             }
             this.getList();
           }).finally(()=>{
@@ -839,13 +1225,25 @@ export default {
           this.updateLogsInfoFrom.qwUserId=this.queryParams.qwUserId
           this.updateLogsInfoFrom.corpId= this.queryParams.corpId
 
+
+          let loadingRock = this.$loading({
+            lock: true,
+            text: '正在执行中请稍后~~请不要刷新页面!!',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+
+
           batchUpdateSopUserLogsInfoToTime(this.updateLogsInfoFrom).then(response => {
             this.msgSuccess("修改成功");
             this.open = false;
             this.updateOpen=false;
             this.getList();
             this.$emit('flashNotify')
-          });
+            loadingRock.close();
+          }).finally(res=>{
+            loadingRock.close();
+          })
 
         }
       });
@@ -882,3 +1280,49 @@ export default {
   }
 };
 </script>
+
+<style scoped>
+/* CSS 样式 */
+.tag-container {
+  display: flex;
+  flex-wrap: wrap; /* 超出宽度时自动换行 */
+  gap: 8px; /* 设置标签之间的间距 */
+}
+.name-background {
+  display: inline-block;
+  background-color: #abece6; /* 背景颜色 */
+  padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
+  border-radius: 4px; /* 可选:设置圆角 */
+}
+.tag-box {
+  padding: 8px 12px;
+  border: 1px solid #989797;
+  border-radius: 4px;
+  cursor: pointer;
+  display: inline-block;
+}
+
+.tag-selected {
+  background-color: #00bc98;
+  color: #fff;
+  border-color: #00bc98;
+}
+
+.el-tag + .el-tag {
+  margin-left: 10px;
+}
+
+
+.button-new-tag {
+  margin-left: 10px;
+  height: 32px;
+  line-height: 30px;
+  padding-top: 0;
+  padding-bottom: 0;
+}
+.input-new-tag {
+  width: 90px;
+  margin-left: 10px;
+  vertical-align: bottom;
+}
+</style>