trunk/pc4mobx/organization/stores/newImport.js

170 lines
3.9 KiB
JavaScript

import {
observable,
action
} from 'mobx';
import {
WeaForm
} from 'comsMobx';
import * as API from '../apis/newImport';
import * as Util from '../util/index';
import {
validate,
getFormParamValue
} from '../util'
import {
message,
Modal,
Button
} from 'antd';
import {
WeaTableNew
} from 'comsMobx'
import * as mobx from 'mobx';
import isEmpty from 'lodash/isEmpty';
import {
has
} from 'lodash';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
const confirm = Modal.confirm;
// import {
// i18n
// } from '../public/i18n';
export class newImportStore {
/********************* cardConfig *********************/
cardConfig = [
{
"subTitle": "分部设置",
"bgColor": "#92B75B",
"icon": "icon-coms-Department-number",
"title": "分部",
"linkName": "分部导入",
"url": "/spa/hrm/engine.html#/hrmengine/organization"
},
{
"subTitle": "部门设置",
"bgColor": "#92B75B",
"icon": "icon-coms-Department-number",
"title": "部门",
"linkName": "部门导入",
"url": "/spa/hrm/engine.html#/hrmengine/organization"
},
{
"subTitle": "岗位设置",
"bgColor": "#49B2FE",
"icon": "icon-coms-hrm",
"title": "岗位",
"linkName": "岗位体系导入",
"url": "/spa/hrm/engine.html#/hrmengine/post"
},
{
"subTitle": "组织维护",
"bgColor": "#51A39A",
"icon": "icon-coms-crm",
"title": "人员",
"linkName": "人员导入",
"url": "/spa/hrm/engine.html#/hrmengine/organization"
}
]
@observable isMouseOver = false;
@observable curIndex = '';
@observable visible = false;
@action setMouseStatus = (index, bool) => {
this.curIndex = index;
this.isMouseOver = bool;
}
/********************* stepDialog *********************/
steps = [
{ title: '设置导入字段'},
{ title: '获取导入模板' },
{ title: '导入结果' }
];
@observable importType = '';
@observable current = 0;
@observable buttonTitle = '';
/********************* stepContent *********************/
data = [
{ id: 1, name: '杨文元' },
{ id: 2, name: '李妍' },
{ id: 3, name: '刘长庚' },
{ id: 4, name: '孟玲' },
{ id: 5, name: '张建华' },
];
selectedKeys = [1, 2];
@observable condition = [];
@observable importParams = {}; //重复验证字段
@observable operateType = 'add'; //导入类型
@observable filelist = []; //文件信息
@observable excelfile = []; //文件id
@observable templetName = "导入模板";
getTemplateUrl
@action setParam = (k, v) => {
const p = toJS(this.importParams);
Object.assign(p, {
[k]: v
});
this.importParams = p;
}
@action("获取导入字段") getImportField() {
}
@action("获取导入表单") getImportForm() {
const params = {
importType: this.importType,
}
API.getImportForm(params).then(data => {
if (data.status == '1') {
this.condition = data.condition;
if (data.condition != null && Array.isArray(data.condition) && data.condition.length > 0) {
this.condition[0].items.map(item => {
if (item.conditionType === 'SELECT' && item.domkey[0] === 'importType') {
item.options.map(op => {
if (op.selected)
this.operateType = op.key;
})
}
item.domkey[0].indexOf('keyField') > -1 && this.setParam(item.domkey[0], item.value);
})
}
} else {
// message.warning(data.message);
}
}, error => {
message.warning(error.message);
})
}
@action("获取导入结果") getImportResult() {
}
setSelectedKeys(keys) {
this.selectedKeys = keys;
}
@action("初始化弹框内容") init() {
this.filelist = [];
this.excelfile = [];
this.visible = false;
}
}