From 98bb6e3ae41a566017e38fa47b2d78049d343322 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 30 Jun 2022 17:14:04 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE=E5=AF=BC?=
=?UTF-8?q?=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/basicImport.js | 7 +
pc4mobx/organization/apis/datasImport.js | 6 +-
pc4mobx/organization/apis/importresource.js | 29 ++
.../components/import/datasImport.js | 9 +-
.../organization/components/import/index.js | 204 ++++++++
.../components/importresource/Import.js | 353 ++++++++++++++
.../importresource/ImportHistory.js | 137 ++++++
.../components/importresource/ImportLog.js | 175 +++++++
.../components/importresource/ImportResult.js | 185 +++++++
.../components/resource/resource.js | 2 +-
pc4mobx/organization/index.js | 3 +
pc4mobx/organization/stores/adareaset.js | 0
pc4mobx/organization/stores/datasImport.js | 30 +-
pc4mobx/organization/stores/import.js | 56 +++
pc4mobx/organization/stores/importCommon.js | 458 ++++++++++++++++++
pc4mobx/organization/stores/importresource.js | 370 ++++++++++++++
pc4mobx/organization/stores/index.js | 8 +-
pc4mobx/organization/stores/resource.js | 1 +
pc4mobx/organization/style/import.css | 86 ++++
19 files changed, 2103 insertions(+), 16 deletions(-)
create mode 100644 pc4mobx/organization/apis/basicImport.js
create mode 100644 pc4mobx/organization/apis/importresource.js
create mode 100644 pc4mobx/organization/components/import/index.js
create mode 100644 pc4mobx/organization/components/importresource/Import.js
create mode 100644 pc4mobx/organization/components/importresource/ImportHistory.js
create mode 100644 pc4mobx/organization/components/importresource/ImportLog.js
create mode 100644 pc4mobx/organization/components/importresource/ImportResult.js
create mode 100644 pc4mobx/organization/stores/adareaset.js
create mode 100644 pc4mobx/organization/stores/import.js
create mode 100644 pc4mobx/organization/stores/importCommon.js
create mode 100644 pc4mobx/organization/stores/importresource.js
create mode 100644 pc4mobx/organization/style/import.css
diff --git a/pc4mobx/organization/apis/basicImport.js b/pc4mobx/organization/apis/basicImport.js
new file mode 100644
index 0000000..930d757
--- /dev/null
+++ b/pc4mobx/organization/apis/basicImport.js
@@ -0,0 +1,7 @@
+import {
+ WeaTools
+} from 'ecCom'
+
+export const getBasicDataImportHasRight = (params) => {
+ return WeaTools.callApi('/api/hrm/import/resource/getBasicDataImportHasRight', 'GET', params);
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/apis/datasImport.js b/pc4mobx/organization/apis/datasImport.js
index 5201064..438e698 100644
--- a/pc4mobx/organization/apis/datasImport.js
+++ b/pc4mobx/organization/apis/datasImport.js
@@ -1,12 +1,16 @@
import { WeaTools } from 'ecCom'
+
+//作废
//获取导入表单
export const getImportForm = (params) => {
return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
}
//导入文件提交
export const saveImport = (params) => {
- return WeaTools.callApi(`/api/hrm/import/resource/saveImport`, 'POST', params);
+ return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
}
+
+
//获取导入结果回调数据
export const getImportProcessLog = (params) => {
return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
diff --git a/pc4mobx/organization/apis/importresource.js b/pc4mobx/organization/apis/importresource.js
new file mode 100644
index 0000000..6446a7c
--- /dev/null
+++ b/pc4mobx/organization/apis/importresource.js
@@ -0,0 +1,29 @@
+import { WeaTools } from 'ecCom'
+//获取导入表单
+export const getImportForm = (params) => {
+ return WeaTools.callApi(`/api/hrm/import/resource/getImportForm`, 'GET', params);
+}
+//导入文件提交
+export const saveImport = (params) => {
+ return WeaTools.callApi(`/api/bs/hrmorganization/commonimport/saveImportResource`, 'POST', params);
+}
+//获取导入结果回调数据
+export const getImportProcessLog = (params) => {
+ return WeaTools.callApi(`/api/hrm/importlog/getImportProcessLog`, 'GET', params);
+}
+//获取导入结果
+export const getImportResult = (params) => {
+ return WeaTools.callApi(`/api/hrm/importlog/getImportResult`, 'GET', params);
+}
+//历史导入信息查询
+export const getImportHistory = (params) => {
+ return WeaTools.callApi(`/api/hrm/importlog/getImportHistory`, 'GET', params);
+}
+//导入日志
+export const getImportLogDetail = (params) => {
+ return WeaTools.callApi(`/api/hrm/importlog/getImportColResultLog`, 'GET', params);
+}
+//导入日志 - 高级搜索
+export const getImportLogSearchCondition = (params) => {
+ return WeaTools.callApi(`/api/hrm/importlog/getHistorySearchCondition`, 'GET', params);
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/import/datasImport.js b/pc4mobx/organization/components/import/datasImport.js
index 7683122..e46e097 100644
--- a/pc4mobx/organization/components/import/datasImport.js
+++ b/pc4mobx/organization/components/import/datasImport.js
@@ -33,6 +33,7 @@ import '../../style/common.less'
const getLabel = WeaLocaleProvider.getLabel;
@inject('datasImport')
+@inject('resource')
@observer
export default class DatasImport extends React.Component {
constructor(props) {
@@ -243,11 +244,15 @@ export default class DatasImport extends React.Component {
submit() {
const {
- datasImport
+ datasImport,
+ resource
} = this.props;
datasImport.saveImport({}, () => {
- this.refs.scroll && this.refs.scroll.scrollToLast()
+ this.refs.scroll && this.refs.scroll.scrollToLast();
});
+
+ // resource.getTableInfo();
+ // resource.getHasRight();
}
cancel() {
diff --git a/pc4mobx/organization/components/import/index.js b/pc4mobx/organization/components/import/index.js
new file mode 100644
index 0000000..e916e79
--- /dev/null
+++ b/pc4mobx/organization/components/import/index.js
@@ -0,0 +1,204 @@
+import React from 'react'
+import {
+ toJS
+} from 'mobx'
+import {
+ inject,
+ observer,
+} from 'mobx-react'
+import {
+ WeaTop,
+ WeaAlertPage,
+} from 'ecCom'
+import {
+ Spin,
+} from 'antd';
+import {
+ i18n
+} from '../../public/i18n';
+import ImportResource from '../importresource/Import';
+//import Import from '../importRelatedComponet/index'
+import {addContentPath} from '../../util/index.js'
+import '../../style/import.css'
+
+@inject('hrmBasicDataImport')
+@inject('hrmImportResource')
+@inject('hrmImportCommon')
+@observer
+export default class BasicInfoImport extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ let bool = window.location.href.indexOf('/spa/hrm/engine.html') > -1;
+ if (bool) {
+ document.title = i18n.module.basicInfoImport();
+ }
+ }
+
+ componentDidMount() {
+ const {
+ hrmBasicDataImport
+ } = this.props, {
+ getRight
+ } = hrmBasicDataImport;
+
+ getRight();
+ }
+
+ getImportCard = () => {
+ const {
+ hrmBasicDataImport
+ } = this.props, {
+ isMouseOver,
+ curIndex,
+ cardConfig,
+ setMouseStatus,
+ } = hrmBasicDataImport;
+
+ let arr = [];
+
+ cardConfig.map((c, index) => {
+ arr.push(
setMouseStatus(index, true)} onMouseLeave={() => setMouseStatus(index, false)}>
+
+ { curIndex == index && isMouseOver ? this.getLinkName(c.linkName,index) : this.getIcon(c.icon)}
+ { curIndex == index && isMouseOver ? this.getSubTitle(c.subTitle,c.url) : this.getTitle(c.title)}
+
+
)
+ });
+ return arr;
+ }
+
+ getIcon = (icon) => {
+ return (
+
+
)
+ }
+
+ getTitle = (title) => {
+ return ({title}
)
+ }
+
+ getLinkName = (linkName, index) => {
+ return ()
+ }
+
+ getSubTitle = (subTitle, url) => {
+ return ()
+ }
+
+ handleClick = (index) => {
+ const {
+ hrmImportResource,
+ hrmImportCommon,
+ } = this.props, {
+ setTempletName,
+ setImportDialogTitle,
+ setImportType,
+ setImportDialogVisible
+ } = hrmImportCommon;
+
+ switch (index) {
+ case 0: //@lvyi
+ hrmImportResource.visible = true;
+ hrmImportResource.title = i18n.button.importOrg();
+ hrmImportResource.importType = 'company';
+ hrmImportResource.getImportForm();
+ break;
+ case 1:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.postSystemImport());
+ setImportType('jobtitle');
+ setImportDialogVisible(true);
+ break;
+ case 2: //@lvyi
+ hrmImportResource.visible = true;
+ hrmImportResource.title = i18n.button.importResource();
+ hrmImportResource.importType = 'resource';
+ hrmImportResource.getImportForm();
+ break;
+ case 3:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.groupInfoImport());
+ setImportType('group');
+ setImportDialogVisible(true);
+ break;
+ case 4:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.personalAndWorkInfoImport());
+ setImportType('resourcedetial');
+ setImportDialogVisible(true);
+ break;
+ case 5:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.areaInfoImport());
+ setImportType('area');
+ setImportDialogVisible(true);
+ break;
+ case 6:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.workingPlaceImport());
+ setImportType('location');
+ setImportDialogVisible(true);
+ break;
+ case 7:
+ setTempletName(i18n.label.importTemplate());
+ setImportDialogTitle(i18n.button.majorImport());
+ setImportType('special');
+ setImportDialogVisible(true);
+ break;
+ }
+
+ }
+
+ render() {
+ const {
+ hrmBasicDataImport,
+ hrmImportResource,
+ hrmImportCommon,
+ } = this.props, {
+ title,
+ isMouseOver,
+ loading,
+ authorized,
+ } = hrmBasicDataImport;
+
+ if (!authorized) {
+ return (
+
+ {loading ?
+
+
+ :
+
+
+ {i18n.message.authFailed()}
+
+
+
+ }
+
+ )
+ } else {
+ return (
+ }
+ iconBgcolor='#217346'
+ loading={true}
+ showDropIcon={true}
+ >
+ {this.getImportCard()}
+ {hrmImportResource.visible && }
+ {/*其它导入暂时未实现 {hrmImportCommon.importDialog.visible && } */}
+
+ )
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/importresource/Import.js b/pc4mobx/organization/components/importresource/Import.js
new file mode 100644
index 0000000..1386d31
--- /dev/null
+++ b/pc4mobx/organization/components/importresource/Import.js
@@ -0,0 +1,353 @@
+import {
+ inject,
+ observer
+} from 'mobx-react';
+import {
+ WeaUpload,
+ WeaDialog,
+ WeaFormItem,
+ WeaSearchGroup,
+ WeaNewScroll,
+ WeaSelect,
+ WeaInput
+} from 'ecCom'
+
+import {
+ Row,
+ Col,
+ Button,
+ Spin
+} from 'antd'
+
+import {
+ WeaSwitch
+} from 'comsMobx'
+import React from 'react'
+import ImportResult from './ImportResult'
+import ImportHistory from './ImportHistory'
+import {
+ WeaLocaleProvider
+} from 'ecCom';
+import {
+ i18n
+} from '../../public/i18n';
+import {addContentPath} from '../../util/index.js'
+import '../../style/common.less'
+
+@inject('hrmImportResource')
+@observer
+export default class ImportResource extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentDidMount() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.list = [];
+ }
+
+ getCircle() {
+ let style = {
+ width: 20,
+ height: 20,
+ backgroundColor: '#D8D8D8',
+ webkitBorderRadius: 10,
+ mozBorderRadius: 10,
+ msBorderRadius: 10,
+ oBorderRadius: 10,
+ borderRadius: 10,
+ //paddingLeft: 6,
+ textAlign: 'center',
+ }
+ return style;
+ }
+
+ getForm() {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ condition
+ } = hrmImportResource;
+ let _arr = [];
+
+ condition.map((c, i) => {
+ let arr = [];
+ if (i == 0) { //基本信息
+ c.items.map((field, index) => {
+ arr.push({
+ com: (
+
+
+
+
+
+
+
+
+ {field.label}:
+
+ {this.getDom(field)}
+
+
+
+
+
+
+ ),
+ colSpan: 1,
+ })
+ })
+ }
+ if (i == 1) { //导入说明
+ c.items.map((field, index) => {
+ arr.push({
+ com: (
+
+
+
+
+
+
+ {this.getIllustration(field.value, field.link, index, field)}
+
+
+
+ ),
+ colSpan: 1
+ })
+ })
+ }
+ _arr.push(
)
+
+ });
+ return _arr;
+ }
+
+ getDom(field) {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ templetName,
+ filelist,
+ getTemplateUrl,
+ importParams
+ } = hrmImportResource;
+ let dom;
+ let domkey = field.domkey;
+ if (domkey[0] == 'templet') {
+ dom = {i18n.label.importTemplate()};
+ } else if (domkey[0] === 'exportData') {
+ const href = hrmImportResource.operateType === 'add' ? field.otherParams.fileVal[0].add : field.otherParams.fileVal[0].update;
+ if(hrmImportResource.importType === 'matrix'){
+ dom = {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}
+ }else
+ dom = {i18n.label.importTemplate()};
+ } else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
+ dom = (
+
+ {
+ this.setFileId(ids, list)
+ }
+ } >
+
+
+
+
+ {filelist.length == 0 ?
{i18n.label.noFileSelected()}
: filelist.map(file =>
{file.filename}
)}
+
+
)
+ } else if (domkey[0].indexOf('keyField') > -1) {
+ const vals = field.options.filter(v => v.selected == true);
+ let val = '';
+ vals.length>0 && (val = vals[0].key);
+ dom = { hrmImportResource.setParam(domkey[0], v)}}
+ />
+ } else if (domkey[0] == 'importType') {
+ dom = { hrmImportResource.operateType = v }}
+ />
+ } else {
+ dom =
+ }
+ return dom;
+ }
+
+ getIllustration(val, url, index, link) {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ templetName,
+ getTemplateUrl,
+ importParams
+ } = hrmImportResource;
+ let p;
+ if (index == 0) {
+ if (url instanceof Object) {
+ const href = hrmImportResource.operateType === 'add' ? url.add : url.update;
+ let dom;
+ if(hrmImportResource.importType === 'matrix'){
+ dom = {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType, importParams)}}>{i18n.label.importTemplate()}
+ }else
+ dom = {i18n.label.importTemplate()};
+ p = ({i18n.label.downLoadTemplete()}:{dom}
);
+ } else if (url != null) {
+ if(hrmImportResource.importType === 'matrix'){
+ p = ({i18n.label.downLoadTemplete()}: {getTemplateUrl(hrmImportResource.otherParams.matrixid, hrmImportResource.operateType)}}>{i18n.label.importTemplate()}
);
+ }else
+ p = ({i18n.label.downLoadTemplete()}:{i18n.label.importTemplate()}
);
+ } else {
+ p = ();
+ }
+ } else {
+ p = ();
+ }
+ return p;
+ }
+
+ setFileId(ids, list) {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.excelfile = ids;
+ hrmImportResource.filelist = list;
+ }
+
+ onUploading(s) {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.status = s;
+ }
+
+ submit() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.saveImport({}, () => {
+ this.refs.scroll && this.refs.scroll.scrollToLast()
+ });
+ }
+
+ cancel() {
+ const {
+ hrmImportResource,
+ onClose
+ } = this.props;
+ hrmImportResource.visible = false
+ hrmImportResource.init();
+ onClose && onClose();
+ }
+
+ importHistoryQuery() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.visibleHistory = true;
+ hrmImportResource.getImportHistory();
+ }
+
+ render() {
+ const {
+ hrmImportResource,
+ mainTitle,
+ importLog,
+ viewLog,
+ viewLogTitle,
+ } = this.props;
+ const {
+ title,
+ visible,
+ titleResult,
+ visibleResult,
+ importResultColumns,
+ importProcessLogDatas,
+ failnum,
+ succnum,
+ importResultTip,
+ importResultStore,
+ importStatus,
+ errorInfo,
+ setScrollRef,
+ single,
+ showLoadingSpin,
+ condition
+ } = hrmImportResource;
+ const buttons = condition.length ? [
+ (),
+ (),
+ ] : [];
+
+ let dialogHeight = window.innerHeight - 150;
+ if (dialogHeight > 560) dialogHeight = 560;
+
+ return (
+
+ {
+ single && visible ?
+
+ {this.getForm()}
+
+ :
+ this.cancel()}
+ buttons={buttons}
+ style={{ width: 870, height: dialogHeight }}
+ moreBtn={{datas:condition ? [{
+ key: '1',
+ content: i18n.button.submit(),
+ icon: ,
+ onClick: () => this.submit(),
+ },
+ {
+ key: '2',
+ content: importLog || i18n.button.importHistoryQuery(),
+ icon: ,
+ onClick: () => this.importHistoryQuery(),
+ }
+ ]: []}}
+ >
+ { condition.length ? (
+
+
+ {this.getForm()}
+
+
+ ): ''}
+
+ }
+
+
+
+
+ )
+ }
+}
diff --git a/pc4mobx/organization/components/importresource/ImportHistory.js b/pc4mobx/organization/components/importresource/ImportHistory.js
new file mode 100644
index 0000000..d13699c
--- /dev/null
+++ b/pc4mobx/organization/components/importresource/ImportHistory.js
@@ -0,0 +1,137 @@
+import {
+ inject,
+ observer
+} from 'mobx-react';
+import {
+ WeaDialog,
+} from 'ecCom'
+
+import {
+ Modal,
+ Table,
+ Button,
+} from 'antd'
+
+import React from 'react'
+import {
+ WeaTableNew
+} from 'comsMobx';
+import ImportLog from './ImportLog'
+import {
+ i18n
+} from '../../public/i18n';
+
+const WeaTable = WeaTableNew.WeaTable;
+
+@inject('hrmImportResource')
+@observer
+class ImportHistory extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ reRenderColumns(c) {
+ let _this = this;
+ c.forEach(item => {
+ if (item.dataIndex == 'operator') {
+ item.render = function(text, record) {
+ return _this.jumpToHrmCard(record.operator)}>{record.operatorspan}
+ }
+ }
+ if (item.dataIndex == 'allnum') {
+ item.render = function(text, record) {
+ return _this.jumpToImportResult(record.randomFieldId)}>{record.allnumspan}
+ }
+ }
+ });
+ }
+
+ jumpToHrmCard(id) {
+ window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
+ }
+
+ jumpToImportResult(pId) {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.dialogKey = new Date().getTime();
+ hrmImportResource.visibleResult = true;
+ hrmImportResource.getImportResult({
+ pId,
+ importType: 'resource'
+ });
+ }
+
+ queryImportLog() {
+ const {
+ hrmImportResource
+ } = this.props;
+ let params = {};
+ params.importType = 'resource';
+ hrmImportResource.pId = '';
+ hrmImportResource.getImportLogDetail(params);
+ hrmImportResource.getImportLogSearchCondition(params);
+ hrmImportResource.visibleImportLog = true;
+ }
+
+ cancel() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.visibleHistory = false;
+ }
+
+ render() {
+ const {
+ hrmImportResource,
+ importLog,
+ viewLog,
+ } = this.props;
+ const {
+ titleHistory,
+ visibleHistory,
+ onCancel,
+ importHistoryStore
+ } = hrmImportResource;
+ const buttons = [
+ (),
+ ];
+ let dialogHeight = window.innerHeight - 150;
+ if (dialogHeight > 510) dialogHeight = 510;
+ return (
+
+
+ {visibleHistory &&
+ this.cancel()}
+ buttons={buttons}
+ style={{ width: 870, height: dialogHeight }}
+ moreBtn={{datas:[{
+ key: '1',
+ content: viewLog || i18n.button.queryImportLog(),
+ icon: ,
+ onClick: () => this.queryImportLog(),
+ }
+ ]}}
+ >
+ index}
+ getColumns={c => this.reRenderColumns(c)}
+ />
+
+ }
+
+ )
+ }
+}
+
+export default ImportHistory
\ No newline at end of file
diff --git a/pc4mobx/organization/components/importresource/ImportLog.js b/pc4mobx/organization/components/importresource/ImportLog.js
new file mode 100644
index 0000000..38a6484
--- /dev/null
+++ b/pc4mobx/organization/components/importresource/ImportLog.js
@@ -0,0 +1,175 @@
+import {
+ inject,
+ observer
+} from 'mobx-react';
+import {
+ WeaTab,
+ WeaDialog,
+ WeaFormItem,
+ WeaSearchGroup,
+} from 'ecCom'
+
+import {
+ Row,
+ Col,
+ Button,
+} from 'antd'
+import * as mobx from 'mobx';
+const toJS = mobx.toJS;
+import {
+ WeaSwitch
+} from 'comsMobx'
+import {
+ WeaTableNew
+} from 'comsMobx';
+import React from 'react'
+
+const WeaTable = WeaTableNew.WeaTable;
+import {
+ i18n
+} from '../../public/i18n';
+
+@inject('hrmImportResource')
+@observer
+class ImportLog extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillReceiveProps(nextProps) {
+
+ }
+
+ getSearchs() {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ form,
+ searchCondition
+ } = hrmImportResource;
+
+ const {
+ isFormInit
+ } = form;
+ let group = [];
+
+ const formParams = form.getFormParams();
+ isFormInit && toJS(searchCondition).map((c, i) => {
+ let items = [];
+ c.items.map((fields, index) => {
+ let hide = false;
+ let dom = ;
+ items.push({
+ com: (
+ {dom}
+ ),
+ colSpan: 1,
+ hide: hide
+ })
+ });
+ group.push()
+ });
+ return group;
+ }
+
+ jumpToHrmCard(id) {
+ window.open(`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${id}`);
+ }
+
+ reRenderColumns(c) {
+ let _this = this;
+ let status = "";
+ c.forEach(item => {
+ if (item.dataIndex == 'operator') {
+ item.render = function(text, record) {
+ return _this.jumpToHrmCard(record.operator)}>{record.operatorspan}
+ }
+ } else if (item.dataIndex == 'status') {
+ item.render = function(text, record) {
+ status = text;
+ return {text=='1'?i18n.label.success():i18n.label.fail()}
+ }
+ } else if (item.dataIndex == 'operatedetail') {
+ item.render = function(text, record) {
+ return {status=="1"?"":text}
+ }
+ }
+ });
+ }
+
+ cancel() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.visibleImportLog = false;
+ }
+
+ render() {
+ const {
+ hrmImportResource,
+ viewLogTitle
+ } = this.props;
+ const {
+ form,
+ titleImportLog,
+ visibleImportLog,
+ importLogStore,
+ showSearchAd
+ } = hrmImportResource;
+ const btn = [
+ (),
+ (),
+ ()
+ ]
+ return (
+
+ {
+ visibleImportLog &&
+ { this.cancel()} }
+ //buttons={buttons}
+ style={{width: 970, height: 510}}
+ >
+ {
+ if (e.keyCode == 13 && e.target.tagName === "INPUT") {
+ hrmImportResource.doSearch();
+ hrmImportResource.showSearchAd=false
+ }
+ }
+ }
+ >{this.getSearchs()}
}
+ setShowSearchAd={bool => {hrmImportResource.showSearchAd = bool}}
+ hideSearchAd={() => hrmImportResource.showSearchAd = false}
+ advanceHeight={200}
+ hasMask={false}
+ buttonsAd={btn}
+ />
+ index}
+ getColumns={c => this.reRenderColumns(c)}
+ />
+
+ }
+
+ )
+ }
+}
+
+export default ImportLog
\ No newline at end of file
diff --git a/pc4mobx/organization/components/importresource/ImportResult.js b/pc4mobx/organization/components/importresource/ImportResult.js
new file mode 100644
index 0000000..e3e1ed2
--- /dev/null
+++ b/pc4mobx/organization/components/importresource/ImportResult.js
@@ -0,0 +1,185 @@
+import {
+ inject,
+ observer
+} from 'mobx-react';
+import {
+ WeaDialog,
+ WeaNewScroll,
+} from 'ecCom'
+
+import {
+ Row,
+ Col,
+ Icon,
+ Spin,
+ Modal,
+ Table,
+ Button,
+} from 'antd'
+import isEmpty from 'lodash/isEmpty';
+import React from 'react'
+import {
+ WeaTableNew
+} from 'comsMobx';
+import {
+ toJS
+} from 'mobx';
+
+const WeaTable = WeaTableNew.WeaTable;
+import {
+ i18n
+} from '../../public/i18n';
+
+@inject('hrmImportResource')
+@observer
+class ImportResult extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentDidMount() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.errorInfo = '';
+ }
+
+ getButtons() {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ failnum,
+ importStatus
+ } = hrmImportResource;
+ const buttons = [];
+ if (importStatus == 'over') {
+ // if (failnum > 0) {
+ // buttons.push();
+ // }
+ // buttons.push();
+ buttons.push();
+ }
+
+ return buttons;
+ }
+
+ reRenderColumns(c) {
+ c.forEach(item => {
+ if (item.dataIndex == 'operatedetail') {
+ item.render = function(text, record) {
+ return {text}
+ }
+ }
+ });
+ }
+
+ cancel() {
+ const {
+ hrmImportResource
+ } = this.props;
+ this.dialogKey = new Date().getTime();
+ hrmImportResource.visibleResult = false;
+ }
+
+ getImportLog() {
+ const {
+ hrmImportResource
+ } = this.props;
+ hrmImportResource.visibleImportLog = true;
+ let params = {};
+ params.importType = 'resource';
+ hrmImportResource.getImportLogSearchCondition(params);
+ hrmImportResource.getImportLogDetail(params);
+ }
+
+ render() {
+ const {
+ hrmImportResource
+ } = this.props;
+ const {
+ titleResult,
+ visibleResult,
+ importResultColumns,
+ importProcessLogDatas,
+ failnum,
+ succnum,
+ importResultTip,
+ importResultStore,
+ importStatus,
+ errorInfo,
+ setScrollRef,
+ dialogKey
+ } = hrmImportResource;
+ const buttons = [];
+ if (importStatus == 'over') {
+ buttons.push(
+ {
+ key: '1',
+ content: i18n.button.getImportLog(),
+ icon: ,
+ onClick: () => this.getImportLog(),
+ }
+ );
+ }
+ return (
+
+ {
+ visibleResult &&
+
this.cancel()}
+ buttons={this.getButtons()}
+ style={{ width: 720, height: 480 }}
+ moreBtn={{datas:buttons}}
+ >
+
+ {
+ importStatus == '' || importStatus == 'importing' || importStatus == 'error'?
+ {
+ importStatus == 'error'?
+
+
+
{importResultTip}
+
:
+
+ }
+
+
{hrmImportResource.setScrollTarget(scroll)}}>
+
+
+
+
:
+
+
0 ? '#54D3A2' : '#FF0000' }}>
+ 0 ? 'check' : 'cross'} style={{ color: '#fff' }} />
+
{importResultTip}
+
+ {
+ failnum > 0 &&
+
index}
+ getColumns={c => this.reRenderColumns(c)}
+ />
+ }
+
+ }
+
+
+ }
+
+ )
+ }
+}
+
+export default ImportResult
\ No newline at end of file
diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js
index 2496424..8b8fe2a 100644
--- a/pc4mobx/organization/components/resource/resource.js
+++ b/pc4mobx/organization/components/resource/resource.js
@@ -145,7 +145,7 @@ export default class Resource extends React.Component {
tableStore.selectedRowKeys.length > 0 ? resource.export() : message.error("请选择需要导出的数据")
}
}}
- //menuOnClick={(key, e) => console.log("选择了按钮:", e)}
+ menuOnClick={(key, e) => key == '1' ? tableStore.selectedRowKeys = []: ''}
/>)
return btns;
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index bbc703d..6ef44b5 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -25,6 +25,7 @@ import DepartmentExtendStore from "./components/department/departmentExtend";
import FieldDefined from "./components/fieldDefinedSet/FieldDefined";
import Resource from "./components/resource/resource";
import ResourceExtend from "./components/resource/ResourceExtend";
+import BasicInfoImport from "./components/import";
import stores from "./stores";
import "./style/index";
@@ -83,7 +84,9 @@ const Routes = (
+
+
);
diff --git a/pc4mobx/organization/stores/adareaset.js b/pc4mobx/organization/stores/adareaset.js
new file mode 100644
index 0000000..e69de29
diff --git a/pc4mobx/organization/stores/datasImport.js b/pc4mobx/organization/stores/datasImport.js
index c856575..168e3c4 100644
--- a/pc4mobx/organization/stores/datasImport.js
+++ b/pc4mobx/organization/stores/datasImport.js
@@ -33,6 +33,10 @@ import {
i18n
} from '../public/i18n';
+ import {ResourceStore} from "./resource";
+
+ const resource = new ResourceStore();
+ // const hrmAdAreaSet = new HrmAdAreaSet();
export class DatasImportStore {
@observable title = "人员导入";
@@ -148,7 +152,7 @@ import {
})
}
- saveImport = (params = {}) => {
+ @action saveImport = (params = {}) => {
params.keyField = this.keyField;
params.importType = this.importType;
params.operateType = this.operateType;
@@ -185,17 +189,21 @@ import {
@action doImport = params => {
API.saveImport(params).then(data => {
- if (data.status == '1') {
+ if (data.code == 200) {
+ this.visible = false;
+ resource.getTableInfo();
+ //window.location.reload();
+ //导入进程暂未实现
if(data.message != null && data.message.trim().length > 0 && params.importType == 'matrix'){
- confirm({
- title: i18n.confirm.defaultTitle(),
- content: data.message,
- okText: i18n.button.ok(),
- cancelText: i18n.button.cancel(),
- onOk: () => {
- this.doImport({...params, confirm: 1})
- }
- });
+ // confirm({
+ // title: i18n.confirm.defaultTitle(),
+ // content: data.message,
+ // okText: i18n.button.ok(),
+ // cancelText: i18n.button.cancel(),
+ // onOk: () => {
+ // this.doImport({...params, confirm: 1})
+ // }
+ // });
}else if (!isEmpty(data.errorInfo)) {
this.importStatus = 'error';
this.importResultTip = i18n.message.selectImportTempleteError();
diff --git a/pc4mobx/organization/stores/import.js b/pc4mobx/organization/stores/import.js
new file mode 100644
index 0000000..1c4776f
--- /dev/null
+++ b/pc4mobx/organization/stores/import.js
@@ -0,0 +1,56 @@
+import * as Api from '../apis/basicImport';
+import {
+ observable,
+ action
+} from 'mobx';
+import {
+ message,
+} from 'antd';
+import {
+ i18n
+} from '../public/i18n';
+
+export class HrmBasicDataImport {
+ @observable title = i18n.module.basicInfoImport();
+ @observable isMouseOver = false;
+ @observable curIndex = '';
+ @observable loading = true;
+ @observable authorized = false;
+ @observable cardConfig = []
+
+ @action
+ getRight = () => {
+ this.loading = true;
+ const params = {
+ type: 'HrmBasicDataImport'
+ }
+ Api.getBasicDataImportHasRight(params).then(action(rs => {
+ const {
+ status,
+ hasRight
+ } = rs;
+
+ if (status == '1') {
+ if (hasRight) {
+ this.authorized = true;
+ if (rs.cardConfig) {
+ this.cardConfig = rs.cardConfig
+ } else {
+ this.authorized = false;
+ }
+ }
+ this.loading = false;
+ } else {
+ this.loading = false;
+ }
+ })).catch(error => {
+ message.error(error);
+ });
+ }
+
+ @action
+ setMouseStatus = (index, bool) => {
+ this.curIndex = index;
+ this.isMouseOver = bool;
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/importCommon.js b/pc4mobx/organization/stores/importCommon.js
new file mode 100644
index 0000000..0594f58
--- /dev/null
+++ b/pc4mobx/organization/stores/importCommon.js
@@ -0,0 +1,458 @@
+import * as Api from '../apis/importresource';
+import {
+ observable,
+ action,
+ extendObservable
+} from 'mobx';
+import {
+ WeaForm,
+ WeaTableNew
+} from 'comsMobx';
+import {
+ message
+} from 'antd'
+import {
+ i18n
+} from '../public/i18n';
+const {
+ TableStore
+} = WeaTableNew;
+
+// import {
+// HrmAdAreaSet
+// } from './adareaset';
+// import {
+// HrmOfficeAddress
+// } from './officeaddress';
+// import {
+// HrmPostSet
+// } from './postset';
+// import {
+// HrmMajorSet
+// } from './majorset';
+// const hrmAdAreaSet = new HrmAdAreaSet();
+// const hrmOfficeAddress = new HrmOfficeAddress();
+// const hrmPostSet = new HrmPostSet();
+// const hrmMajorSet = new HrmMajorSet();
+
+export class HrmImportCommon {
+ sourceStore = null;
+ @observable pageName = '';
+ @observable importType = '';
+ @observable importDialog = {
+ visible: false,
+ condition: [],
+ form: new WeaForm(),
+ title: '',
+ loading: true,
+ templetName: '',
+ selectedValue: 'workcode',
+ }
+
+ @observable resultDialog = {
+ title: observable.ref(i18n.label.importResult()),
+ errorTip: observable.ref(i18n.message.selectImportTempleteError()),
+ visible: false,
+ index: 1,
+ datas: [],
+ importStatus: '',
+ pId: '',
+ interval: '',
+ tableStore: new TableStore(),
+ errorInfo: [],
+ succnum: 0,
+ failnum: 0,
+ loading: true,
+ component: '',
+ }
+
+ @observable recordDialog = {
+ title: observable.ref(i18n.button.importHistoryQuery()),
+ visible: false,
+ tableStore: new TableStore(),
+ }
+
+ @observable logDialog = {
+ title: observable.ref(i18n.button.getImportLog()),
+ visible: false,
+ tableStore: new TableStore(),
+ isPanelShow: false,
+ form: new WeaForm(),
+ condition: [],
+ loading: true,
+ }
+
+ @action
+ getImportForm = () => {
+ this.importDialog.loading = true;
+ let params = {
+ importType: this.importType
+ }
+ Api.getImportForm(params).then(rs => {
+ const {
+ status,
+ condition = [],
+ } = rs;
+
+ if (status == '1') {
+ this.importDialog.condition = condition;
+ const copy = [...condition];
+ copy.splice(1);
+ copy[0].items.splice(2);
+ this.importDialog.form.initFormFields(copy);
+ this.importDialog.loading = false;
+ } else {
+ // message.error(rs.message);
+ }
+ }).catch(error => {
+ message.error(error);
+ });
+ }
+
+ @action
+ getImportProcessInfo = () => {
+ let params = {
+ importType: this.importType,
+ index: this.resultDialog.index,
+ };
+ Api.getImportProcessLog(params).then(rs => {
+ const {
+ datas,
+ index,
+ pId = '',
+ status
+ } = rs;
+
+ this.resultDialog.loading = false;
+ if (status == '1') {
+ const {
+ importStatus,
+ interval,
+ errorInfo,
+ component
+ } = this.resultDialog;
+
+ component.scrollToLast();
+
+ if (importStatus == 'over' || importStatus == 'error') {
+ clearInterval(interval);
+ if (!this.hasErrorInfo(errorInfo)) this.getResultInfo();
+
+ this.sourceStore && this.sourceStore.getTable();
+
+ //根据pageName判断刷新那个页面的列表
+ // switch (this.pageName) {
+ // case 'adareaset':
+ // hrmAdAreaSet.setOperation('getTable');
+ // hrmAdAreaSet.setFuncName('getCountryList');
+ // hrmAdAreaSet.getTable();
+ // break;
+ // case 'officeaddress':
+ // hrmOfficeAddress.getTableInfo();
+ // break;
+ // case 'post':
+ // hrmPostSet.initSet('getTableInfo', 'getJobGroupList');
+ // hrmPostSet.getTableInfo();
+ // break;
+ // case 'major':
+ // hrmMajorSet.setOperation('getTableInfo');
+ // hrmMajorSet.getTableInfo();
+ // break;
+ // }
+ return
+ }
+
+ if (rs.importStatus == 'over' || rs.importStatus == 'error') {
+ this.resultDialog.loading = true;
+ }
+
+ this.resultDialog.importStatus = rs.importStatus;
+
+ if (pId) this.resultDialog.pId = pId;
+
+ if (this.resultDialog.datas.length == 0) {
+ this.resultDialog.datas = datas;
+ } else {
+ this.resultDialog.datas = [...this.resultDialog.datas, ...datas]
+ }
+
+ this.resultDialog.index = index;
+ }
+
+ });
+ }
+
+ @action
+ getResultInfo = () => {
+ let params = {
+ pId: this.resultDialog.pId
+ };
+ this.resultDialog.loading = true;
+ Api.getImportResult(params).then(rs => {
+ const {
+ datas,
+ status
+ } = rs, {
+ succnum,
+ failnum,
+ sessionkey = ''
+ } = datas;
+
+ if (status == '1') {
+ this.resultDialog.succnum = succnum;
+ this.resultDialog.failnum = failnum;
+ sessionkey && this.resultDialog.tableStore.getDatas(sessionkey, 1);
+ }
+ this.resultDialog.loading = false;
+ });
+ }
+
+ @action
+ getRecordTable = () => {
+ let params = {
+ importType: this.importType
+ };
+ Api.getImportHistory(params).then(rs => {
+ const {
+ status,
+ sessionkey,
+ } = rs;
+
+ if (status == '1') {
+ this.recordDialog.tableStore.getDatas(sessionkey, 1);
+ } else {
+ message.error(rs.message);
+ }
+ }).catch(error => {
+ message.error(error);
+ });
+ }
+
+ @action
+ getLogTable = () => {
+ let params = {
+ importType: this.importType,
+ ...this.logDialog.form.getFormParams(),
+ };
+ if (this.resultDialog.pId) {
+ params = { ...params,
+ pId: this.resultDialog.pId
+ }
+ }
+ Api.getImportLogDetail(params).then(rs => {
+ const {
+ status,
+ sessionkey
+ } = rs;
+
+ if (status == '1') {
+ this.logDialog.tableStore.getDatas(sessionkey, 1);
+ } else {
+ message.error(rs.message);
+ }
+ }).catch(error => {
+ message.error(error);
+ });
+ }
+
+ @action
+ submitImportInfo = () => {
+ let params = {
+ importType: this.importType,
+ excelfile: this.importDialog.excelFileId,
+ operateType: 'add'
+ };
+ if (this.importType == 'group') {
+ params = {
+ ...params,
+ ...this.importDialog.form.getFormParams()
+ }
+ }
+ this.setResultInfoDialogVisible(true);
+ Api.saveImport(params).then(rs => {
+ const {
+ status,
+ errorInfo
+ } = rs;
+
+ if (status == '1') {
+ if (this.hasErrorInfo(errorInfo)) {
+ this.resultDialog.errorInfo = errorInfo;
+ this.resultDialog.importStatus = 'error';
+ }
+ } else {
+ message.error(rs.message);
+ }
+ }).catch(error => {
+ message.error(error);
+ });
+ this.resultDialog.interval = setInterval(() => this.getImportProcessInfo(), 2000);
+ }
+
+ @action
+ getLogSearchPanelCondition = () => {
+ this.logDialog.loading = true;
+ let params = {
+ importType: this.importType
+ };
+ Api.getImportLogSearchCondition(params).then(rs => {
+ const {
+ status,
+ searchCondition
+ } = rs;
+
+ if (status == '1') {
+ this.logDialog.condition = searchCondition;
+ this.logDialog.form.initFormFields(searchCondition);
+ } else {
+ message.error(rs.message);
+ }
+ this.logDialog.loading = false;
+ }).catch(error => {
+ message.error(error);
+ });
+ }
+
+ @action
+ setExcelFileNo = (id) => {
+ extendObservable(this.importDialog, {
+ excelFileId: id
+ });
+ }
+
+ @action
+ submitExcel = () => {
+ if (!this.importDialog.excelFileId) {
+ message.warning(i18n.message.selectImportTemplete());
+ return;
+ }
+ this.submitImportInfo();
+ }
+
+ @action
+ queryRecord = () => {
+ this.setRecordDialogVisible(true);
+ }
+
+ @action
+ queryLog = () => {
+ this.setLogDialogVisible(true);
+ }
+
+ @action
+ jumpToImportResult = (id) => {
+ this.resultDialog.pId = id;
+ this.resultDialog.importStatus = 'over';
+ this.setResultInfoDialogVisible(true);
+ this.getResultInfo();
+ }
+
+
+ @action
+ setImportDialogVisible = (bool) => {
+ this.importDialog.visible = bool;
+ if (bool) {
+ this.getImportForm();
+ } else {
+ this.importDialogReset();
+ }
+
+ }
+
+ //设置标识,标识当前是那个页面在导入
+ @action
+ setImportPage = (pageName) => {
+ this.pageName = pageName;
+ }
+
+ @action
+ setResultInfoDialogVisible = (bool) => {
+ this.resultDialog.visible = bool;
+ if (!bool) {
+ clearInterval(this.resultDialog.interval);
+ this.resetResultDialogStatus();
+ }
+ }
+
+ @action
+ importDialogReset = () => {
+ this.importDialog.condition = [];
+ this.importDialog.form = new WeaForm();
+ this.importDialog.selectedValue = 'workcode';
+ this.importDialog.excelFileId = '';
+ }
+
+ @action
+ resetResultDialogStatus = () => {
+ this.resultDialog.index = 1;
+ this.resultDialog.datas = [];
+ this.resultDialog.importStatus = '';
+ this.resultDialog.pId = '';
+ this.resultDialog.interval = '';
+ this.resultDialog.errorInfo = '';
+ this.resultDialog.loading = true;
+ }
+
+ @action
+ setRecordDialogVisible = (bool) => {
+ this.recordDialog.visible = bool;
+ bool && this.getRecordTable();
+ }
+
+ @action
+ setLogDialogVisible = (bool) => {
+ this.logDialog.visible = bool;
+ bool && this.getLogTable();
+ if (!bool) {
+ this.logDialog.isPanelShow = false;
+ this.logDialog.form = new WeaForm();
+ this.logDialog.condition = [];
+ }
+ }
+
+ @action
+ setLogPanelStatus = (bool) => {
+ this.logDialog.isPanelShow = bool;
+ bool && this.logDialog.condition.length == 0 && this.getLogSearchPanelCondition();
+ }
+
+ @action
+ searchLogInfo = () => {
+ this.getLogTable();
+ }
+
+ hasErrorInfo = (errorInfo) => {
+ if (errorInfo.length == 0) return false;
+ return true
+ }
+
+ @action
+ setTempletName = (templetName) => {
+ this.importDialog.templetName = templetName;
+ }
+
+ @action
+ setImportDialogTitle = (title) => {
+ this.importDialog.title = title;
+ }
+
+ @action
+ setImportType = (type) => {
+ this.importType = type;
+ }
+
+ @action
+ setSelectedValue = (value) => {
+ this.importDialog.selectedValue = value;
+ }
+
+ @action
+ setScoll = (component) => {
+ this.resultDialog.component = component;
+ }
+
+ setSourceStore = (store) => {
+ this.sourceStore = store;
+ }
+
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/importresource.js b/pc4mobx/organization/stores/importresource.js
new file mode 100644
index 0000000..3f000b0
--- /dev/null
+++ b/pc4mobx/organization/stores/importresource.js
@@ -0,0 +1,370 @@
+import {
+ observable,
+ action
+} from 'mobx';
+import {
+ WeaForm
+} from 'comsMobx';
+import * as API from '../apis/importresource';
+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 HrmImportResource {
+ @observable title = "人员导入";
+ @observable templetName = "导入模板";
+ titleResult = i18n.label.importResult;
+ titleHistory = i18n.button.importHistoryQuery;
+ titleImportLog = i18n.button.getImportLog;
+ importResultColumns = [];
+ index = 1;
+ @observable scrollTarget;
+ @observable visible = false;
+ @observable visibleResult = false;
+ @observable visibleHistory = false;
+ @observable visibleImportLog = false;
+ @observable condition = [];
+ @observable single = false;
+ @observable keyField = 'workcode';
+ @observable importType = '';
+ @observable operateType = 'add';
+ @observable filelist = [];
+ @observable excelfile = '';
+ @observable searchCondition = [];
+ @observable form = new WeaForm();
+ @observable showSearchAd = false;
+ @observable searchParamsAd = {};
+ @observable importResultStore = new TableStore();
+ @observable importHistoryStore = new TableStore();
+ @observable importLogStore = new TableStore();
+ @observable buttons = [];
+ @observable importProcessLogDatas = [];
+ @observable succnum = 0;
+ @observable failnum = 0;
+ @observable importResultTip = '';
+ @observable importStatus = '';
+ @observable pId = '';
+ @observable ref;
+ @observable errorInfo = '';
+ @observable dialogKey = new Date().getTime();
+ @observable otherParams;
+ @observable showLoadingSpin = false;
+ interval;
+ importCallback;
+ getTemplateUrl;
+ @observable importParams = {};
+
+ importResultColumns = [{
+ "title": i18n.label.confirmInfo(),
+ "width": "100%",
+ "dataIndex": "message",
+ render: (text, record, index) => {
+ return {text}
+ }
+ }];
+
+ @action
+ init() {
+ this.condition = [];
+ this.keyField = 'workcode';
+ this.importType = '';
+ this.operateType = 'add';
+ this.filelist = [];
+ this.excelfile = '';
+ this.searchCondition = [];
+ this.buttons = [];
+ this.importProcessLogDatas = [];
+ this.succnum = 0;
+ this.failnum = 0;
+ this.importResultTip = '';
+ this.importStatus = '';
+ this.pId = '';
+ this.errorInfo = '';
+ this.importParams = {};
+ }
+
+ @action setParam = (k, v) => {
+ const p = toJS(this.importParams);
+ Object.assign(p, {
+ [k]: v
+ });
+ this.importParams = p;
+ }
+
+ getImportForm(params = {}) {
+ this.showLoadingSpin = true;
+ params.importType = this.importType;
+ this.otherParams != null && Object.assign(params, {
+ otherParams: JSON.stringify({ ...this.otherParams,
+ type: this.operateType
+ })
+ })
+ 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);
+ }
+
+ this.showLoadingSpin = false;
+ }, error => {
+ message.warning(error.message);
+ this.showLoadingSpin = false;
+ })
+ }
+
+ saveImport = (params = {}) => {
+ params.keyField = this.keyField;
+ params.importType = this.importType;
+ params.operateType = this.operateType;
+ params.excelfile = this.excelfile || '';
+ if (params.excelfile == '') {
+ message.warning(i18n.message.selectImportTemplete());
+ return;
+ }
+ if (this.otherParams != null) {
+ Object.assign(params, {
+ otherParams: JSON.stringify(this.otherParams)
+ })
+ has(this.otherParams, 'logSmallType') && Object.assign(params, {
+ logSmallType: this.otherParams.logSmallType
+ })
+ }
+
+ this.importResultColumns = [{
+ "title": i18n.label.confirmInfo(),
+ "width": "100%",
+ "dataIndex": "message",
+ render: (text, record, index) => {
+ return {text}
+ }
+ }];
+ this.index = 1;
+ this.importStatus = '';
+ this.importProcessLogDatas = [];
+ this.importStatus = 'importing';
+ this.getImportProcess();
+ this.doImport({...params, ...this.importParams, confirm: 0});
+ this.dialogKey = new Date().getTime();
+ this.visibleResult = true;
+ }
+
+ @action doImport = params => {
+ API.saveImport(params).then(data => {
+ if (data.code == 200) {
+ if(data.message != null && data.message.trim().length > 0 && params.importType == 'matrix'){
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: data.message,
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk: () => {
+ this.doImport({...params, confirm: 1})
+ }
+ });
+ }else if (!isEmpty(data.errorInfo)) {
+ this.importStatus = 'error';
+ this.importResultTip = i18n.message.selectImportTempleteError();
+ this.importResultColumns = [{
+ "title": i18n.label.confirmInfo(),
+ "width": "100%",
+ "dataIndex": "message",
+ render: (text, record, index) => {
+ return {text}
+ }
+ }];
+ this.importProcessLogDatas = data.errorInfo;
+ }else{
+ this.importCallback && this.importCallback();
+ }
+ }else {
+ this.importStatus = 'error';
+ message.warning(data.message);
+ }
+ })
+ }
+
+ getImportProcess() {
+ this.interval = setInterval(() => this.getImportProcessLog(), 2000);
+ }
+
+ getImportProcessLog(params = {}) {
+ if (this.visibleResult == false || this.importStatus == 'over' || this.importStatus == 'error') {
+ clearInterval(this.interval);
+ return;
+ }
+ params.index = this.index;
+ params.importType = this.importType;
+ let textColor = "";
+ this.importResultColumns = [{
+ "title": i18n.label.row(),
+ "width": "15%",
+ "dataIndex": "rownum"
+ }, {
+ "title": i18n.label.status(),
+ "width": "15%",
+ "dataIndex": "status",
+ render: (text, record, index) => {
+ if (text == '1') {
+ textColor = "#54D3A2";
+ } else {
+ textColor = "#FF0000";
+ }
+ return {text=='1'?i18n.label.success():i18n.label.fail()}
+ }
+ }, {
+ "title": i18n.label.confirmInfo(),
+ "width": "70%",
+ "dataIndex": "message",
+ render: (text, record, index) => {
+ return {text}
+ }
+ }];
+ API.getImportProcessLog(params).then((data) => {
+ if (data.status == '1') {
+ if (!isEmpty(this.importProcessLogDatas)) {
+ this.importProcessLogDatas = [...this.importProcessLogDatas, ...data.datas]
+ } else {
+ this.importProcessLogDatas = data.datas;
+ }
+ this.index = data.index;
+ if (data.pId) {
+ this.pId = data.pId;
+ }
+
+ const {importStatus} = data;
+ if(['over', 'error'].indexOf(importStatus) > -1)
+ this.importStatus = importStatus;
+ //this.scrollTarget.scrollToLast();
+ if (data.importStatus == 'over') {
+ this.getImportResult({
+ pId: this.pId
+ });
+ clearInterval(this.interval);
+ }
+ } else {
+ message.warning(data.message);
+ }
+ }, error => {
+ message.warning(error.message);
+ })
+ }
+
+ setScrollTarget(scroll) {
+ this.scrollTarget = scroll;
+ }
+
+ getImportResult(params = {}) {
+ this.importStatus = 'over';
+ if (params.pId) {
+ this.pId = params.pId;
+ }
+ API.getImportResult(params).then((data) => {
+ if (data.status == '1') {
+ this.failnum = data.datas.failnum;
+ this.succnum = data.datas.succnum;
+ if (this.failnum > 0) {
+ let info = i18n.label.importResourceResultInfo();
+ info = info.replace('{rownum}', this.succnum + this.failnum).replace('{succnum}', this.succnum);
+ this.importResultTip = info;
+ this.importResultStore.getDatas(data.datas.sessionkey, 1);
+ } else {
+ let info = i18n.label.importResourceResultInfo1();
+ info = info.replace('{rownum}', this.succnum);
+ this.importResultTip = info;
+ }
+ } else {
+ message.warning(data.message);
+ }
+ }, error => {
+ message.warning(error.message);
+ })
+ }
+
+ getImportHistory(params = {}) {
+ params.importType = this.importType;
+ this.otherParams != null && has(this.otherParams, 'logSmallType') && Object.assign(params, {
+ logSmallType: this.otherParams.logSmallType
+ })
+ API.getImportHistory(params).then((data) => {
+ if (data.status == '1') {
+ data.sessionkey && this.importHistoryStore.getDatas(data.sessionkey, 1);
+ } else {
+ message.warning(data.message);
+ }
+ }, error => {
+ message.warning(error.message);
+ })
+ }
+
+ getImportLogDetail(params = {}) {
+ if (this.pId) params.pId = this.pId;
+ params.importType = this.importType;
+ API.getImportLogDetail(params).then((data) => {
+ if (data.status == '1') {
+ data.sessionkey && this.importLogStore.getDatas(data.sessionkey, 1);
+ } else {
+ message.warning(data.message);
+ }
+ }, error => {
+ message.warning(error.message);
+ })
+ }
+
+ getImportLogSearchCondition(params = {}) {
+ if (this.pId) params.pId = this.pId;
+ this.form.updateIsFormInit(false);
+ this.form = new WeaForm();
+ API.getImportLogSearchCondition(params).then((data) => {
+ if (data.status == '1') {
+ this.searchCondition = data.searchCondition;
+ this.form.initFormFields(data.searchCondition);
+ } else {
+ message.warning(data.message);
+ }
+ }, error => {
+ message.warning(error.message);
+ })
+ }
+
+
+ doSearch(params = {}) {
+ let formParams = this.form.getFormParams();
+ this.getImportLogDetail(formParams);
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index 7db733f..9466607 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -19,6 +19,9 @@ import {FieldDefinedStore} from "./fieldDefined";
import {ResourceStore} from "./resource";
import {ResourceExtendStore} from "./resourceExtend";
import {DatasImportStore} from "./datasImport";
+import {HrmImportResource} from "./importresource";
+import {HrmImportCommon} from "./importCommon";
+import {HrmBasicDataImport} from "./import"
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
@@ -41,5 +44,8 @@ module.exports = {
fieldDefined: new FieldDefinedStore(),
resource: new ResourceStore(),
resourceExtend: new ResourceExtendStore(),
- datasImport: new DatasImportStore()
+ datasImport: new DatasImportStore(),
+ hrmImportResource:new HrmImportResource(),
+ hrmImportCommon:new HrmImportCommon(),
+ hrmBasicDataImport:new HrmBasicDataImport()
};
diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js
index 25ec5b3..8ed79a2 100644
--- a/pc4mobx/organization/stores/resource.js
+++ b/pc4mobx/organization/stores/resource.js
@@ -179,6 +179,7 @@ const {
...this.form.getFormParams()
}
Api.exportResource(toJS(this.tableStore.selectedRowKeys).toString());
+ this.tableStore.selectedRowKeys = [];
}
updateFields(val) {
diff --git a/pc4mobx/organization/style/import.css b/pc4mobx/organization/style/import.css
new file mode 100644
index 0000000..5e68d7b
--- /dev/null
+++ b/pc4mobx/organization/style/import.css
@@ -0,0 +1,86 @@
+.hrm-card-out{
+ width: 24%;
+ height: 130px;
+ float: left;
+ margin-left: 1.3%;
+ margin-top: 10px;
+}
+
+.hrm-card-inwrap{
+ height: 100%;
+ position: relative;
+ cursor: pointer;
+}
+
+.hrm-card-icon{
+ width: 40px;
+ font-size: 40px;
+ position: absolute;
+ left: 50%;
+ margin-left: -20px;
+ margin-top: 30px;
+ color: #fff;
+}
+
+.hrm-card-title{
+ /*width: 80px;*/
+ text-align: right;
+ position: absolute;
+ right: 20px;
+ font-size: 17px;
+ bottom: 15px;
+ color: #fff;
+}
+
+.hrm-import-wrap{
+ width: 90%;
+ height: 100%;
+ margin-left: 5%;
+ padding-top: 30px;
+}
+
+.hrm-import-table-th .ant-table-tbody>tr>td, .ant-table-thead>tr>th{
+ padding: 8px 8px;
+ color: #666;
+}
+
+.hrm-import-table-th .ant-table-thead>tr>th{
+ background-color: #F0F6F6;
+}
+
+.hrm-import-table-th .ant-table{
+ border-radius: 0;
+}
+
+.hrm-import-table-th .ant-table table{
+ border-radius: 0;
+}
+
+.hrm-import-loading .ant-spin.ant-spin-show-text .ant-spin-text{
+ float: right;
+ margin-left: 20px;
+ padding-top: 2px
+}
+
+.hrm-import-error-tip{
+ width: 30px;
+ height: 30px;
+ border-radius: 25px;
+ padding: 6px;
+ /* margin-left: 230px; */
+ margin-right: 10px;
+ display: inline-block;
+ background-color: rgb(255, 0, 0);
+}
+
+.hrm-import-ant-table .ant-table-tbody>tr>td, .ant-table-thead>tr>th{
+ padding: 8px 8px;
+}
+
+.hrm-import-link{
+ color: #B4B4B4;
+}
+
+.hrm-import-link:hover{
+ color: #FFF;
+}
\ No newline at end of file