花名册

This commit is contained in:
Chengliang 2023-01-11 18:22:30 +08:00
parent b15b08433f
commit 07cc8573be
5 changed files with 244 additions and 22 deletions

View File

@ -67,6 +67,17 @@ export const saveSearchTemplate = (params) => {
})
}
export const saveCustomTemplate = (params) => {
return fetch('/api/bs/hrmorganization/hrmresource/saveCustomTemplate', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const deleteSearchTemplate = (params) => {
return fetch('/api/bs/hrmorganization/hrmresource/deleteSearchTemplate', {
@ -85,4 +96,13 @@ export const getSearchTemplate = (id) => {
export const getTemplateSelectKeys = (id) => {
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getTemplateSelectKeys?templateId=${id}`, 'GET');
}
}
export const getEditTable = () => {
return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET');
}
export const getCustomTransferData = (id) => {
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/getCustomTransferData?templateId=${id}`, 'GET');
}

View File

@ -0,0 +1,59 @@
import {
observer
} from 'mobx-react';
import {
WeaDialog,
WeaTableEdit
} from 'ecCom';
import {
Spin,
Button, Modal
} from 'antd'
import * as mobx from "mobx";
const toJS = mobx.toJS;
@observer
export default class NewWeaTableEditDialog extends React.Component {
constructor(props) {
super(props);
}
onRowSelect = (sRowKeys, rows, dataIndex, selectedDatas) => {
const { store } = this.props;
if (dataIndex === undefined || selectedDatas === undefined) {
return;
}
store.setEnableRows(selectedDatas.isused);
};
render() {
const {
store,
} = this.props, {
temlateManageDialog,
relatedData
} = store;
const { datas, columns, loading,selectedData } = relatedData;
return (
<WeaDialog
{...temlateManageDialog}
initLoadCss
>
<WeaTableEdit
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
draggable
deleteConfirm
title=""
columns={toJS(columns)}
datas={toJS(datas)}
copyFilterProps={["id"]}
selectedData={!loading && toJS(selectedData)}
onChange={e => store.setTableEditDatas(e)}
onRowSelect={(sRowKeys, rows, dataIndex, selectedDatas) => this.onRowSelect(sRowKeys, rows, dataIndex, selectedDatas)}
/>
</WeaDialog>
);
}
}

View File

@ -3,12 +3,18 @@ import {
} from 'mobx-react';
import {
WeaDialog,
WeaFormItem,
WeaInput
} from 'ecCom';
import Customization from './Customization';
import {
Spin,
Button,
Button,Modal
} from 'antd'
import {
i18n
} from '../../public/i18n';
const confirm = Modal.confirm;
@observer
export default class SearchCustomDialog extends React.Component {
@ -16,18 +22,47 @@ export default class SearchCustomDialog extends React.Component {
super(props);
}
saveCustomTemplate() {
const {
store
} = this.props, {
customTemplateName
} = store;
confirm({
title: "存为模板",
content:
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@62kt85`}
label="列定制模板名称"
labelCol={{ span: 10 }}
wrapperCol={{ span: 14 }}>
<WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@j9bmvw`} viewAttr="3" value={customTemplateName} {...window.inputType} onChange={v => store.customTemplateName = v} />
</WeaFormItem>,
okText: i18n.button.save(),
cancelText: i18n.button.cancel(),
onOk() {
store.saveCustomTemplate();
},
onCancel() {
return false;
},
});
}
render() {
const {
store
store,
} = this.props, {
SEARCHDIALOG,
searchDialog,
search
search,
searchTemplateName
} = store;
const buttons = [
<Button type='primary' onClick={()=>store.saveHrmSearchUserDefine()}>保存</Button>,
<Button type='primary' onClick={()=>store.saveHrmSearchUserDefine()}>存为模板</Button>,
<Button type='primary' onClick={()=>store.saveHrmSearchUserDefine()}>模板管理</Button>
<Button type='primary' onClick={()=> this.saveCustomTemplate()}>存为模板</Button>,
<Button type='primary' onClick={()=> store.getEditTable()}>模板管理</Button>
]

View File

@ -41,6 +41,7 @@ import NewAndEditDialog from '../NewAndEditDialog';
import { renderNoright } from '../../util';
import DatasImport from '../import/datasImport';
import SearchCustomDialog from './SearchCustomDialog';
import NewWeaTableEditDialog from '../NewWeaTableEditDialog';
@ -569,7 +570,9 @@ 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`}
store={store} />
store={store}/>
<NewWeaTableEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewWeaTableEditDialog@q4rrwm`}
store={store}/>
</div>
)
}

View File

@ -1,7 +1,8 @@
import {
observable,
action,
computed
computed,
extendObservable
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/resource'; // 引入API接口文件
@ -136,11 +137,14 @@ export class ResourceStore {
}
@action("高级搜索表单") getSearchCondition() {
@action("高级搜索表单") getSearchCondition(key = true) {
this.setScLoadingStatus(true);
const params = {
this.form2 = new WeaForm();
let params = {};
key ? params = {
templateId: this.searchTemplateId
} : params = {
selectKeys: this.transfer.transferKeys,
templateId:this.searchTemplateId
}
Api.getAdvanceSearchCondition(params).then(res => {
if (res.code === 200) {
@ -200,7 +204,8 @@ export class ResourceStore {
@observable templates = [];
@observable searchTemplateName = '';
@observable searchTemplateId = '-1';
@observable customTemplateName = '';
@observable customTemplateId = '-1';
@observable search = false;
SEARCHDIALOG = {
@ -215,7 +220,6 @@ export class ResourceStore {
moreBtn: {
datas: []
},
}
@ -238,10 +242,10 @@ export class ResourceStore {
@action("常用条件定制保存") saveHrmSearchUserDefine = () => {
this.closeSearchDialog();
this.getSearchCondition();
this.getSearchCondition(false);
}
@action("高级搜索模板切换") changeSearchTemplate(v){
@action("高级搜索模板切换") changeSearchTemplate(v) {
this.searchTemplateId = v;
this.getSearchCondition();
}
@ -295,7 +299,7 @@ export class ResourceStore {
message.warning(error.msg);
})
}
@action("搜索模板保存") saveTemplate = () => {
if (this.searchTemplateName == '') {
@ -328,18 +332,42 @@ export class ResourceStore {
}
@action("常用定制列模板保存") saveCustomTemplate = () => {
if (this.customTemplateName == '') {
message.error("列定制模板名称不能为空");
} else {
const params = {
showname: this.customTemplateName,
fields: this.transfer.transferKeys.toString()
}
Api.saveCustomTemplate(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
this.customTemplateId = data.data;
this.customization();
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
}
@action("搜索模板删除") deleteSearchTemplate = () => {
if(this.searchTemplateId == -1) {
if (this.searchTemplateId == -1) {
return message.error("默认模板不可删除");
}
Api.deleteSearchTemplate({id:this.searchTemplateId}).then(response => {
Api.deleteSearchTemplate({ id: this.searchTemplateId }).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.searchTemplateId = '-1';
this.setPanelStatus(true);
message.success(data.msg);
this.searchTemplateId = '-1';
this.setPanelStatus(true);
} else {
message.warning(data.msg);
}
@ -348,6 +376,8 @@ export class ResourceStore {
})
}
inputSearchStyle = {
width: "105px",
float: "right",
@ -456,6 +486,54 @@ export class ResourceStore {
})
}
@observable relatedData = {
datas: [],
columns: [],
loading: true,
selectedData: {}
};
@observable temlateManageDialog = {
title: '模板管理',
visible: false,
hasScroll: true,
icon: 'icon-coms-hrm',
iconBgcolor: '#217346',
onCancel: () => this.closeTemlateManageDialog(),
style: {
width: 500,
height: 650
},
buttons: [<Button type='primary' onClick={() => store.saveHrmSearchUserDefine()}>保存</Button>]
}
@action("列定制模板管理") getEditTable() {
this.temlateManageDialog.visible = true;
this.relatedData.loading = true;
Api.getEditTable().then(result => {
if (result.code === 200) {
const { columns, datas, selectedData } = result.data;
extendObservable(this.relatedData, {
datas: datas,
columns: columns
});
selectedData && extendObservable(this.relatedData, {
selectedData: selectedData
});
extendObservable(this.relatedData, {
loading: false
});
} else {
message.warning(result.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action updateTransferleftIptVal = (v) => {
@ -488,6 +566,33 @@ export class ResourceStore {
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"] = "";
}
}
});
extendObservable(this.relatedData, {
datas: e
});
}
setEnableRows(e) {
extendObservable(this.relatedData, {
selectedData: {
isused: e
}
});
}