52 lines
886 B
JavaScript
52 lines
886 B
JavaScript
import {
|
|
observable,
|
|
action,
|
|
computed
|
|
} from 'mobx';
|
|
|
|
export default class DialogStore {
|
|
constructor(root) {
|
|
this.root = root;
|
|
}
|
|
|
|
get dialogProps() {
|
|
return {
|
|
hasScroll: true,
|
|
icon: 'icon-coms-hrm',
|
|
iconBgcolor: '#217346',
|
|
}
|
|
}
|
|
|
|
@observable visible = false;
|
|
@observable title = '';
|
|
@observable style = {};
|
|
@observable mark = '';
|
|
|
|
@action init = (config) => {
|
|
Object.keys(config).forEach(key => {
|
|
this[key] = config[key];
|
|
})
|
|
}
|
|
|
|
@action openDialog = () => {
|
|
this.visible = true;
|
|
}
|
|
|
|
@action closeDialog = () => {
|
|
this.visible = false;
|
|
|
|
this._closeDialog && this._closeDialog();
|
|
}
|
|
|
|
@computed get buttons() {
|
|
const mark = (this.mark !== undefined) ? this.mark : '';
|
|
return this.root[`${mark}DialogButtons`];
|
|
}
|
|
|
|
@computed get moreBtn() {
|
|
const mark = (this.mark !== undefined) ? this.mark : '';
|
|
return this.root[`${mark}MoreBtn`];
|
|
}
|
|
|
|
|
|
} |