花名册开发

This commit is contained in:
Chengliang 2023-01-06 18:01:46 +08:00
parent a88de27c35
commit d98f86be17
6 changed files with 287 additions and 52 deletions

View File

@ -0,0 +1,43 @@
import {
observer
} from 'mobx-react';
import {
WeaTransfer,
} from 'ecCom';
import {
toJS
} from 'mobx';
import isEmpty from 'lodash/isEmpty'
@observer
export default class Customization extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
store
} = this.props, {
TRANSFER,
transfer,
leftHeader,
rightHeader,
} = store, {
transferDatas,
transferKeys
} = transfer;
return (
<div className='customization' style={{padding: 20}}>
<WeaTransfer
{...TRANSFER}
data={toJS(transferDatas)}
selectedKeys={toJS(transferKeys)}
leftHeader={leftHeader}
rightHeader={rightHeader}
/>
</div>
);
}
}

View File

@ -270,7 +270,7 @@ export default class PersonnelResume extends React.Component {
}
//合并导出
MergeExport() {
mergeExport() {
const {
personnelResume
} = this.props;
@ -278,7 +278,7 @@ export default class PersonnelResume extends React.Component {
}
//全部导出
AllExport() {
allExport() {
const {
personnelResume
} = this.props;

View File

@ -4,6 +4,7 @@ import {
import {
WeaDialog,
} from 'ecCom';
import Customization from './Customization';
@observer
export default class SearchCustomDialog extends React.Component {
@ -13,15 +14,19 @@ export default class SearchCustomDialog extends React.Component {
render() {
const {
DIALOG,
dialog
} = this.props
store
} = this.props, {
SEARCHDIALOG,
searchDialog
} = store;
return (
<WeaDialog
{...DIALOG}
{...dialog}
{...SEARCHDIALOG}
{...searchDialog}
initLoadCss
>
<Customization store={store}/>
</WeaDialog>
);
}

View File

@ -12,7 +12,8 @@ import {
WeaLeftRightLayout,
WeaOrgTree,
WeaDropdown,
WeaSelect
WeaSelect,
WeaSearchGroup
} from 'ecCom'
import {
Row,
@ -289,7 +290,7 @@ export default class Resource extends React.Component {
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { resource.getTableInfo(); resource.setPanelStatus(false) }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} type="primary" onClick={() => resource.openSearchDialog()}>{i18n.button.saveTemplate()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} type="primary" onClick={() => resource.openSearchDialog()}>{i18n.button.saveTemplate()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju7`} type="primary" onClick={() => resource.openSearchDialog()}>{i18n.button.conditionSet()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju8`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => resource.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
@ -387,9 +388,10 @@ export default class Resource extends React.Component {
resource
} = this.props;
const {
searchCondition,
defaultCondition,
form2,
searchConditionLoading
searchConditionLoading,
templates
} = resource;
let arr = [];
@ -398,47 +400,39 @@ export default class Resource extends React.Component {
isFormInit
} = form2;
const options002 = [
{
key: "1",
selected: true,
showname: "简单模板"
},
{
key: "2",
selected: false,
showname: "复杂模板"
}
];
arr.push(<Row style={{ marginTop: 20 }}>
<Col offset={1} span={2}><span style={{"lineHeight":"30px","color":"red"}}>选择过滤模板</span></Col>
<Col offset={1} span={2}><span style={{ "lineHeight": "30px", "color": "red" }}>选择过滤模板</span></Col>
<Col span={6} offset={1}>
<WeaSelect
style={{width:"100%"}}
options={options002}
style={{ width: "100%" }}
options={templates}
onChange={v => {
}}
/>
</Col>
<Col offset={1} span={2}><Button onClick={() => console.log(11)}>删除模板</Button></Col>
</Row>)
<Col offset={1} span={2}><Button onClick={() => console.log(11)}>删除模板</Button></Col>
</Row>)
isFormInit && searchCondition.map(c => {
isFormInit && defaultCondition.map((c, i) => {
let _arr = [];
c.items.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} span={(index % 2 == 0) ? 10 : 11} offset={1}>
<div style={{ marginTop: 20 }}>
_arr.push({
com: (
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={form2} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
),
})
})
arr.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@qaih5l@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={_arr} col={2} />)
})
if (searchConditionLoading) {
return (
<div className='hrm-loading-center-small' style={{ top: '25%' }}>
@ -446,12 +440,12 @@ export default class Resource extends React.Component {
</div>
)
} else {
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
return <div onKeyDown={(e) => {
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
resource.getTableInfo();
resource.setPanelStatus(false)
rankScheme.getTableInfo();
rankScheme.setPanelStatus(false)
}
}}>{arr}</Row>
}}>{arr}</div>
}
}
@ -467,11 +461,12 @@ export default class Resource extends React.Component {
render() {
const {
resource
resource,
resource: store
} = this.props;
const {
isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition,
form, dialogLoading, isEdit, date, hasRight, defaultShowLeft,SEARCHDIALOG,searchDialog
form, dialogLoading, isEdit, date, hasRight, defaultShowLeft
} = resource;
if (hasRight === false) {
@ -534,9 +529,7 @@ export default class Resource extends React.Component {
/>
<DatasImport ecId={`${this && this.props && this.props.ecId || ''}_DatasImport@q4rrwm`} />
<SearchCustomDialog ecId={`${this && this.props && this.props.ecId || ''}_SearchCustomDialog@q4rrwm`}
DIALOG={SEARCHDIALOG}
dialog={searchDialog}
/>
store={store} />
</div>
)
}

View File

@ -1,24 +1,30 @@
import {
observable,
action
action,
computed
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/resource'; // 引入API接口文件
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
WeaForm,WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
Button
} from 'antd'
import {
WeaSelect,
WeaInputSearch,
WeaLocaleProvider,
} from 'ecCom';
import {
i18n
} from '../public/i18n';
import trim from 'lodash/trim';
import {getSecondPath} from '../util/index'
import cloneDeep from 'lodash/cloneDeep';
const toJS = mobx.toJS;
const {
@ -32,6 +38,8 @@ const {
@observable rightMenu = [];
@observable condition = [];
@observable searchCondition = [];
@observable defaultCondition = [];
@observable templates=[];
@observable isEdit = true;
@observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
@ -131,12 +139,17 @@ const {
}
@action("高级搜索表单") getSearchCondition() {
this.setScLoadingStatus(false);
Api.getAdvanceSearchCondition().then(res => {
this.setScLoadingStatus(true);
const params = {
selectKeys:this.transfer.transferKeys
}
Api.getAdvanceSearchCondition(params).then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions);
res.data.defaultcondition && this.setDefaultCondition(res.data.defaultcondition);
res.data.defaultcondition && this.form2.initFormFields(res.data.defaultcondition);
res.data.templates && this.setTemplates(res.data.templates);
} else {
message.warning(res.msg);
}
@ -181,7 +194,7 @@ const {
}
/** ================================================================= */
/** ====================================================================================== */
@observable searchDialog = {
visible: false,
title: '常用条件定制',
@ -202,14 +215,172 @@ const {
buttons: [<Button type='primary' onClick={()=>this.saveHrmSearchUserDefine()}>保存</Button>],
}
@action("常用条件定制保存") saveHrmSearchUserDefine = () => {
TRANSFER = {
height: 350,
renderItem: (items) => this.renderItem(items),
filterLeft: (items) => this.filterLeft(items),
filterRight: (items) => this.filterRight(items),
onChange: (v) => this.updateTransferKeys(v)
}
@observable transfer = {
transferDatas: [],
transferKeys: [],
transferOptions: [],
transferSelectedKey: '0',
transferleftIptVal: '',
transferRightIptVal: ''
}
@action("常用条件定制保存") saveHrmSearchUserDefine = () => {
this.closeSearchDialog();
this.getSearchCondition();
}
@action("常用条件定制") formatTransfer = () => {
const transferDatas = []
const transferKeys = []
const transferOptions = [{
key: "",
showname: ""
}]
this.transfer.transferSelectedKey = '0';
this.transfer.transferleftIptVal = '';
this.transfer.transferRightIptVal = '';
this.searchCondition.forEach((c, idx) => {
transferOptions.push({
key: `${idx}`,
showname: c.title,
})
c.items.forEach((i) => {
transferDatas.push({
id: i.domkey[0],
label: i.label,
title: c.title,
idx: `${idx}`
})
})
})
this.defaultCondition.forEach((c, idx) => {
c.items.forEach((i) => {
transferKeys.push(i.domkey[0]);
})
})
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
}
inputSearchStyle = {
width:"105px",
float:"right",
marginTop:"5px",
marginLeft:"10px"
}
selectStyle={
marginTop:"-1px",
width:"85px",
float:"right"
}
@computed get leftHeader() {
const {
transferleftIptVal,
transferOptions,
transferSelectedKey
} = this.transfer;
return (
<div className="trasfer-header">
<span>待选</span>
<WeaInputSearch
style={this.inputSearchStyle}
value={transferleftIptVal}
onSearchChange={this.updateTransferleftIptVal}
/>
<WeaSelect
style={this.selectStyle}
options={transferOptions}
value={transferSelectedKey}
onChange={this.updateTransferSelectedKey}
/>
</div>
)
}
@computed get rightHeader() {
const {
transferRightIptVal
} = this.transfer;
return (
<div className="trasfer-header">
<span>已选</span>
<WeaInputSearch
style={this.inputSearchStyle}
value={transferRightIptVal}
onSearchChange={ this.updateTransferRightptVal}
/>
</div>
)
}
renderItem = (item) => {
const {
label,
title
} = item;
return (<div className="trasfer-list-item" style={{"padding":"10px 20px","borderBottom":"1px solid #ddd"}}>
<div className="top text-overflow" style={{"marginBottom":"4px"}} title={label}>{label}</div>
<div className="bottom text-overflow" style={{"color":"#999"}} title={title}>{title}</div>
</div>)
};
filterLeft = (items) => {
let leftItems = cloneDeep(items);
const {
transferleftIptVal,
transferSelectedKey
} = this.transfer;
if (transferSelectedKey) {
leftItems = leftItems.filter((item) => item.idx == transferSelectedKey)
}
if (trim(transferleftIptVal)) {
leftItems = leftItems.filter((item) => item.label.indexOf(trim(transferleftIptVal)) > -1)
}
return leftItems
}
filterRight = (items) => {
let rightItems = cloneDeep(items);
const {
transferRightIptVal
} = this.transfer;
if (trim(transferRightIptVal)) {
rightItems = rightItems.filter((item) => item.label.indexOf(trim(transferRightIptVal)) > -1)
}
return rightItems
}
@action("穿梭框变化回调") updateTransferKeys = (v) => {
this.transfer.transferKeys = v;
}
@action updateTransferleftIptVal = (v) => {
this.transfer.transferleftIptVal = v;
}
@action updateTransferSelectedKey = (v) => {
this.transfer.transferSelectedKey = v;
}
@action updateTransferRightptVal = (v) => {
this.transfer.transferRightIptVal = v;
}
@action openSearchDialog = () => {
this.searchDialog.visible = true;
this.formatTransfer();
}
@action closeSearchDialog = () => {
@ -231,6 +402,14 @@ const {
this.searchCondition = condition;
}
setDefaultCondition(defaultcondition) {
this.defaultCondition = defaultcondition;
}
setTemplates(templates) {
this.templates = templates;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}

View File

@ -95,3 +95,18 @@
text-overflow: ellipsis;
white-space: nowrap;overflow: hidden;
}
//列定制
// .trasfer-header{
// .wea-input-focus {
// width: 105px;
// float: right;
// margin-top: 5px;
// margin-left: 10px;
// }
// .wea-select{
// margin-top: -1px;
// width: 85px;
// float: right;
// }
// }