Переглянути джерело

Merge branch 'master' into 企微聊天

ct 4 днів тому
батько
коміт
95391b63d3

+ 17 - 0
src/api/company/companyUser.js

@@ -43,6 +43,23 @@ export function getQwAllUserList(id) {
   })
 }
 
+
+export function getQwMyUserList(id) {
+  return request({
+    url: '/company/user/getQwMyUserList/'+id,
+    method: 'get'
+  })
+}
+
+export function getQwDeptUserList(id) {
+  return request({
+    url: '/company/user/getQwDeptUserList/'+id,
+    method: 'get'
+  })
+}
+
+
+
 export function getUserListByDeptId(query) {
   return request({
     url: '/company/user/getUserListByDeptId',

+ 9 - 0
src/api/qw/externalContact.js

@@ -306,6 +306,15 @@ export function batchUpdateExternalContactNotes(data) {
   })
 }
 
+export function batchUpdateExternalContactNotesByWatchLog(data) {
+  return request({
+    url: '/qw/externalContact/batchUpdateExternalContactNotesByWatchLog',
+    method: 'post',
+    data: data
+  })
+}
+
+
 // 查询企业微信客户流失删除统计列表
 export function delLossStatistics(query) {
   return request({

+ 53 - 0
src/api/tag/api.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询视频小节看课标签关联列表
+export function listTag(query) {
+  return request({
+    url: '/shop/tag/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询视频小节看课标签关联详细
+export function getTag(id) {
+  return request({
+    url: '/shop/tag/' + id,
+    method: 'get'
+  })
+}
+
+// 新增视频小节看课标签关联
+export function addTag(data) {
+  return request({
+    url: '/shop/tag',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改视频小节看课标签关联
+export function updateTag(data) {
+  return request({
+    url: '/shop/tag',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除视频小节看课标签关联
+export function delTag(id) {
+  return request({
+    url: '/shop/tag/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出视频小节看课标签关联
+export function exportTag(query) {
+  return request({
+    url: '/shop/tag/export',
+    method: 'get',
+    params: query
+  })
+}

+ 1 - 1
src/router/index.js

@@ -174,7 +174,7 @@ export const constantRoutes = [
     hidden: true,
     children: [
       {
-        path: 'addSop/:corpId',
+        path: 'addSop/:corpId/:type(\\d+)',
         component: (resolve) => require(['@/views/qw/sop/addSop'], resolve),
         name: 'addSop',
         meta: { title: '新增SOP任务', activeMenu: '/qw/sop'}

+ 19 - 130
src/views/components/course/userCourseCatalogDetails.vue

@@ -33,10 +33,6 @@
       <el-table-column label="上传时间" align="center" prop="createTime" />
       <el-table-column label="默认红包" align="center" prop="redPacketMoney" />
       <el-table-column label="公司红包" align="center" prop="companyRedPacketMoney" />
-      <el-table-column label="标签组名称" align="center" prop="tagGroupName" />
-      <el-table-column label="看课标签" align="center" prop="watchingTagName" />
-      <el-table-column label="完课标签" align="center" prop="watchedTagName" />
-
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -91,8 +87,7 @@
       :visible.sync="dialogVisible"
       width="400px"
       @close="resetForm"
-      append-to-body
-    >
+      append-to-body>
       <div>
         <p style="color: gray;">不传默认以系统参数为准</p>
         <el-form :model="linkForm" label-width="120px">
@@ -111,70 +106,13 @@
       </div>
     </el-dialog>
 
-    <!-- 弹框 -->
-    <el-dialog
-      title="绑定看课标签"
+    <AutoTagDialog
       :visible.sync="tagDialogVisible"
-      width="500px"
-      @closed="resetDialog"
+      :title="tagDialogTitle"
+      :videoId="currentVideoId"
       append-to-body
-    >
-      <el-form :model="tagDialog" label-width="120px">
-        <!-- 标签组选择 -->
-        <el-form-item label="标签组" required>
-          <el-select
-            v-model="tagDialog.groupId"
-            placeholder="请选择标签组"
-            @change="onGroupChange"
-            filterable
-          >
-            <el-option
-              v-for="group in tagGroups"
-              :key="group.groupId"
-              :label="group.name"
-              :value="group.groupId"
-            />
-          </el-select>
-        </el-form-item>
-        <!-- 看课标签选择 -->
-        <el-form-item label="看课标签" required>
-          <el-select
-            v-model="tagDialog.watchTagId"
-            placeholder="请选择看课标签"
-            :disabled="!tagDialog.groupId"
-            @change="handleWatchingChange"
-            filterable
-          >
-            <el-option
-              v-for="tag in tagsInGroup"
-              :key="tag.tagId"
-              :label="tag.name"
-              :value="tag.tagId"
-            />
-          </el-select>
-        </el-form-item>
-        <!-- 完课标签选择 -->
-        <el-form-item label="完课标签" required>
-          <el-select
-            v-model="tagDialog.finishTagId"
-            placeholder="请选择完课标签"
-            :disabled="!tagDialog.groupId"
-            @change="handleWatchedChange"
-            filterable>
-            <el-option
-              v-for="tag in tagsInGroup"
-              :key="tag.tagId"
-              :label="tag.name"
-              :value="tag.tagId"
-            />
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="cancelDialog">取消</el-button>
-        <el-button type="primary" @click="submitTagBinding">确定</el-button>
-      </span>
-    </el-dialog>
+    />
+
   </div>
 </template>
 
@@ -182,12 +120,14 @@
 import {getVideoListByCourseId, updatePacketMoney, updateUserCourseVideoUpdate} from "@/api/course/userCourseVideo";
 import userCourseVideoDetails from '../../components/course/userCourseVideoDetails.vue';
 import {createLinkUrl} from "@/api/course/sopCourseLink";
-import {listTagGroup} from "@/api/qw/tagGroup";
+import AutoTagDialog from "@/views/components/tag/AutoTagDialog.vue";
+import {addTag, updateTag} from "@/api/tag/api";
 
 export default {
     name: "userCourseCatalog",
     components: {
-      userCourseVideoDetails
+      userCourseVideoDetails,
+      AutoTagDialog
     },
     props: {
       video: {
@@ -199,9 +139,12 @@ export default {
       return {
         currentRow: null,
         // 假设这里有当前课程小节的数据传入,里面含id等
-        tagDialogVisible: false,
         tagGroups: [],
         tagsInGroup: [],
+        tagDialogVisible: false,
+        tagDialogTitle: "",
+        tagDialogFormData: null,
+        currentVideoId:null,
         tagDialog: {
           videoId: null,
           groupId: null,
@@ -293,33 +236,16 @@ export default {
       });
     },
     methods: {
-      handleWatchingChange(tagId){
-        this.tagDialog.watchingTgId = this.tagsInGroup.find(e => e.tagId === tagId)?.id;
-      },
-      handleWatchedChange(tagId){
-        this.tagDialog.watchedTgId = this.tagsInGroup.find(e => e.tagId === tagId)?.id;
+
+      closeTagDialog(){
+        this.tagDialogVisible = false;
       },
       openTagDialog(row) {
         this.currentRow = row;
-        this.tagDialogVisible = true;
-        this.tagDialog.videoId = row.videoId;
-        this.tagDialog.groupId = this.currentRow.tagGroupId;
-        this.tagDialog.watchTagId = this.currentRow.watchingTagId;
-        this.tagDialog.finishTagId = this.currentRow.watchedTagId;
 
 
-        // 查询所有的标签组
-        listTagGroup({
-          pageNum: 1,
-          pageSize: 1000
-        }).then((res) => {
-          if(res.code === 200) {
-            this.tagGroups = res.rows;
-
-            let tagGroup = this.tagGroups.find(e=>e.groupId === this.currentRow.tagGroupId);
-            this.tagsInGroup = tagGroup.tag || [];
-          }
-        });
+        this.tagDialogVisible = true;
+        this.currentVideoId = row.videoId;
       },
       updateTagsInGroup(groupId) {
         let tagGroup = this.tagGroups.find(e=> e.groupId === groupId);
@@ -330,13 +256,6 @@ export default {
         this.tagDialog.finishTagId = null;
         this.tagDialog.tgId = tagGroup.id;
       },
-      onGroupChange(groupId) {
-        this.updateTagsInGroup(groupId);
-      },
-      cancelDialog() {
-        this.tagDialogVisible = false;
-        this.resetDialog();
-      },
       resetDialog() {
         this.tagDialog = {
           videoId: null,
@@ -347,36 +266,6 @@ export default {
         this.tagGroups = [];
         this.tagsInGroup = [];
       },
-      submitTagBinding() {
-        // 使用表单校验
-        if(!this.tagDialog.groupId){
-          this.$message.warning("标签组必选!");
-          return;
-        }
-        if(!this.tagDialog.watchTagId){
-          this.$message.warning("看课标签必选!");
-          return;
-        }
-        if(!this.tagDialog.finishTagId){
-          this.$message.warning("完课标签必选!");
-          return;
-        }
-        this.currentRow.tagGroupId = this.tagDialog.groupId;
-        this.currentRow.watchingTagId = this.tagDialog.watchTagId;
-        this.currentRow.watchedTagId = this.tagDialog.finishTagId;
-
-        this.currentRow.watchingTgId = this.tagDialog.watchingTgId;
-        this.currentRow.watchedTgId = this.tagDialog.watchedTgId;
-        this.currentRow.tgId = this.tagDialog.tgId;
-
-        updateUserCourseVideoUpdate(this.currentRow).then(res=>{
-          this.$message.success("绑定成功");
-          this.resetDialog();
-          this.currentRow = null;
-          this.tagDialogVisible = false;
-          this.getList();
-        })
-      },
       // 打开弹框
       openDialog(row) {
         this.linkForm.courseId = row.courseId;

+ 504 - 0
src/views/components/tag/AutoTagDialog.vue

@@ -0,0 +1,504 @@
+<template>
+  <el-dialog :visible.sync="visible" title="标签绑定管理" width="1000px"
+   @close="handleClose"
+   append-to-body
+  >
+    <div class="app-container">
+      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form-item label="企微公司" prop="corpId">
+          <el-select v-model="queryParams.corpId" placeholder="企微公司"  size="small" @change="updateCorpId()">
+            <el-option
+              v-for="dict in myQwCompanyList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="视频ID" prop="videoId">
+          <el-input
+            v-model="queryParams.videoId"
+            placeholder="请输入视频ID"
+            clearable
+            size="small"
+            @keyup.enter.native="handleQuery"
+            disabled
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="handleAdd"
+            v-hasPermi="['shop:tag:add']"
+          >新增</el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="success"
+            plain
+            icon="el-icon-edit"
+            size="mini"
+            :disabled="single"
+            @click="handleUpdate"
+            v-hasPermi="['shop:tag:edit']"
+          >修改</el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            size="mini"
+            :disabled="multiple"
+            @click="handleDelete"
+            v-hasPermi="['shop:tag:remove']"
+          >删除</el-button>
+        </el-col>
+<!--        <el-col :span="1.5">-->
+<!--          <el-button-->
+<!--            type="warning"-->
+<!--            plain-->
+<!--            icon="el-icon-download"-->
+<!--            size="mini"-->
+<!--            :loading="exportLoading"-->
+<!--            @click="handleExport"-->
+<!--            v-hasPermi="['shop:tag:export']"-->
+<!--          >导出</el-button>-->
+<!--        </el-col>-->
+        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      </el-row>
+
+      <el-table border v-loading="loading" :data="tagList" @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="ID" align="center" prop="id" />
+        <el-table-column label="企微公司" align="center" prop="corpId" />
+        <el-table-column label="视频ID" align="center" prop="videoId" />
+        <el-table-column label="看课中-标签组名" align="center" prop="watchingGroupName" />
+        <el-table-column label="看课中-标签名" align="center" prop="watchingTgName" />
+        <el-table-column label="完课-标签组名" align="center" prop="watchedGroupName" />
+        <el-table-column label="完课-标签名" align="center" prop="watchedTgName" />
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleUpdate(scope.row)"
+              v-hasPermi="['shop:tag:edit']"
+            >修改</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDelete(scope.row)"
+              v-hasPermi="['shop:tag:remove']"
+            >删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+
+      <!-- 添加或修改视频小节看课标签关联对话框 -->
+      <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+          <el-form-item label="企微公司" prop="corpId">
+            <el-select v-model="queryParams.corpId" placeholder="企微公司"  size="small" @change="updateCorpId()">
+              <el-option
+                v-for="dict in myQwCompanyList"
+                :key="dict.dictValue"
+                :label="dict.dictLabel"
+                :value="dict.dictValue"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="视频ID" prop="videoId">
+            <el-input v-model="form.videoId" placeholder="请输入视频ID" disabled/>
+          </el-form-item>
+          <el-form-item label="看课中-标签组" prop="watchingGroupTgId">
+            <el-select
+              v-model="form.watchingGroupTgId"
+              placeholder="请选择标签组"
+              @change="onWatchingGroupChange"
+              filterable
+            >
+              <el-option
+                v-for="group in tagGroups"
+                :key="group.groupId"
+                :label="group.name"
+                :value="group.groupId"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="看课中-标签" prop="watchingTagId">
+            <el-select
+              v-model="form.watchingTagId"
+              placeholder="请选择看课标签"
+              @change="onWatchingTagChange"
+              filterable>
+              <el-option
+                v-for="tag in watchingTagsInGroup"
+                :key="tag.tagId"
+                :label="tag.name"
+                :value="tag.tagId"
+              />
+            </el-select>
+          </el-form-item>
+
+          <el-form-item label="完课-标签组" prop="watchedGroupTgId">
+            <el-select
+              v-model="form.watchedGroupTgId"
+              placeholder="请选择标签组"
+              @change="onWatchedGroupChange"
+              filterable>
+              <el-option
+                v-for="group in tagGroups"
+                :key="group.groupId"
+                :label="group.name"
+                :value="group.groupId"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="完课-标签" prop="watchedTagId">
+            <el-select
+              v-model="form.watchedTagId"
+              placeholder="请选择看课标签"
+              @change="onWatchedTagChange"
+              filterable>
+              <el-option
+                v-for="tag in watchedTagsInGroup"
+                :key="tag.tagId"
+                :label="tag.name"
+                :value="tag.tagId"
+              />
+            </el-select>
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </el-dialog>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import {addTag, delTag, exportTag, getTag, listTag, updateTag} from "@/api/tag/api";
+import {getMyQwCompanyList} from "@/api/qw/user";
+import {listTagGroup} from "@/api/qw/tagGroup";
+
+export default {
+  name: 'BindLabelsDialog',
+  props: {
+    visible: {
+      type: Boolean,
+      required: true,
+    },
+    videoId: {
+      type: String,
+      required: true,
+    },
+  },
+  watch: {
+    visible(val) {
+      if (val) {
+        this.queryParams.videoId = this.videoId;
+        this.getList();
+      }
+    }
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 视频小节看课标签关联表格数据
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      myQwCompanyList:[],
+      // 看课中标签组
+      watchingTagsInGroup: [],
+      // 完课标签组
+      watchedTagsInGroup: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        corpId: null,
+        videoId: null,
+        watchingGroupId: null,
+        watchedGroupId: null,
+        watchingTgId: null,
+        watchedTgId: null,
+        watchingGroupTagId: null,
+        watchedGroupTagId: null,
+        watchingTagId: null,
+        watchedTagId: null,
+      },
+      tagList: [],
+      totalTags: 0,
+      pageNum: 1,
+      pageSize: 10,
+      loadingList: false,
+      selection: [],
+      formDialogVisible: false,
+      isEditing: false,
+      form: {
+        id: null,
+        corpId: null,
+        videoId: null,
+        watchingGroupId: null,
+        watchedGroupId: null,
+        watchingTgId:null,
+        watchedTgId: null,
+        watchingGroupTagId: null,
+        watchedGroupTagId: null,
+        watchingTagId: null,
+        watchedTagId:null
+      },
+      rules: {
+        corpId: [{ required: true, message: '请选择企微公司', trigger: 'change' }],
+        videoId: [{ required: true, message: '请输入视频ID', trigger: 'blur' }],
+        watchingGroupTgId: [{ required: true, message: '请选择看课中标签组', trigger: 'change' }],
+        watchingTagId: [{ required: true, message: '请选择看课中标签', trigger: 'change' }],
+        watchedGroupTgId: [{ required: true, message: '请选择完课标签组', trigger: 'change' }],
+        watchedTagId: [{ required: true, message: '请选择完课标签', trigger: 'change' }]
+      },
+      tagGroups: []
+    }
+  },
+  created() {
+    getMyQwCompanyList().then(response => {
+      this.myQwCompanyList = response.data;
+      if(this.myQwCompanyList != null && this.myQwCompanyList.length > 0){
+        this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
+        this.getList();
+      }
+    });
+  },
+  methods: {
+    onWatchingTagChange(tagId){
+      let find = this.watchingTagsInGroup.find(e=> e.tagId === tagId);
+      this.form.watchingTgId = find.id;
+    },
+    onWatchedTagChange(tagId){
+      let find = this.watchedTagsInGroup.find(e=> e.tagId === tagId);
+      this.form.watchedTgId = find.id;
+    },
+    onWatchingGroupChange(groupId){
+      let find = this.tagGroups.find(e=> e.groupId===groupId);
+      this.watchingTagsInGroup=find.tag || [];
+      this.form.watchingGroupId = find.id;
+    },
+    onWatchedGroupChange(groupId){
+      let find = this.tagGroups.find(e=> e.groupId===groupId);
+      this.watchedTagsInGroup=find.tag || [];
+      this.form.watchedGroupId = find.id;
+    },
+    updateCorpId(){
+      this.getList();
+      // 查询所有的标签组
+      listTagGroup({
+        pageNum: 1,
+        pageSize: 1000,
+        corpId: this.queryParams.corpId
+      }).then((res) => {
+        if(res.code === 200) {
+          this.tagGroups = res.rows;
+        }
+      });
+    },
+    handleClose(){
+      this.$emit('update:visible', false);
+    },
+    /** 查询视频小节看课标签关联列表 */
+    getList() {
+      this.loading = true;
+      listTag(this.queryParams).then(response => {
+        this.tagList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+      this.$emit('close')
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        corpId: null,
+        videoId: null,
+        watchingGroupId: null,
+        watchedGroupId: null,
+        watchingTgId: null,
+        watchedTgId: null,
+        watchingGroupTagId: null,
+        watchedGroupTagId: null,
+        watchingTagId: null,
+        watchedTagId: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加视频小节看课标签关联";
+      this.form.videoId = this.videoId;
+      this.form.corpId = this.queryParams.corpId;
+
+      listTagGroup({
+        pageNum: 1,
+        pageSize: 1000,
+        corpId: this.queryParams.corpId
+      }).then((res) => {
+        if(res.code === 200) {
+          this.tagGroups = res.rows;
+        }
+      });
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+
+      // 先加载标签组数据
+      listTagGroup({
+        pageNum: 1,
+        pageSize: 1000,
+        corpId: this.queryParams.corpId
+      }).then((res) => {
+        if(res.code === 200) {
+          this.tagGroups = res.rows;
+
+          // 再获取详情数据
+          getTag(id).then(response => {
+            this.form = response.data;
+
+            // 根据标签组ID加载对应的标签列表
+            if(this.form.watchingGroupTgId) {
+              let watchingGroup = this.tagGroups.find(e => e.id === this.form.watchingGroupId);
+              if(watchingGroup) {
+                this.watchingTagsInGroup = watchingGroup.tag || [];
+              }
+            }
+
+            if(this.form.watchedGroupTgId) {
+              let watchedGroup = this.tagGroups.find(e => e.id === this.form.watchedGroupId);
+              if(watchedGroup) {
+                this.watchedTagsInGroup = watchedGroup.tag || [];
+              }
+            }
+
+            this.open = true;
+            this.title = "修改视频小节看课标签关联";
+          });
+        }
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTag(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTag(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除视频小节看课标签关联编号为"' + ids + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delTag(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有视频小节看课标签关联数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportTag(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    }
+  }
+}
+</script>

+ 52 - 16
src/views/course/courseWatchLog/deptWatchLog.vue

@@ -703,9 +703,11 @@ export default {
     },
     /** 查询短链课程看课记录列表 */
     getList() {
-      // xgb 看课数据量太大必须限制时间
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
 
@@ -717,7 +719,14 @@ export default {
         this.courseWatchLogList = response.rows;
         this.total = response.total;
         this.loading = false;
-      });
+      }).catch(() => {
+          this.loading = false;
+        }
+      );
+    },
+    // 添加辅助方法
+    isEmptyArray(arr) {
+      return !arr || arr.length === 0;
     },
     // 取消按钮
     cancel() {
@@ -839,8 +848,11 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      // xgb 看课数据量太大必须限制时间
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
 
@@ -907,6 +919,12 @@ export default {
     // 营期时间
     handleScheduleTimeChange(scheduleTime) {
       if (scheduleTime && scheduleTime.length >= 2) {
+        if(!this.checkDateRangeLimit(scheduleTime)){
+          this.scheduleTimeText = null;
+          this.queryParams.scheduleStartTime=null;
+          this.queryParams.scheduleStartTime=null;
+          return;
+        }
         // this.scheduleTimeText = this.formatDateRange(scheduleTime);
         this.queryParams.scheduleStartTime = scheduleTime[0] || null;
         this.queryParams.scheduleEndTime = scheduleTime[1] || null;
@@ -916,20 +934,32 @@ export default {
         this.queryParams.scheduleEndTime = null;
       }
     },
+    checkDateRangeLimit(dateRange) {
+      if (dateRange && dateRange.length >= 2) {
+        const startDate = new Date(dateRange[0]);
+        const endDate = new Date(dateRange[1]);
+
+        // 设置时间为当天开始,避免时间部分影响计算
+        startDate.setHours(0, 0, 0, 0);
+        endDate.setHours(0, 0, 0, 0);
+
+        const timeDiff = Math.abs(endDate - startDate);
+        const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
+
+        if (diffDays > 31) { // maxDays-1 因为包含起始日
+          this.$message.warning('时间区间不能超过一个月');
+          return false;
+        }
+      }
+      return true;
+    },
     // 创建时间
     createChange(createTime) {
       if (createTime && createTime.length >= 2) {
-        const startDate = new Date(createTime[0]);
-        const endDate = new Date(createTime[1]);
-        const timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
-        const diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
-
-        // 限制时间区间为一个月
-        if (diffDays > 31) {
-          this.$message.warning('创建时间区间不能超过一个月');
+        if(!this.checkDateRangeLimit(createTime)){
           this.createTimeText = null;
-          this.queryParams.sTime = null;
-          this.queryParams.eTime = null;
+          this.queryParams.sTime=null;
+          this.queryParams.eTime=null;
           return;
         }
         // this.createTimeText = this.formatDateRange(createTime);
@@ -945,6 +975,12 @@ export default {
     // 更新时间
     updateChange(updateTime) {
       if (updateTime && updateTime.length >= 2) {
+        if(!this.checkDateRangeLimit(updateTime)){
+          this.updateTimeText = null;
+          this.queryParams.upSTime=null;
+          this.queryParams.upETime=null;
+          return;
+        }
         this.updateTimeText = this.formatDateRange(updateTime);
         this.queryParams.upSTime = updateTime[0] || null;
         this.queryParams.upETime = updateTime[1] || null;

+ 51 - 15
src/views/course/courseWatchLog/index.vue

@@ -832,6 +832,10 @@ export default {
     this.loading=false;
   },
   methods: {
+    // 添加辅助方法
+    isEmptyArray(arr) {
+      return !arr || arr.length === 0;
+    },
     setToday(){
       const today = new Date();
       const todayStart = new Date(today);
@@ -1019,10 +1023,35 @@ export default {
         this.videoList=response.list
       });
     },
+    checkDateRangeLimit(dateRange) {
+      if (dateRange && dateRange.length >= 2) {
+        const startDate = new Date(dateRange[0]);
+        const endDate = new Date(dateRange[1]);
+
+        // 设置时间为当天开始,避免时间部分影响计算
+        startDate.setHours(0, 0, 0, 0);
+        endDate.setHours(0, 0, 0, 0);
 
+        const timeDiff = Math.abs(endDate - startDate);
+        const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
+
+        if (diffDays > 31) { // maxDays-1 因为包含起始日
+          this.$message.warning('时间区间不能超过一个月');
+          return false;
+        }
+      }
+      return true;
+    },
     // 营期时间
     handleScheduleTimeChange(scheduleTime) {
       if (scheduleTime && scheduleTime.length >= 2) {
+        if(!this.checkDateRangeLimit(scheduleTime)){
+          this.scheduleTimeText = null;
+          this.queryParams.scheduleStartTime=null;
+          this.queryParams.scheduleStartTime=null;
+          return;
+        }
+
         // this.scheduleTimeText = this.formatDateRange(scheduleTime);
         this.queryParams.scheduleStartTime = scheduleTime[0] || null;
         this.queryParams.scheduleEndTime = scheduleTime[1] || null;
@@ -1037,17 +1066,10 @@ export default {
     // 创建时间
     createChange(createTime) {
       if (createTime && createTime.length >= 2) {
-        const startDate = new Date(createTime[0]);
-        const endDate = new Date(createTime[1]);
-        const timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
-        const diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
-
-        // 限制时间区间为一个月
-        if (diffDays > 31) {
-          this.$message.warning('创建时间区间不能超过一个月');
+        if(!this.checkDateRangeLimit(createTime)){
           this.createTimeText = null;
-          this.queryParams.sTime = null;
-          this.queryParams.eTime = null;
+          this.queryParams.sTime=null;
+          this.queryParams.eTime=null;
           return;
         }
 
@@ -1064,6 +1086,12 @@ export default {
     // 更新时间
     updateChange(updateTime) {
       if (updateTime && updateTime.length >= 2) {
+        if(!this.checkDateRangeLimit(updateTime)){
+          this.updateTimeText = null;
+          this.queryParams.upSTime=null;
+          this.queryParams.upETime=null;
+          return;
+        }
         // this.updateTimeText = this.formatDateRange(updateTime);
         this.queryParams.upSTime = updateTime[0] || null;
         this.queryParams.upETime = updateTime[1] || null;
@@ -1189,8 +1217,10 @@ export default {
     /** 查询短链课程看课记录列表 */
     getList() {
       // xgb 看课数据量太大必须限制时间
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
 
@@ -1203,6 +1233,8 @@ export default {
         this.courseWatchLogList = response.rows;
         this.total = response.total;
         this.loading = false;
+      }).catch(() => {
+        this.loading = false;
       });
     },
     // 取消按钮
@@ -1261,7 +1293,6 @@ export default {
       this.queryParams.scheduleEndTime = null;
       this.queryParams.sopId = null; // 重置SOP ID
 
-      this.setToday();
 
       // 重置SOP搜索
       this.handleSopClear();
@@ -1269,6 +1300,8 @@ export default {
       // 统一重置日历组件
       this.resetCalendars();
 
+      this.setToday();
+
       this.handleQuery();
     },
     // 多选框选中数据
@@ -1329,8 +1362,11 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      // xgb 看课数据量太大必须限制时间
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
       const queryParams = this.queryParams;

+ 200 - 25
src/views/course/courseWatchLog/watchLog.vue

@@ -291,6 +291,28 @@
           >批量移除标签</el-button>
         </el-col>
       </el-col>
+      <el-col :span="1.5" v-if="queryParams.sendType == 2">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          @click="handleBatchUpdateNotes"
+          v-hasPermi="['qw:externalContact:edit']"
+        >批量修改备注
+        </el-button>
+      </el-col>
+      <el-col :span="1.5" v-if="queryParams.sendType == 2">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          @click="handleBatchUpdateNotesFilter"
+          v-hasPermi="['qw:externalContact:edit']"
+        >批量修改备注(筛选条件)
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -518,7 +540,7 @@
                 @click="tagSelection(tagItem)"
                 :class="{ 'tag-selected': tagItem.isSelected }"
               >
-                {{ tagItem.name }}
+                {{ tagItem.name }} 【{{tagItem.corpName}}】
               </a>
             </div>
           </div>
@@ -587,7 +609,53 @@
         <el-button @click="resultDialogVisible = false">关闭</el-button>
       </span>
     </el-dialog>
-
+     <el-dialog title="批量添加客户备注" :visible.sync="notesOpen.open" width="800px" append-to-body>
+      <el-card>
+        <el-row>
+          <el-col>
+            <el-radio-group v-model="notesOpen.nameType" style="margin-bottom: 2%">
+              <el-radio :label="1">
+                客户名称添加在【新备注】【前】
+              </el-radio>
+              <el-radio :label="2">
+                客户名称添加在【新备注】【后】
+              </el-radio>
+              <el-radio :label="3">
+                不添加客户名称
+              </el-radio>
+            </el-radio-group>
+          </el-col>
+          <el-col>
+            <el-radio-group v-model="notesOpen.type">
+              <el-radio
+                :label="1"
+              >添加【新备注】在最【前】面
+              </el-radio>
+              <el-radio
+                :label="2"
+              >添加【新备注】在最【后】面
+              </el-radio>
+              <el-radio
+                :label="3"
+              >替换所有备注
+              </el-radio>
+            </el-radio-group>
+          </el-col>
+          <el-col>
+            <el-input v-model="notesOpen.notes" placeholder="请输入客户备注(最多20个字,含已有的)" clearable size="small"
+                      maxlength="20" show-word-limit style="width: 500px;margin-top: 3%"/>
+            <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
+              <i class="el-icon-info"></i>
+              由于企业微信官方限制,备注最多20个字,且自动会去除末尾超出的字
+            </div>
+          </el-col>
+        </el-row>
+      </el-card>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="notesSubmitForm()">确 定</el-button>
+        <el-button @click="notesCancel()">取消</el-button>
+      </div>
+    </el-dialog>
 
   </div>
 </template>
@@ -605,7 +673,7 @@ import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/cour
 import {myListLogs} from "@/api/course/courseAnswerlogs";
 import {getMyQwUserList} from "@/api/qw/user";
 import {searchTags} from "../../../api/qw/tag";
-import {addTagByWatch, delTagByWatch} from "../../../api/qw/externalContact";
+import {addTagByWatch, delTagByWatch,batchUpdateExternalContactNotes,batchUpdateExternalContactNotesByWatchLog} from "../../../api/qw/externalContact";
 import {allListTagGroup} from "../../../api/qw/tagGroup";
 import Vue from 'vue'
 import Calendar from 'vue-mobile-calendar'
@@ -781,7 +849,15 @@ export default {
       // 表单参数
       form: {},
       // 表单校验
-      rules: {}
+      rules: {},
+      notesOpen: {
+        type: 1,
+        nameType: 3,
+        addType: 0,
+        filter: false,
+        open: false,
+        notes: null,
+      },
     };
   },
   created() {
@@ -854,10 +930,10 @@ export default {
       this.qecCreateTime = [];
       this.periodTime = [];
 
-      this.scheduleTimeText = '';
-      this.createTimeText = '';
-      this.updateTimeText = '';
-      this.qecCreateTimeText = '';
+      this.scheduleTimeText = [];
+      this.createTimeText = [];
+      this.updateTimeText = [];
+      this.qecCreateTimeText = [];
       this.periodTimeText = [];
 
       // 强制刷新日历组件
@@ -904,31 +980,48 @@ export default {
     // 营期时间
     handleScheduleTimeChange(scheduleTime) {
       if (scheduleTime && scheduleTime.length >= 2) {
+        if(!this.checkDateRangeLimit(scheduleTime)){
+          this.scheduleTimeText = null;
+          this.queryParams.scheduleStartTime=null;
+          this.queryParams.scheduleStartTime=null;
+          return;
+        }
+
         // this.scheduleTimeText = this.formatDateRange(scheduleTime);
         this.queryParams.scheduleStartTime = scheduleTime[0] || null;
         this.queryParams.scheduleEndTime = scheduleTime[1] || null;
-        console.log(this.queryParams.scheduleStartTime)
-        console.log(this.queryParams.scheduleEndTime)
       } else {
         this.scheduleTimeText = [];
         this.queryParams.scheduleStartTime = null;
         this.queryParams.scheduleEndTime = null;
       }
     },
+    checkDateRangeLimit(dateRange) {
+      if (dateRange && dateRange.length >= 2) {
+        const startDate = new Date(dateRange[0]);
+        const endDate = new Date(dateRange[1]);
+
+        // 设置时间为当天开始,避免时间部分影响计算
+        startDate.setHours(0, 0, 0, 0);
+        endDate.setHours(0, 0, 0, 0);
+
+        const timeDiff = Math.abs(endDate - startDate);
+        const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
+
+        if (diffDays > 31) { // maxDays-1 因为包含起始日
+          this.$message.warning('时间区间不能超过一个月');
+          return false;
+        }
+      }
+      return true;
+    },
     // 创建时间
     createChange(createTime) {
       if (createTime && createTime.length >= 2) {
-        const startDate = new Date(createTime[0]);
-        const endDate = new Date(createTime[1]);
-        const timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
-        const diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
-
-        // 限制时间区间为一个月
-        if (diffDays > 31) {
-          this.$message.warning('创建时间区间不能超过一个月');
+        if(!this.checkDateRangeLimit(createTime)){
           this.createTimeText = null;
-          this.queryParams.sTime = null;
-          this.queryParams.eTime = null;
+          this.queryParams.sTime=null;
+          this.queryParams.eTime=null;
           return;
         }
 
@@ -945,6 +1038,13 @@ export default {
     // 更新时间
     updateChange(updateTime) {
       if (updateTime && updateTime.length >= 2) {
+        if(!this.checkDateRangeLimit(updateTime)){
+          this.updateTimeText = null;
+          this.queryParams.upSTime=null;
+          this.queryParams.upETime=null;
+          return;
+        }
+
         // this.updateTimeText = this.formatDateRange(updateTime);
         this.queryParams.upSTime = updateTime[0] || null;
         this.queryParams.upETime = updateTime[1] || null;
@@ -1057,11 +1157,14 @@ export default {
 
     /** 查询短链课程看课记录列表 */
     getList() {
-      // xgb 看课数据量太大必须限制时间
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
+
       this.loading = true;
       let param = JSON.parse(JSON.stringify(this.queryParams));
       if (param.logType == "10") {
@@ -1071,6 +1174,8 @@ export default {
         this.courseWatchLogList = response.rows;
         this.total = response.total;
         this.loading = false;
+      }).catch(() => {
+        this.loading = false;
       });
     },
     // 取消按钮
@@ -1196,10 +1301,17 @@ export default {
       }).catch(() => {
       });
     },
+    // 添加辅助方法
+    isEmptyArray(arr) {
+      return !arr || arr.length === 0;
+    },
     /** 导出按钮操作 */
     handleExport() {
-      if (!this.createTimeText) {
-        this.$message.warning('请选择创建时间');
+      // xgb 看课数据量太大必须限制时间
+      if (this.isEmptyArray(this.createTimeText) &&
+        this.isEmptyArray(this.updateTimeText) &&
+        this.isEmptyArray(this.scheduleTimeText)) {
+        this.$message.warning('请选择创建时间或营期时间或最新更新时间');
         return;
       }
       const queryParams = this.queryParams;
@@ -1486,6 +1598,69 @@ export default {
       this.queryParams.sopId = null;
       this.sopSearchText = '';
     },
+    handleBatchUpdateNotesFilter() {
+      this.notesOpen.open = true;
+      this.notesOpen.filter = true;
+    },
+    handleBatchUpdateNotes() {
+
+      if (this.ids == null || this.ids == "") {
+        return this.$message('请选择需要添加备注的客户');
+      }
+
+      this.notesOpen.open = true;
+      this.notesOpen.filter = false;
+
+    },
+    notesCancel(){
+      this.notesOpen={
+        open: false,
+        notes: null,
+        type: 1,
+        nameType:3,
+      }
+    },
+    notesSubmitForm() {
+
+      if (this.notesOpen.notes == null || this.notesOpen.notes == "") {
+        return this.$message.error("请输入备注内容");
+      }
+
+      // let loadingRock = this.$loading({
+      //   lock: true,
+      //   text: '正在执行中请稍后~~请不要刷新页面!!',
+      //   spinner: 'el-icon-loading',
+      //   background: 'rgba(0, 0, 0, 0.7)'
+      // });
+
+      let obj = JSON.parse(JSON.stringify(this.queryParams))
+      console.log(obj);
+      if(obj.tagIds !== null && obj.tagIds !== undefined && obj.tagIds !== ''){
+        obj.tagIds = obj.tagIds.split(",");
+      }
+      batchUpdateExternalContactNotesByWatchLog({
+        // addType: 0,
+        watchLogIds: this.ids,
+        notes: this.notesOpen.notes,
+        type: this.notesOpen.type,
+        nameType: this.notesOpen.nameType,
+        filter: this.notesOpen.filter,
+        watchLogParam: obj,
+        fromMyList:1
+      }).then(res => {
+
+        this.resultMessage = res.msg;
+        this.$message.success("正在执行中...");
+        // this.resultDialogVisible = true; // 显示弹窗
+        // this.resultTitle = '批量修改备注结果';
+
+      }).finally(res => {
+        this.getList();
+        // loadingRock.close();
+        this.notesCancel();
+      })
+
+    },
   }
 };
 </script>

+ 141 - 19
src/views/qw/externalContact/deptIndex.vue

@@ -166,6 +166,23 @@
 
 
       </el-form-item>
+      <el-form-item label="排除标签" prop="outTagIds">
+        <div @click="hangleChangeOutTags()"
+             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.outSelectTags"
+                    :key="list.tagId"
+                    @close="handleCloseOutTags(list)"
+                    style="margin: 3px;"
+            >{{ list.name }}
+            </el-tag>
+          </div>
+        </div>
+      </el-form-item>
+
       <el-form-item label="备注" prop="remark">
         <el-input
           v-model="queryParams.remark"
@@ -535,8 +552,8 @@
         @pagination="getPageListTagGroup"
       />
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
-        <el-button @click="tagCancel()">取消</el-button>
+        <el-button type="primary" @click="tagSubmitForm(changeTagDialog.type)">确 定</el-button>
+        <el-button @click="tagCancel(changeTagDialog.type)">取消</el-button>
       </div>
     </el-dialog>
 
@@ -970,6 +987,7 @@ export default {
       changeTagDialog:{
         title:"",
         open:false,
+        type: null,
       },
 
       queryTagParams:{
@@ -996,6 +1014,7 @@ export default {
         gender: null,
         description: null,
         tagIds: null,
+        outTagIds: null,
         remark:null,
         remarkMobiles: null,
         remarkCorpName: null,
@@ -1015,6 +1034,7 @@ export default {
         levelType:null
       },
       selectTags:[],
+      outSelectTags:[],
       // 表单参数
       form: {},
       tagList:[],
@@ -1335,6 +1355,7 @@ export default {
 
       this.changeTagDialog.title="搜索的标签"
       this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 1;
 
       // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
       const selectedTagIds = new Set(
@@ -1356,6 +1377,33 @@ export default {
 
     },
 
+
+    //选择排除标签
+    hangleChangeOutTags() {
+      this.changeTagDialog.title="搜索的标签"
+      this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 2;
+
+      // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
+      const selectedTagIds = new Set(
+        (this.outSelectTags || []).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);
+
+    },
+
+
     //删除一些选择的标签
     handleCloseTags(list){
       const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
@@ -1385,6 +1433,36 @@ export default {
 
     },
 
+
+    //删除一些排除的标签
+    handleCloseOutTags(list){
+      const ls = this.outSelectTags.findIndex(t => t.tagId === list.tagId);
+      if (ls !== -1) {
+        this.outSelectTags.splice(ls, 1);
+        this.outSelectTags = [...this.selectTags];
+      }
+
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
+
+    },
+
     //重新获取页面数据
     refreshList(){
       this.getList();
@@ -1588,6 +1666,24 @@ export default {
         this.queryParams.tagIds=null;
       }
 
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
 
       this.queryParams.pageNum = 1;
       this.getList();
@@ -1645,32 +1741,57 @@ export default {
     },
 
     //确定选择标签
-    tagSubmitForm(){
+    tagSubmitForm(type){
 
-      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 (type==1) {
+        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
+              );
 
-            if (!this.selectTags) {
-              this.selectTags = [];
+              // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+              if (!tagExists) {
+                this.selectTags.push(this.tagGroupList[i].tag[x]);
+              }
             }
+          }
+        }
+        if (!this.selectTags || this.selectTags.length === 0) {
+          return this.$message('请选择标签');
+        }
+      }else if (type == 2) {
+        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) {
 
-            // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
-            let tagExists = this.selectTags.some(
-              tag => tag.id === this.tagGroupList[i].tag[x].id
-            );
+              if (!this.outSelectTags) {
+                this.outSelectTags = [];
+              }
 
-            // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
-            if (!tagExists) {
-              this.selectTags.push(this.tagGroupList[i].tag[x]);
+              // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
+              let tagExists = this.outSelectTags.some(
+                tag => tag.id === this.tagGroupList[i].tag[x].id
+              );
+
+              // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+              if (!tagExists) {
+                this.outSelectTags.push(this.tagGroupList[i].tag[x]);
+              }
             }
           }
         }
+        if (!this.outSelectTags || this.outSelectTags.length === 0) {
+          return this.$message('请选择标签');
+        }
       }
-      if (!this.selectTags || this.selectTags.length === 0) {
-        return this.$message('请选择标签');
-      }
-
       this.changeTagDialog.open = false;
     },
 
@@ -1703,6 +1824,7 @@ export default {
       this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
       this.queryParams.transferStatus = null;
       this.selectTags=[];
+      this.outSelectTags=[];
       this.createTime=null;
       this.queryParams.sTime=null;
       this.queryParams.eTime=null;

+ 140 - 28
src/views/qw/externalContact/index.vue

@@ -165,14 +165,6 @@
         </el-select>
       </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>-->
-
         <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"
@@ -186,8 +178,23 @@
             </el-tag>
           </div>
         </div>
+      </el-form-item>
 
-
+      <el-form-item label="排除标签" prop="outTagIds">
+        <div @click="hangleChangeOutTags()"
+             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.outSelectTags"
+                    :key="list.tagId"
+                    @close="handleCloseOutTags(list)"
+                    style="margin: 3px;"
+            >{{ list.name }}
+            </el-tag>
+          </div>
+        </div>
       </el-form-item>
       <el-form-item label="备注" prop="remark">
         <el-input
@@ -596,8 +603,8 @@
         @pagination="getPageListTagGroup"
       />
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
-        <el-button @click="tagCancel()">取消</el-button>
+        <el-button type="primary" @click="tagSubmitForm(changeTagDialog.type)">确 定</el-button>
+        <el-button @click="tagCancel(changeTagDialog.type)">取消</el-button>
       </div>
     </el-dialog>
 
@@ -1097,6 +1104,7 @@ export default {
       changeTagDialog:{
         title:"",
         open:false,
+        type: null,
       },
 
       queryTagParams:{
@@ -1123,6 +1131,7 @@ export default {
         gender: null,
         description: null,
         tagIds: null,
+        outTagIds: null,
         remark:null,
         remarkMobiles: null,
         remarkCorpName: null,
@@ -1144,7 +1153,10 @@ export default {
         companyUser:null,
         userRepeat: null
       },
+      //选择的标签
       selectTags:[],
+      //排除的标签
+      outSelectTags:[],
       // 表单参数
       form: {},
       tagList:[],
@@ -1499,6 +1511,7 @@ export default {
 
       this.changeTagDialog.title="搜索的标签"
       this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 1;
 
       // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
       const selectedTagIds = new Set(
@@ -1517,6 +1530,31 @@ export default {
         }
       }, 200);
 
+    },
+
+
+    //选择排除标签
+    hangleChangeOutTags() {
+      this.changeTagDialog.title="搜索的标签"
+      this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 2;
+
+      // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
+      const selectedTagIds = new Set(
+        (this.outSelectTags || []).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);
 
     },
 
@@ -1549,6 +1587,35 @@ export default {
 
     },
 
+    //删除一些排除的标签
+    handleCloseOutTags(list){
+      const ls = this.outSelectTags.findIndex(t => t.tagId === list.tagId);
+      if (ls !== -1) {
+        this.outSelectTags.splice(ls, 1);
+        this.outSelectTags = [...this.selectTags];
+      }
+
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
+
+    },
+
     //重新获取页面数据
     refreshList(){
       this.getList();
@@ -1740,6 +1807,25 @@ export default {
       }
 
 
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
+
       this.queryParams.pageNum = 1;
       this.getList();
     },
@@ -1765,32 +1851,57 @@ export default {
       this.getPageListTagGroup();
     },
     //确定选择标签
-    tagSubmitForm(){
+    tagSubmitForm(type){
 
-      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 (type==1){
+        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
+              );
 
-            if (!this.selectTags) {
-              this.selectTags = [];
+              // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+              if (!tagExists) {
+                this.selectTags.push(this.tagGroupList[i].tag[x]);
+              }
             }
+          }
+        }
+        if (!this.selectTags || this.selectTags.length === 0) {
+          return this.$message('请选择标签');
+        }
+      }else if (type == 2) {
+        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) {
 
-            // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
-            let tagExists = this.selectTags.some(
-              tag => tag.id === this.tagGroupList[i].tag[x].id
-            );
+              if (!this.outSelectTags) {
+                this.outSelectTags = [];
+              }
 
-            // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
-            if (!tagExists) {
-              this.selectTags.push(this.tagGroupList[i].tag[x]);
+              // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
+              let tagExists = this.outSelectTags.some(
+                tag => tag.id === this.tagGroupList[i].tag[x].id
+              );
+
+              // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+              if (!tagExists) {
+                this.outSelectTags.push(this.tagGroupList[i].tag[x]);
+              }
             }
           }
         }
+        if (!this.outSelectTags || this.outSelectTags.length === 0) {
+          return this.$message('请选择标签');
+        }
       }
-      if (!this.selectTags || this.selectTags.length === 0) {
-        return this.$message('请选择标签');
-      }
-
       this.changeTagDialog.open = false;
     },
 
@@ -1815,6 +1926,7 @@ export default {
       this.queryParams.transferStatus=null;
       this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
       this.selectTags=[];
+      this.outSelectTags=[];
 	   this.createTime=null;
 	  this.queryParams.sTime=null;
 	  this.queryParams.eTime=null;

+ 125 - 4
src/views/qw/externalContact/myExternalContact.vue

@@ -149,6 +149,22 @@
         </div>
 
       </el-form-item>
+      <el-form-item label="排除标签" prop="outTagIds">
+        <div @click="hangleChangeOutTags()"
+             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.outSelectTags"
+                    :key="list.tagId"
+                    @close="handleCloseOutTags(list)"
+                    style="margin: 3px;"
+            >{{ list.name }}
+            </el-tag>
+          </div>
+        </div>
+      </el-form-item>
       <el-form-item label="备注" prop="remark">
         <el-input
           v-model="queryParams.remark"
@@ -533,7 +549,7 @@
       </el-table-column>
     </el-table>
 
-    <pagination
+    <pagination-more
       v-show="total>0"
       :total="total"
       :page.sync="queryParams.pageNum"
@@ -673,8 +689,8 @@
         @pagination="getPageListTagGroup"
       />
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
-        <el-button @click="tagCancel()">取消</el-button>
+        <el-button type="primary" @click="tagSubmitForm(changeTagDialog.type)">确 定</el-button>
+        <el-button @click="tagCancel(changeTagDialog.type)">取消</el-button>
       </div>
     </el-dialog>
 
@@ -1192,6 +1208,7 @@ export default {
         gender: null,
         description: null,
         tagIds: null,
+        outTagIds: null,
         remark:null,
         remarkMobiles: null,
         remarkCorpName: null,
@@ -1225,8 +1242,11 @@ export default {
       changeTagDialog:{
         title:"",
         open:false,
+        type: null,
       },
       selectTags:[],
+      //排除的标签
+      outSelectTags:[],
       // 表单参数
       form: {},
       tagList:[],
@@ -1411,6 +1431,7 @@ export default {
 
       this.changeTagDialog.title="搜索的标签"
       this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 1;
 
       // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
       const selectedTagIds = new Set(
@@ -1431,9 +1452,36 @@ export default {
 
     },
 
+
+    //选择排除标签
+    hangleChangeOutTags() {
+      this.changeTagDialog.title="搜索的标签"
+      this.changeTagDialog.open=true;
+      this.changeTagDialog.type = 2;
+
+      // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
+      const selectedTagIds = new Set(
+        (this.outSelectTags || []).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);
+
+    },
+
     //确定选择标签
-    tagSubmitForm(){
+    tagSubmitForm(type){
 
+      if (type==1) {
         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) {
@@ -1457,7 +1505,31 @@ export default {
         if (!this.selectTags || this.selectTags.length === 0) {
           return this.$message('请选择标签');
         }
+      }else if (type == 2) {
+        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.outSelectTags) {
+                this.outSelectTags = [];
+              }
+
+              // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
+              let tagExists = this.outSelectTags.some(
+                tag => tag.id === this.tagGroupList[i].tag[x].id
+              );
 
+              // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
+              if (!tagExists) {
+                this.outSelectTags.push(this.tagGroupList[i].tag[x]);
+              }
+            }
+          }
+        }
+        if (!this.outSelectTags || this.outSelectTags.length === 0) {
+          return this.$message('请选择标签');
+        }
+      }
       this.changeTagDialog.open = false;
     },
 
@@ -1495,6 +1567,35 @@ export default {
 
     },
 
+    //删除一些排除的标签
+    handleCloseOutTags(list){
+      const ls = this.outSelectTags.findIndex(t => t.tagId === list.tagId);
+      if (ls !== -1) {
+        this.outSelectTags.splice(ls, 1);
+        this.outSelectTags = [...this.selectTags];
+      }
+
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
+
+    },
+
     handleChangeStatus(row) {
       this.statusForm = {
         id: row.id,
@@ -1884,6 +1985,25 @@ export default {
       }
 
 
+      if (this.outSelectTags!=null && this.outSelectTags.length>0){
+        // 确保 this.form.tags 是数组
+        if (!this.queryParams.outTagIds) {
+          this.queryParams.outTagIds = []; // 如果未定义,初始化
+        } else {
+          this.queryParams.outTagIds = []; // 清空已有数据
+        }
+
+        // 遍历并添加 tagId
+        this.outSelectTags.forEach(tag => {
+          if (tag.tagId) { // 确保 tagId 存在
+            this.queryParams.outTagIds.push(tag.tagId);
+          }
+        });
+        this.queryParams.outTagIds=this.queryParams.outTagIds.join(",");
+      }else {
+        this.queryParams.outTagIds=null;
+      }
+
       this.queryParams.pageNum = 1;
       this.getList();
     },
@@ -1894,6 +2014,7 @@ export default {
       this.queryParams.corpId=this.myQwUserList[0].corpId;
       this.queryParams.transferStatus = null;
       this.selectTags=[];
+      this.outSelectTags=[];
 	   this.createTime=null;
 	  this.queryParams.sTime=null;
 	  this.queryParams.eTime=null;

+ 19 - 10
src/views/qw/sop/addSop.vue

@@ -210,13 +210,6 @@
             <Tip title="选择进入SOP任务的标签" />
           </el-form-item>
           <el-form-item label="排除的标签" prop="excludeTags">
-            <!--            <el-select v-model="excludeTags" 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="hangleChangeOutTags()"
                  style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 390px">
               <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
@@ -631,12 +624,15 @@ export default {
         startTime: [{required: true, message: "开始时间不能为空", trigger: "submit"}],
         tempId: [{required: true, message: "模板不能为空", trigger: "submit"}],
         openCommentStatus:[{ required: true, message: '开启评论/弹幕不能为空', trigger: 'change' }]
-      }
+      },
+      //1 总 2 我的 3 部门
+      formType: null,
     };
   },
   created() {
 
     this.form.corpId = this.$route.params && this.$route.params.corpId;
+    this.formType = this.$route.params && this.$route.params.type;
 
     this.queryTagParams.corpId = this.$route.params && this.$route.params.corpId;
 
@@ -1076,7 +1072,14 @@ export default {
               this.msgSuccess("修改成功");
               this.$store.dispatch("tagsView/delView", this.$route);
               // this.$router.replace('/qw/conversion/sop')
-              window.location.replace('/qw/conversion/sop')
+              if (this.formType==1){
+                window.location.replace('/qw/conversion/sop')
+              }else if (this.formType==2){
+                window.location.replace('/qw/conversion/mySop')
+              }else if (this.formType==3){
+                window.location.replace('/qw/conversion/deptSop')
+              }
+
               this.reset();
             });
           } else {
@@ -1084,7 +1087,13 @@ export default {
               this.msgSuccess("新增成功");
               this.$store.dispatch("tagsView/delView", this.$route);
               // this.$router.replace('/qw/conversion/sop')
-              window.location.replace('/qw/conversion/sop')
+              if (this.formType==1){
+                window.location.replace('/qw/conversion/sop')
+              }else if (this.formType==2){
+                window.location.replace('/qw/conversion/mySop')
+              }else if (this.formType==3){
+                window.location.replace('/qw/conversion/deptSop')
+              }
               this.reset();
             });
           }

+ 3 - 2
src/views/qw/sop/deptSop.vue

@@ -912,6 +912,7 @@ import {listTag,} from "@/api/qw/tag";
 import {getMyQwCompanyList} from "@/api/qw/user";
 import {allList} from "@/api/qw/groupChat";
 import SendMsgSopOpenTool from '@/views/qw/sopUserLogsInfo/sendMsgSopOpenTool.vue'
+import {getQwDeptUserList} from "../../../api/company/companyUser";
 
 export default {
   name: "Sop",
@@ -1223,7 +1224,7 @@ export default {
 
     //刷新部分数据
     refreshData(row) {
-      getQwAllUserList(row).then(response => {
+      getQwDeptUserList(row).then(response => {
         this.companyUserList = response.data;
       });
 
@@ -1516,7 +1517,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId)
+      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId+"/"+3)
       // this.open = true;
       // this.setting=[]
       // this.userSelectList=[]

+ 3 - 3
src/views/qw/sop/mySop.vue

@@ -903,7 +903,7 @@ import {
 } from '@/api/qw/sop'
 import {sendMsgSop} from "@/api/qw/sopUserLogsInfo";
 import {listSopTemp} from "@/api/qw/sopTemp";
-import {getQwAllUserList, listUser} from '@/api/company/companyUser'
+import {getQwAllUserList, getQwMyUserList, listUser} from '../../../api/company/companyUser'
 import qwUserList from '@/views/qw/user/qwUserList.vue'
 import ImageUpload from "@/views/qw/sop/ImageUpload";
 import CustomerGroupDetails from '@/views/qw/groupMsg/customerGroupDetails.vue'
@@ -1223,7 +1223,7 @@ export default {
 
     //刷新部分数据
     refreshData(row) {
-      getQwAllUserList(row).then(response => {
+      getQwMyUserList(row).then(response => {
         this.companyUserList = response.data;
       });
 
@@ -1516,7 +1516,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId)
+      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId+"/"+2)
       // this.open = true;
       // this.setting=[]
       // this.userSelectList=[]

+ 2 - 1
src/views/qw/sop/sop.vue

@@ -1111,6 +1111,7 @@ export default {
     }
   },
   methods: {
+
     /**
      * SOP任务营期一键群发
      */
@@ -1518,7 +1519,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId)
+      this.$router.push('/qw/sop/addSop/' + this.queryParams.corpId+"/"+1)
       // this.open = true;
       // this.setting=[]
       // this.userSelectList=[]

+ 145 - 35
src/views/qw/sopTemp/updateSopTemp.vue

@@ -785,6 +785,12 @@ export default {
         companyId: null,
         gap: 1,
       },
+      // 缓存对象用于存储预加载的数据
+      tabCache: {},
+      // 标记哪些tab已经被请求过
+      loadedTabs: new Set(),
+      // 标记正在加载的tab,避免重复请求
+      loadingTabs: new Set(),
       // 表单校验
       rules: {
         name: [
@@ -975,48 +981,140 @@ export default {
       // });
     },
     // 切换标签保存数据
-    leave(index, oldIndex) {
+    async leave(index, oldIndex) {
       const newData = this.setting[index]
       if (newData.dayNum && newData.id) {
-        this.loading = true;
-        selectRulesInfo(newData.id).then(res => {
-          this.$nextTick(() => {
+        // 检查是否已经有缓存数据
+        if (this.tabCache[newData.id]) {
+          // 使用缓存数据,无需loading
+          this.applyCachedData(index, newData);
+        } else {
+          // 没有缓存,需要请求数据
+          this.loading = true;
+          try {
+            const res = await selectRulesInfo(newData.id);
+            // 缓存数据
+            this.tabCache[newData.id] = res.data;
+            this.loadedTabs.add(index);
+            this.applyDataToTab(index, newData, res.data);
+          } catch (error) {
+            console.error("获取规则信息失败:", error);
+          } finally {
             this.loading = false;
-            this.videoList = [];
-            this.addTag = [];
-            this.$set(this.setting, index, {
-              ...newData,
-              voice: res.data.voice,
-              content: res.data.list || [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: ""}]}]
-            });
-
-            for (let j = 0; j < this.setting[index].content.length; j++) {
+          }
+        }
+        
+        // 预加载下一个tab的数据
+        this.preloadNextTab(index);
+      }
+    },
+    
+    // 应用缓存数据到tab
+    applyCachedData(index, newData) {
+      const cachedData = this.tabCache[newData.id];
+      this.$nextTick(() => {
+        this.videoList = [];
+        this.addTag = [];
+        this.$set(this.setting, index, {
+          ...newData,
+          voice: cachedData.voice,
+          content: cachedData.list || [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: ""}]}]
+        });
 
-              if (this.setting[index].content[j].addTag != null) {
-                this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
-              }
-              if (this.setting[index].content[j].delTag != null) {
-                this.setting[index].content[j].delTag = JSON.parse(this.setting[index].content[j].delTag)
-              }
-              this.videoList.push([])
-              this.addTag.push({
-                addTag: [],
-                inputVisible: false,
-                inputValue: '',
-                delTag: [],
-                delTagVisible: false,
-                delTagValue: ''
-              })
-              if (this.setting[index].content[j].type == 2) {
-                if (this.setting[index].content[j].hasOwnProperty('courseId')) {
-                  this.courseChange(this.setting[index].content[j], index, j);
-                }
-              }
-            }
+        for (let j = 0; j < this.setting[index].content.length; j++) {
+          if (this.setting[index].content[j].addTag != null) {
+            this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
+          }
+          if (this.setting[index].content[j].delTag != null) {
+            this.setting[index].content[j].delTag = JSON.parse(this.setting[index].content[j].delTag)
+          }
+          this.videoList.push([])
+          this.addTag.push({
+            addTag: [],
+            inputVisible: false,
+            inputValue: '',
+            delTag: [],
+            delTagVisible: false,
+            delTagValue: ''
           })
+          if (this.setting[index].content[j].type == 2) {
+            if (this.setting[index].content[j].hasOwnProperty('courseId')) {
+              this.courseChange(this.setting[index].content[j], index, j);
+            }
+          }
+        }
+      });
+    },
+    
+    // 应用新获取的数据到tab
+    applyDataToTab(index, newData, data) {
+      this.$nextTick(() => {
+        this.videoList = [];
+        this.addTag = [];
+        this.$set(this.setting, index, {
+          ...newData,
+          voice: data.voice,
+          content: data.list || [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: ""}]}]
         });
-      }
 
+        for (let j = 0; j < this.setting[index].content.length; j++) {
+          if (this.setting[index].content[j].addTag != null) {
+            this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
+          }
+          if (this.setting[index].content[j].delTag != null) {
+            this.setting[index].content[j].delTag = JSON.parse(this.setting[index].content[j].delTag)
+          }
+          this.videoList.push([])
+          this.addTag.push({
+            addTag: [],
+            inputVisible: false,
+            inputValue: '',
+            delTag: [],
+            delTagVisible: false,
+            delTagValue: ''
+          })
+          if (this.setting[index].content[j].type == 2) {
+            if (this.setting[index].content[j].hasOwnProperty('courseId')) {
+              this.courseChange(this.setting[index].content[j], index, j);
+            }
+          }
+        }
+      });
+    },
+    
+    // 预加载下一个tab的数据
+    async preloadNextTab(currentIndex) {
+      const nextIndex = parseInt(currentIndex) + 1;
+      // 检查是否有下一个tab
+      if (nextIndex >= this.setting.length) {
+        return;
+      }
+      
+      const nextTabData = this.setting[nextIndex];
+      // 只预加载已存在的tab(有id的),跳过新建的tab
+      if (!nextTabData.id || !nextTabData.dayNum) {
+        return;
+      }
+      
+      // 如果已经加载过或正在加载,则跳过
+      if (this.loadedTabs.has(nextIndex) || this.loadingTabs.has(nextIndex) || this.tabCache[nextTabData.id]) {
+        return;
+      }
+      
+      // 标记为正在加载
+      this.loadingTabs.add(nextIndex);
+      
+      try {
+        const res = await selectRulesInfo(nextTabData.id);
+        // 缓存数据
+        this.tabCache[nextTabData.id] = res.data;
+        this.loadedTabs.add(nextIndex);
+      } catch (error) {
+        console.error("预加载tab数据失败:", error);
+      } finally {
+        // 移除加载标记
+        this.loadingTabs.delete(nextIndex);
+      }
     },
     save() {
       let data = this.setting[this.tabIndex];
@@ -1079,6 +1177,18 @@ export default {
           ...this.setting[this.tabIndex],
           id: e.data.id,
         });
+        
+        // 更新缓存中的数据
+        const currentTabId = this.setting[this.tabIndex].id;
+        if (currentTabId) {
+          // 重新获取最新数据并更新缓存
+          selectRulesInfo(currentTabId).then(res => {
+            this.tabCache[currentTabId] = res.data;
+            this.loadedTabs.add(parseInt(this.tabIndex));
+          }).catch(error => {
+            console.error("更新缓存失败:", error);
+          });
+        }
       }).catch(() => {
         this.loading = false;
       });