yubo
2026-04-10 c13e0797dd6ca08eb7c5efa491417886f2acc2dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<template>
  <el-dialog
    :title="title"
    top="80px"
    width="80%"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    :visible.sync="isVisible"
    :before-close="beforeClose"
  >
    <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>
        <el-button v-if="isExpireContract" class="filter-item" type="warning" @click="handleExport">
          导出
        </el-button>
      </div>
      <el-table
        ref="multipleTable"
        :data="list"
        row-key="prop1"
        stripe
        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="index" width="55" label="序号" />
        <el-table-column show-overflow-tooltip prop="empNumb" label="编号" width="80" />
        <el-table-column show-overflow-tooltip prop="allDeptName" label="部门(护卫点)" width="300" />
        <el-table-column show-overflow-tooltip prop="jobName" label="岗位" width="80" />
        <el-table-column show-overflow-tooltip prop="empName" label="姓名" width="100" />
        <el-table-column show-overflow-tooltip prop="certificateNumb" label="身份证号码" width="140" />
        <el-table-column show-overflow-tooltip prop="contractStatus" label="合同状态" width="100" />
        <el-table-column show-overflow-tooltip prop="signingDate" label="合同签订日期" min-width="120" />
        <el-table-column show-overflow-tooltip prop="beginDate" label="开始日期" min-width="80" />
        <el-table-column show-overflow-tooltip prop="endDate" label="结束日期" min-width="80" />
        <el-table-column show-overflow-tooltip prop="contractPeriod" label="合同期限(年)" width="120" />
        <el-table-column show-overflow-tooltip prop="transactor" label="办理人" width="80" />
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="pagination.num"
        :limit.sync="pagination.size"
        @pagination="search"
      />
      <el-button type="danger" @click="cancleChoose">关闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
// 引用翻页组件
import Pagination from '@/components/Pagination'
import dictMixin from '../../utils/dictMixin'
 
export default {
  components: {
    Pagination
  },
  mixins: [dictMixin],
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ''
    },
    multipleselect: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      show: false,
      headerHeight: '70px',
      deptTree: [],
      selection: [],
      multipleSelection: [],
      total: 0, // 总数量
      queryParams: {
        name: null,
        btime: null,
        etime: null,
        index: null,
        number: null,
        timeRange: null
      }, // 查询参数
      sort: {}, // 排序
      pagination: { // 分页参数
        size: 15,
        num: 1
      },
 
      list: [], // 给table显示的数据
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      // 导出配置
      exportConfig: {
        selectedFields: [
          'empNumb', // 编号
          'allDeptName', // 部门(护卫点)
          'jobName', // 岗位
          'empName', // 姓名
          'certificateNumb', // 身份证号码
          'contractStatus', // 合同状态
          'signingDate', // 合同签订日期
          'beginDate', // 开始日期
          'endDate', // 结束日期
          'contractPeriod', // 合同期限(年)
          'transactor' // 办理人
        ],
        exportUrl: 'hr/empBaseInfo/export/expireHt',
        fileName: '到期合同列表.xls'
      }
    }
  },
  computed: {
    isVisible: {
      get() {
        return this.dialogVisible
      }
    },
    // 是否为到期合同(number=12)
    isExpireContract() {
      return this.queryParams.number === '12' || this.queryParams.number === 12
    },
    // 字典选项计算属性
    contractStatusOptions() { return this.getDictOptions('CONTRACTSTATUS') }
  },
  mounted() {
    // 字典数据已在登录时预加载,直接从 Vuex 获取
    this.initDictTypes(['CONTRACTSTATUS'])
  },
  methods: {
    contractStatusFormat(row, column) {
      return this.selectDictLabel(this.contractStatusOptions, row.contractStatus)
    },
    transContractStatus(contractStatus, time) {
      var strtime = time.replace('/-/g', '/')// 时间转换
      // 时间
      var date1 = new Date(strtime)
      // 现在时间
      var date2 = new Date()
      if (date1 <= date2) {
        return '到期'
      } else {
        switch (contractStatus) {
          case '1':
            return '有效'
          case '2':
            return '到期'
          case '3':
            return '续签'
          case '4':
            return '存档'
        }
      }
    },
    beforeClose(done) {
      this.$emit('cancleChooseUser')
    },
    search() {
      this.fetch({
        ...this.queryParams
      })
    },
    reset() {
      this.queryParams.name = null
      this.search()
    },
    // 翻页方法
    setjobUser(btime, etime, index, number) {
      this.queryParams.btime = btime
      this.queryParams.etime = etime
      this.queryParams.index = index
      this.queryParams.number = number
      this.queryParams.name = null
      this.queryParams.timeRange = index
      this.selectIndex = index !== null ? index : 0 // 保存传入的 index
      this.search()
    },
    fetch(params = {}) {
      var that = this
      params.pageSize = this.pagination.size
      params.pageNum = this.pagination.num
      // 添加 index 参数
      if (params.timeRange === undefined || params.timeRange === null) {
        params.timeRange = this.selectIndex
      }
      this.$get('hr/statistics/empBaseInfoHtList', {
        ...params
      }).then((r) => {
        const data = r.data.data
        that.total = data.total
        that.list = data.rows
      })
    },
    cancleChoose() {
      this.$emit('cancleChooseUser')
    },
    // 导出方法 - 只导出到期合同(number=12)
    handleExport() {
      const params = {
        ...this.queryParams,
        number: 12, // 固定为12,只导出到期合同
        timeRange: this.selectIndex, // 使用当前查询的 index
        exportField: this.exportConfig.selectedFields.join(',')
      }
      console.log('params', params)
      this.$download(
        this.exportConfig.exportUrl,
        params,
        this.exportConfig.fileName
      ).then(() => {
        this.$message({
          message: '下载成功!',
          type: 'success'
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  .link_button {
    color: #169BD5;
  }
 
  .del_button {
    color: #D9001B;
  }
</style>