Commit 51f6da09 authored by dll's avatar dll

完成职位管理 打卡记录

parent 3006d946
......@@ -38,7 +38,7 @@ instance.interceptors.request.use(config => {
// 代
// http://192.168.0.108/17500
const hostname = '192.168.0.108'
const hostname = '192.168.0.116'
const port = '17500'
// const hostname = '192.168.0.108'
......
......@@ -81,13 +81,13 @@
fuzzy: false
},
{
name: "deptId",
name: "groupId",
type: "select",
label: "全部考勤组",
fuzzy: false
},
{
name: "deptId",
name: "classId",
type: "select",
label: "全部班次",
fuzzy: false
......@@ -105,15 +105,15 @@
fuzzy: false
},
{
name:'startTime',
name:'attendanceDateStart',
type: "date",
label: "考勤开始时间",
label: "异常开始时间",
fuzzy: false
},
{
name:'endTime',
name:'attendanceDateEnd',
type: "date",
label: "考勤结束时间",
label: "异常结束时间",
fuzzy: false
},
{
......
......@@ -311,43 +311,43 @@
name: "staffName",
type: "text",
label: "员工姓名",
fuzzy: true
fuzzy: false
},
{
name: "phone",
type: "text",
label: "手机号",
fuzzy: true
fuzzy: false
},
{
name: "deptId",
type: "select",
label: "所属部门",
fuzzy: true
fuzzy: false
},
{
name: "groupId",
type: "select",
label: "所属考勤组",
fuzzy: true
fuzzy: false
},
{
name: "classId",
type: "select",
label: "班次",
fuzzy: true
fuzzy: false
},
{
name:'attendanceDateStart',
type: "date",
label: "考勤开始时间",
fuzzy: true
fuzzy: false
},
{
name:'attendanceDateEnd',
type: "date",
label: "考勤结束时间",
fuzzy: true
fuzzy: false
}
],
columns: [
......@@ -355,10 +355,10 @@
{type: "index",label: "序号",width: 50},
{label: "打卡日期", prop: "attendanceDate", formatter: this.formatterDate},
{label: "员工姓名", prop: "staffName"},
{label: "考勤组", prop: "attendanceGroupName"},
{label: "部门", prop: "deptName"},
{label: "职位", prop: "positionName"},
{label: "班次", prop: "shiftsName"},
{label: "考勤组", prop: "attendanceGroupName",formatter:this.formatters},
{label: "部门", prop: "deptName",formatter:this.formatters},
{label: "职位", prop: "positionName",formatter:this.formatters},
{label: "班次", prop: "shiftsName",formatter:this.formatters},
// {label: "考勤打卡记录详细信息",
// width: 120,
// prop: "subColumns",
......
......@@ -123,25 +123,25 @@
fuzzy: false
},
{
name: "deptId",
name: "groupId",
type: "select",
label: "全部考勤组",
fuzzy: false
},
{
name: "deptId",
name: "classId",
type: "select",
label: "全部班次",
fuzzy: false
},
{
name:'startTime',
name:'attendanceDateStart',
type: "date",
label: "考勤开始时间",
fuzzy: false
},
{
name:'endTime',
name:'attendanceDateEnd',
type: "date",
label: "考勤结束时间",
fuzzy: false
......
<template>
<div className="page">
<el-card style="height:80vh">
<el-card style="height:80vh;overflow:scroll-y">
<LayoutTable notPagination :data="tableData" ref="layoutTable" :config="tableConfig" notSearch></LayoutTable>
</el-card>
<drawer-show ref="drawerform" @ok="getData" />
......
<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="分组id" prop="groupId" v-model="form.groupId" placeholder="请输入分组id"/>
<Field label="分组名称" prop="groupName" v-model="form.groupName" placeholder="请输入分组名称"/>
<Field label="职位编码" prop="jobCode" v-model="form.jobCode" placeholder="请输入职位编码"/>
<Field label="职位名称" prop="jobName" v-model="form.jobName" 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:[
],
// 表单校验
rules: {
}
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="job/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改职位信息";
},
/** 新增 */
add(row) {
this.reset()
this.urls.currUrl = "job/add";
this.getData();
this.pageInfo.type="add"
this.title = "新增职位信息";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="job/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 = {
groupId : null,
groupName : "",
jobCode : "",
jobName : "",
remark : "",
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
......@@ -7,13 +7,13 @@
size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" style="padding:20px">
<el-row>
<Field v-if="title == '新增职位信息'" label="分组" prop="groupId" v-model="form.groupId"
<Field v-if="from == 'job'" label="分组" prop="groupId" v-model="form.groupId"
:enumData="dict.group" type="select" placeholder="请选择分组"/>
<Field label="分组名称" prop="groupName" v-model="form.groupName" placeholder="请输入分组名称" :maxLength="10" v-if="title == '新增分组信息'"/>
<Field label="分组名称" prop="groupName" v-model="form.groupName" placeholder="请输入分组名称" :maxLength="10" v-if="from == 'group'"/>
<Field label="职位编码" prop="jobCode" :maxLength="10" v-model="form.jobCode" placeholder="请输入职位编码" v-if="title == '新增职位信息'"/>
<Field label="职位名称" prop="jobName" :maxLength="10" v-model="form.jobName" placeholder="请输入职位名称" v-if="title == '新增职位信息'" />
<Field label="职位编码" prop="jobCode" :maxLength="10" v-model="form.jobCode" placeholder="请输入职位编码" v-if="from == 'job'"/>
<Field label="职位名称" prop="jobName" :maxLength="10" v-model="form.jobName" placeholder="请输入职位名称" v-if="from == 'job'" />
<Field label="类型" disabled prop="type" v-model="form.type" type="select" :enumData="dict.type" placeholder="请选择类型"/>
<Field label="备注" prop="remark" :maxLength="50" v-model="form.remark" type="textarea" placeholder="请输入备注"/>
......@@ -57,17 +57,19 @@
methods: {
/** 编辑 */
edit(row) {
edit(from,row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl ="job/edit";
this.getData();
this.pageInfo.type="edit"
this.title = "修改职位信息";
this.from = from
this.title = from === 'group'?"修改分组信息":'修改职位信息';
},
/** 新增 */
add(row) {
// console.log(row,'添加')
console.log(row,'添加')
this.from = row
this.title = row === 'group'?"新增分组信息":'新增职位信息';
this.reset()
......@@ -93,7 +95,7 @@
afterRender(data) {
// 固定新增类型
if(this.title === '新增分组信息'){
if(this.from == 'group'){
this.form.type = '1'
}else{
this.form.type = '2'
......
......@@ -19,7 +19,7 @@
<Field label="工号" :maxLength="15" prop="workNum" v-model="form.workNum" placeholder="请输入工号"/>
</el-row>
<form-buttons @submit='submitForm' noCancelBtn />
<form-buttons @submit='submitFormStaff' noCancelBtn />
</el-form>
</el-drawer>
<!-- 部门选择 -->
......@@ -67,6 +67,7 @@
<script>
import form from "@/assets/mixins/formdialog";
import f from '../codeGen/form';
export default {
name: "StaffDetail",
mixins: [form],
......@@ -121,11 +122,20 @@
icon: "icon",
},
ishowBumen:false,
deptnode:{}
deptnode:{},
jobid:''//当前职位
}
},
methods: {
submitFormStaff(){
this.$post('/staff/save',this.form).then(res => {
if(res.code == 1){
this.open = false
this.$emit('ok')
}
})
},
renderContent: function (h, { node, data, store }) {
return (
<span>
......@@ -163,6 +173,7 @@
this.reset()
this.urls.currUrl = "staff/add";
this.getData();
this.jobid = row
this.pageInfo.type="add"
this.title = "新增员工基本信息";
},
......@@ -181,6 +192,7 @@
},
/**获取数据后弹框 */
afterRender(data) {
this.form.positionId = this.jobid.toString()
this.open = true;
},
......
......@@ -7,11 +7,10 @@
<el-col :span="6" :xs="12" class="mytree">
<div class="title">
<el-button type="primary" size="mini" @click="saveFn('group')">新增分组</el-button>
<el-button type="success" size="mini" @click="saveFn('position')">新增职位</el-button>
<el-button type="success" size="mini" @click="saveFn('job')">新增职位</el-button>
</div>
<el-scrollbar style="height: 100%" class="mt20">
<!-- 区分分组和职位 -->
<!-- @node-click.self="handleNodeClick" -->
<el-tree
size="mini"
ref="siteTree"
......@@ -22,12 +21,11 @@
:props="{
children:'children'
}"
:load="loadNode"
highlight-current
default-expand-all
:expand-on-click-node="false"
:render-content="renderContent"
@node-click.self="handleNodeClick"
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node">
......@@ -56,29 +54,66 @@
</el-scrollbar>
</el-col>
<el-col :span="18" :xs="12" class="mytree">
<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>
<div class="mt20" style="font-size:14px" v-if="currentName">
{{currentName}} ({{this.staffList.length}})
</div>
<div class="mt10">
<el-button type="success" size="mini" @click="addStaff">
新增员工</el-button>
<el-button type="primary" @click="doExport" :disabled="isExport"
size="mini">导出数据</el-button>
<el-button type="danger" @click="allDelete" :disabled="isExport"
size="mini">批量删除</el-button>
</div>
<el-table :data="staffList" border class="mt20" @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="姓名" prop="name"></el-table-column>
<el-table-column label="部门" prop="deptName"></el-table-column>
<el-table-column label="员工类型" prop="staffType"
>
<template slot-scope="scope">
<el-tag size='mini' v-show="scope.row.staffType == 1">全职</el-tag>
<el-tag size='mini' v-show="scope.row.staffType == 2">兼职</el-tag>
<el-tag size='mini' v-show="scope.row.staffType == 3">实习</el-tag>
</template>
</el-table-column>
<el-table-column label="手机号" prop="phoneNumber"></el-table-column>
<el-table-column label="添加时间" prop="createTime"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="deleteStaff(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<drawer-show ref="drawerform" @ok="getData" />
<drawer-show ref="drawerform" @ok="getData"/>
<drawer-staff ref="drawerStaff" :bumentree="bumentree" @ok="refresh"></drawer-staff>
</div>
</template>
<script>
/** 表单弹出框模式需引入 */
import {handleTree} from "@/assets/utils/table";
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
import TabPane from "@/components/tabPane.vue"
import drawershowStaff from './drawershowStaff.vue'
import drawerStaff from './drawershowStaff.vue'
export default {
name: "JobList",
components: {
drawerShow,
TabPane
TabPane,
drawerStaff
},
mixins: [table],
created() {
......@@ -86,6 +121,9 @@
"page":1,
"size":-1
}
this.$post("/dept/treeselect", {}).then(({ data }) => {
this.bumentree = data.result
})
},
computed:{
thirdList(){
......@@ -97,32 +135,48 @@
}
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val;
},
getStaff(){
this.$post('/job/info?id='+this.currentId).then(res => {
if(res.code == 1){
this.staffList = res.data.staffEntities
}
})
},
addStaff(){
this.$refs.drawerStaff.add(this.currentId)
},
refresh(){
// 请求
// 员工、职位列表
if(this.currentId){
this.getStaff()
}
this.getData()
},
handleNodeClick(node){
console.log(node)
if(!node.groupId){
return
}
this.currentId = node.id
this.currentName = node.jobName
this.getStaff()
},
// 获取数据后
afterRender(){
console.log(this.tableData.data)
// 处理树结构
afterRender(data){
data.data = handleTree(data.data, "id", "groupId");
},
saveFn(from){
this.$refs.drawerform.add(from)
},
async loadNode(node, resolve) {
if (node.level === 0) {
return;
}
resolve(data.result);
},
doExport(){
this.isExport = true;
this.isExport = true;
let params = {}
for(let value of this.config.search){
if(this.query[value.name]){
params[value.name] = this.query[value.name]
}
}
if(this.selection.length>0){
params['idList'] = this.selection
if(this.multipleSelection.length>0){
params['idList'] = this.multipleSelection
}
this.$download("/job/exportExcel", {
...params
......@@ -162,7 +216,7 @@
this.toEdit(from,row)
},
// 删除
// 删除分组或者职位
deleteFn(row){
this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
confirmButtonText: '确定',
......@@ -180,62 +234,46 @@
}
})
})
},
// 删除员工
deleteStaff(row){
this.$confirm("此操作将永久删除该员工,是否继续",'提示',{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
this.$post('/staff/delete?id='+row.id).then(res => {
if(res.code == 1){
this.$message.success('删除成功')
this.getStaff()
}
})
})
},
// 批量删除员工
allDelete(){
if (!this.multipleSelection.length) {
return this.$message.warning('请选中一条记录');
}
let ids = this.multipleSelection.map(item => item.id).join(',')
this.$get('/staff/delete?',{id:ids}).then(res => {
if(res.code == 1){
this.$message.success('删除成功')
this.getStaff()
}
})
}
},
data() {
return {
config: {
search: [
// {
// name: "groupName",
// type: "text",
// label: "分组名称",
// fuzzy: true
// },
// {
// name: "jobCode",
// type: "text",
// label: "职位编码",
// fuzzy: true
// },
// {
// name: "jobName",
// type: "text",
// label: "职位名称",
// fuzzy: true
// },
],
columns: [
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
// {label: "分组名称", prop: "groupName"},
// {label: "职位编码", prop: "jobCode"},
// {label: "职位名称", prop: "jobName"},
{label: "姓名", prop: "staffName"},
{label: "部门", prop: "deptName"},
{label: "员工类型", prop: "staffType",formatter: this.formatterType},
{label: "手机号", prop: "phoneNumber"},
{label: "添加时间", prop: "createTime",formatter:this.formatterDateOnly},
{
label: "操作",
width: 240,
formatter: row => {
return (
<table-buttons noAdd noView noEdit row={row}
onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
)
}
}
],
},
isExport:false,
saveFrom:'',
addShow:false,
staffList:[]
staffList:[],
bumentree:[],
currentId:'',
currentName:'',
multipleSelection:[]
}
}
}
......
......@@ -67,7 +67,7 @@
<span class="freshTime" slot="table-head-left2">
<i class="el-icon-refresh"></i>
<span>上次同步时间:2023-04-09 09:00:00</span>
<span>上次同步时间:{{tableData.staff.refreshDate}}</span>
</span>
</LayoutTable>
</el-row>
......@@ -151,6 +151,7 @@
</template>
<script>
import {timestampToTime} from '@/assets/utils/dateFormat.js'
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
......@@ -250,6 +251,9 @@
submitFileForm() {
this.$refs.upload.submit();
},
afterRender(data){
this.tableData.staff.refreshDate = timestampToTime(this.tableData.staff.refreshDate)
}
},
data() {
return {
......
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