Commit fb096215 authored by dll's avatar dll

考勤组

parent a46efbdd
...@@ -91,6 +91,9 @@ sub { ...@@ -91,6 +91,9 @@ sub {
.mt10{ .mt10{
margin-top: 10px; margin-top: 10px;
} }
.ml10{
margin-left: 10px;
}
.ml20{ .ml20{
margin-left: 20px; margin-left: 20px;
} }
......
...@@ -210,3 +210,11 @@ export const findParentIds = (dataSource, nodeId) => { ...@@ -210,3 +210,11 @@ export const findParentIds = (dataSource, nodeId) => {
return parentIds; // 返回所有父节点ID的数组 return parentIds; // 返回所有父节点ID的数组
} }
// 格式化
export const booleanToNum = (val) => {
if(val){
return 1
}else{
return 0
}
}
\ No newline at end of file
...@@ -16,4 +16,27 @@ export const timestampToTime = (timestamp) => { ...@@ -16,4 +16,27 @@ export const timestampToTime = (timestamp) => {
var m = date.getMinutes() + ":"; var m = date.getMinutes() + ":";
var s = date.getSeconds(); var s = date.getSeconds();
return Y + M + D; return Y + M + D;
} }
\ No newline at end of file // 小时:分钟 ==》 转分钟
export const transFormMinut = (String) => {
if(typeof(String) === 'number'){
return
}
if(!String){
return 0
}
let arr = String.split(':')
let hour = arr[0].indexOf('0') === 0? arr[0].substring(1,arr[0].length):arr[0]
let minu = arr[1].indexOf('0') === 0? arr[1].substring(1,arr[1].length):arr[1]
return hour*60 + minu*1
}
// // 分钟 ==》 小时
export const transFormTime = (num) => {
if (typeof(num) != 'string' && num !== 0) {
return (Math.floor(num / 60)).toString() + ":" + (num % 60).toString()
}
else {
return "0:00";
}
}
\ No newline at end of file
...@@ -53,15 +53,15 @@ ...@@ -53,15 +53,15 @@
return { return {
/** 子表列元素 */ /** 子表列元素 */
columnSet:[ columnSet:[
{prop:"goWorkDate",label:"上班打卡时间",width:100}, {prop:"goWorkDate",label:"上班打卡时间",width:150},
{prop:"goWorkDateBefore",label:"上班打卡前时间段,单位分钟",width:100}, {prop:"goWorkDateBefore",label:"上班前打卡(分钟)",width:150},
{prop:"goWorkDateAfter",label:"上班打卡前时间段,单位分钟",width:100}, {prop:"goWorkDateAfter",label:"上班后打卡(分钟)",width:150},
{prop:"offWorkDate",label:"下班打卡时间",width:100}, {prop:"offWorkDate",label:"下班打卡时间",width:150},
{prop:"offWorkDateBefore",label:"下班打卡前时间段,单位分钟",width:100}, {prop:"offWorkDateBefore",label:"下班前打卡(分钟)",width:150},
{prop:"offWorkDateAfter",label:"下班打卡前时间段,单位分钟",width:100}, {prop:"offWorkDateAfter",label:"下班后打卡(分钟)",width:150},
{prop:"remark",label:"备注",width:100}, // {prop:"remark",label:"备注",width:150},
{prop:"classId",label:"班次ID",width:100}, // {prop:"classId",label:"班次ID",width:150},
{prop:"className",label:"班次名称",width:100} ], ],
config: { config: {
search: [ search: [
{ {
...@@ -75,11 +75,10 @@ ...@@ -75,11 +75,10 @@
columns: [ columns: [
{type: "selection", width: 60}, {type: "selection", width: 60},
{type: "index",label: "序号",width: 50}, {type: "index",label: "序号",width: 50},
{label: "班次名称", prop: "className"}, {label: "班次名称", prop: "className"},
// {label: "考勤时间", prop: "className"}, // {label: "考勤时间", prop: "className"},
{label: "考勤班次详细信息", {label: "考勤班次详细信息",
width: 120, width: 200,
prop: "subColumns", prop: "subColumns",
formatter: (row) => { formatter: (row) => {
let widthsize = this.columnSet.reduce((pre, cur) => { let widthsize = this.columnSet.reduce((pre, cur) => {
......
<template>
<div class="mt20" v-if="isshow">
<el-table :data="classArr" border highlight-current-row ref="table"
@row-click="(row, column, event) => $rowClick(row,column, event, 'table')"
>
<el-table-column label="班次名称" prop="className" width="300px"></el-table-column>
<el-table-column label="考勤时间" prop="" fixed="right">
<template slot-scope="scope">
<div>
<el-tag class="ml10" v-for="(item,index) in scope.row.attendanceClassDetailList" :key="index">
{{item.goWorkDate}} ~ {{item.offWorkDate}}
</el-tag>
</div>
</template>
</el-table-column>
</el-table>
<div class="mt20">
<el-button type="primary" size="mini" @click="saveRowBanci">确定</el-button>
<el-button type="" size="mini" @click="cancelBanci">取消</el-button>
</div>
</div>
</template>
<script>
export default {
props:{
classArr:{
type:Array,
default:[]
},
currentArr:{
type:Object,
default:{}
},
isshow:{
type:Boolean,
default:false
}
},
watch:{
isshow:{
handler(newval){
if(newval){
this.selected = this.currentArr
this.$nextTick(() => {
let index = this.classArr.findIndex(item => item.id == this.selected.id)
this.$refs['table'].setCurrentRow(this.classArr[index],true)
})
}
}
}
},
data(){
return{
selected:{}
}
},
methods:{
saveRowBanci(){
this.$emit('saveRowBanci',this.selected)
},
cancelBanci(){
this.$emit('cancelBanci',null)
},
// 表格切换高亮点击
$rowClick (row, column, ev, ref) {
this.selected = row
const $table = this.$refs[ref]
// 因为不知道表格中包裹了多少层元素,所以需要通过查询点击元素的所有父级元素找到符合条件的类名进行判断
const haveHeightLight = [...ev.path].some(el => {
if (el.classList) return [...el.classList].indexOf('el-table__row') !== -1 && [...el.classList].indexOf('current-row') !== -1
})
try {
$table[0].setCurrentRow(haveHeightLight ? '' : row)
} catch (e) {
$table.setCurrentRow(haveHeightLight ? '' : row)
}
},
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<table class="table mt10">
<th class="heads flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox v-model="selectAll" @change="allhandler"></el-checkbox>
</td>
<td class="t1">工作日</td>
<td class="t2">班次时间段</td>
<td class="t1">操作</td>
</th>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.monday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周一</td>
<td class="t2">
<span>{{setParams.mondayClassId?setParams.mondayClassName:'未设置'}}</span>
<el-tag v-for="(item,index) in setParams.mondayClassTime.attendanceClassDetailList" :key="index" class="ml10">
{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('monday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.tuesday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周二</td>
<td class="t2">
{{setParams.tuesdayClassId?setParams.tuesdayClassName:'未设置'}}
<el-tag class="ml10" v-for="(item,index) in setParams.tuesdayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('tuesday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.wednesday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周三</td>
<td class="t2">
{{setParams.wednesdayClassId?setParams.wednesdayClassName:'未设置'}}
<el-tag class="ml10" v-for="(item,index) in setParams.wednesdayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('wednesday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.thursday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周四</td>
<td class="t2">
{{setParams.thursdayClassId?setParams.thursdayClassName:'未设置'}}
<el-tag class="ml10" v-for="(item,index) in setParams.thursdayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('thursday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.friday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周五</td>
<td class="t2">
{{setParams.fridayClassId?setParams.fridayClassName:'未设置'}}
<el-tag class="ml10" v-for="(item,index) in setParams.fridayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('friday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.saturday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周六</td>
<td class="t2">
{{setParams.saturdayClassId?setParams.saturdayClassName:'休息'}}
<el-tag class="ml10" v-for="(item,index) in setParams.saturdayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('saturday')">更改班次</el-button>
</td>
</tr>
<tr class="flex flex-align-center flex-pack-justify">
<td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.sunday" @change="judgeAll"></el-checkbox>
</td>
<td class="t1">周日</td>
<td class="t2">
{{setParams.sundayClassId?setParams.sundayClassName:'休息'}}
<el-tag class="ml10" v-for="(item,index) in setParams.sundayClassTime.attendanceClassDetailList" :key="index">{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</td>
<td class="t1">
<el-button type="text" @click="changebanci('sunday')">更改班次</el-button>
</td>
</tr>
</table>
</template>
<script>
export default {
props:{
setParams:{
type:Object,
default:{}
}
},
data(){
return{
selectAll:false
}
},
mounted(){
// 判断全选
this.judgeAll()
},
methods:{
changebanci(from){
this.$emit('changebanci',from)
},
allhandler(){
if(this.selectAll){
this.setParams.monday = true
this.setParams.tuesday = true
this.setParams.wednesday = true
this.setParams.thursday = true
this.setParams.friday = true
this.setParams.saturday = true
this.setParams.sunday = true
}else{
this.setParams.monday = false
this.setParams.tuesday = false
this.setParams.wednesday = false
this.setParams.thursday = false
this.setParams.friday = false
this.setParams.saturday = false
this.setParams.sunday = false
}
},
judgeAll(){
if(!this.setParams.monday){
this.selectAll = false
return
}
if(!this.setParams.tuesday){
this.selectAll = false
return
}
if(!this.setParams.wednesday){
this.selectAll = false
return
}
if(!this.setParams.thursday){
this.selectAll = false
return
}
if(!this.setParams.friday){
this.selectAll = false
return
}
if(!this.setParams.saturday){
this.selectAll = false
return
}
if(!this.setParams.sunday){
this.selectAll = false
return
}
this.selectAll = true
}
}
}
</script>
<style lang="scss" scoped>
.table{
width: 90%;
.selectTions{
margin-right: 10px;
}
.heads{
background-color: #cae4fd;
height: 50px;
line-height: 50px;
padding: 0 20px;
}
tr{
height: 50px;
line-height: 50px;
padding: 0 20px;
}
.t1{
flex: 1
}
.t2{
flex: 2;
color:gray;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment