From 39e60335ec9051d1752ff03baf8b3b893c4bb3d2 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 11 Jul 2022 10:06:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/components/Home.js | 2 +- .../components/NewAndEditDialog.js | 18 +- .../components/department/department.js | 1239 +++++++++-------- 3 files changed, 631 insertions(+), 628 deletions(-) diff --git a/pc4mobx/organization/components/Home.js b/pc4mobx/organization/components/Home.js index 5cc0369..9e68164 100644 --- a/pc4mobx/organization/components/Home.js +++ b/pc4mobx/organization/components/Home.js @@ -65,7 +65,7 @@ class Home extends React.Component { //const isSingle = window.location.pathname.indexOf('/spa/hrm/engine') > -1; return (
- + {/* */} diff --git a/pc4mobx/organization/components/NewAndEditDialog.js b/pc4mobx/organization/components/NewAndEditDialog.js index 1c3705c..6e65d79 100644 --- a/pc4mobx/organization/components/NewAndEditDialog.js +++ b/pc4mobx/organization/components/NewAndEditDialog.js @@ -4,6 +4,7 @@ import { WeaNewScroll, WeaSearchGroup, WeaMoreButton, + WeaPopoverHrm } from 'ecCom' import { @@ -26,7 +27,7 @@ export default class NewAndEditDialog extends React.Component { width: 700, } } - + getForm() { const { @@ -56,16 +57,16 @@ export default class NewAndEditDialog extends React.Component { bindChangeEnvent, moduleName } = this.props; - if(moduleName == 'jobGrade' && data.schemeId) { + if (moduleName == 'jobGrade' && data.schemeId) { bindChangeEnvent(data.schemeId.value); } - if(moduleName == 'staffScheme' && data.planYear){ + if (moduleName == 'staffScheme' && data.planYear) { bindChangeEnvent(data.planYear.value); } - if(moduleName == 'department' && data.parent_comp ){ + if (moduleName == 'department' && data.parent_comp) { bindChangeEnvent(data.parent_comp.value); } - if(moduleName == 'job' && (data.sequence_id || data.level_id)){ + if (moduleName == 'job' && (data.sequence_id || data.level_id)) { bindChangeEnvent(data); } }; @@ -149,10 +150,9 @@ export default class NewAndEditDialog extends React.Component { loading ?
- :
1 ? '' : 'hrm-dialog-form'}> - {conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()} -
- } + : this.getSearchGroupForm()} + + ) } diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js index dd66750..df668ac 100644 --- a/pc4mobx/organization/components/department/department.js +++ b/pc4mobx/organization/components/department/department.js @@ -1,151 +1,153 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:19:37 - * @LastEditTime: 2022-07-06 10:48:46 + * @LastEditTime: 2022-07-08 16:50:58 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js */ - import React from 'react' - import * as mobx from 'mobx' - import { - inject, - observer, - } from 'mobx-react' - import { - WeaTop, - WeaTab, - WeaFormItem, - WeaRightMenu, - WeaTable, - WeaLeftRightLayout, - WeaOrgTree - } from 'ecCom' - import { - Row, - Col, - Spin, - Modal, - Button, - message, - Switch, - Menu, Dropdown, Icon - } from 'antd' - import { - WeaSwitch, - WeaTableNew - } from 'comsMobx' - import { - i18n - } from '../../public/i18n'; - - import '../../style/common.less'; - import { renderNoright } from '../../util'; - - import NewAndEditDialog from '../NewAndEditDialog'; - import NewTableDialog from '../NewTableDialog'; - import NewPopconfirm from './NewPopconfirm' - - const toJS = mobx.toJS; - const confirm = Modal.confirm; - - - @inject('department') - @observer - export default class Department extends React.Component { - constructor(props) { - super(props); - } - - componentWillMount() { - } - - componentDidMount() { - this.init(); - } - - componentWillReceiveProps(nextProps) { - const { - department - } = this.props; - - if (this.props.location.key !== nextProps.location.key) { - this.init(); - } - } - - init() { - const { - department - } = this.props; - department.getTableInfo(); - department.getHasRight(); - department.getCopyForm(); - } - - getTopMenuBtns() { - const { - department - } = this.props; - const { - topMenu, - selectedRowKeys - } = department; - - let btns = []; - topMenu.map((item, i) => { - if (item.menuFun === 'batchDelete') { - btns.push(); - } else if (item.menuFun === 'copy') { - btns.push(); - } else { - btns.push(); - - } - - }); - - return btns; - } - - handleClick(item) { - const { - department - } = this.props; - const { - isPanelShow - } = department; - - isPanelShow && department.setPanelStatus(false); - this[item.menuFun] && this[item.menuFun](); - } - - new() { - const { - department - } = this.props; - - department.setNeDialogTitle(i18n.label.newDept()); - department.setNewVisible(true); - department.getDeptForm(); - - } - - //联查岗位 - select(id) { - const { - department - } = this.props; - - department.setNeDialogTitle("联查岗位"); - department.setVisible(true); - department.setDialogLoadingStatus(true); - department.getPostionTable(id); - } +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer, +} from 'mobx-react' +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, + WeaTable, + WeaLeftRightLayout, + WeaOrgTree, + WeaDialog, + WeaPopoverHrm +} from 'ecCom' +import { + Row, + Col, + Spin, + Modal, + Button, + message, + Switch, + Menu, Dropdown, Icon +} from 'antd' +import { + WeaSwitch, + WeaTableNew +} from 'comsMobx' +import { + i18n +} from '../../public/i18n'; + +import '../../style/common.less'; +import { renderNoright } from '../../util'; + +import NewAndEditDialog from '../NewAndEditDialog'; +import NewTableDialog from '../NewTableDialog'; +import NewPopconfirm from './NewPopconfirm' + +const toJS = mobx.toJS; +const confirm = Modal.confirm; - //合并 - merge(id){ +@inject('department') +@observer +export default class Department extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + department + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + department + } = this.props; + department.getTableInfo(); + department.getHasRight(); + department.getCopyForm(); + } + + getTopMenuBtns() { + const { + department + } = this.props; + const { + topMenu, + selectedRowKeys + } = department; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun === 'batchDelete') { + btns.push(); + } else if (item.menuFun === 'copy') { + btns.push(); + } else { + btns.push(); + + } + + }); + + return btns; + } + + handleClick(item) { + const { + department + } = this.props; + const { + isPanelShow + } = department; + + isPanelShow && department.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + department + } = this.props; + + department.setNeDialogTitle(i18n.label.newDept()); + department.setNewVisible(true); + department.getDeptForm(); + + } + + //联查岗位 + select(id) { + const { + department + } = this.props; + + department.setNeDialogTitle("联查岗位"); + department.setVisible(true); + department.setDialogLoadingStatus(true); + department.getPostionTable(id); + } + + + //合并 + merge(id) { const { department } = this.props; @@ -155,10 +157,10 @@ department.setIds(id); department.setIsMerge(true); department.getMergeForm(id); - } + } - //转移 - transfer(id) { + //转移 + transfer(id) { const { department } = this.props; @@ -168,63 +170,63 @@ department.setIsMerge(false); department.getTransferForm(id); - } + } - //查看 - view(id) { + //查看 + view(id) { window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${id}`, "_blank") } - - copy() { - const { - department - } = this.props; - const { - selectedRowKeys - } = department; - let keys = toJS(selectedRowKeys).toString(); - department.setIds(keys); - confirm({ - title: i18n.confirm.defaultTitle(), - content: this.getCopyForm(), - okText: i18n.button.ok(), - cancelText: i18n.button.cancel(), - onOk() { - department.copy() - }, - onCancel() { - return false; - }, - }); - } - - getCopyForm() { - const { - department - } = this.props; - const { - copyCondition, - form2, - } = department; - let formParams = form2.getFormParams(); - const { - isFormInit - } = form2; - let arr = []; - isFormInit && copyCondition.map(c => { - c.items.map((field, index) => { - arr.push( - - {} - - ) - }) - }) - return arr; - } + + copy() { + const { + department + } = this.props; + const { + selectedRowKeys + } = department; + let keys = toJS(selectedRowKeys).toString(); + department.setIds(keys); + confirm({ + title: i18n.confirm.defaultTitle(), + content: this.getCopyForm(), + okText: i18n.button.ok(), + cancelText: i18n.button.cancel(), + onOk() { + department.copy() + }, + onCancel() { + return false; + }, + }); + } + + getCopyForm() { + const { + department + } = this.props; + const { + copyCondition, + form2, + } = department; + let formParams = form2.getFormParams(); + const { + isFormInit + } = form2; + let arr = []; + isFormInit && copyCondition.map(c => { + c.items.map((field, index) => { + arr.push( + + {} + + ) + }) + }) + return arr; + } log = () => { @@ -233,81 +235,81 @@ keys: new Date().getTime(), }); } - - batchDelete() { - const { - department - } = this.props; - const { - selectedRowKeys - } = department; - let keys = toJS(selectedRowKeys).toString(); - department.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 { - department - } = this.props; - department.delete(); - } - - - getDropMenuDatas() { - const { - department - } = this.props; - const { - rightMenu - } = department; - - 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 { - department - } = this.props; - const { - isPanelShow - } = department; - - isPanelShow && department.setPanelStatus(false); - this[key] && this[key](); - } - - updateForbiddenTag(checked, id) { - const { - department - } = this.props; - confirm({ + + batchDelete() { + const { + department + } = this.props; + const { + selectedRowKeys + } = department; + let keys = toJS(selectedRowKeys).toString(); + department.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 { + department + } = this.props; + department.delete(); + } + + + getDropMenuDatas() { + const { + department + } = this.props; + const { + rightMenu + } = department; + + 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 { + department + } = this.props; + const { + isPanelShow + } = department; + + isPanelShow && department.setPanelStatus(false); + this[key] && this[key](); + } + + updateForbiddenTag(checked, id) { + const { + department + } = this.props; + confirm({ title: i18n.confirm.defaultTitle(), content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(), okText: i18n.button.ok(), @@ -319,340 +321,340 @@ return false; }, }); - } - - - - onSearchChange(val) { - const { - department - } = this.props; - const { - form - } = department; - - department.setDepartmentName(val); - !this.isEmptyObject(form.getFormParams()) && department.updateFields(val); - } - - - reRenderColumns(columns) { - const { - department - } = this.props; - let _this = this; - columns.forEach((c, index) => { - if (c.dataIndex == 'forbiddenTag') { - c.render = function (text, record) { - return _this.updateForbiddenTag(checked, record.id)} /> - } - }; - if (c.dataIndex == 'deptName') { - c.render = function (text, record) { - return { - window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${record.id}`, "_blank") - }}>{text} - } - } - if (c.dataIndex == 'operate') { - c.className = "wea-table-operates" - c.width = 80 - c.render = function (text, record) { - const menu = ( - + } + + + + onSearchChange(val) { + const { + department + } = this.props; + const { + form + } = department; + + department.setDepartmentName(val); + !this.isEmptyObject(form.getFormParams()) && department.updateFields(val); + } + + + reRenderColumns(columns) { + const { + department + } = this.props; + let _this = this; + columns.forEach((c, index) => { + if (c.dataIndex == 'forbiddenTag') { + c.render = function (text, record) { + return _this.updateForbiddenTag(checked, record.id)} /> + } + }; + if (c.dataIndex == 'deptName') { + c.render = function (text, record) { + return { + window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${record.id}`, "_blank") + }}>{text} + } + } + if (c.dataIndex == 'operate') { + c.className = "wea-table-operates" + c.width = 80 + c.render = function (text, record) { + const menu = ( + { _this.view(record.id) }}>查看 - + { _this.doDel(record.id) }}>删除 - - { _this.merge(record.id) }}>合并 - - - { _this.transfer(record.id) }}>转移 - - - { _this.select(record.id) }}>联查岗位 - - - ) - return - - - } - } - }) - return columns; - } - - - doDel(id) { - const { - department - } = this.props; - department.setIds(id); - this.showConfirm('del'); - } - - - handleSave() { - const { - department - } = this.props; - department.setSaveAndSetting(false); - department.save(); - } + + { _this.merge(record.id) }}>合并 + + + { _this.transfer(record.id) }}>转移 + + + { _this.select(record.id) }}>联查岗位 + + + ) + return + + + } + } + }) + return columns; + } - handleSaveAndSetting() { + + doDel(id) { + const { + department + } = this.props; + department.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + const { + department + } = this.props; + department.setSaveAndSetting(false); + department.save(); + } + + handleSaveAndSetting() { const { department } = this.props; department.setSaveAndSetting(true); department.save(); - } + } - PopconfirmSave() { + PopconfirmSave() { const { department } = this.props; - const {isMerge} = department; + const { isMerge } = department; isMerge && department.merge(); !isMerge && department.transfer(); - } - - getTabBtn() { - const { - department - } = this.props; - const { - form - } = department; - - const btn = [ - (), - (), - (), - ]; - - return btn; - } - - getPanelComponents() { - const { - department - } = this.props; - const { - searchCondition, - form, - searchConditionLoading - } = department; - - let arr = []; - let formParams = form.getFormParams(); - const { - isFormInit - } = form; - - isFormInit && searchCondition.map(c => { - c.items.map((field, index) => { - arr.push( -
- - {} - -
- ) - }) - }) - - if (searchConditionLoading) { - return ( -
- -
- ) - } else { - return { - if (e.keyCode == 13 && e.target.tagName === "INPUT") { - department.getTableInfo(); - department.setPanelStatus(false) - } - }}>{arr} - } - - } - - //非空判断 - isEmptyObject(obj) { - for (let key in obj) { - return false; - } - return true; - } - - //左侧树 - getTree = () => { - const { - department - } = this.props; - const { - companysId, - } = department - - let tree = ( - ${i18n.label.organization()}`} - treeNodeClick={this.treeNodeClick} - expandAllChildrenOnSearch={true} - /> - ) - - return tree; - } - - treeNodeClick = (event, ids, nodeids, nodes) => { - const { - department - } = this.props; - const { - form, - companysId - } = department; - const type = event.node.props.type || '0'; - const id = event.node.props.id || ''; - let params = {}; - form.resetConditionValue(); - department.setPanelStatus(false) - // department.tabkey = 'default_3'; - department.nodeType = type; - if (type == '0') { - params['virtualtype'] = companysId; - } - if (type == '1') { - params['subcompanyid1'] = id; - } - if (type == '2') { - params['departmentid'] = id; - } - department.doSearch(params); - } - - - - render() { - - const { - department - } = this.props; - const { - isPanelShow, departmentName, conditionNum, visible, condition, form, - tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, - form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init, - defaultShowLeft,confirmVisible,confirmLoading,postionDataSource,postionColumns,isMerge,hasRight - } = department; + } - if (hasRight === false) { + getTabBtn() { + const { + department + } = this.props; + const { + form + } = department; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + getPanelComponents() { + const { + department + } = this.props; + const { + searchCondition, + form, + searchConditionLoading + } = department; + + let arr = []; + let formParams = form.getFormParams(); + const { + isFormInit + } = form; + + isFormInit && searchCondition.map(c => { + c.items.map((field, index) => { + arr.push( +
+ + {} + +
+ ) + }) + }) + + if (searchConditionLoading) { + return ( +
+ +
+ ) + } else { + return { + if (e.keyCode == 13 && e.target.tagName === "INPUT") { + department.getTableInfo(); + department.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + //左侧树 + getTree = () => { + const { + department + } = this.props; + const { + companysId, + } = department + + let tree = ( + ${i18n.label.organization()}`} + treeNodeClick={this.treeNodeClick} + expandAllChildrenOnSearch={true} + /> + ) + + return tree; + } + + treeNodeClick = (event, ids, nodeids, nodes) => { + const { + department + } = this.props; + const { + form, + companysId + } = department; + const type = event.node.props.type || '0'; + const id = event.node.props.id || ''; + let params = {}; + form.resetConditionValue(); + department.setPanelStatus(false) + // department.tabkey = 'default_3'; + department.nodeType = type; + if (type == '0') { + params['virtualtype'] = companysId; + } + if (type == '1') { + params['subcompanyid1'] = id; + } + if (type == '2') { + params['departmentid'] = id; + } + department.doSearch(params); + } + + + + render() { + + const { + department + } = this.props; + const { + isPanelShow, departmentName, conditionNum, visible, condition, form, + tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, + form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init, + defaultShowLeft, confirmVisible, confirmLoading, postionDataSource, postionColumns, isMerge, hasRight + } = department; + + if (hasRight === false) { return renderNoright(); - } - - const rowSelection = { - selectedRowKeys:selectedRowKeys, - type:"checkbox", - onChange(selectedRowKeys, selectedRows) { - department.setSelectedRowKeys(selectedRowKeys); - }, - getCheckboxProps: record => ({ - disabled: record.isUsed === 1, // 配置无法勾选的列 - }), - }; - - const pagination = { - current: current, - pageSize: pageSize, - total: total, - showSizeChanger: true, - showQuickJumper: true, - onShowSizeChange(current, pageSize) { - }, - onChange(current) { - }, - showTotal(total) { - return `共 ${total} 条` - } - }; - - - return ( + } + + const rowSelection = { + selectedRowKeys: selectedRowKeys, + type: "checkbox", + onChange(selectedRowKeys, selectedRows) { + department.setSelectedRowKeys(selectedRowKeys); + }, + getCheckboxProps: record => ({ + disabled: record.isUsed === 1, // 配置无法勾选的列 + }), + }; + + const pagination = { + current: current, + pageSize: pageSize, + total: total, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + }, + onChange(current) { + }, + showTotal(total) { + return `共 ${total} 条` + } + }; + + + return ( hasRight &&
- this.handleMenuClick(key)} - > - } - iconBgcolor='#217346' - loading={true} - buttons={this.getTopMenuBtns()} - showDropIcon={true} - dropMenuDatas={this.getDropMenuDatas()} - onDropMenuClick={(e) => this.handleMenuClick(e)} - > - - department.setPanelStatus(bool)} - hideSearchAd={() => department.setPanelStatus(false)} - searchsAd={isPanelShow ? this.getPanelComponents() :
} - advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} - hasMask={false} - buttonsAd={this.getTabBtn()} - onSearch={() => { - department.setCurrent(1); - department.setPageSize(10); - department.getTableInfo() - }} - onSearchChange={val => this.onSearchChange(val)} - /> - { - init ?
- -
: - record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`} - loading={loading} - dataSource={dataSource} childrenColumnName="children" - columns={this.reRenderColumns(columns)} - rowSelection={rowSelection} - pagination={pagination} - onChange={(pagination, filters, sorter) => { - department.setSortParams(sorter); - department.setCurrent(pagination.current); - department.setPageSize(pagination.pageSize); - department.getTableInfo(); - }} - indentSize={15} - /> - } -
-
-
- this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + + department.setPanelStatus(bool)} + hideSearchAd={() => department.setPanelStatus(false)} + searchsAd={isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => { + department.setCurrent(1); + department.setPageSize(10); + department.getTableInfo() + }} + onSearchChange={val => this.onSearchChange(val)} + /> + { + init ?
+ +
: + record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`} + loading={loading} + dataSource={dataSource} childrenColumnName="children" + columns={this.reRenderColumns(columns)} + rowSelection={rowSelection} + pagination={pagination} + onChange={(pagination, filters, sorter) => { + department.setSortParams(sorter); + department.setCurrent(pagination.current); + department.setPageSize(pagination.pageSize); + department.getTableInfo(); + }} + indentSize={15} + /> + } +
+
+ + department.setVisible(false)} /> - this.handleSave()} - onCancel={() => department.setNewVisible(false)} - saveAndSetting = {() => this.handleSaveAndSetting()} - moduleName={"department"} - bindChangeEnvent={val => department.updateConditions(val)} - /> - this.PopconfirmSave()} - onCancel={() => department.setConfirmVisible(false)} - /> -
- ) - } - } \ No newline at end of file + this.handleSave()} + onCancel={() => department.setNewVisible(false)} + saveAndSetting={() => this.handleSaveAndSetting()} + moduleName={"department"} + bindChangeEnvent={val => department.updateConditions(val)} + > + + this.PopconfirmSave()} + onCancel={() => department.setConfirmVisible(false)} + /> +
+ ) + } +} \ No newline at end of file