feat:完成员工概况模块接口调试

This commit is contained in:
xiongchengqiang 2020-05-20 10:56:46 +08:00
parent d8c0694830
commit c84f9f19e4
5 changed files with 73 additions and 48 deletions

View File

@ -21,7 +21,7 @@ export const apiEmployeesInfo = data => {
// 员工概况 // 员工概况
export const apiEmployeessItuation = 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 })
} }
/** /**

View File

@ -18,7 +18,9 @@ export default {
props: { props: {
dataInfo: { dataInfo: {
type: Object, type: Object,
default: () => { } default: () => {
return {}
}
}, },
title: { title: {
type: String, type: String,

View File

@ -4,19 +4,19 @@
<div class="staff-archives-title">员工数量</div> <div class="staff-archives-title">员工数量</div>
<div class="staff-archives-content"> <div class="staff-archives-content">
截至 截至
<span class="staff-archives-yellow">2020</span> <span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[0]}}</span>
<span class="staff-archives-yellow">2</span> <span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[1]}}</span>
<span class="staff-archives-yellow">20</span> <span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[2]}}</span>
<span class="staff-archives-yellow">浙江霖梓控股有限公司</span>在职员工总数为 <span class="staff-archives-yellow">{{dataInfo.departmentName}}</span>在职员工总数为
<span class="staff-archives-bule">134</span>其中管理人员 <span class="staff-archives-bule">{{dataInfo.totalStaffCount}}</span>其中管理人员
<span class="staff-archives-bule">134</span>占比 <span class="staff-archives-bule">{{dataInfo.managementCount}}</span>占比
<span class="staff-archives-bule">20.5%</span> <span class="staff-archives-bule">{{dataInfo.managementRate}}%</span>
</div> </div>
<div class="staff-archives-content"> <div class="staff-archives-content">
<span class="staff-archives-yellow">近三个月</span>新入职员工 <span class="staff-archives-yellow">近三个月</span>新入职员工
<span class="staff-archives-bule">134</span>离职员工 <span class="staff-archives-bule">{{dataInfo.newStaffCount}}</span>离职员工
<span class="staff-archives-bule">134</span>离职率为 <span class="staff-archives-bule">{{dataInfo.leaveStaffCount}}</span>离职率为
<span class="staff-archives-bule">134%</span> <span class="staff-archives-bule">{{dataInfo.leaveRate}}%</span>
</div> </div>
</div> </div>
</template> </template>
@ -26,7 +26,9 @@ export default {
props: { props: {
dataInfo: { dataInfo: {
type: Object, type: Object,
default: () => { } default: () => {
return {}
}
} }
}, },
data () { data () {
@ -36,7 +38,11 @@ export default {
}, },
computed: {}, computed: {},
beforeMount () { }, beforeMount () { },
mounted () { }, mounted () {
setTimeout(() => {
console.log('dataInfo22: ', this.dataInfo)
}, 1000)
},
methods: {}, methods: {},
watch: {} watch: {}

View File

@ -109,8 +109,12 @@ export default {
this.menuList = result this.menuList = result
}, },
onSubmit () { onSubmit () {
console.log('formInline', this.formInline) let obj = {
this.$emit('submit', 12) departmentId: this.formInline.departmentId,
beginDate: this.formInline.beginDate,
endDate: this.formInline.endDate
}
this.$emit('submit', obj)
}, },
restValue () { restValue () {
this.formInline = {} this.formInline = {}

View File

@ -8,16 +8,16 @@
<employees-number :dataInfo="dataInfo" /> <employees-number :dataInfo="dataInfo" />
</el-card> </el-card>
<div class="staff-archives-chart"> <div class="staff-archives-chart">
<el-card> <el-card v-if="dataInfo.genderDistribution">
<chart-form :dataInfo="dataInfo.genderDistribution" title="性别分布" /> <chart-form :dataInfo="dataInfo.genderDistribution" title="性别分布" />
</el-card> </el-card>
<el-card> <el-card v-if="dataInfo.ageDistribution">
<chart-form :dataInfo="dataInfo.ageDistribution" title="年龄分布" /> <chart-form :dataInfo="dataInfo.ageDistribution" title="年龄分布" />
</el-card> </el-card>
<el-card> <el-card v-if="dataInfo.jobSeniorityDistribution">
<chart-form :dataInfo="dataInfo.jobSeniorityDistribution" title="岗位工龄分布" /> <chart-form :dataInfo="dataInfo.jobSeniorityDistribution" title="岗位工龄分布" />
</el-card> </el-card>
<el-card> <el-card v-if="dataInfo.educationDistribution">
<chart-form :dataInfo="dataInfo.educationDistribution" title="学历分布" /> <chart-form :dataInfo="dataInfo.educationDistribution" title="学历分布" />
</el-card> </el-card>
</div> </div>
@ -30,6 +30,7 @@ import chartForm from './componments/chart-form'
import queryForm from './componments/query-form' import queryForm from './componments/query-form'
import employeesNumber from './componments/employees-number' import employeesNumber from './componments/employees-number'
import { apiEmployeessItuation } from '@/api/api_staff'
export default { export default {
components: { components: {
chartForm, chartForm,
@ -47,38 +48,50 @@ export default {
this.initData() this.initData()
}, },
methods: { 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 () { async initData () {
const dataInfo = { this.handleGetEmployeessItuation()
beginDate: '2020-03-03',
endDate: '2020-05-16', // const dataInfo = {
departmentName: '技术部', // beginDate: '2020-03-03',
totalStaffCount: '300', // endDate: '2020-05-16',
managementCount: '24', // departmentName: '',
managementRate: '25%', // totalStaffCount: '300',
newStaffCount: '20', // managementCount: '24',
leaveStaffCount: '2', // managementRate: '25%',
leaveRate: '15%', // newStaffCount: '20',
genderDistribution: { // leaveStaffCount: '2',
columns: ['分类', '数量', '占比'], // leaveRate: '15%',
rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 100, '占比': '40%' }] // genderDistribution: {
}, // columns: ['', '', ''],
ageDistribution: { // rows: [{ '': '', '': 153, '': '60%' }, { '': '', '': 100, '': '40%' }]
columns: ['分类', '数量', '占比'], // },
rows: [{ '分类': '10-20', '数量': 153, '占比': '60%' }, { '分类': '20-30', '数量': 60, '占比': '40%' }, { '分类': '30-40', '数量': 10, '占比': '40%' }] // ageDistribution: {
}, // columns: ['', '', ''],
jobSeniorityDistribution: { // rows: [{ '': '10-20', '': 153, '': '60%' }, { '': '20-30', '': 60, '': '40%' }, { '': '30-40', '': 10, '': '40%' }]
columns: ['分类', '数量', '占比'], // },
rows: [{ '分类': '男', '数量': 153, '占比': '60%' }, { '分类': '女', '数量': 60, '占比': '40%' }] // jobSeniorityDistribution: {
}, // columns: ['', '', ''],
educationDistribution: { // rows: [{ '': '', '': 153, '': '60%' }, { '': '', '': 60, '': '40%' }]
columns: ['分类', '数量', '占比'], // },
rows: [{ '分类': '专科', '数量': 13, '占比': '60%' }, { '分类': '本科', '数量': 100, '占比': '40%' }, { '分类': '研究生', '数量': 60, '占比': '40%' }, { '分类': '博士', '数量': 10, '占比': '40%' }] // educationDistribution: {
} // columns: ['', '', ''],
} // rows: [{ '': '', '': 13, '': '60%' }, { '': '', '': 100, '': '40%' }, { '': '', '': 60, '': '40%' }, { '': '', '': 10, '': '40%' }]
this.dataInfo = dataInfo // }
// }
// this.dataInfo = dataInfo
}, },
submit (data) { submit (data) {
this.handleGetEmployeessItuation(data)
console.log('data', data) console.log('data', data)
} }
}, },