yubo
2026-04-12 3a77c6fbda3243c135f9a3b55ad205970fd9f6cb
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
<template>
  <div>
    <el-row>
      <el-col :span="3">员工编号:
        <el-input v-model="localParams.empNumb" size="small" maxlength="20" style="width:85px" />
      </el-col>
      <el-col :span="3">姓名:
        <el-input v-model="localParams.empName" size="small" maxlength="10" style="width:110px" />
      </el-col>
      <el-col :span="4">身份证号:
        <el-input v-model="localParams.certificateNumb" size="small" maxlength="18" style="width:140px" />
      </el-col>
      <el-col :span="4">部门(护卫点):
        <el-input v-model="localParams.deptName" size="small" maxlength="20" style="width:100px" />
      </el-col>
      <el-col :span="7">入职日期:
        <el-date-picker
          v-model="localParams.entryDateStr"
          size="small"
          type="daterange"
          align="right"
          unlink-panels
          range-separator="~"
          value-format="yyyy-MM-dd"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          style="width: 300px;"
        />
      </el-col>
      <el-col :span="3">
        <el-button size="mini" class="hr-but-all" type="primary" @click="handleSearch">查询</el-button>
        <el-button size="mini" class="hr-but" type="danger" @click="handleReset">重置</el-button>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <table class="searchTable">
          <tr v-for="field in dictFilterFields" :key="field.paramKey">
            <td class="td">{{ field.label }}:</td>
            <td class="td-group">
              <el-checkbox-group v-model="localParams[field.paramKey]" class="fj-checkbox">
                <el-checkbox label="" @change="(val) => handleSelectAll(field, val)">全部</el-checkbox>
                <el-checkbox
                  v-for="data in getDictOptions(field.dictType)"
                  :key="data.dicItemName"
                  :label="data.dicItemCode"
                >
                  {{ data.dicItemName }}
                </el-checkbox>
              </el-checkbox-group>
            </td>
          </tr>
          <tr>
            <td class="td">入职类型:</td>
            <td class="td-group">
              <el-checkbox-group v-model="localParams.entryType" class="fj-checkbox">
                <el-checkbox label="" @change="handleSelectAllEntryType">全部</el-checkbox>
                <el-checkbox
                  v-for="item in entryTypeOptions"
                  :key="item.dicItemCode"
                  :label="item.dicItemCode"
                >
                  {{ item.dicItemName }}
                </el-checkbox>
              </el-checkbox-group>
            </td>
          </tr>
        </table>
      </el-col>
    </el-row>
  </div>
</template>
 
<script>
import dictMixin from '@/utils/dictMixin'
 
export default {
  name: 'AdvancedQuery',
  mixins: [dictMixin],
  props: {
    queryParams: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      // 字典筛选配置
      dictFilterFields: [
        { label: '性别', paramKey: 'sex', dictType: 'sex' },
        { label: '学历', paramKey: 'education', dictType: 'EDUCATION' },
        { label: '政治面貌', paramKey: 'politics', dictType: 'PLITICAL' },
        { label: '年龄', paramKey: 'ageStr', dictType: 'ageStr' },
        { label: '档案情况', paramKey: 'archivesStatus', dictType: 'archivesStatus' },
        { label: '社保档位', paramKey: 'insuranceType', dictType: 'INSURANCETYPE' },
        { label: '工作证', paramKey: 'empCardStatus', dictType: 'empCardStatus' },
        { label: '员工手册', paramKey: 'handbookStatus', dictType: 'handbookStatus' },
        { label: '员工类型', paramKey: 'empType', dictType: 'EMPTYPE' },
        { label: '相关证件', paramKey: 'certificateList', dictType: 'certificateList' }
      ],
      // 入职类型特殊选项(硬编码)
      entryTypeOptions: [
        { dicItemCode: 20, dicItemName: '新入职' },
        { dicItemCode: 21, dicItemName: '重新入职' },
        { dicItemCode: 22, dicItemName: '返聘入职' }
      ],
      // 本地查询参数(从 props 复制,避免直接修改)
      localParams: {},
      // 防止 watch 循环更新标志
      isUpdating: false
    }
  },
  watch: {
    queryParams: {
      handler(val) {
        if (!this.isUpdating) {
          this.localParams = { ...val }
        }
      },
      immediate: true,
      deep: true
    },
    localParams: {
      handler(val) {
        this.isUpdating = true
        this.$emit('update:queryParams', val)
        this.$nextTick(() => {
          this.isUpdating = false
        })
      },
      deep: true
    }
  },
  mounted() {
    this.initDictTypes([
      'sex', 'EDUCATION', 'PLITICAL', 'ageStr', 'archivesStatus',
      'INSURANCETYPE', 'empCardStatus', 'handbookStatus', 'EMPTYPE', 'certificateList'
    ])
  },
  methods: {
    // 通用全选/取消全选
    handleSelectAll(field, val) {
      if (val) {
        const options = this.getDictOptions(field.dictType)
        this.$set(this.localParams, field.paramKey, options.map(item => item.dicItemCode))
      } else {
        this.$set(this.localParams, field.paramKey, [])
      }
    },
    // 入职类型全选/取消全选
    handleSelectAllEntryType(val) {
      if (val) {
        this.$set(this.localParams, 'entryType', [20, 21, 22])
      } else {
        this.$set(this.localParams, 'entryType', [])
      }
    },
    // 查询
    handleSearch() {
      this.$emit('search')
    },
    // 重置
    handleReset() {
      this.localParams = {
        empNumb: '',
        vague: '',
        sex: [],
        education: [],
        politics: [],
        ageStr: [],
        archivesStatus: [],
        insuranceType: [],
        empStatus: [],
        empCardStatus: [],
        handbookStatus: [],
        baseKey: '',
        empType: [],
        entryType: [],
        certificateList: []
      }
      this.$emit('reset')
    }
  }
}
</script>
 
<style lang="scss" scoped>
.searchTable {
  margin-top: 10px;
  border-collapse: collapse;
  width: 100%;
 
  tr {
    border-bottom: 1px dashed #d9dadb;
  }
 
  .td {
    width: 90px;
    text-align: right;
  }
 
  .td-group {
    padding-left: 20px;
  }
}
 
.searchTable td,
.searchTable th {
  color: #000;
  height: 50px;
  background-color: #fff;
}
</style>