update code

dev-login
haha 2023-09-27 00:36:41 +08:00
parent ec38bb02ed
commit d938a781d4
4 changed files with 77 additions and 36 deletions

View File

@ -15,7 +15,16 @@ const getWorkAttendanceList=(deptId,projectId)=> {
}) })
} }
const groupByComany=(data)=> {
return request({
url: `bgscreen/attendance/groupByComany`,
data:data,
method: 'post'
})
}
export default{ export default{
getDeptWorksList, getDeptWorksList,
getWorkAttendanceList getWorkAttendanceList,
groupByComany
} }

View File

@ -491,6 +491,7 @@ export default {
this.elKey++; this.elKey++;
this.onWarningInfoNav(0); this.onWarningInfoNav(0);
this.sumCostOutByDeptId(); this.sumCostOutByDeptId();
})); }));
this.$bus.$on("deptChange", debounce(dept => { this.$bus.$on("deptChange", debounce(dept => {
this.deptInfo = dept; this.deptInfo = dept;
@ -502,6 +503,31 @@ export default {
})); }));
}, },
methods: { methods: {
loadAttendanceData(){
let data={
subDeptId:this.deptInfo.id||0,
projectId:this.prj.id||0,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD")
}
this.$api.attendance.groupByComany(data).then(d=>{
let tmps=d.data||[];
const func=(ids)=>{
let sum=0;
tmps.filter(it=>ids.includes(it.companyTypeId)).map(it=>it.id).forEach(it=>{
sum+=it*1;
})
return sum;
}
this.laborPersonnelTotal = 0;
this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1"]) }];
this.laborPersonnelData.forEach(it=>{
this.laborPersonnelTotal += it.value;
})
this.elDeptWorks++;
});
},
planSummaryChartClick(p){ planSummaryChartClick(p){
let idx=0; let idx=0;
if(p.event.target.parent.style && p.event.target.parent.style.text){ if(p.event.target.parent.style && p.event.target.parent.style.text){
@ -633,7 +659,6 @@ export default {
}, },
init() { init() {
this.localStorage = JSON.parse(localStorage.getItem("data1")) this.localStorage = JSON.parse(localStorage.getItem("data1"))
// //
@ -690,20 +715,7 @@ export default {
}); });
} else { } else {
// //
this.$api.attendance.getWorkAttendanceList(deptId).then(d => { this.loadAttendanceData();
this.laborPersonnelTotal = 0;
this.laborPersonnelData = [{ text: "劳务人员", value: 0 }, { text: "监理人员", value: 0 }, { text: "总包人员", value: 0 }];
if (d.rows.length > 0 && d.rows[0] != null) {
this.laborPersonnelData = [];
this.laborPersonnelTotal += d.rows[0].servicePersonnel;
this.laborPersonnelData.push({ text: "劳务人员", value: d.rows[0].servicePersonnel });
this.laborPersonnelTotal += d.rows[0].supervisorPersonnel;
this.laborPersonnelData.push({ text: "监理人员", value: d.rows[0].supervisorPersonnel });
this.laborPersonnelTotal += d.rows[0].contractorPersonnel;
this.laborPersonnelData.push({ text: "总包人员", value: d.rows[0].contractorPersonnel });
}
this.elDeptWorks++;
});
} }
}, },
// //

View File

@ -88,7 +88,7 @@
<div :class="infoNav == 1 ? 'active' : ''" @click="onWarningInfoNav(1, '今日出勤')">今日出勤 <div :class="infoNav == 1 ? 'active' : ''" @click="onWarningInfoNav(1, '今日出勤')">今日出勤
</div> </div>
</div> </div>
<el-row> <el-row :key="elDeptWorks">
<el-col :span="8"> <el-col :span="8">
<div class="survey_content"> <div class="survey_content">
<div class="survey_content_img"> <div class="survey_content_img">
@ -752,7 +752,8 @@ export default {
mapName: '', mapName: '',
costOut: {}, costOut: {},
finishBuildNode: [], finishBuildNode: [],
modleMap: [] modleMap: [],
elDeptWorks:0,
} }
}, },
created() { created() {
@ -950,6 +951,32 @@ export default {
// //
this.costInterval = setInterval(this.manufacturingCostRoll, 5000); this.costInterval = setInterval(this.manufacturingCostRoll, 5000);
}, },
loadAttendanceData(){
this.getProjectId(id => {
let data={
subDeptId:this.dept.id||0,
projectId:id||0,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD")
}
this.$api.attendance.groupByComany(data).then(d=>{
let tmps=d.data||[];
const func=(ids)=>{
let sum=0;
tmps.filter(it=>ids.includes(it.companyTypeId)).map(it=>it.id).forEach(it=>{
sum+=it*1;
})
return sum;
}
this.laborPersonnelTotal = 0;
this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1"]) }];
this.laborPersonnelData.forEach(it=>{
this.laborPersonnelTotal += it.value;
})
this.elDeptWorks++;
});
});
},
// //
getDeptWorksList() { getDeptWorksList() {
if (this.infoNav == 0) { if (this.infoNav == 0) {
@ -969,20 +996,7 @@ export default {
}); });
} else { } else {
// this.loadAttendanceData();
this.$api.attendance.getWorkAttendanceList(this.dept?.id || 0, this.project?.id || 0).then(d => {
this.laborPersonnelTotal = 0;
this.laborPersonnelData = [{ text: "劳务人员", value: 0 }, { text: "监理人员", value: 0 }, { text: "总包人员", value: 0 }];
if (d.rows.length > 0 && d.rows[0] != null) {
this.laborPersonnelData = [];
this.laborPersonnelTotal += d.rows[0].servicePersonnel;
this.laborPersonnelData.push({ text: "劳务人员", value: d.rows[0].servicePersonnel });
this.laborPersonnelTotal += d.rows[0].supervisorPersonnel;
this.laborPersonnelData.push({ text: "监理人员", value: d.rows[0].supervisorPersonnel });
this.laborPersonnelTotal += d.rows[0].contractorPersonnel;
this.laborPersonnelData.push({ text: "总包人员", value: d.rows[0].contractorPersonnel });
}
});
} }
}, },
// //

View File

@ -97,10 +97,14 @@ service.interceptors.response.use(res => {
} }
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code === 601) { } else if (code === 601) {
Message({ message: msg, type: 'warning' }) if(msg.indexOf('重复提交')==-1){
Message({ message: msg, type: 'warning' })
}
return Promise.reject('error') return Promise.reject('error')
} else if (code !== 200) { } else if (code !== 200) {
Notification.error({ title: msg }) if(msg.indexOf('重复提交')==-1){
Notification.error({ title: msg })
}
return Promise.reject('error') return Promise.reject('error')
} else { } else {
return res.data return res.data
@ -116,7 +120,9 @@ service.interceptors.response.use(res => {
} else if (message.includes("Request failed with status code")) { } else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常"; message = "系统接口" + message.substr(message.length - 3) + "异常";
} }
Message({ message: message, type: 'error', duration: 5 * 1000 }) if(message.indexOf('重复提交')==-1){
Message({ message: message, type: 'error', duration: 5 * 1000 })
}
return Promise.reject(error) return Promise.reject(error)
} }
) )