人员考勤

This commit is contained in:
bb_pan 2025-04-15 10:32:04 +08:00
parent dae8c6d2c1
commit a7e13089d1
3 changed files with 183 additions and 6 deletions

View File

@ -66,6 +66,10 @@
margin-left: 20px;
}
.w240 {
width: 240px;
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-family: inherit;
font-weight: 500;

View File

@ -0,0 +1,175 @@
<template>
<!-- 基础页面 -->
<div class="app-container">
<el-form v-show="showSearch" :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
<el-form-item prop="keyWord">
<el-input
class="w240"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="status">
<el-select class="w240" v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option v-for="item in statusOpts" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<!-- 表单按钮 -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableList" fit highlight-current-row style="width: 100%" border>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
/>
<el-table-column
v-for="(column, index) in tableColumns"
show-overflow-tooltip
:key="index"
:label="column.label"
:prop="column.prop"
align="center"
>
<!-- 插槽 -->
<template v-slot="{ row }" v-if="column.prop == 'facePhoto'">
<el-image
v-if="row.facePhoto"
style="width: 30px; height: 30px; border-radius: 5px"
:src="row.facePhoto"
fit="cover"
:preview-src-list="[row.facePhoto]"
></el-image>
<span v-else>未上传</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
export default {
data() {
return {
showSearch: true,
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', //
status: '', //
},
total: 0, //
statusOpts: [
{ label: '新建', value: '0' },
{ label: '进行中', value: '1' },
{ label: '已完成', value: '2' },
{ label: '已关闭', value: '3' },
], //
//
tableColumns: [
{ label: '姓名', prop: 'userName' },
{ label: '打卡时间', prop: 'clockTime' },
{ label: '打卡照片', prop: 'facePhoto' },
{ label: '班组', prop: 'work' },
{ label: '打卡设备编号', prop: 'deviceCode' },
],
//
tableList: [
{
userName: '张三',
clockTime: '2023-10-01 10:00:00',
facePhoto: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
work: '班组A',
deviceCode: '设备001',
},
{
userName: '李四',
clockTime: '2023-10-01 11:00:00',
facePhoto: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
work: '班组B',
deviceCode: '设备002',
},
],
}
},
created() {
this.getList()
},
methods: {
//
handleQuery() {
this.getList()
},
//
handleReset() {
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.$refs.queryForm.resetFields()
this.getList()
},
//
async getList() {
console.log('列表-查询', this.queryParams)
const loading = this.$loading({ text: '加载中...' })
try {
const params = { ...this.queryParams }
// const res = await
// console.log('🚀 ~ ~ res:', res)
// this.tableList = res.rows
// this.total = res.total
loading.close()
} catch (error) {
console.log('🚀 ~ 获取列表 ~ error:', error)
this.tableList = []
this.total = 0
loading.close()
}
},
//
handleExport() {
this.$message({
type: 'warning',
message: '导出功能开发中,敬请期待!',
})
return
try {
let fileName = `人员出入场_${new Date().getTime()}.xLsx`
let url = ''
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
},
},
}
</script>
<style lang="scss" scoped></style>

View File

@ -4,6 +4,7 @@
<el-form v-show="showSearch" :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
<el-form-item prop="keyWord">
<el-input
class="w240"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
@ -11,12 +12,12 @@
/>
</el-form-item>
<el-form-item prop="work">
<el-select v-model="queryParams.work" placeholder="请选择工种/岗位" clearable>
<el-select class="w240" v-model="queryParams.work" placeholder="请选择工种/岗位" clearable>
<el-option v-for="item in workOpts" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-select class="w240" v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option v-for="item in statusOpts" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
@ -38,7 +39,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table :data="tableList" fit highlight-current-row style="width: 100%">
<el-table :data="tableList" fit highlight-current-row style="width: 100%" border>
<el-table-column
type="index"
width="55"
@ -258,9 +259,6 @@ export default {
handleDetails(row) {
console.log('出入场记录', row)
this.dialogDetails = true
this.$nextTick(() => {
// this.$refs.dialogDetails.handleDetails(row)
})
},
//
handleEdit(row) {