import { Button, Modal, message, Row, Col, Spin } from 'antd';
import isEmpty from 'lodash/isEmpty'
import cloneDeep from 'lodash/cloneDeep'
import forEach from 'lodash/forEach'
import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab, WeaTop } from 'ecCom'
import { WeaSwitch, WeaForm } from 'comsMobx';
import { inject, observer } from 'mobx-react';
import * as mobx from 'mobx';
import { i18n } from '../../public/i18n';
import * as Api from '../../apis/hrmInfoExtend'; // 引入API接口文件
const toJS = mobx.toJS;
import '../../style/common.less';
export default class HrmInfoExtend extends React.Component {
constructor(props) {
super(props);
this.state = {
id: props.location.query.hrmResourceID,
isEditor: false,
loading: false,
form: new WeaForm(),
conditions: [],
buttons: {},
date: ''
}
}
componentDidMount() {
this.init();
}
init = () => {
this.setState({
isEditor: false
});
this.getData();
}
getData = () => {
this.state.loading = true;
let params = {
viewAttr: this.isEditor ? 2 : 1,
id: this.state.id,
}
Api.getResourceExtendForm(params).then((res) => {
if (res.code === 200) {
this.state.form.initFormFields(res.data.conditions);
this.setState({
conditions: res.data.conditions,
buttons: res.data.buttons,
loading: false
})
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
getTopButtons = () => {
const { isEditor, buttons } = this.state;
const save = ;
const back = ;
const edit = ;
const btns = [];
try {
if (isEditor) {
if (buttons.hasSave) {
btns.push(save);
btns.push(back);
}
} else {
if (buttons.hasEdit) {
btns.push(edit);
}
}
} catch (e) { }
return btns;
}
getSearchs = () => {
let { form, conditions, isEditor } = this.state;
const { isFormInit } = form;
let group = [];
let tipPosition = 'bottom';
window.e9HideFormFieldKeys = [];
isFormInit && conditions.forEach((c, i) => {
let items = [];
c.items.forEach((field, j) => {
if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
window.e9HideFormFieldKeys.push(field.domkey[0]);
} else {
items.push({
com: (