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 => {
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: {
dataInfo: {
type: Object,
default: () => { }
default: () => {
return {}
}
},
title: {
type: String,

View File

@ -4,19 +4,19 @@
<div class="staff-archives-title">员工数量</div>
<div class="staff-archives-content">
截至
<span class="staff-archives-yellow">2020</span>
<span class="staff-archives-yellow">2</span>
<span class="staff-archives-yellow">20</span>
<span class="staff-archives-yellow">浙江霖梓控股有限公司</span>在职员工总数为
<span class="staff-archives-bule">134</span>其中管理人员
<span class="staff-archives-bule">134</span>占比
<span class="staff-archives-bule">20.5%</span>
<span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[0]}}</span>
<span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[1]}}</span>
<span class="staff-archives-yellow">{{dataInfo.endDate.split("-")[2]}}</span>
<span class="staff-archives-yellow">{{dataInfo.departmentName}}</span>在职员工总数为
<span class="staff-archives-bule">{{dataInfo.totalStaffCount}}</span>其中管理人员
<span class="staff-archives-bule">{{dataInfo.managementCount}}</span>占比
<span class="staff-archives-bule">{{dataInfo.managementRate}}%</span>
</div>
<div class="staff-archives-content">
<span class="staff-archives-yellow">近三个月</span>新入职员工
<span class="staff-archives-bule">134</span>离职员工
<span class="staff-archives-bule">134</span>离职率为
<span class="staff-archives-bule">134%</span>
<span class="staff-archives-bule">{{dataInfo.newStaffCount}}</span>离职员工
<span class="staff-archives-bule">{{dataInfo.leaveStaffCount}}</span>离职率为
<span class="staff-archives-bule">{{dataInfo.leaveRate}}%</span>
</div>
</div>
</template>
@ -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: {}

View File

@ -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 = {}

View File

@ -8,16 +8,16 @@
<employees-number :dataInfo="dataInfo" />
</el-card>
<div class="staff-archives-chart">
<el-card>
<el-card v-if="dataInfo.genderDistribution">
<chart-form :dataInfo="dataInfo.genderDistribution" title="性别分布" />
</el-card>
<el-card>
<el-card v-if="dataInfo.ageDistribution">
<chart-form :dataInfo="dataInfo.ageDistribution" title="年龄分布" />
</el-card>
<el-card>
<el-card v-if="dataInfo.jobSeniorityDistribution">
<chart-form :dataInfo="dataInfo.jobSeniorityDistribution" title="岗位工龄分布" />
</el-card>
<el-card>
<el-card v-if="dataInfo.educationDistribution">
<chart-form :dataInfo="dataInfo.educationDistribution" title="学历分布" />
</el-card>
</div>
@ -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)
}
},