浏览代码

修复部门一键群发问题

吴树波 1 天之前
父节点
当前提交
9e69b7fd7e
共有 2 个文件被更改,包括 173 次插入57 次删除
  1. 93 35
      src/views/qw/sop/deptSop.vue
  2. 80 22
      src/views/qw/sop/mySop.vue

+ 93 - 35
src/views/qw/sop/deptSop.vue

@@ -104,6 +104,18 @@
         >删除
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleSopLogsDelete"
+          v-hasPermi="['qw:sopLogs:removeAll']"
+        >批量删除执行任务
+        </el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="success"
@@ -128,6 +140,18 @@
         >批量执行SOP
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-tooltip class="item" effect="dark" content="此功能用于给 选中的 SOP任务营期 内【所有的】客户发送 消息【或者发送草稿-/-清楚草稿】" placement="top">
+          <el-button
+            type="warning"
+            icon="el-icon-s-promotion"
+            size="mini"
+            :disabled="multiple"
+            @click="handleCampSendMsg"
+            v-hasPermi="['qw:sopUserLogsInfo:msgSop']"
+          >SOP营期一键群发(或草稿)</el-button>
+        </el-tooltip>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <el-table v-loading="loading" border :data="sopList" @selection-change="handleSelectionChange">
@@ -313,6 +337,7 @@
       @pagination="getList"
     />
 
+    <send-msg-sop-open-tool ref="sendMsgSopOpenTool" ></send-msg-sop-open-tool>
     <!-- 添加或修改企微sop对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
