|
@@ -3,7 +3,7 @@
|
|
|
<el-row style="min-width:1160px;">
|
|
|
<div class="flex-box-ce">
|
|
|
<div>
|
|
|
- <el-select v-model="select_employee_id" filterable placeholder="请输入或选择人员">
|
|
|
+ <el-select v-model="select_employee_id" @change="selectEmployeeChange" filterable placeholder="请输入或选择人员">
|
|
|
<el-option v-for="item in employee_map" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
@@ -277,7 +277,7 @@ export default {
|
|
|
monthORyear: '2',
|
|
|
|
|
|
//选择人员
|
|
|
- select_employee_id: this.$getUserData().name,
|
|
|
+ select_employee_id: '',
|
|
|
employee_map: '', //获取人员列表
|
|
|
|
|
|
dept_list: '',
|
|
@@ -360,14 +360,30 @@ export default {
|
|
|
this.monthlyIntegral();
|
|
|
},
|
|
|
|
|
|
- select_employee_id(val) {
|
|
|
- this.formData.employee_id = val;
|
|
|
- this.executiveFunction(true);
|
|
|
- }
|
|
|
+ // select_employee_id(val) {
|
|
|
+ // this.formData.employee_id = val;
|
|
|
+ // this.executiveFunction(true);
|
|
|
+ // }
|
|
|
},
|
|
|
mounted() {
|
|
|
window.addEventListener('resize', this.selfAdaption);
|
|
|
- this.getEmployee();
|
|
|
+ this.getEmployee().then(res =>{
|
|
|
+ // if (this.$getUserData()) {
|
|
|
+ // this.personnel = this.$getUserData();
|
|
|
+ // let dept_li = this.personnel.employee_detail.dept_list;
|
|
|
+ // let dept_ = '';
|
|
|
+ // for (let i in dept_li) {
|
|
|
+ // dept_ += dept_li[i].dept_name + ' ';
|
|
|
+ // }
|
|
|
+ // this.dept_list = dept_;
|
|
|
+ // } else {
|
|
|
+ // this.personnelDetails(); //获取人员详情
|
|
|
+ // }
|
|
|
+ this.formData.month = this.$moment().format('YYYY-MM');
|
|
|
+ this.executiveFunction();
|
|
|
+ }).catch((err) =>{
|
|
|
+ console.log(err)
|
|
|
+ });
|
|
|
// if(JSON.parse(localStorage.getItem("SET_EMPLOYEE_MAP"))){
|
|
|
// this.employee_map = JSON.parse(localStorage.getItem("SET_EMPLOYEE_MAP"))
|
|
|
// }else{
|
|
@@ -388,36 +404,66 @@ export default {
|
|
|
// } else {
|
|
|
// this.personnelDetails(); //获取人员详情
|
|
|
// }
|
|
|
- if (this.$getUserData()) {
|
|
|
- this.personnel = this.$getUserData();
|
|
|
- let dept_li = this.personnel.employee_detail.dept_list;
|
|
|
- let dept_ = '';
|
|
|
- for (let i in dept_li) {
|
|
|
- dept_ += dept_li[i].dept_name + ' ';
|
|
|
- }
|
|
|
- this.dept_list = dept_;
|
|
|
- } else {
|
|
|
- this.personnelDetails(); //获取人员详情
|
|
|
- }
|
|
|
- this.formData.month = this.$moment().format('YYYY-MM');
|
|
|
- this.executiveFunction();
|
|
|
},
|
|
|
methods: {
|
|
|
+ selectEmployeeChange(val){
|
|
|
+ console.log(val)
|
|
|
+ this.formData.employee_id = val;
|
|
|
+ this.executiveFunction(true);
|
|
|
+ },
|
|
|
getType(id) {
|
|
|
return this.$getTyps(id).name;
|
|
|
},
|
|
|
|
|
|
//获取员工列表
|
|
|
getEmployee() {
|
|
|
- this.$axios('get', '/api/employee/index', { dept_id: 0, keywords: '', page: 1, page_size: 3000, is_official: 1 })
|
|
|
- .then(res => {
|
|
|
- let list = res.data.data.list;
|
|
|
- this.employee_map = list;
|
|
|
- // for(let i in list){
|
|
|
+ return new Promise((resolve, reject) =>{
|
|
|
+ this.personnelMessage = true;
|
|
|
+ this.$axios('get', '/api/employee/index', { dept_id: 0, keywords: '', page: 1, page_size: 3000, is_official: 1 })
|
|
|
+ .then(res => {
|
|
|
+ let list = res.data.data.list;
|
|
|
+ this.employee_map = list.filter(x => x.is_creator != 1)
|
|
|
+ if(this.employee_map.length == 0){
|
|
|
+ reject('err')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.$getUserData().is_creator == 1){
|
|
|
+ this.select_employee_id = this.employee_map[0].id
|
|
|
+ let employee = this.employee_map[0]
|
|
|
+ this.formData.employee_id = employee.id
|
|
|
+ this.personnel = employee
|
|
|
+ let dept_li = this.personnel.employee_detail.dept_list;
|
|
|
+ let dept_ = '';
|
|
|
+ for (let i in dept_li) {
|
|
|
+ dept_ += dept_li[i].dept_name + ' ';
|
|
|
+ }
|
|
|
+ this.dept_list = dept_;
|
|
|
+ }else{
|
|
|
+ if (this.$getUserData()) {
|
|
|
+ this.select_employee_id = this.$getUserData().name
|
|
|
+ this.personnel = this.$getUserData();
|
|
|
+ let dept_li = this.personnel.employee_detail.dept_list;
|
|
|
+ let dept_ = '';
|
|
|
+ for (let i in dept_li) {
|
|
|
+ dept_ += dept_li[i].dept_name + ' ';
|
|
|
+ }
|
|
|
+ this.dept_list = dept_;
|
|
|
+ } else {
|
|
|
+ this.personnelDetails(); //获取人员详情
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // this.employee_map = list;
|
|
|
+ // for(let i in list){
|
|
|
|
|
|
- // }
|
|
|
- })
|
|
|
- .finally(err => {});
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ .finally(err => {
|
|
|
+ this.personnelMessage = false;
|
|
|
+ resolve('res')
|
|
|
+ });
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
//echarts自适应
|