update code

prv
haha 2024-01-16 22:54:45 +08:00
parent cd5e3da32d
commit 4dee34f05a
3 changed files with 118 additions and 14 deletions

View File

@ -6,7 +6,14 @@ const getWorkTrainList=(trainType,deptId,projectId)=> {
method: 'get'
})
}
const getGroupByDataType=(deptId,projectId)=> {
return request({
url: `bgscreen/workTrain/getGroupByDataType?deptId=${deptId||0}&projectId=${projectId||0}`,
method: 'get'
})
}
export default{
getWorkTrainList
getWorkTrainList,
getGroupByDataType
}

View File

@ -72,7 +72,9 @@
</module-one-3-1>
</el-col>
<el-col :span="6">
<module-one-1-1 label="专项培训">
<module-one-1-1 :label="'专项培训('+WorkTrainCnt1+')'">
<enginChart ref="chart3" :height="300"></enginChart>
<!--
<div style="padding:10px" class="train-list scroll">
<div v-for="(it, index) in workTrainList" :key="index" class="transition-item"
@click="doShowDlgTrain(it, 0)">
@ -102,9 +104,11 @@
<img src="images/nodata.png" style="width: 240px;">
<div style="text-align: center;">暂无数据</div>
</div>
</div>
</div>-->
</module-one-1-1>
<module-one-1-1 label="应急演练">
<module-one-1-1 :label="'应急演练('+WorkTrainCnt2+')'">
<enginChart ref="chart4" :height="300"></enginChart>
<!--
<div style="padding:10px" class="train-list scroll">
<div v-for="(it, index) in emergencyDrillList" :key="index" class="transition-item"
@click="doShowDlgTrain(it, 1)">
@ -134,7 +138,7 @@
<img src="images/nodata.png" style="width: 240px;">
<div style="text-align: center;">暂无数据</div>
</div>
</div>
</div>-->
</module-one-1-1>
<module-one-1-1 label="特种作业人员">
<div class="quality-table special-table">
@ -301,12 +305,13 @@ import projectInsuranceDlg from './safe/projectInsuranceDlg.vue'
import AttendanceDetailDialog from './components/AttendanceDetailDialog.vue'
import JobWorkerDialog from './components/JobWorkerDialog.vue'
import debounce from 'lodash.debounce'
import enginChart from './engin/enginChart.vue'
export default {
components: {
worktrainDlg,
projectSpecialDlg,
ProblemmodifyDetail,AttendanceDetailDialog,
projectInsuranceDlg,JobWorkerDialog
projectInsuranceDlg,JobWorkerDialog,enginChart
},
data() {
return {
@ -324,6 +329,12 @@ export default {
fontSize: '12px',
height: '32px'
},
//1
WorkTrainCnt1:0,
WorkTrainChart1:[],
//2
WorkTrainCnt2:0,
WorkTrainChart2:[],
//
workTrainList: [],
//
@ -393,8 +404,9 @@ export default {
this.$bus.$on("projectChange", debounce(res => {
this.projectInfo=res;
this.doDeptChane();
this.getWorkTrainList();
this.getEmergencyDrillList();
this.getWorkTrainChart();
//this.getWorkTrainList();
//this.getEmergencyDrillList();
this.getProjectSpecialView();
this.getDeptSafetyWorksList();
this.getProjectInsuranceList();
@ -405,8 +417,8 @@ export default {
this.$bus.$on("deptChange", debounce(dept => {
this.dept = dept;
this.doDeptChane();
this.getWorkTrainList();
this.getEmergencyDrillList();
//this.getWorkTrainList();
//this.getEmergencyDrillList();
this.getProjectSpecialView();
this.getDeptSafetyWorksList();
this.getProjectInsuranceList();
@ -437,8 +449,9 @@ export default {
this.dept=this.$root.dept||{};
this.projects=this.$root.projects||[];
this.doDeptChane();
this.getWorkTrainList();
this.getEmergencyDrillList();
this.getWorkTrainChart();
//this.getWorkTrainList();
//this.getEmergencyDrillList();
this.getProjectSpecialView();
this.getDeptSafetyWorksList();
this.getProjectInsuranceList();
@ -478,6 +491,90 @@ export default {
this.fileTitle = _title;
});
},
getWorkTrainChart(){
this.$api.workTrain.getGroupByDataType(this.dept?.id||0,this.projectInfo?.id||0).then(d => {
this.WorkTrainChart1=(d.data||[]).filter(it=>it.trainType==='a').map(it=>{return {value:it.id||0,name:it.trainTitle}});
this.WorkTrainChart2=(d.data||[]).filter(it=>it.trainType==='b').map(it=>{return {value:it.id||0,name:it.trainTitle}});
let cnt=0;
this.WorkTrainChart1.forEach(it=>{cnt+=it.value||0;})
this.WorkTrainCnt1=cnt;
cnt=0;
this.WorkTrainChart2.forEach(it=>{cnt+=it.value||0;})
this.WorkTrainCnt2=cnt;
let opt = {
tooltip: {
trigger: 'item'
},
series: [{
type: 'pie',
radius: '60%',
data: this.WorkTrainChart1,
label: {
color: "#fff",
formatter: '{name|{b}}\n{cnt|{c}}',
rich: {
name:{
},
cnt: {
fontSize: 10,
color: '#eee'
}
}
},
}
]
};
this.$refs.chart3.init(opt);
let tmps=this.WorkTrainChart2;
let opt2 = {
grid: {
left: 10,
right:10,
top:40,
bottom:60
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
color: ['#409eff'],
xAxis: {
type: 'category',
data: tmps.map(d => d.name.replace("演练","\n演练")),
axisLabel: {
color: "#fff",
fontSize:10,
}
},
yAxis: {
type: 'value',
axisLabel: {
show:false,
color: "#fff"
}
},
series: [
{
label: {
show:true,
color: '#82c9ff',
position: 'top',
},
data: tmps.map(d => d.value),
type: 'bar'
}
]
};
this.$refs.chart4.init(opt2);
});
},
//
getWorkTrainList() {
this.$api.workTrain.getWorkTrainList(0, this.dept?.id||0,this.projectInfo?.id||0).then(d => {

View File

@ -37,8 +37,8 @@ module.exports = defineConfig({
}
},
'/jhapi':{
target: `http://62.234.3.186/jhapi/`,
//target: `http://127.0.0.1:8090/jhapi/`,
//target: `http://62.234.3.186/jhapi/`,
target: `http://127.0.0.1:8090/jhapi/`,
changeOrigin: true,
pathRewrite: {
'^/jhapi':'/'