Compare commits

..

No commits in common. "51f31be16f3af538e1bd29da03b4084ea9b7eafd" and "cb561658907aeee0467793621f2203d049e2dfbe" have entirely different histories.

6 changed files with 955 additions and 1032 deletions

View File

@ -207,7 +207,7 @@ export default {
if (tmps.length > 0) { if (tmps.length > 0) {
this.$store.dispatch("SetSelProject", tmps[0]); this.$store.dispatch("SetSelProject", tmps[0]);
this.selProject = tmps[0]; this.selProject = tmps[0];
if(this.selProject.vendorsCode == "jgw" ){ if(this.sel.vendorsCode == "jgw" ){
this.selProject.vendorsCode = "uni"; this.selProject.vendorsCode = "uni";
} }

View File

@ -4,18 +4,8 @@
<module-one-1-1 label="劳务人员概况" class="labor-base"> <module-one-1-1 label="劳务人员概况" class="labor-base">
<div class="attendance-info warning-info"> <div class="attendance-info warning-info">
<div class="attendance-info-title warning-info-title"> <div class="attendance-info-title warning-info-title">
<div <div :class="attendanceNav == 0 ? 'active' : ''" @click="doAttendanceNav(0, '在岗人员')">在岗人员</div>
:class="attendanceNav == 0 ? 'active' : ''" <div :class="attendanceNav == 1 ? 'active' : ''" @click="doAttendanceNav(1, '今日出勤')">今日出勤</div>
@click="doAttendanceNav(0, '在岗人员')"
>
在岗人员
</div>
<div
:class="attendanceNav == 1 ? 'active' : ''"
@click="doAttendanceNav(1, '今日出勤')"
>
今日出勤
</div>
</div> </div>
<el-row> <el-row>
<el-col :span="8" class="attendance-tag"> <el-col :span="8" class="attendance-tag">
@ -38,77 +28,38 @@
</div> </div>
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<staffSurveyChart <staffSurveyChart :key="chartKey" :height="$dpi() == '1K' ? '220px' : $dpi() == '2K' ? '330px' : '550px'" :data="attendanceData" :width="140"></staffSurveyChart>
:key="chartKey"
:height="
$dpi() == '1K' ? '220px' : $dpi() == '2K' ? '330px' : '550px'
"
:data="attendanceData"
:width="140"
></staffSurveyChart>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</module-one-1-1> </module-one-1-1>
<module-one-1-1 label="劳务人员七天出勤趋势" class="labor-week-att"> <module-one-1-1 label="劳务人员七天出勤趋势" class="labor-week-att">
<my-chart <my-chart :key="chartKey" id="prj_labor_chart2" width="100%" height="calc(100% - 40px)" :render="renderChart2"></my-chart>
:key="chartKey"
id="prj_labor_chart2"
width="100%"
height="calc(100% - 40px)"
:render="renderChart2"
></my-chart>
</module-one-1-1> </module-one-1-1>
<module-one-1-1 label="劳务人员年龄分布"> <module-one-1-1 label="劳务人员年龄分布">
<my-chart <my-chart :key="chartKey" id="prj_labor_chart3" width="100%" height="calc(100% - 0px)" :render="renderChart3"></my-chart>
:key="chartKey"
id="prj_labor_chart3"
width="100%"
height="calc(100% - 0px)"
:render="renderChart3"
></my-chart>
</module-one-1-1> </module-one-1-1>
</el-col> </el-col>
<el-col :span="12" class="h100"> <el-col :span="12" class="h100">
<module-one-2-2 label class="no-title no-border"> <module-one-2-2 label class="no-title no-border">
<my-chart <my-chart :key="chartKey" id="prj-labor-map" width="100%" height="100%" :render="renderMap"></my-chart>
:key="chartKey"
id="prj-labor-map"
width="100%"
height="100%"
:render="renderMap"
></my-chart>
</module-one-2-2> </module-one-2-2>
<module-one-1-2 label="实时进出" class="prj-labor-real"> <module-one-1-2 label="实时进出" class="prj-labor-real">
<div class="real-item" v-for="(item, index) in realList" :key="index"> <div class="real-item" v-for="(item, index) in realList" :key="index">
<div class="real-item-type" :class="'is-' + item.inOutType"> <div class="real-item-type" :class="'is-'+item.inOutType">{{ item.inOutType==='out'?'出':'进' }}</div>
{{ item.inOutType === "out" ? "出" : "进" }} <el-image class="real-item-img" fit="cover" :src="item.img" :preview-src-list="[item.img]"></el-image>
</div>
<el-image
class="real-item-img"
fit="cover"
:src="item.img"
:preview-src-list="[item.img]"
></el-image>
<div class="real-item-name">{{ item.name }}</div> <div class="real-item-name">{{ item.name }}</div>
<div class="real-item-work-type"> <div class="real-item-work-type">
<span>{{ item.workType }}</span> <span>{{ item.workType }}</span>
</div> </div>
<div class="real-item-time"> <div class="real-item-time">
<span <span>{{item.inOutType==='in'?'进场时间:':'出场时间:'}} {{ item.inoutDate }}</span>
>{{ item.inOutType === "in" ? "进场时间:" : "出场时间:" }}
{{ item.inoutDate }}</span
>
</div> </div>
</div> </div>
</module-one-1-2> </module-one-1-2>
</el-col> </el-col>
<el-col :span="6" class="h100"> <el-col :span="6" class="h100">
<module-one-1-1 <module-one-1-1 label="工种占比分布" class="chart-module4" :key="chartKey">
label="工种占比分布"
class="chart-module4"
:key="chartKey"
>
<project-overview-chart <project-overview-chart
:htmlShow="true" :htmlShow="true"
:key="'ai4' +chartKey" :key="'ai4' +chartKey"
@ -122,13 +73,7 @@
></project-overview-chart> ></project-overview-chart>
</module-one-1-1> </module-one-1-1>
<module-one-1-1 label="人员地区分布"> <module-one-1-1 label="人员地区分布">
<my-chart <my-chart :key="chartKey" id="prj_labor_chart5" width="100%" height="100%" :render="renderChart5"></my-chart>
:key="chartKey"
id="prj_labor_chart5"
width="100%"
height="100%"
:render="renderChart5"
></my-chart>
</module-one-1-1> </module-one-1-1>
<module-one-1-1 label="人员预警" class="prj-labor-alert"> <module-one-1-1 label="人员预警" class="prj-labor-alert">
<div class="alert-list scroll"> <div class="alert-list scroll">
@ -155,13 +100,13 @@
</template> </template>
<script> <script>
import debounce from "lodash.debounce"; import debounce from 'lodash.debounce'
import staffSurveyChart from "@/components/staffSurveyChart.vue"; import staffSurveyChart from '@/components/staffSurveyChart.vue'
export default { export default {
components: { staffSurveyChart }, components: { staffSurveyChart },
data() { data() {
return { return {
dpi: "", dpi: '',
chartKey: 0, chartKey: 0,
chart4Height: 230, chart4Height: 230,
chart2Height: 230, chart2Height: 230,
@ -169,9 +114,9 @@ export default {
attendanceNav: 0, attendanceNav: 0,
attendanceTotal: 0, attendanceTotal: 0,
attendanceData: [ attendanceData: [
{ text: "普通工种", value: 0, id: 0 }, { text: '普通工种', value: 0, id: 0 },
{ text: "特殊工种", value: 0, id: 0 }, { text: '特殊工种', value: 0, id: 0 },
{ text: "管理人员", value: 0, id: 0 }, { text: '管理人员', value: 0, id: 0 },
], ],
legendOpt: {}, legendOpt: {},
overviewDatas: [], overviewDatas: [],
@ -182,36 +127,36 @@ export default {
workerGroupList: [], workerGroupList: [],
realList: [], realList: [],
alertList: [], alertList: [],
}; }
}, },
methods: { methods: {
changeChart4(opt) { changeChart4(opt) {
if (this.$dpi() == "1K") { if (this.$dpi() == '1K') {
opt.legend[0].left = 200; opt.legend[0].left = 200
return opt; return opt
} else if (this.$dpi() == "2K") { } else if (this.$dpi() == '2K') {
opt.legend[0].left = 290; opt.legend[0].left = 290
return opt; return opt
} else { } else {
opt.legend[0].left = 500; opt.legend[0].left = 500
return opt; return opt
} }
}, },
setOpts() { setOpts() {
let is1K = this.$dpi() == "1K"; let is1K = this.$dpi() == '1K'
let is2K = this.$dpi() == "2K"; let is2K = this.$dpi() == '2K'
this.legendOpt = { this.legendOpt = {
icon: "rect", icon: 'rect',
orient: "vertical", orient: 'vertical',
itemWidth: "50%", itemWidth: '50%',
left: 240, left: 240,
right: "10%", right: '10%',
itemWidth: 20, itemWidth: 20,
itemGap: 20, itemGap: 20,
itemHeight: 20, itemHeight: 20,
type: "scroll", type: 'scroll',
pageTextStyle: { pageTextStyle: {
color: "#c3dbfd", color: '#c3dbfd',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
scroll: { scroll: {
@ -225,148 +170,133 @@ export default {
textStyle: { textStyle: {
padding: [0, 0, 0, 0], padding: [0, 0, 0, 0],
fontSize: is1K ? 12 : is2K ? 14 : 20, fontSize: is1K ? 12 : is2K ? 14 : 20,
color: "#c3dbfd", color: '#c3dbfd',
align: "center", align: 'center',
rich: { rich: {
name: { name: {
fontSize: is1K ? 12 : is2K ? 14 : 20, fontSize: is1K ? 12 : is2K ? 14 : 20,
color: "#c3dbfd", color: '#c3dbfd',
padding: [5, 2, 5, 2], padding: [5, 2, 5, 2],
}, },
percent: { percent: {
fontSize: is1K ? 12 : is2K ? 14 : 20, fontSize: is1K ? 12 : is2K ? 14 : 20,
color: "#4676FD", color: '#4676FD',
padding: [0, 2, 0, 2], padding: [0, 2, 0, 2],
}, },
}, },
}, },
}; }
}, },
init() { init() {
if (!this.selProject) { if (!this.selProject) {
return; return
} }
this.loadAttendanceData(); this.loadAttendanceData()
this.getGroupByWorker(); this.getGroupByWorker()
this.groupAttendanceLastWeek(); this.groupAttendanceLastWeek()
this.getWorkerCountGroupByType(); this.getWorkerCountGroupByType()
this.getRealAttendance(); this.getRealAttendance()
this.getAttendanceAlert(); this.getAttendanceAlert()
setTimeout(this.init,3*60*1000); setTimeout(this.init,3*60*1000);
}, },
resize() { resize() {
let is1K = this.$dpi() == "1K"; let is1K = this.$dpi() == '1K'
let is2K = this.$dpi() == "2K"; let is2K = this.$dpi() == '2K'
this.chart4Height = is1K ? 230 : is2K ? 360 : 595; this.chart4Height = is1K ? 230 : is2K ? 360 : 595
this.chart2Height = is1K ? 567 : is2K ? 800 : 1250; this.chart2Height = is1K ? 567 : is2K ? 800 : 1250
this.chartKey++; this.chartKey++
}, },
getAttendanceAlert() { getAttendanceAlert() {
this.$api.labor this.$api.labor.getAttendanceAlert(this.selProject.vendorsCode, this.selProject.id).then((d) => {
.getAttendanceAlert(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.alertList = d.data.map((it) => { this.alertList = d.data.map((it) => {
return it; return it
}); })
}); })
}, },
getRealAttendance() { getRealAttendance() {
this.$api.labor this.$api.labor.getRealAttendance(this.selProject.vendorsCode, this.selProject.id).then((d) => {
.getRealAttendance(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.realList = d.data.map((it) => { this.realList = d.data.map((it) => {
it.name = it.workerName||it.userName; it.name = it.workerName||it.userName;
it.workType = it.workTypeName || it.subDeptGroupName; it.workType = it.workTypeName||it.subDeptGroupName
it.img = it.scanPhoto || it.inPhoto || it.outPhoto; it.img = it.scanPhoto||it.inPhoto||it.outPhoto
if(it.outTime){ if(it.outTime){
it.inOutType = "out"; it.inOutType = 'out'
it.inoutDate = it.outTime; it.inoutDate = it.outTime
}else if(it.inTime){ }else if(it.inTime){
it.inOutType = "in"; it.inOutType = 'in'
it.inoutDate = it.inTime; it.inoutDate = it.inTime
}else if (it.attendanceOutTime) { }else if (it.attendanceOutTime) {
it.inOutType = "out"; it.inOutType = 'out'
it.inoutDate = it.attendanceOutTime; it.inoutDate = it.attendanceInTime
} else { } else {
it.inOutType = "in"; it.inOutType = 'in'
it.inoutDate = it.attendanceTime; it.inoutDate = it.attendanceTime
} }
return it; return it
}); })
}); })
}, },
getWorkerCountGroupByType() { getWorkerCountGroupByType() {
this.$api.labor this.$api.labor.getWorkerCountGroupByType(this.selProject.vendorsCode, this.selProject.id).then((d) => {
.getWorkerCountGroupByType( let sum = 0
this.selProject.vendorsCode,
this.selProject.id
)
.then((d) => {
let sum = 0;
d.data.forEach((item) => { d.data.forEach((item) => {
item.id = item.id || item.comId; item.id = item.id || item.comId
sum += item.id ? item.id : 0; sum += item.id ? item.id : 0
}); })
this.workerTotal = sum; this.workerTotal = sum
this.workerGroupList = d.data.map((item) => { this.workerGroupList = d.data.map((item) => {
return { return {
name: item.workTypeName || item.craftPostName, name: item.workTypeName || item.craftPostName,
value: item.id ? item.id : 0, value: item.id ? item.id : 0,
}; }
}); })
this.chartKey++; this.chartKey++
}); })
}, },
groupAttendanceLastWeek() { groupAttendanceLastWeek() {
this.$api.labor this.$api.labor.groupAttendanceLastWeek(this.selProject.vendorsCode, this.selProject.id).then((d) => {
.groupAttendanceLastWeek(
this.selProject.vendorsCode,
this.selProject.id
)
.then((d) => {
this.weekData = d.data.map((it) => { this.weekData = d.data.map((it) => {
return { return {
name: it.dt.substring(5).replace("-", "."), name: it.dt.substring(5).replace('-', '.'),
value: it.cnt, value: it.cnt,
};
}); }
this.chartKey++; })
}); this.chartKey++
})
}, },
getGroupByWorker() { getGroupByWorker() {
this.$api.labor this.$api.labor.groupByWorker(this.selProject.vendorsCode, this.selProject.id).then((d) => {
.groupByWorker(this.selProject.vendorsCode, this.selProject.id)
.then((d) => {
this.nativeList = (d.data.native || []).map((it) => { this.nativeList = (d.data.native || []).map((it) => {
it.name = it.nativePlace; it.name = it.nativePlace
it.value = it.count; it.value = it.count
return it; return it
}); })
this.ageList = (d.data.age || []).map((it) => { this.ageList = (d.data.age || []).map((it) => {
it.name = ["", "18~30", "30~40", "40~55", "55岁以上"][it.age]; it.name = ['', '18~30', '30~40', '40~55', '55岁以上'][it.age]
it.value = it.count; it.value = it.count
return it; return it
}); })
this.chartKey++; this.chartKey++
}); })
}, },
renderChart2(opt) { renderChart2(opt) {
let is1K = this.$dpi() == "1K"; let is1K = this.$dpi() == '1K'
let is2K = this.$dpi() == "2K"; let is2K = this.$dpi() == '2K'
const areaOption = { const areaOption = {
grid: { grid: {
left: "5%", left: '5%',
right: "5%", right: '5%',
bottom: "0%", bottom: '0%',
top: "15%", top: '15%',
containLabel: true, containLabel: true,
}, },
tooltip: { tooltip: {
trigger: "axis", trigger: 'axis',
axisPointer: { axisPointer: {
type: "shadow", type: 'shadow',
label: { label: {
backgroundColor: "#6a7985", backgroundColor: '#6a7985',
textStyle: { textStyle: {
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
@ -374,85 +304,85 @@ export default {
}, },
}, },
xAxis: { xAxis: {
type: "category", type: 'category',
data: this.weekData.map((item) => item.name), data: this.weekData.map((item) => item.name),
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
}, },
yAxis: { yAxis: {
type: "value", type: 'value',
minInterval: 1, minInterval: 1,
axisLabel: { axisLabel: {
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
}, },
series: [ series: [
{ {
name: "出勤人数", name: '出勤人数',
type: "line", type: 'line',
areaStyle: { areaStyle: {
color: "rgba(13, 204, 242,0.5)", // color: 'rgba(13, 204, 242,0.5)', //
}, },
label: { label: {
show: true, show: true,
position: "top", // 线 position: 'top', // 线
textStyle: { textStyle: {
color: "#0df2c8", // color: '#0df2c8', //
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
data: this.weekData.map((item) => item.value), data: this.weekData.map((item) => item.value),
}, },
], ],
}; }
return areaOption; return areaOption
}, },
renderChart3(opt) { renderChart3(opt) {
let is1K = this.$dpi() == "1K"; let is1K = this.$dpi() == '1K'
let is2K = this.$dpi() == "2K"; let is2K = this.$dpi() == '2K'
let pieOption = { let pieOption = {
tooltip: { tooltip: {
trigger: "item", trigger: 'item',
formatter: "{b} 岁 <br/> {c} 人 ({d}%)", formatter: '{b} 岁 <br/> {c} 人 ({d}%)',
textStyle: { textStyle: {
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
legend: { legend: {
orient: "vertical", orient: 'vertical',
left: "left", left: 'left',
top: "center", top: 'center',
data: this.ageList.map((it) => it.name), data: this.ageList.map((it) => it.name),
textStyle: { textStyle: {
color: "#19c0e6", color: '#19c0e6',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
series: [ series: [
{ {
type: "pie", type: 'pie',
radius: "55%", radius: '55%',
center: ["50%", "60%"], center: ['50%', '60%'],
data: this.ageList, data: this.ageList,
label: { label: {
normal: { normal: {
formatter: "{b}\n{c}", formatter: '{b}\n{c}',
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
emphasis: { emphasis: {
formatter: "{b}\n{c}", formatter: '{b}\n{c}',
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
@ -465,37 +395,37 @@ export default {
}, },
}, },
], ],
}; }
return pieOption; return pieOption
}, },
renderChart5(opt) { renderChart5(opt) {
let is1K = this.$dpi() == "1K"; let is1K = this.$dpi() == '1K'
let is2K = this.$dpi() == "2K"; let is2K = this.$dpi() == '2K'
const pieOption = { const pieOption = {
tooltip: { tooltip: {
trigger: "item", trigger: 'item',
formatter: "{b}: {c} ({d}%)", formatter: '{b}: {c} ({d}%)',
textStyle: { textStyle: {
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
series: [ series: [
{ {
type: "pie", type: 'pie',
radius: ["50%", "70%"], // radius: ['50%', '70%'], //
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: { label: {
normal: { normal: {
formatter: "{b}\n{c}", formatter: '{b}\n{c}',
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
emphasis: { emphasis: {
formatter: "{b}\n{c}", formatter: '{b}\n{c}',
textStyle: { textStyle: {
color: "#0df2c8", color: '#0df2c8',
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
}, },
}, },
@ -504,63 +434,62 @@ export default {
label: { label: {
show: true, show: true,
fontSize: is1K ? 12 : is2K ? 16 : 20, fontSize: is1K ? 12 : is2K ? 16 : 20,
fontWeight: "bold", fontWeight: 'bold',
}, },
}, },
data: this.nativeList, data: this.nativeList,
}, },
], ],
}; }
return pieOption; return pieOption
}, },
doAttendanceNav(n) { doAttendanceNav(n) {
this.attendanceNav = n; this.attendanceNav = n
this.loadAttendanceData(); this.loadAttendanceData()
}, },
loadJhAttendanceData() { loadJhAttendanceData() {
let data = { let data = {
id: this.attendanceNav, id: this.attendanceNav,
projectId: this.selProject.id, projectId: this.selProject.id,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD"), attendanceTime: this.$dt(new Date()).format('YYYY-MM-DD'),
}; }
let ajax = this.$api.detail.groupByComany; let ajax = this.$api.detail.groupByComany
if (this.attendanceNav != 1) { if (this.attendanceNav != 1) {
ajax = this.$api.detail.groupAllByComany; ajax = this.$api.detail.groupAllByComany
} }
ajax(data).then((d) => { ajax(data).then((d) => {
let tmps = d.data || []; let tmps = d.data || []
const func = (ids) => { const func = (ids) => {
let sum = 0; let sum = 0
tmps tmps.filter((it) => ids.includes(it.companyTypeId))
.filter((it) => ids.includes(it.companyTypeId))
.map((it) => it.id) .map((it) => it.id)
.forEach((it) => { .forEach((it) => {
sum += it * 1; sum += it * 1
}); })
return sum; return sum
}; }
this.attendanceTotal = 0; this.attendanceTotal = 0
this.attendanceData = [ this.attendanceData = [
{ text: "劳务人员", value: func(["0", "2", "3", "4", "5"]) }, { text: '劳务人员', value: func(['0', '2', '3', '4', '5']) },
{ text: "监理人员", value: func(["8"]) }, { text: '监理人员', value: func(['8']) },
{ text: "总包人员", value: func(["1", "6"]) }, { text: '总包人员', value: func(['1', '6']) },
]; ]
this.attendanceData.forEach((it) => { this.attendanceData.forEach((it) => {
this.attendanceTotal += it.value; this.attendanceTotal += it.value
}); })
}); })
}, },
loadUniAttendanceData() { loadUniAttendanceData() {
let ajax = this.$api.detail.groupByCraftType; let ajax = this.$api.detail.groupByCraftType
let posData = { let posData = {
comId: this.selProject.comId, comId: this.selProject.comId,
projectId: this.selProject.id, projectId: this.selProject.id,
}; }
if (this.attendanceNav == 1) { if (this.attendanceNav == 1) {
ajax = this.$api.detail.groupByCraftTypeByAttendance; ajax = this.$api.detail.groupByCraftTypeByAttendance
posData.createTime = this.$dt(new Date()).format("YYYY-MM-DD"); posData.createTime = this.$dt(new Date()).format('YYYY-MM-DD')
//posData.createTime = '2024-10-13' //posData.createTime = '2024-10-13'
} }
ajax(posData).then((d) => { ajax(posData).then((d) => {
@ -569,71 +498,71 @@ export default {
text: it.createBy, text: it.createBy,
value: it.id || 0, value: it.id || 0,
id: it.craftType, id: it.craftType,
}; }
}); })
let count = 0; let count = 0
this.attendanceData.forEach((it) => { this.attendanceData.forEach((it) => {
count += it.value; count += it.value
}); })
this.attendanceTotal = count; this.attendanceTotal = count
}); })
}, },
renderMap(opt, myChart) { renderMap(opt, myChart) {
let mapName = "china"; let mapName = 'china'
let data = this.nativeList; let data = this.nativeList
let geoCoordMap = {}; let geoCoordMap = {}
/*获取地图数据*/ /*获取地图数据*/
let mapFeatures = echarts.getMap(mapName).geoJson.features; let mapFeatures = echarts.getMap(mapName).geoJson.features
let allData = []; let allData = []
mapFeatures.forEach(function (v) { mapFeatures.forEach(function (v) {
// //
var name = v.properties.name; var name = v.properties.name
// //
geoCoordMap[name] = v.properties.cp; geoCoordMap[name] = v.properties.cp
allData.push({ allData.push({
name: name, name: name,
value: 0, value: 0,
}); })
}); })
let max = 880, let max = 880,
min = 3; // todo min = 3 // todo
let maxSize4Pin = 80, let maxSize4Pin = 80,
minSize4Pin = 20; minSize4Pin = 20
let convertData = function (data, lbl) { let convertData = function (data, lbl) {
let res = []; let res = []
if (lbl == 1) { if (lbl == 1) {
data = allData; data = allData
} }
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let geoCoord = geoCoordMap[data[i].name]; let geoCoord = geoCoordMap[data[i].name]
if (geoCoord) { if (geoCoord) {
res.push({ res.push({
name: data[i].name, name: data[i].name,
value: geoCoord.concat(data[i].value), value: geoCoord.concat(data[i].value),
}); })
} }
} }
if (lbl == 1) { if (lbl == 1) {
return res; return res
}
return res.filter((d) => d.value[2] > 0)
} }
return res.filter((d) => d.value[2] > 0);
};
let option = { let option = {
visualMap: { visualMap: {
show: false, show: false,
min: 0, min: 0,
max: 200, max: 200,
left: "left", left: 'left',
top: "bottom", top: 'bottom',
text: ["高", "低"], // text: ['高', '低'], //
calculable: true, calculable: true,
seriesIndex: [1], seriesIndex: [1],
inRange: { inRange: {
color: ["#00e1ff00", "#3da2ffFF"], color: ['#00e1ff00', '#3da2ffFF'],
//color: ['#3B5077', '#031525'], // //color: ['#3B5077', '#031525'], //
// color: ['#ffc0cb', '#800080'] // // color: ['#ffc0cb', '#800080'] //
// color: ['#3C3B3F', '#605C3C'] // 绿 // color: ['#3C3B3F', '#605C3C'] // 绿
@ -661,27 +590,27 @@ export default {
roam: true, roam: true,
itemStyle: { itemStyle: {
normal: { normal: {
areaColor: "#031525", areaColor: '#031525',
borderColor: "#3B5077", borderColor: '#3B5077',
}, },
emphasis: { emphasis: {
areaColor: "#2B91B7", areaColor: '#2B91B7',
}, },
}, },
}, },
series: [ series: [
{ {
name: "散点", name: '散点',
type: "scatter", type: 'scatter',
coordinateSystem: "geo", coordinateSystem: 'geo',
data: convertData(data, 1), data: convertData(data, 1),
symbolSize: function (val) { symbolSize: function (val) {
return val[2] / 10; return val[2] / 10
}, },
label: { label: {
normal: { normal: {
formatter: "{b}", formatter: '{b}',
position: "right", position: 'right',
show: true, show: true,
}, },
emphasis: { emphasis: {
@ -690,12 +619,12 @@ export default {
}, },
itemStyle: { itemStyle: {
normal: { normal: {
color: "#05C3F9", color: '#05C3F9',
}, },
}, },
}, },
{ {
type: "map", type: 'map',
map: mapName, map: mapName,
geoIndex: 0, geoIndex: 0,
aspectScale: 0.75, // aspectScale: 0.75, //
@ -709,71 +638,71 @@ export default {
data: data, data: data,
}, },
{ {
name: "点", name: '点',
type: "scatter", type: 'scatter',
coordinateSystem: "geo", coordinateSystem: 'geo',
symbol: "pin", // symbol: 'pin', //
symbolSize: function (val) { symbolSize: function (val) {
var a = (maxSize4Pin - minSize4Pin) / (max - min); var a = (maxSize4Pin - minSize4Pin) / (max - min)
var b = minSize4Pin - a * min; var b = minSize4Pin - a * min
b = maxSize4Pin - a * max; b = maxSize4Pin - a * max
return a * val[2] + b; return a * val[2] + b
}, },
label: { label: {
normal: { normal: {
formatter: (a) => { formatter: (a) => {
return a.value[2]; return a.value[2]
}, },
show: true, show: true,
textStyle: { textStyle: {
color: "#fff", color: '#fff',
fontSize: 9, fontSize: 9,
}, },
}, },
}, },
itemStyle: { itemStyle: {
normal: { normal: {
color: "#F62157", // color: '#F62157', //
}, },
}, },
zlevel: 6, zlevel: 6,
data: convertData(data, 2), data: convertData(data, 2),
}, },
], ],
}; }
return option; return option
}, },
loadAttendanceData() { loadAttendanceData() {
if (this.selProject.vendorsCode != "uni") { if (this.selProject.vendorsCode != 'uni') {
this.loadJhAttendanceData(); this.loadJhAttendanceData()
} else { } else {
this.loadUniAttendanceData(); this.loadUniAttendanceData()
} }
}, },
}, },
mounted() { mounted() {
window.plApp = this; window.plApp = this
this.$store.dispatch("ChangeNav", 102); this.$store.dispatch('ChangeNav', 102)
this.$bus.$on( this.$bus.$on(
"projectChange", 'projectChange',
debounce((prj) => { debounce((prj) => {
this.selProject = prj; this.selProject = prj
this.init(); this.init()
}) })
); )
this.selProject = this.$store.getters.selProject; this.selProject = this.$store.getters.selProject
this.init(); this.init()
this.dpi = this.$dpi(); this.dpi = this.$dpi()
window.addEventListener("resize", () => { window.addEventListener('resize', () => {
if (this.dpi != this.$dpi()) { if (this.dpi != this.$dpi()) {
this.dpi = this.$dpi(); this.dpi = this.$dpi()
this.resize(); this.resize()
} }
}); })
this.setOpts(); this.setOpts()
this.resize(); this.resize()
}, },
}; }
</script> </script>
<style lang="less"> <style lang="less">

View File

@ -399,15 +399,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="groupAllByComany" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult"> <select id="groupAllByComany" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ct.sub_type companyTypeId,count(1) id select g.companyTypeId,count(1) id
from sur_project_attendance_user u, attendance_cfg c, from sur_project_attendance_user u, attendance_cfg c,view_sur_project_attendance_group g,
view_sur_project_attendance_group g, pro_project_info sp
pro_project_info sp, where u.cfgid=c.id and u.companyId=g.companyId and u.state=#{id} and c.project_id = sp.id
sur_project_attendance_company_type ct
where u.cfgid=c.id and u.companyId=g.companyId and u.state=0 and c.project_id = sp.id
and u.vendors_code=ct.vendors_code and g.companyTypeId=ct.type_id
and sp.is_Del=0 and sp.is_Del=0
and ct.sub_type in (0,1,2,3,4,5,6,8) and g.companyTypeId in (0,1,2,3,4,5,6,8)
<if test="projectId!=null and projectId>0"> <if test="projectId!=null and projectId>0">
and c.project_id=#{projectId} and c.project_id=#{projectId}
</if> </if>
@ -421,7 +418,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item} #{item}
</foreach> </foreach>
</if> </if>
group by ct.sub_type group by g.companyTypeId
</select> </select>
<select id="getHuazhuPage" parameterType="SurProjectAttendanceData" resultType="Long"> <select id="getHuazhuPage" parameterType="SurProjectAttendanceData" resultType="Long">
@ -658,8 +655,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sur_project_attendance_data_${year} where from sur_project_attendance_data_${year} where
is_del !=1 is_del !=1
and projectid=#{prjId} and projectid=#{prjId}
AND DATE( ifnull( attendance_time, attendance_out_time ) ) &gt;= date(#{dateStart}) AND (date(attendance_time) &gt;= date(#{dateStart}) or date(attendance_out_time) &gt;= date(#{dateStart}))
AND DATE( ifnull( attendance_time, attendance_out_time ) ) &lt;= date(#{dateEnd}) AND (date(attendance_time) &lt;= date(#{dateEnd}) or date(attendance_out_time) &lt;= date(#{dateEnd}))
) tmp ) tmp
group by dt group by dt

View File

@ -112,8 +112,8 @@ public class AttendanceSzjTask {
try { try {
params.put("offset",5); params.put("offset",5);
params.put("recordSize",5); params.put("recordSize",5);
params.put("startTime","2025-06-25"); params.put("startTime","2025-06-01");
params.put("endTime","2025-06-26"); params.put("endTime","2025-06-07");
String result = HttpUtils.sendJSONPost(SZJ_HOST + "v1/api/recognition/query", JSON.toJSONString(params), headerMap); String result = HttpUtils.sendJSONPost(SZJ_HOST + "v1/api/recognition/query", JSON.toJSONString(params), headerMap);
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject != null && jsonObject.getBoolean("success")) { if (jsonObject != null && jsonObject.getBoolean("success")) {
@ -460,7 +460,7 @@ public class AttendanceSzjTask {
headerMap.put("token",token); headerMap.put("token",token);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try { try {
params.put("offset",pageIndex); params.put("offset",1);
params.put("recordSize",100); params.put("recordSize",100);
String result = HttpUtils.sendJSONPost(SZJ_HOST + "v1/api/person/query", JSON.toJSONString(params), headerMap); String result = HttpUtils.sendJSONPost(SZJ_HOST + "v1/api/person/query", JSON.toJSONString(params), headerMap);
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
@ -504,7 +504,7 @@ public class AttendanceSzjTask {
public void syncAttendanceData() { public void syncAttendanceData() {
log.info("开始同步数智建考勤记录...{}",DateUtils.dateTimeStr()); log.info("开始同步数智建考勤记录...{}",DateUtils.dateTimeStr());
String startTime=DateUtil.formatDate(new Date()); String startTime=DateUtil.formatDate(new Date());
String endTime=DateUtil.formatDate(DateUtil.offsetDay(new Date(),1)); String endTime=DateUtil.formatDate(new Date());
syncAttendanceData(startTime,endTime); syncAttendanceData(startTime,endTime);
} }
@ -513,8 +513,8 @@ public class AttendanceSzjTask {
*/ */
public void syncLastWeekAttendanceData() { public void syncLastWeekAttendanceData() {
log.info("开始同步数智建考勤记录...{}",DateUtils.dateTimeStr()); log.info("开始同步数智建考勤记录...{}",DateUtils.dateTimeStr());
String startTime=DateUtil.formatDate(DateUtil.offsetDay(new Date(),-6)); String startTime=DateUtil.formatDate(DateUtil.offsetDay(new Date(),-7));
String endTime=DateUtil.formatDate(DateUtil.offsetDay(new Date(),1)); String endTime=DateUtil.formatDate(new Date());
syncAttendanceData(startTime,endTime); syncAttendanceData(startTime,endTime);
} }
@ -544,7 +544,6 @@ public class AttendanceSzjTask {
try { try {
String token = getToken(jSONObject.getString("secret")); String token = getToken(jSONObject.getString("secret"));
doSyncAttendance(token, item,0,startTime,endTime); doSyncAttendance(token, item,0,startTime,endTime);
System.out.println("====完成====");
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
@ -597,8 +596,6 @@ public class AttendanceSzjTask {
att.setCompanyName(user.getCompanyName()); att.setCompanyName(user.getCompanyName());
att.setCompanyTypeId(user.getCompanyTypeId()); att.setCompanyTypeId(user.getCompanyTypeId());
QuartzProjectAttendanceGroup groupWhere=new QuartzProjectAttendanceGroup(); QuartzProjectAttendanceGroup groupWhere=new QuartzProjectAttendanceGroup();
groupWhere.setCfgid(cfg.getId());
groupWhere.setTeamId(NumberUtil.parseLong(user.getGroupId()));
List<QuartzProjectAttendanceGroup> groupList=groupService.selectSurProjectAttendanceGroupList(groupWhere); List<QuartzProjectAttendanceGroup> groupList=groupService.selectSurProjectAttendanceGroupList(groupWhere);
if(!groupList.isEmpty()){ if(!groupList.isEmpty()){
QuartzProjectAttendanceGroup group=groupList.get(0); QuartzProjectAttendanceGroup group=groupList.get(0);
@ -627,7 +624,7 @@ public class AttendanceSzjTask {
} }
} }
if(atts.size()==100){ if(atts.size()==100){
doSyncAttendance(token,cfg,offset,startTime,endTime); doSyncAttendance(token,cfg,offset+1,startTime,endTime);
} }
} }

View File

@ -132,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<if test="scanPhoto != null and scanPhoto != ''"> and scanPhoto = #{scanPhoto}</if> <if test="scanPhoto != null and scanPhoto != ''"> and scanPhoto = #{scanPhoto}</if>
<if test="isDel != null "> and is_del = #{isDel}</if> <if test="isDel != null "> and is_del = #{isDel}</if>
<if test="attendanceTime != null and attendanceTime != ''"> and DATE( ifnull( attendance_time, attendance_out_time ) ) = date(#{attendanceTime})</if> <if test="attendanceTime != null and attendanceTime != ''"> and date(attendance_time) = date(#{attendanceTime})</if>
</where> </where>
order by id desc order by id desc
</select> </select>

View File

@ -65,7 +65,7 @@ public class LaborController extends BaseController {
@GetMapping("/groupAttendanceLastWeek/{type}/{prjId}") @GetMapping("/groupAttendanceLastWeek/{type}/{prjId}")
public AjaxResult groupAttendanceLastWeek(@PathVariable("type")String type, @PathVariable("prjId") Long prjId){ public AjaxResult groupAttendanceLastWeek(@PathVariable("type")String type, @PathVariable("prjId") Long prjId){
Date dateEnd=new DateTime(); Date dateEnd=new DateTime();
Date dateStart=DateUtil.offsetDay(dateEnd,-6); Date dateStart=DateUtil.offsetDay(dateEnd,-7);
if("uni".equals(type.toLowerCase())){ if("uni".equals(type.toLowerCase())){
JSONArray sList=attendanceUbiDataService.groupAttendanceLastWeek(prjId,dateStart,dateEnd); JSONArray sList=attendanceUbiDataService.groupAttendanceLastWeek(prjId,dateStart,dateEnd);
return AjaxResult.success(sList); return AjaxResult.success(sList);