Commit 8c13af37 authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/master'

parents f69f194e 1075c055
#开发环境
NODE_ENV = "development"
VUE_APP_API_BASE_URL= http://112.19.80.237:11039
VUE_APP_API_ZWFW_URL= http://112.19.80.237:11031
# VUE_APP_API_BASE_URL= http://192.168.0.98:11039
\ No newline at end of file
# VUE_APP_API_BASE_URL= http://112.19.80.237:11039
VUE_APP_API_BASE_URL= http://192.168.0.98:11039
VUE_APP_API_ZWFW_URL= http://112.19.80.237:11031
\ No newline at end of file
// table-list 所需的一系列操作方法
/**
* formatter
*
......@@ -10,8 +9,8 @@
*/
const formatter = (tableData, column, val) => {
const key = column.property;
if(tableData.dict && tableData.dict[key]){
const dict = tableData.dict[key]
if (tableData.dict && tableData.dict[key]) {
const dict = tableData.dict[key];
return dict[val] || val;
}
return val;
......@@ -27,11 +26,11 @@ const formatter = (tableData, column, val) => {
const formatterAmount = (row, column) => {
const property = column.property;
const amount = row[property];
if(!amount){
return '0.00';
if (!amount) {
return "0.00";
}
if(amount == 0){
return '0.00';
if (amount == 0) {
return "0.00";
}
return amount;
};
......@@ -46,15 +45,19 @@ const formatterAmount = (row, column) => {
const formatterDate = (row, column) => {
const property = column.property;
const time = row[property];
if(!time) return '--';
let date = time.length<13?new Date(Number(time) * 1000) : new Date(Number(time));
let Y = date.getFullYear() + '-';
let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
let D = panLeft(date.getDate()) + ' ';
let h = panLeft(date.getHours()) + ':';
let m = panLeft(date.getMinutes()) + ':';
if (!time) return "--";
let date =
time.length < 13 ? new Date(Number(time) * 1000) : new Date(Number(time));
let Y = date.getFullYear() + "-";
let M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
let D = panLeft(date.getDate()) + " ";
let h = panLeft(date.getHours()) + ":";
let m = panLeft(date.getMinutes()) + ":";
let s = panLeft(date.getSeconds());
return Y+M+D+h+m+s;
return Y + M + D + h + m + s;
};
/**
......@@ -67,16 +70,19 @@ const formatterDate = (row, column) => {
const formatterDateOnly = (row, column) => {
const property = column.property;
const time = row[property];
if(!time) return '-';
if (!time) return "-";
let date = new Date(Number(time));
let Y = date.getFullYear() + '-';
let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
let D = panLeft(date.getDate()) + ' ';
return Y+M+D;
let Y = date.getFullYear() + "-";
let M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
let D = panLeft(date.getDate()) + " ";
return Y + M + D;
};
function panLeft(num){
return num < 10 ? '0'+num : num;
function panLeft(num) {
return num < 10 ? "0" + num : num;
}
/**
......@@ -90,18 +96,18 @@ function panLeft(num){
const find = (list, key, val) => {
let index = -1;
let data = null;
list.forEach((item, i)=>{
if(item[key] === val){
list.forEach((item, i) => {
if (item[key] === val) {
index = i;
data = JSON.parse(JSON.stringify(item));
return;
}
})
});
return {
index,
data,
}
}
};
};
/**
* 构造树型结构数据
......@@ -112,24 +118,34 @@ const find = (list, key, val) => {
* @param {*} rootId 根Id 默认 0
*/
function handleTree(data, id, parentId, children, rootId) {
id = id || 'id'
parentId = parentId || 'parentId'
children = children || 'children'
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
id = id || "id";
parentId = parentId || "parentId";
children = children || "children";
rootId =
rootId ||
Math.min.apply(
Math,
data.map((item) => {
return item[parentId];
})
) ||
null;
//对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
const cloneData = JSON.parse(JSON.stringify(data));
//循环所有项
const treeData = cloneData.filter(father => {
let branchArr = cloneData.filter(child => {
const treeData = cloneData.filter((father) => {
let branchArr = cloneData.filter((child) => {
//返回每一项的子级数组
return father[id] === child[parentId]
console.log(child[parentId]);
return father[id] === child[parentId];
});
branchArr.length > 0 ? father.children = branchArr : '';
branchArr.length > 0 ? (father.children = branchArr) : "";
//返回第一层
return father[parentId] === rootId;
});
return treeData != '' ? treeData : data;
};
console.log(treeData);
return treeData != "" ? treeData : data;
}
export {
formatter,
......@@ -137,5 +153,5 @@ export {
formatterDate,
formatterDateOnly,
find,
handleTree
handleTree,
};
<template>
<div class="page">
<div style="margin:10px 0">
<tab-pane :thirdList="thirdList" :activeName="activeName" @handleClick="handleClick"></tab-pane>
<div class="page">
<div style="margin:10px 0">
<tab-pane
:thirdList="thirdList"
:activeName="activeName"
@handleClick="handleClick"
></tab-pane>
</div>
<el-row :gutter="20">
<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('job')"
>新增职位</el-button
>
</div>
<el-row :gutter="20">
<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('job')">新增职位</el-button>
</div>
<el-scrollbar style="height: 100%" class="mt20">
<!-- 区分分组和职位 -->
<el-tree
<el-scrollbar style="height: 100%" class="mt20">
<!-- 区分分组和职位 -->
<el-tree
size="mini"
ref="siteTree"
:data="tableData.data"
id="el-tree"
node-key="id"
indent="4"
:props="{
children: 'children',
}"
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">
<span style="font-size:14px" v-if="!data.groupId">{{
data.groupName
}}</span>
<span style="font-size:14px" v-if="data.groupId">{{
data.jobName
}}</span>
<span style="margin-left:50px">
<el-button
type="text"
class="el-icon-edit-outline"
size="mini"
ref="siteTree"
:data="tableData.data"
id="el-tree"
node-key="id"
indent="4"
:props="{
children:'children'
}"
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">
<span style="font-size:14px" v-if="!data.groupId">{{ data.groupName }}</span>
<span style="font-size:14px" v-if="data.groupId">{{ data.jobName }}</span>
<span style="margin-left:50px">
<el-button
type="text"
class="el-icon-edit-outline"
size="mini"
@click.stop="editJob(data)"
></el-button>
<el-button
type="text"
class="el-icon-delete"
size="mini"
style="color:#F56C6C"
@click.stop="deleteFn(data)"
></el-button>
</span>
</span>
</template>
</el-tree>
</el-scrollbar>
</el-col>
<el-col :span="18" :xs="12" class="mytree">
<div class="mt20" style="font-size:14px" v-if="currentName">
{{currentName}} ({{this.staffList.length}})
</div>
@click.stop="editJob(data)"
></el-button>
<el-button
type="text"
class="el-icon-delete"
size="mini"
style="color:#F56C6C"
@click.stop="deleteFn(data)"
></el-button>
</span>
</span>
</template>
</el-tree>
</el-scrollbar>
</el-col>
<el-col :span="18" :xs="12" class="mytree">
<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>
<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-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-staff ref="drawerStaff" :bumentree="bumentree" @ok="refresh"></drawer-staff>
</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-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 drawerStaff from './drawershowStaff.vue'
import {timestampToTime} from '@/assets/utils/dateFormat.js'
export default {
name: "JobList",
components: {
drawerShow,
TabPane,
drawerStaff
},
mixins: [table],
created() {
this.query = {
"page":1,
"size":-1
}
this.$post("/dept/treeselect", {}).then(({ data }) => {
this.bumentree = data.result
})
},
computed:{
thirdList(){
if(!this.$store.state.CurrentThirdArr) return []
return this.$store.state.CurrentThirdArr
},
activeName(){
return this.$store.state.ThirdPath
}
/** 表单弹出框模式需引入 */
import { handleTree } from "@/assets/utils/table";
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
import TabPane from "@/components/tabPane.vue";
import drawerStaff from "./drawershowStaff.vue";
import { timestampToTime } from "@/assets/utils/dateFormat.js";
export default {
name: "JobList",
components: {
drawerShow,
TabPane,
drawerStaff,
},
mixins: [table],
created() {
this.query = {
page: 1,
size: -1,
};
this.$post("/dept/treeselect", {}).then(({ data }) => {
this.bumentree = data.result;
});
},
computed: {
thirdList() {
if (!this.$store.state.CurrentThirdArr) return [];
return this.$store.state.CurrentThirdArr;
},
activeName() {
return this.$store.state.ThirdPath;
},
},
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;
this.staffList.forEach((item) => {
item.createTime = timestampToTime(item.createTime, 6);
});
}
});
},
addStaff() {
this.$refs.drawerStaff.add(this.currentId);
},
refresh() {
// 请求
// 员工、职位列表
if (this.currentId) {
this.getStaff();
}
this.getData();
},
handleNodeClick(node) {
if (!node.groupId) {
return;
}
this.currentId = node.id;
this.currentName = node.jobName;
this.getStaff();
},
// 获取数据后
// 处理树结构
afterRender(data) {
console.log(data);
data.data = handleTree(data.data, "id", "groupId");
},
saveFn(from) {
this.$refs.drawerform.add(from);
},
doExport() {
this.isExport = true;
let params = {};
if (this.multipleSelection.length > 0) {
params["idList"] = this.multipleSelection;
}
this.$download(
"/staff/exportExcel",
{
...params,
},
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
this.staffList.forEach(item => {
item.createTime = timestampToTime(item.createTime,6)
})
}
})
},
addStaff(){
this.$refs.drawerStaff.add(this.currentId)
},
refresh(){
// 请求
// 员工、职位列表
if(this.currentId){
this.getStaff()
}
this.getData()
},
handleNodeClick(node){
if(!node.groupId){
return
}
this.currentId = node.id
this.currentName = node.jobName
this.getStaff()
},
// 获取数据后
// 处理树结构
afterRender(data){
data.data = handleTree(data.data, "id", "groupId");
},
saveFn(from){
this.$refs.drawerform.add(from)
},
doExport(){
this.isExport = true;
let params = {}
if(this.multipleSelection.length>0){
params['idList'] = this.multipleSelection
}
this.$download("/staff/exportExcel", {
...params
}, { type: "excel" }).then(() => this.isExport = false).catch(error => {
this.isExport = false;
this.$message.error(error.message);
})
},
/** 重写新增方法 */
toAdd(row) {
// console.log(row,'ssss')
// this.$refs.drawerform.add(row);
},
/** 重写编辑方法 */
toEdit(form,row) {
this.$refs.drawerform.edit(form,row);
},
/** 重写查看方法 */
toView(row) {
this.$refs.drawerform.view(row);
},
handleClick(key){
this.$store.commit('setThirdPath',key)
this.$router.push({
path:key
})
},
// 职位
editJob(row){
let from = ''
// 编辑职位/分组
if(!row.groupId){
from = 'group'
}else{
from = 'job'
}
{ type: "excel" }
)
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 重写新增方法 */
toAdd(row) {
// console.log(row,'ssss')
// this.$refs.drawerform.add(row);
},
/** 重写编辑方法 */
toEdit(form, row) {
this.$refs.drawerform.edit(form, row);
},
/** 重写查看方法 */
toView(row) {
this.$refs.drawerform.view(row);
},
handleClick(key) {
this.$store.commit("setThirdPath", key);
this.$router.push({
path: key,
});
},
// 职位
editJob(row) {
let from = "";
// 编辑职位/分组
if (!row.groupId) {
from = "group";
} else {
from = "job";
}
this.toEdit(from,row)
},
// 删除分组或者职位
deleteFn(row){
this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
// 删除操作
this.$post('/job/delete?id='+row.id).then(data => {
if(data.code == 1){
this.$message({
type: 'success',
message: '删除成功!'
})
this.getData()
}
})
})
},
// 删除员工
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 {
isExport:false,
saveFrom:'',
addShow:false,
staffList:[],
bumentree:[],
currentId:'',
currentName:'',
multipleSelection:[]
}
this.toEdit(from, row);
},
// 删除分组或者职位
deleteFn(row) {
this.$confirm("此操作将永久删除该信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then((res) => {
// 删除操作
this.$post("/job/delete?id=" + row.id).then((data) => {
if (data.code == 1) {
this.$message({
type: "success",
message: "删除成功!",
});
this.getData();
}
});
});
},
// 删除员工
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();
}
}
</script>
\ No newline at end of file
});
},
},
data() {
return {
isExport: false,
saveFrom: "",
addShow: false,
staffList: [],
bumentree: [],
currentId: "",
currentName: "",
multipleSelection: [],
};
},
};
</script>
......@@ -17,8 +17,8 @@ module.exports = {
hot: true,//自动保存
proxy: {
'/attendance': {
//target: 'http://192.168.0.98:11039',
target: 'http://112.19.80.237:11039',
target: 'http://192.168.0.98:11039',
// target: 'http://112.19.80.237:11039',
// target: 'http://localhost:17500',
changeOrigin: true,
secure: false,
......
......@@ -145,12 +145,14 @@ public class DingMessageController {
attendanceVacationBalanceEntity.setEntryTime(staffEntity.getEntryDate());
if(result.getTasks().size() >0 ){
Date startTime = dateFormat(result.getTasks().get(0).getCreateTime(),"yyyy-MM-dd'T'HH:mm'Z'");
if(result.getTasks().get(0).getCreateTime() != null && result.getTasks().get(0).getFinishTime() != null){
Date startTime = dateFormat(result.getTasks().get(0).getCreateTime(),"yyyy-MM-dd'T'HH:mm'Z'");
Date endTime = dateFormat(result.getTasks().get(0).getFinishTime(),"yyyy-MM-dd'T'HH:mm'Z'");
leaveRecordEntity.setStartTime(startTime);
leaveRecordEntity.setEndTime(endTime);
leaveRecordEntity.setDuration((int) ((endTime.getTime() - startTime.getTime())/1000));
Date endTime = dateFormat(result.getTasks().get(0).getFinishTime(),"yyyy-MM-dd'T'HH:mm'Z'");
leaveRecordEntity.setStartTime(startTime);
leaveRecordEntity.setEndTime(endTime);
leaveRecordEntity.setDuration((int) ((endTime.getTime() - startTime.getTime())/1000));
}
}
String leave_code = LeaveRulesEnum.事假.getLeave_code();
......@@ -239,7 +241,7 @@ public class DingMessageController {
break;
case "探亲假":
leaveRecordEntity.setLeaveType(21);
leave_code = LeaveRulesEnum..getLeave_code();
leave_code = LeaveRulesEnum.探亲.getLeave_code();
break;
default:
leaveRecordEntity.setLeaveType(1); //默认事假
......
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