中建四(安全管理):人员管理年龄段趋势接口对接

This commit is contained in:
骆乐 2022-09-19 14:04:27 +08:00
parent 5608634878
commit 7e7ae63e56
4 changed files with 61 additions and 44 deletions

View File

@ -34,5 +34,7 @@ export const listProgressOfTheTask = params => get('xmgl/progressItem/getSchedul
/* --------------安全管理------------ */
// 人员管理
export const getWorkerNumApi = data => get('xmgl/workerInfo/getPersonnelNum',data)
// 时间区间查询人员增长趋势
// 人员增长趋势
export const getWorkerGrowthApi = data => get('xmgl/workerInfo/getPersonnelGrowth',data)
// 员工申报年龄段
export const getDeclareAgeApi = data => get('/xmgl/workerInfo/getDeclareAge',data)

View File

@ -4,7 +4,7 @@
<div class="dllm">
<div class="chart">
<JRingChart
:title="{ text: '质量验收', subTitle: '2314件',fontSize: 14 }"
:title="{ text: '质量验收', subTitle: '2314件',fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']"
:data="[{ value: 2314, name: '已验收' }, { value: 987 ,name: '未验收'}]"
:radius="['60%', '80%']"
@ -35,7 +35,7 @@
<div class="dllm">
<div class="chart">
<JRingChart
:title="{ text: '质量整改', subTitle: '987件',fontSize: 14 }"
:title="{ text: '质量整改', subTitle: '987件',fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']"
:data="[{ value: 2314,name: '已整改' }, { value: 987,name: '未整改' }]"
:radius="['60%', '80%']"

View File

@ -39,12 +39,12 @@
<div class="left">
<span>员工申报年龄段</span>
<el-date-picker
v-model="value1"
v-model="time1"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-DD"
value-format="yyyy-MM-dd"
@change="getTime1"
></el-date-picker>
<JBarChart
@ -52,17 +52,22 @@
:xData="xData"
:series="series"
:grid="grid"
v-if="series[0].data.length != 0"
/>
<div class="nodata" v-else>
<img src="@/assets/images/noData3.png" alt srcset />
<p>暂无数据</p>
</div>
</div>
<div class="right">
<span>人员增长趋势</span>
<el-date-picker
v-model="value2"
v-model="time2"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-DD"
value-format="yyyy-MM-dd"
@change="getTime2"
></el-date-picker>
<div v-if="xdata2.length != 0" class="rightChart" ref="rightChart"></div>
@ -82,6 +87,7 @@ import JBarChart from "../../common/jChart/bar/JBarChart.vue";
import {
getWorkerNumApi,
getWorkerGrowthApi,
getDeclareAgeApi
} from "@/assets/js/api/zhongjianFourth";
import echarts from "echarts4";
export default {
@ -89,15 +95,14 @@ export default {
data() {
return {
WorkerNum: {},
time1: [],
time2: [],
value1: "",
value2: "",
time1:["2022-08-19","2022-09-19"],
time2: ["2022-08-19","2022-09-19"],
xData: ["18-24", "25-34", "34-49", "50-55", "未登记"],
grid: ["10%", "2%", "18%", "10%"],
series: [
{
data: ["2200", "4000", "8000", "3000", "8000"],
// "2200", "4000", "8000", "3000", "8000"
data: [],
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#DE5F2A" },
@ -110,19 +115,45 @@ export default {
ydata2: [],
};
},
created(){
this.time1 = this.getDefaultTime();
this.time2 = this.getDefaultTime();
},
mounted() {
this.getData();
this.getAgeData();
this.getYearData();
},
watch: {
time1: {
handler(oldVal, newVal) {
if (oldVal != newVal) {
this.getAgeData();
}
},
immediate:true,
},
time2: {
handler(oldVal, newVal) {
if (oldVal != newVal) {
this.getYearData();
}
},
immediate:true,
},
},
methods: {
getDefaultTime () {
const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)
.toISOString()
.replace('T', ' ')
.split('.')[0].split(' ')[0] //30
const end = new Date(new Date().getTime())
.toISOString()
.replace('T', ' ')
.split('.')[0].split(' ')[0]//
return [start, end]
},
getData() {
getWorkerNumApi({ projectSn: this.$store.state.projectSn }).then(
(res) => {
@ -131,13 +162,24 @@ export default {
);
},
getTime1(val) {
console.log("-----时间", val);
this.time1 = val;
},
getTime2(val) {
console.log("-----时间", val);
this.time2 = val;
},
getAgeData(){
let data = {}
data.projectSn = this.$store.state.projectSn;
if (this.time1 != null) {
data.startDate = this.time1[0];
data.endDate = this.time1[1];
getDeclareAgeApi(data).then((res)=>{
if(JSON.stringify(res.result) != "{}"){
this.series[0].data = Object.values(res.result)
}
})
}
},
getYearData() {
let data = {};
data.projectSn = this.$store.state.projectSn;
@ -145,7 +187,7 @@ export default {
data.startDate = this.time2[0];
data.endDate = this.time2[1];
getWorkerGrowthApi(data).then((res) => {
console.log("======", res);
console.log('---趋势--',res)
if (res.reult != null) {
this.xdata2 = result.map((item) => {
return item.date;
@ -155,33 +197,6 @@ export default {
});
this.createChart();
}
// let result = [
// {
// date: "2021-07",
// count: "3",
// },
// {
// date: "2021-09",
// count: "2",
// },
// {
// date: "2021-11",
// count: "3",
// },
// {
// date: "2021-12",
// count: "7",
// },
// {
// date: "2022-03",
// count: "2",
// },
// {
// date: "2022-07",
// count: "3",
// },
// ]
});
}
},

View File

@ -4,7 +4,7 @@
<div class="dllm">
<div class="woria">
<JRingChart
:title="{ text: '安全隐患', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:title="{ text: '安全隐患', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']"
:data="[{ value: safetyPeril.rectificationNum, name:'已处理' }, { value: safetyPeril.noRectificationNum, name:'未处理' }]"
:radius="['60%', '85%']"
@ -35,7 +35,7 @@
<div class="dllm">
<div class="woria">
<JRingChart
:title="{ text: '今日巡检', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:title="{ text: '今日巡检', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']"
:data="[{ value: todayInspection.rectificationNum, name:'已巡检' }, { value: todayInspection.noRectificationNum, name:'未巡检' }]"
:radius="['60%', '85%']"