From 67304df5671c40f44e323d8128e31dc6ad752a5d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 12 May 2022 14:57:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=81=8C=E7=AD=89?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E8=81=8C=E7=BA=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/jobgrade.js | 67 +++ pc4mobx/organization/apis/joblevel.js | 68 +++ pc4mobx/organization/apis/rankscheme.js | 4 + pc4mobx/organization/apis/sequence.js | 69 +++ .../components/postionrank/JobGrade.js | 61 ++- .../components/postionrank/JobLevel.js | 56 +-- .../components/postionrank/RankScheme.js | 8 + .../components/sequence/Sequence.js | 414 ++++++++++++++++++ pc4mobx/organization/index.js | 5 +- pc4mobx/organization/public/i18n.js | 3 + pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/jobgrade.js | 305 ++++++------- pc4mobx/organization/stores/joblevel.js | 305 ++++++------- pc4mobx/organization/stores/rankscheme.js | 62 +-- pc4mobx/organization/stores/sequence.js | 340 ++++++++++++++ 15 files changed, 1357 insertions(+), 414 deletions(-) create mode 100644 pc4mobx/organization/apis/sequence.js create mode 100644 pc4mobx/organization/components/sequence/Sequence.js create mode 100644 pc4mobx/organization/stores/sequence.js diff --git a/pc4mobx/organization/apis/jobgrade.js b/pc4mobx/organization/apis/jobgrade.js index e69de29..5ef46d5 100644 --- a/pc4mobx/organization/apis/jobgrade.js +++ b/pc4mobx/organization/apis/jobgrade.js @@ -0,0 +1,67 @@ +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/grade/getGradeTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/grade/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/grade/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/grade/saveGrade', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/grade/updateGrade', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/grade/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getGradeForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/grade/getGradeForm', 'GET', params); +} + +export const getTabInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/grade/getTabInfo', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/grade/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/apis/joblevel.js b/pc4mobx/organization/apis/joblevel.js index e69de29..0203910 100644 --- a/pc4mobx/organization/apis/joblevel.js +++ b/pc4mobx/organization/apis/joblevel.js @@ -0,0 +1,68 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/level/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/level/saveLevel', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/level/updateLevel', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/level/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getLevelForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params); +} + +export const getTabInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getTableBtn', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/apis/rankscheme.js b/pc4mobx/organization/apis/rankscheme.js index 7a1aee7..f196220 100644 --- a/pc4mobx/organization/apis/rankscheme.js +++ b/pc4mobx/organization/apis/rankscheme.js @@ -59,4 +59,8 @@ export const updateForbiddenTag = (params) => { export const getSchemeForm = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/organization/apis/sequence.js b/pc4mobx/organization/apis/sequence.js new file mode 100644 index 0000000..a2dd192 --- /dev/null +++ b/pc4mobx/organization/apis/sequence.js @@ -0,0 +1,69 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/level/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/level/saveLevel', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +// export const edit = (params) => { +// return fetch('/api/bs/hrmorganization/scheme/updateScheme', { +// method: 'POST', +// mode: 'cors', +// headers: { +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify(params) +// }) +// } + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/level/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getLevelForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params); +} + +export const getTabInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params); +} + + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 8a3b279..97ac99f 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -69,6 +69,7 @@ export default class JobGrade extends React.Component { jobGrade.getTableInfo(); jobGrade.getHasRight(); } + getTopMenuBtns() { const { @@ -109,7 +110,7 @@ export default class JobGrade extends React.Component { jobGrade } = this.props; - jobGrade.setNeDialogTitle(i18n.label.newRankScheme()); + jobGrade.setNeDialogTitle(i18n.label.newJobGrade()); jobGrade.setIsNew(true); jobGrade.setVisible(true); jobGrade.getForm(); @@ -174,7 +175,15 @@ export default class JobGrade extends React.Component { } handleMenuClick(key) { + const { + jobGrade + } = this.props; + const { + isPanelShow + } = jobGrade; + isPanelShow && jobGrade.setPanelStatus(false); + this[key] && this[key](); } getTabBtn() { @@ -202,10 +211,17 @@ export default class JobGrade extends React.Component { form2 } = jobGrade; - jobGrade.setRankName(val); + jobGrade.setGradeName(val); !this.isEmptyObject(form2.getFormParams()) && jobGrade.updateFields(val); } + changeData(key) { + const { + jobGrade + } = this.props; + jobGrade.changeData(key); + } + reRenderColumns(columns) { let _this = this; columns.forEach((c, index) => { @@ -238,8 +254,8 @@ export default class JobGrade extends React.Component { jobGrade } = this.props; - jobGrade.setNeDialogTitle(i18n.label.editRankScheme()); - jobGrade.setLevelId(id); + jobGrade.setNeDialogTitle(i18n.label.editJobGrade()); + jobGrade.setGradeId(id); jobGrade.setIsNew(false); jobGrade.setVisible(true); jobGrade.getForm(); @@ -331,37 +347,9 @@ export default class JobGrade extends React.Component { } = this.props; const { isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount } = jobGrade; - const topTab = [ - { - color: "#000000", - groupid: "flowAll", - showcount: true, - title: "全部", - viewcondition: "0" - }, - { - color: "#ff3232", - groupid: "flowNew", - showcount: true, - title: "启用", - viewcondition: "1" - }, - { - color: "#fea468", - groupid: "flowRes", - showcount: true, - title: "禁用", - viewcondition: "2" - } - ]; - const topTabCount = { - flowAll: "120", - flowNew: "112", - flowOver: "0", - }; return (
@@ -382,9 +370,10 @@ export default class JobGrade extends React.Component { this.handleSave()} onCancel={() => jobGrade.setVisible(false)} diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index 020cd11..9c8ed11 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -109,7 +109,7 @@ export default class JobLevel extends React.Component { jobLevel } = this.props; - jobLevel.setNeDialogTitle(i18n.label.newRankScheme()); + jobLevel.setNeDialogTitle(i18n.label.newJobLevel()); jobLevel.setIsNew(true); jobLevel.setVisible(true); jobLevel.getForm(); @@ -174,7 +174,15 @@ export default class JobLevel extends React.Component { } handleMenuClick(key) { + const { + jobLevel + } = this.props; + const { + isPanelShow + } = jobLevel; + isPanelShow && jobLevel.setPanelStatus(false); + this[key] && this[key](); } getTabBtn() { @@ -206,6 +214,13 @@ export default class JobLevel extends React.Component { !this.isEmptyObject(form2.getFormParams()) && jobLevel.updateFields(val); } + changeData(key) { + const { + jobLevel + } = this.props; + jobLevel.changeData(key); + } + reRenderColumns(columns) { let _this = this; columns.forEach((c, index) => { @@ -238,7 +253,7 @@ export default class JobLevel extends React.Component { jobLevel } = this.props; - jobLevel.setNeDialogTitle(i18n.label.editRankScheme()); + jobLevel.setNeDialogTitle(i18n.label.editJobLevel()); jobLevel.setLevelId(id); jobLevel.setIsNew(false); jobLevel.setVisible(true); @@ -332,37 +347,9 @@ export default class JobLevel extends React.Component { } = this.props; const { isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount } = jobLevel; - const topTab = [ - { - color: "#000000", - groupid: "flowAll", - showcount: true, - title: "全部", - viewcondition: "0" - }, - { - color: "#ff3232", - groupid: "flowNew", - showcount: true, - title: "启用", - viewcondition: "1" - }, - { - color: "#fea468", - groupid: "flowRes", - showcount: true, - title: "禁用", - viewcondition: "2" - } - ]; - const topTabCount = { - flowAll: "120", - flowNew: "112", - flowOver: "0", - }; return (
@@ -383,9 +370,10 @@ export default class JobLevel extends React.Component { this.handleSave()} onCancel={() => jobLevel.setVisible(false)} diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index 41deb7d..929bf8a 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -174,7 +174,15 @@ export default class RankScheme extends React.Component { } handleMenuClick(key) { + const { + rankScheme + } = this.props; + const { + isPanelShow + } = rankScheme; + isPanelShow && rankScheme.setPanelStatus(false); + this[key] && this[key](); } getTabBtn() { diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js new file mode 100644 index 0000000..c3f4537 --- /dev/null +++ b/pc4mobx/organization/components/sequence/Sequence.js @@ -0,0 +1,414 @@ +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer, +} from 'mobx-react' +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, +} from 'ecCom' +import { + Row, + Col, + Spin, + Modal, + Button, + message, + Switch +} from 'antd' +import { + WeaSwitch, + WeaTableNew +} from 'comsMobx' +import { + i18n +} from '../../public/i18n'; + +import '../../style/common.less'; + +import NewAndEditDialog from '../NewAndEditDialog'; + + + +const toJS = mobx.toJS; +const confirm = Modal.confirm; +const WeaTable = WeaTableNew.WeaTable; + + +@inject('sequence') +@observer +export default class Sequence extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + sequence + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + sequence + } = this.props; + sequence.getTableInfo(); + sequence.getHasRight(); + } + + getTopMenuBtns() { + const { + sequence + } = this.props; + const { + topMenu, + tableStore + } = sequence; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun !== 'batchDelete') { + btns.push(); + } else { + btns.push(); + } + + }); + + return btns; + } + + handleClick(item) { + const { + sequence + } = this.props; + const { + isPanelShow + } = sequence; + + isPanelShow && sequence.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + sequence + } = this.props; + + sequence.setNeDialogTitle(i18n.label.newSequence()); + sequence.setIsNew(true); + sequence.setVisible(true); + sequence.getForm(); + } + + batchDelete() { + const { + sequence + } = this.props; + const { + tableStore + } = sequence; + + let keys = toJS(tableStore.selectedRowKeys).toString(); + sequence.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 { + sequence + } = this.props; + sequence.delete(); + } + + + getDropMenuDatas() { + const { + sequence + } = this.props; + const { + rightMenu + } = sequence; + + let menus = []; + toJS(rightMenu).map((item, index) => { + let obj = { + key: item.menuFun, + icon: , + content: item.menuName, + } + if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') { + obj.disabled = true; + } + menus.push(obj); + }) + return menus; + } + + handleMenuClick(key) { + const { + sequence + } = this.props; + const { + isPanelShow + } = sequence; + + isPanelShow && sequence.setPanelStatus(false); + this[key] && this[key](); + } + + getTabBtn() { + const { + sequence + } = this.props; + const { + form2 + } = sequence; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + onSearchChange(val) { + const { + sequence + } = this.props; + const { + form2 + } = sequence; + + sequence.setSequenceName(val); + !this.isEmptyObject(form2.getFormParams()) && sequence.updateFields(val); + } + + changeData(key) { + const { + sequence + } = this.props; + sequence.changeData(key); + } + + reRenderColumns(columns) { + let _this = this; + columns.forEach((c, index) => { + if (c.dataIndex == 'forbidden_tag') { + c.render = function(text, record) { + return _this.updateForbiddenTag(checked,record.id)} /> + } + }; + }) + } + + updateForbiddenTag(checked,id) { + const { + sequence + } = this.props; + sequence.updateForbiddenTag(checked,id); + } + + onOperatesClick(record, rowIndex, operate) { + const { + index + } = operate; + (index == '0') && this.doEdit(record.randomFieldId); + (index == '1') && this.doDel(record.randomFieldId); + + } + + doEdit(id) { + const { + sequence + } = this.props; + + sequence.setNeDialogTitle(i18n.label.editSequence()); + sequence.setLevelId(id); + sequence.setIsNew(false); + sequence.setVisible(true); + sequence.getForm(); + } + + doDel(id) { + const { + sequence + } = this.props; + sequence.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + const { + sequence + } = this.props; + const { + isNew + } = sequence; + + isNew && sequence.save(); + !isNew && sequence.edit(); + } + + getPanelComponents() { + const { + sequence + } = this.props; + const { + searchCondition, + form2, + searchConditionLoading + } = sequence; + + 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") { + sequence.getTableInfo(); + sequence.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + + + + render() { + + const { + sequence + } = this.props; + const { + isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + } = sequence; + + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + sequence.setPanelStatus(bool)} + hideSearchAd={() => sequence.setPanelStatus(false)} + searchsAd= {isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => sequence.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + this.reRenderColumns(c)} + onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} + /> +
+
+ this.handleSave()} + onCancel={() => sequence.setVisible(false)} + /> +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index f99c5d4..4a6ba37 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -5,7 +5,9 @@ import SimpleOrg from './components/tree/index'; import StandardOrg from './components/tree/standard_org' import RankScheme from './components/postionrank/RankScheme'; import JobLevel from './components/postionrank/JobLevel'; -import JobGrade from './components/postionrank/JobGrade' +import JobGrade from './components/postionrank/JobGrade'; +import Sequence from './components/sequence/Sequence'; + import stores from './stores'; import './style/index'; @@ -24,6 +26,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index c8b905e..e53bb43 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -119,6 +119,9 @@ export const i18n = { gradeName: () => getLabel(385936, '职级'), newJobGrade: () => getLabel(386246, '新建职级'), editJobGrade: () => getLabel(386247, '编辑职级'), + sequenceName: () => getLabel(385936, '岗位序列'), + newSequence: () => getLabel(386246, '新建岗位序列'), + editSequence: () => getLabel(386247, '编辑岗位序列'), authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index d77503f..7b65348 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -3,7 +3,8 @@ import { SimpleOrgStore } from './tree/simple_org'; import {StandardOrgStore} from './tree/standard_org' import {RankSchemeStore} from './rankscheme'; import {JobLevelStore} from './joblevel'; -import {JobGradeStore} from './jobgrade' +import {JobGradeStore} from './jobgrade'; +import {SequenceStore} from './sequence' module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -11,4 +12,5 @@ module.exports = { rankScheme: new RankSchemeStore(), jobLevel: new JobLevelStore(), jobGrade: new JobGradeStore(), + sequence: new SequenceStore(), }; diff --git a/pc4mobx/organization/stores/jobgrade.js b/pc4mobx/organization/stores/jobgrade.js index 11ad9cf..b4773ed 100644 --- a/pc4mobx/organization/stores/jobgrade.js +++ b/pc4mobx/organization/stores/jobgrade.js @@ -44,7 +44,9 @@ export class JobGradeStore { @observable dialogLoading = true; @observable gradeId = ''; @observable date = ''; - @observable selectedKey = 0; + @observable selectedKey = -1; + @observable topTab = []; + @observable topTabCount = {}; @@ -52,95 +54,113 @@ export class JobGradeStore { getTableInfo() { let params; this.tableStore = new TableStore(); - // if (this.isEmptyObject(this.form2.getFormParams())) { - // params = { - // ...this.form2.getFormParams(), - // gradeName: this.gradeName - // }; - // } 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); - // }) + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...this.form2.getFormParams(), + gradeName: this.gradeName, + viewCondition:this.selectedKey + }; + } else { + params = { + ...this.form2.getFormParams(), + viewCondition:this.selectedKey + }; + } + 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); + }) + //获取tab信息 + this.getTabInfo(); } + @action + getTabInfo() { + Api.getTabInfo().then(res => { + if (res.code === 200) { + res.data.topTabs && this.setTopTab(res.data.topTabs); + res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + //删除 delete() { let params = { ids: this.ids }; - // Api.deleteTableData(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(i18n.message.deleteSuccess()); - // this.getTableInfo(); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.deleteTableData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.deleteSuccess()); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } save() { let params = { ...this.form.getFormParams() }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.add(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.add(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } edit() { let params = { ...this.form.getFormParams(), id: this.gradeId }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.edit(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.edit(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } updateForbiddenTag(checked, id) { @@ -148,17 +168,17 @@ export class JobGradeStore { forbiddenTag: checked, id: id } - // Api.updateForbiddenTag(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.updateForbiddenTag(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } getForm() { @@ -166,82 +186,48 @@ export class JobGradeStore { id: this.gradeId } this.setDialogLoadingStatus(true); - // Api.getSchemeForm(params).then(res => { - // if (res.code === 200) { - // this.setDialogLoadingStatus(false); - // res.data.condition && this.setCondition(res.data.condition); - // res.data.condition && this.form.initFormFields(res.data.condition); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getGradeForm(params).then(res => { + if (res.code === 200) { + this.setDialogLoadingStatus(false); + res.data.condition && this.setCondition(res.data.condition); + res.data.condition && this.form.initFormFields(res.data.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } getSearchCondition() { this.setScLoadingStatus(false); - // Api.getAdvanceSearchCondition().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); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getAdvanceSearchCondition().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); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } @action - getHasRight() { - this.topMenu = [ - { - "isBatch": "1", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "1", - "isTop": "1", - "menuFun": "batchDelete", - "menuIcon": "icon-coms-Batch-delete", - "menuName": "批量删除", - "type": "BTN_BatchDelete" + getHasRight() { + Api.getHasRight().then(res => { + if (res.code === 200) { + res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + res.data.topMenu && this.setTopMenu(res.data.topMenu); + } else { + message.warning(res.msg); } - ]; - this.rightMenu = [ - { - "isBatch": "0", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "log", - "menuIcon": "icon-coms-Print-log", - "menuName": "日志", - "type": "BTN_log" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "custom", - "menuIcon": "icon-coms-task-list", - "menuName": "显示列定制", - "type": "BTN_COLUMN" - } - ] + }, error => { + message.warning(error.msg); + }) } updateFields(val) { @@ -252,6 +238,11 @@ export class JobGradeStore { }); } + changeData(key) { + this.setSelectedKey(key); + this.getTableInfo(); + } + setSearchCondition(condition) { this.searchCondition = condition; } @@ -330,4 +321,20 @@ export class JobGradeStore { this.selectedKey = selectedKey; } + setTopTab(topTab) { + this.topTab = topTab; + } + + setTopTabCount(topTabCount) { + this.topTabCount = topTabCount; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js index 98971ad..99c2deb 100644 --- a/pc4mobx/organization/stores/joblevel.js +++ b/pc4mobx/organization/stores/joblevel.js @@ -44,7 +44,9 @@ export class JobLevelStore { @observable dialogLoading = true; @observable levelId = ''; @observable date = ''; - @observable selectedKey = 0; + @observable selectedKey = -1; + @observable topTab = []; + @observable topTabCount = {}; @@ -52,25 +54,29 @@ export class JobLevelStore { getTableInfo() { let params; this.tableStore = new TableStore(); - // if (this.isEmptyObject(this.form2.getFormParams())) { - // params = { - // ...this.form2.getFormParams(), - // levelName: this.levelName - // }; - // } 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); - // }) + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...this.form2.getFormParams(), + levelName: this.levelName, + viewCondition:this.selectedKey + }; + } else { + params = { + ...this.form2.getFormParams(), + viewCondition:this.selectedKey + }; + } + 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); + }) + //获取tab信息 + this.getTabInfo(); } @@ -79,68 +85,73 @@ export class JobLevelStore { let params = { ids: this.ids }; - // Api.deleteTableData(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(i18n.message.deleteSuccess()); - // this.getTableInfo(); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.deleteTableData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.deleteSuccess()); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } save() { let params = { ...this.form.getFormParams() }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.add(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.add(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } edit() { let params = { ...this.form.getFormParams(), id: this.levelId }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.edit(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.edit(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + changeData(key) { + this.setSelectedKey(key); + this.getTableInfo(); } updateForbiddenTag(checked, id) { @@ -148,17 +159,17 @@ export class JobLevelStore { forbiddenTag: checked, id: id } - // Api.updateForbiddenTag(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.updateForbiddenTag(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } getForm() { @@ -166,82 +177,62 @@ export class JobLevelStore { id: this.levelId } this.setDialogLoadingStatus(true); - // Api.getSchemeForm(params).then(res => { - // if (res.code === 200) { - // this.setDialogLoadingStatus(false); - // res.data.condition && this.setCondition(res.data.condition); - // res.data.condition && this.form.initFormFields(res.data.condition); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getLevelForm(params).then(res => { + if (res.code === 200) { + this.setDialogLoadingStatus(false); + res.data.condition && this.setCondition(res.data.condition); + res.data.condition && this.form.initFormFields(res.data.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } getSearchCondition() { this.setScLoadingStatus(false); - // Api.getAdvanceSearchCondition().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); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getAdvanceSearchCondition().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); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + @action + getTabInfo() { + Api.getTabInfo().then(res => { + if (res.code === 200) { + res.data.topTabs && this.setTopTab(res.data.topTabs); + res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } @action - getHasRight() { - this.topMenu = [ - { - "isBatch": "1", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "1", - "isTop": "1", - "menuFun": "batchDelete", - "menuIcon": "icon-coms-Batch-delete", - "menuName": "批量删除", - "type": "BTN_BatchDelete" + getHasRight() { + Api.getHasRight().then(res => { + if (res.code === 200) { + res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + res.data.topMenu && this.setTopMenu(res.data.topMenu); + } else { + message.warning(res.msg); } - ]; - this.rightMenu = [ - { - "isBatch": "0", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "log", - "menuIcon": "icon-coms-Print-log", - "menuName": "日志", - "type": "BTN_log" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "custom", - "menuIcon": "icon-coms-task-list", - "menuName": "显示列定制", - "type": "BTN_COLUMN" - } - ] + }, error => { + message.warning(error.msg); + }) } updateFields(val) { @@ -330,4 +321,20 @@ export class JobLevelStore { this.selectedKey = selectedKey; } + setTopTab(topTab) { + this.topTab = topTab; + } + + setTopTabCount(topTabCount) { + this.topTabCount = topTabCount; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index 658efd0..14de671 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -202,51 +202,17 @@ export class RankSchemeStore { @action - getHasRight() { - this.topMenu = [ - { - "isBatch": "1", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "1", - "isTop": "1", - "menuFun": "batchDelete", - "menuIcon": "icon-coms-Batch-delete", - "menuName": "批量删除", - "type": "BTN_BatchDelete" + getHasRight() { + Api.getHasRight().then(res => { + if (res.code === 200) { + res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + res.data.topMenu && this.setTopMenu(res.data.topMenu); + } else { + message.warning(res.msg); } - ]; - this.rightMenu = [ - { - "isBatch": "0", - "isTop": "1", - "menuFun": "new", - "menuIcon": "icon-coms-New-Flow", - "menuName": "新建", - "type": "BTN_Addnew" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "log", - "menuIcon": "icon-coms-Print-log", - "menuName": "日志", - "type": "BTN_log" - }, - { - "isBatch": "0", - "isTop": "0", - "menuFun": "custom", - "menuIcon": "icon-coms-task-list", - "menuName": "显示列定制", - "type": "BTN_COLUMN" - } - ] + }, error => { + message.warning(error.msg); + }) } updateFields(val) { @@ -331,4 +297,12 @@ export class RankSchemeStore { this.date = date; } + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/sequence.js b/pc4mobx/organization/stores/sequence.js new file mode 100644 index 0000000..61c19e8 --- /dev/null +++ b/pc4mobx/organization/stores/sequence.js @@ -0,0 +1,340 @@ +import { + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/sequence'; // 引入API接口文件 +import { + WeaForm +} from 'comsMobx'; +import { + WeaTableNew +} from 'comsMobx'; +import { + Modal, + message, +} from 'antd' +import { + i18n +} from '../public/i18n'; + +const toJS = mobx.toJS; +const { + TableStore +} = WeaTableNew; + +export class SequenceStore { + @observable tableStore = new TableStore(); + @observable topMenu = [] + @observable rightMenu = []; + @observable condition = []; + @observable searchCondition = []; + @observable isEdit = true; + @observable isNew = true; + @observable isPanelShow = false; //高级搜索面板 + @observable form2 = new WeaForm(); + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); + @observable sequenceName = ''; + @observable conditionNum = 2; + @observable ids = ''; //选择行id + @observable searchConditionLoading = true; + @observable nEdialogTitle = ''; + @observable visible = false; + @observable dialogLoading = true; + @observable sequenceId = ''; + @observable date = ''; + @observable selectedKey = -1; + @observable topTab = []; + @observable topTabCount = {}; + + + + @action + getTableInfo() { + let params; + this.tableStore = new TableStore(); + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...this.form2.getFormParams(), + sequenceName: this.sequenceName, + viewcondition:this.selectedKey + }; + } else { + params = { + ...this.form2.getFormParams(), + viewcondition:this.selectedKey + }; + } + // 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); + // }) + // //获取tab信息 + // this.getTabInfo(); + + } + + //删除 + delete() { + let params = { + ids: this.ids + }; + // Api.deleteTableData(params).then(response => { + // return response.json() + // }).then(data => { + // if (data.code === 200) { + // message.success(i18n.message.deleteSuccess()); + // this.getTableInfo(); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + } + + save() { + let params = { + ...this.form.getFormParams() + }; + // this.form.validateForm().then(f => { + // if (f.isValid) { + // Api.add(params).then(response => { + // return response.json() + // }).then(data => { + // if (data.code === 200) { + // message.success(data.msg); + // this.getTableInfo(); + // this.setVisible(false); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + // } else { + // f.showErrors(); + // this.setDate(new Date()); + // } + // }); + } + + edit() { + let params = { ...this.form.getFormParams(), id: this.sequenceId }; + // this.form.validateForm().then(f => { + // if (f.isValid) { + // Api.edit(params).then(response => { + // return response.json() + // }).then(data => { + // if (data.code === 200) { + // message.success(data.msg); + // this.getTableInfo(); + // this.setVisible(false); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + // } else { + // f.showErrors(); + // this.setDate(new Date()); + // } + // }); + } + + changeData(key) { + this.setSelectedKey(key); + this.getTableInfo(); + } + + updateForbiddenTag(checked, id) { + let params = { + forbiddenTag: checked, + id: id + } + // Api.updateForbiddenTag(params).then(response => { + // return response.json() + // }).then(data => { + // if (data.code === 200) { + // message.success(data.msg); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + } + + getForm() { + let params = this.isNew ? {} : { + id: this.sequenceId + } + this.setDialogLoadingStatus(true); + Api.getLevelForm(params).then(res => { + if (res.code === 200) { + this.setDialogLoadingStatus(false); + res.data.condition && this.setCondition(res.data.condition); + res.data.condition && this.form.initFormFields(res.data.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + } + + getSearchCondition() { + this.setScLoadingStatus(false); + // Api.getAdvanceSearchCondition().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); + // } else { + // message.warning(res.msg); + // } + // }, error => { + // message.warning(error.msg); + // }) + } + + @action + getTabInfo() { + // Api.getTabInfo().then(res => { + // if (res.code === 200) { + // res.data.topTabs && this.setTopTab(res.data.topTabs); + // res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); + // } else { + // message.warning(res.msg); + // } + // }, error => { + // message.warning(error.msg); + // }) + } + + + @action + getHasRight() { + Api.getHasRight().then(res => { + if (res.code === 200) { + res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + res.data.topMenu && this.setTopMenu(res.data.topMenu); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + updateFields(val) { + this.form2.updateFields({ + sequenceName: { + value: val + } + }); + } + + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setSequenceName(val) { + this.sequenceName = val; + } + + 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; + } + + setSequenceId(sequenceId) { + this.sequenceId = sequenceId; + } + + setDate(date) { + this.date = date; + } + + setSelectedKey(selectedKey) { + this.selectedKey = selectedKey; + } + + setTopTab(topTab) { + this.topTab = topTab; + } + + setTopTabCount(topTabCount) { + this.topTabCount = topTabCount; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + +} \ No newline at end of file From 811c9da4d1aa3b58a763afd3b712a0b694477367 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 13 May 2022 16:56:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=9B=86=E5=9B=A2=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/group.js | 0 pc4mobx/organization/apis/sequence.js | 38 +- .../components/NewAndEditDialog.js | 72 ++- .../organization/components/group/Group.js | 224 +++++++++ .../components/postionrank/JobGrade.js | 2 + .../components/postionrank/JobLevel.js | 1 + .../components/postionrank/RankScheme.js | 1 + .../components/sequence/Sequence.js | 5 +- pc4mobx/organization/index.js | 2 + pc4mobx/organization/public/i18n.js | 3 + pc4mobx/organization/stores/group.js | 458 ++++++++++++++++++ pc4mobx/organization/stores/index.js | 9 +- pc4mobx/organization/stores/jobgrade.js | 41 ++ pc4mobx/organization/stores/rankscheme.js | 1 - pc4mobx/organization/stores/sequence.js | 192 ++++---- pc4mobx/organization/style/common.less | 50 +- 16 files changed, 933 insertions(+), 166 deletions(-) create mode 100644 pc4mobx/organization/apis/group.js create mode 100644 pc4mobx/organization/components/group/Group.js create mode 100644 pc4mobx/organization/stores/group.js diff --git a/pc4mobx/organization/apis/group.js b/pc4mobx/organization/apis/group.js new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/organization/apis/sequence.js b/pc4mobx/organization/apis/sequence.js index a2dd192..97d0cd3 100644 --- a/pc4mobx/organization/apis/sequence.js +++ b/pc4mobx/organization/apis/sequence.js @@ -4,11 +4,11 @@ import { } from 'ecCom' export const getSearchList = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelTable', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSequenceTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/level/deleteByIds', { + return fetch('/api/bs/hrmorganization/sequence/deleteByIds', { method: 'POST', mode: 'cors', headers: { @@ -19,11 +19,11 @@ export const deleteTableData = (params) => { } export const getAdvanceSearchCondition = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/level/getSearchCondition', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSearchCondition', 'GET', params); } export const add = (params) => { - return fetch('/api/bs/hrmorganization/level/saveLevel', { + return fetch('/api/bs/hrmorganization/sequence/saveSequence', { method: 'POST', mode: 'cors', headers: { @@ -33,19 +33,19 @@ export const add = (params) => { }) } -// export const edit = (params) => { -// return fetch('/api/bs/hrmorganization/scheme/updateScheme', { -// method: 'POST', -// mode: 'cors', -// headers: { -// 'Content-Type': 'application/json' -// }, -// body: JSON.stringify(params) -// }) -// } +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/sequence/updateSequence', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/level/updateForbiddenTagById', { + return fetch('/api/bs/hrmorganization/sequence/updateForbiddenTagById', { method: 'POST', mode: 'cors', headers: { @@ -55,15 +55,15 @@ export const updateForbiddenTag = (params) => { }) } -export const getLevelForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params); +export const getSequenceForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSequenceForm', 'GET', params); } export const getTabInfo = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getTabInfo', 'GET', params); } export const getHasRight = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getHasRight', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/organization/components/NewAndEditDialog.js b/pc4mobx/organization/components/NewAndEditDialog.js index b447c5a..7513c42 100644 --- a/pc4mobx/organization/components/NewAndEditDialog.js +++ b/pc4mobx/organization/components/NewAndEditDialog.js @@ -24,6 +24,8 @@ export default class NewAndEditDialog extends React.Component { super(props); this.state = { width: 700, + enable: props.enable + } } @@ -39,24 +41,41 @@ export default class NewAndEditDialog extends React.Component { isFormInit && condition.map(c => { c.items.map((field, index) => { arr.push( - {} - ) + label={`${field.label}`} + labelCol={{ span: `${field.labelcol}` }} + error={form.getError(field)} + tipPosition="bottom" + wrapperCol={{ span: `${field.fieldcol}` }}> + {} + ) }) }) return
{arr}
} + onChange = data => { + if(this.state.enable && data.schemeId) { + const { + condition, + form, + bindChangeEnvent, + } = this.props; + bindChangeEnvent(data.schemeId.value); + } + + + }; + + onBlur = data => { + //console.log("onBlur 回调", data); + }; + + getSearchGroupForm() { const { condition, form, isFormInit, - domkey, isEdit } = this.props; @@ -67,15 +86,16 @@ export default class NewAndEditDialog extends React.Component { _arr.push({ com: ( - - + label={`${field.label}`} + labelCol={{ span: `${field.labelcol}` }} + error={form.getError(field)} + tipPosition="bottom" + wrapperCol={{ span: `${field.fieldcol}` }} + underline={isEdit ? false : true} + > + + ), colSpan: 1 }) @@ -115,17 +135,17 @@ export default class NewAndEditDialog extends React.Component { visible={visible} closable={true} hasScroll={true} - onCancel={() => onCancel() } - buttons={isEdit?buttons:buttons.slice(1,2)} - style={{width: width, height: height}} + onCancel={() => onCancel()} + buttons={isEdit ? buttons : buttons.slice(1, 2)} + style={{ width: width, height: height }} > { - loading ?
- -
- :
1 ? '' : 'hrm-dialog-form'}> - {conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()} -
+ loading ?
+ +
+ :
1 ? '' : 'hrm-dialog-form'}> + {conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()} +
} ) diff --git a/pc4mobx/organization/components/group/Group.js b/pc4mobx/organization/components/group/Group.js new file mode 100644 index 0000000..4e26c0b --- /dev/null +++ b/pc4mobx/organization/components/group/Group.js @@ -0,0 +1,224 @@ +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer, +} from 'mobx-react' +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, +} from 'ecCom' +import { + Row, + Col, + Spin, + Modal, + Button, + message, + Switch +} from 'antd' +import { + WeaSwitch, + WeaTableNew +} from 'comsMobx' +import { + i18n +} from '../../public/i18n'; + +import '../../style/common.less'; + +import NewAndEditDialog from '../NewAndEditDialog'; + + +const toJS = mobx.toJS; +const confirm = Modal.confirm; + + +@inject('group') +@observer +export default class Group extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + group + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + group + } = this.props; + group.getGroupForm(); + group.getHasRight(); + } + + getTopMenuBtns() { + const { + group + } = this.props; + const { + topMenu, + tableStore + } = group; + + let btns = []; + topMenu.map((item, i) => { + btns.push(); + }); + return btns; + } + + getDropMenuDatas() { + const { + group + } = this.props; + const { + rightMenu + } = group; + + let menus = []; + toJS(rightMenu).map((item, index) => { + let obj = { + key: item.menuFun, + icon: , + content: item.menuName, + } + if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') { + obj.disabled = true; + } + menus.push(obj); + }) + return menus; + } + + + + doEdit(id) { + const { + group + } = this.props; + + group.setNeDialogTitle(i18n.label.editGroup()); + group.setVisible(true); + group.getForm(); + } + + + handleSave() { + const { + group + } = this.props; + group.edit(); + } + + handleMenuClick(key) { + this[key] && this[key](); + } + + handleClick(item) { + this[item.menuFun] && this[item.menuFun](); + } + + + changeData(key) { + const { + group + } = this.props; + group.changeData(key); + } + + getFormField() { + const { + group + } = this.props; + const { form1, groupCondition } = group; + + const { isFormInit } = form1; + const formParams = form1.getFormParams(); + let items = []; + isFormInit && toJS(groupCondition).map(c => { + c.items.map((fields, index) => { + items.push( + + ); + }); + }); + return
{items}
; + } + + + + render() { + + const { + group + } = this.props; + const { + nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey + } = group; + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + +
+ {this.getFormField()} +
+
+
+ this.handleSave()} + onCancel={() => group.setVisible(false)} + enable={false} //是否开启字段联动 + /> +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 97ac99f..061c8c6 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -407,6 +407,8 @@ export default class JobGrade extends React.Component { conditionLen={3} save={() => this.handleSave()} onCancel={() => jobGrade.setVisible(false)} + enable={true} //是否开启字段联动 + bindChangeEnvent={val => jobGrade.updateConditions(val)} />
) diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index 9c8ed11..61dedd5 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -407,6 +407,7 @@ export default class JobLevel extends React.Component { conditionLen={3} save={() => this.handleSave()} onCancel={() => jobLevel.setVisible(false)} + enable={false} //是否开启字段联动 />
) diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index 929bf8a..d078ee6 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -393,6 +393,7 @@ export default class RankScheme extends React.Component { conditionLen={3} save={() => this.handleSave()} onCancel={() => rankScheme.setVisible(false)} + enable={false} //是否开启字段联动 /> ) diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js index c3f4537..2fa8554 100644 --- a/pc4mobx/organization/components/sequence/Sequence.js +++ b/pc4mobx/organization/components/sequence/Sequence.js @@ -254,7 +254,7 @@ export default class Sequence extends React.Component { } = this.props; sequence.setNeDialogTitle(i18n.label.editSequence()); - sequence.setLevelId(id); + sequence.setSequenceId(id); sequence.setIsNew(false); sequence.setVisible(true); sequence.getForm(); @@ -358,7 +358,7 @@ export default class Sequence extends React.Component { onClick={key => this.handleMenuClick(key)} > } iconBgcolor='#217346' loading={true} @@ -407,6 +407,7 @@ export default class Sequence extends React.Component { conditionLen={3} save={() => this.handleSave()} onCancel={() => sequence.setVisible(false)} + enable={false} //是否开启字段联动 /> ) diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 4a6ba37..c0b126d 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -7,6 +7,7 @@ import RankScheme from './components/postionrank/RankScheme'; import JobLevel from './components/postionrank/JobLevel'; import JobGrade from './components/postionrank/JobGrade'; import Sequence from './components/sequence/Sequence'; +import Group from './components/group/group'; import stores from './stores'; import './style/index'; @@ -27,6 +28,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index e53bb43..5a1f774 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -122,6 +122,9 @@ export const i18n = { sequenceName: () => getLabel(385936, '岗位序列'), newSequence: () => getLabel(386246, '新建岗位序列'), editSequence: () => getLabel(386247, '编辑岗位序列'), + groupInfo: () => getLabel(385936, '总部'), + editGroup: () => getLabel(386247, '编辑总部'), + authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/group.js b/pc4mobx/organization/stores/group.js new file mode 100644 index 0000000..624ac6f --- /dev/null +++ b/pc4mobx/organization/stores/group.js @@ -0,0 +1,458 @@ +import { + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/group'; // 引入API接口文件 +import { + WeaForm +} from 'comsMobx'; +import { + Modal, + message, +} from 'antd' +import { + i18n +} from '../public/i18n'; + +const toJS = mobx.toJS; + +export class GroupStore { + @observable topMenu = [] + @observable rightMenu = []; + @observable condition = []; + @observable groupCondition = []; + @observable isEdit = true; + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); + @observable nEdialogTitle = ''; + @observable visible = false; + @observable dialogLoading = true; + @observable selectedKey = 1; + @observable topTab = []; + @observable date = ''; + + @action + getGroupForm() { + let params = { + viewattr: 1 + } + //api + let condition = [ + { + "title": "总部信息", + "defaultshow": true, + "items": [ + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companyname" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "rules": "required|string", + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "E9TEST", + "valueList": [], + "viewAttr": 1 + }, + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companydesc" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "rules": "required|string", + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "E9TEST", + "valueList": [], + "viewAttr": 1 + }, + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companyweb" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "", + "valueList": [], + "viewAttr": 1 + } + ] + } + ] + + this.setGroupCondition(condition); + this.form1.initFormFields(condition); + this.getTabInfo(); + + } + + getTabInfo() { + // Api.getTabInfo().then(res => { + // if (res.code === 200) { + // res.data.topTabs && this.setTopTab(res.data.topTabs); + // res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); + // } else { + // message.warning(res.msg); + // } + // }, error => { + // message.warning(error.msg); + // }) + const topTab = [ + { + "title": "总部信息", + "viewCondition": "1" + } + ] + this.setTopTab(topTab) + } + + + @action + getHasRight() { + const rightMenu = [ + { + "isTop": "1", + "menuFun": "doEdit", + "menuIcon": "icon-coms-edit", + "menuName": "编辑", + "type": "BTN_EDIT" + } + ] + const topMenu = [ + { + "isTop": "1", + "menuFun": "doEdit", + "menuIcon": "icon-coms-edit", + "menuName": "编辑", + "type": "BTN_EDIT" + } + ] + this.setTopMenu(topMenu); + this.setRightMenu(rightMenu); + // Api.getHasRight().then(res => { + // if (res.code === 200) { + // res.data.rightMenu && this.setRightMenu(res.data.rightMenu); + // res.data.topMenu && this.setTopMenu(res.data.topMenu); + // } else { + // message.warning(res.msg); + // } + // }, error => { + // message.warning(error.msg); + // }) + } + + + edit() { + + // let params = { ...this.form.getFormParams(), id: this.schemeId }; + // this.form.validateForm().then(f => { + // if (f.isValid) { + // Api.edit(params).then(response => { + // return response.json() + // }).then(data => { + // if (data.code === 200) { + // message.success(data.msg); + // this.getTableInfo(); + // this.setVisible(false); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + // } else { + // f.showErrors(); + // this.setDate(new Date()); + // } + // }); + } + + getForm() { + let params = { + viewattr: 2 + } + + + const condition = [ + { + "title": "总部信息", + "defaultshow": true, + "items": [ + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companyname" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "rules": "required|string", + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "E9TEST", + "valueList": [], + "viewAttr": 3 + }, + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companydesc" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "rules": "required|string", + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "E9TEST", + "valueList": [], + "viewAttr": 3 + }, + { + "belong": "PC", + "checkbox": false, + "checkboxValue": false, + "colSpan": 2, + "conditionType": "INPUT", + "dateGroup": false, + "defaultDisplayInBar": false, + "detailtype": 1, + "domkey": [ + "companyweb" + ], + "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, + "otherParams": { + "inputType": "multilang", + "isBase64": true + }, + "precision": 0, + "secretLimit": false, + "showOrder": 0, + "showTime": false, + "stringLength": 0, + "supportCancel": false, + "tipPosition": "bottom", + "value": "", + "valueList": [], + "viewAttr": 2 + } + ] + } + ] + this.setCondition(condition); + this.form.initFormFields(condition); + this.setDialogLoadingStatus(false); + // this.setDialogLoadingStatus(true); + + // Api.getSchemeForm(params).then(res => { + // if (res.code === 200) { + // this.setDialogLoadingStatus(false); + // res.data.condition && this.setCondition(res.data.condition); + // res.data.condition && this.form.initFormFields(res.data.condition); + // } else { + // message.warning(res.msg); + // } + // }, error => { + // message.warning(error.msg); + // }) + } + + changeData(key) { + this.setSelectedKey(key); + } + + + setVisible(bool) { + this.visible = bool; + } + + setGroupCondition(groupCondition) { + this.groupCondition = groupCondition + } + + setCondition(condition) { + this.condition = condition; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + + setTopTab(topTab) { + this.topTab = topTab; + } + + setNeDialogTitle(title) { + this.nEdialogTitle = title; + } + + setDialogLoadingStatus(bool) { + this.dialogLoading = bool; + } + + + +} \ No newline at end of file diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index 7b65348..c462f2c 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -1,10 +1,13 @@ import { SimpleOrgStore } from './tree/simple_org'; -import {StandardOrgStore} from './tree/standard_org' +import {StandardOrgStore} from './tree/standard_org'; import {RankSchemeStore} from './rankscheme'; import {JobLevelStore} from './joblevel'; import {JobGradeStore} from './jobgrade'; -import {SequenceStore} from './sequence' +import {SequenceStore} from './sequence'; +import {GroupStore} from './group'; + + module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -13,4 +16,6 @@ module.exports = { jobLevel: new JobLevelStore(), jobGrade: new JobGradeStore(), sequence: new SequenceStore(), + group: new GroupStore() + }; diff --git a/pc4mobx/organization/stores/jobgrade.js b/pc4mobx/organization/stores/jobgrade.js index b4773ed..9edb713 100644 --- a/pc4mobx/organization/stores/jobgrade.js +++ b/pc4mobx/organization/stores/jobgrade.js @@ -47,6 +47,7 @@ export class JobGradeStore { @observable selectedKey = -1; @observable topTab = []; @observable topTabCount = {}; + @observable key = '';// @@ -238,6 +239,42 @@ export class JobGradeStore { }); } + updateConditions(val) { + let currenttime = Date.now(); + let key = `schemId_${currenttime}`; + const lastKey = this.key; + // let conditions = []; + // this.condition[0].items.map(item => { + // if(item.domkey[0] === 'levelId') { + // Reflect.deleteProperty(item.browserConditionParam.dataParams,lastKey) + // this.setKey(key); + // //completeParams conditionDataParams + // item.browserConditionParam.dataParams = { + // [key]:val, + // ...item.browserConditionParam.dataParams, + // currenttime: currenttime + // } + // } + // conditions.push(item); + // }) + + Reflect.deleteProperty(this.condition[0].items[4].browserConditionParam.dataParams,lastKey) + this.setKey(key); + this.condition[0].items[4].browserConditionParam.dataParams = { + [key]:val, + ...this.condition[0].items[4].browserConditionParam.dataParams, + currenttime: currenttime + } + this.form.updateFields({ + levelId: { + value: '' + } + }); + + this.setCondition(this.condition); + } + + changeData(key) { this.setSelectedKey(key); this.getTableInfo(); @@ -337,4 +374,8 @@ export class JobGradeStore { this.rightMenu = rightMenu; } + setKey (key) { + this.key = key; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index 14de671..adbe001 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -123,7 +123,6 @@ export class RankSchemeStore { edit() { let params = { ...this.form.getFormParams(), id: this.schemeId }; - debugger this.form.validateForm().then(f => { if (f.isValid) { Api.edit(params).then(response => { diff --git a/pc4mobx/organization/stores/sequence.js b/pc4mobx/organization/stores/sequence.js index 61c19e8..547cfbd 100644 --- a/pc4mobx/organization/stores/sequence.js +++ b/pc4mobx/organization/stores/sequence.js @@ -66,17 +66,17 @@ export class SequenceStore { viewcondition:this.selectedKey }; } - // 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); - // }) - // //获取tab信息 - // this.getTabInfo(); + 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); + }) + //获取tab信息 + this.getTabInfo(); } @@ -85,68 +85,68 @@ export class SequenceStore { let params = { ids: this.ids }; - // Api.deleteTableData(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(i18n.message.deleteSuccess()); - // this.getTableInfo(); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.deleteTableData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.deleteSuccess()); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } save() { let params = { ...this.form.getFormParams() }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.add(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.add(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } edit() { let params = { ...this.form.getFormParams(), id: this.sequenceId }; - // this.form.validateForm().then(f => { - // if (f.isValid) { - // Api.edit(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // this.getTableInfo(); - // this.setVisible(false); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) - // } else { - // f.showErrors(); - // this.setDate(new Date()); - // } - // }); + this.form.validateForm().then(f => { + if (f.isValid) { + Api.edit(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } changeData(key) { @@ -159,17 +159,17 @@ export class SequenceStore { forbiddenTag: checked, id: id } - // Api.updateForbiddenTag(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(data.msg); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.updateForbiddenTag(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } getForm() { @@ -177,7 +177,7 @@ export class SequenceStore { id: this.sequenceId } this.setDialogLoadingStatus(true); - Api.getLevelForm(params).then(res => { + Api.getSequenceForm(params).then(res => { if (res.code === 200) { this.setDialogLoadingStatus(false); res.data.condition && this.setCondition(res.data.condition); @@ -193,31 +193,31 @@ export class SequenceStore { getSearchCondition() { this.setScLoadingStatus(false); - // Api.getAdvanceSearchCondition().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); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getAdvanceSearchCondition().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); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } @action getTabInfo() { - // Api.getTabInfo().then(res => { - // if (res.code === 200) { - // res.data.topTabs && this.setTopTab(res.data.topTabs); - // res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); - // } else { - // message.warning(res.msg); - // } - // }, error => { - // message.warning(error.msg); - // }) + Api.getTabInfo().then(res => { + if (res.code === 200) { + res.data.topTabs && this.setTopTab(res.data.topTabs); + res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) } diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less index bf62c98..15e7919 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -1,22 +1,32 @@ /* 公共样式 */ -.hrm-loading-center-small{ - position: absolute; - top:50%; - left:50%; - margin-left:-8px; - margin-top: -8px; - } - - .hrm-dialog-form{ - padding-top: 27px; - padding-right: 8%; - padding-left: 8%; - padding-bottom: 25px; - - .wea-upload-list-item { - & > div{ - width: 400px !important; - line-height: 30px; - } +.hrm-loading-center-small { + position: absolute; + top: 50%; + left: 50%; + margin-left: -8px; + margin-top: -8px; +} + +.hrm-dialog-form { + padding-top: 27px; + padding-right: 8%; + padding-left: 8%; + padding-bottom: 25px; + + .wea-upload-list-item { + &>div { + width: 400px !important; + line-height: 30px; } - } \ No newline at end of file + } +} + + +//集团管理 +.organization-group { + padding-left: 25%; + padding-right: 25%; + padding-top: 28px; + height: calc(100% - 47px); + overflow: auto; +} \ No newline at end of file