xdd 1 tuần trước cách đây
mục cha
commit
7be1aa8a1b

+ 51 - 0
src/api/system/employeeStats.js

@@ -0,0 +1,51 @@
+import request from '@/utils/request'
+
+// 查询员工完成统计列表
+export function listEmployeeStats(query) {
+  return request({
+    url: '/stats/seller/pageList',
+    method: 'post',
+    data: query
+  })
+}
+
+// 查询员工完成统计详细
+export function getEmployeeStats(id) {
+  return request({
+    url: '/system/employeeStats/' + id,
+    method: 'get'
+  })
+}
+
+// 获取员工列表
+export function getEmployeeList() {
+  return request({
+    url: '/system/employee/list',
+    method: 'get'
+  })
+}
+
+// 获取频道列表
+export function getChannelList() {
+  return request({
+    url: '/system/channel/list',
+    method: 'get'
+  })
+}
+
+// 导出员工完成统计
+export function exportEmployeeStats(query) {
+  return request({
+    url: '/system/employeeStats/export',
+    method: 'post',
+    data: query
+  })
+}
+
+// 获取SOP任务数据
+export function getSOPTaskData(param){
+  return request({
+    url: '/stats/sopTaskData',
+    method: 'get'
+  })
+}

+ 539 - 0
src/components/TreeSelect/index.vue

