diff --git a/pc4mobx/organization/apis/rankscheme.js b/pc4mobx/organization/apis/rankscheme.js index e69de29..e2c225a 100644 --- a/pc4mobx/organization/apis/rankscheme.js +++ b/pc4mobx/organization/apis/rankscheme.js @@ -0,0 +1,8 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index 1424023..0a41678 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -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 _this.doEdit(record.randomFieldId)} >{record.locationname} - // } - // }; + if (c.dataIndex == 'forbidden_tag') { + c.render = function(text, record) { + return 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( +
+ + {} + +
+ ) + }) + }) + + if (searchConditionLoading) { + return ( +
+ +
+ ) + } else { + return { + if ( e.keyCode == 13 && e.target.tagName === "INPUT") { + rankScheme.getTableInfo(); + rankScheme.setPanelStatus(false) + } + }}>{arr} + } + + } + //非空判断 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() :
} + searchsAd= {isPanelShow ? this.getPanelComponents() :
} 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} /> diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index 11936c4..c47e0a6 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -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; + } + } \ No newline at end of file