From ebf1cb58d97ba77dc891bae784435c289900eeab Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 22 Jun 2022 17:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/jobgrade.js | 4 + pc4mobx/organization/apis/joblevel.js | 4 + .../components/company/CompanyExtend.js | 15 +- .../components/company/company.js | 4 +- .../components/department/department.js | 4 +- .../components/department/departmentExtend.js | 548 ++++++++--------- pc4mobx/organization/components/job/Job.js | 4 +- .../organization/components/job/JobExtend.js | 557 +++++++++--------- .../components/postionrank/JobGrade.js | 120 ++-- .../components/postionrank/JobLevel.js | 79 ++- pc4mobx/organization/public/i18n.js | 11 +- pc4mobx/organization/stores/companyextend.js | 2 - pc4mobx/organization/stores/jobgrade.js | 55 +- pc4mobx/organization/stores/joblevel.js | 54 +- 14 files changed, 793 insertions(+), 668 deletions(-) diff --git a/pc4mobx/organization/apis/jobgrade.js b/pc4mobx/organization/apis/jobgrade.js index 5ef46d5..2029137 100644 --- a/pc4mobx/organization/apis/jobgrade.js +++ b/pc4mobx/organization/apis/jobgrade.js @@ -64,4 +64,8 @@ export const getTabInfo = (params) => { export const getHasRight = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/grade/getHasRight', 'GET', params); +} + +export const getTree = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTreeData', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/organization/apis/joblevel.js b/pc4mobx/organization/apis/joblevel.js index 0203910..8fb9365 100644 --- a/pc4mobx/organization/apis/joblevel.js +++ b/pc4mobx/organization/apis/joblevel.js @@ -65,4 +65,8 @@ export const getTabInfo = (params) => { export const getHasRight = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/level/getTableBtn', 'GET', params); +} + +export const getTree = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTreeData', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index b766975..92b4901 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-18 14:52:39 - * @LastEditTime: 2022-05-26 17:11:02 + * @LastEditTime: 2022-06-22 16:37:43 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js */ @@ -228,15 +228,7 @@ export default class CompanyExtend extends React.Component { render() { const { companyExtend } = this.props; - const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = companyExtend; - - // if(!hasRight && !loading){ - // return ( - // - //
{i18n.message.authFailed()}
- //
- // ) - // } + const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey,isEditor } = companyExtend; try { return ( @@ -246,6 +238,9 @@ export default class CompanyExtend extends React.Component { > } + iconBgcolor='#217346' buttons={this.getTopButtons()} showDropIcon={true} dropMenuDatas={this.getRightMenu()} diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 560202f..e28f0fc 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-18 16:23:32 - * @LastEditTime: 2022-06-22 10:08:54 + * @LastEditTime: 2022-06-22 15:13:10 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -121,7 +121,7 @@ export default class Company extends React.Component { company } = this.props; - company.setNeDialogTitle(i18n.label.companyName()); + company.setNeDialogTitle(i18n.label.newCompany()); company.setNewVisible(true); company.getCompanyForm(); diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js index b533783..4b6de65 100644 --- a/pc4mobx/organization/components/department/department.js +++ b/pc4mobx/organization/components/department/department.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:19:37 - * @LastEditTime: 2022-06-22 10:10:28 + * @LastEditTime: 2022-06-22 16:42:37 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js */ @@ -125,7 +125,7 @@ department } = this.props; - department.setNeDialogTitle(i18n.label.deptManage()); + department.setNeDialogTitle(i18n.label.newDept()); department.setNewVisible(true); department.getDeptForm(); diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js index e54a2cb..d31b86c 100644 --- a/pc4mobx/organization/components/department/departmentExtend.js +++ b/pc4mobx/organization/components/department/departmentExtend.js @@ -1,282 +1,284 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:20:03 - * @LastEditTime: 2022-06-02 11:40:57 + * @LastEditTime: 2022-06-22 16:54:39 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js */ - import { Button, Modal, message, Row, Col, Spin } from 'antd'; - import isEmpty from 'lodash/isEmpty' - import cloneDeep from 'lodash/cloneDeep' - import forEach from 'lodash/forEach' - import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom' - import { WeaSwitch } from 'comsMobx'; - import { inject, observer } from 'mobx-react'; - import * as mobx from 'mobx'; - import { i18n } from '../../public/i18n'; - - const toJS = mobx.toJS; - import '../../style/common.less'; - - - @inject('departmentExtend') - @inject('department') - @observer - export default class DepartmentExtendStore extends React.Component { - - componentDidMount() { - this.init(); - } - init = () => { - const { departmentExtend,department } = this.props; - let {hash} = window.location; - hash = hash.split("?")[0]; - let id = hash.match("[^/]+(?=/$|$)")[0]; - departmentExtend.init(); - departmentExtend.setId(id); - departmentExtend.getData(); - } - - getTabChildren = () => { - const { departmentExtend } = this.props; - let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = departmentExtend; - let tabChildren = []; - tableInfo = toJS(tableInfo); - tableInfo && tableInfo.map((t, i) => { - if (detailSelectedKey == i) { - tabChildren.push( - departmentExtend.setPersonalEditTables(ref)} - showTitle={isEditor} - // title={'列表信息'} - //addFirstRow={isEditor} - columns={t.tabinfo.columns} - datas={t.tabinfo.datas} - onChange={this.tableEditChange} - selectedRowKeys={toJS(selectedRowKeys)} - onRowSelect={keys => onRowSelect(keys)} - onBtnsSelect={key => this.onBtnsSelect(key, i)} - viewAttr={isEditor ? 2 : 1} - getRowSelection={isEditor ? (rowSelection) => { - Object.assign(rowSelection, { - getCheckboxProps: record => ({ - disabled: record.viewAttr === 1, // 配置无法勾选的列 - }) - }) - return rowSelection; - } : () => null} - /> - ); - } - }) - return tabChildren; - } - - onBtnsSelect = (key, index) => { - const { - departmentExtend - } = this.props, { - tableInfo, - selectedRows, - setSelectedRowKeys, - selectedRowKeys - } = departmentExtend; - - const datas = tableInfo[index].tabinfo.datas; - if (key === 'copy') { - tableInfo[index].tabinfo.datas = datas.map((data, i) => { - if (!selectedRows[index].includes(i)) { - data.viewAttr = 2; - } - return data - }) - } - if (key === 'delete') { - tableInfo[index].tabinfo.datas = datas.map((data, i) => { - if (selectedRows[index].includes(i)) { - data.viewAttr = 1; - } - return data - }); - setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row))) - } - } - - getSearchs = () => { - const { departmentExtend } = this.props; - let { form, conditions, isEditor } = departmentExtend; - const { isFormInit } = form; - let group = []; - let tipPosition = 'bottom'; - window.e9HideFormFieldKeys = []; - isFormInit && conditions.forEach((c, i) => { - let items = []; - c.items.forEach((field, j) => { - if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) { - window.e9HideFormFieldKeys.push(field.domkey[0]); - } else { - items.push({ - com: ( - - ), - colSpan: 1 - }); - } - }); - group.push() - }); - return group; - } - - tableEditChange = (data) => { - const { departmentExtend } = this.props; - let { detailSelectedKey = '0', tableInfo } = departmentExtend; - tableInfo = toJS(tableInfo); - let d = cloneDeep(tableInfo); - d[Number(detailSelectedKey)].tabinfo.datas = data; - departmentExtend.updateTableInfo(d); - } - - getRightMenu = () => { - const { departmentExtend } = this.props; - const { isEditor, buttons } = departmentExtend; - let arr = []; - try { - if (buttons.hasEdit) { - if (isEditor) { - arr = [{ - icon: , - content: i18n.button.save(), - key: 'save', - onClick: key => { - this.saveEditCard(); - } - }, { - icon: , - content: i18n.button.back(), - key: 'back', - onClick: key => { - this.backCard(); - } - }] - } else { - arr = [{ - icon: , - content: i18n.button.modify(), - key: 'editCard', - onClick: key => { - this.editCard(); - } - } - ] - } - } - } catch (e) { } - return arr; - } - - getTopButtons = () => { - const { departmentExtend } = this.props; - const { isEditor, buttons } = departmentExtend; - const save = ; - const back = ; - const edit = ; - const btns = []; - try { - if (isEditor) { - if (buttons.hasSave) { - btns.push(save); - btns.push(back); - } - } else { - if (buttons.hasEdit) { - btns.push(edit); - } - } - } catch (e) { } - return btns; - } - - editCard = () => { - const { departmentExtend } = this.props; - departmentExtend.edit(); - } - - saveEditCard = () => { - const { departmentExtend } = this.props; - departmentExtend.save(); - } - - backCard = () => { - this.init(); - } - - changeData(key) { - const { - departmentExtend - } = this.props; - departmentExtend.changeData(key); - } - - render() { - const { departmentExtend } = this.props; - const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = departmentExtend; - +import { Button, Modal, message, Row, Col, Spin } from 'antd'; +import isEmpty from 'lodash/isEmpty' +import cloneDeep from 'lodash/cloneDeep' +import forEach from 'lodash/forEach' +import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab, WeaTop } from 'ecCom' +import { WeaSwitch } from 'comsMobx'; +import { inject, observer } from 'mobx-react'; +import * as mobx from 'mobx'; +import { i18n } from '../../public/i18n'; + +const toJS = mobx.toJS; +import '../../style/common.less'; + + +@inject('departmentExtend') +@inject('department') +@observer +export default class DepartmentExtendStore extends React.Component { + + componentDidMount() { + this.init(); + } + init = () => { + const { departmentExtend, department } = this.props; + let { hash } = window.location; + hash = hash.split("?")[0]; + let id = hash.match("[^/]+(?=/$|$)")[0]; + departmentExtend.init(); + departmentExtend.setId(id); + departmentExtend.getData(); + } + + getTabChildren = () => { + const { departmentExtend } = this.props; + let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys, detailSelectedKey } = departmentExtend; + let tabChildren = []; + tableInfo = toJS(tableInfo); + tableInfo && tableInfo.map((t, i) => { + if (detailSelectedKey == i) { + tabChildren.push( + departmentExtend.setPersonalEditTables(ref)} + showTitle={isEditor} + // title={'列表信息'} + //addFirstRow={isEditor} + columns={t.tabinfo.columns} + datas={t.tabinfo.datas} + onChange={this.tableEditChange} + selectedRowKeys={toJS(selectedRowKeys)} + onRowSelect={keys => onRowSelect(keys)} + onBtnsSelect={key => this.onBtnsSelect(key, i)} + viewAttr={isEditor ? 2 : 1} + getRowSelection={isEditor ? (rowSelection) => { + Object.assign(rowSelection, { + getCheckboxProps: record => ({ + disabled: record.viewAttr === 1, // 配置无法勾选的列 + }) + }) + return rowSelection; + } : () => null} + /> + ); + } + }) + return tabChildren; + } + + onBtnsSelect = (key, index) => { + const { + departmentExtend + } = this.props, { + tableInfo, + selectedRows, + setSelectedRowKeys, + selectedRowKeys + } = departmentExtend; + + const datas = tableInfo[index].tabinfo.datas; + if (key === 'copy') { + tableInfo[index].tabinfo.datas = datas.map((data, i) => { + if (!selectedRows[index].includes(i)) { + data.viewAttr = 2; + } + return data + }) + } + if (key === 'delete') { + tableInfo[index].tabinfo.datas = datas.map((data, i) => { + if (selectedRows[index].includes(i)) { + data.viewAttr = 1; + } + return data + }); + setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row))) + } + } + + getSearchs = () => { + const { departmentExtend } = this.props; + let { form, conditions, isEditor } = departmentExtend; + const { isFormInit } = form; + let group = []; + let tipPosition = 'bottom'; + window.e9HideFormFieldKeys = []; + isFormInit && conditions.forEach((c, i) => { + let items = []; + c.items.forEach((field, j) => { + if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) { + window.e9HideFormFieldKeys.push(field.domkey[0]); + } else { + items.push({ + com: ( + + ), + colSpan: 1 + }); + } + }); + group.push() + }); + return group; + } + + tableEditChange = (data) => { + const { departmentExtend } = this.props; + let { detailSelectedKey = '0', tableInfo } = departmentExtend; + tableInfo = toJS(tableInfo); + let d = cloneDeep(tableInfo); + d[Number(detailSelectedKey)].tabinfo.datas = data; + departmentExtend.updateTableInfo(d); + } + + getRightMenu = () => { + const { departmentExtend } = this.props; + const { isEditor, buttons } = departmentExtend; + let arr = []; try { - return ( -
- - - - - {this.getSearchs()} - { - !isEmpty(tabInfo) &&
- { - departmentExtend.updateDetailSelectedKey(v); - }} - /> - {this.getTabChildren()} -
- } -
-
-
- -
- ) - } catch (e) { - return -
{i18n.message.authFailed()}
-
- } - } - } - - \ No newline at end of file + if (buttons.hasEdit) { + if (isEditor) { + arr = [{ + icon: , + content: i18n.button.save(), + key: 'save', + onClick: key => { + this.saveEditCard(); + } + }, { + icon: , + content: i18n.button.back(), + key: 'back', + onClick: key => { + this.backCard(); + } + }] + } else { + arr = [{ + icon: , + content: i18n.button.modify(), + key: 'editCard', + onClick: key => { + this.editCard(); + } + } + ] + } + } + } catch (e) { } + return arr; + } + + getTopButtons = () => { + const { departmentExtend } = this.props; + const { isEditor, buttons } = departmentExtend; + const save = ; + const back = ; + const edit = ; + const btns = []; + try { + if (isEditor) { + if (buttons.hasSave) { + btns.push(save); + btns.push(back); + } + } else { + if (buttons.hasEdit) { + btns.push(edit); + } + } + } catch (e) { } + return btns; + } + + editCard = () => { + const { departmentExtend } = this.props; + departmentExtend.edit(); + } + + saveEditCard = () => { + const { departmentExtend } = this.props; + departmentExtend.save(); + } + + backCard = () => { + this.init(); + } + + changeData(key) { + const { + departmentExtend + } = this.props; + departmentExtend.changeData(key); + } + + render() { + const { departmentExtend } = this.props; + const { loading, tabkey, tabInfo, topTab, selectedKey, date, detailSelectedKey,isEditor } = departmentExtend; + + try { + return ( +
+ + } + iconBgcolor='#217346' + buttons={this.getTopButtons()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + > + + + {this.getSearchs()} + { + !isEmpty(tabInfo) &&
+ { + departmentExtend.updateDetailSelectedKey(v); + }} + /> + {this.getTabChildren()} +
+ } +
+
+
+ +
+ ) + } catch (e) { + return +
{i18n.message.authFailed()}
+
+ } + } +} + diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index 1131898..fc2b1f2 100644 --- a/pc4mobx/organization/components/job/Job.js +++ b/pc4mobx/organization/components/job/Job.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-26 14:05:59 - * @LastEditTime: 2022-06-22 10:10:58 + * @LastEditTime: 2022-06-22 16:43:08 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js */ @@ -126,7 +126,7 @@ export default class Job extends React.Component { job } = this.props; - job.setNeDialogTitle(i18n.label.jobName()); + job.setNeDialogTitle(i18n.label.newJob()); job.setNewVisible(true); job.getJobForm(); diff --git a/pc4mobx/organization/components/job/JobExtend.js b/pc4mobx/organization/components/job/JobExtend.js index ba34a54..5f900cd 100644 --- a/pc4mobx/organization/components/job/JobExtend.js +++ b/pc4mobx/organization/components/job/JobExtend.js @@ -1,289 +1,284 @@ /** * @Author: 程亮 * @Date: 2022-05-26 14:07:12 - * @LastEditTime: 2022-05-30 17:16:47 + * @LastEditTime: 2022-06-22 17:01:11 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js */ - import { Button, Modal, message, Row, Col, Spin } from 'antd'; - import isEmpty from 'lodash/isEmpty' - import cloneDeep from 'lodash/cloneDeep' - import forEach from 'lodash/forEach' - import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom' - import { WeaSwitch } from 'comsMobx'; - import { inject, observer } from 'mobx-react'; - import * as mobx from 'mobx'; - import { i18n } from '../../public/i18n'; - - const toJS = mobx.toJS; - import '../../style/common.less'; - - - @inject('jobExtend') - @inject('job') - @observer - export default class JobExtend extends React.Component { - - componentDidMount() { - this.init(); - } - init = () => { - const { jobExtend,job } = this.props; - let {hash} = window.location; - hash = hash.split("?")[0]; - let id = hash.match("[^/]+(?=/$|$)")[0]; - jobExtend.init(); - jobExtend.setId(id); - jobExtend.getData(); - } - - getTabChildren = () => { - const { jobExtend } = this.props; - let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = jobExtend; - let tabChildren = []; - tableInfo = toJS(tableInfo); - tableInfo && tableInfo.map((t, i) => { - if (detailSelectedKey == i) { - tabChildren.push( - jobExtend.setPersonalEditTables(ref)} - showTitle={isEditor} - // title={'列表信息'} - //addFirstRow={isEditor} - columns={t.tabinfo.columns} - datas={t.tabinfo.datas} - onChange={this.tableEditChange} - selectedRowKeys={toJS(selectedRowKeys)} - onRowSelect={keys => onRowSelect(keys)} - onBtnsSelect={key => this.onBtnsSelect(key, i)} - viewAttr={isEditor ? 2 : 1} - getRowSelection={isEditor ? (rowSelection) => { - Object.assign(rowSelection, { - getCheckboxProps: record => ({ - disabled: record.viewAttr === 1, // 配置无法勾选的列 - }) - }) - return rowSelection; - } : () => null} - /> - ); - } - }) - return tabChildren; - } - - onBtnsSelect = (key, index) => { - const { - jobExtend - } = this.props, { - tableInfo, - selectedRows, - setSelectedRowKeys, - selectedRowKeys - } = jobExtend; - - const datas = tableInfo[index].tabinfo.datas; - if (key === 'copy') { - tableInfo[index].tabinfo.datas = datas.map((data, i) => { - if (!selectedRows[index].includes(i)) { - data.viewAttr = 2; - } - return data - }) - } - if (key === 'delete') { - tableInfo[index].tabinfo.datas = datas.map((data, i) => { - if (selectedRows[index].includes(i)) { - data.viewAttr = 1; - } - return data - }); - setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row))) - } - } - - getSearchs = () => { - const { jobExtend } = this.props; - let { form, conditions, isEditor } = jobExtend; - const { isFormInit } = form; - let group = []; - let tipPosition = 'bottom'; - window.e9HideFormFieldKeys = []; - isFormInit && conditions.forEach((c, i) => { - let items = []; - c.items.forEach((field, j) => { - if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) { - window.e9HideFormFieldKeys.push(field.domkey[0]); - } else { - items.push({ - com: ( - - ), - colSpan: 1 - }); - } - }); - group.push() - }); - return group; - } - - tableEditChange = (data) => { - const { jobExtend } = this.props; - let { detailSelectedKey = '0', tableInfo } = jobExtend; - tableInfo = toJS(tableInfo); - let d = cloneDeep(tableInfo); - d[Number(detailSelectedKey)].tabinfo.datas = data; - jobExtend.updateTableInfo(d); - } - - getRightMenu = () => { - const { jobExtend } = this.props; - const { isEditor, buttons } = jobExtend; - let arr = []; - try { - if (buttons.hasEdit) { - if (isEditor) { - arr = [{ - icon: , - content: i18n.button.save(), - key: 'save', - onClick: key => { - this.saveEditCard(); - } - }, { - icon: , - content: i18n.button.back(), - key: 'back', - onClick: key => { - this.backCard(); - } - }] - } else { - arr = [{ - icon: , - content: i18n.button.modify(), - key: 'editCard', - onClick: key => { - this.editCard(); - } - } - ] - } - } - } catch (e) { } - return arr; - } - - getTopButtons = () => { - const { jobExtend } = this.props; - const { isEditor, buttons } = jobExtend; - const save = ; - const back = ; - const edit = ; - const btns = []; - try { - if (isEditor) { - if (buttons.hasSave) { - btns.push(save); - btns.push(back); - } - } else { - if (buttons.hasEdit) { - btns.push(edit); - } - } - } catch (e) { } - return btns; - } - - editCard = () => { - const { jobExtend } = this.props; - jobExtend.edit(); - } - - saveEditCard = () => { - const { jobExtend } = this.props; - jobExtend.save(); - } - - backCard = () => { - this.init(); - } - - changeData(key) { - const { - jobExtend - } = this.props; - jobExtend.changeData(key); - } - - render() { - const { jobExtend } = this.props; - const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = jobExtend; - - // if(!hasRight && !loading){ - // return ( - // - //
{i18n.message.authFailed()}
- //
- // ) - // } - +import { Button, Modal, message, Row, Col, Spin } from 'antd'; +import isEmpty from 'lodash/isEmpty' +import cloneDeep from 'lodash/cloneDeep' +import forEach from 'lodash/forEach' +import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab, WeaTop } from 'ecCom' +import { WeaSwitch } from 'comsMobx'; +import { inject, observer } from 'mobx-react'; +import * as mobx from 'mobx'; +import { i18n } from '../../public/i18n'; + +const toJS = mobx.toJS; +import '../../style/common.less'; + + +@inject('jobExtend') +@inject('job') +@observer +export default class JobExtend extends React.Component { + + componentDidMount() { + this.init(); + } + init = () => { + const { jobExtend, job } = this.props; + let { hash } = window.location; + hash = hash.split("?")[0]; + let id = hash.match("[^/]+(?=/$|$)")[0]; + jobExtend.init(); + jobExtend.setId(id); + jobExtend.getData(); + } + + getTabChildren = () => { + const { jobExtend } = this.props; + let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys, detailSelectedKey } = jobExtend; + let tabChildren = []; + tableInfo = toJS(tableInfo); + tableInfo && tableInfo.map((t, i) => { + if (detailSelectedKey == i) { + tabChildren.push( + jobExtend.setPersonalEditTables(ref)} + showTitle={isEditor} + // title={'列表信息'} + //addFirstRow={isEditor} + columns={t.tabinfo.columns} + datas={t.tabinfo.datas} + onChange={this.tableEditChange} + selectedRowKeys={toJS(selectedRowKeys)} + onRowSelect={keys => onRowSelect(keys)} + onBtnsSelect={key => this.onBtnsSelect(key, i)} + viewAttr={isEditor ? 2 : 1} + getRowSelection={isEditor ? (rowSelection) => { + Object.assign(rowSelection, { + getCheckboxProps: record => ({ + disabled: record.viewAttr === 1, // 配置无法勾选的列 + }) + }) + return rowSelection; + } : () => null} + /> + ); + } + }) + return tabChildren; + } + + onBtnsSelect = (key, index) => { + const { + jobExtend + } = this.props, { + tableInfo, + selectedRows, + setSelectedRowKeys, + selectedRowKeys + } = jobExtend; + + const datas = tableInfo[index].tabinfo.datas; + if (key === 'copy') { + tableInfo[index].tabinfo.datas = datas.map((data, i) => { + if (!selectedRows[index].includes(i)) { + data.viewAttr = 2; + } + return data + }) + } + if (key === 'delete') { + tableInfo[index].tabinfo.datas = datas.map((data, i) => { + if (selectedRows[index].includes(i)) { + data.viewAttr = 1; + } + return data + }); + setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row))) + } + } + + getSearchs = () => { + const { jobExtend } = this.props; + let { form, conditions, isEditor } = jobExtend; + const { isFormInit } = form; + let group = []; + let tipPosition = 'bottom'; + window.e9HideFormFieldKeys = []; + isFormInit && conditions.forEach((c, i) => { + let items = []; + c.items.forEach((field, j) => { + if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) { + window.e9HideFormFieldKeys.push(field.domkey[0]); + } else { + items.push({ + com: ( + + ), + colSpan: 1 + }); + } + }); + group.push() + }); + return group; + } + + tableEditChange = (data) => { + const { jobExtend } = this.props; + let { detailSelectedKey = '0', tableInfo } = jobExtend; + tableInfo = toJS(tableInfo); + let d = cloneDeep(tableInfo); + d[Number(detailSelectedKey)].tabinfo.datas = data; + jobExtend.updateTableInfo(d); + } + + getRightMenu = () => { + const { jobExtend } = this.props; + const { isEditor, buttons } = jobExtend; + let arr = []; try { - return ( -
- - - - - {this.getSearchs()} - { - !isEmpty(tabInfo) &&
- { - jobExtend.updateDetailSelectedKey(v); - }} - /> - {this.getTabChildren()} -
- } -
-
-
- -
- ) - } catch (e) { - return -
{i18n.message.authFailed()}
-
- } - } - } - - \ No newline at end of file + if (buttons.hasEdit) { + if (isEditor) { + arr = [{ + icon: , + content: i18n.button.save(), + key: 'save', + onClick: key => { + this.saveEditCard(); + } + }, { + icon: , + content: i18n.button.back(), + key: 'back', + onClick: key => { + this.backCard(); + } + }] + } else { + arr = [{ + icon: , + content: i18n.button.modify(), + key: 'editCard', + onClick: key => { + this.editCard(); + } + } + ] + } + } + } catch (e) { } + return arr; + } + + getTopButtons = () => { + const { jobExtend } = this.props; + const { isEditor, buttons } = jobExtend; + const save = ; + const back = ; + const edit = ; + const btns = []; + try { + if (isEditor) { + if (buttons.hasSave) { + btns.push(save); + btns.push(back); + } + } else { + if (buttons.hasEdit) { + btns.push(edit); + } + } + } catch (e) { } + return btns; + } + + editCard = () => { + const { jobExtend } = this.props; + jobExtend.edit(); + } + + saveEditCard = () => { + const { jobExtend } = this.props; + jobExtend.save(); + } + + backCard = () => { + this.init(); + } + + changeData(key) { + const { + jobExtend + } = this.props; + jobExtend.changeData(key); + } + + render() { + const { jobExtend } = this.props; + const { loading, tabkey, tabInfo, topTab, selectedKey, date, detailSelectedKey,isEditor } = jobExtend; + + + try { + return ( +
+ + } + iconBgcolor='#217346' + buttons={this.getTopButtons()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + > + + + {this.getSearchs()} + { + !isEmpty(tabInfo) &&
+ { + jobExtend.updateDetailSelectedKey(v); + }} + /> + {this.getTabChildren()} +
+ } +
+
+
+ +
+ ) + } catch (e) { + return +
{i18n.message.authFailed()}
+
+ } + } +} + diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 347501d..7237106 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -9,6 +9,8 @@ import { WeaTab, WeaFormItem, WeaRightMenu, + WeaLeftRightLayout, + WeaLeftTree } from 'ecCom' import { Row, @@ -67,10 +69,10 @@ export default class JobGrade extends React.Component { const { jobGrade } = this.props; - jobGrade.getTableInfo(); jobGrade.getHasRight(); + jobGrade.initData(); } - + getTopMenuBtns() { const { @@ -117,7 +119,7 @@ export default class JobGrade extends React.Component { jobGrade.getForm(); } - + custom = () => { const { jobGrade @@ -240,14 +242,14 @@ export default class JobGrade extends React.Component { let _this = this; columns.forEach((c, index) => { if (c.dataIndex == 'forbidden_tag') { - c.render = function(text, record) { - return _this.updateForbiddenTag(checked,record.id)} /> + c.render = function (text, record) { + return _this.updateForbiddenTag(checked, record.id)} /> } }; }) } - updateForbiddenTag(checked,id) { + updateForbiddenTag(checked, id) { const { jobGrade } = this.props; @@ -278,7 +280,7 @@ export default class JobGrade extends React.Component { const { jobGrade } = this.props; - + jobGrade.setNeDialogTitle(i18n.label.editJobGrade()); jobGrade.setGradeId(id); jobGrade.setIsNew(false); @@ -325,29 +327,29 @@ export default class JobGrade extends React.Component { isFormInit && searchCondition.map(c => { c.items.map((field, index) => { - arr.push( -
- - {} - -
- ) + arr.push( +
+ + {} + +
+ ) }) }) if (searchConditionLoading) { return ( -
+
) } else { return { - if ( e.keyCode == 13 && e.target.tagName === "INPUT") { - jobGrade.getTableInfo(); + if (e.keyCode == 13 && e.target.tagName === "INPUT") { + jobGrade.getTableInfo(); jobGrade.setPanelStatus(false) } }}>{arr} @@ -371,14 +373,32 @@ export default class JobGrade extends React.Component { jobGrade } = this.props; const { - isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date,hasRight + isPanelShow, form2, gradeName, conditionNum, tableStore, nEdialogTitle, visible, condition, + form, dialogLoading, isEdit, selectedKey, topTab, topTabCount, date, hasRight, treeConfig, treeLoading } = jobGrade; if (hasRight === false) { return renderNoright(); } + const { + data, + onSelectedTreeNode, + selectedKeys, + onExpand, + treeExpandKeys + } = toJS(treeConfig); + const treeCom = ( + + ) + return ( hasRight &&
this.handleMenuClick(e)} > - jobGrade.setPanelStatus(bool)} - hideSearchAd={() => jobGrade.setPanelStatus(false)} - searchsAd= {isPanelShow ? this.getPanelComponents() :
} - advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} - hasMask={false} - buttonsAd={this.getTabBtn()} - onSearch={() => jobGrade.getTableInfo()} - onSearchChange={val => this.onSearchChange(val)} - /> - this.reRenderColumns(c)} - onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} - /> + + jobGrade.setPanelStatus(bool)} + hideSearchAd={() => jobGrade.setPanelStatus(false)} + searchsAd={isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => jobGrade.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + this.reRenderColumns(c)} + onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} + /> +
- + ) + return ( hasRight &&
this.handleMenuClick(e)} > - jobLevel.setPanelStatus(bool)} - hideSearchAd={() => jobLevel.setPanelStatus(false)} - searchsAd={isPanelShow ? this.getPanelComponents() :
} - advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} - hasMask={false} - buttonsAd={this.getTabBtn()} - onSearch={() => jobLevel.getTableInfo()} - onSearchChange={val => this.onSearchChange(val)} - /> - this.reRenderColumns(c)} - onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} - /> + + + jobLevel.setPanelStatus(bool)} + hideSearchAd={() => jobLevel.setPanelStatus(false)} + searchsAd={isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => jobLevel.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + this.reRenderColumns(c)} + onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} + /> +
getLabel(386246, '岗位编号设置'), userNumSetting: () => getLabel(386246, '人员编号设置'), companyName: () => getLabel(385937, '分部'), + newCompany: () => getLabel(385937, '新增分部'), + viewCompany: () => getLabel(385937, '分部信息'), + updateCompany: () => getLabel(385937, '修改分部信息'), staffSchemeName: () => getLabel(385936, '编制方案'), newStaffScheme: () => getLabel(386246, '新建编制方案'), ediStaffScheme: () => getLabel(386247, '编辑编制方案'), @@ -141,12 +144,14 @@ export const i18n = { editStaff: () => getLabel(386247, '编辑编制'), changeStaff: () => getLabel(386247, '编制变更'), jobName: () => getLabel(385936, '岗位'), - newJob: () => getLabel(386246, '新建岗位'), - editJob: () => getLabel(386247, '编辑岗位'), + newJob: () => getLabel(386246, '新增岗位'), + editJobInfo: () => getLabel(386247, '修改岗位信息'), + jobInfo: () => getLabel(386247, '岗位信息'), deptManage: () => getLabel(385936, '部门管理'), - newDept: () => getLabel(386246, '新建部门'), + newDept: () => getLabel(386246, '新增部门'), mergeDept:()=> getLabel(386246, '合并部门'), transferDept:()=> getLabel(386246, '转移部门'), + editDept:()=> getLabel(386246, '修改部门信息'), typeName: () => getLabel(129927, '类型名称'), ResourceName: () => getLabel(385936, '人员'), newPeople: () => getLabel(386246, '新建人员'), diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 8079896..2e70f03 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -43,12 +43,10 @@ export class CompanyExtendStore { this.isEditor = true; this.getData(); this.getTabInfo(); - //this.tabkey = '0'; this.detailSelectedKey = '0' } init = () => { - //this.tabkey = '0'; this.detailSelectedKey = '0' this.isEditor = false; } diff --git a/pc4mobx/organization/stores/jobgrade.js b/pc4mobx/organization/stores/jobgrade.js index 5014b82..11a6e8e 100644 --- a/pc4mobx/organization/stores/jobgrade.js +++ b/pc4mobx/organization/stores/jobgrade.js @@ -48,38 +48,73 @@ export class JobGradeStore { @observable topTab = []; @observable topTabCount = {}; @observable key = '';// - @observable hasRight = ''; + @observable hasRight = true; + @observable treeLoading = true; + + @observable treeConfig = { + data: [], + selectedKeys: [], + treeExpandKeys: [], + onExpand: (keys) => { + this.treeConfig.treeExpandKeys = keys; + }, + onSelectedTreeNode: (key, count, countType) => { + this.treeConfig.selectedKeys = [key]; + this.selectedTreeNodeInfo = countType.node.props.data; + this.getTableInfo(); + } + } + //选中树节点的信息 + @observable selectedTreeNodeInfo; + + @action initData = () => { + this.selectedTreeNodeInfo = null; + this.treeConfig.treeExpandKeys.length = 0; + Api.getTree().then(res => { + if (res.code === 200) { + if (res.data.length > 0) { + this.treeConfig.data = res.data; + this.treeConfig.selectedKeys = [res.data[0].key]; + this.treeConfig.treeExpandKeys = "-1"; + this.selectedTreeNodeInfo = res.data[0]; + this.getTableInfo(); + this.setTreeLoading(false); + } + } else { + message.error(res.msg); + } + }, error => { }) + } @action getTableInfo() { - let params; + let params = { + schemeId: this.selectedTreeNodeInfo && this.selectedTreeNodeInfo.domid, + } this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { params = { - ...this.form2.getFormParams(), + ...params, gradeName: this.gradeName, - viewCondition:this.selectedKey }; } else { params = { + ...params, ...this.form2.getFormParams(), - viewCondition:this.selectedKey }; } Api.getSearchList(params).then(res => { if (res.code === 200) { this.setHasRight(res.data.hasRight); res.data.datas && this.tableStore.getDatas(res.data.datas, 1); + } else { message.warning(res.msg); } }, error => { message.warning(error.msg); }) - //获取tab信息(去除) - //this.getTabInfo(); - } @action @@ -384,4 +419,8 @@ export class JobGradeStore { this.hasRight = bool; } + setTreeLoading(bool) { + this.treeLoading = bool; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js index 8a2e8e2..350389d 100644 --- a/pc4mobx/organization/stores/joblevel.js +++ b/pc4mobx/organization/stores/joblevel.js @@ -48,25 +48,59 @@ export class JobLevelStore { @observable topTab = []; @observable topTabCount = {}; @observable hasRight = ''; + @observable treeLoading = true; + @observable treeConfig = { + data: [], + selectedKeys: [], + treeExpandKeys: [], + onExpand: (keys) => { + this.treeConfig.treeExpandKeys = keys; + }, + onSelectedTreeNode: (key, count, countType) => { + this.treeConfig.selectedKeys = [key]; + this.selectedTreeNodeInfo = countType.node.props.data; + this.getTableInfo(); + } + } + //选中树节点的信息 + @observable selectedTreeNodeInfo; + + @action initData = () => { + this.selectedTreeNodeInfo = null; + this.treeConfig.treeExpandKeys.length = 0; + Api.getTree().then(res => { + if (res.code === 200) { + if (res.data.length > 0) { + this.treeConfig.data = res.data; + this.treeConfig.selectedKeys = [res.data[0].key]; + this.treeConfig.treeExpandKeys = "-1"; + this.selectedTreeNodeInfo = res.data[0]; + this.getTableInfo(); + this.setTreeLoading(false); + } + } else { + message.error(res.msg); + } + }, error => { }) + } @action getTableInfo() { - let params; - //获取tab信息 - // this.getTabInfo(); + let params = { + schemeId: this.selectedTreeNodeInfo && this.selectedTreeNodeInfo.domid, + } this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { params = { - ...this.form2.getFormParams(), + ...params, levelName: this.levelName, - viewCondition:this.selectedKey }; } else { params = { + ...params, ...this.form2.getFormParams(), - viewCondition:this.selectedKey }; } Api.getSearchList(params).then(res => { @@ -79,7 +113,7 @@ export class JobLevelStore { }, error => { message.warning(error.msg); }) - + } //删除 @@ -225,7 +259,7 @@ export class JobLevelStore { @action - getHasRight() { + getHasRight() { Api.getHasRight().then(res => { if (res.code === 200) { res.data.rightMenu && this.setRightMenu(res.data.rightMenu); @@ -344,4 +378,8 @@ export class JobLevelStore { this.hasRight = bool; } + setTreeLoading(bool) { + this.treeLoading = bool; + } + } \ No newline at end of file