115 lines
2.8 KiB
JavaScript
115 lines
2.8 KiB
JavaScript
import {
|
|
observable,
|
|
action,
|
|
toJS
|
|
} from 'mobx';
|
|
import { WeaTools, WeaLocaleProvider } from 'ecCom';
|
|
import { Button ,message} from 'antd'
|
|
import { WeaForm ,WeaLogView} from "comsMobx";
|
|
const {LogStore} = WeaLogView;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
const { callApi } = WeaTools;
|
|
|
|
const addContentPath = (url) => {
|
|
const ecologyContentPath = window.ecologyContentPath || '';
|
|
if (url && ecologyContentPath) {
|
|
//避免重复添加ecologyContentPath
|
|
//避免传入的参数不是链接
|
|
if (url.startsWith('/') && !url.startsWith(ecologyContentPath)) {
|
|
url = ecologyContentPath + url;
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
|
|
export default class HrmImportCommon {
|
|
@observable hasOtherTab = false;
|
|
@observable LogDialogVisible=false;
|
|
@observable form = new WeaForm();
|
|
@observable logStore = new LogStore();
|
|
@action changeLogStatus=(status)=>{
|
|
this.LogDialogVisible=status
|
|
}
|
|
@action Init = () => {
|
|
callApi('/api/hrm/securitysetting/getAllowUserSetting', 'GET').then(data => {
|
|
if (data.status == '1') {
|
|
if( data.allowUserSetting == "1"){
|
|
this.hasOtherTab = true
|
|
}else{
|
|
this.hasOtherTab = false
|
|
}
|
|
|
|
}
|
|
})
|
|
}
|
|
@action getForm = () => {
|
|
this.form = new WeaForm();
|
|
callApi('/api/hrm/securitysetting/getUserSecuritySettingForm', 'GET').then(data => {
|
|
if (data.status == '1') {
|
|
this.form.setCondition(toJS(data.formField));
|
|
}
|
|
})
|
|
}
|
|
|
|
getRightMenu = () => {
|
|
return [{
|
|
key: 'save',
|
|
icon: <i className="icon-workflow-Right-menu-Preservation" />,
|
|
content: getLabel(30986, '保存'),
|
|
onClick: () => {
|
|
this.onSave();
|
|
},
|
|
},{
|
|
key: 'log',
|
|
icon: <i className="icon-coms-Print-log" />,
|
|
content: getLabel(83, '日志'),
|
|
onClick: () => {
|
|
this.changeLogStatus(true)
|
|
},
|
|
}]
|
|
}
|
|
|
|
@action
|
|
getButtons () {
|
|
let btns = [];
|
|
btns.push(<Button type="primary" onClick={this.onSave}>{getLabel(30986, '保存')}</Button>);
|
|
return btns;
|
|
}
|
|
|
|
@action onSave = () => {
|
|
const url = addContentPath(`/spa/hrm/index_mobx.html#/main/hrmSingle/secondaryVerification4em`);
|
|
let dialog = ecCom.WeaTools.createDialog({
|
|
moduleName: 'hrm',
|
|
title: getLabel('534593','身份校验'),
|
|
style: { width: 400, height: 400 },
|
|
url,
|
|
destroyBodyOnClose: true,
|
|
callback: this.onCheckRs,
|
|
onCancel: () => {
|
|
}
|
|
});
|
|
|
|
dialog && dialog.show();
|
|
|
|
// if(window.doCheckSecondaryVerify4ec){
|
|
// window.doCheckSecondaryVerify4ec({mouldCode: 'HRM', itemCode: 'SALARY'}, this.doSave);
|
|
// }else{
|
|
// this.doSave();
|
|
// }
|
|
}
|
|
|
|
@action onCheckRs = (data) => {
|
|
if(data.status == '1')
|
|
this.doSave(data.token);
|
|
}
|
|
|
|
@action doSave = (token) => {
|
|
const params = this.form.getFormParams()
|
|
callApi('/api/hrm/securitysetting/saveUserSecuritySetting', 'POST', {...params, token}).then(data => {
|
|
if (data.status == '1') {
|
|
message.success(getLabel(83551, '保存成功'))
|
|
}
|
|
})
|
|
}
|
|
}
|