yubo
2026-03-11 09d00cd810cebc2b78c3928a8673f569cbffe165
src/views/dashboard/sfzUser.vue
@@ -17,23 +17,29 @@
        <el-button class="filter-item" type="success" @click="reset">
          {{ $t('table.reset') }}
        </el-button>
        <!-- 新增导出按钮 -->
        <el-button class="filter-item" type="warning" @click="handleExport">
          导出
        </el-button>
      </div>
      <el-table
        ref="multipleTable"
        :data="list"
        row-key="prop1"
        stripe
        :header-cell-style="{'height':'5.3vh','background-color':'#e6e6e6'}"
        border
        :cell-style="{padding:'7px 0','text-align':'center'}"
        :header-cell-style="{'height':'5.3vh','background-color':'#e6e6e6','text-align':'center'}"
        style="width: 100%;"
      >
        <el-table-column show-overflow-tooltip type="selection" :reserve-selection="false" width="55" />
        <el-table-column show-overflow-tooltip prop="empNumb" label="员工编号" width="150" />
        <el-table-column show-overflow-tooltip prop="deptName" label="护卫点" width="150" />
        <el-table-column show-overflow-tooltip prop="jobName" label="岗位" width="150" />
        <el-table-column show-overflow-tooltip prop="empName" label="姓名" width="150" />
        <el-table-column show-overflow-tooltip prop="certificateNumb" label="身份证号码" />
        <el-table-column show-overflow-tooltip prop="certificateValidity" label="身份证有效期" />
        <el-table-column show-overflow-tooltip prop="empStatus" label="员工状态" width="150">
        <el-table-column show-overflow-tooltip type="index" width="55" label="序号" />
        <el-table-column show-overflow-tooltip prop="empNumb" label="编号" width="150" />
        <el-table-column show-overflow-tooltip prop="allDeptName" label="部门(护卫点)" width="300" />
        <el-table-column show-overflow-tooltip prop="jobName" label="岗位" width="100" />
        <el-table-column show-overflow-tooltip prop="empName" label="姓名" width="100" />
        <el-table-column show-overflow-tooltip prop="certificateNumb" label="身份证号码" min-width="120" />
        <el-table-column show-overflow-tooltip prop="certificateValidity" label="身份证有效期" min-width="120" />
        <el-table-column show-overflow-tooltip prop="empStatus" label="员工状态" width="100">
          <template slot-scope="scope">
            <span>{{ gzdStateList[scope.row.empStatus] }}&nbsp;</span>
          </template>
@@ -89,7 +95,8 @@
        btime: null,
        etime: null,
        index: null,
        number: null
        number: null,
        timeRange: null
      }, // 查询参数
      sort: {}, // 排序
      pagination: { // 分页参数
@@ -100,7 +107,22 @@
      defaultProps: {
        children: 'children',
        label: 'label'
      }
      },
      // 导出配置
      exportConfig: {
        selectedFields: [
          'empNumb', // 编号
          'allDeptName', // 部门(护卫点)
          'jobName', // 岗位
          'empName', // 姓名
          'certificateNumb', // 身份证号码
          'certificateValidity', // 身份证有效期
          'empStatus' // 员工状态
        ],
        exportUrl: 'hr/empBaseInfo/export/sfz', // 需要后端提供对应接口
        fileName: '身份证到期员工列表.xls'
      },
      selectIndex: 0 // 存储传入的时间筛选索引
    }
  },
  computed: {
@@ -129,6 +151,7 @@
      this.queryParams.etime = etime
      this.queryParams.index = index
      this.queryParams.number = number
      this.selectIndex = index !== null ? index : 0 // 保存传入的 index
      this.queryParams.name = null
      this.search()
    },
@@ -146,6 +169,26 @@
    },
    cancleChoose() {
      this.$emit('cancleChooseUser')
    },
    // 导出方法
    handleExport() {
      const params = {
        ...this.queryParams,
        index: this.queryParams.index !== null ? this.queryParams.index : this.selectIndex,
        timeRange: this.queryParams.index !== null ? this.queryParams.index : this.selectIndex,
        exportField: this.exportConfig.selectedFields.join(',')
      }
      this.$download(
        this.exportConfig.exportUrl,
        params,
        this.exportConfig.fileName
      ).then(() => {
        this.$message({
          message: '下载成功!',
          type: 'success'
        })
      })
    }
  }
}