yubo
2026-04-06 6448ec15bfe0b65fb822a662105bceddc23b58d8
src/views/dashboard/zzUser.vue
@@ -10,12 +10,8 @@
  >
    <div class="app-container">
      <div class="filter-container" style="margin-left: -340px;">
        <el-input v-model="queryParams.name" placeholder="姓名/身份证号/护卫点/员工编号" class="filter-item search-item" />
        <el-button class="filter-item" type="primary" @click="search">
          {{ $t('table.search') }}
        </el-button>
        <el-button class="filter-item" type="success" @click="reset">
          {{ $t('table.reset') }}
        <el-button class="filter-item" type="warning" @click="handleExport">
          导出
        </el-button>
      </div>
      <el-table
@@ -55,11 +51,13 @@
<script>
// 引用翻页组件
import Pagination from '@/components/Pagination'
import dictMixin from '../../utils/dictMixin'
export default {
  components: {
    Pagination
  },
  mixins: [dictMixin],
  props: {
    dialogVisible: {
      type: Boolean,
@@ -91,15 +89,34 @@
      }, // 查询参数
      sort: {}, // 排序
      pagination: { // 分页参数
        size: 5,
        size: 15,
        num: 1
      },
      probationStatusOptions: [],
      list: [], // 给table显示的数据
      defaultProps: {
        children: 'children',
        label: 'label'
      }
      },
      // 导出配置
      exportConfig: {
        selectedFields: [
          'empNumb', // 员工编号
          'allDeptName', // 部门(护卫点)
          'jobName', // 岗位
          'empName', // 姓名
          'certificateNumb', // 身份证号码
          'birthdate', // 出生日期
          'insuranceTypeName', // 社保档位
          'socialNumb', // 社保电脑号
          'entryDate', // 入职日期
          'probationDate', // 转正日期
          'probationStatusName' // 转正状态
        ],
        exportUrl: 'hr/empBaseInfo/export/probation',
        fileName: '员工转正提醒.xls'
      },
      selectIndex: 0 // 存储传入的时间筛选索引
    }
  },
  computed: {
@@ -107,14 +124,13 @@
      get() {
        return this.dialogVisible
      }
    }
    },
    // 字典选项计算属性
    probationStatusOptions() { return this.getDictOptions('PROBATIONSTATUS') }
  },
  mounted() {
    setTimeout(() => {
      this.getDicts('PROBATIONSTATUS').then(response => {
        this.probationStatusOptions = response.data
      })
    }, 1000)
    // 字典数据已在登录时预加载,直接从 Vuex 获取
    this.initDictTypes(['PROBATIONSTATUS'])
  },
  methods: {
    probationStatusFormat(row, column) {
@@ -139,6 +155,8 @@
      this.queryParams.index = index
      this.queryParams.number = number
      this.queryParams.name = null
      this.selectIndex = index !== null ? index : 0 // 保存传入的 index
      this.pagination.num = 1
      this.search()
    },
    fetch(params = {}) {
@@ -147,6 +165,12 @@
      params.pageNum = this.pagination.num
      params.delFlag = 0
      params.empStatus = 0
      // 添加 index 参数
      if (params.timeRange === undefined || params.timeRange === null) {
        params.timeRange = this.selectIndex
      }
      this.$get('hr/empBaseInfo/probation/alert', {
        ...params
      }).then((r) => {
@@ -157,6 +181,27 @@
    },
    cancleChoose() {
      this.$emit('cancleChooseUser')
    },
    // 导出方法
    handleExport() {
      const params = {
        ...this.queryParams,
        index: this.selectIndex, // 使用当前查询的 index
        delFlag: 0,
        empStatus: 0,
        exportField: this.exportConfig.selectedFields.join(',')
      }
      this.$download(
        this.exportConfig.exportUrl,
        params,
        this.exportConfig.fileName
      ).then(() => {
        this.$message({
          message: '下载成功!',
          type: 'success'
        })
      })
    }
  }
}