@@ -0,0 +1,539 @@
+<template>
+  <div class="task-select-tree" :style="{ width: componentWidth }">
+    <el-popover
+      ref="popover"
+      placement="bottom-start"
+      :width="popoverComputedWidth"
+      trigger="click"
+      v-model="popoverVisible"
+      popper-class="task-select-tree-popper"
+      :disabled="disabled"
+      @show="onPopoverShow"
+    >
+      <div class="popover-content-wrapper">
+        <el-input
+          v-if="filterable"
+          placeholder="输入关键字过滤"
+          v-model="filterText"
+          size="mini"
+          clearable
+          class="filter-input"
+        >
+        </el-input>
+        <el-scrollbar :style="{ height: treeHeight + 'px' }" class="tree-scrollbar">
+          <el-tree
+            ref="taskTree"
+            :data="processedTreeData"
+            :props="treeProps"
+            show-checkbox
+            :node-key="nodeKey"
+            :default-expand-all="defaultExpandAll"
+            :expand-on-click-node="false"
+            :check-strictly="checkStrictly"
+            :filter-node-method="filterNode"
+            @check="handleTreeCheck"
+            :default-checked-keys="tempCheckedKeys"
+            class="task-tree-in-popover"
+          >
+            <span class="custom-tree-node" slot-scope="{ node, data }">
+              <span>{{ node.label }}</span>
+              <span v-if="!data.isParent && showNodeDetail" class="node-detail-text">
+                (ID: {{ data.originalData.qwUserId}} {{ data.originalData.taskExecDate }})
+              </span>
+            </span>
+          </el-tree>
+        </el-scrollbar>
+        <div class="popover-footer">
+          <el-button size="mini" @click="handleClearInPopover">清空</el-button>
+          <el-button type="primary" size="mini" @click="handleConfirm">确定</el-button>
+        </div>
+      </div>
+
+      <div
+        slot="reference"
+        :class="['select-trigger-wrapper', { 'is-disabled': disabled, 'is-active': popoverVisible }]"
+        @mouseenter="inputHovering = true"
+        @mouseleave="inputHovering = false"
+      >
+        <div class="tags-or-value-container">
+          <template v-if="multiple && currentSelectedDisplayNodes.length > 0">
+            <el-tag
+              v-for="node in currentSelectedDisplayNodes"
+              :key="node[nodeKey]"
+              type="info"
+              size="small"
+              closable
+              :disable-transitions="true"
+              @close.stop="removeTag(node)"
+              class="trigger-tag"
+            >
+              {{ node[treeProps.label] }}
+            </el-tag>
+            <el-tag
+              v-if="currentSelectedNodes.length > maxDisplayTags"
+              type="info"
+              size="small"
+              class="trigger-tag"
+            >
+              + {{ currentSelectedNodes.length - maxDisplayTags }}
+            </el-tag>
+          </template>
+          <span v-else-if="!multiple && currentSelectedNodes.length > 0" class="single-value-display">
+            {{ currentSelectedNodes[0][treeProps.label] }}
+            </span>
+          <span v-else class="placeholder-text">{{ placeholder }}</span>
+        </div>
+
+        <span class="icons-container">
+            <i
+              v-if="showClearIcon"
+              class="el-icon-circle-close clear-icon"
+              @click.stop="handleClearOnTrigger"
+            ></i>
+            <i :class="['el-icon-arrow-up', 'arrow-icon', { 'is-reverse': !popoverVisible }]"></i>
+        </span>
+      </div>
+    </el-popover>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'SelectTree',
+  props: {
+    value: {
+      type: Array,
+      default: () => []
+    },
+    rawData: {
+      type: Array,
+      required: true
+    },
+    placeholder: {
+      type: String,
+      default: '请选择'
+    },
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    checkStrictly: {
+      type: Boolean,
+      default: false
+    },
+    filterable: {
+      type: Boolean,
+      default: true
+    },
+    maxDisplayTags: {
+      type: Number,
+      default: 2
+    },
+    componentWidth: {
+      type: String,
+      default: '100%'
+    },
+    popoverWidth: {
+      type: [String, Number],
+      default: 'auto'
+    },
+    treeProps: {
+      type: Object,
+      default: () => ({
+        children: 'children',
+        label: 'label',
+        isLeaf: 'isLeaf'
+      })
+    },
+    nodeKey: {
+      type: String,
+      default: 'id'
+    },
+    defaultExpandAll: {
+      type: Boolean,
+      default: false
+    },
+    showNodeDetail: {
+      type: Boolean,
+      default: true
+    },
+    treeHeight: {
+      type: Number,
+      default: 280
+    },
+    returnLeafOnly: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      popoverVisible: false,
+      filterText: '',
+      processedTreeData: [],
+      nodeMap: {},
+      tempCheckedKeys: [...this.value],
+      currentSelectedNodes: [],
+      inputHovering: false,
+      triggerElRect: null
+    };
+  },
+  computed: {
+    popoverComputedWidth() {
+      if (this.popoverWidth === 'auto') {
+        return this.triggerElRect ? this.triggerElRect.width : 250;
+      }
+      return parseInt(this.popoverWidth, 10);
+    },
+    currentSelectedDisplayNodes() {
+      if (!this.multiple) return [];
+      return this.currentSelectedNodes.slice(0, this.maxDisplayTags);
+    },
+    showClearIcon() {
+      return (
+        !this.disabled &&
+        this.inputHovering &&
+        this.currentSelectedNodes.length > 0 &&
+        !this.multiple
+      );
+    }
+  },
+  watch: {
+    rawData: {
+      immediate: true,
+      handler(newData) {
+        this.processRawData(newData);
+        this.updateCurrentSelectedNodesFromKeys(this.value, true);
+      }
+    },
+    value: {
+      handler(newVal) {
+        const valStr = JSON.stringify(newVal.sort());
+        const currentValStr = JSON.stringify(this.currentSelectedNodes.map(n => n[this.nodeKey]).sort());
+
+        if (valStr !== currentValStr) {
+          this.tempCheckedKeys = [...newVal];
+          this.updateCurrentSelectedNodesFromKeys(newVal, true);
+          if (this.$refs.taskTree) {
+            this.$refs.taskTree.setCheckedKeys([...newVal]);
+          }
+        }
+      },
+      deep: true
+    },
+    filterText(val) {
+      if (this.$refs.taskTree) {
+        this.$refs.taskTree.filter(val);
+      }
+    },
+    popoverVisible(isVisible) {
+      if (isVisible) {
+        if (this.$refs.popover && this.$refs.popover.$refs.reference) {
+          this.triggerElRect = this.$refs.popover.$refs.reference.getBoundingClientRect();
+        }
+        this.tempCheckedKeys = [...this.value];
+        this.$nextTick(() => {
+          if (this.$refs.taskTree) {
+            this.$refs.taskTree.setCheckedKeys(this.tempCheckedKeys);
+          }
+        });
+      } else {
+        this.filterText = '';
+      }
+    }
+  },
+  mounted() {
+    this.updateCurrentSelectedNodesFromKeys(this.value, true);
+  },
+  methods: {
+    processRawData(data) {
+      if (!data || !Array.isArray(data)) {
+        this.processedTreeData = [];
+        this.nodeMap = {};
+        return;
+      }
+      const newMap = {};
+      const mapNode = (node) => {
+        newMap[node[this.nodeKey]] = node;
+        if (node[this.treeProps.children] && node[this.treeProps.children].length) {
+          node[this.treeProps.children].forEach(mapNode);
+        }
+      };
+
+      this.processedTreeData = data.map(mainTask => {
+        const children = (mainTask.taskDetailList || []).map(detail => ({
+          [this.nodeKey]: detail.taskId,
+          [this.treeProps.label]: `${detail.qwUserId || '未命名子任务'}`,
+          isParent: false,
+          [this.treeProps.isLeaf]: true,
+          originalData: { ...detail, parentTaskId: mainTask.taskId }
+        }));
+
+        const parentNode = {
+          [this.nodeKey]: mainTask.taskId,
+          [this.treeProps.label]: mainTask.taskName,
+          isParent: true,
+          [this.treeProps.isLeaf]: children.length === 0,
+          [this.treeProps.children]: children,
+          originalData: { taskId: mainTask.taskId, taskName: mainTask.taskName }
+        };
+        mapNode(parentNode); // Add parent and its children to map
+        return parentNode;
+      });
+      this.nodeMap = newMap;
+    },
+    updateCurrentSelectedNodesFromKeys(keys, isConfirmation = false) {
+      const newSelectedNodes = [];
+      if (keys && keys.length > 0) {
+        keys.forEach(key => {
+          if (this.nodeMap[key]) {
+            newSelectedNodes.push(this.nodeMap[key]);
+          }
+        });
+      }
+      this.currentSelectedNodes = newSelectedNodes;
+      if(isConfirmation && this.$refs.taskTree) {
+        this.$refs.taskTree.setCheckedKeys(keys);
+      }
+    },
+    filterNode(value, data) {
+      if (!value) return true;
+      return data[this.treeProps.label].toLowerCase().indexOf(value.toLowerCase()) !== -1;
+    },
+    handleTreeCheck(nodeData, checkStatus) {
+      if (!this.multiple) {
+        const isNodeChecked = checkStatus.checkedKeys.includes(nodeData[this.nodeKey]);
+        if (isNodeChecked) {
+          this.tempCheckedKeys = [nodeData[this.nodeKey]];
+          this.$refs.taskTree.setCheckedKeys([nodeData[this.nodeKey]]); // Visually enforce single check
+        } else {
+          this.tempCheckedKeys = [];
+        }
+      } else {
+        this.tempCheckedKeys = checkStatus.checkedKeys;
+      }
+    },
+    handleConfirm() {
+      let finalSelectedKeys = [];
+      let finalSelectedNodes = [];
+
+      if (this.$refs.taskTree) {
+        const leafOnlyForSelection = this.multiple && !this.checkStrictly && this.returnLeafOnly;
+        finalSelectedNodes = this.$refs.taskTree.getCheckedNodes(leafOnlyForSelection);
+        finalSelectedKeys = finalSelectedNodes.map(node => node[this.nodeKey]);
+
+        if(!this.multiple) {
+          finalSelectedKeys = this.tempCheckedKeys;
+          finalSelectedNodes = finalSelectedKeys.map(key => this.nodeMap[key]).filter(Boolean);
+        }
+      }
+
+      this.$emit('input', finalSelectedKeys);
+      this.$emit('change', finalSelectedKeys, finalSelectedNodes);
+      this.updateCurrentSelectedNodesFromKeys(finalSelectedKeys, true);
+      this.popoverVisible = false;
+    },
+    handleClearInPopover() {
+      this.tempCheckedKeys = [];
+      if (this.$refs.taskTree) {
+        this.$refs.taskTree.setCheckedKeys([]);
+      }
+    },
+    handleClearOnTrigger() {
+      if (this.disabled) return;
+      this.tempCheckedKeys = [];
+      this.$emit('input', []);
+      this.$emit('change', [], []);
+      this.updateCurrentSelectedNodesFromKeys([], true);
+      if (this.$refs.taskTree) {
+        this.$refs.taskTree.setCheckedKeys([]);
+      }
+      this.popoverVisible = false;
+    },
+    removeTag(nodeToRemove) {
+      if (this.disabled) return;
+      const newKeys = this.value.filter(key => key !== nodeToRemove[this.nodeKey]);
+
+      this.$emit('input', newKeys);
+      this.$emit('change', newKeys, newKeys.map(k => this.nodeMap[k]).filter(Boolean));
+
+      this.tempCheckedKeys = [...newKeys];
+      this.updateCurrentSelectedNodesFromKeys(newKeys, true);
+      if (this.$refs.taskTree) {
+        this.$refs.taskTree.setCheckedKeys(newKeys);
+      }
+    },
+    onPopoverShow() {
+      if (this.$refs.popover && this.$refs.popover.$refs.reference) {
+        this.triggerElRect = this.$refs.popover.$refs.reference.getBoundingClientRect();
+      }
+      this.tempCheckedKeys = [...this.value];
+      this.$nextTick(() => {
+        if (this.$refs.taskTree) {
+          this.$refs.taskTree.setCheckedKeys(this.tempCheckedKeys);
+        }
+        if (this.filterable && this.$refs.popover && this.$refs.popover.$el) {
+          const inputEl = this.$refs.popover.$el.querySelector('.filter-input input');
+          if (inputEl) inputEl.focus();
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style scoped>
+.task-select-tree {
+  display: inline-block;
+  position: relative;
+  font-size: 14px;
+}
+
+.select-trigger-wrapper {
+  background-color: #fff;
+  border-radius: 4px;
+  border: 1px solid #dcdfe6;
+  box-sizing: border-box;
+  color: #606266;
+  display: flex; /* Use flex for alignment */
+  align-items: center; /* Vertically align items */
+  min-height: 32px; /* Element UI default input height (small) or 40px (default) */
+  /* Adjust line-height or padding if min-height is larger */
+  padding: 0 30px 0 10px; /* Space for text/tags and icons */
+  position: relative;
+  transition: border-color .2s cubic-bezier(.645,.045,.355,1);
+  width: 100%;
+  cursor: pointer;
+  overflow: hidden; /* Hide overflow from tags */
+}
+.select-trigger-wrapper.is-disabled {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+.select-trigger-wrapper.is-disabled .trigger-tag {
+  background-color: #f0f2f5;
+  border-color: #e9e9eb;
+  color: #909399;
+}
+.select-trigger-wrapper.is-disabled .trigger-tag .el-tag__close {
+  color: #909399;
+}
+.select-trigger-wrapper:hover:not(.is-disabled) {
+  border-color: #c0c4cc;
+}
+.select-trigger-wrapper.is-active:not(.is-disabled) {
+  border-color: #409eff;
+}
+
+.tags-or-value-container {
+  flex-grow: 1; /* Allow this container to take available space */
+  display: flex;
+  flex-wrap: wrap; /* For multiple tags */
+  gap: 5px; /* Space between tags */
+  align-items: center;
+  overflow: hidden; /* Prevent content from pushing icons */
+  padding: 2px 0; /* Small padding for tags not to touch border */
+}
+
+.trigger-tag {
+  /* margin-right: 5px; /* Use gap if supported, otherwise this */
+  /* margin-bottom: 2px;
+  margin-top: 2px; */
+}
+
+.single-value-display {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  color: #606266;
+  line-height: 30px; /* Adjust if trigger height changes */
+}
+
+.placeholder-text {
+  color: #c0c4cc;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  line-height: 30px; /* Adjust if trigger height changes */
+}
+
+.icons-container {
+  position: absolute;
+  right: 5px;
+  top: 50%;
+  transform: translateY(-50%);
+  display: flex;
+  align-items: center;
+  color: #c0c4cc;
+}
+.icons-container .clear-icon {
+  cursor: pointer;
+  margin-right: 5px;
+  display: none;
+  font-size: 14px;
+}
+.select-trigger-wrapper:hover .clear-icon {
+  /* Only show if showClearIcon is true (handled by v-if) */
+  display: inline-block;
+}
+.icons-container .arrow-icon {
+  transition: transform .3s;
+  font-size: 14px;
+}
+.icons-container .arrow-icon.is-reverse {
+  transform: rotate(180deg);
+}
+
+/* Popover Content */
+.popover-content-wrapper {
+  display: flex;
+  flex-direction: column;
+}
+.filter-input {
+  margin-bottom: 8px;
+}
+.tree-scrollbar {
+  /* height is set by prop */
+  border: 1px solid #ebeef5;
+  border-radius: 2px;
+}
+.el-scrollbar__wrap { /* Make sure scrollbar wrap doesn't add extra space */
+  overflow-x: hidden;
+}
+.task-tree-in-popover {
+  min-height: 50px; /* Prevent collapse if empty */
+}
+.custom-tree-node {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 14px;
+  padding-right: 8px;
+}
+.node-detail-text {
+  font-size: 12px;
+  color: #909399;
+  margin-left: 8px;
+}
+
+.popover-footer {
+  text-align: right;
+  padding-top: 10px;
+  border-top: 1px solid #ebeef5;
+  margin-top: 10px;
+}
+</style>
+
+<style>
+/* Global style for popper to customize padding */
+.task-select-tree-popper.el-popover {
+  padding: 12px; /* Adjust padding of the popper itself */
+}
+</style>

+ 3 - 3
src/router/index.js

@@ -141,19 +141,19 @@ export const constantRoutes = [
         path: 'updateSopTemp/:id/:type(\\d+)', // 确保 :type 的正则匹配数字
         component: () => import('@/views/qw/sopTemp/updateSopTemp'),
         name: 'updateSopTemp',
-        meta: { title: '改SOP模板', activeMenu: '/course/addSopTemp' }
+        meta: { title: '改SOP模板', activeMenu: '/course/addSopTemp' }
       },
       {
         path: 'updateTemp/:id/:type(\\d+)', // 确保 :type 的正则匹配数字
         component: () => import('@/views/qw/sopTemp/updateTemp'),
         name: 'updateTemp',
-        meta: { title: '改SOP模板', activeMenu: '/course/updateTemp' }
+        meta: { title: '改SOP模板', activeMenu: '/course/updateTemp' }
       },
       {
         path: 'updateAiChatTemp/:id/:type(\\d+)', // 确保 :type 的正则匹配数字
         component: () => import('@/views/qw/sopTemp/updateAiChatTemp'),
         name: 'updateAiChatTemp',
-        meta: { title: '改SOP模板', activeMenu: '/course/addSopTemp' }
+        meta: { title: '改SOP模板', activeMenu: '/course/addSopTemp' }
       }
     ]
   },

+ 269 - 0
src/views/statistics/section/index.vue

@@ -0,0 +1,269 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="公司名" prop="companyId">
+        <el-select filterable style="width: 220px" v-model="queryParams.companyId" @change="handleSeller" placeholder="请选择公司名" clearable size="small">
+          <el-option
+            v-for="item in companys"
+            :key="item.companyId"
+            :label="item.companyName"
+            :value="item.companyId"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="销售" prop="nickName" v-if="queryParams.companyId">
+        <el-select v-model="queryParams.companyUserId" remote placeholder="请选择" filterable clearable  style="width: 100%;" @keyup.enter.native="handleQuery">
+          <el-option
+            v-for="dict in companyUserList"
+            :key="`${dict.nickName} - ${dict.userName}`"
+            :label="`${dict.nickName} - ${dict.userName}`"
+            :value="dict.userId">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="时间范围" prop="dateRange">
+        <el-date-picker
+          v-model="dateRange"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyy-MM-dd"
+          style="width: 240px"
+        />
+      </el-form-item>
+      <el-form-item label="SOP任务" prop="channel">
+        <select-tree
+          v-model="selectedMultipleTasks"
+          :raw-data="channelList"
+          placeholder="请选择多个任务"
+          :multiple="true"
+          component-width="400px"
+          :max-display-tags="3"
+          :check-strictly="false"
+        :return-leaf-only="false"
+        @change="handleMultiChange"
+        ></select-tree>
+      </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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['system:stats:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <!-- 警告提示 -->
+    <el-alert
+      title="待激活人数依赖进粉时的自动标记和员工手动标记是可变的,相应的目标人数和进线完播率受此影响;为了不受进粉期人数变化影响,第二天新进报名产生的观后数据不做统计;辅助工作台人数不一致可能是受进粉影响,也有可能是员工删除了好友或者取消了客户频道报名。"
+      type="warning"
+      :closable="false"
+      show-icon
+      class="mb8">
+    </el-alert>
+
+    <el-table v-loading="loading" :data="statsList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+
+      <!-- 未上线部分 -->
+
+        <el-table-column prop="departmentName" label="所属部门" width="180" />
+        <el-table-column prop="employeeName" label="员工"  />
+        <el-table-column prop="totalTasks" label="营期人数"  align="center" />
+        <el-table-column prop="incompleteTasks" label="未报名"  align="center" />
+        <el-table-column prop="inProgressTasks" label="已报名"  align="center" />
+        <el-table-column prop="incompleteRate" label="报名率"  align="center">
+          <template slot-scope="scope">
+            <span>{{ scope.row.incompleteRate }}%</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="completionRate" label="完课率"  align="center">
+          <template slot-scope="scope">
+            <span>{{ scope.row.completionRate }}%</span>
+          </template>
+        </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listEmployeeStats, getEmployeeList, getChannelList, exportEmployeeStats,getSOPTaskData} from "@/api/system/employeeStats";
+import {getCompanyList} from "@/api/company/company";
+import {getUserList} from "@/api/company/companyUser";
+import SelectTree from "@/components/TreeSelect/index.vue";
+
+export default {
+  name: "EmployeeStats",
+  components: {SelectTree},
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      companys:[],
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 员工统计表格数据
+      statsList: [],
+      // 员工列表
+      employeeList: [],
+      companyUserList: [],
+      // 频道列表
+      channelList: [],
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        channel: null,
+        startDate: null,
+        endDate: null,
+        companyId: null
+      },
+      // 总体统计
+      totalStats: {
+        totalEmployees: 0,
+        onlineEmployees: 0,
+        offlineEmployees: 0,
+        completionRate: '0.00'
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getEmployeeList();
+
+    getCompanyList().then(response => {
+      this.companys = response.data;
+    });
+
+    getSOPTaskData().then(response => {
+      this.channelList = response.data;
+    });
+
+  },
+  methods: {
+    handleSeller(){
+      if(this.queryParams.companyId != null) {
+        getUserList(this.queryParams.companyId).then(res=>{
+          if(res.code === 200) {
+            this.companyUserList = res.data
+          }
+        })
+      }
+    },
+    /** 查询员工统计列表 */
+    getList() {
+      this.loading = true;
+      if (this.dateRange && this.dateRange.length === 2) {
+        this.queryParams.startDate = this.dateRange[0];
+        this.queryParams.endDate = this.dateRange[1];
+      } else {
+        this.queryParams.startDate = null;
+        this.queryParams.endDate = null;
+      }
+
+      listEmployeeStats(this.queryParams).then(response => {
+        this.statsList = response.rows;
+        this.total = response.total;
+        this.totalStats = response.totalStats || this.totalStats;
+        this.loading = false;
+      });
+    },
+    /** 获取员工列表 */
+    getEmployeeList() {
+      getEmployeeList().then(response => {
+        this.employeeList = response.data || [];
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('system/employeeStats/export', {
+        ...this.queryParams
+      }, `员工完成统计_${new Date().getTime()}.xlsx`);
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.stats-card {
+  text-align: center;
+  margin-bottom: 16px;
+
+  .stats-number {
+    font-size: 24px;
+    font-weight: bold;
+    color: #409EFF;
+
+    &.online {
+      color: #67C23A;
+    }
+
+    &.offline {
+      color: #F56C6C;
+    }
+
+    &.rate {
+      color: #E6A23C;
+    }
+  }
+}
+
+.mb8 {
+  margin-bottom: 8px;
+}
+
+::v-deep .el-table .el-table__header th {
+  background-color: #f5f7fa;
+}
+
+::v-deep .el-alert {
+  margin-bottom: 16px;
+}
+</style>