|
@@ -13,37 +13,41 @@
|
|
|
<el-form-item>
|
|
|
<el-date-picker
|
|
|
size="medium"
|
|
|
- v-show="time_type == '2'"
|
|
|
- v-model="export_from.year"
|
|
|
+ v-show="time_type == '1'"
|
|
|
+ v-model="formData.month"
|
|
|
class="date-picker-width"
|
|
|
- type="year"
|
|
|
- value-format="yyyy"
|
|
|
- placeholder="选择年份排名"
|
|
|
+ type="month"
|
|
|
+ :clearable="false"
|
|
|
+ value-format="yyyy-MM"
|
|
|
+ placeholder="选择月份排名"
|
|
|
></el-date-picker>
|
|
|
<el-date-picker
|
|
|
size="medium"
|
|
|
- v-show="time_type == '1' || time_type == '月份'"
|
|
|
- v-model="export_from.month"
|
|
|
+ v-show="time_type == '2'"
|
|
|
+ v-model="formData.year"
|
|
|
class="date-picker-width"
|
|
|
- type="month"
|
|
|
- value-format="yyyy-MM"
|
|
|
- placeholder="选择月份排名"
|
|
|
+ type="year"
|
|
|
+ :clearable="false"
|
|
|
+ value-format="yyyy"
|
|
|
+ placeholder="选择年份排名"
|
|
|
></el-date-picker>
|
|
|
- <season v-if="time_type == '3'" :isActive="true" class="date-picker-width" @confirm="export_quarter_confirm"></season>
|
|
|
-
|
|
|
+ <season v-if="time_type == '3'" class="date-picker-width" @confirm="export_quarter_confirm"></season>
|
|
|
<el-date-picker
|
|
|
size="medium"
|
|
|
v-show="time_type == '4'"
|
|
|
class="date-picker-width"
|
|
|
- v-model="export_from.time_range"
|
|
|
+ v-model="formData.time_range"
|
|
|
type="daterange"
|
|
|
- value-format="timestamp"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
range-separator="至"
|
|
|
+ :clearable="false"
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
|
:picker-options="instantPickerOptions"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+
|
|
|
<el-form-item label="部门">
|
|
|
<el-cascader
|
|
|
size="medium"
|
|
@@ -92,7 +96,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="人员">
|
|
|
<el-select size="medium" v-model="formData.position" style="width:150px" placeholder="请选择">
|
|
|
- <el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.age"></el-option>
|
|
|
+ <el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
@@ -157,7 +161,7 @@
|
|
|
v-model="Dc_Data.value1"
|
|
|
type="daterange"
|
|
|
size="medium"
|
|
|
- value-format="timestamp"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
@@ -167,7 +171,7 @@
|
|
|
|
|
|
<el-form-item label="人员" style="margin-left:30px">
|
|
|
<el-select size="medium" v-model="Dc_Data.DC_position" style="width:150px" placeholder="请选择">
|
|
|
- <el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.age"></el-option>
|
|
|
+ <el-option v-for="item in positions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
@@ -263,7 +267,7 @@ export default {
|
|
|
Dc_Data: {
|
|
|
//导出数据
|
|
|
value1: '', //时间
|
|
|
- DC_position: '全部', //人员
|
|
|
+ DC_position: 'all', //人员
|
|
|
dept_name: [], //部门
|
|
|
rule: [] ,//规则
|
|
|
pt_id: 3,
|
|
@@ -281,7 +285,11 @@ export default {
|
|
|
page: 1,
|
|
|
rule: '',
|
|
|
page_size: 10,
|
|
|
- position: 0 //部门多选删除这个
|
|
|
+ position: 'all' ,
|
|
|
+ year:moment().format('YYYY'),
|
|
|
+ month: moment().format('YYYY-MM'),
|
|
|
+ quarter: '',
|
|
|
+ time_range: []
|
|
|
},
|
|
|
total: null,
|
|
|
rule_trees: null,
|
|
@@ -293,16 +301,9 @@ export default {
|
|
|
time_types: [{ label: '月份', value: '1' }, { label: '季度', value: '3' }, { label: '年份', value: '2' }, { label: '自定义', value: '4' }],
|
|
|
props: { value: 'id', label: 'name', children: 'child', multiple: true },
|
|
|
props2: { value: 'id', label: 'name', children: 'child', checkStrictly: true},
|
|
|
- time_type: '月份',
|
|
|
- export_from: {
|
|
|
- year: '',
|
|
|
- month: moment().format('YYYY-MM'),
|
|
|
- quarter: '',
|
|
|
- // time_range: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime()]
|
|
|
- time_range: []
|
|
|
- },
|
|
|
+ time_type: '1',
|
|
|
employee_map: this.$getCache('SET_EMPLOYEE_MAP'),
|
|
|
- positions: [{ id: 0, age: 'all', name: '全部' }, { id: 1, age: 'manager', name: '管理者' }, { id: 2, age: 'employee', name: '员工' }],
|
|
|
+ positions: [{ id: 'all', name: '全部' }, { id:'manager', name: '管理者' }, { id: 'employee',name: '员工' }],
|
|
|
tips_show: false,
|
|
|
byRankingShow: false,
|
|
|
byRankingData: {
|
|
@@ -322,53 +323,53 @@ export default {
|
|
|
{
|
|
|
text: '今天',
|
|
|
onClick(picker) {
|
|
|
- const now = new Date(new Date().toLocaleDateString());
|
|
|
- const start = now.getTime();
|
|
|
- picker.$emit('pick', [start, start]);
|
|
|
+ const now = new Date(new Date().toLocaleDateString());
|
|
|
+ const start = now.getTime();
|
|
|
+ picker.$emit('pick', [moment(start).format('YYYY-MM-DD'), moment(start).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '昨天',
|
|
|
onClick(picker) {
|
|
|
- const now = new Date(new Date().toLocaleDateString());
|
|
|
- const start = now.getTime() - 60 * 60 * 24 * 1000;
|
|
|
- picker.$emit('pick', [start, start]);
|
|
|
+ const now = new Date(new Date().toLocaleDateString());
|
|
|
+ const start = now.getTime() - 60 * 60 * 24 * 1000;
|
|
|
+ picker.$emit('pick', [moment(start).format('YYYY-MM-DD'),moment(start).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '本周',
|
|
|
onClick(picker) {
|
|
|
- const now = new Date(new Date().toLocaleDateString());
|
|
|
- const start = now.getTime() - (now.getDay() - 1) * 24 * 60 * 60 * 1000;
|
|
|
- const end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const now = new Date(new Date().toLocaleDateString());
|
|
|
+ const start = now.getTime() - (now.getDay() - 1) * 24 * 60 * 60 * 1000;
|
|
|
+ const end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
|
|
|
+ picker.$emit('pick', [moment(start).format('YYYY-MM-DD'), moment(end).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '上周',
|
|
|
onClick(picker) {
|
|
|
- const now = new Date(new Date().toLocaleDateString());
|
|
|
- const start = now.getTime() - (now.getDay() + 6) * 24 * 60 * 60 * 1000;
|
|
|
- const end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const now = new Date(new Date().toLocaleDateString());
|
|
|
+ const start = now.getTime() - (now.getDay() + 6) * 24 * 60 * 60 * 1000;
|
|
|
+ const end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
|
|
|
+ picker.$emit('pick', [moment(start).format('YYYY-MM-DD'), moment(end).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '本月',
|
|
|
onClick(picker) {
|
|
|
const now = new Date();
|
|
|
- const startDate = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
|
- const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
|
- picker.$emit('pick', [startDate.getTime(), endDate.getTime()]);
|
|
|
+ const startDate = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
|
+ const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
|
+ picker.$emit('pick', [moment(startDate.getTime()).format('YYYY-MM-DD'), moment(endDate.getTime()).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
text: '上月',
|
|
|
onClick(picker) {
|
|
|
- const now = new Date();
|
|
|
- const startDate = new Date(now.getFullYear() - (now.getMonth() > 0 ? 0 : 1), (now.getMonth() + 11) % 12, 1);
|
|
|
- const endDate = new Date(now.getFullYear(), now.getMonth(), 0);
|
|
|
- picker.$emit('pick', [startDate.getTime(), endDate.getTime()]);
|
|
|
+ const now = new Date();
|
|
|
+ const startDate = new Date(now.getFullYear() - (now.getMonth() > 0 ? 0 : 1), (now.getMonth() + 11) % 12, 1);
|
|
|
+ const endDate = new Date(now.getFullYear(), now.getMonth(), 0);
|
|
|
+ picker.$emit('pick', [moment(startDate.getTime()).format('YYYY-MM-DD'), moment(endDate.getTime()).format('YYYY-MM-DD')]);
|
|
|
}
|
|
|
}
|
|
|
],
|
|
@@ -386,18 +387,27 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- pickerDisabledDate: {
|
|
|
- },
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- 'export_from.time_range'(){
|
|
|
+ time_type(val){
|
|
|
+ if(val=='1'){
|
|
|
+ this.selectBtn();
|
|
|
+ }else if(val=='2'){
|
|
|
+ this.selectBtn();
|
|
|
+ }else if(val=='3'){
|
|
|
+ // this.formData.quarter=moment().format('YYYY')+moment().format("Q");
|
|
|
+ }else {
|
|
|
+ this.formData.time_range=[moment().startOf('month').format('YYYY-MM-DD'),moment().endOf('month').format('YYYY-MM-DD')]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'formData.time_range'(){
|
|
|
this.selectBtn();
|
|
|
},
|
|
|
- 'export_from.year'(){
|
|
|
+ 'formData.year'(val,val2){
|
|
|
this.selectBtn();
|
|
|
},
|
|
|
- 'export_from.month'(){
|
|
|
+ 'formData.month'(){
|
|
|
this.selectBtn();
|
|
|
},
|
|
|
'formData.pt_id'(){
|
|
@@ -445,6 +455,7 @@ export default {
|
|
|
rule_id(val) {
|
|
|
if(val.length==0){
|
|
|
this.formData.rule='';
|
|
|
+ this.selectBtn();
|
|
|
return false
|
|
|
}
|
|
|
if(val.length==1){
|
|
@@ -500,14 +511,8 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
if(!date){
|
|
|
- // let month=moment().format('YYYY-MM').split("-");
|
|
|
- // date={type:3,year:month[0],month:month[1]<10? month[1].slice(1):month[1]}
|
|
|
- // this.getDate((res)=>{
|
|
|
- // parameter.start_date = this.$moment(Number(res.data.start+'000')).format('YYYY-MM-DD')
|
|
|
- // parameter.end_date = this.$moment(Number(res.data.end+'000')).format('YYYY-MM-DD')
|
|
|
data.parameter=JSON.stringify(parameter);
|
|
|
this.$router.push({path: '/JfDetail',query:data})
|
|
|
- // },date)
|
|
|
return false
|
|
|
}
|
|
|
if(parameter.time_type==4){
|
|
@@ -591,106 +596,64 @@ export default {
|
|
|
},
|
|
|
// 查询
|
|
|
selectBtn() {
|
|
|
- switch (this.time_type) {
|
|
|
- case '1':
|
|
|
- this.$set(this.formData, 'month', this.export_from.month);
|
|
|
- this.formData.month ? '' : delete this.formData.month;
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- this.$set(this.formData, 'year', this.export_from.year);
|
|
|
- this.formData.year ? '' : delete this.formData.year;
|
|
|
- break;
|
|
|
- case '月份':
|
|
|
- this.$set(this.formData, 'month', this.export_from.month);
|
|
|
- this.formData.month ? '' : delete this.formData.month;
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- this.$set(this.formData, 'quarter', this.export_from.quarter);
|
|
|
- this.formData.quarter ? '' : delete this.formData.quarter;
|
|
|
- break;
|
|
|
- case '4':
|
|
|
- this.$set(this.formData, 'time_range', this.export_from.time_range);
|
|
|
- this.formData.time_range ? '' : delete this.formData.time_range;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- // let data = JSON.parse(JSON.stringify(this.formData));
|
|
|
- let data = JSON.parse(JSON.stringify(this.formData));
|
|
|
- var employee_ids = data.exclusion.join(',');
|
|
|
- data.exclusion = employee_ids;
|
|
|
- data.page = 1;
|
|
|
- data.page_size = 10;
|
|
|
this.formData.page = 1;
|
|
|
this.formData.page_size = 10;
|
|
|
this.$nextTick(() => {
|
|
|
- this.get_list(data);
|
|
|
+ this.get_list();
|
|
|
});
|
|
|
},
|
|
|
// 页面变更
|
|
|
handleCurrentChange(val) {
|
|
|
this.formData.page = val;
|
|
|
- this.get_list(this.formData);
|
|
|
+ this.get_list();
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
this.formData.page = 1;
|
|
|
this.formData.page_size = val;
|
|
|
- this.get_list(this.formData);
|
|
|
+ this.get_list();
|
|
|
},
|
|
|
// 选择时间
|
|
|
export_quarter_confirm(val) {
|
|
|
- this.export_from.quarter = val;
|
|
|
+ this.formData.quarter = val;
|
|
|
this.selectBtn();
|
|
|
},
|
|
|
//请求数据
|
|
|
- get_list(data, bool) {
|
|
|
- if (this.time_type == 1) {
|
|
|
- delete data.year;
|
|
|
- delete data.quarter;
|
|
|
- delete data.time_range;
|
|
|
- } else if (this.time_type == 2) {
|
|
|
- delete data.month;
|
|
|
- delete data.quarter;
|
|
|
- delete data.time_range;
|
|
|
- } else if (this.time_type == '月份') {
|
|
|
- delete data.year;
|
|
|
- delete data.quarter;
|
|
|
- delete data.time_range;
|
|
|
- } else if (this.time_type == 3) {
|
|
|
- delete data.month;
|
|
|
- delete data.year;
|
|
|
- delete data.time_range;
|
|
|
- } else if (this.time_type == 4) {
|
|
|
- delete data.month;
|
|
|
- delete data.year;
|
|
|
- delete data.quarter;
|
|
|
- if(data.time_range && data.time_range.length > 0){
|
|
|
- data.start_date = moment(data.time_range[0]).format('YYYY-MM-DD')
|
|
|
- data.end_date = moment(data.time_range[1]).format('YYYY-MM-DD')
|
|
|
- }
|
|
|
- delete data.time_range
|
|
|
- }
|
|
|
- if (bool) {
|
|
|
- data.month = moment().format('YYYY-MM');
|
|
|
+ get_list() {
|
|
|
+ let data={
|
|
|
+ page: this.formData.page,
|
|
|
+ page_size: this.formData.page_size,
|
|
|
+ dept_id: this.formData.dept_id,
|
|
|
+ sort:this.formData.sort,
|
|
|
+ pt_id:this.formData.pt_id,
|
|
|
+ time_type: this.formData.time_type,
|
|
|
+ exclusion: this.formData.exclusion.toString(),
|
|
|
+ rule: this.formData.rule,
|
|
|
+ position: this.formData.position,
|
|
|
+ };
|
|
|
+ if(this.time_type==1||this.time_type=='月份'){
|
|
|
+ data.month=this.formData.month
|
|
|
+ }else if(this.time_type==2){
|
|
|
+ data.year=this.formData.year
|
|
|
+ }else if(this.time_type==3){
|
|
|
+ data.quarter=this.formData.quarter
|
|
|
+ }else if(this.time_type==4){
|
|
|
+ data.start_date= moment(this.formData.time_range[0]).format('YYYY-MM-DD')
|
|
|
+ data.end_date=moment(this.formData.time_range[1]).format('YYYY-MM-DD')
|
|
|
}
|
|
|
+
|
|
|
this.loading = true;
|
|
|
- data ? '' : (data = this.formData);
|
|
|
-
|
|
|
- data.position = data.position == 'manager' ? 'manager' : data.position == 'employee' ? 'employee' : 'all';
|
|
|
- this.$axios('get', '/api/integral/statistics/ranking', data, 'v2')
|
|
|
- .then(res => {
|
|
|
- this.labelName = this.formData.pt_id == 2 ? 'A分' : 'B分';
|
|
|
- if (res.data.code == 1) {
|
|
|
- this.list =this.$returnDeptName(res.data.data.list);
|
|
|
- this.total = res.data.data.total;
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.data.msg);
|
|
|
- }
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ this.$axios('get', '/api/integral/statistics/ranking', data, 'v2').then(res => {
|
|
|
+ this.labelName = this.formData.pt_id == 2 ? 'A分' : 'B分';
|
|
|
+ if (res.data.code == 1) {
|
|
|
+ this.list =this.$returnDeptName(res.data.data.list);
|
|
|
+ this.total = res.data.data.total;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
// 获取积分规则
|
|
|
get_rule_tree() {
|
|
@@ -737,27 +700,16 @@ export default {
|
|
|
},
|
|
|
|
|
|
exportExcel() {
|
|
|
- //人员
|
|
|
- this.Dc_Data.DC_position =
|
|
|
- this.Dc_Data.DC_position == 'manager' ? 'manager' : this.Dc_Data.DC_position == 'employee' ? 'employee' : this.Dc_Data.DC_position == '全部' ? 'all' : 'all';
|
|
|
//部门
|
|
|
let dept_name;
|
|
|
for (let i in this.Dc_Data.dept_name) {
|
|
|
dept_name = this.Dc_Data.dept_name[i];
|
|
|
}
|
|
|
this.Dc_Data.dept_name = dept_name;
|
|
|
- //规则
|
|
|
- // let rule_id = [];
|
|
|
- // for (let i in this.Dc_Data.rule_id) {
|
|
|
- // for (let a in this.Dc_Data.rule_id[i]) {
|
|
|
- // rule_id.push(this.Dc_Data.rule_id[i][a]);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.Dc_Data.rule_id = rule_id;
|
|
|
let data = '';
|
|
|
if (this.Dc_Data.value1) {
|
|
|
- data += '&start_date=' + moment(this.Dc_Data.value1[0]).format('YYYY-MM-DD');
|
|
|
- data += '&end_date=' + moment(this.Dc_Data.value1[1]).format('YYYY-MM-DD');
|
|
|
+ data += '&start_date=' + this.Dc_Data.value1[0];
|
|
|
+ data += '&end_date=' + this.Dc_Data.value1[1];
|
|
|
}
|
|
|
data += '&position=' + this.Dc_Data.DC_position;
|
|
|
this.Dc_Data.dept_name > 0 ? (data += '&dept_id=' + this.Dc_Data.dept_name) : (data += '&dept_id=0');
|
|
@@ -779,8 +731,8 @@ export default {
|
|
|
this.tips_show = this.$getCache('dept_rank_tips') ? false : true;
|
|
|
this.getDepartment();
|
|
|
this.getEmployeeList();
|
|
|
- this.get_list(this.formData, true);
|
|
|
this.get_rule_tree();
|
|
|
+ this.get_list();
|
|
|
}
|
|
|
};
|
|
|
</script>
|