attendance-group-table.vue
4.15 KB
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
<template>
<el-card class="setting-card" shadow="never">
<div slot="header" class="card-header">
<span>考勤分组设置</span>
<el-button type="primary" size="mini" icon="el-icon-plus" @click="addRow">新增分组</el-button>
</div>
<NCC-table :data="value" border size="mini" height="260">
<el-table-column label="分组名称" min-width="150" align="left">
<template slot-scope="scope">
<el-input v-model="scope.row.groupName" placeholder="例如:门店组" />
</template>
</el-table-column>
<el-table-column label="上班时间" min-width="130" align="left">
<template slot-scope="scope">
<el-time-picker
v-model="scope.row.workStartTime"
value-format="HH:mm"
format="HH:mm"
placeholder="09:00"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column label="下班时间" min-width="130" align="left">
<template slot-scope="scope">
<el-time-picker
v-model="scope.row.workEndTime"
value-format="HH:mm"
format="HH:mm"
placeholder="19:00"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column label="月应休天数" min-width="120" align="left">
<template slot-scope="scope">
<el-input-number v-model="scope.row.monthlyRestDays" :min="0" :precision="0" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="是否启用" width="100" align="left">
<template slot-scope="scope">
<el-switch v-model="scope.row.isEnabled" :active-value="1" :inactive-value="0" />
</template>
</el-table-column>
<el-table-column label="备注" min-width="180" align="left">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="无" />
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="left">
<template slot-scope="scope">
<el-button type="text" @click="showUsers(scope.row)">成员详情</el-button>
<el-popconfirm
title="确认删除当前配置吗?"
confirm-button-text="确认删除"
cancel-button-text="取消"
@confirm="removeRow(scope.$index)"
>
<el-button slot="reference" type="text" class="danger-text">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</NCC-table>
<div class="table-tip">分组成员请到“用户管理-编辑用户”中单独指定考勤分组,也可以在这里查看分组成员详情。</div>
<el-empty v-if="!value.length" :image-size="56" description="暂无考勤分组配置" />
<attendance-group-user-dialog ref="userDialog" />
</el-card>
</template>
<script>
import AttendanceGroupUserDialog from './attendance-group-user-dialog'
export default {
name: 'AttendanceGroupTable',
components: {
AttendanceGroupUserDialog
},
props: {
value: {
type: Array,
default: () => []
}
},
methods: {
addRow() {
this.$emit('input', [
...this.value,
{
groupName: '',
workStartTime: '09:00',
workEndTime: '19:00',
monthlyRestDays: 4,
isEnabled: 1,
remark: ''
}
])
},
removeRow(index) {
const list = this.value.slice()
list.splice(index, 1)
this.$emit('input', list)
},
showUsers(row) {
if (!row.id) {
this.$message.warning('请先保存分组设置后再查看成员详情')
return
}
this.$refs.userDialog.init(row)
}
}
}
</script>
<style lang="scss" scoped>
.setting-card {
border-radius: 12px;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 600;
}
.table-tip {
margin-top: 8px;
color: #909399;
font-size: 12px;
}
.danger-text {
color: #f56c6c;
}
::v-deep .el-card__header {
padding: 12px 16px;
}
::v-deep .el-card__body {
padding: 12px 14px;
}
</style>