zhgdyun/src/views/projectFront/laborManage/personnelAnalysis.vue
2022-06-08 14:51:11 +08:00

874 lines
28 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="fullHeight">
<div class="searchBox whiteBlock">
<el-form
:inline="true"
size="medium"
:model="searchForm"
ref="searchForm"
label="标题"
>
<el-form-item prop="executeType">
<el-select
v-model="searchForm.executeType"
placeholder="选择单位"
filterable
clearable
>
<el-option
v-for="item in executeTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="startTime">
<el-date-picker
v-model="searchForm.selectTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" plain @click="queryData">
{{ $t("message.laborMange.inquire") }}
</el-button>
<el-button type="primary" plain @click="exportFn">
导出统计数据
</el-button>
<el-button type="primary" plain @click="exportFn2">
导出单边明细
</el-button>
</el-form-item>
</el-form>
</div>
<div class="table_wrap whiteBlock">
<div class="tableTitle">
{{
showDate ? showDate : moment().format("MM月DD日")
}}南昌轨道交通产业园封闭管理人员表
</div>
<el-table
:data="tableData"
class="tables"
style="width: 100%"
height="600px"
>
<el-table-column
prop="name"
label="单位名称"
width="180"
align="center"
>
</el-table-column>
<el-table-column prop="incumbency" label="在职人数" align="center">
<template slot-scope="scope">
<span
@click="clickNum_abnormalCode(scope.row, 0)"
style="cursor: pointer"
>
{{ scope.row.incumbency }}
</span>
</template>
</el-table-column>
<el-table-column prop="greenCode" label="绿码人数" align="center">
<template slot-scope="scope">
<span
@click="clickNum_abnormalCode(scope.row, 1)"
style="cursor: pointer"
>
{{ scope.row.greenCode }}
</span>
</template>
</el-table-column>
<el-table-column prop="abnormalCode" align="center" label="异常码人数">
<template slot-scope="scope">
<span
@click="clickNum_abnormalCode(scope.row, 2)"
style="cursor: pointer"
>
{{ scope.row.abnormalCode }}
</span>
</template>
</el-table-column>
<el-table-column label="项目部" prop="projectDept" align="center">
<el-table-column
prop="projectDept.outNum"
label="外出"
width="120"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 3, 2)" style="cursor: pointer">
{{ scope.row.projectDept.outNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="projectDept.inNum"
label="进入"
width="120"
align="center"
>
<template slot-scope="scope">
<span
@click="clickNum(scope.row, 3, 1)"
style="cursor: pointer"
prop="name"
>
{{ scope.row.projectDept.inNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="projectDept.unilateralTrafficNum"
label="单边通行"
width="180"
align="center"
>
<template slot-scope="scope">
<span
@click="clickNum(scope.row, 3, 3)"
style="cursor: pointer"
prop="name"
>
{{ scope.row.projectDept.unilateralTrafficNum }}
<span v-if="scope.row.projectDept.departmentExamineNum"
>(已核查人数:{{
scope.row.projectDept.departmentExamineNum
}})</span
>
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="生活区" prop="livingArea" align="center">
<el-table-column
prop="livingArea.outNum"
label="外出"
width="120"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 2, 2)" style="cursor: pointer">
{{ scope.row.livingArea.outNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="livingArea.inNum"
label="进入"
width="120"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 2, 1)" style="cursor: pointer">
{{ scope.row.livingArea.inNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="livingArea.unilateralTrafficNum"
label="单边通行"
width="180"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 2, 3)" style="cursor: pointer">
{{ scope.row.livingArea.unilateralTrafficNum }}
<span v-if="scope.row.livingArea.lifeExamineNum"
>(已核查人数:{{ scope.row.livingArea.lifeExamineNum }})</span
>
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="工地区" prop="siteArea" align="center">
<el-table-column
prop="siteArea.outNum"
label="外出"
width="120"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 1, 2)" style="cursor: pointer">
{{ scope.row.siteArea.outNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="siteArea.inNum"
label="进入"
width="120"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 1, 1)" style="cursor: pointer">
{{ scope.row.siteArea.inNum }}
</span>
</template>
</el-table-column>
<el-table-column
prop="siteArea.unilateralTrafficNum"
label="单边通行"
width="180"
align="center"
>
<template slot-scope="scope">
<span @click="clickNum(scope.row, 1, 3)" style="cursor: pointer">
{{ scope.row.siteArea.unilateralTrafficNum }}
<span v-if="scope.row.siteArea.workExamineNum"
>(已核查人数:{{ scope.row.siteArea.workExamineNum }})</span
>
</span>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
<div>
<el-dialog
width="80%"
title="明细详情"
:visible.sync="detailDialog"
:modal-append-to-body="false"
>
<el-button type="primary" size="mini" @click.native="exportDetailData">
导出明细详情表
</el-button>
<div class="tableBox">
<el-table :data="projectDetailData">
<el-table-column
property="workerName"
label="姓名"
width="100"
></el-table-column>
<el-table-column
property="enterpriseName"
label="公司名"
></el-table-column>
<el-table-column
property="codeStateName"
label="健康码"
></el-table-column>
<el-table-column
property="personTypeName"
label="人员类型"
v-if="dialogType === 0"
></el-table-column>
<el-table-column
property="inTime"
:label="'进入时间(' + areaType + ''"
v-if="dialogType === 1"
></el-table-column>
<el-table-column
property="outTime"
:label="'离开时间(' + areaType + ''"
v-if="dialogType === 1"
></el-table-column>
<el-table-column
property="examineTime"
label="调查时间"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
width="165"
></el-table-column>
<el-table-column
property="examineContent"
label="调查内容"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
></el-table-column>
<el-table-column
property="auditTime"
label="审核时间"
width="165"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
></el-table-column>
<el-table-column
property="auditContent"
label="审核内容"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
></el-table-column>
<el-table-column
property="auditState"
label="状态"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
>
<template slot-scope="scope">
<span>
{{
scope.row.auditState === 0
? "待审核"
: scope.row.auditState === 1
? "重新提交"
: scope.row.auditState === 2
? "审核通过"
: ""
}}
</span>
</template>
</el-table-column>
<el-table-column
property="operate"
label="操作"
v-if="
dialogType === 1 &&
type === 3 &&
searchForm.selectTime != moment().format('YYYY-MM-DD')
"
>
<template slot-scope="scope">
<el-button
type="warning"
size="mini"
@click="examineHandler(scope.row, 1)"
v-if="
menuList.actionList.findIndex(
(x) => x.actionCode == 'investigation'
) != -1 &&
(scope.row.auditState == null ||
scope.row.auditState === 1)
"
>调查</el-button
>
<el-button
type="warning"
size="mini"
@click="examineHandler(scope.row, 2)"
v-if="
menuList.actionList.findIndex(
(x) => x.actionCode == 'examination'
) != -1 && scope.row.auditState === 0
"
>审查</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
<div class="examineDialog">
<el-dialog
:title="btnType === 1 ? '调查申请' : '审核'"
:visible.sync="examineDialog"
:modal-append-to-body="false"
width="25%"
>
<el-form
label-position="right"
label-width="80px"
ref="examineForm"
:model="examineForm"
:rules="examineFormRules"
>
<!-- <el-form-item label="姓名" prop="workerName">
<el-input
v-model="examineForm.workerName"
placeholder="请输入姓名"
></el-input>
</el-form-item>
<el-form-item label="调查类型" prop="inOrOut">
<el-radio-group v-model="examineForm.inOrOut">
<el-radio label="进入时间" :value="1"></el-radio>
<el-radio label="离开时间" :value="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="设备类型" prop="devType">
<el-select
v-model="examineForm.devType"
placeholder="请选择设备类型"
>
<el-option label="工地区" value="1"></el-option>
<el-option label="项目部" value="2"></el-option>
<el-option label="生活区" value="3"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="调查时间" prop="examineTime">
<div class="block">
<span class="demonstration"></span>
<el-date-picker
v-model="examineForm.examineTime"
type="datetime"
:disabled="btnType === 2"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
>
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="调查内容" prop="examineContent">
<el-input
type="textarea"
:rows="2"
:disabled="btnType === 2"
placeholder="请输入内容"
v-model="examineForm.examineContent"
autosize
>
</el-input>
</el-form-item>
<el-form-item
v-if="btnType === 2"
label="审核内容"
prop="auditContent"
>
<el-input
type="textarea"
:rows="2"
placeholder="请输入内容"
v-model="examineForm.auditContent"
autosize
>
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-if="btnType === 1" @click="examineDialog = false"
> </el-button
>
<el-button
v-if="btnType === 1"
type="primary"
@click="submitForm('examineForm', 0)"
> </el-button
>
<el-button
type="danger"
v-if="btnType === 2"
@click="submitForm('examineForm', 1)"
> </el-button
>
<el-button
v-if="btnType === 2"
type="primary"
@click="submitForm('examineForm', 2)"
> </el-button
>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import {
getProjectCloseManageAnalysisApi,
getSelectDepartmentEnterpriseList,
selectDepartmentEnterpriseAttendanceWorkerInfoList,
selectDepartmentEnterpriseCodeWorkerInfoList,
editWorkerAttendanceAnalyseExamine,
} from "@/assets/js/api/laborPerson.js";
import moment from "moment";
export default {
data() {
return {
menuList: this.$store.state.userInfo.menuAuthority.menuList,
searchForm: {
executeType: "",
resultType: "",
selectTime: "",
},
btnType: 1, // 1调查按钮 2审查按钮
executeTypeList: [],
moment: moment,
tableData: [], //列表数据
detailDialog: false,
projectDetailData: [],
projectSn: "",
showDate: "",
areaType: "",
devGroupType: 1,
dialogEnterpriseId: "",
type: 1, // 判断点击的数字为外出、进入、单边通行 1进入2外出3单边通行
codeType: 1, // 1绿码人数 2异常码人数
dialogType: 0, // 0弹窗为异常码人数样式 1弹窗为进出和单边通行人数样式
examineDialog: false, // 调查弹窗
examineForm: {
examineTime: "", // 调查日期
examineContent: "", // 调查理由
auditContent: "", // 审核内容
auditTime: "", // 审核时间
},
examineFormRules: {
examineTime: [
{ required: true, message: "请选择调查时间", trigger: "change" },
],
examineContent: [
{ required: true, message: "请输入调查内容", trigger: "blur" },
],
auditContent: [
{ required: true, message: "请输入审查内容", trigger: "blur" },
],
},
examining: false,
auditItem: "", // 单边通行列表每条的信息
};
},
created() {
this.projectSn = this.$store.state.projectSn;
this.menuList = this.menuList.filter(
(x) => x.menuName == "人员统计分析"
)[0];
console.log(this.menuList);
this.getProjectCloseManageAnalysis();
getSelectDepartmentEnterpriseList({ projectSn: this.projectSn }).then(
(result) => {
this.executeTypeList = result.result.map((item) => {
const labelData = {
value: item.enterpriseId,
label: item.enterpriseName,
};
return labelData;
});
}
);
},
methods: {
//导出封闭管理人员数据
exportFn() {
window.location.href =
this.$http.defaults.baseURL +
"xmgl/projectCloseManageAnalysis/exporExcelProjectCloseManageAnalysis?projectSn=" +
this.$store.state.projectSn +
"&enterpriseId=" +
this.searchForm.executeType +
"&queryTime=" +
this.moment(this.searchForm.selectTime).format("YYYY-MM-DD");
},
// 导出总的单边通行数据
exportFn2() {
window.location.href =
this.$http.defaults.baseURL +
"xmgl/projectCloseManageAnalysis/exporExcelAnalysisAllWorkerInfoList?projectSn=" +
this.$store.state.projectSn +
"&enterpriseId=" +
this.searchForm.executeType +
"&queryTime=" +
this.moment(this.searchForm.selectTime).format("YYYY-MM-DD");
},
// 查询
queryData() {
console.log(this.searchForm.executeType);
this.getProjectCloseManageAnalysis();
},
// 获取列表数据
getProjectCloseManageAnalysis() {
if (!this.searchForm.selectTime) {
this.searchForm.selectTime = this.moment().format("YYYY-MM-DD");
}
console.log(this.searchForm.selectTime);
getProjectCloseManageAnalysisApi({
projectSn: this.projectSn,
enterpriseId: this.searchForm.executeType,
queryTime: this.moment(this.searchForm.selectTime).format("YYYY-MM-DD"),
}).then((result) => {
this.showDate = this.moment(this.searchForm.selectTime).format(
"MM月DD日"
);
this.tableData = [];
// 合计
let totalNum = {
name: "合计",
incumbency: 0,
greenCode: 0,
abnormalCode: 0,
enterpriseId: "",
siteArea: {
outNum: 0,
inNum: 0,
unilateralTrafficNum: 0,
reviewedNum: 0,
workExamineNum: 0,
},
livingArea: {
outNum: 0,
inNum: 0,
unilateralTrafficNum: 0,
reviewedNum: 0,
lifeExamineNum: 0,
},
projectDept: {
outNum: 0,
inNum: 0,
unilateralTrafficNum: 0,
reviewedNum: 0,
departmentExamineNum: 0,
},
};
result.result.forEach((item) => {
const itemDate = {
name: item.enterpriseName,
incumbency: item.workerNum, //在职人数
greenCode: item.greenCodeNum, //绿码人数
abnormalCode: item.abnormalCodeNum, //异常码人数
enterpriseId: item.enterpriseId,
siteArea: {
// 工地区
outNum: item.workOutNum,
inNum: item.workInNum,
unilateralTrafficNum: item.workDifferenceNum,
workExamineNum: item.workExamineNum, // 已核查人数
},
// 生活区
livingArea: {
outNum: item.lifeOutNum,
inNum: item.lifeInNum,
unilateralTrafficNum: item.lifeDifferenceNum,
lifeExamineNum: item.lifeExamineNum, // 已核查人数
},
// 项目部
projectDept: {
outNum: item.departmentOutNum,
inNum: item.departmentInNum,
unilateralTrafficNum: item.departmentDifferenceNum,
departmentExamineNum: item.departmentExamineNum, // 已核查人数
},
};
this.tableData.push(itemDate);
totalNum.incumbency += item.workerNum;
totalNum.greenCode += item.greenCodeNum;
totalNum.abnormalCode += item.abnormalCodeNum;
totalNum.siteArea.outNum += item.workOutNum;
totalNum.siteArea.inNum += item.workInNum;
totalNum.siteArea.unilateralTrafficNum += item.workDifferenceNum;
totalNum.siteArea.workExamineNum += item.workExamineNum;
totalNum.livingArea.outNum += item.lifeOutNum;
totalNum.livingArea.inNum += item.lifeInNum;
totalNum.livingArea.unilateralTrafficNum += item.lifeDifferenceNum;
totalNum.livingArea.lifeExamineNum += item.lifeExamineNum;
totalNum.projectDept.outNum += item.departmentOutNum;
totalNum.projectDept.inNum += item.departmentInNum;
totalNum.projectDept.unilateralTrafficNum +=
item.departmentDifferenceNum;
totalNum.projectDept.departmentExamineNum +=
item.departmentExamineNum;
});
if (result.result.length > 0) {
this.tableData.push(totalNum);
}
});
},
// 点击异常码人数弹窗
clickNum_abnormalCode(row, codeType) {
this.detailDialog = true;
this.dialogEnterpriseId = row.enterpriseId;
this.projectDetailData = [];
this.codeType = codeType;
this.dialogType = 0;
// 获取异常码人数数据
this.getAbnormalCodeNum();
},
getAbnormalCodeNum() {
selectDepartmentEnterpriseCodeWorkerInfoList({
projectSn: this.projectSn,
codeType: this.codeType,
enterpriseId: this.dialogEnterpriseId,
queryTime: this.moment(this.searchForm.selectTime).format("YYYY-MM-DD"),
}).then((res) => {
console.log(res);
this.projectDetailData = res.result;
});
},
//点击进出人数出现弹窗 type: 1进入2外出3单边通行
clickNum(row, devGroupType, type) {
this.detailDialog = true;
this.projectDetailData = [];
this.devGroupType = devGroupType;
this.dialogEnterpriseId = row.enterpriseId;
this.type = type;
this.dialogType = 1;
switch (devGroupType) {
case 1:
this.areaType = "工地区";
break;
case 2:
this.areaType = "生活区";
break;
case 3:
this.areaType = "项目部";
break;
default:
break;
}
//获取明细数据
this.getDialogDetail();
},
// 获取明细详情
getDialogDetail() {
selectDepartmentEnterpriseAttendanceWorkerInfoList({
projectSn: this.projectSn,
enterpriseId: this.dialogEnterpriseId,
queryTime: this.moment(this.searchForm.selectTime).format("YYYY-MM-DD"),
devGroupType: this.devGroupType,
type: this.type,
}).then((res) => {
this.projectDetailData = res.result;
});
},
// 导出明细详情
exportDetailData() {
if (this.dialogType === 1) {
window.location.href =
this.$http.defaults.baseURL +
"xmgl/projectCloseManageAnalysis/exporExcelAnalysisWorkerInfoList?projectSn=" +
this.$store.state.projectSn +
"&enterpriseId=" +
this.dialogEnterpriseId +
"&queryTime=" +
this.moment(this.searchForm.selectTime).format("YYYY-MM-DD") +
"&devGroupType=" +
this.devGroupType +
"&type=" +
this.type;
} else if (this.dialogType === 0) {
window.location.href =
this.$http.defaults.baseURL +
"xmgl/projectCloseManageAnalysis/exporExcelEnterpriseCodeWorkerInfoList?projectSn=" +
this.$store.state.projectSn +
"&enterpriseId=" +
this.dialogEnterpriseId +
"&queryTime=" +
this.moment(this.searchForm.selectTime).format("YYYY-MM-DD") +
"&codeType=" +
this.codeType;
}
},
// 调查/审查
examineHandler(row, btnType) {
// btnType 1调查 2审查
this.auditItem = row;
console.log("row", this.auditItem);
this.examineDialog = true;
if (btnType == 1) {
this.btnType = 1;
this.examineForm = {
examineTime: "", // 选择的调查时间
examineContent: "", // 调查理由
auditContent: "", // 审核内容
auditTime: "", // 审核时间
};
console.log(this.examineForm);
} else {
this.btnType = 2;
this.examineForm = {
examineTime: this.auditItem.examineTime, // 选择的调查时间
examineContent: this.auditItem.examineContent, // 调查理由
auditContent: "", // 审核内容
auditTime: this.moment().format("YYYY-MM-DD h:mm:ss"), // 审核时间
};
}
this.$nextTick(() => {
// 清空表单校验结果
this.$refs.examineForm.resetFields();
});
},
// 确认调查/审查/驳回
submitForm(formName, type) {
// type 1调查确认按钮 2审查通过按钮 3审查驳回按钮
this.$refs[formName].validate((valid) => {
if (valid) {
this.examining = true;
this.examineDialog = false;
let data = {
auditContent: this.examineForm.auditContent, // 审查内容
auditTime: this.examineForm.auditTime, // 审查时间
examineContent: this.examineForm.examineContent, // 调查内容
examineTime: this.examineForm.examineTime, // 调查时间
auditState: this.auditItem.auditState, // 审核状态 0待审核1驳回2审核通过
areaType: this.auditItem.areaType, // 所属区域 1工地区2生活区3项目部
enterpriseId: this.auditItem.enterpriseId,
id: this.auditItem.examineId,
manageEnterpriseId: this.auditItem.manageEnterpriseId,
personSn: this.auditItem.personSn,
projectSn: this.projectSn,
queryTime: this.moment(this.searchForm.selectTime).format(
"YYYY-MM-DD"
),
};
if (type === 0) {
data.auditState = 0;
editWorkerAttendanceAnalyseExamine(data).then((res) => {
this.$message.success(res.message);
this.getDialogDetail();
});
} else if (type === 2) {
data.auditState = 2;
editWorkerAttendanceAnalyseExamine(data).then((res) => {
this.$message.success(res.message);
this.getDialogDetail();
});
} else if (type === 1) {
data.auditState = 1;
editWorkerAttendanceAnalyseExamine(data).then((res) => {
this.$message.success(res.message);
this.getDialogDetail();
});
}
this.$refs[formName].resetFields();
} else {
console.log("error submit!!");
return false;
}
});
},
},
};
</script>
<style lang="less" scoped>
.tableTitle {
margin: 0 auto;
width: 100%;
text-align: center;
padding: 30px 0;
font-size: 24px;
}
.tableBox {
height: 650px;
overflow: auto;
}
.examineDialog {
/deep/ .el-dialog {
margin-top: 24vh !important;
}
.el-input,
.el-textarea {
width: 90%;
}
/deep/ .el-dialog__body {
padding-bottom: 0;
}
}
</style>