jhbigscreen/src/pages/components/JobWorkerDialog.vue

221 lines
7.9 KiB
Vue
Raw Normal View History

2023-10-15 00:26:35 +08:00
<template>
2024-03-30 22:19:41 +08:00
<MyDialog v-if="show" v-model="show" width="1600px" height="850px" class="today-attendance-detail">
<template v-if="isGroup">
<template slot="title">在岗人数({{ total }})</template>
<el-table :data="tableData" class="mytable" max-height="750" style="width: 100%;background: transparent;"
ref="fbsubordinateUnit" :show-summary="tableData.length > 1">
<el-table-column label="项目名称" align="left" prop="prjName" />
<el-table-column label="部门" align="left" prop="dptName"></el-table-column>
<el-table-column label="劳务人数" align="center" prop="data101" />
<el-table-column label="监理人数" align="center" prop="data102" />
<el-table-column label="总包人数" align="center" prop="data103" />
</el-table>
2023-10-15 00:26:35 +08:00
2024-03-30 22:19:41 +08:00
</template>
<template v-else>
<template slot="title">在岗人数({{ indexData.total }})</template>
<div class="head-title-tab" style="padding: 10px 0px;">
<div :class="nav == 101 ? 'head-nav active' : 'head-nav'" @click="doNav(101)">({{ indexData.data101
}})</div>
<div :class="nav == 102 ? 'head-nav active' : 'head-nav'" @click="doNav(102)">({{ indexData.data102
}})</div>
<div :class="nav == 103 ? 'head-nav active' : 'head-nav'" @click="doNav(103)">({{ indexData.data103
}})</div>
</div>
<el-table v-loading="loading" :data="tableData" class="mytable" height="650"
style="width: 100%;background: transparent;" ref="fbsubordinateUnit">
<el-table-column label="照片" align="center" prop="id">
<template slot-scope="{row}">
<el-image :src="row.recentPhoto" :preview-src-list="[row.recentPhoto]" style="height:60px" />
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="籍贯" align="center" prop="nativePlace" />
<el-table-column label="性别" align="center" prop="attendanceType">
<template slot-scope="{row}">{{ row.gender == 1 ? '女' : '男' }}</template>
</el-table-column>
<el-table-column label="进场时间" align="center" prop="inTime" v-if="1 == 2">
<template slot-scope="{row}">{{ row.enterDate | formatDate }}</template>
</el-table-column>
<el-table-column label="分包商名称" align="center" prop="companyName" />
<el-table-column label="所属班组" align="center" prop="groupName" />
<el-table-column label="岗位/工种" align="center" prop="workTypeName" />
</el-table>
<el-pagination layout="total,prev, pager, next" :hide-on-single-page="true"
@current-change="handleCurrentChange" :total="total" :page-size="size" :current-page.sync="index"
class="bg-pagination"></el-pagination>
</template>
2023-10-15 00:26:35 +08:00
</MyDialog>
</template>
<script>
import MyDialog from '../components/MyDialog'
export default {
components: {
MyDialog,
},
name: 'JhbigscreenIndexDlg1',
data() {
return {
2024-03-30 22:19:41 +08:00
loading: false,
2023-10-15 00:26:35 +08:00
show: false,
tableData: [],
2024-03-30 22:19:41 +08:00
projectId: 0,
deptId: 0,
isGroup: false,
size: 10,
index: 1,
total: 0,
nav: 101,
indexData: {
total: 0,
data101: 0,
data102: 0,
data103: 0
},
2023-10-15 00:26:35 +08:00
};
},
mounted() {
2024-03-30 22:19:41 +08:00
2023-10-15 00:26:35 +08:00
},
methods: {
2024-03-30 22:19:41 +08:00
handleCurrentChange(n) {
this.index = n;
2023-10-15 00:26:35 +08:00
this.loadData();
},
2024-03-30 22:19:41 +08:00
doNav(n) {
this.nav = n;
this.index = 1;
2023-10-15 00:26:35 +08:00
this.loadData();
},
2024-03-30 22:19:41 +08:00
showDialog(data) {debugger
const getData = id => {
var tmps = data.datas.filter(d => d.text == id);
return tmps.length > 0 ? tmps[0].cnt : 0;
}
this.indexData.total = data.total;
this.indexData.data101 = getData("101");
this.indexData.data102 = getData("102");
this.indexData.data103 = getData("103");
this.projectId = data?.projectId || 0;
this.deptId = data?.deptId || 0;
this.size = 10;
this.index = 1;
if (this.projectId == 0) {
this.isGroup = true;
this.loadGroupData();
} else {
this.isGroup = false;
this.loadData();
}
2023-10-15 00:26:35 +08:00
this.show = true
},
2024-03-30 22:19:41 +08:00
loadGroupData() {
this.$api.attendance.groupByWorkerOnDuty({ deptId: this.deptId }).then(d => {
const getTypeId = (id) => {
let typeId = { "101": [1, 6], "102": [8], "103": [0, 2, 3, 4, 5] }
for (let k in typeId) {
let v = typeId[k];
if (v.indexOf(id) >= 0) {
return k;
}
}
return "";
}
let tmps = (d.data || []).map(it => {
return {
prjName: it.name,
dptName: it.groupName,
companyId: getTypeId(+it.companyId),
cnt: it.cfgid
}
});
let sum = 0;
let obj = {};
tmps.forEach(it => {
let k = it.prjName + "_" + it.dptName + "_";
let o = null;
if (!obj[k]) {
o = {
prjName: it.prjName,
dptName: it.dptName,
data101: 0,
data102: 0,
data103: 0
};
obj[k] = o;
} else {
o = obj[k];
}
sum += it.cnt;
o['data' + it.companyId] += it.cnt;
});
this.tableData = [];
for (let k in obj) {
this.tableData.push(obj[k]);
}
this.total = sum;
})
},
loadData() {
let postData = {
projectId: this.projectId,
pageSize: this.size,
pageNum: this.index,
id: this.nav
2023-10-15 00:26:35 +08:00
}
2024-03-30 22:19:41 +08:00
this.tableData = [];
this.loading = true;
this.$api.attendance.workerOnDuty(postData).then(d => {
this.total = d.total || 0;
this.tableData = (d.rows || []).map(it => {
it.scanPhoto = it.scanPhoto && it.scanPhoto.indexOf("/profile") == 0 ? "/jhapi" + it.scanPhoto : it.scanPhoto;
2023-10-15 00:26:35 +08:00
return it;
});
2024-03-30 22:19:41 +08:00
this.loading = false;
2023-10-15 00:26:35 +08:00
})
}
},
};
</script>
<style lang="less" scoped>
2024-03-30 22:19:41 +08:00
.mytable {
/deep/ th .cell {
2023-10-15 00:26:35 +08:00
color: aquamarine;
}
}
2024-03-30 22:19:41 +08:00
.today-attendance-detail {
/deep/ .quality-table .el-table .el-table__row {
2023-10-15 00:26:35 +08:00
background-image: none !important;
2024-03-30 22:19:41 +08:00
td {
border-bottom: solid 1px rgba(60, 170, 255, 0.3);
2023-10-15 00:26:35 +08:00
}
}
}
</style>
<style lang="less">
2024-03-30 22:19:41 +08:00
.today-attendance-detail {
.popup-project-introduction-min {
2023-10-15 00:26:35 +08:00
transform: translateY(100px);
2024-03-30 22:19:41 +08:00
.bg-pagination {
margin-top: 20px;
2023-10-15 00:26:35 +08:00
}
2024-03-30 22:19:41 +08:00
.head-title-tab {
.head-nav {
padding: 4px 36px;
}
}
}
2023-10-15 00:26:35 +08:00
}
</style>