Commit 255d6fce authored by dll's avatar dll

完成考勤组功能

parent e6aa3b6b
#开发环境
NODE_ENV = "development"
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.98:11039
VUE_APP_API_BASE_URL = http://192.168.0.116:17500
\ No newline at end of file
......@@ -19,8 +19,8 @@ export default {
}
},
beforeDestroy() {
this.source.cancel('自动取消ajax操作');
clearTimeout(this.loadingTimer);
this.source.cancel('自动取消ajax操作')
clearTimeout(this.loadingTimer)
},
methods: {
test() {
......@@ -58,7 +58,6 @@ export default {
this.tableData = this.beforeRender(
Object.assign({}, this.tableData, data)
)
console.log(this.tableData,'fffff')
this.afterRender(this.tableData);
})
.catch(error => {
......@@ -339,6 +338,22 @@ export default {
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) {
this.selection = val.map(i => i.id);
......
......@@ -31,10 +31,10 @@ export default {
<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;margin-left:20px">
({data.children.length})
({data.children?data.children.length:0})
</span>
</span>
);
)
},
async loadNode(node, resolve) {
......
......@@ -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;
// 测试用
//http://192.168.0.98:11039/
//http://192.168.0.98:11039
// 温
// http://192.168.0.116/17500
// 代
// http://192.168.0.108/17500
const hostname = '192.168.0.116'
const port = '17500'
// const hostname = '192.168.0.98'
// const port = '11039'
// 动态修改请求地址
if (config.url.startsWith('/')) {
// 字符串以 / 开头
......
......@@ -4,12 +4,13 @@
<el-form-item :label="label" :prop="prop" class='my-form-field'>
<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 :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" @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" 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 :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"'>
......@@ -133,6 +134,10 @@ export default {
inputClass: {
type: String,
default: '',
},
maxLength:{
type:Number,
default:256,
}
},
methods: {
......
......@@ -230,6 +230,7 @@ export default {
//初始化查询表单
let newFormData = {};
// this.form = this.encode(data, this.form);
console.log(this.search,'ddd')
this.search.forEach((item) => {
//复选框
if (item.type === "checkbox") {
......@@ -255,6 +256,7 @@ export default {
});
this.form = Object.assign({}, this.form, newFormData);
this.form = Object.assign({}, this.form, data);
console.log(this.form,'dddddd')
},
cleanForm() {
this.clean();
......@@ -274,11 +276,19 @@ export default {
},
onSubmit() {
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({
path: path,
query: Object.assign({}, query, data),
});
query: {
...query,
...data
},
})
},
// 解析url字符串,去除query字段
encode(data, formTemp) {
......@@ -325,18 +335,17 @@ export default {
val.length > 0
) {
//支持模糊查询,收尾增加百分号
val = val.trim();
val = val.trim()
if(val.charAt(0)!='%'){
val = "%" + val
}
if(val.charAt(val.length-1)!='%'){
val =val + "%";
}
}
});
})
newData[item] = this.decodeVal(val);
});
})
return newData;
},
decodeVal(val) {
......
<template>
<div class="mt20" v-if="isshow">
<div class="mt20">
<el-table :data="classArr" border highlight-current-row ref="table"
@row-click="(row, column, event) => $rowClick(row,column, event, 'table')"
>
......@@ -31,23 +31,6 @@ export 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(){
......@@ -55,6 +38,13 @@ export default {
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:{
saveRowBanci(){
this.$emit('saveRowBanci',this.selected)
......
......@@ -8,102 +8,21 @@
<td class="t2">班次时间段</td>
<td class="t1">操作</td>
</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">
<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 class="t1">周一</td>
<td class="t1">{{item.name}}</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>
<span>{{setParams[item.value+'ClassId']?setParams[item.value+'ClassName']:'未设置'}}</span>
<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>
<el-tag v-for="(item,index) in setParams[item.value+'ClassTime'].attendanceClassDetailList" :key="index"
class="ml10">
{{item.goWorkDate}}~{{item.offWorkDate}}</el-tag>
<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>
<el-button type="text" @click="changebanci(item.value)">更改班次</el-button>
</td>
</tr>
</table>
......@@ -119,7 +38,45 @@ export default {
},
data(){
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(){
......@@ -132,51 +89,30 @@ export default {
},
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
for(let item of this.typeList){
let key = item.value
this.setParams[key] = 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
for(let item of this.typeList){
let key = item.value
this.setParams[key] = false
this.setParams[key+'ClassTime'] = []
this.setParams[key+'ClassName'] = ''
this.setParams[key+'ClassId'] = ''
}
}
},
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
for(let item of this.typeList){
let key = item.value
if(!this.setParams[key]){
this.setParams[key+'ClassTime'] = []
this.setParams[key+'ClassName'] = ''
this.setParams[key+'ClassId'] = ''
this.selectAll = false
return
}
}
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>
<div class="page">
<LayoutTable :data="tableData" notDel :config="tableConfig"></LayoutTable>
<drawer-show ref="drawerform" @ok="getData" />
<LayoutTable :data="tableData" notDel :config="tableConfig" v-if="isshow"></LayoutTable>
<group-template ref="groupTemplate" @ok="okFn" />
</div>
</template>
<script>
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import groupTemplate from "./groupTemplate";
import table from "@/assets/mixins/table";
export default {
name: "AttendanceGroupList",
components: {
drawerShow
},
groupTemplate
},
mixins: [table],
created() {
},
......@@ -37,29 +37,37 @@
},
/** 重写新增方法 */
toAdd(row) {
// this.$refs.drawerform.add(row);
this.$router.push(
{
path:'/attendance/group/view'
}
)
this.isshow = false
this.$refs.groupTemplate.add(row);
// this.$router.push(
// {
// path:'/attendance/group/view'
// }
// )
},
/** 重写编辑方法 */
toEdit(row) {
this.$router.push(
{
path:'/attendance/group/view'
}
)
this.isshow = false
this.$refs.groupTemplate.edit(row);
// this.$router.push(
// {
// path:'/attendance/group/view'
// }
// )
},
/** 重写查看方法 */
toView(row) {
this.$refs.drawerform.view(row);
this.isshow = false
this.$refs.groupTemplate.view(row);
},
okFn(val){
this.getData()
this.isshow = val
}
},
data() {
return {
isshow:true,
/** 子表列元素 */
columnSet:[
{prop:"groupId",label:"考勤组",width:100},
......@@ -83,13 +91,13 @@
{type: "selection", width: 60},
{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},
......@@ -97,7 +105,7 @@
// {label: "考勤方式", prop: "attendanceType"},
{label: "考勤时间", prop: "attendanceType"},//未
{label: "考勤时间", prop: "attendanceTime",formatter:this.formatterBanci},//未
// {label: "考勤组人员信息",
// width: 120,
......
......@@ -63,28 +63,28 @@
fuzzy: true
},
{
name: "leaveType",
name: "deptId",
type: "select",
label: "全部部门",
fuzzy: true
fuzzy: false
},
{
name: "leaveType",
type: "select",
label: "请假类型",
fuzzy: true
fuzzy: false
},
{
name: "startTime",
type: "date",
label: "开始时间",
fuzzy: true
fuzzy: false
},
{
name: "endTime",
type: "date",
label: "结束时间",
fuzzy: true
fuzzy: false
},
],
columns: [
......
......@@ -163,6 +163,9 @@
data() {
return {
upload: {
headers:{
Authorization:window.sessionStorage.getItem('token') || ''
},
// 是否显示弹出层(员工关怀信息导入)
open: false,
// 弹出层标题(员工关怀信息导入)
......@@ -172,7 +175,7 @@
// 是否更新已经存在的数据
updateSupport: 0,
// 上传的地址
url: "/attendance/record/hik/importData",
url: process.env.VUE_APP_API_BASE_URL +"/attendance/attendance/record/hik/importData",
},
config: {
isshowTabPane:true,
......
......@@ -7,7 +7,7 @@
size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<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="workId" v-model="form.workId" type="select" :enumData="dict.workName" placeholder="请选择员工"/>
......@@ -47,7 +47,7 @@
rules: {
deptName: [
{required: true,message: "请输入部门名称", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
{max: 15,message: "最多只能录入15个字符",trigger: "blur",},
],
parentId: [
{required: true,message: "请输入部门", trigger: "change" },
......@@ -89,6 +89,7 @@
},
/**获取数据后弹框 */
afterRender(data) {
this.form.parentId = this.form.parentId.toString()
this.open = true;
},
......
......@@ -53,8 +53,6 @@
expand: false,
columns: [
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
// {label: "祖级列表", prop: "ancestors"},
{label: "部门名称", prop: "deptName"},
{label: "成员数量", prop: "personNum"},
{label: "负责人", prop: "workName"},
......
......@@ -29,7 +29,9 @@
</el-scrollbar>
</el-col>
<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"
size="mini" slot="table-head-left2">导出</el-button>
</LayoutTable>
......@@ -125,6 +127,7 @@
data() {
return {
config: {
search: [
// {
// name: "groupName",
......
......@@ -36,6 +36,7 @@
@node-click="handleNodeClick"
>
</el-tree>
</el-scrollbar>
</el-col>
<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