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

1、调整细微参数
2、优化样式

yfh 1 тиждень тому
батько
коміт
b42b4325ca

+ 9 - 1
src/views/qw/sopLogs/sopLogsList.vue

@@ -19,7 +19,15 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-
+<el-form-item label="员工手机号" prop="phone">
+        <el-input
+          v-model="queryParams.phone"
+          placeholder="请输入员工手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="客户昵称" prop="externalUserName">
         <el-input
           v-model="queryParams.externalUserName"

+ 360 - 101
src/views/qw/sopUserLogs/sopUserLogsSchedule.vue

@@ -83,60 +83,131 @@
     <Tip :title="'【批量删除营期】:此功能用于删除选中的【整个营期】,删除之后将不会在给原营期的客户发送消息,ps:删除之后不可恢复'" />
     <Tip :title="'【天数】:【列表:营期时间】对应列表中的天数是几 就代表着 插件助手 会发送【任务模板】里的第几天的消息'" />
 
-    <el-table border v-loading="loading" :data="sopUserLogsList" @selection-change="handleSelectionChange">
+
+    <!-- 分组表格 -->
+    <el-table
+      border
+      v-loading="loading"
+      :data="groupedSopUserLogsList"
+      row-key="groupKey"
+      @selection-change="handleSelectionChange"
+    >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="营期编号" align="center" prop="id" />
-<!--      <el-table-column label="模板编号" align="center" prop="sopTempId" />-->
-      <el-table-column label="企微员工账号" align="center" prop="qwUserId" />
-      <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
-      <el-table-column label="群聊" align="center" prop="chatName" v-if="filterMode == 2" />
       <el-table-column label="营期时间" align="center" prop="startTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
       <el-table-column label="天数" align="center" prop="countDays" />
-      <el-table-column label="状态" align="center" prop="status" >
+      <el-table-column label="企微数量" align="center">
         <template slot-scope="scope">
-          <div v-if="scope.row.userId && scope.row.userId.includes('null')">
-            <span style="color: orange;">营期异常</span>
-          </div>
-          <div v-else>
-            <dict-tag :options="sopUserLogsDelStatus" :value="scope.row.status"/>
-          </div>
-
+          <span>{{ scope.row.items.length }}</span>
         </template>
       </el-table-column>
-
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.status ==1"
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleSelect(scope.row)"
-            v-hasPermi="['qw:sop:list']"
-          >营期详情</el-button>
-          <el-button
-            v-if="scope.row.userId && scope.row.userId.includes('null')"
             size="mini"
             type="text"
-            icon="el-icon-s-check"
-            @click="handleRepairLogs(scope.row)"
+            icon="el-icon-view"
+            @click="showGroupDetails(scope.row)"
             v-hasPermi="['qw:sop:list']"
-          >修复营期</el-button>
-<!--          <el-button-->
-<!--            size="mini"-->
-<!--            type="text"-->
-<!--            icon="el-icon-edit"-->
-<!--            @click="handleTemp(scope.row)"-->
-<!--          >新建群发任务</el-button>-->
+          >详情</el-button>
         </template>
       </el-table-column>
-
     </el-table>
 
