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{
getDeptWorksList,
getWorkAttendanceList
getWorkAttendanceList,
groupByComany
}

View File

@ -491,6 +491,7 @@ export default {
this.elKey++;
this.onWarningInfoNav(0);
this.sumCostOutByDeptId();
}));
this.$bus.$on("deptChange", debounce(dept => {
this.deptInfo = dept;
@ -502,6 +503,31 @@ export default {
}));
},
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){
let idx=0;
if(p.event.target.parent.style && p.event.target.parent.style.text){
@ -633,7 +659,6 @@ export default {
},
init() {
this.localStorage = JSON.parse(localStorage.getItem("data1"))
//
@ -690,20 +715,7 @@ export default {
});
} else {
//
this.$api.attendance.getWorkAttendanceList(deptId).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 });
}
this.elDeptWorks++;
});
this.loadAttendanceData();
}
},
//

View File

@ -88,7 +88,7 @@
<div :class="infoNav == 1 ? 'active' : ''" @click="onWarningInfoNav(1, '今日出勤')">今日出勤
</div>
</div>
<el-row>
<el-row :key="elDeptWorks">
<el-col :span="8">
<div class="survey_content">
<div class="survey_content_img">
@ -752,7 +752,8 @@ export default {
mapName: '',
costOut: {},
finishBuildNode: [],
modleMap: []
modleMap: [],
elDeptWorks:0,
}
},
created() {
@ -950,6 +951,32 @@ export default {
//
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() {
if (this.infoNav == 0) {
@ -969,20 +996,7 @@ export default {
});
} else {
//
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 });
}
});
this.loadAttendanceData();
}
},
//

View File

@ -97,10 +97,14 @@ service.interceptors.response.use(res => {
}
return Promise.reject(new Error(msg))
} else if (code === 601) {
Message({ message: msg, type: 'warning' })
if(msg.indexOf('重复提交')==-1){
Message({ message: msg, type: 'warning' })
}
return Promise.reject('error')
} else if (code !== 200) {
Notification.error({ title: msg })
if(msg.indexOf('重复提交')==-1){
Notification.error({ title: msg })
}
return Promise.reject('error')
} else {
return res.data
@ -116,7 +120,9 @@ service.interceptors.response.use(res => {
} else if (message.includes("Request failed with status code")) {
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)
}
)