103 lines
3.3 KiB
JavaScript
103 lines
3.3 KiB
JavaScript
import { observable, action } from 'mobx';
|
|
import { TopStore, FormStore, TableListStore, AuthorityStore } from '../../../pc4backstage/hrmengine/public/valhalla/stores/index.js'
|
|
import { i18n } from '../../../pc4backstage/hrmengine/public/i18n.js';
|
|
import { message } from 'antd';
|
|
import * as api from '../apis/sensitiveWordProcess.js';
|
|
|
|
export default class SenstiveWordProcessStore {
|
|
searchGroupProps = { col: 1 };
|
|
|
|
@observable topStore = new TopStore(this);
|
|
@observable formStore = new FormStore(this);
|
|
@observable tableListStore = new TableListStore(this);
|
|
@observable authorityStore = new AuthorityStore(api.hasRight);
|
|
@observable canEdit = false;
|
|
|
|
get topConf() {
|
|
return {
|
|
btnMenu: this.canEdit ? [{
|
|
"isTop": "1",
|
|
"menuFun": "processSensitive",
|
|
"menuIcon": "icon-coms-plus",
|
|
"menuName": i18n.label['531731'](),
|
|
"type": "BTN_Process"
|
|
}, {
|
|
"isTop": "1",
|
|
"menuFun": "del",
|
|
"menuIcon": "icon-coms-Batch-delete",
|
|
"menuName": i18n.label['531732'](),
|
|
"type": "BTN_BatchDelete"
|
|
}] : [],
|
|
title: i18n.label['531603'](),
|
|
additionalTopProps: {
|
|
icon: <i className='icon-coms-currency'/>
|
|
}
|
|
}
|
|
}
|
|
|
|
get formConf() {
|
|
return {
|
|
isCustomRender: false,
|
|
hasTitle: false,
|
|
api: api.getSensitiveWordLogForm
|
|
};
|
|
}
|
|
|
|
init = () => {
|
|
this.authorityStore.fetchAuthority({type: 'intercept',id:this.dataId}).then(()=>{
|
|
this.initTop();
|
|
this.initForm();
|
|
})
|
|
}
|
|
|
|
initTop = () => {
|
|
this.topStore.init(this.topConf).fetchRightMenu()
|
|
}
|
|
|
|
initForm = () => {
|
|
const exportDatas = (datas) => {
|
|
this.canEdit = datas.canEdit;
|
|
this.initTop();
|
|
}
|
|
const params = { id: this.dataId };
|
|
this.formStore.init(this.formConf).fetchForm(params, exportDatas)
|
|
}
|
|
|
|
processSensitive = () => {
|
|
const getStyle = code => (code == '531605') ? { color: 'red' } : {};
|
|
const msg = <div>{['531604','531605'].map(code => <p style={{...getStyle(code),textAlign:'center'}}>{i18n.label[code]()}</p>)}</div>
|
|
this.tableListStore.showConfirm(msg).then(res => {
|
|
const params = { ids: this.dataId, handleway: '2' };
|
|
api.processSensitiveWordLog(params).then(res => {
|
|
const { status } = res;
|
|
if (status == '1') {
|
|
message.success(res.message);
|
|
this.initForm();
|
|
} else {
|
|
message.error(res.message);
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
del = () => {
|
|
const msg = i18n.label['531606']();
|
|
|
|
this.tableListStore.showConfirm(msg).then(() => {
|
|
const params = { ids: this.dataId, handleway: '1' };
|
|
api.processSensitiveWordLog(params).then(res => {
|
|
const { status } = res;
|
|
if (status == '1') {
|
|
message.success(res.message);
|
|
this.initForm();
|
|
} else {
|
|
message.error(res.message);
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
setId = (id) => {
|
|
this.dataId = id;
|
|
}
|
|
} |