<template>
|
<div class="silkRegister-form">
|
<div class="filter">
|
<div class="filter-card">
|
<CommonSearch
|
:show-add="false"
|
:show-download="false"
|
:amount-view="false"
|
:show-action-btn="false"
|
placeholder="请输入关键词"
|
@searchClick="onFilterSearch"
|
>
|
<template slot="leftButton">
|
<el-button size="small" type="primary" @click="exportClick">导入</el-button>
|
<el-button size="small" type="primary" @click="synchClick">同步</el-button>
|
<el-button size="small" type="primary" @click="ruleSettingClick">规则设置</el-button>
|
</template>
|
</CommonSearch>
|
</div>
|
</div>
|
|
<div class="body">
|
<div class="body-card">
|
<div class="list-view">
|
<TableCommonView
|
ref="tableListRef"
|
v-loading="loading"
|
:table-list="tableList"
|
@selTableCol="selTableCol"
|
>
|
<template slot="tableButton">
|
<el-table-column label="操作" width="90" fixed="right">
|
<template slot-scope="scope">
|
<el-button @click="delClick(scope.row)" type="text" size="small">删除</el-button>
|
</template>
|
</el-table-column>
|
</template>
|
</TableCommonView>
|
</div>
|
<div class="btn-pager">
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
</div>
|
<ImportDialog
|
title="上传文件"
|
ref="import"
|
@fileSuccess="fileSuccess"
|
>
|
</ImportDialog>
|
<!-- 规则设置 -->
|
<RuleSettingDialog ref="RuleSettingDialog" :editRow="editRow" @closeClick="getData" />
|
</div>
|
</template>
|
|
<script>
|
import { getAttendanceList, deleteAttendanceInfo } from "@/api/employeeSalary/attendanceManage.js"
|
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
|
import RuleSettingDialog from "@/views/employeeSalary/attendanceManage/components/RuleSettingDialog"
|
import ImportDialog from "@/views/employeeSalary/attendanceManage/components/ImportDialog";
|
|
export default {
|
name: "attendanceManage",
|
props: {
|
},
|
mixins: [pageMixin],
|
components: {
|
RuleSettingDialog,
|
ImportDialog
|
},
|
data() {
|
return {
|
tableList: {},
|
loading: false,
|
searchOptions: [],
|
editConfig: {
|
visible: false,
|
title: "新建",
|
infomation: {}
|
},
|
keyword: '',
|
tableColumn: [
|
{ label: "日期", prop: "date", min: 120, default: true },
|
{ label: "员工编号", prop: "workerId", min: 190,default: true},
|
{ label: "员工姓名", prop: "workerName", min: 100, },
|
{ label: "上班打卡时间", prop: "startWorkTime", min: 100 },
|
{ label: "下班打卡时间", prop: "endWorkTime", min: 100 },
|
{ label: "班次", prop: "classes", min: 100 },
|
{ label: "班次上班时间", prop: "classesStartTime", min: 110 },
|
{ label: "班次下班时间", prop: "classesEndTime", min: 110 },
|
{ label: "添加时间", prop: "createTime", min: 130 },
|
{ label: "添加人", prop: "addPeople", min: 110 },
|
],
|
showCol: [
|
"员工姓名",
|
"上班打卡时间",
|
"下班打卡时间",
|
"班次",
|
"班次上班时间",
|
"班次下班时间",
|
"添加时间",
|
"添加人",
|
],
|
editRow:{},
|
}
|
},
|
created() {
|
this.setTable()
|
this.getData(this.keyword)
|
},
|
computed: {
|
},
|
methods: {
|
setTable() {
|
this.tableList = {
|
selectIndex: true,
|
tableInfomation: [],
|
allcol: [],
|
showcol: this.showCol,
|
tableColumn: this.setColumnVisible(this.showCol)
|
}
|
this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
|
this.searchOptions = []
|
for (let i = 0; i < this.tableList.tableColumn.length; i++) {
|
const label = this.tableList.tableColumn[i].label
|
const value = this.tableList.tableColumn[i].prop
|
this.searchOptions.push({ value: value, label: label })
|
}
|
},
|
setColumnVisible(showCol) {
|
return this.tableColumn.map((ele) => {
|
|
return {
|
...ele,
|
isShowColumn: ele.default?true:showCol.includes(ele.label)
|
}
|
})
|
},
|
selTableCol(val) {
|
this.showcol = val
|
this.tableList.tableColumn = this.setColumnVisible(val)
|
},
|
// 请求数据
|
async getData() {
|
this.loading = true
|
await getAttendanceList({
|
keyword: this.keyword,
|
page: this.pagerOptions.currPage,
|
pageSize: this.pagerOptions.pageSize
|
})
|
.then((res) => {
|
console.log(res)
|
if (res.code === 200) {
|
if (res.data && res.data.length > 0) {
|
const list = res.data.map((item) => {
|
return {
|
...item,
|
}
|
})
|
this.tableList.tableInfomation = list || []
|
this.pagerOptions.totalCount = res.total
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
} else {
|
this.tableList.tableInfomation = []
|
}
|
this.loading = false
|
})
|
.catch((err) => {
|
console.log(err)
|
this.tableList.tableInfomation = []
|
this.loading = false
|
})
|
},
|
// 搜索
|
onFilterSearch(searchText) {
|
this.keyword = searchText ?? ""
|
this.pagerOptions.currPage = 1
|
this.getData()
|
},
|
//导入成功
|
fileSuccess() {
|
this.getData()
|
},
|
// 导入
|
exportClick() {
|
this.$refs.import.isopen=true;
|
},
|
// 同步
|
synchClick(){
|
|
},
|
// 打印
|
ruleSettingClick(){
|
this.$refs.RuleSettingDialog.islook = true;
|
},
|
// 删除
|
delClick(row) {
|
this.$confirm("是否确认删除?", "警告", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
deleteAttendanceInfo({ ids: [row.ID] }).then((response) => {
|
if (response.code === 200) {
|
this.$message.success("删除成功")
|
this.pagerOptions.currPage = 1
|
this.getData()
|
} else {
|
this.$message.warning("删除失败")
|
}
|
})
|
})
|
.catch(() => {})
|
},
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.silkRegister-form {
|
height: 100%;
|
overflow: hidden;
|
.filter {
|
height: 80px;
|
display: flex;
|
align-items: center;
|
padding: 12px 20px 0 20px;
|
&-card {
|
height: 80px;
|
display: flex;
|
align-items: center;
|
box-sizing: border-box;
|
padding: 10px 20px;
|
flex: 1;
|
border-radius: 12px;
|
background-color: #fff;
|
}
|
}
|
.body {
|
box-sizing: border-box;
|
padding: 10px 20px;
|
border-radius: 12px;
|
height: calc(100% - 92px);
|
.body-card {
|
background-color: #fff;
|
border-radius: 12px;
|
height: 100%;
|
overflow: hidden;
|
}
|
.list-view {
|
height: calc(100% - 60px);
|
overflow: hidden;
|
}
|
.btn-pager {
|
display: flex;
|
margin-top: 10px;
|
.page {
|
margin-left: auto;
|
}
|
}
|
}
|
}
|
</style>
|