152 lines
4.5 KiB
JavaScript
152 lines
4.5 KiB
JavaScript
import { observable, action } from 'mobx';
|
|
import * as API from '../apis/schedulediffmonthattdetail';
|
|
import * as Util from '../util/index';
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
import {Modal,message,Button} from 'antd'
|
|
import {WeaForm} from 'comsMobx'
|
|
import { toJS } from 'mobx';
|
|
import isEmpty from 'lodash/isEmpty';
|
|
import moment from 'moment';
|
|
import {WeaLocaleProvider} from 'ecCom';
|
|
import {addContentPath} from '../util/index.js'
|
|
const confirm = Modal.confirm;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
export class HrmScheduleDiffMonthAttDetail {
|
|
title = () => getLabel('82801',"月考勤日历报表");
|
|
dialogTitle = () => getLabel('386477',"考勤明细");
|
|
@observable loading = false;
|
|
@observable form = new WeaForm();
|
|
@observable config = [];
|
|
@observable configbak = [];
|
|
@observable configall = [];
|
|
@observable reportdata = {};
|
|
@observable visible = false;
|
|
@observable lastname = "";
|
|
@observable radiogroupdata = {};
|
|
@observable showFList = false;
|
|
@observable pDate = new moment().format('YYYY-MM-DD');
|
|
@observable table = {};
|
|
@observable table1 = {};
|
|
@observable resourceId = "";
|
|
|
|
@action
|
|
getSearchCondition(params={}, cb){
|
|
this.config = [];
|
|
this.configbak = [];
|
|
this.configall = [];
|
|
this.resourceId = "";
|
|
API.getSearchCondition(params).then(data=>{
|
|
if (data.status == '1') {
|
|
let c = cloneDeep(data.conditions);
|
|
let tmpCondition = [];
|
|
tmpCondition.push(c[0]);
|
|
tmpCondition.push(c[1]);
|
|
cb(tmpCondition);
|
|
cb(data.conditions);
|
|
this.configbak = cloneDeep(tmpCondition);
|
|
this.configall = data.conditions;
|
|
this.config = cloneDeep(tmpCondition);
|
|
this.resourceId = data.resourceId;
|
|
} else {
|
|
message.warning(data.message);
|
|
}
|
|
}, error=> {
|
|
message.warning(error.message);
|
|
})
|
|
}
|
|
|
|
changeDate(v) {
|
|
v = new moment(v).format('YYYY-MM');
|
|
this.pDate = v+"-01";
|
|
let params = this.radiogroupdata;
|
|
this.getReportData(params);
|
|
}
|
|
|
|
resetConfig(v) {
|
|
this.config=[];
|
|
this.configbak=[];
|
|
this.configall=[];
|
|
this.pDate=new moment().format('YYYY-MM-DD');
|
|
}
|
|
|
|
|
|
updateVisible(v) {
|
|
this.visible = v;
|
|
}
|
|
|
|
getTableData(params) {
|
|
API.getTableData(params).then(data=>{
|
|
if (data.status == '1') {
|
|
this.table = data.table;
|
|
this.table1 = data.table1;
|
|
this.showFList = data.showFList;
|
|
this.loading=false;
|
|
} else {
|
|
message.warning(data.message);
|
|
}
|
|
}, error=> {
|
|
message.warning(error.message);
|
|
})
|
|
}
|
|
|
|
exportExcel(){
|
|
if(this.pDate){
|
|
this.radiogroupdata.currentdate = this.pDate;
|
|
}
|
|
let params = this.radiogroupdata;
|
|
let currentdate = params.currentdate || '';
|
|
let resourceid = params.resourceId || '';
|
|
let departmentid = params.departmentId || '';
|
|
let subcompanyid = params.subCompanyId || '';
|
|
if(params.viewscope=='0'){
|
|
resourceid = this.resourceId || '';
|
|
}
|
|
if(params.viewscope=='1' && resourceid=="" && departmentid=="" && subcompanyid=="" ){
|
|
message.warning(getLabel('386536',"请选择数据范围"));
|
|
return;
|
|
}
|
|
window.location.href = addContentPath("/hrm/report/schedulediff/HrmScheduleDiffReportExcelE9.jsp?cmd=HrmScheduleDiffMonthAttDetail&tnum=82801"+
|
|
"¤tdate="+currentdate+"&resourceId="+resourceid+"&departmentId="+departmentid+
|
|
"&subCompanyId="+subcompanyid+"&viewscope="+params.viewscope);
|
|
}
|
|
|
|
getReportData(params={}){
|
|
if(this.pDate){
|
|
this.radiogroupdata.currentdate = this.pDate;
|
|
}
|
|
|
|
if(params.viewscope=='1'){
|
|
this.config = this.configall;
|
|
let resourceid = params.resourceId || '';
|
|
let departmentid = params.departmentId || '';
|
|
let subcompanyid = params.subCompanyId || '';
|
|
if(resourceid=='' && departmentid=='' && subcompanyid==''){
|
|
//message.warning("请选择数据范围");
|
|
return false;
|
|
}
|
|
}else{
|
|
this.config = this.configbak;
|
|
params.viewscope = "0";
|
|
params.resourceId = '';
|
|
params.departmentId = '';
|
|
params.subCompanyId = '';
|
|
}
|
|
|
|
this.radiogroupdata = params;
|
|
|
|
this.loading=true;
|
|
API.getReportData(params).then(data=>{
|
|
if (data.status == '1') {
|
|
this.reportdata = data.reportdata;
|
|
this.fromDate = data.fromDate;
|
|
this.toDate = data.toDate;
|
|
this.loading=false;
|
|
} else {
|
|
message.warning(data.message);
|
|
}
|
|
}, error=> {
|
|
message.warning(error.message);
|
|
})
|
|
}
|
|
} |