+    <!-- 分组详情侧边栏 -->
+    <el-drawer
+      :title="groupDetailTitle"
+      :visible.sync="groupDetailVisible"
+      size="70%" style="font-weight: bolder"
+      direction="rtl"
+    >
+
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-tooltip class="item" effect="dark" content="此功能用于给 选中的 营期 内【所有的】客户发送 消息【或者发送草稿-/-清楚草稿】" placement="top">
+            <el-button class="drawer-header-actions"
+              type="warning"
+              icon="el-icon-s-promotion"
+              size="medium"
+              :disabled="detailMultiple"
+              @click="handleDetailCampSendMsg"
+              v-hasPermi="['qw:sopUserLogsInfo:msg']"
+            >营期一键群发(或草稿)</el-button>
+          </el-tooltip>
+        </el-col>
+
+        <el-col :span="1.5">
+          <el-tooltip class="item" effect="dark" content="删除营期之后,将不会在给原营期的客户发送消息,ps:删除之后不可恢复" placement="top">
+            <el-button
+              type="danger"
+              icon="el-icon-s-promotion"
+              size="medium"
+              :disabled="detailMultiple"
+              @click="handleDetailDeleteUserLogs"
+              v-hasPermi="['qw:sopUserLogs:remove']"
+            >批量删除营期</el-button>
+          </el-tooltip>
+        </el-col>
+      </el-row>
+    <div style="margin: 20px">
+
+      <el-table
+        :data="currentGroupDetails"
+        border
+        @selection-change="handleDetailSelectionChange"
+        v-loading="detailLoading"
+      >
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="营期编号" align="center" prop="id" />
+        <!--      <el-table-column label="模板编号" align="center" prop="sopTempId" />-->
+        <el-table-column label="企微员工账号" align="center" prop="qwUserId" />
+        <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
+        <el-table-column label="群聊" align="center" prop="chatName" v-if="filterMode == 2" />
+        <el-table-column label="营期时间" align="center" prop="startTime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="天数" align="center" prop="countDays" />
+        <el-table-column label="状态" align="center" prop="status" >
+          <template slot-scope="scope">
+            <div v-if="scope.row.userId && scope.row.userId.includes('null')">
+              <span style="color: orange;">营期异常</span>
+            </div>
+            <div v-else>
+              <dict-tag :options="sopUserLogsDelStatus" :value="scope.row.status"/>
+            </div>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button
+              v-if="scope.row.status ==1"
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleSelect(scope.row)"
+              v-hasPermi="['qw:sop:list']"
+            >营期详情</el-button>
+            <el-button
+              v-if="scope.row.userId && scope.row.userId.includes('null')"
+              size="mini"
+              type="text"
+              icon="el-icon-s-check"
+              @click="handleRepairLogs(scope.row)"
+              v-hasPermi="['qw:sop:list']"
+            >修复营期</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+    </div>
+    </el-drawer>
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -145,14 +216,12 @@
       @pagination="getList"
     />
 
-
-    <!--  执行详情  -->
+    <!-- 执行详情 -->
     <el-drawer :title="logsInfoDetailsOpen.title" :visible.sync="logsInfoDetailsOpen.open" size="70%" style="font-weight: bolder">
       <sop-user-logs-info-details ref="SopUserLogsInfoDetails" :rowDetailFrom="logsInfoDetailsOpen.item" @flashNotify="flashNotify"></sop-user-logs-info-details>
     </el-drawer>
 
-    <send-msg-open-tool ref="sendMsgOpenTool" ></send-msg-open-tool>
-
+    <send-msg-open-tool ref="sendMsgOpenTool"></send-msg-open-tool>
   </div>
 </template>
 
@@ -171,18 +240,26 @@ import SopUserLogsInfoDetails from "@/views/qw/sopUserLogsInfo/sopUserLogsInfoDe
 import {syncMyExternalContact} from "@/api/qw/externalContact";
 import SendMsgOpenTool from "@/views/qw/sopUserLogsInfo/sendMsgOpenTool.vue";
 import Tip from "../../../components/Tip/index.vue";
