人员导入模块新增
This commit is contained in:
parent
58b118ebe3
commit
c52d10323a
|
|
@ -0,0 +1,17 @@
|
|||
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);
|
||||
}
|
||||
//获取导入结果回调数据
|
||||
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);
|
||||
}
|
||||
|
|
@ -83,7 +83,21 @@ export const getJobExtendForm = (params) => {
|
|||
return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', 'GET', params);
|
||||
}
|
||||
|
||||
|
||||
export const getHasRight = (params) => {
|
||||
return WeaTools.callApi('/api/bs/hrmorganization/job/getHasRight', 'GET', params);
|
||||
}
|
||||
|
||||
export const getMergeForm = (params = {}) => {
|
||||
return WeaTools.callApi('/api/bs/hrmorganization/job/getMergeForm', 'GET', params);
|
||||
}
|
||||
|
||||
export const merge = (params) => {
|
||||
return fetch('/api/bs/hrmorganization/job/mergeJob', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,341 @@
|
|||
import {
|
||||
inject,
|
||||
observer
|
||||
} from 'mobx-react';
|
||||
import {
|
||||
WeaUpload,
|
||||
WeaDialog,
|
||||
WeaFormItem,
|
||||
WeaSearchGroup,
|
||||
WeaNewScroll,
|
||||
WeaSelect,
|
||||
WeaInput,
|
||||
WeaAlertPage,
|
||||
WeaLocaleProvider
|
||||
} from 'ecCom'
|
||||
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Button,
|
||||
Spin
|
||||
} from 'antd'
|
||||
|
||||
import {
|
||||
WeaSwitch
|
||||
} from 'comsMobx'
|
||||
import React from 'react'
|
||||
import {
|
||||
i18n
|
||||
} from '../../public/i18n';
|
||||
import { addContentPath, renderNoright } from '../../util/index.js'
|
||||
import '../../style/common.less'
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject('datasImport')
|
||||
@observer
|
||||
export default class DatasImport extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.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 {
|
||||
datasImport
|
||||
} = this.props;
|
||||
const {
|
||||
condition
|
||||
} = datasImport;
|
||||
let _arr = [];
|
||||
|
||||
condition.map((c, i) => {
|
||||
let arr = [];
|
||||
if (i == 0) { //基本信息
|
||||
c.items.map((field, index) => {
|
||||
arr.push({
|
||||
com: (
|
||||
<div>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m9t2kn@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@rc5who@${index}`} span={1} offset={4}>
|
||||
<div style={{ marginTop: 15 }}>
|
||||
<div style={this.getCircle()}><div style={{ paddingTop: 2 }}>{index + 1}</div></div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@f1sc6s@${index}`} span={14}>
|
||||
<div style={{ marginTop: 15 }}>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@5gsx6o@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@qrdxst@${index}`} span={field.labelcol} style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }} title={field.label}>{field.label}:</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7jy5um@${index}`} span={field.fieldcol}>
|
||||
{this.getDom(field)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
),
|
||||
colSpan: 1,
|
||||
})
|
||||
})
|
||||
}
|
||||
if (i == 1) { //导入说明
|
||||
c.items.map((field, index) => {
|
||||
arr.push({
|
||||
com: (
|
||||
<div>
|
||||
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@hz50xl@${index}`}>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@fgfbrv@${index}`} span={1} offset={4} style={{ marginTop: 15 }}>
|
||||
<div style={this.getCircle()}>
|
||||
<div style={{ paddingTop: 2 }}>{index + 1}</div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5rom81@${index}`} span={17} style={{ marginTop: 15 }}>
|
||||
{this.getIllustration(field.value, field.link, index, field)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
),
|
||||
colSpan: 1
|
||||
})
|
||||
})
|
||||
}
|
||||
_arr.push(<div><WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@bo47pp@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={arr} col={1} /></div>)
|
||||
|
||||
});
|
||||
return _arr;
|
||||
}
|
||||
|
||||
getDom(field) {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
const {
|
||||
templetName,
|
||||
filelist,
|
||||
getTemplateUrl,
|
||||
importParams
|
||||
} = datasImport;
|
||||
let dom;
|
||||
let domkey = field.domkey;
|
||||
if (domkey[0] == 'templet') {
|
||||
dom = <a href={addContentPath(field.value)}>{i18n.label.importTemplate()}</a>;
|
||||
} else if (domkey[0] === 'exportData') {
|
||||
const href = datasImport.operateType === 'add' ? field.otherParams.fileVal[0].add : field.otherParams.fileVal[0].update;
|
||||
if (datasImport.importType === 'matrix') {
|
||||
dom = <a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType, importParams) }}>{i18n.label.importTemplate()}</a>
|
||||
} else
|
||||
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||
} else if (domkey[0] == 'excelfile' || domkey[0] == 'importfile') {
|
||||
dom = (<div>
|
||||
<div style={{ float: 'left', marginTop: -10 }}>
|
||||
<WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@iu8n01`}
|
||||
uploadUrl='/api/doc/upload/uploadFile'
|
||||
category='string'
|
||||
limitType='xls,xlsx'
|
||||
maxFilesNumber={1}
|
||||
datas={filelist}
|
||||
{...field.otherParams}
|
||||
onChange={
|
||||
(ids, list) => {
|
||||
this.setFileId(ids, list)
|
||||
}
|
||||
} >
|
||||
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@87232v`}>{i18n.button.selectFile()}</Button>
|
||||
</WeaUpload>
|
||||
</div>
|
||||
<div style={{ float: 'left', paddingLeft: 10 }}>
|
||||
{filelist.length == 0 ? <p>{i18n.label.noFileSelected()}</p> : filelist.map(file => <p>{file.filename}</p>)}
|
||||
</div>
|
||||
</div>)
|
||||
} 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 = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@yzc92h`}
|
||||
style={{ width: 200 }}
|
||||
options={field.options}
|
||||
value={datasImport.importParams[domkey[0]] || field.value || val}
|
||||
onChange={(v) => { datasImport.setParam(domkey[0], v) }}
|
||||
/>
|
||||
} else if (domkey[0] == 'importType') {
|
||||
dom = <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@holhhb`}
|
||||
style={{ width: 200 }}
|
||||
options={field.options}
|
||||
value={datasImport.operateType}
|
||||
onChange={(v) => { datasImport.operateType = v }}
|
||||
/>
|
||||
} else {
|
||||
dom = <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@rg6f3p`} hasBorder={true} viewAttr={1} value={field.value} />
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
|
||||
getIllustration(val, url, index, link) {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
const {
|
||||
templetName,
|
||||
getTemplateUrl,
|
||||
importParams
|
||||
} = datasImport;
|
||||
let p;
|
||||
if (index == 0) {
|
||||
if (url instanceof Object) {
|
||||
const href = datasImport.operateType === 'add' ? url.add : url.update;
|
||||
let dom;
|
||||
if (datasImport.importType === 'matrix') {
|
||||
dom = <a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType, importParams) }}>{i18n.label.importTemplate()}</a>
|
||||
} else
|
||||
dom = <a href={addContentPath(href)}>{i18n.label.importTemplate()}</a>;
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:{dom}</p>);
|
||||
} else if (url != null) {
|
||||
if (datasImport.importType === 'matrix') {
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:<a onClick={() => { getTemplateUrl(datasImport.otherParams.matrixid, datasImport.operateType) }}>{i18n.label.importTemplate()}</a></p>);
|
||||
} else
|
||||
p = (<p>{i18n.label.downLoadTemplete()}:<a href={addContentPath(url)}>{i18n.label.importTemplate()}</a></p>);
|
||||
} else {
|
||||
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||
}
|
||||
} else {
|
||||
p = (<p><div dangerouslySetInnerHTML={{ __html: val }} /></p>);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
setFileId(ids, list) {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.excelfile = ids;
|
||||
datasImport.filelist = list;
|
||||
}
|
||||
|
||||
onUploading(s) {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.status = s;
|
||||
}
|
||||
|
||||
submit() {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.saveImport({}, () => {
|
||||
this.refs.scroll && this.refs.scroll.scrollToLast()
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
const {
|
||||
datasImport,
|
||||
onClose
|
||||
} = this.props;
|
||||
datasImport.visible = false
|
||||
datasImport.init();
|
||||
onClose && onClose();
|
||||
}
|
||||
|
||||
importHistoryQuery() {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.visibleHistory = true;
|
||||
datasImport.getImportHistory();
|
||||
}
|
||||
|
||||
render() {
|
||||
debugger
|
||||
const {
|
||||
datasImport,
|
||||
mainTitle,
|
||||
importLog,
|
||||
viewLog,
|
||||
viewLogTitle,
|
||||
} = this.props;
|
||||
const {
|
||||
title,
|
||||
visible,
|
||||
titleResult,
|
||||
visibleResult,
|
||||
importResultColumns,
|
||||
importProcessLogDatas,
|
||||
failnum,
|
||||
succnum,
|
||||
importResultTip,
|
||||
importResultStore,
|
||||
importStatus,
|
||||
errorInfo,
|
||||
setScrollRef,
|
||||
single,
|
||||
showLoadingSpin,
|
||||
condition
|
||||
} = datasImport;
|
||||
const buttons = condition.length ? [
|
||||
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ip7b32`} type="primary" onClick={() => this.submit()}>{i18n.button.submit()}</Button>),
|
||||
] : [];
|
||||
|
||||
let dialogHeight = window.innerHeight - 150;
|
||||
if (dialogHeight > 560) dialogHeight = 560;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@s55z5q`}
|
||||
title={mainTitle || title}
|
||||
icon="icon-coms-hrm"
|
||||
iconBgcolor="#217346"
|
||||
visible={visible}
|
||||
closable={true}
|
||||
onCancel={() => this.cancel()}
|
||||
buttons={buttons}
|
||||
style={{ width: 870, height: dialogHeight }}
|
||||
moreBtn={{
|
||||
datas: condition ? [{
|
||||
key: '1',
|
||||
content: i18n.button.submit(),
|
||||
icon: <i className='icon-coms-Preservation' />,
|
||||
onClick: () => this.submit(),
|
||||
}] : []
|
||||
}}
|
||||
>
|
||||
{condition.length ? (
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@1fvd3j`} spinning={showLoadingSpin}>
|
||||
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@2908z2`} height={dialogHeight} ref="scrollBar">
|
||||
{this.getForm()}
|
||||
</WeaNewScroll>
|
||||
</Spin>
|
||||
) : <div></div>
|
||||
}
|
||||
</WeaDialog>
|
||||
}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @Author: 程亮
|
||||
* @Date: 2022-05-26 14:05:59
|
||||
* @LastEditTime: 2022-06-24 14:36:50
|
||||
* @LastEditTime: 2022-06-27 11:23:42
|
||||
* @Description:
|
||||
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
|
||||
*/
|
||||
|
|
@ -79,9 +79,7 @@ export default class Job extends React.Component {
|
|||
const {
|
||||
job
|
||||
} = this.props;
|
||||
job.getTableInfo();
|
||||
job.getHasRight();
|
||||
job.getCopyForm()
|
||||
job.initData();
|
||||
}
|
||||
|
||||
getTopMenuBtns() {
|
||||
|
|
@ -144,7 +142,21 @@ export default class Job extends React.Component {
|
|||
}
|
||||
|
||||
merge(id) {
|
||||
alert("后续更新")
|
||||
const {
|
||||
job
|
||||
} = this.props;
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: this.getCopyForm({isCopy:false}),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk() {
|
||||
job.merge(id)
|
||||
},
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -159,7 +171,7 @@ export default class Job extends React.Component {
|
|||
job.setIds(keys);
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: this.getCopyForm(),
|
||||
content: this.getCopyForm({isCopy:true}),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk() {
|
||||
|
|
@ -171,20 +183,23 @@ export default class Job extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
getCopyForm() {
|
||||
getCopyForm(params) {
|
||||
const {
|
||||
job
|
||||
} = this.props;
|
||||
const {
|
||||
copyCondition,
|
||||
mergeCondition,
|
||||
form2,
|
||||
} = job;
|
||||
params.isCopy ? form2.initFormFields(copyCondition) : form2.initFormFields(mergeCondition);
|
||||
let formParams = form2.getFormParams();
|
||||
let condition = params.isCopy ? copyCondition : mergeCondition;
|
||||
const {
|
||||
isFormInit
|
||||
isFormInit
|
||||
} = form2;
|
||||
let arr = [];
|
||||
isFormInit && copyCondition.map(c => {
|
||||
isFormInit && condition.map(c => {
|
||||
c.items.map((field, index) => {
|
||||
arr.push(
|
||||
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import '../../style/common.less';
|
|||
|
||||
import NewAndEditDialog from '../NewAndEditDialog';
|
||||
import { renderNoright } from '../../util';
|
||||
import DatasImport from '../import/datasImport';
|
||||
|
||||
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ const WeaTable = WeaTableNew.WeaTable;
|
|||
|
||||
|
||||
@inject('resource')
|
||||
@inject('datasImport')
|
||||
@observer
|
||||
export default class Resource extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -143,12 +145,22 @@ export default class Resource extends React.Component {
|
|||
resource
|
||||
} = this.props;
|
||||
|
||||
resource.setNeDialogTitle(i18n.label.newRankScheme());
|
||||
resource.setNeDialogTitle(i18n.label.newPeople());
|
||||
resource.setIsNew(true);
|
||||
resource.setVisible(true);
|
||||
resource.getForm();
|
||||
}
|
||||
|
||||
import() {
|
||||
const {
|
||||
datasImport
|
||||
} = this.props;
|
||||
datasImport.visible = true;
|
||||
datasImport.title = i18n.button.importResource();
|
||||
datasImport.importType = 'resource';
|
||||
datasImport.getImportForm();
|
||||
}
|
||||
|
||||
batchDelete() {
|
||||
const {
|
||||
resource
|
||||
|
|
@ -406,7 +418,7 @@ export default class Resource extends React.Component {
|
|||
onClick={key => this.handleMenuClick(key)}
|
||||
>
|
||||
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
|
||||
title={i18n.label.schemeName()}
|
||||
title={i18n.label.resourceMange()}
|
||||
icon={<i className='icon-coms-hrm' />}
|
||||
iconBgcolor='#217346'
|
||||
loading={true}
|
||||
|
|
@ -453,6 +465,7 @@ export default class Resource extends React.Component {
|
|||
onCancel={() => resource.setVisible(false)}
|
||||
saveAndSetting = {() => this.handleSaveAndSetting()}
|
||||
/>
|
||||
<DatasImport ecId={`${this && this.props && this.props.ecId || ''}_DatasImport@q4rrwm`} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ export const i18n = {
|
|||
typeName: () => getLabel(129927, '类型名称'),
|
||||
ResourceName: () => getLabel(385936, '人员'),
|
||||
newPeople: () => getLabel(386246, '新建人员'),
|
||||
resourceMange: () => getLabel(386246, '人员管理'),
|
||||
|
||||
|
||||
authorizationGroup: () => getLabel(492, '权限组'),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,255 @@
|
|||
import {
|
||||
observable,
|
||||
action
|
||||
} from 'mobx';
|
||||
import {
|
||||
WeaForm
|
||||
} from 'comsMobx';
|
||||
import * as API from '../apis/datasImport';
|
||||
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 DatasImportStore {
|
||||
@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 = true;
|
||||
@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 <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
|
||||
@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 <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
this.index = 1;
|
||||
this.importStatus = '';
|
||||
this.importProcessLogDatas = [];
|
||||
this.importStatus = 'importing';
|
||||
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.status == '1') {
|
||||
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 <span style={{ color: '#FF0000' }}>{text}</span>
|
||||
}
|
||||
}];
|
||||
this.importProcessLogDatas = data.errorInfo;
|
||||
}else{
|
||||
this.importCallback && this.importCallback();
|
||||
}
|
||||
}else {
|
||||
this.importStatus = 'error';
|
||||
message.warning(data.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);
|
||||
})
|
||||
}
|
||||
|
||||
doSearch(params = {}) {
|
||||
let formParams = this.form.getFormParams();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @Author: 程亮
|
||||
* @Date: 2022-06-09 10:16:00
|
||||
* @LastEditTime: 2022-06-23 09:58:27
|
||||
* @LastEditTime: 2022-06-27 15:32:03
|
||||
* @Description:
|
||||
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
|
||||
*/
|
||||
|
|
@ -1405,10 +1405,10 @@ export class FieldDefinedStore extends HrmBaseStore {
|
|||
if (res.code === 200) {
|
||||
this.treeConfig.data = res.data;
|
||||
this.treeConfig.data.map(p => {
|
||||
if (p.domid === this.treeConfig.selectedKeys[0])
|
||||
if (p.domid === this.treeConfig.selectedKeys[0]+'')
|
||||
this.selectedTreeNodeInfo = p;
|
||||
p.childs && p.childs.map(c => {
|
||||
if (c.domid === this.treeConfig.selectedKeys[0])
|
||||
if (c.domid === this.treeConfig.selectedKeys[0]+'')
|
||||
this.selectedTreeNodeInfo = c;
|
||||
})
|
||||
})
|
||||
|
|
@ -1441,7 +1441,7 @@ export class FieldDefinedStore extends HrmBaseStore {
|
|||
|
||||
let defaultType = domid != '1' && domid != '2' && domid != '3' && domid != '4'
|
||||
|
||||
defaultType && t.topButtonDef.push({
|
||||
t.topButtonDef.push({
|
||||
comType: 'button',
|
||||
type: 'primary',
|
||||
onClickHandle: this.doChildInfoSetting,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { NumberSetStore } from "./numberSet";
|
|||
import {FieldDefinedStore} from "./fieldDefined";
|
||||
import {ResourceStore} from "./resource";
|
||||
import {ResourceExtendStore} from "./resourceExtend";
|
||||
import {DatasImportStore} from "./datasImport";
|
||||
|
||||
module.exports = {
|
||||
simpleOrgStore: new SimpleOrgStore(),
|
||||
|
|
@ -39,5 +40,6 @@ module.exports = {
|
|||
numberSet: new NumberSetStore(),
|
||||
fieldDefined: new FieldDefinedStore(),
|
||||
resource: new ResourceStore(),
|
||||
resourceExtend: new ResourceExtendStore()
|
||||
resourceExtend: new ResourceExtendStore(),
|
||||
datasImport: new DatasImportStore()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
i18n
|
||||
} from '../public/i18n';
|
||||
import {
|
||||
findIndex
|
||||
findIndex
|
||||
} from 'lodash';
|
||||
|
||||
const toJS = mobx.toJS;
|
||||
|
|
@ -40,10 +40,11 @@ export class JobStore {
|
|||
@observable searchCondition = [];
|
||||
@observable condition = [];
|
||||
@observable copyCondition = [];
|
||||
@observable mergeCondition = [];
|
||||
@observable isPanelShow = false; //高级搜索面板
|
||||
@observable form = new WeaForm();
|
||||
@observable form1 = new WeaForm(); //新增主表表单
|
||||
@observable form2 = new WeaForm(); //复制表单
|
||||
@observable form2 = new WeaForm(); //复制表单 合并表单
|
||||
@observable jobName = '';
|
||||
@observable conditionNum = 12;
|
||||
@observable ids = ''; //选择行id
|
||||
|
|
@ -66,6 +67,13 @@ export class JobStore {
|
|||
@observable selectTreeNodeInfo;
|
||||
saveAndSetting = false;
|
||||
|
||||
@action initData() {
|
||||
this.getTableInfo();
|
||||
this.getHasRight();
|
||||
this.getCopyForm();
|
||||
this.getMergeForm();
|
||||
}
|
||||
|
||||
@action
|
||||
getTableInfo() {
|
||||
this.setLoading(true);
|
||||
|
|
@ -207,7 +215,19 @@ export class JobStore {
|
|||
Api.getCopyForm(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data && this.setCopyCondition(res.data);
|
||||
res.data && this.form2.initFormFields(res.data);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
}
|
||||
|
||||
@action("合并表单")
|
||||
getMergeForm() {
|
||||
Api.getMergeForm().then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data && this.setMergeCondition(res.data);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
|
|
@ -262,7 +282,25 @@ export class JobStore {
|
|||
}).catch(error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
}
|
||||
|
||||
merge(id) {
|
||||
let params = {
|
||||
id: id,
|
||||
...this.form2.getFormParams()
|
||||
};
|
||||
Api.merge(params).then(response => {
|
||||
return response.json()
|
||||
}).then(data => {
|
||||
if (data.code === 200) {
|
||||
message.success(data.msg);
|
||||
this.getTableInfo();
|
||||
} else {
|
||||
message.error(data.msg);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
}
|
||||
|
||||
updateConditions(data) {
|
||||
|
|
@ -271,9 +309,9 @@ export class JobStore {
|
|||
value: '',
|
||||
},
|
||||
});
|
||||
const label = "等级方案"
|
||||
let index = findIndex(this.condition[0].items,{label});
|
||||
this.condition[0].items[index].browserConditionParam.replaceDatas = [];
|
||||
// const label = "等级方案"
|
||||
// const index = findIndex(this.condition[0].items, { label });
|
||||
// this.condition[0].items[index].browserConditionParam.replaceDatas = [{ name: data.sequence_id.valueObj[0].scheme_ids, id: "18" }];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -440,4 +478,8 @@ export class JobStore {
|
|||
this.saveAndSetting = bool;
|
||||
}
|
||||
|
||||
setMergeCondition(mergeCondition) {
|
||||
this.mergeCondition = mergeCondition;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -102,6 +102,23 @@ export const isEmpty = (obj) =>{
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加多级路径
|
||||
*
|
||||
* @param {*} url
|
||||
*/
|
||||
export const addContentPath = (url) => {
|
||||
const ecologyContentPath = window.ecologyContentPath || '';
|
||||
if (url && ecologyContentPath) {
|
||||
//避免重复添加ecologyContentPath
|
||||
//避免传入的参数不是链接
|
||||
if (url.startsWith('/') && !url.startsWith(ecologyContentPath)) {
|
||||
url = ecologyContentPath + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
|
||||
export const calFormHeight = (groupLength, children) => {
|
||||
let childrenLength = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue