155 lines
4.2 KiB
JavaScript
155 lines
4.2 KiB
JavaScript
import {
|
|
observable,
|
|
action,
|
|
computed, extendObservable
|
|
} from 'mobx';
|
|
import * as mobx from 'mobx';
|
|
import * as API from '../apis/qtxConfig';
|
|
import {
|
|
WeaForm
|
|
} from 'comsMobx';
|
|
import {
|
|
Modal,
|
|
message,
|
|
} from 'antd'
|
|
import {
|
|
i18n
|
|
} from '../public/i18n';
|
|
import { WeaLocaleProvider } from 'ecCom';
|
|
|
|
const toJS = mobx.toJS;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
|
|
export class QtxConfigStore {
|
|
|
|
@observable configForm = new WeaForm();
|
|
@observable editTableData = {
|
|
datas: [],
|
|
columns: [],
|
|
loading: true,
|
|
selectedData: {}
|
|
};
|
|
|
|
@observable configFields = [
|
|
{
|
|
domkey: ['isopenconfig'],
|
|
conditionType: 'SWITCH',
|
|
label: getLabel('-1', "是否开启数据库配置"),
|
|
labelcol: 5,
|
|
fieldcol: 19,
|
|
viewAttr: 3,
|
|
}
|
|
]
|
|
|
|
@action("初始化页面") initList = () => {
|
|
this.configForm.initFormFields([{ items: this.configFields.slice() }]);
|
|
this.getQtxConfigInfo();
|
|
}
|
|
|
|
@action clearConfigData = () => {
|
|
this.editTableData.datas = [];
|
|
this.editTableData.columns = [];
|
|
this.editTableData.loading = true;
|
|
|
|
}
|
|
|
|
@action("数据获取") getQtxConfigInfo = () => {
|
|
this.clearConfigData();
|
|
API.getQtxConfigInfo().then(action(({ code, data, msg }) => {
|
|
if (code == 200) {
|
|
const { columns, datas } = data;
|
|
extendObservable(this.editTableData, {
|
|
datas: datas,
|
|
columns: columns,
|
|
loading: false
|
|
});
|
|
// this.configForm.updateFields({
|
|
// isquicksearch: data.setting.isquicksearch,
|
|
// });
|
|
} else {
|
|
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
|
|
}
|
|
}));
|
|
}
|
|
|
|
setTableEditDatas = (e) => {
|
|
debugger;
|
|
if(e.length > 1) {
|
|
e.pop();
|
|
message.error("默认只能添加一条配置数据!!!")
|
|
}
|
|
extendObservable(this.editTableData, {
|
|
datas: e
|
|
});
|
|
}
|
|
|
|
@action("保存页面") saveQtxConfigInfo = () => {
|
|
// let datas = this.quickSearchData.datas;
|
|
// datas.map((data, index) => {
|
|
// data.orderid = index
|
|
// });
|
|
|
|
// let formparm = this.configForm.getFormParams();
|
|
// if (!this.checkQuickSearchData()) {
|
|
// message.error(getLabel('387954', "条件字段不能重复"));
|
|
// return;
|
|
// }
|
|
// let id = this.quickSearchData.setting.id;
|
|
// if (id == null) {
|
|
// return;
|
|
// }
|
|
// API.saveQuickSearchInfo({
|
|
// id: id,
|
|
// data: JSON.stringify(datas), ...formparm
|
|
// }).then(({ code, data, msg }) => {
|
|
// if (code == 200) {
|
|
// message.success(getLabel(83551, '保存成功!'));
|
|
// this.qcSelectedRowKeys = [];
|
|
// this.getQuickSearchInfo();
|
|
// } else {
|
|
// message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
|
|
// }
|
|
// });
|
|
// this.quickSearchData.setting.id = null;
|
|
}
|
|
|
|
/**===========================buttons=========================== */
|
|
rightMenu = [
|
|
{
|
|
"isBatch": "0",
|
|
"isTop": "1",
|
|
"menuFun": "save",
|
|
"menuIcon": "icon-coms-Preservation",
|
|
"menuName": "保存",
|
|
"type": "BTN_save"
|
|
},
|
|
{
|
|
"isBatch": "0",
|
|
"isTop": "0",
|
|
"menuFun": "login",
|
|
"menuIcon": "icon-coms-link",
|
|
"menuName": "单点登录",
|
|
"type": "BTN_link"
|
|
}
|
|
];
|
|
topMenu = [
|
|
{
|
|
"isBatch": "1",
|
|
"isTop": "1",
|
|
"menuFun": "save",
|
|
"menuIcon": "icon-coms-Preservation",
|
|
"menuName": "保存",
|
|
"type": "BTN_save"
|
|
},
|
|
{
|
|
"isBatch": "1",
|
|
"isTop": "1",
|
|
"menuFun": "login",
|
|
"menuIcon": "icon-coms-link",
|
|
"menuName": "单点登录",
|
|
"type": "BTN_link"
|
|
}
|
|
]
|
|
|
|
} |