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