花名册
This commit is contained in:
parent
07cc8573be
commit
5baac661e2
|
|
@ -90,19 +90,28 @@ export const deleteSearchTemplate = (params) => {
|
|||
})
|
||||
}
|
||||
|
||||
export const getSearchTemplate = (id) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getSearchTemplate?templateId=${id}`, 'GET');
|
||||
export const getSearchTemplate = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getSearchTemplate`, 'GET',params);
|
||||
}
|
||||
|
||||
export const getTemplateSelectKeys = (id) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getTemplateSelectKeys?templateId=${id}`, 'GET');
|
||||
export const getTemplateSelectKeys = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getTemplateSelectKeys`, 'GET',params);
|
||||
}
|
||||
|
||||
export const updateCustomTemplate = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/updateCustomTemplate`, 'POST',params);
|
||||
}
|
||||
|
||||
export const saveColumnsCustomTemplate = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/saveColumnsCustomTemplate`, 'POST',params);
|
||||
}
|
||||
|
||||
export const getEditTable = () => {
|
||||
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET');
|
||||
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getCustomTemplate', 'GET');
|
||||
}
|
||||
|
||||
export const getCustomTransferData = (id) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getCustomTransferData?templateId=${id}`, 'GET');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@ import {
|
|||
} from 'mobx-react';
|
||||
import {
|
||||
WeaTransfer,
|
||||
WeaInputSearch,
|
||||
WeaSelect
|
||||
} from 'ecCom';
|
||||
import {
|
||||
toJS
|
||||
} from 'mobx';
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
import {
|
||||
Spin
|
||||
} from 'antd'
|
||||
|
||||
@observer
|
||||
export default class Customization extends React.Component {
|
||||
|
|
@ -15,6 +20,41 @@ export default class Customization extends React.Component {
|
|||
super(props);
|
||||
}
|
||||
|
||||
rightHeader = () => {
|
||||
|
||||
|
||||
const {
|
||||
store
|
||||
} = this.props, {
|
||||
transfer,
|
||||
inputSearchStyle,
|
||||
search,
|
||||
customTemplates,
|
||||
templates,
|
||||
searchTemplateId,
|
||||
customTemplateId
|
||||
} = store, {
|
||||
transferRightIptVal,
|
||||
} = transfer;
|
||||
return (
|
||||
<div className="trasfer-header">
|
||||
<span>已选</span>
|
||||
<WeaInputSearch
|
||||
style={inputSearchStyle}
|
||||
value={transferRightIptVal}
|
||||
onSearchChange={store.updateTransferRightptVal}
|
||||
/>
|
||||
<WeaSelect
|
||||
style={store.selectStyle}
|
||||
options={search ? templates : customTemplates}
|
||||
value={search ? searchTemplateId : customTemplateId}
|
||||
onChange={v => store.getTemplateSelectKeys(v)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const {
|
||||
store
|
||||
|
|
@ -23,21 +63,29 @@ export default class Customization extends React.Component {
|
|||
transfer,
|
||||
leftHeader,
|
||||
rightHeader,
|
||||
searchDialog,
|
||||
search
|
||||
} = store, {
|
||||
transferDatas,
|
||||
transferKeys
|
||||
} = transfer;
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className='customization' style={{padding: 20}}>
|
||||
<WeaTransfer
|
||||
{...TRANSFER}
|
||||
data={toJS(transferDatas)}
|
||||
selectedKeys={toJS(transferKeys)}
|
||||
leftHeader={leftHeader}
|
||||
rightHeader={rightHeader}
|
||||
/>
|
||||
</div>
|
||||
<div className='customization' style={{ padding: 20 }}>
|
||||
{
|
||||
!searchDialog.loading ? <WeaTransfer
|
||||
{...TRANSFER}
|
||||
data={toJS(transferDatas)}
|
||||
selectedKeys={toJS(transferKeys)}
|
||||
leftHeader={leftHeader}
|
||||
rightHeader={rightHeader}
|
||||
/> : <div className='hrm-loading-center-small' style={{ top: '25%' }}>
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchDialog.loading}></Spin>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ export default class SearchCustomDialog extends React.Component {
|
|||
searchTemplateName
|
||||
} = store;
|
||||
const buttons = [
|
||||
<Button type='primary' onClick={()=>store.saveHrmSearchUserDefine()}>保存</Button>,
|
||||
<Button type='primary' onClick={()=> search ? store.saveHrmSearchUserDefine() : store.saveCustomDefine()}>保存</Button>,
|
||||
<Button type='primary' onClick={()=> this.saveCustomTemplate()}>存为模板</Button>,
|
||||
<Button type='primary' onClick={()=> store.getEditTable()}>模板管理</Button>
|
||||
]
|
||||
|
|
|
|||
|
|
@ -417,10 +417,6 @@ export default class Resource extends React.Component {
|
|||
!isNew && resource.edit();
|
||||
}
|
||||
|
||||
//高级搜索模板修改
|
||||
handleTemplateChange() {
|
||||
|
||||
}
|
||||
|
||||
getPanelComponents() {
|
||||
const {
|
||||
|
|
@ -536,6 +532,7 @@ export default class Resource extends React.Component {
|
|||
searchType={['base', 'advanced']}
|
||||
showSearchAd={isPanelShow}
|
||||
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? lastName : form2.getFormParams().lastName}
|
||||
searchsBasePlaceHolder='请输入姓名'
|
||||
setShowSearchAd={bool => resource.setPanelStatus(bool)}
|
||||
hideSearchAd={() => resource.setPanelStatus(false)}
|
||||
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ import {
|
|||
import {
|
||||
i18n
|
||||
} from '../public/i18n';
|
||||
import trim from 'lodash/trim';
|
||||
import { getSecondPath } from '../util/index'
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import {cloneDeep,isEmpty,trim} from 'lodash';
|
||||
|
||||
const toJS = mobx.toJS;
|
||||
const {
|
||||
|
|
@ -197,11 +196,16 @@ export class ResourceStore {
|
|||
|
||||
|
||||
/** ============================================================================================= */
|
||||
@observable search = true;
|
||||
|
||||
|
||||
@observable searchDialog = {
|
||||
visible: false,
|
||||
loading: true
|
||||
}
|
||||
|
||||
@observable templates = [];
|
||||
@observable customTemplates = [];
|
||||
@observable searchTemplateName = '';
|
||||
@observable searchTemplateId = '-1';
|
||||
@observable customTemplateName = '';
|
||||
|
|
@ -245,6 +249,29 @@ export class ResourceStore {
|
|||
this.getSearchCondition(false);
|
||||
}
|
||||
|
||||
@action("列定制保存") saveCustomDefine = () => {
|
||||
if(this.customTemplateId == '-1') {
|
||||
message.error("默认模板不能修改");
|
||||
}else {
|
||||
|
||||
const params = {
|
||||
columns:this.transfer.transferKeys,
|
||||
templateId:this.customTemplateId
|
||||
}
|
||||
Api.getTemplateSelectKeys(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.transfer.transferKeys = res.data.split(",");
|
||||
} else {
|
||||
this.searchDialog.visible = false;
|
||||
this.getTableInfo();
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@action("高级搜索模板切换") changeSearchTemplate(v) {
|
||||
this.searchTemplateId = v;
|
||||
this.getSearchCondition();
|
||||
|
|
@ -282,14 +309,23 @@ export class ResourceStore {
|
|||
this.transfer.transferDatas = transferDatas;
|
||||
this.transfer.transferKeys = transferKeys;
|
||||
this.transfer.transferOptions = transferOptions;
|
||||
this.searchDialog.visible = true;
|
||||
}
|
||||
|
||||
@action("列定制") customization = (v) => {
|
||||
this.openSearchDialog(false);
|
||||
@action("列定制") customization = (v = false) => {
|
||||
this.openCustomDialog(v);
|
||||
}
|
||||
|
||||
@action("常用条件定制模板切换") getTemplateSelectKeys = v => {
|
||||
Api.getTemplateSelectKeys(v).then(res => {
|
||||
if(!this.search){
|
||||
this.customTemplateId = v;
|
||||
}
|
||||
|
||||
const params = {
|
||||
templateId: v,
|
||||
type: this.search ? 'search' : 'custom'
|
||||
}
|
||||
Api.getTemplateSelectKeys(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.transfer.transferKeys = res.data.split(",");
|
||||
} else {
|
||||
|
|
@ -345,7 +381,7 @@ export class ResourceStore {
|
|||
}).then(data => {
|
||||
if (data.code === 200) {
|
||||
this.customTemplateId = data.data;
|
||||
this.customization();
|
||||
|
||||
} else {
|
||||
message.warning(data.msg);
|
||||
}
|
||||
|
|
@ -427,12 +463,14 @@ export class ResourceStore {
|
|||
/>
|
||||
<WeaSelect
|
||||
style={this.selectStyle}
|
||||
options={this.templates}
|
||||
options={this.search ? this.templates : this.customTemplates}
|
||||
value={this.search ? this.searchTemplateId : this.customTemplateId}
|
||||
onChange={v => this.getTemplateSelectKeys(v)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
renderItem = (item) => {
|
||||
const {
|
||||
label,
|
||||
|
|
@ -474,10 +512,10 @@ export class ResourceStore {
|
|||
this.transfer.transferKeys = v;
|
||||
}
|
||||
|
||||
@action("高级搜索模板") getSearchTemplate = () => {
|
||||
Api.getSearchTemplate(this.searchTemplateId).then(res => {
|
||||
@action("模板") getSearchTemplate = (bool) => {
|
||||
Api.getSearchTemplate({ type: bool ? 'search' : 'custom' }).then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data && this.setTemplates(res.data);
|
||||
bool ? this.setTemplates(res.data) : this.setCustomTemplates(res.data);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
|
|
@ -504,7 +542,15 @@ export class ResourceStore {
|
|||
width: 500,
|
||||
height: 650
|
||||
},
|
||||
buttons: [<Button type='primary' onClick={() => store.saveHrmSearchUserDefine()}>保存</Button>]
|
||||
buttons: [<Button type='primary' onClick={() => this.updateCustomTemplate()}>保存</Button>]
|
||||
}
|
||||
|
||||
@computed get editTableParams() {
|
||||
let datas = this.relatedData.datas;
|
||||
let selectedData = this.relatedData.selectedData.status;
|
||||
let params = this.arrToJson(toJS(datas), toJS(selectedData), 'status');
|
||||
params.rownum = datas.length;
|
||||
return params;
|
||||
}
|
||||
|
||||
@action("列定制模板管理") getEditTable() {
|
||||
|
|
@ -530,173 +576,234 @@ export class ResourceStore {
|
|||
}, error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@action updateTransferleftIptVal = (v) => {
|
||||
this.transfer.transferleftIptVal = v;
|
||||
}
|
||||
|
||||
@action updateTransferSelectedKey = (v) => {
|
||||
this.transfer.transferSelectedKey = v;
|
||||
}
|
||||
|
||||
@action updateTransferKeys = (v) => {
|
||||
this.transfer.transferKeys = v;
|
||||
}
|
||||
|
||||
|
||||
@action updateTransferRightptVal = (v) => {
|
||||
this.transfer.transferRightIptVal = v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@action openSearchDialog = (bool) => {
|
||||
this.search = bool;
|
||||
this.searchDialog.visible = true;
|
||||
this.formatTransfer();
|
||||
|
||||
}
|
||||
|
||||
@action closeSearchDialog = () => {
|
||||
this.searchDialog.visible = false;
|
||||
}
|
||||
|
||||
@action closeTemlateManageDialog = () => {
|
||||
this.temlateManageDialog.visible = false;
|
||||
}
|
||||
|
||||
setTableEditDatas(e) {
|
||||
e.map(item => {
|
||||
for (let key in item) {
|
||||
if (key == "undefined") {
|
||||
delete item[key];
|
||||
}
|
||||
if (!item["isused"]) {
|
||||
item["isused"] = "";
|
||||
}
|
||||
@action("保存") updateCustomTemplate() {
|
||||
let params = this.editTableParams;
|
||||
Api.updateCustomTemplate(params).then(res => {
|
||||
let { code, msg } = res;
|
||||
if (code === 200) {
|
||||
message.success(msg || "操作成功");
|
||||
this.getEditTable();
|
||||
this.customization();
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
}).catch(error => {
|
||||
message.error(error);
|
||||
});
|
||||
extendObservable(this.relatedData, {
|
||||
datas: e
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setEnableRows(e) {
|
||||
extendObservable(this.relatedData, {
|
||||
selectedData: {
|
||||
isused: e
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
updateFields(val) {
|
||||
this.form2.updateFields({
|
||||
lastName: {
|
||||
value: val
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSearchCondition(condition) {
|
||||
this.searchCondition = condition;
|
||||
}
|
||||
|
||||
setDefaultCondition(defaultcondition) {
|
||||
this.defaultCondition = defaultcondition;
|
||||
}
|
||||
|
||||
setTemplates(templates) {
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
setScLoadingStatus(bool) {
|
||||
this.searchConditionLoading = bool;
|
||||
}
|
||||
|
||||
setPanelStatus(bool) {
|
||||
this.isPanelShow = bool;
|
||||
this.getSearchTemplate();
|
||||
bool && this.getSearchCondition();
|
||||
if (!bool) {
|
||||
this.scLoadingReset();
|
||||
@action("列定制") getCustomTransferData() {
|
||||
Api.getCustomTransferData(this.customTemplateId).then(result => {
|
||||
if (result.code === 200) {
|
||||
const { transferDatas, transferKeys, transferOptions } = result.data;
|
||||
this.transfer.transferDatas = transferDatas;
|
||||
this.transfer.transferKeys = transferKeys;
|
||||
this.transfer.transferOptions = transferOptions;
|
||||
this.searchDialog.visible = true;
|
||||
this.searchDialog.loading = false;
|
||||
} else {
|
||||
message.warning(result.msg);
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
}
|
||||
|
||||
setLastName(val) {
|
||||
this.lastName = val;
|
||||
}
|
||||
|
||||
isEmptyObject(obj) {
|
||||
for (let key in obj) {
|
||||
return false;
|
||||
|
||||
|
||||
@action updateTransferleftIptVal = (v) => {
|
||||
this.transfer.transferleftIptVal = v;
|
||||
}
|
||||
|
||||
@action updateTransferSelectedKey = (v) => {
|
||||
this.transfer.transferSelectedKey = v;
|
||||
}
|
||||
|
||||
@action updateTransferKeys = (v) => {
|
||||
this.transfer.transferKeys = v;
|
||||
}
|
||||
|
||||
|
||||
@action updateTransferRightptVal = (v) => {
|
||||
this.transfer.transferRightIptVal = v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@action openSearchDialog = (bool) => {
|
||||
this.search = bool;
|
||||
this.searchDialog.loading = false;
|
||||
this.formatTransfer();
|
||||
}
|
||||
|
||||
@action openCustomDialog = (bool) => {
|
||||
this.search = bool;
|
||||
this.searchDialog.loading = true;
|
||||
this.getSearchTemplate(bool);
|
||||
this.getCustomTransferData();
|
||||
|
||||
}
|
||||
|
||||
@action closeSearchDialog = () => {
|
||||
this.searchDialog.visible = false;
|
||||
}
|
||||
|
||||
@action closeTemlateManageDialog = () => {
|
||||
this.temlateManageDialog.visible = false;
|
||||
}
|
||||
|
||||
setTableEditDatas(e) {
|
||||
e.map(item => {
|
||||
for (let key in item) {
|
||||
if (key == "undefined") {
|
||||
delete item[key];
|
||||
}
|
||||
if (!item["isused"]) {
|
||||
item["isused"] = "";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
extendObservable(this.relatedData, {
|
||||
datas: e
|
||||
});
|
||||
}
|
||||
|
||||
setIds(ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
scLoadingReset() {
|
||||
this.searchConditionLoading = true;
|
||||
}
|
||||
setEnableRows(e) {
|
||||
extendObservable(this.relatedData, {
|
||||
selectedData: {
|
||||
isused: e
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
formReset() {
|
||||
this.form = new WeaForm();
|
||||
}
|
||||
|
||||
dialogLoadingReset() {
|
||||
this.dialogLoading = true;
|
||||
}
|
||||
updateFields(val) {
|
||||
this.form2.updateFields({
|
||||
lastname: {
|
||||
value: val
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setVisible(bool) {
|
||||
this.visible = bool;
|
||||
this.formReset();
|
||||
!bool && this.dialogLoadingReset();
|
||||
}
|
||||
setSearchCondition(condition) {
|
||||
this.searchCondition = condition;
|
||||
}
|
||||
|
||||
setDialogLoadingStatus(bool) {
|
||||
this.dialogLoading = bool;
|
||||
}
|
||||
setDefaultCondition(defaultcondition) {
|
||||
this.defaultCondition = defaultcondition;
|
||||
}
|
||||
|
||||
setNeDialogTitle(title) {
|
||||
this.nEdialogTitle = title;
|
||||
}
|
||||
setTemplates(datas) {
|
||||
this.templates = datas;
|
||||
}
|
||||
|
||||
setIsNew(bool) {
|
||||
this.isNew = bool;
|
||||
}
|
||||
setCustomTemplates(datas) {
|
||||
this.customTemplates = datas;
|
||||
}
|
||||
|
||||
setCondition(condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
setScLoadingStatus(bool) {
|
||||
this.searchConditionLoading = bool;
|
||||
}
|
||||
|
||||
setUserId(userId) {
|
||||
this.userId = userId;
|
||||
setPanelStatus(bool) {
|
||||
this.isPanelShow = bool;
|
||||
this.search = true;
|
||||
this.searchDialog.loading = true;
|
||||
this.getSearchTemplate(bool);
|
||||
bool && this.getSearchCondition();
|
||||
if (!bool) {
|
||||
this.scLoadingReset();
|
||||
}
|
||||
}
|
||||
|
||||
setDate(date) {
|
||||
this.date = date;
|
||||
}
|
||||
arrToJson(arr, rows, rowKey = "isused") {
|
||||
let json = {};
|
||||
const _rows = isEmpty(arr) ? [] : rows;
|
||||
_rows && _rows.map(index => {
|
||||
arr[index][rowKey] = "1";
|
||||
});
|
||||
arr.map((item, index) => {
|
||||
if (!item[rowKey]) item[rowKey] = "0";
|
||||
for (let key in item) {
|
||||
json[key + "_" + index] = item[key];
|
||||
}
|
||||
});
|
||||
|
||||
setTopMenu(topMenu) {
|
||||
this.topMenu = topMenu;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
setRightMenu(rightMenu) {
|
||||
this.rightMenu = rightMenu;
|
||||
}
|
||||
setLastName(val) {
|
||||
this.lastName = val;
|
||||
}
|
||||
|
||||
setHasRight(bool) {
|
||||
this.hasRight = bool;
|
||||
isEmptyObject(obj) {
|
||||
for (let key in obj) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
setIds(ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
scLoadingReset() {
|
||||
this.searchConditionLoading = true;
|
||||
}
|
||||
|
||||
|
||||
formReset() {
|
||||
this.form = new WeaForm();
|
||||
}
|
||||
|
||||
dialogLoadingReset() {
|
||||
this.dialogLoading = true;
|
||||
}
|
||||
|
||||
setVisible(bool) {
|
||||
this.visible = bool;
|
||||
this.formReset();
|
||||
!bool && this.dialogLoadingReset();
|
||||
}
|
||||
|
||||
setDialogLoadingStatus(bool) {
|
||||
this.dialogLoading = bool;
|
||||
}
|
||||
|
||||
setNeDialogTitle(title) {
|
||||
this.nEdialogTitle = title;
|
||||
}
|
||||
|
||||
setIsNew(bool) {
|
||||
this.isNew = bool;
|
||||
}
|
||||
|
||||
setCondition(condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
setUserId(userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
setDate(date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
setTopMenu(topMenu) {
|
||||
this.topMenu = topMenu;
|
||||
}
|
||||
|
||||
setRightMenu(rightMenu) {
|
||||
this.rightMenu = rightMenu;
|
||||
}
|
||||
|
||||
setHasRight(bool) {
|
||||
this.hasRight = bool;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue