<template>
|
<div>
|
<div class="body" :style="{height:mainHeight+'px'}">
|
<div class="bodyTopButtonGroup" style="justify-content: space-between">
|
<!-- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
|
<!-- <el-button-->
|
<!-- v-waves-->
|
<!-- type="success"-->
|
<!-- icon="el-icon-download"-->
|
<!-- @click="$router.push('./../systemSetting/dataImport?fileCode=1')"-->
|
<!-- >导入-->
|
<!-- </el-button>-->
|
<el-button v-waves type="primary" icon="el-icon-download" @click="download">导出</el-button>
|
|
</div>
|
|
<div class="bodyTopFormGroup">
|
<el-form
|
ref="form"
|
:model="form"
|
label-width="100px"
|
inline
|
style="display: flex;"
|
>
|
<div class="elForm">
|
<el-form-item label="车间名称" style=" display: flex;">
|
<el-select
|
v-model="form.wkshop_code"
|
style="width: 200px"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in wkshopArr"
|
:key="item.torg_code"
|
:label="item.torg_name"
|
:value="item.torg_code"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="打卡人员" style=" display: flex;">
|
<el-select
|
v-model="form.creatusercode"
|
style="width: 200px"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in creatuserArr"
|
:key="item.usercode"
|
:label="item.username"
|
:value="item.usercode"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="打卡日期" style=" display: flex;">
|
<el-date-picker
|
v-model="form.creatdate"
|
type="daterange"
|
range-separator="~"
|
class="timeMini"
|
size="mini"
|
style="width: 240px;display: flex;line-height: 34px;height: 34px;"
|
:clearable="false"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
/>
|
</el-form-item>
|
</div>
|
<div
|
class="bodySearchReset"
|
:style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
|
>
|
<el-button v-waves type="primary" icon="el-icon-search" @click="getDailyWageReportSearch">查询</el-button>
|
<el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
|
</div>
|
</el-form>
|
<div
|
class="bodyTopFormExpand"
|
style="height:5px"
|
>
|
<!-- <svg-icon-->
|
<!-- v-show="mouseHoverType==='mouseout'"-->
|
<!-- style="cursor: pointer"-->
|
<!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
|
<!-- @mouseenter="mouseHoverType=$event.type"-->
|
<!-- />-->
|
<!-- <svg-icon-->
|
<!-- v-show="mouseHoverType==='mouseenter'"-->
|
<!-- style="cursor: pointer"-->
|
<!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
|
<!-- @click="isExpandForm=!isExpandForm"-->
|
<!-- @mouseout="mouseHoverType=$event.type"-->
|
<!-- />-->
|
</div>
|
</div>
|
|
<div class="elTableDiv">
|
<el-table
|
ref="tableDataRef"
|
class="tableFixed"
|
:data="tableData"
|
:height="tableHeight+'px'"
|
border
|
row-class-name="custom-row"
|
:style="{width: 100+'%',height:tableHeight+'px',}"
|
highlight-current-row
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
@sort-change="sortChange"
|
>
|
<el-table-column
|
prop="rowNum"
|
width="50"
|
fixed
|
label="序号"
|
/>
|
<el-table-column
|
prop="wkshop_name"
|
label="所属车间"
|
width="110"
|
sortable="custom"
|
/>
|
<el-table-column
|
prop="username"
|
label="打卡人员"
|
sortable="custom"
|
width="110"
|
/>
|
<el-table-column
|
prop="checkindate"
|
label="打卡日期"
|
width="110"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
{{ row.checkindate ? row.checkindate.substring(0, 11) : '/' }}
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
prop="workcount"
|
label="上班时长(小时)"
|
sortable="custom"
|
/>
|
<el-table-column
|
prop="workprice"
|
label="工价(元/小时)"
|
sortable="custom"
|
/>
|
<el-table-column
|
prop="overcount"
|
label="加班时长(小时)"
|
sortable="custom"
|
/>
|
<el-table-column
|
prop="overprice"
|
label="加班工价(元/小时)"
|
sortable="custom"
|
width="160"
|
/>
|
<el-table-column
|
prop="deductcount"
|
label="扣除时长(小时)"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
<div v-if="row.isEdit">
|
<el-input
|
v-model="dialogForm.deductcount"
|
oninput="value=value.replace(/[^0-9.]/g,'')"
|
style="width: 100%"
|
/>
|
</div>
|
<div v-else>{{ row.deductcount }}</div>
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
prop="deductmoney"
|
label="扣除薪资(元)"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
<div v-if="row.isEdit">
|
<el-input
|
v-model="dialogForm.deductmoney"
|
oninput="value=value.replace(/[^0-9.]/g,'')"
|
style="width: 100%"
|
/>
|
</div>
|
<div v-else>{{ row.deductmoney }}</div>
|
</template>
|
</el-table-column>
|
<!-- <el-input-->
|
<!-- v-model="dialogForm.deductcount"-->
|
<!-- oninput="value=value.replace(/[^0-9.]/g,'')"-->
|
<!-- style="width: 200px"-->
|
<!-- />-->
|
<el-table-column
|
prop="timimoney"
|
label="计时工资(元)"
|
sortable="custom"
|
/>
|
|
<el-table-column
|
label="结算工资(元)"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
{{ parseFloat((parseFloat(row.timimoney) - parseFloat(row.deductmoney)).toFixed(2)) }}
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
width="120"
|
fixed="right"
|
>
|
<template slot-scope="{row}">
|
<div class="operationClass">
|
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
|
<i
|
v-if="!row.isEdit"
|
class="el-icon-edit-outline"
|
:style="{color:$store.state.settings.theme}"
|
@click="edit('edit',row)"
|
/>
|
</el-tooltip>
|
|
<el-tooltip class="item" effect="dark" content="保存" placement="top">
|
<i
|
v-if="row.isEdit"
|
class="el-icon-circle-check"
|
style="cursor: pointer;"
|
:style="{color:$store.state.settings.theme}"
|
@click="save(row)"
|
/>
|
</el-tooltip>
|
|
<el-tooltip class="item" effect="dark" content="取消" placement="top">
|
<i
|
v-if="row.isEdit"
|
class="el-icon-circle-close"
|
style="cursor: pointer;margin-left: 15px;"
|
:style="{color:$store.state.settings.theme}"
|
@click="cancel(row)"
|
/>
|
</el-tooltip>
|
|
<!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">-->
|
<!-- <i-->
|
<!-- v-if="row.leve!==0"-->
|
<!-- class="el-icon-delete"-->
|
<!-- :style="{color:$store.state.settings.theme}"-->
|
<!-- @click="del(row)"-->
|
<!-- />-->
|
<!-- </el-tooltip>-->
|
</div>
|
</template>
|
|
</el-table-column>
|
</el-table>
|
</div>
|
<!--分页-->
|
<pagination
|
:total="total"
|
:page.sync="form.page"
|
:limit.sync="form.rows"
|
align="right"
|
layout="total,prev, pager, next,sizes,jumper"
|
popper-class="select_bottom"
|
@pagination="getDailyWageReportSearch"
|
/>
|
</div>
|
|
<el-dialog
|
v-el-drag-dialog
|
:title="operation==='add'?'新增':'编辑'"
|
:visible.sync="dialogVisible"
|
width="900px"
|
:close-on-click-modal="false"
|
top="15vh"
|
@closed="handleClose"
|
@close="handleClose"
|
>
|
<el-form
|
ref="dialogForm"
|
inline
|
:rules="dialogFormRules"
|
:model="dialogForm"
|
label-width="140px"
|
>
|
<el-form-item label="车间名称" prop="wkshop_code">
|
<el-select
|
v-model="dialogForm.wkshop_code"
|
style="width: 200px"
|
placeholder="请选择"
|
disabled
|
>
|
<el-option
|
v-for="item in wkshopArr"
|
:key="item.torg_code"
|
:label="item.torg_name"
|
:value="item.torg_code"
|
/>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="打卡日期" prop="checkindate">
|
<el-date-picker
|
v-model="dialogForm.checkindate"
|
type="date"
|
style="width: 200px"
|
disabled
|
placeholder="选择日期"
|
format="yyyy-MM-dd"
|
/>
|
</el-form-item>
|
|
<el-form-item label="打卡人员" prop="usercode">
|
<el-select
|
v-model="dialogForm.usercode"
|
style="width: 200px"
|
placeholder="请选择"
|
disabled
|
>
|
<el-option
|
v-for="item in creatuserArr"
|
:key="item.usercode"
|
:label="item.username"
|
:value="item.usercode"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="工作时长" prop="workcount">
|
<el-input
|
v-model="dialogForm.workcount"
|
style="width: 200px"
|
disabled
|
/>
|
</el-form-item>
|
<el-form-item label="加班时长" prop="overcount">
|
<el-input
|
v-model="dialogForm.overcount"
|
disabled
|
style="width: 200px"
|
/>
|
</el-form-item>
|
|
<el-form-item label="扣除时长" prop="deductcount">
|
<el-input
|
v-model="dialogForm.deductcount"
|
oninput="value=value.replace(/[^0-9.]/g,'')"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<el-form-item label="扣除薪资" prop="deductmoney">
|
<el-input
|
v-model="dialogForm.deductmoney"
|
oninput="value=value.replace(/[^0-9.]/g,'')"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<div class="footerButton">
|
<el-button v-waves @click="dialogVisibleCancel">取 消</el-button>
|
<el-button
|
v-waves
|
type="primary"
|
:loading="$store.state.app.buttonIsDisabled"
|
:disabled="$store.state.app.buttonIsDisabled"
|
@click="dialogVisibleConfirm"
|
>确 定</el-button>
|
</div>
|
</span>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import Pagination from '@/components/Pagination'
|
import { handleDatetime } from '@/utils/global'
|
import elDragDialog from '@/directive/el-drag-dialog'
|
import waves from '@/directive/waves'
|
import { PersonPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData'
|
import {
|
DailyWageReportUpdate,
|
AttendanceSettDelete,
|
DailyWageReportSearch,
|
DailyWageReportExcelSearch
|
} from '@/api/attendanceModule'
|
|
export default {
|
name: 'AttendanceDay',
|
components: {
|
Pagination
|
},
|
directives: { elDragDialog, waves },
|
data() {
|
return {
|
mainHeight: 0,
|
tableHeight: 0,
|
form: {
|
wkshop_code: '',
|
creatusercode: '',
|
creatdate: [new Date(), new Date()],
|
prop: 'wkshop_code', // 排序字段
|
order: 'desc', // 排序字段
|
page: 1, // 第几页
|
rows: 20 // 每页多少条
|
},
|
total: 10,
|
tableData: [],
|
|
wkshopArr: [],
|
creatuserArr: [],
|
|
dialogVisible: false,
|
dialogForm: {
|
// 'wkshop_code': '',
|
// 'checkindate': '',
|
// 'usercode': '',
|
// 'workcount': '',
|
// 'overcount': '',
|
// 'deductcount': '',
|
// 'deductmoney': ''
|
},
|
operation: '',
|
dialogFormRules: {
|
wkshop_code: [
|
{ required: true, message: '请选择所属车间', trigger: ['blur', 'change'] }
|
],
|
checkindate: [
|
{ required: true, message: '请选择打卡日期', trigger: ['blur', 'change'] }
|
],
|
usercode: [
|
{ required: true, message: '请选择打卡人员', trigger: ['blur', 'change'] }
|
],
|
workcount: [
|
{ required: true, message: '请输入工作时长', trigger: ['blur', 'change'] }
|
],
|
overcount: [
|
{ required: true, message: '请输入加班时长', trigger: ['blur', 'change'] }
|
],
|
deductcount: [
|
{ required: true, message: '请输入扣除时长', trigger: ['blur', 'change'] }
|
],
|
deductmoney: [
|
{ required: true, message: '请输入扣除薪资', trigger: ['blur', 'change'] }
|
]
|
|
}
|
|
}
|
},
|
activated() {
|
window.addEventListener('resize', this.getHeight)
|
this.getHeight()
|
},
|
created() {
|
this.getDailyWageReportSearch()
|
},
|
async mounted() {
|
window.addEventListener('resize', this.getHeight)
|
this.getHeight()
|
await this.getPrentOrganizationNoCompany()
|
await this.getPersonPermissions()
|
},
|
methods: {
|
async getPrentOrganizationNoCompany() {
|
const { data: res } = await PrentOrganizationNoCompany()
|
this.wkshopArr = res
|
},
|
async getPersonPermissions() {
|
const { data: res } = await PersonPermissions()
|
this.creatuserArr = res
|
},
|
|
async getDailyWageReportSearch() {
|
let tempDate = this.form.creatdate
|
if (tempDate.length > 0) {
|
tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
|
}
|
const data = {
|
wkshop_code: this.form.wkshop_code,
|
creatusercode: this.form.creatusercode,
|
creatdate: tempDate,
|
prop: this.form.prop,
|
order: this.form.order,
|
page: this.form.page,
|
rows: this.form.rows
|
}
|
const res = await DailyWageReportSearch(data)
|
res.data.forEach(i => {
|
i.isEdit = false
|
})
|
this.tableData = res.data
|
this.total = res.count
|
},
|
|
// 排序改变时
|
sortChange({ column, prop, order }) {
|
if (order === 'descending') {
|
order = 'desc'
|
} else if (order === 'ascending') {
|
order = 'asc'
|
} else {
|
order = 'desc'
|
}
|
this.form.order = order
|
this.form.prop = prop
|
this.getDailyWageReportSearch()
|
},
|
// 重置
|
reset() {
|
this.form.wkshop_code = ''
|
this.form.creatusercode = ''
|
this.form.creatdate = [new Date(), new Date()]
|
this.getDailyWageReportSearch()
|
},
|
// 新增按钮
|
add(operation) {
|
this.operation = operation
|
this.dialogVisible = true
|
},
|
// 修改按钮
|
async edit(operation, row) {
|
this.dialogForm = { ...row }
|
row.isEdit = true
|
this.operation = operation
|
// this.operation = operation
|
// this.dialogVisible = true
|
// this.$nextTick(() => {
|
// this.dialogForm = { ...row }
|
// })
|
},
|
save(row) {
|
if (this.dialogForm.deductcount.toString().trim().length === 0) {
|
return this.$message.info('扣除时长的最小值为零!')
|
}
|
if (this.dialogForm.deductmoney.toString().trim().length === 0) {
|
return this.$message.info('扣除薪资的最小值为零!')
|
}
|
|
DailyWageReportUpdate(this.dialogForm, 'Update').then(res => {
|
if (res.code === '200') {
|
this.$notify.success('修改成功!')
|
row.isEdit = false
|
this.getDailyWageReportSearch()
|
} else {
|
this.$notify.error('修改失败!')
|
}
|
})
|
},
|
cancel(row) {
|
row.isEdit = false
|
this.getDailyWageReportSearch()
|
},
|
// 删除按钮
|
// async del(row) {
|
// this.$confirm('是否确认删除?', '提示', {
|
// confirmButtonText: '确定',
|
// cancelButtonText: '取消',
|
// type: 'warning'
|
// }).then(() => {
|
// const data = {
|
// 'wkshop_code': row.wkshop_code,
|
// 'workhouse': row.workhouse,
|
// 'closehouse': row.closehouse,
|
// 'workprice': row.workprice,
|
// 'overprice': row.overprice,
|
// 'uphouse': row.uphouse,
|
// 'downhouse': row.downhouse
|
// }
|
// AttendanceSettDelete(data).then(res => {
|
// if (res.code === '200') {
|
// this.$notify.success('删除成功!')
|
// if (this.form.page > 1 && this.tableData.length === 1) {
|
// this.form.page--
|
// }
|
// this.getDailyWageReportSearch()
|
// }
|
// })
|
// }).catch(() => {
|
// this.$notify.info('已取消删除')
|
// })
|
// },
|
// 对话框关闭事件
|
handleClose() {
|
this.dialogForm = {}
|
this.$refs.dialogForm.clearValidate()
|
},
|
// 对话框取消
|
dialogVisibleCancel() {
|
this.dialogVisible = false
|
},
|
// 对话框确认
|
dialogVisibleConfirm() {
|
this.$refs.dialogForm.validate(valid => {
|
if (valid) {
|
this.$store.state.app.buttonIsDisabled = true
|
DailyWageReportUpdate(this.dialogForm, this.operation === 'add' ? 'Add' : 'Update').then(res => {
|
if (res.code === '200') {
|
this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
|
this.dialogVisible = false
|
this.$store.state.app.buttonIsDisabled = false
|
this.getDailyWageReportSearch()
|
} else {
|
this.$store.state.app.buttonIsDisabled = false
|
this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
|
}
|
})
|
}
|
})
|
},
|
async download() {
|
let tempDate = this.form.creatdate
|
if (tempDate.length > 0) {
|
tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
|
}
|
const data = {
|
wkshop_code: this.form.wkshop_code,
|
creatusercode: this.form.creatusercode,
|
creatdate: tempDate
|
}
|
const { data: res } = await DailyWageReportExcelSearch(data)
|
window.location.href = res
|
},
|
// 获取页面高度
|
getHeight() {
|
this.$nextTick(() => {
|
this.mainHeight = window.innerHeight - 85
|
this.tableHeight = this.mainHeight - 200
|
this.$refs.tableDataRef.doLayout()
|
})
|
}
|
}
|
}
|
</script>
|
<style scoped lang="scss">
|
::v-deep .el-select__caret {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
::v-deep .el-range__icon {
|
line-height: 28px !important;
|
}
|
|
::v-deep .el-range-separator {
|
line-height: 28px !important;
|
}
|
|
::v-deep .el-range-input {
|
font-size: 14px;
|
}
|
|
::v-deep .el-range-separator {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
::v-deep .el-progress-bar__innerText {
|
display: none !important;
|
}
|
|
//.custom-table-class {
|
// ::v-deep .el-table__row {
|
// height: 80px;
|
// line-height:80px;
|
// }
|
//}
|
|
</style>
|