trunk/pc4mobx/organization/stores/rankscheme.js

279 lines
7.9 KiB
JavaScript

import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as APi from '../apis/rankscheme'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class RankSchemeStore {
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm();
@observable schemeName = '';
@observable conditionNum = 2;
@observable ids = ''; //选择行id
@observable searchConditionLoading = true;
@action
getTableInfo() {
let params;
this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) {
params = { ...this.form2.getFormParams(),
name: this.schemeName
};
} else {
params = { ...this.form2.getFormParams()
};
}
APi.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
//删除
delete() {
let params = {
ids: this.ids
};
// Api.deleteTableData(params).then(res => {
// if (res.api_status) {
// message.success(i18n.message.deleteSuccess());
// this.getTableInfo();
// } else {
// message.warning(data.message);
// }
// }, error => {
// message.warning(error.message);
// })
}
getSearchCondition() {
this.setScLoadingStatus(false);
let conditions = [
{
"title": "高级查询条件",
"defaultshow": true,
"items": [
{
"belong": "PC",
"checkbox": false,
"checkboxValue": false,
"colSpan": 2,
"conditionType": "INPUT",
"dateGroup": false,
"defaultDisplayInBar": false,
"detailtype": 1,
"domkey": [
"name"
],
"entSearch": false,
"fieldcol": 16,
"hasBorder": false,
"helpfulTipProps": {},
"hide": false,
"isBase64": false,
"isQuickSearch": false,
"label": "办公地点简称",
"labelcol": 8,
"length": 0,
"maxFilesNumber": 0,
"maxUploadSize": 0,
"multiSelection": false,
"multiple": false,
"precision": 0,
"secretLimit": false,
"showOrder": 0,
"showTime": false,
"stringLength": 0,
"supportCancel": false,
"tipPosition": "bottom",
"valueList": [],
"viewAttr": 2
},
{
"belong": "PC",
"checkbox": false,
"checkboxValue": false,
"colSpan": 2,
"conditionType": "INPUT",
"dateGroup": false,
"defaultDisplayInBar": false,
"detailtype": 1,
"domkey": [
"mark"
],
"entSearch": false,
"fieldcol": 16,
"hasBorder": false,
"helpfulTipProps": {},
"hide": false,
"isBase64": false,
"isQuickSearch": false,
"label": "办公地点全称",
"labelcol": 8,
"length": 0,
"maxFilesNumber": 0,
"maxUploadSize": 0,
"multiSelection": false,
"multiple": false,
"precision": 0,
"secretLimit": false,
"showOrder": 0,
"showTime": false,
"stringLength": 0,
"supportCancel": false,
"tipPosition": "bottom",
"valueList": [],
"viewAttr": 2
}
]
}
]
this.setSearchCondition(conditions);
this.form2.initFormFields(conditions);
// Api.getAdvanceSearchCondition().then(res => {
// if (res.api_status) {
// this.setScLoadingStatus(false);
// res.conditions && this.setSearchCondition(res.conditions);
// res.conditions && this.form2.initFormFields(res.conditions);
// } else {
// message.warning(data.message);
// }
// }, error => {
// message.warning(error.message);
// })
}
@action
getHasRight() {
this.topMenu = [
{
"isBatch": "1",
"isTop": "1",
"menuFun": "new",
"menuIcon": "icon-coms-New-Flow",
"menuName": "新建",
"type": "BTN_Addnew"
},
{
"isBatch": "1",
"isTop": "1",
"menuFun": "batchDelete",
"menuIcon": "icon-coms-Batch-delete",
"menuName": "批量删除",
"type": "BTN_BatchDelete"
}
];
this.rightMenu = [
{
"isBatch": "0",
"isTop": "1",
"menuFun": "new",
"menuIcon": "icon-coms-New-Flow",
"menuName": "新建",
"type": "BTN_Addnew"
},
{
"isBatch": "0",
"isTop": "0",
"menuFun": "log",
"menuIcon": "icon-coms-Print-log",
"menuName": "日志",
"type": "BTN_log"
},
{
"isBatch": "0",
"isTop": "0",
"menuFun": "custom",
"menuIcon": "icon-coms-task-list",
"menuName": "显示列定制",
"type": "BTN_COLUMN"
}
]
}
updateFields(val) {
this.form2.updateFields({
name: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
setSchemeName(val) {
this.schemeName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
}