张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
245
246
247
248
249
250
<template>
  <div class="main tabs_main back_main">
    <div class="back_item">
      <el-button icon="el-icon-back" @click="$emit('update:recordShow', false)">返回</el-button>
    </div>
    <div class="main_info">
      <div
        class="main_info_item"
        v-for="item in recordInfoList"
        :key="item.id">
        <span>{{item.materialName}}</span>
        <span class="main_info_item--value">{{statisticInfo[item.materialValue]}}</span>
      </div>
    </div>
    <div class="main_header" style="margin-top: 0">
      <div class="header_item">
        <span class="header_label">考核结果:</span>
        <el-select v-model="examResult" clearable placeholder="请选择考核结果">
          <el-option
            v-for="item in resultData"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">班组:</span>
        <el-select v-model="groupId" clearable placeholder="请选择班组">
          <el-option
            v-for="item in groupData"
            :key="item.groupId"
            :label="item.groupName"
            :value="item.groupId">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">考核时间:</span>
        <el-date-picker 
          v-model="timeDate" 
          type="daterange" 
          value-format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" @click="searchExamineRecordList(true)">查询</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="examineRecordList"
        height="100%">
        <el-table-column label="序号" width="60" align="center">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="examName" label="考核名称" width="180" align="center"></el-table-column>
        <el-table-column prop="realName" label="姓名" align="center"></el-table-column>
        <el-table-column prop="groupName" label="班组" align="center"></el-table-column>
        <el-table-column prop="startTime" label="考核时间" align="center"></el-table-column>
        <el-table-column prop="useTime" label="用时" align="center"></el-table-column>
        <el-table-column prop="score" label="考核成绩" align="center"></el-table-column>
        <el-table-column label="考核结果" align="center">
          <template #default="{ row }">
            <span>{{row.pass === 1 ? '合格' : row.pass === 0 ? '不合格' : ''}}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>
 
<script>
import { buttonPinia } from '../../../../pinia';
  export default {
    name: 'ExamineRecord',
    props: {
      examineId: String,
      recordShow: Boolean
    },
    data() {
      return {
        recordInfoList: [{
          id: 1,
          materialName: '应考人数',
          materialValue: 'planExamUser'
        },{
          id: 2,
          materialName: '实考人数',
          materialValue: 'totalExamUser'
        },{
          id: 3,
          materialName: '缺考人数',
          materialValue: 'noExamUser'
        },{
          id: 4,
          materialName: '合格人数',
          materialValue: 'passExamUser'
        },{
          id: 5,
          materialName: '不合格人数',
          materialValue: 'noPassExanUser'
        }], // 页头信息
        statisticInfo: {}, // 统计信息
        examResult: '',
        resultData: [{
          value: 0,
          label: '不合格'
        },{
          value: 1,
          label: '合格'
        }], // 考核结果
        departId: '',
        groupId: '',
        groupData: [],
        timeDate: '',
        loading: false,
        pageNum: 1,
        pageSize: 10,
        total: 0,
        examineRecordList: []
      }
    },
    mounted() {
      this.getExamRecordStatistical();
      this.getAllDepartmentData();
      this.searchExamineRecordList(true);
    },
    methods: {
      // 获取部门班组信息
      async getAllDepartmentData() {
        const { data } = await this.$api.Personnerl.GETDEPARTMENTDATA();
        const groupData = data.map(item => item.groups);
        this.groupData = groupData.flat(Infinity);
      },
      // 查询考核记录统计
      async getExamRecordStatistical() {
        const { data } = await this.$api.Safety.getExamRecordStatistical({
          examId: this.examineId
        })
        this.statisticInfo = data;
      },
      // 查询记录信息
      searchExamineRecordList(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        this.loading = true;
        this.examineRecordList = [];
        this.$api.Safety.searchSafetyCheckRecord({
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          examId: this.examineId,
          examResult: this.examResult,
          departId: this.departId,
          groupId: this.groupId,
          startTime: this.timeDate ? this.timeDate[0] + ' 00:00:00' : '',
          endTime: this.timeDate ? this.timeDate[1] + ' 23:59:59' : ''
        }).then((res) => {
          if(res.success) {
            this.total = res.data.total;
            this.examineRecordList = res.data.list;
          }
          this.loading = false;
        }).catch(() => {
          this.loading = false;
        })
      },
      // 切换页码
      changePageNum(page) {
        this.pageNum = page;
        this.searchExamineRecordList();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchExamineRecordList();
      },
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      }
    }
  }
</script>
 
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
 
.back_main {
  background: none !important;
}
 
.back_item {
  display: flex;
  justify-content: flex-end;
}
 
.main_info {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 20px 10px 10px;
 
  .main_info_item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: calc(100% / 8);
    height: 80px;
    color: #FFFFFF;
    background: url('../../../../assets/stir_img.png')no-repeat;
    background-size: 100% 100%;
 
    &:first-child {
      margin-left: 0 !important;
    }
 
    &:nth-child(odd) {
      margin: 0 20px;
    }
 
    .main_info_item--value {
      padding-top: 2px;
      color: #18F6F8;
      font-size: 18px;
    }
  }
}
</style>