From 7e7ae63e5660be13803a493835e6a93a8f20a3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=86=E4=B9=90?= <342503599@qq.com> Date: Mon, 19 Sep 2022 14:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=BB=BA=E5=9B=9B(=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E7=AE=A1=E7=90=86):=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=B9=B4=E9=BE=84=E6=AE=B5=E8=B6=8B=E5=8A=BF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/api/zhongjianFourth.js | 4 +- .../projectAdmin/zjsj/quality/leftTop.vue | 4 +- .../projectAdmin/zjsj/security/centerTop.vue | 93 +++++++++++-------- .../projectAdmin/zjsj/security/leftTop.vue | 4 +- 4 files changed, 61 insertions(+), 44 deletions(-) diff --git a/src/assets/js/api/zhongjianFourth.js b/src/assets/js/api/zhongjianFourth.js index 21596306..0a2a5cde 100644 --- a/src/assets/js/api/zhongjianFourth.js +++ b/src/assets/js/api/zhongjianFourth.js @@ -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) \ No newline at end of file diff --git a/src/views/projectAdmin/zjsj/quality/leftTop.vue b/src/views/projectAdmin/zjsj/quality/leftTop.vue index fc5ce9a5..b6ecf34c 100644 --- a/src/views/projectAdmin/zjsj/quality/leftTop.vue +++ b/src/views/projectAdmin/zjsj/quality/leftTop.vue @@ -4,7 +4,7 @@
员工申报年龄段 +
+ +

暂无数据

+
人员增长趋势
@@ -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", - // }, - // ] - }); } }, diff --git a/src/views/projectAdmin/zjsj/security/leftTop.vue b/src/views/projectAdmin/zjsj/security/leftTop.vue index a339a070..05507833 100644 --- a/src/views/projectAdmin/zjsj/security/leftTop.vue +++ b/src/views/projectAdmin/zjsj/security/leftTop.vue @@ -4,7 +4,7 @@