diff --git a/src/api/api_staff.js b/src/api/api_staff.js index c40ff71..0c1fffe 100644 --- a/src/api/api_staff.js +++ b/src/api/api_staff.js @@ -21,7 +21,7 @@ export const apiEmployeesInfo = data => { // 员工概况 export const apiEmployeessItuation = data => { - return http({ url: '/lz_management/staff/statistical', method: 'post', data }) + return http({ url: '/lz_management/staff/info/statistical', method: 'get', params: data }) } /** diff --git a/src/views/modules/staff/profile/componments/chart-form/index.vue b/src/views/modules/staff/profile/componments/chart-form/index.vue index 783fdfb..cc29358 100644 --- a/src/views/modules/staff/profile/componments/chart-form/index.vue +++ b/src/views/modules/staff/profile/componments/chart-form/index.vue @@ -18,7 +18,9 @@ export default { props: { dataInfo: { type: Object, - default: () => { } + default: () => { + return {} + } }, title: { type: String, diff --git a/src/views/modules/staff/profile/componments/employees-number/index.vue b/src/views/modules/staff/profile/componments/employees-number/index.vue index e00c696..c28de2a 100644 --- a/src/views/modules/staff/profile/componments/employees-number/index.vue +++ b/src/views/modules/staff/profile/componments/employees-number/index.vue @@ -4,19 +4,19 @@
员工数量
截至 - 2020年 - 2月 - 20日, - 浙江霖梓控股有限公司在职员工总数为 - 134人,其中管理人员 - 134人,占比 - 20.5%。 + {{dataInfo.endDate.split("-")[0]}}年 + {{dataInfo.endDate.split("-")[1]}}月 + {{dataInfo.endDate.split("-")[2]}}日, + {{dataInfo.departmentName}}在职员工总数为 + {{dataInfo.totalStaffCount}}人,其中管理人员 + {{dataInfo.managementCount}}人,占比 + {{dataInfo.managementRate}}%。
近三个月新入职员工 - 134人,离职员工 - 134人,离职率为 - 134%。 + {{dataInfo.newStaffCount}}人,离职员工 + {{dataInfo.leaveStaffCount}}人,离职率为 + {{dataInfo.leaveRate}}%。
@@ -26,7 +26,9 @@ export default { props: { dataInfo: { type: Object, - default: () => { } + default: () => { + return {} + } } }, data () { @@ -36,7 +38,11 @@ export default { }, computed: {}, beforeMount () { }, - mounted () { }, + mounted () { + setTimeout(() => { + console.log('dataInfo22: ', this.dataInfo) + }, 1000) + }, methods: {}, watch: {} diff --git a/src/views/modules/staff/profile/componments/query-form/index.vue b/src/views/modules/staff/profile/componments/query-form/index.vue index 59071ef..e118bfe 100644 --- a/src/views/modules/staff/profile/componments/query-form/index.vue +++ b/src/views/modules/staff/profile/componments/query-form/index.vue @@ -109,8 +109,12 @@ export default { this.menuList = result }, onSubmit () { - console.log('formInline', this.formInline) - this.$emit('submit', 12) + let obj = { + departmentId: this.formInline.departmentId, + beginDate: this.formInline.beginDate, + endDate: this.formInline.endDate + } + this.$emit('submit', obj) }, restValue () { this.formInline = {} diff --git a/src/views/modules/staff/profile/index.vue b/src/views/modules/staff/profile/index.vue index 8d9bb11..a1a8f37 100644 --- a/src/views/modules/staff/profile/index.vue +++ b/src/views/modules/staff/profile/index.vue @@ -8,16 +8,16 @@
- + - + - + - +
@@ -30,6 +30,7 @@ import chartForm from './componments/chart-form' import queryForm from './componments/query-form' import employeesNumber from './componments/employees-number' +import { apiEmployeessItuation } from '@/api/api_staff' export default { components: { chartForm, @@ -47,38 +48,50 @@ export default { this.initData() }, methods: { + async handleGetEmployeessItuation (data = {}) { + let result = await apiEmployeessItuation(data) + console.log('result: ', result) + if (result.code === 0) { + this.dataInfo = result.data + } else { + this.$message.error(result.mgs) + } + }, // 获取页面数据 async initData () { - const dataInfo = { - beginDate: '2020-03-03', - endDate: '2020-05-16', - departmentName: '技术部', - totalStaffCount: '300', - managementCount: '24', - managementRate: '25%', - newStaffCount: '20', - leaveStaffCount: '2', - leaveRate: '15%', - genderDistribution: { - columns: ['分类', '数量', '占比'], - rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 100, '占比': '40%' }] - }, - ageDistribution: { - columns: ['分类', '数量', '占比'], - rows: [{ '分类': '10-20', '数量': 153, '占比': '60%' }, { '分类': '20-30', '数量': 60, '占比': '40%' }, { '分类': '30-40', '数量': 10, '占比': '40%' }] - }, - jobSeniorityDistribution: { - columns: ['分类', '数量', '占比'], - rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 60, '占比': '40%' }] - }, - educationDistribution: { - columns: ['分类', '数量', '占比'], - rows: [{ '分类': '专科', '数量': 13, '占比': '60%' }, { '分类': '本科', '数量': 100, '占比': '40%' }, { '分类': '研究生', '数量': 60, '占比': '40%' }, { '分类': '博士', '数量': 10, '占比': '40%' }] - } - } - this.dataInfo = dataInfo + this.handleGetEmployeessItuation() + + // const dataInfo = { + // beginDate: '2020-03-03', + // endDate: '2020-05-16', + // departmentName: '技术部', + // totalStaffCount: '300', + // managementCount: '24', + // managementRate: '25%', + // newStaffCount: '20', + // leaveStaffCount: '2', + // leaveRate: '15%', + // genderDistribution: { + // columns: ['分类', '数量', '占比'], + // rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 100, '占比': '40%' }] + // }, + // ageDistribution: { + // columns: ['分类', '数量', '占比'], + // rows: [{ '分类': '10-20', '数量': 153, '占比': '60%' }, { '分类': '20-30', '数量': 60, '占比': '40%' }, { '分类': '30-40', '数量': 10, '占比': '40%' }] + // }, + // jobSeniorityDistribution: { + // columns: ['分类', '数量', '占比'], + // rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 60, '占比': '40%' }] + // }, + // educationDistribution: { + // columns: ['分类', '数量', '占比'], + // rows: [{ '分类': '专科', '数量': 13, '占比': '60%' }, { '分类': '本科', '数量': 100, '占比': '40%' }, { '分类': '研究生', '数量': 60, '占比': '40%' }, { '分类': '博士', '数量': 10, '占比': '40%' }] + // } + // } + // this.dataInfo = dataInfo }, submit (data) { + this.handleGetEmployeessItuation(data) console.log('data', data) } },