diff --git a/pc4mobx/organization/apis/common.js b/pc4mobx/organization/apis/common.js new file mode 100644 index 0000000..34af337 --- /dev/null +++ b/pc4mobx/organization/apis/common.js @@ -0,0 +1,25 @@ +import { + WeaTools +} from 'ecCom' + +/** + * 获取权限 + * @param {[type]} moduleName [模块名] + * @param {Object} params [description] + * @return {[type]} [description] + */ +export const authorized = (moduleName, params = {}, apiMethod = 'getHasRight') => WeaTools.callApi(`/api/hrm/${moduleName}/${apiMethod}`, 'POST', params); + +/** + * 应用分权 + */ +export const detachable = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachable', 'GET', params); +export const getDetachableAll = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachableAll', 'GET', params); + +export const checkAuthAndDetach = (moduleName, params = {}, apiMethod = 'getHasRight') => Promise.all([authorized(moduleName, params = {}, apiMethod || 'getHasRight'), detachable()]) + +export const exportExcel = (params = {}) => WeaTools.callApi('/api/ec/dev/table/export', 'POST', params) + +export const isEnableMultiLang = (params = {}) => WeaTools.callApi('/api/hrm/common/isEnableMultiLang', 'GET', params) + +export const getPinYin = (params = {}) => WeaTools.callApi('/api/workflow/formSetting/fieldSet/getPinYin', 'POST', params) \ No newline at end of file diff --git a/pc4mobx/organization/apis/job.js b/pc4mobx/organization/apis/job.js new file mode 100644 index 0000000..6fb261f --- /dev/null +++ b/pc4mobx/organization/apis/job.js @@ -0,0 +1,91 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + //return WeaTools.callApi('/api/bs/hrmorganization/comp/listComp', 'POST', params); + return fetch('/api/bs/hrmorganization/comp/listComp', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getDeptListByPid = (params) => { + return fetch('/api/bs/hrmorganization/dept/getDeptListByPid', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/comp/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/comp/saveBaseComp', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const editResource = (params) => { + // return fetch('/api/bs/hrmorganization/comp/updateComp', { + // method: 'POST', + // mode: 'cors', + // headers: { + // 'Content-Type': 'application/json' + // }, + // body: JSON.stringify(params) + // }) + return WeaTools.callApi('/api/bs/hrmorganization/comp/updateComp', 'POST', params); +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getCompanyForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params); +} + + +export const getCompanyExtendForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params); +} + + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/apis/staff.js b/pc4mobx/organization/apis/staff.js new file mode 100644 index 0000000..adc688e --- /dev/null +++ b/pc4mobx/organization/apis/staff.js @@ -0,0 +1,53 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/staff/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/staff/saveStaff', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/staff/updateStaff', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staff/getForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staff/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/apis/staffscheme.js b/pc4mobx/organization/apis/staffscheme.js new file mode 100644 index 0000000..4b866ba --- /dev/null +++ b/pc4mobx/organization/apis/staffscheme.js @@ -0,0 +1,64 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/staffplan/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getSchemeForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/Home.js b/pc4mobx/organization/components/Home.js new file mode 100644 index 0000000..244ed50 --- /dev/null +++ b/pc4mobx/organization/components/Home.js @@ -0,0 +1,78 @@ +import { + WeaPopoverHrm, + WeaLocaleProvider +} from 'ecCom'; +import { + WeaLogView +} from 'comsMobx'; +import { + isEnableMultiLang +} from '../apis/common'; +const WeaLogViewComp = WeaLogView.Component; +const { + LogStore +} = WeaLogView; + +class Home extends React.Component { + constructor(props) { + super(props); + this.state = { + key: new Date().getTime(), + visible: false, + logStore: new LogStore(), + logType: '4', + logSmallType: '' + } + window.setLogViewProps = this.setLogViewProps; + } + + componentDidMount(){ + isEnableMultiLang().then(data => { + window.inputType = { + inputType: 'NORMAL' + } + if (data.status === '1') { + if (data.isEnableMultiLang) { + window.inputType = { + inputType: 'MULTILANG', + isBase64: true + } + } + } + }, error => { + window.inputType = { + inputType: 'NORMAL' + } + }); + } + + setLogViewProps = (props) => { + this.setState({ + key: new Date().getTime(), + targetId: '', + visible: true, + logType: '4', + logStore: new LogStore(), + ...props + }); + } + onCancel = () => { + this.setState({ + visible: false + }) + } + render() { + //const isSingle = window.location.pathname.indexOf('/spa/hrm/engine') > -1; + return ( +
+ + + + {this.props.children} + +
+ ) + } +} + +export default Home \ No newline at end of file diff --git a/pc4mobx/organization/components/NewTableDialog.js b/pc4mobx/organization/components/NewTableDialog.js index ff7f1da..992150b 100644 --- a/pc4mobx/organization/components/NewTableDialog.js +++ b/pc4mobx/organization/components/NewTableDialog.js @@ -43,6 +43,19 @@ export default class NewTableDialog extends React.Component { width, } = this.state; + const pagination = { + total: dataSource.length, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + }, + onChange(current) { + }, + showTotal(total) { + return `共 ${total} 条` + } + }; + const buttons = [ //(), () @@ -60,13 +73,18 @@ export default class NewTableDialog extends React.Component { buttons={buttons} style={{ width: width, height: height }} > - record.id} - dataSource={dataSource} childrenColumnName="children" - columns={columns} - indentSize={15} - loading={loading} - defaultExpandedRowKeys={[1, 2]} - /> + { + loading ?
+ +
: record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + loading={loading} + pagination={pagination} + indentSize={15} + /> + } + ) } diff --git a/pc4mobx/organization/components/NewWeaTable.js b/pc4mobx/organization/components/NewWeaTable.js new file mode 100644 index 0000000..f0d651c --- /dev/null +++ b/pc4mobx/organization/components/NewWeaTable.js @@ -0,0 +1,69 @@ +import { + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, + WeaTable +} from 'ecCom' + +import { + Spin, + Button, + Pagination +} from 'antd' + +import { + WeaSwitch +} from 'comsMobx' + +import { + i18n +} from '../public/i18n'; + +import '../style/common.less'; + + +export default class NewWeaTable extends React.Component { + constructor(props) { + super(props); + } + + + + render() { + const { + dataSource, + columns, + rowSelection, + loading, + indentSize + } = this.props + + const pagination = { + total: dataSource.length, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + }, + onChange(current) { + }, + showTotal(total){ + return `共 ${total} 条` + } + }; + + + return ( + loading ?
+ +
: + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + rowSelection={rowSelection} + pagination={pagination} + loading={loading} + indentSize={indentSize} + /> + ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index 5ce6162..b766975 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -1,3 +1,10 @@ +/** + * @Author: 程亮 + * @Date: 2022-05-18 14:52:39 + * @LastEditTime: 2022-05-26 17:11:02 + * @Description: + * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js + */ import { Button, Modal, message, Row, Col, Spin } from 'antd'; import isEmpty from 'lodash/isEmpty' import cloneDeep from 'lodash/cloneDeep' @@ -231,7 +238,7 @@ export default class CompanyExtend extends React.Component { // ) // } - // try { + try { return (
) - // } catch (e) { - // return - //
{i18n.message.authFailed()}
- //
- // } + } catch (e) { + return +
{i18n.message.authFailed()}
+
+ } } } diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index d3ac210..1f9df79 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-05-23 16:55:22 + * @LastEditTime: 2022-05-26 09:12:59 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -39,6 +39,7 @@ import '../../style/common.less'; import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; +import NewWeaTable from '../NewWeaTable'; import { renderLoading } from '../../util'; // 从util文件引入公共的方法 @@ -133,8 +134,8 @@ export default class Company extends React.Component { company.setNeDialogTitle(i18n.label.companyName()); company.setVisible(true); + company.setDialogLoadingStatus(true); company.getDeptTable(id); - company.setDialogLoadingStatus(false); } batchDelete() { @@ -285,7 +286,7 @@ export default class Company extends React.Component { } = company; const btn = [ - (), + (), (), (), ]; @@ -359,10 +360,9 @@ export default class Company extends React.Component { const { isPanelShow, companyName, conditionNum, visible, condition, form, tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, - form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total + form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total,current,pageSize,init } = company; - const rowSelection = { onChange(selectedRowKeys, selectedRows) { company.setSelectedRowKeys(selectedRowKeys); @@ -370,16 +370,18 @@ export default class Company extends React.Component { }; const pagination = { + current:current, + pageSize:pageSize, total: total, showSizeChanger: true, showQuickJumper: true, onShowSizeChange(current, pageSize) { - // company.setCurrent(current); - // company.setPageSize(pageSize); }, onChange(current) { - //company.setCurrent(current); }, + showTotal(total){ + return `共 ${total} 条` + } }; @@ -409,14 +411,19 @@ export default class Company extends React.Component { advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} hasMask={false} buttonsAd={this.getTabBtn()} - onSearch={() => company.getTableInfo()} + onSearch={() => { + company.setCurrent(1); + company.setPageSize(10); + company.getTableInfo() + }} onSearchChange={val => this.onSearchChange(val)} /> { - loading ?
- + init ?
+
: - record.id} + record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`} + loading={loading} dataSource={dataSource} childrenColumnName="children" columns={this.reRenderColumns(columns)} rowSelection={rowSelection} @@ -428,6 +435,14 @@ export default class Company extends React.Component { }} indentSize={15} /> + // } diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js new file mode 100644 index 0000000..306ece3 --- /dev/null +++ b/pc4mobx/organization/components/job/Job.js @@ -0,0 +1,531 @@ +/** + * @Author: 程亮 + * @Date: 2022-05-26 14:05:59 + * @LastEditTime: 2022-05-26 16:42:44 + * @Description: + * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js + */ +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer, +} from 'mobx-react' +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, + WeaTable, + WeaLeftRightLayout, +} 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 NewTableDialog from '../NewTableDialog'; +import NewAndEditDialog from '../NewAndEditDialog'; +import NewWeaTable from '../NewWeaTable'; +import { renderLoading } from '../../util'; // 从util文件引入公共的方法 + + + +const toJS = mobx.toJS; +const confirm = Modal.confirm; +//const WeaTable = WeaTableNew.WeaTable + + +@inject('job') +@observer +export default class Job extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + job + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + job + } = this.props; + job.getTableInfo(); + job.getHasRight(); + } + + getTopMenuBtns() { + const { + job + } = this.props; + const { + topMenu, + selectedRowKeys + } = job; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun !== 'batchDelete') { + btns.push(); + } else { + btns.push(); + } + + }); + + return btns; + } + + handleClick(item) { + const { + job + } = this.props; + const { + isPanelShow + } = job; + + isPanelShow && job.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + job + } = this.props; + + job.setNeDialogTitle(i18n.label.jobName()); + job.setNewVisible(true); + job.getCompanyForm(); + + } + + //联查部门 + select(id) { + const { + job + } = this.props; + + job.setNeDialogTitle(i18n.label.jobName()); + job.setVisible(true); + job.setDialogLoadingStatus(true); + job.getDeptTable(id); + } + + batchDelete() { + const { + job + } = this.props; + const { + selectedRowKeys + } = job; + let keys = toJS(selectedRowKeys).toString(); + job.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 { + job + } = this.props; + job.delete(); + } + + + getDropMenuDatas() { + const { + job + } = this.props; + const { + rightMenu + } = job; + + 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 { + job + } = this.props; + const { + isPanelShow + } = job; + + isPanelShow && job.setPanelStatus(false); + this[key] && this[key](); + } + + + + onSearchChange(val) { + const { + job + } = this.props; + const { + form + } = job; + + job.setCompanyName(val); + !this.isEmptyObject(form.getFormParams()) && job.updateFields(val); + } + + + reRenderColumns(columns) { + const { + job + } = 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 == 'compName') { + c.render = function (text, record) { + return { + window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") + }}>{text} + } + } + if (c.dataIndex == 'operate') { + c.render = function (text, record) { + return + { _this.doDel(record.id) }}>删除 + + { _this.select(record.id) }}>联查部门 + + } + } + + }) + return columns; + } + + updateForbiddenTag(checked, id) { + const { + job + } = this.props; + job.updateForbiddenTag(checked, id); + } + + doDel(id) { + const { + job + } = this.props; + job.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + const { + job + } = this.props; + job.save(); + } + + getTabBtn() { + const { + job + } = this.props; + const { + form + } = job; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + getPanelComponents() { + const { + job + } = this.props; + const { + searchCondition, + form, + searchConditionLoading + } = job; + + 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") { + job.getTableInfo(); + job.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + //左侧树 + getTree = () => { + // const { + // hrmAddressBook + // } = this.props; + // const { + // companysId, + // hrmAddressBookPlus: plusStore + // } = hrmAddressBook, { + // leftTabDatas, + // leftTab, + // ORGTREE, + // } = plusStore; + + // Object.assign(ORGTREE,{ + // expandAllChildrenOnSearch:true + // }); + + // let tree; + // if (leftTab.selectedKey === '0') { + // tree = ( + // ${i18n.label.organization()} + // ) + // } else { + // tree = ; + // } + // const leftCom = ( + //
+ // + //
+ // { + // tree + // } + //
+ //
+ // ) + return
; + } + + + + render() { + + const { + job + } = this.props; + const { + isPanelShow, jobName, conditionNum, visible, condition, form, + tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, + form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init, + defaultShowLeft + } = job; + + const rowSelection = { + onChange(selectedRowKeys, selectedRows) { + job.setSelectedRowKeys(selectedRowKeys); + }, + }; + + const pagination = { + current: current, + pageSize: pageSize, + total: total, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + }, + onChange(current) { + }, + showTotal(total) { + return `共 ${total} 条` + } + }; + + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + + job.setPanelStatus(bool)} + hideSearchAd={() => job.setPanelStatus(false)} + searchsAd={isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => { + job.setCurrent(1); + job.setPageSize(10); + job.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) => { + job.setCurrent(pagination.current); + job.setPageSize(pagination.pageSize); + job.getTableInfo(); + }} + indentSize={15} + /> + // + } +
+
+
+ job.setVisible(false)} + /> + this.handleSave()} + onCancel={() => job.setNewVisible(false)} + enable={false} //是否开启字段联动 + /> +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/job/JobExtend.js b/pc4mobx/organization/components/job/JobExtend.js new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/organization/components/office/officeManage.js b/pc4mobx/organization/components/office/officeManage.js index afdf3bf..97995bf 100644 --- a/pc4mobx/organization/components/office/officeManage.js +++ b/pc4mobx/organization/components/office/officeManage.js @@ -58,7 +58,7 @@ export default class OfficeManage extends Component { handleMenuClick = (key) => { const { officeManageStore } = this.props; - const { isPanelShow } = officeManageStore; + const { isPanelShow,tableStore} = officeManageStore; isPanelShow && officeManageStore.setPanelStatus(false); switch (key) { case "new": @@ -66,6 +66,10 @@ export default class OfficeManage extends Component { officeManageStore.setVisible(true); officeManageStore.setNeDialogTitle(i18n.label.newOfficeName()); break; + case "custom": + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + break; default: break; } @@ -239,6 +243,17 @@ export default class OfficeManage extends Component { officeManageStore.setNeDialogTitle(i18n.label.editOfficeName()); }; + custom = () => { + debugger + const { + officeManageStore + } = this.props, { + tableStore, + } = officeManageStore; + + +} + getPanelComponents = () => { const { officeManageStore } = this.props; const { searchCondition, form2, searchConditionLoading } = diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 39ef1cb..3e286bf 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -116,6 +116,19 @@ export default class JobGrade extends React.Component { jobGrade.getForm(); } + + custom = () => { + const { + jobGrade + } = this.props, { + tableStore, + } = jobGrade; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + + batchDelete() { const { jobGrade diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index b570e57..7c3cfdd 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -245,7 +245,17 @@ export default class JobLevel extends React.Component { } = operate; (index == '0') && this.doEdit(record.randomFieldId); (index == '1') && this.doDel(record.randomFieldId); + } + custom = () => { + const { + jobLevel + } = this.props, { + tableStore, + } = jobLevel; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); } doEdit(id) { diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index 2cb6601..f953511 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -202,6 +202,17 @@ export default class RankScheme extends React.Component { return btn; } + custom = () => { + const { + rankScheme + } = this.props, { + tableStore, + } = rankScheme; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + onSearchChange(val) { const { rankScheme diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js index 78f702c..1cb9bde 100644 --- a/pc4mobx/organization/components/sequence/Sequence.js +++ b/pc4mobx/organization/components/sequence/Sequence.js @@ -232,6 +232,17 @@ export default class Sequence extends React.Component { }) } + custom = () => { + const { + sequence + } = this.props, { + tableStore, + } = sequence; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + updateForbiddenTag(checked,id) { const { sequence diff --git a/pc4mobx/organization/components/staff/Staff.js b/pc4mobx/organization/components/staff/Staff.js new file mode 100644 index 0000000..38f7e08 --- /dev/null +++ b/pc4mobx/organization/components/staff/Staff.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('staff') +@observer +export default class Staff extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + staff + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + staff + } = this.props; + staff.getTableInfo(); + staff.getHasRight(); + } + + getTopMenuBtns() { + const { + staff + } = this.props; + const { + topMenu, + tableStore + } = staff; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun !== 'batchDelete') { + btns.push(); + } else { + btns.push(); + } + + }); + + return btns; + } + + handleClick(item) { + const { + staff + } = this.props; + const { + isPanelShow + } = staff; + + isPanelShow && staff.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + staff + } = this.props; + + staff.setNeDialogTitle(i18n.label.newStaff()); + staff.setIsNew(true); + staff.setVisible(true); + staff.getForm(); + } + + batchDelete() { + const { + staff + } = this.props; + const { + tableStore + } = staff; + + let keys = toJS(tableStore.selectedRowKeys).toString(); + staff.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 { + staff + } = this.props; + staff.delete(); + } + + + getDropMenuDatas() { + const { + staff + } = this.props; + const { + rightMenu + } = staff; + + 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 { + staff + } = this.props; + const { + isPanelShow + } = staff; + + isPanelShow && staff.setPanelStatus(false); + this[key] && this[key](); + } + + getTabBtn() { + const { + staff + } = this.props; + const { + form2 + } = staff; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + onSearchChange(val) { + const { + staff + } = this.props; + const { + form2 + } = staff; + + staff.setSchemeName(val); + !this.isEmptyObject(form2.getFormParams()) && staff.updateFields(val); + } + + 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 { + staff + } = this.props; + staff.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 { + staff + } = this.props; + + staff.setNeDialogTitle(i18n.label.editStaff()); + staff.setSchemeId(id); + staff.setIsNew(false); + staff.setVisible(true); + staff.getForm(); + } + + + custom = () => { + const { + staff + } = this.props, { + tableStore, + } = staff; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + + + doDel(id) { + const { + staff + } = this.props; + staff.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + const { + staff + } = this.props; + const { + isNew + } = staff; + + isNew && staff.save(); + !isNew && staff.edit(); + } + + getPanelComponents() { + const { + staff + } = this.props; + const { + searchCondition, + form2, + searchConditionLoading + } = staff; + + 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") { + staff.getTableInfo(); + staff.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + + + + render() { + + const { + staff + } = this.props; + const { + isPanelShow, form2, staffName, conditionNum, tableStore,nEdialogTitle,visible,condition, + form,dialogLoading,isEdit,date + } = staff; + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + staff.setPanelStatus(bool)} + hideSearchAd={() => staff.setPanelStatus(false)} + searchsAd= {isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => staff.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + this.reRenderColumns(c)} + onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} + /> +
+
+ this.handleSave()} + onCancel={() => staff.setVisible(false)} + enable={false} //是否开启字段联动 + /> +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/staff/StaffScheme.js b/pc4mobx/organization/components/staff/StaffScheme.js new file mode 100644 index 0000000..28ee2b8 --- /dev/null +++ b/pc4mobx/organization/components/staff/StaffScheme.js @@ -0,0 +1,422 @@ +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('staffScheme') +@observer +export default class StaffScheme extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + staffScheme + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + staffScheme + } = this.props; + staffScheme.getTableInfo(); + staffScheme.getHasRight(); + } + + getTopMenuBtns() { + const { + staffScheme + } = this.props; + const { + topMenu, + tableStore + } = staffScheme; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun !== 'batchDelete') { + btns.push(); + } else { + btns.push(); + } + + }); + + return btns; + } + + handleClick(item) { + const { + staffScheme + } = this.props; + const { + isPanelShow + } = staffScheme; + + isPanelShow && staffScheme.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + staffScheme + } = this.props; + + staffScheme.setNeDialogTitle(i18n.label.newStaffScheme()); + staffScheme.setIsNew(true); + staffScheme.setVisible(true); + staffScheme.getForm(); + } + + batchDelete() { + const { + staffScheme + } = this.props; + const { + tableStore + } = staffScheme; + + let keys = toJS(tableStore.selectedRowKeys).toString(); + staffScheme.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 { + staffScheme + } = this.props; + staffScheme.delete(); + } + + + getDropMenuDatas() { + const { + staffScheme + } = this.props; + const { + rightMenu + } = staffScheme; + + 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 { + staffScheme + } = this.props; + const { + isPanelShow + } = staffScheme; + + isPanelShow && staffScheme.setPanelStatus(false); + this[key] && this[key](); + } + + getTabBtn() { + const { + staffScheme + } = this.props; + const { + form2 + } = staffScheme; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + onSearchChange(val) { + const { + staffScheme + } = this.props; + const { + form2 + } = staffScheme; + + staffScheme.setSchemeName(val); + !this.isEmptyObject(form2.getFormParams()) && staffScheme.updateFields(val); + } + + 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 { + staffScheme + } = this.props; + staffScheme.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 { + staffScheme + } = this.props; + + staffScheme.setNeDialogTitle(i18n.label.ediStaffScheme()); + staffScheme.setSchemeId(id); + staffScheme.setIsNew(false); + staffScheme.setVisible(true); + staffScheme.getForm(); + } + + log = () => { + window.setLogViewProps({ + logSmallType: '3010', + }); + } + + + custom = () => { + const { + staffScheme + } = this.props, { + tableStore, + } = staffScheme; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + + + + + doDel(id) { + const { + staffScheme + } = this.props; + staffScheme.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + const { + staffScheme + } = this.props; + const { + isNew + } = staffScheme; + + isNew && staffScheme.save(); + !isNew && staffScheme.edit(); + } + + getPanelComponents() { + const { + staffScheme + } = this.props; + const { + searchCondition, + form2, + searchConditionLoading + } = staffScheme; + + 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") { + staffScheme.getTableInfo(); + staffScheme.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + + + + render() { + + const { + staffScheme + } = this.props; + const { + isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition, + form,dialogLoading,isEdit,date + } = staffScheme; + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + staffScheme.setPanelStatus(bool)} + hideSearchAd={() => staffScheme.setPanelStatus(false)} + searchsAd= {isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => staffScheme.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + this.reRenderColumns(c)} + onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)} + /> +
+
+ this.handleSave()} + onCancel={() => staffScheme.setVisible(false)} + enable={false} //是否开启字段联动 + /> +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 89040e0..2670924 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -2,11 +2,12 @@ * Author: 黎永顺 * Description: * Date: 2022-05-23 17:44:32 - * LastEditTime: 2022-05-23 17:46:13 + * LastEditTime: 2022-05-30 09:29:18 */ import React from "react"; import Route from "react-router/lib/Route"; import { WeaLocaleProvider } from "ecCom"; +import Home from "./components/Home"; import SimpleOrg from "./components/tree/index"; import StandardOrg from "./components/tree/standard_org"; import RankScheme from "./components/postionrank/RankScheme"; @@ -19,6 +20,10 @@ import CompanyExtend from "./components/company/CompanyExtend"; import BranchNumSetting from "./components/branchNumSetting"; import Company from "./components/company/company"; import DepartmentManage from "./components/deptment"; +import StaffScheme from "./components/staff/StaffScheme"; +import Staff from "./components/staff/Staff"; +import Job from "./components/job/job"; + import stores from "./stores"; import "./style/index"; @@ -33,7 +38,7 @@ getLocaleLabel = function (nextState, replace, callback) { callback(); }; -const Home = (props) => props.children; +//const Home = (props) => props.children; const Routes = ( + + + + ); +const OutSignAppSettingProvider = (props) => ( + + + +); + +class NetworkStrategy extends React.Component { + constructor(props) { + super(props); + this.state = { + reRender: false, + }; + } + + componentDidMount() { + // 多语言加载之后,已经 mount 的组件,需要重新 render 一次,刷新多语言配置。 + // getLocaleLabelByCode('hrm').then(() => this.setState({ + // reRender: true + // })); + } + + render = () => ( + + + + + + ); +} + module.exports = { Route: Routes, store: stores, + com: { + OutSignAppSettingProvider: OutSignAppSettingProvider, + NetworkStrategy, + }, }; + +// module.exports = { +// Route: Routes, +// store: stores, +// }; diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index a71391f..66b278e 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -132,6 +132,16 @@ export const i18n = { companyName: () => getLabel(385937, '分部'), departName: () => getLabel(386246, '部门管理'), + staffSchemeName: () => getLabel(385936, '编制方案'), + newStaffScheme: () => getLabel(386246, '新建编制方案'), + ediStaffScheme: () => getLabel(386247, '编辑编制方案'), + staffName: () => getLabel(385936, '编制上报'), + newStaff: () => getLabel(386246, '新建编制'), + editStaff: () => getLabel(386247, '编辑编制'), + jobName: () => getLabel(385936, '岗位'), + newJob: () => getLabel(386246, '新建岗位'), + editJob: () => getLabel(386247, '编辑岗位'), + authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index d5dd07f..a365ad3 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -51,7 +51,8 @@ export class CompanyStore { @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; - @observable total = 0; + @observable init = true; //是否首次加载 + @observable total = ''; @observable current = 1; @observable pageSize = 10; @@ -69,7 +70,7 @@ export class CompanyStore { params = { ...params, ...this.form.getFormParams(), - compName: this.companyName, + compName: this.companyName }; } else { params = { @@ -81,10 +82,11 @@ export class CompanyStore { return response.json() }).then(res => { if (res.code === 200) { - res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); - res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); - res.data.pageInfo.total && this.setTotal(res.data.pageInfo.total ) - this.setLoading(false); + res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); + this.setTotal(res.data.pageInfo.total); + res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); + this.setLoading(false); + this.setInit(false); } else { message.warning(res.msg); } @@ -103,14 +105,13 @@ export class CompanyStore { let params = { parentComp:id } - this.setLoading(true); Api.getDeptListByPid(params).then(response => { return response.json() }).then(res => { if (res.code === 200) { res.data.list && this.setDeptDataSource(res.data.list); res.data.columns && this.setDeptColumns(res.data.columns); - this.setLoading(false); + this.setDialogLoadingStatus(false); } else { message.warning(res.msg); } @@ -361,4 +362,8 @@ save() { this.pageSize = pageSize; } + setInit(bool) { + this.init = bool; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 8b317a2..95ba257 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -123,7 +123,8 @@ export class CompanyExtendStore { this.setLoading(true); let params = { viewAttr: this.isEditor ? 2 : 1, - id: this.id + id: this.id, + viewCondition:this.selectedKey } Api.getCompanyExtendForm(params).then((res) => { if (res.code === 200) { @@ -215,6 +216,7 @@ export class CompanyExtendStore { changeData(key) { this.setSelectedKey(key); + this.getData(); } setId(id) { diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index ed60974..ce67d31 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -8,6 +8,9 @@ import { SequenceStore } from "./sequence"; import { GroupStore } from "./group"; import {CompanyExtendStore} from "./companyextend"; import {CompanyStore} from "./company" +import {StaffSchemeStore} from "./staffscheme"; +import {StaffStore} from "./staff"; +import {JobStore} from "./job" module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -19,5 +22,8 @@ module.exports = { sequence: new SequenceStore(), group: new GroupStore(), companyExtend: new CompanyExtendStore(), - company: new CompanyStore() + company: new CompanyStore(), + staffScheme: new StaffSchemeStore(), + staff: new StaffStore(), + job: new JobStore() }; diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js new file mode 100644 index 0000000..d54bd0d --- /dev/null +++ b/pc4mobx/organization/stores/job.js @@ -0,0 +1,371 @@ +import { + observable, + action + } from 'mobx'; + import * as mobx from 'mobx'; + import * as Api from '../apis/job'; // 引入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 JobStore { + @observable topMenu = [] + @observable rightMenu = []; + @observable dataSource = []; + @observable columns = []; + @observable deptDataSource = []; + @observable deptColumns = []; + @observable tableStore = new TableStore(); + @observable loading = true; + @observable dialogLoading = true; + @observable isEdit = true; + @observable nEdialogTitle = ''; + @observable searchCondition = []; + @observable condition = []; + @observable isPanelShow = false; //高级搜索面板 + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); //新增主表表单 + @observable jobName = ''; + @observable conditionNum = 8; + @observable ids = ''; //选择行id + @observable id = ''; //页面跳转参数id + @observable searchConditionLoading = true; + @observable visible = false; + @observable newVisible = false; //新增弹窗 + @observable jobId = ''; + @observable selectedRowKeys = ''; + @observable date = ''; + @observable init = true; //是否首次加载 + @observable total = ''; + @observable current = 1; + @observable pageSize = 10; + + @observable defaultShowLeft = true + + + + + @action + getTableInfo() { + this.setLoading(true); + let params = { + current:this.current, + pageSize:this.pageSize + } + if (this.isEmptyObject(this.form.getFormParams())) { + params = { + ...params, + ...this.form.getFormParams(), + compName: this.jobName + }; + } else { + params = { + ...params, + ...this.form.getFormParams(), + }; + } + Api.getSearchList(params).then(response => { + return response.json() + }).then(res => { + if (res.code === 200) { + res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); + this.setTotal(res.data.pageInfo.total); + res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); + this.setLoading(false); + this.setInit(false); + } else { + message.warning(res.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + + + + + + } + + @action("联查部门") + getDeptTable(id) { + let params = { + parentComp:id + } + Api.getDeptListByPid(params).then(response => { + return response.json() + }).then(res => { + if (res.code === 200) { + res.data.list && this.setDeptDataSource(res.data.list); + res.data.columns && this.setDeptColumns(res.data.columns); + this.setDialogLoadingStatus(false); + } else { + message.warning(res.msg); + } + }).catch(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); + }) + } + + 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); + }) + } + + getSearchCondition() { + this.setScLoadingStatus(true); + Api.getAdvanceSearchCondition().then(res => { + if (res.code === 200) { + this.setScLoadingStatus(false); + res.data.conditions && this.setSearchCondition(res.data.conditions); + res.data.conditions && this.form.initFormFields(res.data.conditions); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + + getCompanyForm() { + let params = {}; + this.setDialogLoadingStatus(true); + Api.getCompanyForm(params).then(res => { + if (res.code === 200) { + this.setDialogLoadingStatus(false); + res.data.condition && this.setCondition(res.data.condition); + res.data.condition && this.form1.initFormFields(res.data.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + } + + save() { + let params = { + ...this.form1.getFormParams() + }; + this.form1.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.setNewVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + + @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.form.updateFields({ + compName: { + value: val + } + }); + } + + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setJobName(val) { + this.jobName = val; + } + + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + setIds(ids) { + this.ids = ids; + } + + setId(id) { + this.id =id; + } + + scLoadingReset() { + this.searchConditionLoading = true; + } + + + formReset() { + this.form1 = new WeaForm(); + } + + + setVisible(bool) { + this.visible = bool; + } + + setDialogLoadingStatus(bool) { + this.dialogLoading = bool; + } + + + setSearchCondition(searchCondition) { + this.searchCondition = searchCondition; + } + + setJobId(jobId) { + this.jobId = jobId; + } + + setDate(date) { + this.date = date; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + + setDataSource(dataSource) { + this.dataSource = dataSource; + } + + setDeptDataSource(deptDataSource) { + this.deptDataSource = deptDataSource; + } + + setColumns(columns) { + this.columns = columns + } + + setDeptColumns(deptColumns) { + this.deptColumns = deptColumns + } + + setSelectedRowKeys(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + } + + setLoading(bool) { + this.loading = bool; + } + + setNeDialogTitle(title) { + this.nEdialogTitle = title + } + + setCondition(condition) { + this.condition = condition; + } + + setNewVisible(bool) { + this.formReset(); + this.newVisible = bool; + } + + setTotal(total) { + this.total = total; + } + + setCurrent(current) { + this.current = current; + } + + setPageSize(pageSize) { + this.pageSize = pageSize; + } + + setInit(bool) { + this.init = bool; + } + + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js index 99c2deb..65ad030 100644 --- a/pc4mobx/organization/stores/joblevel.js +++ b/pc4mobx/organization/stores/joblevel.js @@ -53,6 +53,8 @@ export class JobLevelStore { @action getTableInfo() { let params; + //获取tab信息 + this.getTabInfo(); this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { params = { @@ -75,9 +77,7 @@ export class JobLevelStore { }, error => { message.warning(error.msg); }) - //获取tab信息 - this.getTabInfo(); - + } //删除 diff --git a/pc4mobx/organization/stores/staff.js b/pc4mobx/organization/stores/staff.js new file mode 100644 index 0000000..9a1b4f7 --- /dev/null +++ b/pc4mobx/organization/stores/staff.js @@ -0,0 +1,290 @@ +import { + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/staff'; // 引入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 StaffStore { + @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 staffName = ''; + @observable conditionNum = 10; + @observable ids = ''; //选择行id + @observable searchConditionLoading = true; + @observable nEdialogTitle = ''; + @observable visible = false; + @observable dialogLoading = true; + @observable staffId = ''; + @observable date = ''; + + + + + + @action + getTableInfo() { + let params; + this.tableStore = new TableStore(); + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...this.form2.getFormParams(), + staffName: this.staffName + }; + } else { + params = { + ...this.form2.getFormParams() + }; + } + Api.getSearchList(params).then(res => { + if (res.code === 200) { + res.data.datas && this.tableStore.getDatas(res.data.datas, 1); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + } + + //删除 + delete() { + let params = { + ids: this.ids + }; + Api.deleteTableData(params).then(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.staffId }; + this.form.validateForm().then(f => { + if (f.isValid) { + Api.edit(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + + getForm() { + let params = this.isNew ? {} : { + id: this.staffId + } + this.setDialogLoadingStatus(true); + + Api.getForm(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 + 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({ + staffName: { + value: val + } + }); + } + + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setStaffName(staffName) { + this.staffName = staffName; + } + + 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; + } + + setStaffId(staffId) { + this.staffId = staffId; + } + + @action + setDate(date) { + 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/staffscheme.js b/pc4mobx/organization/stores/staffscheme.js new file mode 100644 index 0000000..00b4a61 --- /dev/null +++ b/pc4mobx/organization/stores/staffscheme.js @@ -0,0 +1,308 @@ +import { + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/staffscheme'; // 引入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 StaffSchemeStore { + @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 schemeName = ''; + @observable conditionNum = 8; + @observable ids = ''; //选择行id + @observable searchConditionLoading = true; + @observable nEdialogTitle = ''; + @observable visible = false; + @observable dialogLoading = true; + @observable schemeId = ''; + @observable date = ''; + + + + + + @action + getTableInfo() { + let params; + this.tableStore = new TableStore(); + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...this.form2.getFormParams(), + schemeName: this.schemeName + }; + } else { + params = { + ...this.form2.getFormParams() + }; + } + Api.getSearchList(params).then(res => { + if (res.code === 200) { + res.data.datas && this.tableStore.getDatas(res.data.datas, 1); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + } + + //删除 + delete() { + let params = { + ids: this.ids + }; + Api.deleteTableData(params).then(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.schemeId }; + this.form.validateForm().then(f => { + if (f.isValid) { + Api.edit(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); + } + + 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.schemeId + } + 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); + }) + + } + + 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 + 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({ + schemeName: { + value: val + } + }); + } + + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setSchemeName(val) { + this.schemeName = val; + } + + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + setIds(ids) { + this.ids = ids; + } + + scLoadingReset() { + this.searchConditionLoading = true; + } + + + 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; + } + + setSchemeId(schemeId) { + this.schemeId = schemeId; + } + + @action + setDate(date) { + this.date = date; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + +} \ No newline at end of file diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less index 5c3fad6..1f965bc 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -18,7 +18,16 @@ width: 400px !important; line-height: 30px; } - } + } +} + +.hrm-new-weatable-spin { + text-align: center; + margin-top: 10px; +} + +.wea-left-right-layout-right { + overflow: scroll !important; } @@ -47,4 +56,6 @@ padding-left: 25%; } } + + } \ No newline at end of file