@@ -866,7 +891,7 @@
 import {
   addSop,
   courseList,
-  delSop,
+  delSop, delSopLogs,
   exportSop,
   getSopVoiceList, listDeptSop,
   listSop,
@@ -886,10 +911,11 @@ import sopLogsDetails from '@/views/qw/sopLogs/sopLogsList.vue'
 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'
 
 export default {
   name: "Sop",
-  components: {CustomerGroupDetails, qwUserList, ImageUpload, sopLogsDetails},
+  components: {CustomerGroupDetails, qwUserList, ImageUpload, sopLogsDetails, SendMsgSopOpenTool},
   data() {
     return {
       // 存储每一行的展开状态
@@ -1084,6 +1110,16 @@ export default {
     }
   },
   methods: {
+    /**
+     * SOP任务营期一键群发
+     */
+    handleCampSendMsg(){
+
+      setTimeout(() => {
+        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+      }, 500);
+
+    },
     voice(id) {
       this.voiceForm.queryParams.id = id;
       getSopVoiceList(this.voiceForm.queryParams).then(res => {
@@ -1355,9 +1391,9 @@ export default {
       });
     },
 
-    addSetList() {
+    addSetList(){
       const newSetting = {
-        contentType: '1',
+        contentType:'1',
         value: '',
       };
       // 将新设置项添加到 content.setting 数组中
@@ -1368,7 +1404,7 @@ export default {
     handleContentTypeChange() {
 
       //如果是链接的才上
-      if (this.msgForm.courseId != null) {
+      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++) {
           //响应式直接给链接的标题/封面上值
@@ -1376,6 +1412,9 @@ export default {
             this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
             this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
           }
+          if (selectedCourse && this.setting[i].contentType == 4 && this.msgForm.courseId != null) {
+            this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
+          }
 
         }
 
@@ -1386,12 +1425,20 @@ 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) {
+            console.log(2, this.setting[i].contentType)
+            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);
+            }
+
           }
         }
       }
 
+
     },
     videoIdChange() {
       if (this.msgForm.videoId != null) {
@@ -1441,7 +1488,7 @@ export default {
         createBy: null,
         createTime: null,
         isAutoSop: null,
-        autoSopTime: { autoSopType: 2, autoStartTime: '00:00', autoEndTime: '24:00', autoSopSend: 2 },
+        autoSopTime: {autoSopType: 2, autoStartTime: '00:00', autoEndTime: '24:00', autoSopSend: 2},
       };
       this.resetForm("form");
       this.tags = null;
@@ -1490,7 +1537,7 @@ export default {
         tempId: row.tempId,
         filterMode: row.filterMode,
         corpId: row.corpId,
-        type:1,
+        type: 1,
       }
       // 使用 params 传递参数
       this.$router.push({
@@ -1517,7 +1564,7 @@ export default {
         this.msgError(res.msg);
       }
     },
-    beforeAvatarUploadFile(file) {
+    beforeAvatarUploadFile(file){
       const isLt1M = file.size / 1024 / 1024 < 10;
       if (!isLt1M) {
         this.$message.error('上传大小不能超过 10MB!');
@@ -1531,7 +1578,7 @@ export default {
     },
 
     handleAvatarSuccessVideo(res, file, item) {
-      if (res.code == 200) {
+      if(res.code==200){
         // 使用 $set 确保响应式更新
         this.$set(item, 'videoUrl', res.url);
       } else {
@@ -1539,7 +1586,7 @@ export default {
       }
     },
 
-    beforeAvatarUploadVideo(file) {
+    beforeAvatarUploadVideo(file){
       const isLt30M = file.size / 1024 / 1024 < 10;
       const isMP4 = file.type === 'video/mp4';
 
@@ -1556,7 +1603,7 @@ export default {
       return true;
     },
 
-    handleInputVideoText(value, content) {
+    handleInputVideoText(value,content){
       // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
       const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
 
@@ -1647,7 +1694,7 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
-      }).then(function() {
+      }).then(function () {
         return delSop(ids);
       }).then(() => {
         this.getList();
@@ -1655,6 +1702,17 @@ export default {
       }).catch(() => {
       });
     },
+    /** 删除按钮操作 */
+    handleSopLogsDelete() {
+      this.$confirm('是否确认删除企微sop编号为"' + this.ids + '"的所有发送任务(执行记录)数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => delSopLogs(this.ids)).then(() => {
+        this.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
     /**
      * 批量执行SOP任务
      */
@@ -1727,32 +1785,32 @@ export default {
     /**
      * 一键群发
      */
-    handleSendMsg(row) {
+    handleSendMsg(row){
       this.sendMsgOpen.open = true;
       this.sendMsgOpen.id = row.id;
       this.sendMsgOpen.row = row;
       this.msgForm.chatIds = row.chatId.split(",");
     },
-    submitMsgForm() {
+    submitMsgForm(){
       this.$refs["msgForm"].validate(valid => {
         if (valid) {
-          this.msgForm.setting = JSON.stringify(this.setting)
-          this.msgForm.sopId = this.sendMsgOpen.row.id;
-          this.msgForm.corpId = this.sendMsgOpen.row.corpId;
-          this.msgForm.filterMode = this.sendMsgOpen.row.filterMode;
+          this.msgForm.setting=JSON.stringify(this.setting)
+          this.msgForm.sopId=this.sendMsgOpen.row.id;
+          this.msgForm.corpId=this.sendMsgOpen.row.corpId;
+          this.msgForm.filterMode=this.sendMsgOpen.row.filterMode;
 
           if (this.setting.length <= 0) {
             return this.$message.error("请添加规则")
           }
-          if (this.msgForm.courseId === null || this.msgForm.courseId === '') {
+          if (this.msgForm.courseId===null || this.msgForm.courseId===''){
             return this.$message.error("课程不能为空")
           }
 
-          if (this.msgForm.videoId === null || this.msgForm.videoId === '') {
+          if (this.msgForm.videoId===null || this.msgForm.videoId===''){
             return this.$message.error("课节不能为空")
           }
 
-          if (this.msgForm.courseType === null || this.msgForm.courseType === '') {
+          if (this.msgForm.courseType===null || this.msgForm.courseType===''){
             return this.$message.error("消息类型不能为空")
           }
 
@@ -1798,19 +1856,19 @@ export default {
           sendMsgSop(this.msgForm).then(response => {
             this.msgSuccess("一键群发成功");
             loading.close();
-            this.setting = [];
+            this.setting=[];
             this.msgForm = {
-              videoId: null,
-              courseId: null,
-              courseType: null,
-              setting: null,
-              isRegister: 2,
-              sendType: 1,
-              filterMode: 2,
+              videoId:null,
+              courseId:null,
+              courseType:null,
+              setting:null,
+              isRegister:2,
+              sendType:1,
+              filterMode:2,
 
             }
             this.getList();
-          }).finally(() => {
+          }).finally(()=>{
             loading.close();
           });
 
@@ -1837,12 +1895,12 @@ export default {
         this.videoList = response.list;
       });
     },
-    cancelMsgForm() {
+    cancelMsgForm(){
       this.sendMsgOpen.open = false;
       this.resetSendMsgSop();
     },
-    delSetList(index) {
-      this.setting.splice(index, 1)
+    delSetList(index){
+      this.setting.splice(index,1)
     },
   }
 };

+ 80 - 22
src/views/qw/sop/mySop.vue

@@ -104,6 +104,18 @@
         >删除
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleSopLogsDelete"
+          v-hasPermi="['qw:sopLogs:removeAll']"
+        >批量删除执行任务
+        </el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="success"
@@ -128,6 +140,18 @@
         >批量执行SOP
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-tooltip class="item" effect="dark" content="此功能用于给 选中的 SOP任务营期 内【所有的】客户发送 消息【或者发送草稿-/-清楚草稿】" placement="top">
+          <el-button
+            type="warning"
+            icon="el-icon-s-promotion"
+            size="mini"
+            :disabled="multiple"
+            @click="handleCampSendMsg"
+            v-hasPermi="['qw:sopUserLogsInfo:msgSop']"
+          >SOP营期一键群发(或草稿)</el-button>
+        </el-tooltip>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <el-table v-loading="loading" border :data="sopList" @selection-change="handleSelectionChange">
@@ -313,6 +337,7 @@
       @pagination="getList"
     />
 
+    <send-msg-sop-open-tool ref="sendMsgSopOpenTool" ></send-msg-sop-open-tool>
     <!-- 添加或修改企微sop对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
@@ -866,7 +891,7 @@
 import {
   addSop,
   courseList,
-  delSop,
+  delSop, delSopLogs,
   exportSop,
   getSopVoiceList, listMySop,
   listSop,
@@ -886,10 +911,11 @@ import sopLogsDetails from '@/views/qw/sopLogs/sopLogsList.vue'
 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'
 
 export default {
   name: "Sop",
-  components: {CustomerGroupDetails, qwUserList, ImageUpload, sopLogsDetails},
+  components: {CustomerGroupDetails, qwUserList, ImageUpload, sopLogsDetails, SendMsgSopOpenTool},
   data() {
     return {
       // 存储每一行的展开状态
@@ -1084,6 +1110,16 @@ export default {
     }
   },
   methods: {
+    /**
+     * SOP任务营期一键群发
+     */
+    handleCampSendMsg(){
+
+      setTimeout(() => {
+        this.$refs.sendMsgSopOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+      }, 500);
+
+    },
     voice(id) {
       this.voiceForm.queryParams.id = id;
       getSopVoiceList(this.voiceForm.queryParams).then(res => {
@@ -1355,9 +1391,9 @@ export default {
       });
     },
 
-    addSetList() {
+    addSetList(){
       const newSetting = {
-        contentType: '1',
+        contentType:'1',
         value: '',
       };
       // 将新设置项添加到 content.setting 数组中
@@ -1368,7 +1404,7 @@ export default {
     handleContentTypeChange() {
 
       //如果是链接的才上
-      if (this.msgForm.courseId != null) {
+      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++) {
           //响应式直接给链接的标题/封面上值
@@ -1376,6 +1412,9 @@ export default {
             this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
             this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
           }
+          if (selectedCourse && this.setting[i].contentType == 4 && this.msgForm.courseId != null) {
+            this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
+          }
 
         }
 
@@ -1386,12 +1425,20 @@ 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) {
+            console.log(2, this.setting[i].contentType)
+            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);
+            }
+
           }
         }
       }
 
+
     },
     videoIdChange() {
       if (this.msgForm.videoId != null) {
@@ -1441,7 +1488,7 @@ export default {
         createBy: null,
         createTime: null,
         isAutoSop: null,
-        autoSopTime: { autoSopType: 2, autoStartTime: '00:00', autoEndTime: '24:00', autoSopSend: 2 },
+        autoSopTime: {autoSopType: 2, autoStartTime: '00:00', autoEndTime: '24:00', autoSopSend: 2},
       };
       this.resetForm("form");
       this.tags = null;
@@ -1517,7 +1564,7 @@ export default {
         this.msgError(res.msg);
       }
     },
-    beforeAvatarUploadFile(file) {
+    beforeAvatarUploadFile(file){
       const isLt1M = file.size / 1024 / 1024 < 10;
       if (!isLt1M) {
         this.$message.error('上传大小不能超过 10MB!');
@@ -1531,7 +1578,7 @@ export default {
     },
 
     handleAvatarSuccessVideo(res, file, item) {
-      if (res.code == 200) {
+      if(res.code==200){
         // 使用 $set 确保响应式更新
         this.$set(item, 'videoUrl', res.url);
       } else {
@@ -1539,7 +1586,7 @@ export default {
       }
     },
 
-    beforeAvatarUploadVideo(file) {
+    beforeAvatarUploadVideo(file){
       const isLt30M = file.size / 1024 / 1024 < 10;
       const isMP4 = file.type === 'video/mp4';
 
@@ -1556,7 +1603,7 @@ export default {
       return true;
     },
 
-    handleInputVideoText(value, content) {
+    handleInputVideoText(value,content){
       // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
       const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
 
@@ -1647,7 +1694,7 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
-      }).then(function() {
+      }).then(function () {
         return delSop(ids);
       }).then(() => {
         this.getList();
@@ -1655,6 +1702,17 @@ export default {
       }).catch(() => {
       });
     },
+    /** 删除按钮操作 */
+    handleSopLogsDelete() {
+      this.$confirm('是否确认删除企微sop编号为"' + this.ids + '"的所有发送任务(执行记录)数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => delSopLogs(this.ids)).then(() => {
+        this.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
     /**
      * 批量执行SOP任务
      */
@@ -1727,32 +1785,32 @@ export default {
     /**
      * 一键群发
      */
-    handleSendMsg(row) {
+    handleSendMsg(row){
       this.sendMsgOpen.open = true;
       this.sendMsgOpen.id = row.id;
       this.sendMsgOpen.row = row;
       this.msgForm.chatIds = row.chatId.split(",");
     },
-    submitMsgForm() {
+    submitMsgForm(){
       this.$refs["msgForm"].validate(valid => {
         if (valid) {
-          this.msgForm.setting = JSON.stringify(this.setting)
-          this.msgForm.sopId = this.sendMsgOpen.row.id;
-          this.msgForm.corpId = this.sendMsgOpen.row.corpId;
-          this.msgForm.filterMode = this.sendMsgOpen.row.filterMode;
+          this.msgForm.setting=JSON.stringify(this.setting)
+          this.msgForm.sopId=this.sendMsgOpen.row.id;
+          this.msgForm.corpId=this.sendMsgOpen.row.corpId;
+          this.msgForm.filterMode=this.sendMsgOpen.row.filterMode;
 
           if (this.setting.length <= 0) {
             return this.$message.error("请添加规则")
           }
-          if (this.msgForm.courseId === null || this.msgForm.courseId === '') {
+          if (this.msgForm.courseId===null || this.msgForm.courseId===''){
             return this.$message.error("课程不能为空")
           }
 
-          if (this.msgForm.videoId === null || this.msgForm.videoId === '') {
+          if (this.msgForm.videoId===null || this.msgForm.videoId===''){
             return this.$message.error("课节不能为空")
           }
 
-          if (this.msgForm.courseType === null || this.msgForm.courseType === '') {
+          if (this.msgForm.courseType===null || this.msgForm.courseType===''){
             return this.$message.error("消息类型不能为空")
           }