人员增长趋势
@@ -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 @@