等级方案页面完成列表渲染,高级搜索,禁用标记等
This commit is contained in:
parent
b7c99835da
commit
fb6ae67485
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
import {
|
||||
WeaTools
|
||||
} from 'ecCom'
|
||||
|
||||
export const getSearchList = (params) => {
|
||||
return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params);
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import {
|
|||
Modal,
|
||||
Button,
|
||||
message,
|
||||
Switch
|
||||
} from 'antd'
|
||||
import {
|
||||
WeaSwitch,
|
||||
|
|
@ -85,11 +86,53 @@ export default class RankScheme extends React.Component {
|
|||
return btns;
|
||||
}
|
||||
|
||||
//点击事件
|
||||
handleClick(item) {
|
||||
const {
|
||||
rankScheme
|
||||
} = this.props;
|
||||
const {
|
||||
isPanelShow
|
||||
} = rankScheme;
|
||||
|
||||
isPanelShow && rankScheme.setPanelStatus(false);
|
||||
this[item.menuFun] && this[item.menuFun]();
|
||||
}
|
||||
|
||||
batchDelete() {
|
||||
const {
|
||||
rankScheme
|
||||
} = this.props;
|
||||
const {
|
||||
tableStore
|
||||
} = rankScheme;
|
||||
|
||||
let keys = toJS(tableStore.selectedRowKeys).toString();
|
||||
rankScheme.setIds(keys);
|
||||
this.showConfirm('batchDel');
|
||||
}
|
||||
showConfirm(v) {
|
||||
let _this = this;
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk() {
|
||||
_this.onOk();
|
||||
},
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}
|
||||
onOk() {
|
||||
const {
|
||||
rankScheme
|
||||
} = this.props;
|
||||
rankScheme.delete();
|
||||
}
|
||||
|
||||
|
||||
getDropMenuDatas() {
|
||||
const {
|
||||
rankScheme
|
||||
|
|
@ -142,18 +185,18 @@ export default class RankScheme extends React.Component {
|
|||
form2
|
||||
} = rankScheme;
|
||||
|
||||
rankScheme.schemeName(val);
|
||||
//!this.isEmptyObject(form2.getFormParams()) && hrmOfficeAddress.updateFields(val);
|
||||
rankScheme.setSchemeName(val);
|
||||
!this.isEmptyObject(form2.getFormParams()) && rankScheme.updateFields(val);
|
||||
}
|
||||
|
||||
reRenderColumns(columns) {
|
||||
let _this = this;
|
||||
columns.forEach((c, index) => {
|
||||
// if (c.dataIndex == 'schemename') {
|
||||
// c.render = function(text, record) {
|
||||
// return <a onClick={() => _this.doEdit(record.randomFieldId)} >{record.locationname}</a>
|
||||
// }
|
||||
// };
|
||||
if (c.dataIndex == 'forbidden_tag') {
|
||||
c.render = function(text, record) {
|
||||
return <Switch defaultChecked={text == "0" ? true : false} onChange={checked => console.log(checked)} />
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -167,6 +210,54 @@ export default class RankScheme extends React.Component {
|
|||
// (index == '2') && this.deLog(record.randomFieldId);
|
||||
}
|
||||
|
||||
getPanelComponents() {
|
||||
const {
|
||||
rankScheme
|
||||
} = this.props;
|
||||
const {
|
||||
searchCondition,
|
||||
form2,
|
||||
searchConditionLoading
|
||||
} = rankScheme;
|
||||
|
||||
let arr = [];
|
||||
let formParams = form2.getFormParams();
|
||||
const {
|
||||
isFormInit
|
||||
} = form2;
|
||||
|
||||
isFormInit && searchCondition.map(c => {
|
||||
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}}>
|
||||
<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>)
|
||||
})
|
||||
})
|
||||
|
||||
if (searchConditionLoading) {
|
||||
return (
|
||||
<div className='hrm-loading-center-small' style={{top:'25%'}}>
|
||||
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@lbktzb`} spinning={searchConditionLoading}></Spin>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ppeb6z`} onKeyDown={(e) => {
|
||||
if ( e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||
rankScheme.getTableInfo();
|
||||
rankScheme.setPanelStatus(false)
|
||||
}
|
||||
}}>{arr}</Row>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//非空判断
|
||||
isEmptyObject(obj) {
|
||||
for (let key in obj) {
|
||||
|
|
@ -180,19 +271,6 @@ export default class RankScheme extends React.Component {
|
|||
|
||||
render() {
|
||||
|
||||
// 通过 rowSelection 对象表明需要行选择
|
||||
const rowSelection = {
|
||||
onChange(selectedRowKeys, selectedRows) {
|
||||
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
||||
},
|
||||
onSelect(record, selected, selectedRows) {
|
||||
console.log(record, selected, selectedRows);
|
||||
},
|
||||
onSelectAll(selected, selectedRows, changeRows) {
|
||||
console.log(selected, selectedRows, changeRows);
|
||||
},
|
||||
};
|
||||
|
||||
const {
|
||||
rankScheme
|
||||
} = this.props;
|
||||
|
|
@ -222,7 +300,7 @@ export default class RankScheme extends React.Component {
|
|||
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? schemeName : form2.getFormParams().name}
|
||||
setShowSearchAd={bool => rankScheme.setPanelStatus(bool)}
|
||||
hideSearchAd={() => rankScheme.setPanelStatus(false)}
|
||||
// searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||
searchsAd= {isPanelShow ? this.getPanelComponents() : <div></div>}
|
||||
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||
hasMask={false}
|
||||
buttonsAd={this.getTabBtn()}
|
||||
|
|
@ -235,7 +313,6 @@ export default class RankScheme extends React.Component {
|
|||
needScroll={true}
|
||||
getColumns={c => this.reRenderColumns(c)}
|
||||
onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
|
||||
rowSelection={rowSelection}
|
||||
/>
|
||||
</WeaTop>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
action
|
||||
} from 'mobx';
|
||||
import * as mobx from 'mobx';
|
||||
import * as API from '../apis/rankscheme'; // 引入API接口文件
|
||||
import * as APi from '../apis/rankscheme'; // 引入API接口文件
|
||||
import {
|
||||
WeaForm
|
||||
} from 'comsMobx';
|
||||
|
|
@ -27,11 +27,16 @@ export class RankSchemeStore {
|
|||
@observable tableStore = new TableStore();
|
||||
@observable topMenu = []
|
||||
@observable rightMenu = [];
|
||||
@observable condition = [];
|
||||
@observable searchCondition = [];
|
||||
@observable isEdit = true;
|
||||
@observable isPanelShow = true; //高级搜索面板
|
||||
@observable isPanelShow = false; //高级搜索面板
|
||||
@observable form2 = new WeaForm();
|
||||
@observable schemeName = '';
|
||||
@observable conditionNum = 2;
|
||||
@observable ids = ''; //选择行id
|
||||
@observable searchConditionLoading = true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -40,12 +45,37 @@ export class RankSchemeStore {
|
|||
|
||||
@action
|
||||
getTableInfo() {
|
||||
let params = { ...this.form2.getFormParams()};
|
||||
let params;
|
||||
this.tableStore = new TableStore();
|
||||
this.tableStore.getDatas("de13a6ef-76e4-40d2-b9ff-01d8a37e7dfe_0638F7675486BD6B43E8CA8FD921E4EB", 1);
|
||||
// Api.getSearchList(params).then(res => {
|
||||
if (this.isEmptyObject(this.form2.getFormParams())) {
|
||||
params = { ...this.form2.getFormParams(),
|
||||
name: this.schemeName
|
||||
};
|
||||
} else {
|
||||
params = { ...this.form2.getFormParams()
|
||||
};
|
||||
}
|
||||
APi.getSearchList(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
}, error => {
|
||||
message.warning(error.msg);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//删除
|
||||
delete() {
|
||||
let params = {
|
||||
ids: this.ids
|
||||
};
|
||||
// Api.deleteTableData(params).then(res => {
|
||||
// if (res.api_status) {
|
||||
// res.sessionkey && this.tableStore.getDatas("de13a6ef-76e4-40d2-b9ff-01d8a37e7dfe_0638F7675486BD6B43E8CA8FD921E4EB", 1);
|
||||
// message.success(i18n.message.deleteSuccess());
|
||||
// this.getTableInfo();
|
||||
// } else {
|
||||
// message.warning(data.message);
|
||||
// }
|
||||
|
|
@ -55,6 +85,105 @@ export class RankSchemeStore {
|
|||
|
||||
}
|
||||
|
||||
getSearchCondition() {
|
||||
this.setScLoadingStatus(false);
|
||||
let conditions = [
|
||||
{
|
||||
"title": "高级查询条件",
|
||||
"defaultshow": true,
|
||||
"items": [
|
||||
{
|
||||
"belong": "PC",
|
||||
"checkbox": false,
|
||||
"checkboxValue": false,
|
||||
"colSpan": 2,
|
||||
"conditionType": "INPUT",
|
||||
"dateGroup": false,
|
||||
"defaultDisplayInBar": false,
|
||||
"detailtype": 1,
|
||||
"domkey": [
|
||||
"name"
|
||||
],
|
||||
"entSearch": false,
|
||||
"fieldcol": 16,
|
||||
"hasBorder": false,
|
||||
"helpfulTipProps": {},
|
||||
"hide": false,
|
||||
"isBase64": false,
|
||||
"isQuickSearch": false,
|
||||
"label": "办公地点简称",
|
||||
"labelcol": 8,
|
||||
"length": 0,
|
||||
"maxFilesNumber": 0,
|
||||
"maxUploadSize": 0,
|
||||
"multiSelection": false,
|
||||
"multiple": false,
|
||||
"precision": 0,
|
||||
"secretLimit": false,
|
||||
"showOrder": 0,
|
||||
"showTime": false,
|
||||
"stringLength": 0,
|
||||
"supportCancel": false,
|
||||
"tipPosition": "bottom",
|
||||
"valueList": [],
|
||||
"viewAttr": 2
|
||||
},
|
||||
{
|
||||
"belong": "PC",
|
||||
"checkbox": false,
|
||||
"checkboxValue": false,
|
||||
"colSpan": 2,
|
||||
"conditionType": "INPUT",
|
||||
"dateGroup": false,
|
||||
"defaultDisplayInBar": false,
|
||||
"detailtype": 1,
|
||||
"domkey": [
|
||||
"mark"
|
||||
],
|
||||
"entSearch": false,
|
||||
"fieldcol": 16,
|
||||
"hasBorder": false,
|
||||
"helpfulTipProps": {},
|
||||
"hide": false,
|
||||
"isBase64": false,
|
||||
"isQuickSearch": false,
|
||||
"label": "办公地点全称",
|
||||
"labelcol": 8,
|
||||
"length": 0,
|
||||
"maxFilesNumber": 0,
|
||||
"maxUploadSize": 0,
|
||||
"multiSelection": false,
|
||||
"multiple": false,
|
||||
"precision": 0,
|
||||
"secretLimit": false,
|
||||
"showOrder": 0,
|
||||
"showTime": false,
|
||||
"stringLength": 0,
|
||||
"supportCancel": false,
|
||||
"tipPosition": "bottom",
|
||||
"valueList": [],
|
||||
"viewAttr": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
this.setSearchCondition(conditions);
|
||||
this.form2.initFormFields(conditions);
|
||||
|
||||
|
||||
// Api.getAdvanceSearchCondition().then(res => {
|
||||
// if (res.api_status) {
|
||||
// this.setScLoadingStatus(false);
|
||||
// res.conditions && this.setSearchCondition(res.conditions);
|
||||
// res.conditions && this.form2.initFormFields(res.conditions);
|
||||
// } else {
|
||||
// message.warning(data.message);
|
||||
// }
|
||||
// }, error => {
|
||||
// message.warning(error.message);
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
@action
|
||||
getHasRight() {
|
||||
|
|
@ -67,14 +196,6 @@ export class RankSchemeStore {
|
|||
"menuName": "新建",
|
||||
"type": "BTN_Addnew"
|
||||
},
|
||||
{
|
||||
"isBatch": "1",
|
||||
"isTop": "1",
|
||||
"menuFun": "import",
|
||||
"menuIcon": "icon-coms-leading-in",
|
||||
"menuName": "导入",
|
||||
"type": "BTN_Import"
|
||||
},
|
||||
{
|
||||
"isBatch": "1",
|
||||
"isTop": "1",
|
||||
|
|
@ -93,14 +214,6 @@ export class RankSchemeStore {
|
|||
"menuName": "新建",
|
||||
"type": "BTN_Addnew"
|
||||
},
|
||||
{
|
||||
"isBatch": "0",
|
||||
"isTop": "1",
|
||||
"menuFun": "import",
|
||||
"menuIcon": "icon-coms-leading-in",
|
||||
"menuName": "导入",
|
||||
"type": "BTN_Import"
|
||||
},
|
||||
{
|
||||
"isBatch": "0",
|
||||
"isTop": "0",
|
||||
|
|
@ -120,12 +233,47 @@ export class RankSchemeStore {
|
|||
]
|
||||
}
|
||||
|
||||
updateFields(val) {
|
||||
this.form2.updateFields({
|
||||
name: {
|
||||
value: val
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setSearchCondition(condition) {
|
||||
this.searchCondition = condition;
|
||||
}
|
||||
|
||||
setScLoadingStatus(bool) {
|
||||
this.searchConditionLoading = bool;
|
||||
}
|
||||
|
||||
setPanelStatus(bool) {
|
||||
this.isPanelShow = bool;
|
||||
bool && this.getSearchCondition();
|
||||
if (!bool) {
|
||||
this.scLoadingReset();
|
||||
}
|
||||
}
|
||||
|
||||
setSchemeName(val) {
|
||||
this.schemeName = val;
|
||||
}
|
||||
|
||||
isEmptyObject(obj) {
|
||||
for (let key in obj) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
setIds(ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
scLoadingReset() {
|
||||
this.searchConditionLoading = true;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue