Commit 255d6fce authored by dll's avatar dll

完成考勤组功能

parent e6aa3b6b
#开发环境 #开发环境
NODE_ENV = "development" NODE_ENV = "development"
VUE_APP_API_BASE_URL=http://192.168.0.98:11039 VUE_APP_API_BASE_URL= http://192.168.0.98:11039
\ No newline at end of file VUE_APP_API_BASE_URL = http://192.168.0.116:17500
\ No newline at end of file
...@@ -19,8 +19,8 @@ export default { ...@@ -19,8 +19,8 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
this.source.cancel('自动取消ajax操作'); this.source.cancel('自动取消ajax操作')
clearTimeout(this.loadingTimer); clearTimeout(this.loadingTimer)
}, },
methods: { methods: {
test() { test() {
...@@ -58,7 +58,6 @@ export default { ...@@ -58,7 +58,6 @@ export default {
this.tableData = this.beforeRender( this.tableData = this.beforeRender(
Object.assign({}, this.tableData, data) Object.assign({}, this.tableData, data)
) )
console.log(this.tableData,'fffff')
this.afterRender(this.tableData); this.afterRender(this.tableData);
}) })
.catch(error => { .catch(error => {
...@@ -339,6 +338,22 @@ export default { ...@@ -339,6 +338,22 @@ export default {
return val return val
} }
}, },
// 考勤组格式
formatterBanci(row,column,val){
const content = formatter(this.tableData, column, val)
if (content) {
return <div>
<div>
<el-tag type="info">{row.restTime}</el-tag>
</div>
<div class="mt10">
<el-tag>{row.attendanceTime}</el-tag>
</div>
</div>
} else {
return val
}
},
// 多选表格行 // 多选表格行
handleSelectionChange(val) { handleSelectionChange(val) {
this.selection = val.map(i => i.id); this.selection = val.map(i => i.id);
......
...@@ -31,10 +31,10 @@ export default { ...@@ -31,10 +31,10 @@ export default {
<i style="font-size:16px;color:#409EFF" class={data.icon}></i> <i style="font-size:16px;color:#409EFF" class={data.icon}></i>
<span style="padding-left: 2px;font-size:14px">{node.label}</span> <span style="padding-left: 2px;font-size:14px">{node.label}</span>
<span style="padding-left: 2px;font-size:14px;margin-left:20px"> <span style="padding-left: 2px;font-size:14px;margin-left:20px">
({data.children.length}) ({data.children?data.children.length:0})
</span> </span>
</span> </span>
); )
}, },
async loadNode(node, resolve) { async loadNode(node, resolve) {
......
...@@ -31,13 +31,20 @@ instance.interceptors.request.use(config => { ...@@ -31,13 +31,20 @@ instance.interceptors.request.use(config => {
// const port =process.env.VUE_APP_PORTAL_PORT=='undefined'?'11072':process.env.VUE_APP_PORTAL_PORT; // const port =process.env.VUE_APP_PORTAL_PORT=='undefined'?'11072':process.env.VUE_APP_PORTAL_PORT;
// 测试用 // 测试用
//http://192.168.0.98:11039/ //http://192.168.0.98:11039
// 温 // 温
// http://192.168.0.116/17500 // http://192.168.0.116/17500
// 代
// http://192.168.0.108/17500
const hostname = '192.168.0.116' const hostname = '192.168.0.116'
const port = '17500' const port = '17500'
// const hostname = '192.168.0.98'
// const port = '11039'
// 动态修改请求地址 // 动态修改请求地址
if (config.url.startsWith('/')) { if (config.url.startsWith('/')) {
// 字符串以 / 开头 // 字符串以 / 开头
......
...@@ -4,12 +4,13 @@ ...@@ -4,12 +4,13 @@
<el-form-item :label="label" :prop="prop" class='my-form-field'> <el-form-item :label="label" :prop="prop" class='my-form-field'>
<slot> <slot>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" @focus="emit" v-if='type === "text"' :class="inputClass" :clearable='clearable'></el-input> <el-input :maxlength="maxLength" :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" @focus="emit" v-if='type === "text"' :class="inputClass" :clearable='clearable'></el-input>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" type='password' v-if='type === "password"'></el-input> <el-input :maxlength="maxLength" :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" type='password' v-if='type === "password"'></el-input>
<el-input-number :disabled='disabled' v-model="field" size="small" :placeholder='placeholder' @change="emit" @input="emit" v-if='type === "num"'></el-input-number> <el-input-number :disabled='disabled' v-model="field" size="small" :placeholder='placeholder' @change="emit" @input="emit" v-if='type === "num"'></el-input-number>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" :rows='rows' @input="emit" v-if='type === "textarea"' type='textarea' :autosize="textareaSize" :class="inputClass"></el-input> <el-input :disabled='disabled' :placeholder='placeholder' v-model="field" :maxlength="maxLength"
@change="emit" :rows='rows' @input="emit" v-if='type === "textarea"' type='textarea' :autosize="textareaSize" :class="inputClass"></el-input>
<!-- 一级 --> <!-- 一级 -->
<el-select :disabled='disabled' v-model="field" @change="emit" :multiple='multiple' :filterable='filterable' :clearable='clearable' v-if='type === "select"'> <el-select :disabled='disabled' v-model="field" @change="emit" :multiple='multiple' :filterable='filterable' :clearable='clearable' v-if='type === "select"'>
...@@ -133,6 +134,10 @@ export default { ...@@ -133,6 +134,10 @@ export default {
inputClass: { inputClass: {
type: String, type: String,
default: '', default: '',
},
maxLength:{
type:Number,
default:256,
} }
}, },
methods: { methods: {
......
...@@ -230,6 +230,7 @@ export default { ...@@ -230,6 +230,7 @@ export default {
//初始化查询表单 //初始化查询表单
let newFormData = {}; let newFormData = {};
// this.form = this.encode(data, this.form); // this.form = this.encode(data, this.form);
console.log(this.search,'ddd')
this.search.forEach((item) => { this.search.forEach((item) => {
//复选框 //复选框
if (item.type === "checkbox") { if (item.type === "checkbox") {
...@@ -255,6 +256,7 @@ export default { ...@@ -255,6 +256,7 @@ export default {
}); });
this.form = Object.assign({}, this.form, newFormData); this.form = Object.assign({}, this.form, newFormData);
this.form = Object.assign({}, this.form, data); this.form = Object.assign({}, this.form, data);
console.log(this.form,'dddddd')
}, },
cleanForm() { cleanForm() {
this.clean(); this.clean();
...@@ -274,11 +276,19 @@ export default { ...@@ -274,11 +276,19 @@ export default {
}, },
onSubmit() { onSubmit() {
let { path, query } = this.$route; let { path, query } = this.$route;
let data = this.decode(this.form); let params = JSON.parse(JSON.stringify(this.form)) //不更改原始数据
console.log(this.form,'form参数')
let data = this.decode(params);
console.log(data,'参数')
// Object.assign({}, query, data)
this.$router.push({ this.$router.push({
path: path, path: path,
query: Object.assign({}, query, data), query: {
}); ...query,
...data
},
})
}, },
// 解析url字符串,去除query字段 // 解析url字符串,去除query字段
encode(data, formTemp) { encode(data, formTemp) {
...@@ -325,18 +335,17 @@ export default { ...@@ -325,18 +335,17 @@ export default {
val.length > 0 val.length > 0
) { ) {
//支持模糊查询,收尾增加百分号 //支持模糊查询,收尾增加百分号
val = val.trim(); val = val.trim()
if(val.charAt(0)!='%'){ if(val.charAt(0)!='%'){
val = "%" + val val = "%" + val
} }
if(val.charAt(val.length-1)!='%'){ if(val.charAt(val.length-1)!='%'){
val =val + "%"; val =val + "%";
} }
} }
}); })
newData[item] = this.decodeVal(val); newData[item] = this.decodeVal(val);
}); })
return newData; return newData;
}, },
decodeVal(val) { decodeVal(val) {
......
<template> <template>
<div class="mt20" v-if="isshow"> <div class="mt20">
<el-table :data="classArr" border highlight-current-row ref="table" <el-table :data="classArr" border highlight-current-row ref="table"
@row-click="(row, column, event) => $rowClick(row,column, event, 'table')" @row-click="(row, column, event) => $rowClick(row,column, event, 'table')"
> >
...@@ -31,23 +31,6 @@ export default { ...@@ -31,23 +31,6 @@ export default {
currentArr:{ currentArr:{
type:Object, type:Object,
default:{} 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(){ data(){
...@@ -55,6 +38,13 @@ export default { ...@@ -55,6 +38,13 @@ export default {
selected:{} selected:{}
} }
}, },
mounted() {
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)
})
},
methods:{ methods:{
saveRowBanci(){ saveRowBanci(){
this.$emit('saveRowBanci',this.selected) this.$emit('saveRowBanci',this.selected)
......
...@@ -8,102 +8,21 @@ ...@@ -8,102 +8,21 @@
<td class="t2">班次时间段</td> <td class="t2">班次时间段</td>
<td class="t1">操作</td> <td class="t1">操作</td>
</th> </th>
<tr class="flex flex-align-center flex-pack-justify"> <tr class="flex flex-align-center flex-pack-justify" v-for="(item,index) in typeList" :key="index">
<td class="selectTions"> <td class="selectTions">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.monday" @change="judgeAll"></el-checkbox> <el-checkbox :true-label="1" :false-label="0" v-model="setParams[item.value]" @change="judgeAll"></el-checkbox>
</td> </td>
<td class="t1">周一</td> <td class="t1">{{item.name}}</td>
<td class="t2"> <td class="t2">
<span>{{setParams.mondayClassId?setParams.mondayClassName:'未设置'}}</span> <span>{{setParams[item.value+'ClassId']?setParams[item.value+'ClassName']:'未设置'}}</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"> <el-tag v-for="(item,index) in setParams[item.value+'ClassTime'].attendanceClassDetailList" :key="index"
<td class="selectTions"> class="ml10">
<el-checkbox :true-label="1" :false-label="0" v-model="setParams.wednesday" @change="judgeAll"></el-checkbox> {{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
</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>
<td class="t1"> <td class="t1">
<el-button type="text" @click="changebanci('thursday')">更改班次</el-button> <el-button type="text" @click="changebanci(item.value)">更改班次</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> </td>
</tr> </tr>
</table> </table>
...@@ -119,7 +38,45 @@ export default { ...@@ -119,7 +38,45 @@ export default {
}, },
data(){ data(){
return{ return{
selectAll:false selectAll:false,
typeList:[
{
name:'周一',
value:'monday'
},
{
name:'周二',
value:'tuesday'
},
{
name:'周三',
value:'wednesday'
},
{
name:'周四',
value:'thursday'
},
{
name:'周五',
value:'friday'
},
{
name:'周六',
value:'saturday'
},
{
name:'周日',
value:'sunday'
}
]
}
},
watch:{
setParams:{
handler(newval){
this.$forceUpdate()
},
deep:true
} }
}, },
mounted(){ mounted(){
...@@ -132,51 +89,30 @@ export default { ...@@ -132,51 +89,30 @@ export default {
}, },
allhandler(){ allhandler(){
if(this.selectAll){ if(this.selectAll){
this.setParams.monday = true for(let item of this.typeList){
this.setParams.tuesday = true let key = item.value
this.setParams.wednesday = true this.setParams[key] = true
this.setParams.thursday = true }
this.setParams.friday = true
this.setParams.saturday = true
this.setParams.sunday = true
}else{ }else{
this.setParams.monday = false for(let item of this.typeList){
this.setParams.tuesday = false let key = item.value
this.setParams.wednesday = false this.setParams[key] = false
this.setParams.thursday = false this.setParams[key+'ClassTime'] = []
this.setParams.friday = false this.setParams[key+'ClassName'] = ''
this.setParams.saturday = false this.setParams[key+'ClassId'] = ''
this.setParams.sunday = false }
} }
}, },
judgeAll(){ judgeAll(){
if(!this.setParams.monday){ for(let item of this.typeList){
this.selectAll = false let key = item.value
return if(!this.setParams[key]){
} this.setParams[key+'ClassTime'] = []
if(!this.setParams.tuesday){ this.setParams[key+'ClassName'] = ''
this.selectAll = false this.setParams[key+'ClassId'] = ''
return 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 this.selectAll = true
} }
......
<template>
<!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="考勤组名称" prop="groupName" v-model="form.groupName" placeholder="请输入考勤组名称"/>
<Field label="人数" prop="personNum" v-model="form.personNum" placeholder="请输入人数"/>
<Field label="负责人" prop="responsiblePerson" v-model="form.responsiblePerson" placeholder="请输入负责人"/>
<Field label="类型" prop="type" v-model="form.type" type="select" :enumData="dict.type" placeholder="请选择类型"/>
<Field label="考勤时间" prop="attendanceTime" v-model="form.attendanceTime" type="select" :enumData="dict.attendanceTime" placeholder="请选择考勤时间"/>
<Field label="备注" prop="remark" v-model="form.remark" type="textarea" placeholder="请输入备注"/>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow";
export default {
mixins: [form],
components: {
dialogShow ,
},
data() {
return {
// 遮罩层
loading: true,
// 弹出层标题
title: "考勤组信息",
// 是否显示弹出层
open: false,
toString:[
"type",
"attendanceTime",
],
// 表单校验
rules: {
createTime: [
{required: true,message: "请选择创建时间" },
],
}
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改考勤组信息";
},
/** 新增 */
add(row) {
this.reset()
this.urls.currUrl = "attendance/group/add";
this.getData();
this.pageInfo.type="add"
this.title = "新增考勤组信息";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/view";
this.getData();
this.pageInfo.type="view"
this.title = "考勤组信息详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
groupName : "",
personNum : null,
responsiblePerson : "",
type : null,
attendanceTime : null,
remark : "",
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
<template>
<!-- 弹出框表单 -->
<el-drawer
:title="title"
:visible.sync="open"
:direction="direction"
size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="考勤组名称" prop="groupName" v-model="form.groupName" placeholder="请输入考勤组名称"/>
<Field label="参与考勤人数" prop="personNum" v-model="form.personNum" placeholder="请输入参与考勤人数"/>
<Field label="类型" prop="type" v-model="form.type" type="select" :enumData="dict.type" placeholder="请选择类型"/>
<Field label="备注" prop="remark" v-model="form.remark" type="textarea" placeholder="请输入备注"/>
<Field label="未参与考勤人数" prop="personNumNo" v-model="form.personNumNo" placeholder="请输入未参与考勤人数"/>
<Field label="考勤方式" prop="attendanceType" v-model="form.attendanceType" type="select" :enumData="dict.attendanceType" placeholder="请选择考勤方式"/>
</el-row>
<el-divider content-position="center">考勤组人员信息信息</el-divider>
<br/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddAttendanceGroupStaff">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteAttendanceGroupStaff">删除</el-button>
</el-col>
</el-row>
<el-table :data="attendanceGroupStaffList" :row-class-name="rowAttendanceGroupStaffIndex" @selection-change="handleAttendanceGroupStaffSelectionChange" ref="attendanceGroupStaff">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="考勤组名称" prop="groupName">
<template slot-scope="scope">
<el-input v-model="scope.row.groupName" placeholder="请输入考勤组名称" />
</template>
</el-table-column>
<el-table-column label="员工ID" prop="staffId">
<template slot-scope="scope">
<el-input v-model="scope.row.staffId" placeholder="请输入员工ID" />
</template>
</el-table-column>
<el-table-column label="员工姓名" prop="staffName">
<template slot-scope="scope">
<el-input v-model="scope.row.staffName" placeholder="请输入员工姓名" />
</template>
</el-table-column>
<el-table-column label="是否参与考勤," prop="partAttendance">
<template slot-scope="scope">
<el-input v-model="scope.row.partAttendance" placeholder="请输入是否参与考勤," />
</template>
</el-table-column>
<el-table-column label="备注" prop="remark">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
</template>
</el-table-column>
<el-table-column label="创建用户" prop="createUserId">
<template slot-scope="scope">
<el-input v-model="scope.row.createUserId" placeholder="请输入创建用户" />
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime">
<template slot-scope="scope">
<el-input v-model="scope.row.createTime" placeholder="请输入创建时间" />
</template>
</el-table-column>
<el-table-column label="更新用户" prop="updateUserId">
<template slot-scope="scope">
<el-input v-model="scope.row.updateUserId" placeholder="请输入更新用户" />
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updateTime">
<template slot-scope="scope">
<el-input v-model="scope.row.updateTime" placeholder="请输入更新时间" />
</template>
</el-table-column>
</el-table>
<form-buttons @submit='submitForm' noCancelBtn />
</el-form>
</el-drawer>
</template>
<script>
import form from "@/assets/mixins/formdialog";
export default {
name: "AttendanceGroupDetail",
mixins: [form],
components: {
},
created() {
this.changePath("attendance/group")
},
data() {
return {
// 子表选中数据
checkedAttendanceGroupStaff: [],
// 考勤组人员信息表格数据
attendanceGroupStaffList: [],
// 遮罩层
loading: true,
// 弹出层标题
title: "考勤组信息",
// 是否显示弹出层
open: false,
direction:"rtl",
toString:[
"type",
],
toDate:[
],
// 表单校验
rules: {
createTime: [
{required: true,message: "请选择创建时间" },
],
}
};
},
methods: {
/** 考勤组人员信息序号 */
rowAttendanceGroupStaffIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 考勤组人员信息添加按钮操作 */
handleAddAttendanceGroupStaff() {
let obj = {};
obj.groupName = "";
obj.staffId = "";
obj.staffName = "";
obj.partAttendance = "";
obj.remark = "";
obj.createUserId = "";
obj.createTime = "";
obj.updateUserId = "";
obj.updateTime = "";
this.attendanceGroupStaffList.push(obj);
},
/** 考勤组人员信息删除按钮操作 */
handleDeleteAttendanceGroupStaff() {
if (this.checkedAttendanceGroupStaff.length == 0) {
this.$alert("请先选择要删除的考勤组人员信息数据", "提示", { confirmButtonText: "确定", });
} else {
this.attendanceGroupStaffList.splice(this.checkedAttendanceGroupStaff[0].index - 1, 1);
}
},
/** 单选框选中数据 */
handleAttendanceGroupStaffSelectionChange(selection) {
if (selection.length > 1) {
this.$refs.attendanceGroupStaff.clearSelection();
this.$refs.attendanceGroupStaff.toggleRowSelection(selection.pop());
} else {
this.checkedAttendanceGroupStaff = selection;
}
},
// 渲染前置处理
beforeRender(data) {
if(data.entity.attendanceGroupStaffList) {
this.attendanceGroupStaffList = data.entity.attendanceGroupStaffList;
}
return data
},
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改考勤组信息";
},
/** 新增 */
add(row) {
this.reset()
this.urls.currUrl = "attendance/group/add";
this.getData();
this.pageInfo.type="add"
this.title = "新增考勤组信息";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/view";
this.getData();
this.pageInfo.type="view"
this.title = "考勤组信息详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
groupName : "",
personNum : null,
type : null,
remark : "",
personNumNo : null,
attendanceType : "",
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
<template> <template>
<div class="container"> <div class="container" v-if="open">
<el-card style="min-height:80vh;padding:15px"> <el-card style="min-height:80vh;padding:15px">
<div class="flex flex_end"> <div class="flex flex_end">
<el-button type="primary" size="mini" @click="$router.back()">返回上一级</el-button> <el-button type="primary" size="mini" @click="backTo">返回上一级</el-button>
</div> </div>
<tab-pane :activeName="activeName" :thirdList="thirdList"></tab-pane> <tab-pane :activeName="activeName" :thirdList="thirdList"></tab-pane>
<div class="mt20"> <div class="mt20">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<el-button type="text" class="ml20" @click="drawershow('drawer2')">设置</el-button> <el-button type="text" class="ml20" @click="drawershow('drawer2')">设置</el-button>
</div> </div>
<div class="flex flex-align-center mt10" style="color:#999;font-size:14px" v-if="!setParams.groupResponsibleEntity.responsibleId"> <div class="flex flex-align-center mt10" style="color:#999;font-size:14px" v-if="!groupResponsibleEntity.responsibleId">
<div>主负责人</div> <div>主负责人</div>
<div class="ml20">未设置</div> <div class="ml20">未设置</div>
</div> </div>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<!-- 考勤人员 --> <!-- 考勤人员 -->
<div v-if="drawer1"> <div v-if="drawer1">
<div>参与考勤人员({{this.attendArr.length}})</div> <div>参与考勤人员({{this.attendArr.length}})</div>
<el-input @focus="selectGroup(true)" type="textarea" <el-input @focus="selectGroup(true)" type="textarea" maxlength="20"
v-model="persons" style="width:80%" size="mini" placeholder="请选择"> v-model="persons" style="width:80%" size="mini" placeholder="请选择">
</el-input> </el-input>
</div> </div>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<!-- 考勤组 --> <!-- 考勤组 -->
<div class="mt10" v-if="drawer2"> <div class="mt10" v-if="drawer2">
<div>考勤组负责人:</div> <div>考勤组负责人:</div>
<el-select v-model="setParams.groupResponsibleEntity.responsibleId"> <el-select v-model="groupResponsibleEntity.responsibleId">
<el-option <el-option
v-for="($label, $value) in responsiableList" v-for="($label, $value) in responsiableList"
:key="$value" :key="$value"
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
<!-- 考勤时间 --> <!-- 考勤时间 -->
<div class="mt20" v-if="drawer3"> <div class="mt20" v-if="drawer3">
<!-- -->
<el-radio-group v-model="setParams.type" @change="changeRadio"> <el-radio-group v-model="setParams.type" @change="changeRadio">
<div class="mt10" v-for="(item,index) in paibanType" :key="index"> <div class="mt10" v-for="(item,index) in paibanType" :key="index">
<el-radio :label="item.value">{{item.label}}</el-radio> <el-radio :label="item.value">{{item.label}}</el-radio>
...@@ -182,9 +183,10 @@ ...@@ -182,9 +183,10 @@
</el-button> </el-button>
<div class="el-tag ml20" type="primary" size="mini" plain <div class="el-tag ml20" type="primary" size="mini" plain
v-if="attendanceGroupFixedworkSpecialList[0].specialTime"> v-if="attendanceGroupFixedworkSpecialList[0]">
{{attendanceGroupFixedworkSpecialList[0].specialTime? {{attendanceGroupFixedworkSpecialList[0].specialTime?
attendanceGroupFixedworkSpecialList[0].specialTime:'未设置'}} attendanceGroupFixedworkSpecialList[0].specialTime:'未设置'}}
<i class="el-icon-close" @click="deleteSpecal(0)"></i>
</div> </div>
</div> </div>
...@@ -192,11 +194,17 @@ ...@@ -192,11 +194,17 @@
<el-button @click="setMustTimes('noneed',attendanceGroupFixedworkSpecialList[1],1)"> <el-button @click="setMustTimes('noneed',attendanceGroupFixedworkSpecialList[1],1)">
+新增无需打卡的日期 +新增无需打卡的日期
</el-button> </el-button>
<div class="el-tag ml20" type="primary" size="mini" plain v-if="attendanceGroupFixedworkSpecialList[1].specialTime"> <div class="el-tag ml20" type="primary" size="mini" plain
v-if="attendanceGroupFixedworkSpecialList[1]&&attendanceGroupFixedworkSpecialList[1].specialTime">
{{attendanceGroupFixedworkSpecialList[1].specialTime}} {{attendanceGroupFixedworkSpecialList[1].specialTime}}
<i class="el-icon-close" @click="deleteSpecal(1)"></i>
</div>
<div class="el-tag ml20"
v-else-if="attendanceGroupFixedworkSpecialList[1]&&attendanceGroupFixedworkSpecialList[1].specialStartTime">
{{attendanceGroupFixedworkSpecialList[1].specialStartTime}}
{{attendanceGroupFixedworkSpecialList[1].specialEndTime}}
<i class="el-icon-close" @click="deleteSpecal(1)"></i>
</div> </div>
<div class="el-tag ml20" v-else-if="attendanceGroupFixedworkSpecialList[1].specialStartTime">
{{attendanceGroupFixedworkSpecialList[1].specialStartTime}}{{attendanceGroupFixedworkSpecialList[1].specialEndTime}}</div>
</div> </div>
</div> </div>
...@@ -285,7 +293,7 @@ ...@@ -285,7 +293,7 @@
<!-- 选择班次 --> <!-- 选择班次 -->
<el-dialog :visible.sync="isshowBanci" title="选择班次" :show-close="false"> <el-dialog :visible.sync="isshowBanci" title="选择班次" :show-close="false">
选择班次 选择班次
<banci-select :classArr="classArr" :currentArr="currentselectBanciRow" :isshow="isshowBanci" <banci-select :classArr="classArr" :currentArr="currentselectBanciRow" v-if="isshowBanci"
@saveRowBanci="saveRowBanci" @cancelBanci="cancelBanci"></banci-select> @saveRowBanci="saveRowBanci" @cancelBanci="cancelBanci"></banci-select>
</el-dialog> </el-dialog>
...@@ -345,30 +353,170 @@ ...@@ -345,30 +353,170 @@
import tabPane from '@/components/tabPane.vue' import tabPane from '@/components/tabPane.vue'
import banciTable from './banciTable/index' import banciTable from './banciTable/index'
import banciSelect from './banciSelect/index.vue' import banciSelect from './banciSelect/index.vue'
import {booleanToNum} from '@/assets/utils/common.js' import form from "@/assets/mixins/formdialog"
export default { export default {
mixins: [form],
components: { components: {
tabPane, tabPane,
banciTable, banciTable,
banciSelect banciSelect
}, },
created(){ created(){
this.getdata() this.changePath("attendance/group")
}, },
methods: { methods: {
// 返回
backTo(){
this.open = false
this.$emit('ok',true)
},
// 渲染前置处理
beforeRender(data) {
if(data.entity.attendanceGroupStaffList) {
this.attendanceGroupStaffList = data.entity.attendanceGroupStaffList;
}
return data
},
/** 编辑 */
edit(row) {
this.allReset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/edit";
this.getData();
this.pageInfo.type="edit"
this.open = true;
},
/** 新增 */
add(row) {
this.allReset()
this.urls.currUrl = "attendance/group/add";
this.getData();
this.pageInfo.type="add"
this.open = true;
},
/** 查看*/
view(row) {
this.allReset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/view";
this.getData();
this.pageInfo.type="view"
},
/**获取数据后弹框 */
afterRender(data) {
console.log(this.form,'返回数据')
this.dealDic()
let {attendanceGroupStaffList,groupName,type,attendanceType,groupFixedworkEntity,groupResponsibleEntity,attendanceGroupFreeworkEntity,id} = this.form
if(id){
this.setParams.id = id
}
if(attendanceGroupStaffList){
this.attendanceGroupStaffList = attendanceGroupStaffList//参与考勤的人
}
//固定班制
if(groupFixedworkEntity){
this.groupFixedworkEntity = groupFixedworkEntity
let week = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
for(let value of week){
if(this.groupFixedworkEntity[value]){
this.classArr.map(item => {
if(item.id === this.groupFixedworkEntity[value+'ClassId']){
this.groupFixedworkEntity[value+'ClassTime'] = item
}
})
}else{
this.groupFixedworkEntity[value+'ClassTime'] = []
}
}
this.cancelBanci()
this.holidays = groupFixedworkEntity.holidays
}
// 特殊日期
if(groupFixedworkEntity && groupFixedworkEntity.attendanceGroupFixedworkSpecialList){
// 固定班制
this.attendanceGroupFixedworkSpecialList = groupFixedworkEntity.attendanceGroupFixedworkSpecialList
}
// 自由工时
if(attendanceGroupFreeworkEntity){
this.attendanceGroupFreeworkEntity = attendanceGroupFreeworkEntity
this.holidays = attendanceGroupFreeworkEntity.holidays
}
if(attendanceGroupFreeworkEntity && attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList){
this.attendanceGroupFixedworkSpecialList = attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList
}
//负责人
if(groupResponsibleEntity){
this.groupResponsibleEntity = groupResponsibleEntity
this.groupResponsibleEntity.responsibleId = this.groupResponsibleEntity.responsibleId.toString()
}
// 处理考勤人回显
this.attendArrId = this.attendanceGroupStaffList.map(item => item.staffId)
this.attendArr = this.attendanceGroupStaffList
this.setParams.groupName = groupName//考勤组名称
this.setParams.type = type//考勤类型
this.setParams.attendanceType = attendanceType//打卡类型
},
afterSubmit(data) {
this.open = false;
this.allReset()
this.$emit("ok",true);
},
// 处理字典
dealDic(){
this.attendanceType = []
this.classArr = this.dict.classId
this.responsiableList = this.dict.workMan
this.areaData = this.dict.deptId
for(let key in this.dict.attendanceType){
let obj = {
label:this.dict.attendanceType[key],
value:key
}
this.attendanceType.push(obj)
}
// 类型
let typearr = []
for(let key in this.dict.type){
let obj = {
label:this.dict.type[key],
value:Number(key)
}
typearr.push(obj)
}
typearr.forEach((item,index) => {
let res = this.paibanType.filter(item1 => item1.label.indexOf(item.label) != -1)
if(res.length>0){
res[0].value = typearr[index].value
}
})
},
// ---- 班次选择 ------- // ---- 班次选择 -------
// 当前班次选择 // 当前班次选择
saveRowBanci(val){ saveRowBanci(val){
this.groupFixedworkEntity[this.currentWorkName+'ClassId'] = val.id//存储班次id this.groupFixedworkEntity[this.currentWorkName+'ClassId'] = val.id//存储班次id
this.groupFixedworkEntity[this.currentWorkName+'ClassName'] = val.className//存储班次名称 this.groupFixedworkEntity[this.currentWorkName+'ClassName'] = val.className//存储班次名称
this.groupFixedworkEntity[this.currentWorkName+'ClassTime'] = val
// this.groupFixedworkEntity[this.currentWorkName+'ClassTime'] = val
this.$set(
this.groupFixedworkEntity,
this.currentWorkName+'ClassTime',
val
)
console.log(this.groupFixedworkEntity[this.currentWorkName+'ClassTime'],'当前更改')
this.cancelBanci() this.cancelBanci()
}, },
// 固定班制 ---- 触发班次选择 // 固定班制 ---- 触发班次选择
changeBanci(row){ changeBanci(row){
this.currentWorkName = row this.currentWorkName = row
this.currentselectBanciRow = this.groupFixedworkEntity[this.currentWorkName+'ClassTime'] this.currentselectBanciRow = JSON.parse(JSON.stringify(this.groupFixedworkEntity[this.currentWorkName+'ClassTime']))
this.isshowBanci = true this.isshowBanci = true
}, },
// 置空 // 置空
...@@ -380,10 +528,40 @@ ...@@ -380,10 +528,40 @@
// ----- 特殊日期选择 ---- // ----- 特殊日期选择 ----
// 删除必须
deleteSpecal(index){
this.attendanceGroupFixedworkSpecialList.splice(index,1)
},
// 新增必须打卡 --- 触发班次 // 新增必须打卡 --- 触发班次
setMustTimes(from,item,index){ setMustTimes(from,item,index){
this.currentParams = JSON.parse(JSON.stringify(item)) if(this.attendanceGroupFixedworkSpecialList.length){
}else{
if(from == 'must'){
this.attendanceGroupFixedworkSpecialList.splice(0,0,{
must:1,//必需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
})
}else{
this.attendanceGroupFixedworkSpecialList.splice(1,0,{
must:0,//无需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
})
}
}
this.currentParams = this.attendanceGroupFixedworkSpecialList[index]
if(from == 'must'){ if(from == 'must'){
this.mustDaka = true this.mustDaka = true
this.currentselectBanciRow = this.currentParams.classArr this.currentselectBanciRow = this.currentParams.classArr
...@@ -406,12 +584,11 @@ ...@@ -406,12 +584,11 @@
this.$message.error('请选择班次') this.$message.error('请选择班次')
return return
} }
if(this.attendanceGroupFixedworkSpecialList[1].specialTime === this.currentParams.specialTime){
this.$message.error('该日期已设置为无需打卡日,请重新选择')
return
}
if(this.attendanceGroupFixedworkSpecialList[1]){ if(this.attendanceGroupFixedworkSpecialList[1]){
if(this.attendanceGroupFixedworkSpecialList[1].specialTime === this.currentParams.specialTime){
this.$message.error('该日期已设置为无需打卡日,请重新选择')
return
}
let timeStart = Date.parse(this.attendanceGroupFixedworkSpecialList[1].specialStartTime)//无需开始时间戳 let timeStart = Date.parse(this.attendanceGroupFixedworkSpecialList[1].specialStartTime)//无需开始时间戳
let timeEnd = Date.parse(this.attendanceGroupFixedworkSpecialList[1].specialEndTime)//无需结束时间戳 let timeEnd = Date.parse(this.attendanceGroupFixedworkSpecialList[1].specialEndTime)//无需结束时间戳
let mustTime = Date.parse(this.currentParams.specialTime)//必须时间戳 let mustTime = Date.parse(this.currentParams.specialTime)//必须时间戳
...@@ -433,7 +610,6 @@ ...@@ -433,7 +610,6 @@
this.noneedDaka = false this.noneedDaka = false
this.currentselectBanciRow = null this.currentselectBanciRow = null
}, },
// 无需时间段 // 无需时间段
changeneedRange(){ changeneedRange(){
if(this.noneedRange){ if(this.noneedRange){
...@@ -454,13 +630,13 @@ ...@@ -454,13 +630,13 @@
this.$message.error('请选择时间段') this.$message.error('请选择时间段')
return return
} }
if(this.attendanceGroupFixedworkSpecialList[0].specialTime === this.currentParams.specialTime &&
this.attendanceGroupFixedworkSpecialList[0].specialTime != ''){
this.$message.error('该日期已设置为必须打卡日,请重新选择')
return
}
if(this.attendanceGroupFixedworkSpecialList[0]){ if(this.attendanceGroupFixedworkSpecialList[0]){
if(this.attendanceGroupFixedworkSpecialList[0].specialTime === this.currentParams.specialTime &&
this.attendanceGroupFixedworkSpecialList[0].specialTime != ''){
this.$message.error('该日期已设置为必须打卡日,请重新选择')
return
}
let timeStart = Date.parse(this.currentParams.specialStartTime)//无需开始时间戳 let timeStart = Date.parse(this.currentParams.specialStartTime)//无需开始时间戳
let timeEnd = Date.parse(this.currentParams.specialEndTime)//无需结束时间戳 let timeEnd = Date.parse(this.currentParams.specialEndTime)//无需结束时间戳
let mustTime = Date.parse(this.attendanceGroupFixedworkSpecialList[0].specialTime)//必须时间戳 let mustTime = Date.parse(this.attendanceGroupFixedworkSpecialList[0].specialTime)//必须时间戳
...@@ -570,45 +746,25 @@ ...@@ -570,45 +746,25 @@
// ---- end ------- // ---- end -------
// 考勤方式发生改变 -置空其他类别选项 // 考勤方式发生改变 -置空其他类别选项
changeRadio(val){ changeRadio(){
// 固定班次 // 自由工时置空
if(val == 1){ for(let key in this.attendanceGroupFreeworkEntity){
// 自由工时置空 this.attendanceGroupFreeworkEntity[key] = 0
for(let key in this.attendanceGroupFreeworkEntity){ }
this.attendanceGroupFreeworkEntity[key] = 0 this.attendanceGroupFreeworkEntity.workTime = ''
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList = []
}
this.attendanceGroupFreeworkEntity['workTime'] = ''
this.attendanceGroupFreeworkEntity['attendanceGroupFreeworkSpecialList'] = []
}else if(val == 2){
// 自由工时置空
for(let key in this.attendanceGroupFreeworkEntity){
this.attendanceGroupFreeworkEntity[key] = 0
}
this.attendanceGroupFreeworkEntity['workTime'] = ''
this.attendanceGroupFreeworkEntity['attendanceGroupFreeworkSpecialList'] = []
// 固定班制置空
for(let key in this.groupFixedworkEntity){
this.groupFixedworkEntity[key] = ''
}
this.groupFixedworkEntity['monday'] = 0
this.groupFixedworkEntity['tuesday'] = 0
this.groupFixedworkEntity['wednesday'] = 0
this.groupFixedworkEntity['thursday'] = 0
this.groupFixedworkEntity['friday'] = 0
this.groupFixedworkEntity['saturday'] = 0
this.groupFixedworkEntity['sunday'] = 0
this.groupFixedworkEntity['mondayClassTime'] = []
this.groupFixedworkEntity['tuesdayClassTime'] = []
this.groupFixedworkEntity['wednesdayClassTime'] = []
this.groupFixedworkEntity['thursdayClassTime'] = []
this.groupFixedworkEntity['fridayClassTime'] = []
this.groupFixedworkEntity['saturdayClassTime'] = []
this.groupFixedworkEntity['sundayClassTime'] = []
// 固定班制置空
for(let key in this.groupFixedworkEntity){
this.groupFixedworkEntity[key] = ''
}
for(let item of this.typeList){
this.groupFixedworkEntity[item.value] = 0
this.groupFixedworkEntity[item.value+'ClassTime'] = []
this.groupFixedworkEntity[item.value+'ClassName'] = ''
this.groupFixedworkEntity[item.value+'ClassId'] = ''
} }
this.attendanceGroupFixedworkSpecialList = []
}, },
// 触发对应流程设置 // 触发对应流程设置
drawershow(from){ drawershow(from){
...@@ -644,21 +800,19 @@ ...@@ -644,21 +800,19 @@
// 全部置空 // 全部置空
allReset(){ allReset(){
// 置空无关项 // 置空无关项
this.changeRadio('1') this.changeRadio()
this.changeRadio('2')
this.changeRadio('3')
// 先大概处理 // 先大概处理
for(let key in this.setParams){ for(let key in this.setParams){
this.setParams[key] = '' this.setParams[key] = ''
} }
this.setParams.attendanceGroupStaffList = [] this.setParams.attendanceGroupStaffList = []
this.attendArr = [] this.attendArr = []
this.attendArrId = [] this.attendArrId = []
this.allSelectId = [] this.allSelectId = []
this.allSelect = [] this.allSelect = []
this.currentSelect = [] this.currentSelect = []
this.cancelBanci()
}, },
// 提交保存 // 提交保存
...@@ -677,7 +831,7 @@ ...@@ -677,7 +831,7 @@
this.$message.error('请设置参与考勤人员') this.$message.error('请设置参与考勤人员')
return return
} }
if(this.setParams.groupResponsibleEntity.responsibleId == ''){ if(this.groupResponsibleEntity.responsibleId == ''){
this.$message.error('请设置考勤负责人') this.$message.error('请设置考勤负责人')
return return
} }
...@@ -693,43 +847,25 @@ ...@@ -693,43 +847,25 @@
// -----end --- // -----end ---
// ---- 根据类型判断 --- // ---- 根据类型判断 ---
// 固定班制
// 固定班制校验
if(this.setParams.type == 1){ if(this.setParams.type == 1){
if(this.groupFixedworkEntity.monday && !this.groupFixedworkEntity.mondayClassId){ for(let item of this.typeList){
this.$message.error('周一考勤班次未设置') if(this.groupFixedworkEntity[item.value] && !this.groupFixedworkEntity[item.value+'ClassId']){
return false this.$message.error(`${item.name} 考勤班次未设置`)
} return false
if(this.groupFixedworkEntity.tuesday && !this.groupFixedworkEntity.tuesdayClassId){ }
this.$message.error('周二考勤班次未设置')
return false
}
if(this.groupFixedworkEntity.wednesday && !this.groupFixedworkEntity.wednesdayClassId){
this.$message.error('周三考勤班次未设置')
return false
}
if(this.groupFixedworkEntity.thursday && !this.groupFixedworkEntity.thursdayClassId){
this.$message.error('周四考勤班次未设置')
return false
}
if(this.groupFixedworkEntity.friday && !this.groupFixedworkEntity.fridayClassId){
this.$message.error('周五考勤班次未设置')
return false
}
if(this.groupFixedworkEntity.saturday && !this.groupFixedworkEntity.saturdayClassId){
this.$message.error('周六考勤班次未设置')
return false
}
if(this.groupFixedworkEntity.sunday && !this.groupFixedworkEntity.sundayClassId){
this.$message.error('周日考勤班次未设置')
return false
} }
} }
// 自由工时校验
if(this.setParams.type == 3){ if(this.setParams.type == 3){
if(this.attendanceGroupFreeworkEntity.workTime = '' ){ if(this.attendanceGroupFreeworkEntity.workTime == '' ){
this.$message.error('请设置工作时长') this.$message.error('请设置工作时长')
return false return false
} }
} }
// ---- end ----
// ---- 处理数据 ---- // ---- 处理数据 ----
if(this.attendArr.length > 0){ if(this.attendArr.length > 0){
this.setParams.attendanceGroupStaffList = this.attendArr.map(item => { this.setParams.attendanceGroupStaffList = this.attendArr.map(item => {
...@@ -739,76 +875,42 @@ ...@@ -739,76 +875,42 @@
} }
}) })
} }
if(this.setParams.groupResponsibleEntity.responsibleId){ if(this.groupResponsibleEntity.responsibleId){
// 给负责人进行赋值 // 给负责人进行赋值
this.setParams.groupResponsibleEntity.responsibleName = this.responsiableList[this.setParams.groupResponsibleEntity.responsibleId] this.groupResponsibleEntity.responsibleName = this.responsiableList[this.groupResponsibleEntity.responsibleId]
} }
// 删操作值
// delete this.groupFixedworkEntity.mondayClassTime
// delete this.groupFixedworkEntity.tuesdayClassName
// delete this.groupFixedworkEntity.wednesdayClassTime
// delete this.groupFixedworkEntity.thursdayClassTime
// delete this.groupFixedworkEntity.fridayClassTime
// delete this.groupFixedworkEntity.saturdayClassTime
// delete this.groupFixedworkEntity.sundayClassTime
// delete this.attendanceGroupFixedworkSpecialList[0]['classArr']
// delete this.attendanceGroupFixedworkSpecialList[1]['classArr']
// 固定工时 // 固定工时
if(this.setParams.type == 1){ if(this.setParams.type == 1){
this.groupFixedworkEntity.attendanceGroupFixedworkSpecialList = this.attendanceGroupFixedworkSpecialList if(this.attendanceGroupFixedworkSpecialList&&this.attendanceGroupFixedworkSpecialList.length>0){
this.groupFixedworkEntity.attendanceGroupFixedworkSpecialList =
this.attendanceGroupFixedworkSpecialList//特殊日期设置
}
this.setParams.groupFixedworkEntity = this.groupFixedworkEntity this.setParams.groupFixedworkEntity = this.groupFixedworkEntity
if(this.setParams.hasOwnProperty('attendanceGroupFreeworkEntity')){
delete this.setParams.attendanceGroupFreeworkEntity
}
} }
// 自由工时 // 自由工时
if(this.setParams.type == 3){ if(this.setParams.type == 3){
if(this.attendanceGroupFixedworkSpecialList && this.attendanceGroupFixedworkSpecialList.length>0){
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList =
this.attendanceGroupFixedworkSpecialList//特殊日期
}
this.setParams.attendanceGroupFreeworkEntity = this.attendanceGroupFreeworkEntity
this.attendanceGroupFreeworkEntity.attendanceGroupFixedworkSpecialList = this.attendanceGroupFixedworkSpecialList if(this.setParams.hasOwnProperty('groupFixedworkEntity')){
this.setParams.attendanceGroupFreeworkEntity = this.attendanceGroupFreeworkEntity delete this.setParams.groupFixedworkEntity
}
} }
// 考勤负责人
this.setParams.groupResponsibleEntity = this.groupResponsibleEntity
// ----- end ----
this.$post('/attendance/group/save',this.setParams).then(res => { this.$post(this.urls.saveUrl || this.pageInfo.saveUrl,this.setParams).then(res => {
if(res.code === 1){
this.$router.back()
}
})
},
// 参数和公共字典
getdata(){
this.$post('/attendance/group/add').then(res => {
if(res.code == 1){ if(res.code == 1){
// 打卡类型 this.afterSubmit()
this.attendanceType = []
let data = res.data.dict//字典函数
this.classArr = data.classId
this.responsiableList = data.workMan
this.areaData = data.deptId
for(let key in data.attendanceType){
let obj = {
label:data.attendanceType[key],
value:key
}
this.attendanceType.push(obj)
}
// 类型
let type = []
for(let key in data.type){
let obj = {
label:data.type[key],
value:key
}
type.push(obj)
}
type.forEach((item,index) => {
let res = this.paibanType.filter(item1 => item1.label.indexOf(item.label) != -1)
if(res.length>0){
res[0].value = type[index].value
}
})
} }
}) })
}, },
...@@ -821,7 +923,7 @@ ...@@ -821,7 +923,7 @@
}, },
data() { data() {
return { return {
open:false,
activeName:'/attendance/group/view', activeName:'/attendance/group/view',
thirdList:[ thirdList:[
{ {
...@@ -832,20 +934,50 @@ ...@@ -832,20 +934,50 @@
paibanType:[ paibanType:[
{ {
label:'固定班制(固定时间上下班)', label:'固定班制(固定时间上下班)',
value:'1', value:1,
des:'考勤组中所有人按照相同的时间打卡,适用于办公室坐班,例如朝九晚五' des:'考勤组中所有人按照相同的时间打卡,适用于办公室坐班,例如朝九晚五'
}, },
{ {
label:'排班制(按排班上下班)', label:'排班制(按排班上下班)',
value:'2', value:2,
des:'自定义设置每人的班次,适用于工厂、门店等,例如三班倒' des:'自定义设置每人的班次,适用于工厂、门店等,例如三班倒'
}, },
{ {
label:'自由工时(不固定时间上下班)', label:'自由工时(不固定时间上下班)',
value:'3', value:3,
des:'上下班时间不固定,可随时打卡,适用于销售以及装修、家政等计时工' des:'上下班时间不固定,可随时打卡,适用于销售以及装修、家政等计时工'
} }
], ],
typeList:[
{
name:'周一',
value:'monday'
},
{
name:'周二',
value:'tuesday'
},
{
name:'周三',
value:'wednesday'
},
{
name:'周四',
value:'thursday'
},
{
name:'周五',
value:'friday'
},
{
name:'周六',
value:'saturday'
},
{
name:'周日',
value:'sunday'
}
],
classArr:[],//公共字典 - 班次选择 classArr:[],//公共字典 - 班次选择
attendanceType:[],//打卡类型 - 公共字典 attendanceType:[],//打卡类型 - 公共字典
areaData:[],//部门信息 - 公共字典 areaData:[],//部门信息 - 公共字典
...@@ -877,16 +1009,15 @@ ...@@ -877,16 +1009,15 @@
setParams:{ setParams:{
groupName:'',//考勤名称 groupName:'',//考勤名称
// 负责人信息
groupResponsibleEntity:{
responsibleId:'',//考勤负责人
responsibleName:''//考勤负责人姓名
},
attendanceGroupStaffList:[],//参与考勤人员 attendanceGroupStaffList:[],//参与考勤人员
type:'',//考勤方式 type:'',//考勤方式
attendanceType:'',//打卡类型 attendanceType:'',//打卡类型
}, },
// 考勤赋值
groupResponsibleEntity:{
responsibleId:'',//考勤负责人
responsibleName:''//考勤负责人姓名
},
type:[], type:[],
currentselectBanciRow:'',//当前班次 currentselectBanciRow:'',//当前班次
...@@ -904,9 +1035,8 @@ ...@@ -904,9 +1035,8 @@
friday:0, friday:0,
saturday:0, saturday:0,
sunday:0, sunday:0,
holidays:0,
workTime:'', workTime:'',
attendanceGroupFreeworkSpecialList:[] // attendanceGroupFreeworkSpecialList:[]
}, },
//固定班制 //固定班制
groupFixedworkEntity:{ groupFixedworkEntity:{
...@@ -944,32 +1074,13 @@ ...@@ -944,32 +1074,13 @@
sundayClassId:'', sundayClassId:'',
sundayClassName:'', sundayClassName:'',
sundayClassTime:[],//便于选择-传参删除 sundayClassTime:[],//便于选择-传参删除
attendanceGroupFixedworkSpecialList:[], holidays:"",
holidays:"" // attendanceGroupFixedworkSpecialList:[],
}, },
holidays:0,// 假期排休 法定节假日自动排休(0.否,1.是) holidays:0,// 假期排休 法定节假日自动排休(0.否,1.是)
// 公共 - 特殊日期设置 // 公共 - 特殊日期设置
attendanceGroupFixedworkSpecialList:[ attendanceGroupFixedworkSpecialList:[],
{
must:1,//必需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
},
{
must:0,//无需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
}
],
} }
} }
} }
......
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" notDel :config="tableConfig"></LayoutTable> <LayoutTable :data="tableData" notDel :config="tableConfig" v-if="isshow"></LayoutTable>
<drawer-show ref="drawerform" @ok="getData" /> <group-template ref="groupTemplate" @ok="okFn" />
</div> </div>
</template> </template>
<script> <script>
/** 表单弹出框模式需引入 */ /** 表单弹出框模式需引入 */
import drawerShow from "./drawershow"; import groupTemplate from "./groupTemplate";
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
name: "AttendanceGroupList", name: "AttendanceGroupList",
components: { components: {
drawerShow groupTemplate
}, },
mixins: [table], mixins: [table],
created() { created() {
}, },
...@@ -37,29 +37,37 @@ ...@@ -37,29 +37,37 @@
}, },
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
// this.$refs.drawerform.add(row); this.isshow = false
this.$router.push( this.$refs.groupTemplate.add(row);
{ // this.$router.push(
path:'/attendance/group/view' // {
} // path:'/attendance/group/view'
) // }
// )
}, },
/** 重写编辑方法 */ /** 重写编辑方法 */
toEdit(row) { toEdit(row) {
this.$router.push( this.isshow = false
{ this.$refs.groupTemplate.edit(row);
path:'/attendance/group/view' // this.$router.push(
} // {
) // path:'/attendance/group/view'
// }
// )
}, },
/** 重写查看方法 */ /** 重写查看方法 */
toView(row) { toView(row) {
this.$refs.drawerform.view(row); this.isshow = false
this.$refs.groupTemplate.view(row);
}, },
okFn(val){
this.getData()
this.isshow = val
}
}, },
data() { data() {
return { return {
isshow:true,
/** 子表列元素 */ /** 子表列元素 */
columnSet:[ columnSet:[
{prop:"groupId",label:"考勤组",width:100}, {prop:"groupId",label:"考勤组",width:100},
...@@ -83,13 +91,13 @@ ...@@ -83,13 +91,13 @@
{type: "selection", width: 60}, {type: "selection", width: 60},
{type: "index",label: "序号",width: 50}, {type: "index",label: "序号",width: 50},
{label: "考勤组名称", prop: "groupName"}, {label: "考勤组名称", prop: "groupName",width:200},
{label: "人数", prop: "personNum",formatter: this.formatterGroupPerson}, {label: "人数", prop: "personNum",width: 80},
{label: "负责人", prop: "personNum"},//未 {label: "负责人", prop: "responsibleName",width: 80},//未
{label: "类型", prop: "type",formatter: this.formatterattendType}, {label: "类型", prop: "type",formatter: this.formatterattendType,width: 100},
// {label: "创建用户", prop: "createUserId", formatter: this.formatter}, // {label: "创建用户", prop: "createUserId", formatter: this.formatter},
...@@ -97,7 +105,7 @@ ...@@ -97,7 +105,7 @@
// {label: "考勤方式", prop: "attendanceType"}, // {label: "考勤方式", prop: "attendanceType"},
{label: "考勤时间", prop: "attendanceType"},//未 {label: "考勤时间", prop: "attendanceTime",formatter:this.formatterBanci},//未
// {label: "考勤组人员信息", // {label: "考勤组人员信息",
// width: 120, // width: 120,
......
...@@ -63,28 +63,28 @@ ...@@ -63,28 +63,28 @@
fuzzy: true fuzzy: true
}, },
{ {
name: "leaveType", name: "deptId",
type: "select", type: "select",
label: "全部部门", label: "全部部门",
fuzzy: true fuzzy: false
}, },
{ {
name: "leaveType", name: "leaveType",
type: "select", type: "select",
label: "请假类型", label: "请假类型",
fuzzy: true fuzzy: false
}, },
{ {
name: "startTime", name: "startTime",
type: "date", type: "date",
label: "开始时间", label: "开始时间",
fuzzy: true fuzzy: false
}, },
{ {
name: "endTime", name: "endTime",
type: "date", type: "date",
label: "结束时间", label: "结束时间",
fuzzy: true fuzzy: false
}, },
], ],
columns: [ columns: [
......
...@@ -163,6 +163,9 @@ ...@@ -163,6 +163,9 @@
data() { data() {
return { return {
upload: { upload: {
headers:{
Authorization:window.sessionStorage.getItem('token') || ''
},
// 是否显示弹出层(员工关怀信息导入) // 是否显示弹出层(员工关怀信息导入)
open: false, open: false,
// 弹出层标题(员工关怀信息导入) // 弹出层标题(员工关怀信息导入)
...@@ -172,7 +175,7 @@ ...@@ -172,7 +175,7 @@
// 是否更新已经存在的数据 // 是否更新已经存在的数据
updateSupport: 0, updateSupport: 0,
// 上传的地址 // 上传的地址
url: "/attendance/record/hik/importData", url: process.env.VUE_APP_API_BASE_URL +"/attendance/attendance/record/hik/importData",
}, },
config: { config: {
isshowTabPane:true, isshowTabPane:true,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
size="50%"> size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<Field label="部门名称" prop="deptName" v-model="form.deptName" type="textarea" placeholder="请输入部门名称"/> <Field label="部门名称" prop="deptName" v-model="form.deptName" type="textarea" placeholder="请输入部门名称" :maxLength="15"/>
<Field label="上级部门" prop="parentId" v-model="form.parentId" type="select" :enumData="dict.deptName" placeholder="请选择上级部门"/> <Field label="上级部门" prop="parentId" v-model="form.parentId" type="select" :enumData="dict.deptName" placeholder="请选择上级部门"/>
<Field label="负责人" prop="workId" v-model="form.workId" type="select" :enumData="dict.workName" placeholder="请选择员工"/> <Field label="负责人" prop="workId" v-model="form.workId" type="select" :enumData="dict.workName" placeholder="请选择员工"/>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
rules: { rules: {
deptName: [ deptName: [
{required: true,message: "请输入部门名称", trigger: "blur" }, {required: true,message: "请输入部门名称", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",}, {max: 15,message: "最多只能录入15个字符",trigger: "blur",},
], ],
parentId: [ parentId: [
{required: true,message: "请输入部门", trigger: "change" }, {required: true,message: "请输入部门", trigger: "change" },
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
}, },
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
this.form.parentId = this.form.parentId.toString()
this.open = true; this.open = true;
}, },
......
...@@ -53,8 +53,6 @@ ...@@ -53,8 +53,6 @@
expand: false, expand: false,
columns: [ columns: [
{type: "selection", width: 60}, {type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
// {label: "祖级列表", prop: "ancestors"},
{label: "部门名称", prop: "deptName"}, {label: "部门名称", prop: "deptName"},
{label: "成员数量", prop: "personNum"}, {label: "成员数量", prop: "personNum"},
{label: "负责人", prop: "workName"}, {label: "负责人", prop: "workName"},
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
</el-scrollbar> </el-scrollbar>
</el-col> </el-col>
<el-col :span="18" :xs="12" class="mytree"> <el-col :span="18" :xs="12" class="mytree">
<LayoutTable :data="tableData" :config="tableConfig" notSearch> <LayoutTable :data="tableData" :config="tableConfig" notSearch notAdd>
<el-button type="success" size="mini" slot="table-head-left2">
新增员工</el-button>
<el-button type="primary" @click="doExport" :disabled="isExport" <el-button type="primary" @click="doExport" :disabled="isExport"
size="mini" slot="table-head-left2">导出</el-button> size="mini" slot="table-head-left2">导出</el-button>
</LayoutTable> </LayoutTable>
...@@ -125,6 +127,7 @@ ...@@ -125,6 +127,7 @@
data() { data() {
return { return {
config: { config: {
search: [ search: [
// { // {
// name: "groupName", // name: "groupName",
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
@node-click="handleNodeClick" @node-click="handleNodeClick"
> >
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</el-col> </el-col>
<el-col :span="18" :xs="12"> <el-col :span="18" :xs="12">
......
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