+
 export default {
   name: "sopUserLogsSchedule",
   components: {Tip, SendMsgOpenTool, SopUserLogsInfoDetails, sopLogsDetails},
-  props:{
-    rowDetailFrom:{},
+  props: {
+    rowDetailFrom: {},
   },
 
   data() {
     return {
-      sopUserLogId:null,
-      sopName:'',
-      tempId:'',
+      detailSelected: [], // 侧边栏选中的项
+      detailMultiple: true, // 侧边栏多选禁用状态
+      // 新增的弹窗相关数据
+      groupDetailVisible: false,
+      groupDetailTitle: '',
+      currentGroupDetails: [],
+      detailLoading: false,
+      sopUserLogId: null,
+      sopName: '',
+      tempId: '',
       // 遮罩层
       loading: true,
       // 导出遮罩层
@@ -198,14 +275,15 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
-      logsInfoDetailsOpen:{
-        title:"",
-        open:false,
+      logsInfoDetailsOpen: {
+        title: "",
+        open: false,
       },
-      sysQwSopAiContentType:[],
+      sysQwSopAiContentType: [],
       // sopUserLogs表格数据
       sopUserLogsList: [],
-      sopUserLogsDelStatus:[],
+      groupedSopUserLogsList: [], // 分组后的数据
+      sopUserLogsDelStatus: [],
       // 弹出层标题
       title: "",
       filterMode: 1,
@@ -216,8 +294,8 @@ export default {
         pageNum: 1,
         pageSize: 10,
         sopId: null,
-        userLogsId:null,
-        externalUserName:null,
+        userLogsId: null,
+        externalUserName: null,
         sopTempId: null,
         qwUserId: null,
         corpId: null,
@@ -225,21 +303,19 @@ export default {
         status: null,
         userId: null
       },
-      setting:[],
+      setting: [],
       // 表单参数
       form: {},
       tempForm: {
-        setting:null,
-        videoIdSet:null,
-        courseIdSet:null,
+        setting: null,
+        videoIdSet: null,
+        courseIdSet: null,
       },
       // 表单校验
-      rules: {
-      }
+      rules: {}
     };
   },
   created() {
-
     this.getDicts("sys_company_status").then(response => {
       this.statusOptions = response.data;
     });
@@ -254,49 +330,222 @@ export default {
     this.filterMode = this.$route.query.filterMode;
     this.sopName = this.$route.query.name;
     this.tempId = this.$route.query.tempId;
-    this.queryParams.corpId= this.$route.query.corpId;
+    this.queryParams.corpId = this.$route.query.corpId;
 
     this.getList()
-
   },
   methods: {
     /** 查询sopUserLogs列表 */
     getList() {
       this.loading = true;
       listSopUserLogs(this.queryParams).then(response => {
-        this.sopUserLogsList = response.rows;
+        /**this.sopUserLogsList = response.rows;*/
+        this.sopUserLogsList = [
+        {
+          id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+          qwUserId: "zhuangxu",
+          qwUserName: "云联技术庄旭",
+          startTime: "2025-05-10",
+          status: 1,
+          countDays: 29,
+          sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+          corpId: "wwf3d04b7638b6018a",
+          userId: "27621|9241|278",
+          sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+          chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+          chatName: "测试1"
+        },
+        {
+          id: "e7b4e46c-4243-12g1-90d6-636511e460cg",
+          qwUserId: "lisi",
+          qwUserName: "云联技术李四",
+          startTime: "2025-05-10",
+          status: 0,
+          countDays: 29,
+          sopTempId: "5ce8a880-38e5-57bd-03d6-9g90a9087bc1",
+          corpId: "wwf3d04b7638b6018a",
+          userId: "27621|9241|279",
+          sopId: "5fdb245be193d5b4697e5d8g6905edba",
+          chatId: "xs8suGDQBBDOh6zF1cFbz7KyRrmK-vFx",
+          chatName: "测试1"
+        },
+        {
+          id: "f8c5f57d-5354-13h2-01e7-747622f571dh",
+          qwUserId: "wangwu",
+          qwUserName: "云联技术王五",
+          startTime: "2025-05-20",
+          status: 1,
+          countDays: 15,
+          sopTempId: "6df9b991-49f6-68ce-14e7-0h01b0198cd2",
+          corpId: "wwf3d04b7638b6018a",
+          userId: "27621|9241|280",
+          sopId: "60ec356cf2a4e6c57a8f6e9h7806fecb",
+          chatId: "yt9tvHEZCCCEPi7AG2dGc8LzSsmL-wGy",
+          chatName: "测试2"
+        },{
+            id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+            qwUserId: "zhuangxu",
+            qwUserName: "云联技术庄旭",
+            startTime: "2025-05-14",
+            status: 1,
+            countDays: 34,
+            sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+            corpId: "wwf3d04b7638b6018a",
+            userId: "27621|9241|278",
+            sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+            chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+            chatName: "测试1"
+          },{
+            id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+            qwUserId: "zhuangxu",
+            qwUserName: "云联技术庄旭",
+            startTime: "2025-05-14",
+            status: 1,
+            countDays: 34,
+            sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+            corpId: "wwf3d04b7638b6018a",
+            userId: "27621|9241|278",
+            sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+            chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+            chatName: "测试1"
+          },{
+            id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+            qwUserId: "zhuangxu",
+            qwUserName: "云联技术庄旭",
+            startTime: "2025-05-11",
+            status: 1,
+            countDays: 22,
+            sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+            corpId: "wwf3d04b7638b6018a",
+            userId: "27621|9241|278",
+            sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+            chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+            chatName: "测试1"
+          },{
+            id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+            qwUserId: "zhuangxu",
+            qwUserName: "云联技术庄旭",
+            startTime: "2025-05-11",
+            status: 1,
+            countDays: 22,
+            sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+            corpId: "wwf3d04b7638b6018a",
+            userId: "27621|9241|278",
+            sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+            chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+            chatName: "测试1"
+          },{
+            id: "d6a3d35b-3132-11f0-89c5-525400d359bf",
+            qwUserId: "zhuangxu",
+            qwUserName: "云联技术庄旭",
+            startTime: "2025-05-11",
+            status: 1,
+            countDays: 22,
+            sopTempId: "4bd7976f-27d4-46ac-92c5-8f89c8996ab0",
+            corpId: "wwf3d04b7638b6018a",
+            userId: "27621|9241|278",
+            sopId: "4eca134ad082c4a3586e4c7f5804dca9",
+            chatId: "wr7rtFCQAACNg5yE0bEay6JxSqlJ-uEw",
+            chatName: "测试1"
+          },
+      ];
         this.total = response.total;
+        this.groupData();
         this.loading = false;
       });
     },
 
+    // 分组处理数据
+    groupData() {
+      const groups = {};
+      this.sopUserLogsList.forEach(item => {
+        const groupKey = `${item.startTime}_${item.countDays}`;
+        if (!groups[groupKey]) {
+          groups[groupKey] = {
+            key: groupKey,
+            countDays: item.countDays,
+            startTime: item.startTime,
+            items: [],
+            checked: false,
+            indeterminate: false,
+            expanded: false
+          };
+        }
+        groups[groupKey].items.push(item);
+      });
 
+      this.groupedSopUserLogsList = Object.values(groups);
+      this.groupedSopUserLogsList.sort((a, b) => b.countDays - a.countDays);
+    },
+    // 显示分组详情
+    showGroupDetails(row) {
+      this.groupDetailTitle = `营期详情 - ${this.parseTime(row.startTime, '{y}-{m}-{d}')} (天数: ${row.countDays})`;
+      this.currentGroupDetails = row.items;
+      this.groupDetailVisible = true;
+
+      // 重置选择状态
+      this.$nextTick(() => {
+        if (this.$refs.detailTable) {
+          this.$refs.detailTable.clearSelection();
+        }
+        this.detailMultiple = !this.detailSelected.length;
+      });
+    },
+    // 侧边栏选择变化
+    handleDetailSelectionChange(selection) {
+      this.detailSelected = selection;
+      this.detailMultiple = !selection.length;
+    },
     /**
      * 营期一键群发
      */
-    handleCampSendMsg(){
-
+    handleCampSendMsg() {
       setTimeout(() => {
-        this.$refs.sendMsgOpenTool.oneClickGroupSending(this.ids,2,this.queryParams.corpId);
+        this.$refs.sendMsgOpenTool.oneClickGroupSending(this.ids, 2, this.queryParams.corpId);
       }, 500);
-
     },
-
     /**
-     *  删除营期
+     *     营期一键群发
      */
-    handleDeleteUserLogs(){
-      const ids =  this.ids;
+    handleDetailCampSendMsg() {
+      const ids = this.detailSelected.map(item => item.id);
+      setTimeout(() => {
+        this.$refs.sendMsgOpenTool.oneClickGroupSending(ids, 2, this.queryParams.corpId);
+      }, 500);
+    },
+    /**
+     * 删除详情营期
+     */
+    handleDetailDeleteUserLogs() {
+      const ids = this.detailSelected.map(item => item.id);
+      this.$confirm('是否确认删除编号为"' + ids + '"的数据项【注意!!删除后不可恢复,请谨慎操作】?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return delSopUserLogs(ids);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /**
+     * 删除营期
+     */
+    handleDeleteUserLogs() {
+      const ids = this.ids;
       this.$confirm('是否确认删除编号为"' + ids + '"的数据项【注意!!删除后不可恢复,请谨慎操作】?', "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
-      }).then(function() {
+      }).then(function () {
         return delSopUserLogs(ids);
       }).then(() => {
         this.getList();
         this.msgSuccess("删除成功");
-      }).catch(() => {});
+      }).catch(() => {
+      });
     },
 
     // 取消按钮
@@ -304,14 +553,12 @@ export default {
       this.open = false;
       this.reset();
     },
-    addSetList(){
-        const newSetting = {
-          contentType:'1',
-          value: '',
-        };
-        // 将新设置项添加到 content.setting 数组中
-        this.setting.push(newSetting);
-
+    addSetList() {
+      const newSetting = {
+        contentType: '1',
+        value: '',
+      };
+      this.setting.push(newSetting);
     },
     // 表单重置
     reset() {
@@ -338,29 +585,34 @@ export default {
       this.handleQuery();
     },
 
-    flashNotify(){
+    flashNotify() {
       this.getList();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      // 获取所有分组项的子项ID
+      this.ids = selection.reduce((acc, group) => {
+        if (group.items) {
+          return [...acc, ...group.items.map(item => item.id)];
+        }
+        return [...acc, group.id];
+      }, []);
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
 
-    handleSelect(val){
+    handleSelect(val) {
       val.filterMode = this.filterMode;
       this.logsInfoDetailsOpen.title='企微账号:'+val.qwUserId+'  '+'营期时间:'+val.startTime+'  '+'天数:' + val.countDays;
-      this.logsInfoDetailsOpen.open=true;
+      this.logsInfoDetailsOpen.open = true;
       const externalUserName = this.queryParams.externalUserName;
       setTimeout(() => {
-        this.$refs.SopUserLogsInfoDetails.selectSopUserLogsInfo(val,externalUserName);
+        this.$refs.SopUserLogsInfoDetails.selectSopUserLogsInfo(val, externalUserName);
       }, 500);
-
     },
 
-    handleRepairLogs(val){
-      this.loading=true;
+    handleRepairLogs(val) {
+      this.loading = true;
       let loadingRock = this.$loading({
         lock: true,
         text: '正在修复中请稍后~~!!',
@@ -370,28 +622,28 @@ export default {
 
       repairSopUserLogs(val).then(res => {
         this.msgSuccess("修复成功成功");
-      }).catch(res=>{
-      }).finally(res=>{
+      }).catch(res => {
+      }).finally(res => {
         loadingRock.close();
-        this.loading=false;
+        this.loading = false;
         this.getList();
       })
-
     },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出所有sopUserLogs数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportSopUserLogs(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportSopUserLogs(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+      });
     }
   }
 };
@@ -401,4 +653,11 @@ export default {
 .custom-style {
   font-weight: bold; /* 加粗 */
 }
+
+/* 新增样式 */
+.drawer-header-actions {
+  display: flex;
+  margin-left: 20px;
+}
+
 </style>