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

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 getWorkerNumApi = data => get('xmgl/workerInfo/getPersonnelNum',data)
// 时间区间查询人员增长趋势 // 人员增长趋势
export const getWorkerGrowthApi = data => get('xmgl/workerInfo/getPersonnelGrowth',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="dllm">
<div class="chart"> <div class="chart">
<JRingChart <JRingChart
:title="{ text: '质量验收', subTitle: '2314件',fontSize: 14 }" :title="{ text: '质量验收', subTitle: '2314件',fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']" :color="['#6EE4F0', '#E7622A']"
:data="[{ value: 2314, name: '已验收' }, { value: 987 ,name: '未验收'}]" :data="[{ value: 2314, name: '已验收' }, { value: 987 ,name: '未验收'}]"
:radius="['60%', '80%']" :radius="['60%', '80%']"
@ -35,7 +35,7 @@
<div class="dllm"> <div class="dllm">
<div class="chart"> <div class="chart">
<JRingChart <JRingChart
:title="{ text: '质量整改', subTitle: '987件',fontSize: 14 }" :title="{ text: '质量整改', subTitle: '987件',fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']" :color="['#6EE4F0', '#E7622A']"
:data="[{ value: 2314,name: '已整改' }, { value: 987,name: '未整改' }]" :data="[{ value: 2314,name: '已整改' }, { value: 987,name: '未整改' }]"
:radius="['60%', '80%']" :radius="['60%', '80%']"

View File

@ -39,12 +39,12 @@
<div class="left"> <div class="left">
<span>员工申报年龄段</span> <span>员工申报年龄段</span>
<el-date-picker <el-date-picker
v-model="value1" v-model="time1"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-DD" value-format="yyyy-MM-dd"
@change="getTime1" @change="getTime1"
></el-date-picker> ></el-date-picker>
<JBarChart <JBarChart
@ -52,17 +52,22 @@
:xData="xData" :xData="xData"
:series="series" :series="series"
:grid="grid" :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>
<div class="right"> <div class="right">
<span>人员增长趋势</span> <span>人员增长趋势</span>
<el-date-picker <el-date-picker
v-model="value2" v-model="time2"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-DD" value-format="yyyy-MM-dd"
@change="getTime2" @change="getTime2"
></el-date-picker> ></el-date-picker>
<div v-if="xdata2.length != 0" class="rightChart" ref="rightChart"></div> <div v-if="xdata2.length != 0" class="rightChart" ref="rightChart"></div>
@ -82,6 +87,7 @@ import JBarChart from "../../common/jChart/bar/JBarChart.vue";
import { import {
getWorkerNumApi, getWorkerNumApi,
getWorkerGrowthApi, getWorkerGrowthApi,
getDeclareAgeApi
} from "@/assets/js/api/zhongjianFourth"; } from "@/assets/js/api/zhongjianFourth";
import echarts from "echarts4"; import echarts from "echarts4";
export default { export default {
@ -89,15 +95,14 @@ export default {
data() { data() {
return { return {
WorkerNum: {}, WorkerNum: {},
time1: [], time1:["2022-08-19","2022-09-19"],
time2: [], time2: ["2022-08-19","2022-09-19"],
value1: "",
value2: "",
xData: ["18-24", "25-34", "34-49", "50-55", "未登记"], xData: ["18-24", "25-34", "34-49", "50-55", "未登记"],
grid: ["10%", "2%", "18%", "10%"], grid: ["10%", "2%", "18%", "10%"],
series: [ series: [
{ {
data: ["2200", "4000", "8000", "3000", "8000"], // "2200", "4000", "8000", "3000", "8000"
data: [],
itemStyle: { itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#DE5F2A" }, { offset: 0, color: "#DE5F2A" },
@ -110,19 +115,45 @@ export default {
ydata2: [], ydata2: [],
}; };
}, },
created(){
this.time1 = this.getDefaultTime();
this.time2 = this.getDefaultTime();
},
mounted() { mounted() {
this.getData(); this.getData();
this.getAgeData();
this.getYearData();
}, },
watch: { watch: {
time1: {
handler(oldVal, newVal) {
if (oldVal != newVal) {
this.getAgeData();
}
},
immediate:true,
},
time2: { time2: {
handler(oldVal, newVal) { handler(oldVal, newVal) {
if (oldVal != newVal) { if (oldVal != newVal) {
this.getYearData(); this.getYearData();
} }
}, },
immediate:true,
}, },
}, },
methods: { 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() { getData() {
getWorkerNumApi({ projectSn: this.$store.state.projectSn }).then( getWorkerNumApi({ projectSn: this.$store.state.projectSn }).then(
(res) => { (res) => {
@ -131,13 +162,24 @@ export default {
); );
}, },
getTime1(val) { getTime1(val) {
console.log("-----时间", val);
this.time1 = val; this.time1 = val;
}, },
getTime2(val) { getTime2(val) {
console.log("-----时间", val);
this.time2 = 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() { getYearData() {
let data = {}; let data = {};
data.projectSn = this.$store.state.projectSn; data.projectSn = this.$store.state.projectSn;
@ -145,7 +187,7 @@ export default {
data.startDate = this.time2[0]; data.startDate = this.time2[0];
data.endDate = this.time2[1]; data.endDate = this.time2[1];
getWorkerGrowthApi(data).then((res) => { getWorkerGrowthApi(data).then((res) => {
console.log("======", res); console.log('---趋势--',res)
if (res.reult != null) { if (res.reult != null) {
this.xdata2 = result.map((item) => { this.xdata2 = result.map((item) => {
return item.date; return item.date;
@ -155,33 +197,6 @@ export default {
}); });
this.createChart(); 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="dllm">
<div class="woria"> <div class="woria">
<JRingChart <JRingChart
:title="{ text: '安全隐患', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }" :title="{ text: '安全隐患', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']" :color="['#6EE4F0', '#E7622A']"
:data="[{ value: safetyPeril.rectificationNum, name:'已处理' }, { value: safetyPeril.noRectificationNum, name:'未处理' }]" :data="[{ value: safetyPeril.rectificationNum, name:'已处理' }, { value: safetyPeril.noRectificationNum, name:'未处理' }]"
:radius="['60%', '85%']" :radius="['60%', '85%']"
@ -35,7 +35,7 @@
<div class="dllm"> <div class="dllm">
<div class="woria"> <div class="woria">
<JRingChart <JRingChart
:title="{ text: '今日巡检', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }" :title="{ text: '今日巡检', subTitle: `${todayInspection.totalNum}件`, fontSize: 14 }"
:color="['#6EE4F0', '#E7622A']" :color="['#6EE4F0', '#E7622A']"
:data="[{ value: todayInspection.rectificationNum, name:'已巡检' }, { value: todayInspection.noRectificationNum, name:'未巡检' }]" :data="[{ value: todayInspection.rectificationNum, name:'已巡检' }, { value: todayInspection.noRectificationNum, name:'未巡检' }]"
:radius="['60%', '85%']" :radius="['60%', '85%']"