import { observable, action, } from 'mobx'; import { WeaTableNew } from 'comsMobx'; import { WeaLocaleProvider, } from 'ecCom'; import { Modal, } from 'antd'; const { TableStore } = WeaTableNew; const getLabel = WeaLocaleProvider.getLabel; const confirm = Modal.confirm; export default class TableListStore { constructor(root) { this.root = root; } get tableProps() { return { hasOrder: true, needScroll: true, } } @observable tableStore = new TableStore(); @action init = (config) => { Object.keys(config).forEach(key => { this[key] = config[key]; }) } @action fetchTableList = (params = {}) => { this.api(params).then(datas => { const { sessionkey, } = datas; this.tableStore = new TableStore(); this.tableStore.getDatas(sessionkey, 1); }) } reRenderColumns = (columns) => { this._reRenderColumns && this._reRenderColumns(columns); } onOperatesClick = (record, rowIndex, operate) => { this._onOperatesClick && this._onOperatesClick(record, rowIndex, operate); } colSet = () => { this.tableStore.setColSetVisible(true); this.tableStore.tableColSet(true) } showConfirm = (msg) => { return new Promise((resolve, reject) => { confirm({ title: getLabel('131329', '信息确认'), content: msg, okText: getLabel('33703', '确定'), cancelText: getLabel('32694', '取消'), onOk() { resolve(); }, onCancel() { return false; }, }); }) } showLog = (type, id) => { const params = { logSmallType: type, }; if (id) { Object.assign(params, { targetId: id, }); } window.setLogViewProps(params); } exportExcel = () => { this.tableStore.exportAll(); } }