From 98ae042c26045904cb260c6c3187e90c7aae5770 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 14:34:01 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/company.js | 77 ++++ pc4mobx/organization/apis/group.js | 2 +- .../components/company/company.js | 390 +++++++++++++++++- pc4mobx/organization/index.js | 2 + pc4mobx/organization/public/i18n.js | 2 +- pc4mobx/organization/stores/company.js | 232 ++++++++++- pc4mobx/organization/stores/companyextend.js | 1 + 7 files changed, 674 insertions(+), 32 deletions(-) diff --git a/pc4mobx/organization/apis/company.js b/pc4mobx/organization/apis/company.js index e69de29..5fa5238 100644 --- a/pc4mobx/organization/apis/company.js +++ b/pc4mobx/organization/apis/company.js @@ -0,0 +1,77 @@ + +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 deleteTableData = (params) => { +// return fetch('/api/bs/hrmorganization/level/deleteByIds', { +// method: 'POST', +// mode: 'cors', +// headers: { +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify(params) +// }) +// } + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params); +} + +// export const add = (params) => { +// return fetch('/api/bs/hrmorganization/level/saveLevel', { +// method: 'POST', +// mode: 'cors', +// headers: { +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify(params) +// }) +// } + +// export const edit = (params) => { +// return fetch('/api/bs/hrmorganization/level/updateLevel', { +// method: 'POST', +// mode: 'cors', +// headers: { +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify(params) +// }) +// } + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +// export const getLevelForm = (params) => { +// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params); +// } + +// export const getTabInfo = (params) => { +// return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params); +// } + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/apis/group.js b/pc4mobx/organization/apis/group.js index ffabd63..bb8651c 100644 --- a/pc4mobx/organization/apis/group.js +++ b/pc4mobx/organization/apis/group.js @@ -21,7 +21,7 @@ export const getTabInfo = (params) => { export const getGroupForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/group/getCompanyFormField', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/group/getGroupFormField', 'GET', params); } export const getHasRight = (params) => { diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 5e8fabc..2e1417e 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,9 +1,383 @@ -import React, { Component } from 'react' +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer, +} from 'mobx-react' +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, + WeaTable +} from 'ecCom' +import { + Row, + Col, + Spin, + Modal, + Button, + message, + Switch +} from 'antd' +import { + WeaSwitch, + WeaTableNew +} from 'comsMobx' +import { + i18n +} from '../../public/i18n'; -export default class Company extends Component { - render() { - return ( -
C
- ) - } -} +import '../../style/common.less'; + +import NewAndEditDialog from '../NewAndEditDialog'; + + + +const toJS = mobx.toJS; +const confirm = Modal.confirm; +//const WeaTable = WeaTableNew.WeaTable; + + +@inject('company') +@observer +export default class Company extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + const { + company + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + this.init(); + } + } + + init() { + const { + company + } = this.props; + company.getTableInfo(); + company.getHasRight(); + } + + getTopMenuBtns() { + const { + company + } = this.props; + const { + topMenu, + selectedRowKeys + } = company; + + let btns = []; + topMenu.map((item, i) => { + if (item.menuFun !== 'batchDelete') { + btns.push(); + } else { + btns.push(); + } + + }); + + return btns; + } + + handleClick(item) { + const { + company + } = this.props; + const { + isPanelShow + } = company; + + isPanelShow && company.setPanelStatus(false); + this[item.menuFun] && this[item.menuFun](); + } + + new() { + const { + company + } = this.props; + + // company.setNeDialogTitle(i18n.label.newcompany()); + // company.setIsNew(true); + // company.setVisible(true); + // company.getForm(); + } + + batchDelete() { + const { + company + } = this.props; + const { + tableStore + } = company; + + let keys = toJS(tableStore.selectedRowKeys).toString(); + company.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 { + company + } = this.props; + company.delete(); + } + + + getDropMenuDatas() { + const { + company + } = this.props; + const { + rightMenu + } = company; + + 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 { + company + } = this.props; + const { + isPanelShow + } = company; + + isPanelShow && company.setPanelStatus(false); + this[key] && this[key](); + } + + + + onSearchChange(val) { + const { + company + } = this.props; + const { + form + } = company; + + company.setCompanyName(val); + !this.isEmptyObject(form.getFormParams()) && company.updateFields(val); + } + + reRenderColumns(columns) { + 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 {text} + } + } + }) + return columns; + } + + updateForbiddenTag(checked, id) { + const { + company + } = this.props; + company.updateForbiddenTag(checked, id); + } + + doDel(id) { + const { + company + } = this.props; + company.setIds(id); + this.showConfirm('del'); + } + + + handleSave() { + // const { + // company + // } = this.props; + // const { + // isNew + // } = company; + + // isNew && company.save(); + // !isNew && company.edit(); + } + + getTabBtn() { + const { + company + } = this.props; + const { + form + } = company; + + const btn = [ + (), + (), + (), + ]; + + return btn; + } + + getPanelComponents() { + const { + company + } = this.props; + const { + searchCondition, + form, + searchConditionLoading + } = company; + + 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") { + company.getTableInfo(); + company.setPanelStatus(false) + } + }}>{arr} + } + + } + + //非空判断 + isEmptyObject(obj) { + for (let key in obj) { + return false; + } + return true; + } + + + + render() { + + const { + company + } = this.props; + const { + isPanelShow, companyName, conditionNum, visible, condition, form, tableStore, dataSource, columns + } = company; + + + const rowSelection = { + onChange(selectedRowKeys, selectedRows) { + company.setSelectedRowKeys(selectedRowKeys); + + }, + }; + + + return ( +
+ this.handleMenuClick(key)} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(e) => this.handleMenuClick(e)} + > + company.setPanelStatus(bool)} + hideSearchAd={() => company.setPanelStatus(false)} + searchsAd={isPanelShow ? this.getPanelComponents() :
} + advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} + hasMask={false} + buttonsAd={this.getTabBtn()} + onSearch={() => company.getTableInfo()} + onSearchChange={val => this.onSearchChange(val)} + /> + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={this.reRenderColumns(columns)} + rowSelection={rowSelection} + indentSize={15} + defaultExpandedRowKeys={[1,2]} + /> +
+
+ +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index a89f3ba..ee85080 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -10,6 +10,7 @@ import Sequence from "./components/sequence/Sequence"; import Group from "./components/group/Group"; import OfficeManage from "./components/office/officeManage"; import CompanyExtend from "./components/company/CompanyExtend" +import Company from "./components/company/company"; import stores from "./stores"; import "./style/index"; @@ -41,6 +42,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 44a3246..e917510 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -128,7 +128,7 @@ export const i18n = { newOfficeName: () => getLabel(386246, '新建职务信息'), editOfficeName: () => getLabel(386247, '编辑职务信息'), newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), - + companyName: () => getLabel(385936, '分部'), authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 4a179b0..67f8739 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -1,43 +1,231 @@ -import { observable, action, toJS } from "mobx"; -import { WeaForm } from "comsMobx"; -import { WeaTableNew } from "comsMobx"; -import { Modal, message } from "antd"; -import { i18n } from "../public/i18n"; +import { + observable, + action +} from 'mobx'; +import * as mobx from 'mobx'; +import * as Api from '../apis/company'; // 引入API接口文件 +import { + WeaForm +} from 'comsMobx'; +import { + WeaTableNew +} from 'comsMobx'; +import { + Modal, + message, +} from 'antd' +import { + i18n +} from '../public/i18n'; -const { TableStore } = WeaTableNew; +const toJS = mobx.toJS; +const { + TableStore +} = WeaTableNew; export class CompanyStore { - @observable tableStore = new TableStore(); - @observable topMenu = []; + @observable topMenu = [] @observable rightMenu = []; - @observable condition = []; + @observable dataSource = []; + @observable columns = []; + @observable tableStore = new TableStore(); @observable searchCondition = []; - @observable isEdit = true; - @observable isNew = true; @observable isPanelShow = false; //高级搜索面板 - @observable form2 = new WeaForm(); @observable form = new WeaForm(); - @observable form1 = new WeaForm(); - @observable conditionNum = 2; - @observable ids = ""; //选择行id + @observable companyName = ''; + @observable conditionNum = 8; + @observable ids = ''; //选择行id + @observable id = ''; //页面跳转参数id @observable searchConditionLoading = true; @observable visible = false; - @observable date = ""; + @observable companyId = ''; + @observable selectedRowKeys = ''; + @observable date = ''; + + + @action + getTableInfo() { + let params; + if (this.isEmptyObject(this.form.getFormParams())) { + params = { + ...this.form.getFormParams(), + //companyName: this.companyName, + }; + } else { + params = { + ...this.form.getFormParams(), + }; + } + Api.getSearchList(params).then(response => { + 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); + } 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); + }) + } + + @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, - }, + this.form.updateFields({ + companyName: { + value: val + } }); } + setSearchCondition(condition) { + this.searchCondition = condition; + } + + setScLoadingStatus(bool) { + this.searchConditionLoading = bool; + } + + setPanelStatus(bool) { + this.isPanelShow = bool; + bool && this.getSearchCondition(); + if (!bool) { + this.scLoadingReset(); + } + } + + setCompanyName(val) { + this.companyName = 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(); } -} + + + setVisible(bool) { + this.visible = bool; + this.formReset(); + !bool && this.dialogLoadingReset(); + } + + + setSearchCondition(searchCondition) { + this.searchCondition = searchCondition; + } + + setCompanyId(companyId) { + this.companyId = companyId; + } + + setDate(date) { + this.date = date; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + + setDataSource(dataSource) { + this.dataSource = dataSource; + } + + setColumns(columns) { + this.columns = columns + } + + setSelectedRowKeys(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + } + +} \ No newline at end of file diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 7bf098a..8993851 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -4,6 +4,7 @@ import isEmpty from 'lodash/isEmpty' import { WeaTableNew } from "comsMobx"; import { Modal, message } from "antd"; import { i18n } from "../public/i18n"; +import * as Api from '../apis/company'; // 引入API接口文件 export class CompanyExtendStore { From b073384fc71dc021b77623db63ed16f5e45947d8 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 14:46:36 +0800 Subject: [PATCH 02/26] solve conflict --- pc4mobx/organization/public/i18n.js | 1 + 1 file changed, 1 insertion(+) diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index e917510..d4230b6 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -128,6 +128,7 @@ export const i18n = { newOfficeName: () => getLabel(386246, '新建职务信息'), editOfficeName: () => getLabel(386247, '编辑职务信息'), newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), + branchNumSetting: () => getLabel(386246, '分部编号设置'), companyName: () => getLabel(385936, '分部'), From eff03741b23a46053c0da857705ec06824b23c0d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 14:49:46 +0800 Subject: [PATCH 03/26] solve conflict --- pc4mobx/organization/components/company/company.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 2e1417e..6a631ef 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -36,7 +36,7 @@ import NewAndEditDialog from '../NewAndEditDialog'; const toJS = mobx.toJS; const confirm = Modal.confirm; -//const WeaTable = WeaTableNew.WeaTable; +//const WeaTable = WeaTableNew.WeaTable @inject('company') From a89634f0dfd8510899a6325e49bef377212cf009 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 14:55:10 +0800 Subject: [PATCH 04/26] 1 --- pc4mobx/organization/public/i18n.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index d4230b6..7de3ef6 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -129,7 +129,7 @@ export const i18n = { editOfficeName: () => getLabel(386247, '编辑职务信息'), newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), branchNumSetting: () => getLabel(386246, '分部编号设置'), - companyName: () => getLabel(385936, '分部'), + companyName: () => getLabel(385937, '分部'), authorizationGroup: () => getLabel(492, '权限组'), From db16ec323a9b34f4e77a219dde9f3480ddde02db Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 14:58:44 +0800 Subject: [PATCH 05/26] solve conflict --- pc4mobx/organization/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index e123cd1..d59d092 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -10,11 +10,9 @@ import Sequence from "./components/sequence/Sequence"; import Group from "./components/group/Group"; import OfficeManage from "./components/office/officeManage"; import CompanyExtend from "./components/company/CompanyExtend" -<<<<<<< HEAD import BranchNumSetting from "./components/branchNumSetting" -======= import Company from "./components/company/company"; ->>>>>>> feature/cl + import stores from "./stores"; import "./style/index"; From b96ffa42053845ee3d624b6623e25537407b51ed Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 15:01:04 +0800 Subject: [PATCH 06/26] solve conflict --- pc4mobx/organization/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index d59d092..8abf7ad 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -44,11 +44,8 @@ const Routes = ( -<<<<<<< HEAD -======= ->>>>>>> feature/cl ); From 44715650dbe5a06c1ff3992e1b2bb9efdfd8297e Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 15:24:46 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=E9=9B=86=E5=9B=A2=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/group.js | 2 +- pc4mobx/organization/stores/group.js | 43 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pc4mobx/organization/apis/group.js b/pc4mobx/organization/apis/group.js index bb8651c..f5fe312 100644 --- a/pc4mobx/organization/apis/group.js +++ b/pc4mobx/organization/apis/group.js @@ -5,7 +5,7 @@ import { export const edit = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateScheme', { + return fetch('/api/bs/hrmorganization/group/updateGroup', { method: 'POST', mode: 'cors', headers: { diff --git a/pc4mobx/organization/stores/group.js b/pc4mobx/organization/stores/group.js index 57a5ac6..6901ac8 100644 --- a/pc4mobx/organization/stores/group.js +++ b/pc4mobx/organization/stores/group.js @@ -81,28 +81,27 @@ export class GroupStore { 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()); - // } - // }); + let params = { ...this.form.getFormParams(), id: 1 }; + 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.getGroupForm(); + this.setVisible(false); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } else { + f.showErrors(); + this.setDate(new Date()); + } + }); } getForm() { From 8eb704e23d5e38bded8158abf71c87689a14bb9a Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 15:50:35 +0800 Subject: [PATCH 08/26] =?UTF-8?q?=E4=BF=9D=E6=8A=A4=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/components/company/company.js | 4 +++- pc4mobx/organization/stores/company.js | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 6a631ef..59bb4b7 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -326,7 +326,8 @@ export default class Company extends React.Component { company } = this.props; const { - isPanelShow, companyName, conditionNum, visible, condition, form, tableStore, dataSource, columns + isPanelShow, companyName, conditionNum, visible, condition, form, + tableStore, dataSource, columns,loading } = company; @@ -373,6 +374,7 @@ export default class Company extends React.Component { rowSelection={rowSelection} indentSize={15} defaultExpandedRowKeys={[1,2]} + loading={loading} /> diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 67f8739..b560629 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -29,6 +29,7 @@ export class CompanyStore { @observable dataSource = []; @observable columns = []; @observable tableStore = new TableStore(); + @observable loading = true; @observable searchCondition = []; @observable isPanelShow = false; //高级搜索面板 @observable form = new WeaForm(); @@ -43,6 +44,7 @@ export class CompanyStore { @observable date = ''; + @action getTableInfo() { let params; @@ -62,6 +64,7 @@ export class CompanyStore { if (res.code === 200) { res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); + this.setLoading(false); } else { message.warning(res.msg); } @@ -228,4 +231,8 @@ export class CompanyStore { this.selectedRowKeys = selectedRowKeys; } + setLoading(bool) { + this.loading = bool; + } + } \ No newline at end of file From 337f8f8dff535aa37ab54549a7edf3b94abb99b7 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 16:01:09 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=E9=9B=86=E5=9B=A2=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/components/company/company.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 59bb4b7..d73302a 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -205,7 +205,7 @@ export default class Company extends React.Component { columns.forEach((c, index) => { if (c.dataIndex == 'forbiddenTag') { c.render = function (text, record) { - return _this.updateForbiddenTag(checked, record.id)} /> + return _this.updateForbiddenTag(checked, record.id)} /> } }; if (c.dataIndex == 'compName') { From d52cf8170e80e4f4826f2f53b6d57ef987cdf94a Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 18 May 2022 17:51:57 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E6=89=A9=E5=B1=95=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/company/CompanyExtend.js | 3 ++- pc4mobx/organization/components/company/company.js | 11 ++++++++++- pc4mobx/organization/components/tree/index.js | 1 - pc4mobx/organization/stores/company.js | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index 721c6d2..7fa7d9a 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -21,7 +21,8 @@ export default class CompanyExtend extends React.Component { this.init(); } init = () => { - const { companyExtend } = this.props; + const { companyExtend,company } = this.props; + const {id} = company; companyExtend.init(); // companyExtend.hrmId=hrmId; companyExtend.getData(); diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index d73302a..87539ba 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -200,7 +200,13 @@ export default class Company extends React.Component { !this.isEmptyObject(form.getFormParams()) && company.updateFields(val); } + + + ///spa/organization/static/index.html#/main/organization/companyExtend reRenderColumns(columns) { + const { + company + } = this.props; let _this = this; columns.forEach((c, index) => { if (c.dataIndex == 'forbiddenTag') { @@ -210,7 +216,10 @@ export default class Company extends React.Component { }; if (c.dataIndex == 'compName') { c.render = function (text, record) { - return {text} + return { + company.setId(record.id); + window.open('/spa/organization/static/index.html#/main/organization/companyExtend',"_blank") + }}>{text} } } }) diff --git a/pc4mobx/organization/components/tree/index.js b/pc4mobx/organization/components/tree/index.js index 878c3e2..fd9d17a 100644 --- a/pc4mobx/organization/components/tree/index.js +++ b/pc4mobx/organization/components/tree/index.js @@ -26,7 +26,6 @@ const WeaLogViewComp = WeaLogView.Component; export default class simpleOrg extends React.Component { componentWillMount() { // 初始化渲染页面 - debugger const { simpleOrgStore: { doInit } } = this.props; doInit(); } diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index b560629..f5d6826 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -182,6 +182,10 @@ export class CompanyStore { this.ids = ids; } + setId(id) { + this.id =id; + } + scLoadingReset() { this.searchConditionLoading = true; } From 669f92dbf26fa0cc79f589c89efd3b580312947e Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 19 May 2022 09:35:39 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=E6=89=A9=E5=B1=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/company/CompanyExtend.js | 7 +++-- .../components/company/company.js | 3 +- pc4mobx/organization/index.js | 2 +- pc4mobx/organization/stores/companyextend.js | 29 +++++++++++-------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index 7fa7d9a..c9ff330 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -22,9 +22,12 @@ export default class CompanyExtend extends React.Component { } init = () => { const { companyExtend,company } = this.props; - const {id} = company; + //const {id} = company; + const {hash} = window.location; + let id = hash.replace("[^/]+(?=/$|$)"); + console.log("id",id) companyExtend.init(); - // companyExtend.hrmId=hrmId; + companyExtend.setId(id); companyExtend.getData(); } diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 87539ba..6d7bd83 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -217,8 +217,7 @@ export default class Company extends React.Component { if (c.dataIndex == 'compName') { c.render = function (text, record) { return { - company.setId(record.id); - window.open('/spa/organization/static/index.html#/main/organization/companyExtend',"_blank") + window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`,"_blank") }}>{text} } } diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 8abf7ad..b8bc76d 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -43,7 +43,7 @@ const Routes = ( - + diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 8993851..85cf6e5 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -18,7 +18,8 @@ export class CompanyExtendStore { @observable selectedKey = 0; @observable detailSelectedKey = 0; @observable topTab = []; - @observable buttons = {} + @observable buttons = {}; + @observable id = ''; //分部id @observable date; @observable personalEditTables; @@ -122,7 +123,7 @@ export class CompanyExtendStore { this.loading = true; params = { ...params, - viewAttr:this.isEditor ? 2 : 1 + viewAttr: this.isEditor ? 2 : 1 } let data = { "result": { @@ -1090,10 +1091,10 @@ export class CompanyExtendStore { ], "topTab": [ { - "title": "总部信息", - "viewCondition": "1" + "title": "总部信息", + "viewCondition": "1" } - ] + ] } } // API.getResourceCard(params).then((data) => { @@ -1120,12 +1121,12 @@ export class CompanyExtendStore { handleTable = (datas) => { return datas && datas.map(data => { - const {tabinfo:{columns}} = data; + const { tabinfo: { columns } } = data; const length = columns.length; - columns.map(c => { - c.width = `${95/length}%` - }) - return data + columns.map(c => { + c.width = `${95 / length}%` + }) + return data }) } @@ -1170,13 +1171,17 @@ export class CompanyExtendStore { } - setTopTab (topTab) { + setTopTab(topTab) { this.topTab = topTab; } changeData(key) { this.setSelectedKey(key); -} + } + + setId(id) { + this.id = id; + } } From de7e0d50c64d01fe8c3640849607966b3b92384d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 19 May 2022 16:15:19 +0800 Subject: [PATCH 12/26] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=88=86=E9=83=A8?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E9=83=A8=E9=97=A8=20=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/NewTableDialog.js | 77 +++++++++++++ .../components/company/CompanyExtend.js | 8 +- .../components/company/company.js | 108 +++++++++++++----- .../organization/components/group/Group.js | 2 +- .../components/postionrank/JobGrade.js | 2 +- .../components/postionrank/JobLevel.js | 2 +- .../components/postionrank/RankScheme.js | 4 +- .../components/sequence/Sequence.js | 2 +- pc4mobx/organization/stores/company.js | 68 ++++++++++- pc4mobx/organization/stores/companyextend.js | 2 +- pc4mobx/organization/stores/rankscheme.js | 3 +- 11 files changed, 236 insertions(+), 42 deletions(-) create mode 100644 pc4mobx/organization/components/NewTableDialog.js diff --git a/pc4mobx/organization/components/NewTableDialog.js b/pc4mobx/organization/components/NewTableDialog.js new file mode 100644 index 0000000..bd7d2dc --- /dev/null +++ b/pc4mobx/organization/components/NewTableDialog.js @@ -0,0 +1,77 @@ +import { + WeaDialog, + WeaFormItem, + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, + WeaTable +} from 'ecCom' + +import { + Spin, + Button, +} from 'antd' + +import { + WeaSwitch +} from 'comsMobx' + +import { + i18n +} from '../public/i18n'; + +export default class NewTableDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + width: 800, + } + } + + + + render() { + const { + title, + visible, + onCancel, + loading, + height, + dataSource, + columns + } = this.props, { + width, + } = this.state; + + const buttons = [ + //(), + () + ]; + + return ( + onCancel()} + buttons={buttons} + style={{ width: width, height: height }} + > + { + loading ?
+ +
+ : record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + indentSize={15} + defaultExpandedRowKeys={[1, 2]} + /> + } +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index c9ff330..291fb27 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -23,9 +23,9 @@ export default class CompanyExtend extends React.Component { init = () => { const { companyExtend,company } = this.props; //const {id} = company; - const {hash} = window.location; - let id = hash.replace("[^/]+(?=/$|$)"); - console.log("id",id) + let {hash} = window.location; + hash = hash.split("?")[0]; + let id = hash.match("[^/]+(?=/$|$)")[0]; companyExtend.init(); companyExtend.setId(id); companyExtend.getData(); @@ -221,7 +221,7 @@ export default class CompanyExtend extends React.Component { render() { const { companyExtend } = this.props; - const { loading, detailSelectedKey, tabInfo,topTab,selectedKey } = companyExtend; + const { loading, detailSelectedKey, tabInfo,topTab,selectedKey,date } = companyExtend; // if(!hasRight && !loading){ // return ( diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 6d7bd83..7549a7a 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,3 +1,10 @@ +/** + * @Author: 程亮 + * @Date: 2022-05-18 16:23:32 + * @LastEditTime: 2022-05-19 15:00:16 + * @Description: + * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js + */ import React from 'react' import * as mobx from 'mobx' import { @@ -30,7 +37,9 @@ import { import '../../style/common.less'; +import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; +import { renderLoading } from '../../util'; // 从util文件引入公共的方法 @@ -110,10 +119,23 @@ export default class Company extends React.Component { company } = this.props; - // company.setNeDialogTitle(i18n.label.newcompany()); - // company.setIsNew(true); - // company.setVisible(true); - // company.getForm(); + company.setNeDialogTitle(i18n.label.companyName()); + company.setNewVisible(true); + //company.getTable(); + company.setDialogLoadingStatus(false); + + } + + //联查部门 + select() { + const { + company + } = this.props; + + company.setNeDialogTitle(i18n.label.companyName()); + company.setVisible(true); + //company.getTable(); + company.setDialogLoadingStatus(false); } batchDelete() { @@ -201,8 +223,6 @@ export default class Company extends React.Component { } - - ///spa/organization/static/index.html#/main/organization/companyExtend reRenderColumns(columns) { const { company @@ -217,10 +237,20 @@ export default class Company extends React.Component { if (c.dataIndex == 'compName') { c.render = function (text, record) { return { - window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`,"_blank") + 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() }}>联查部门 + + } + } + }) return columns; } @@ -240,17 +270,12 @@ export default class Company extends React.Component { this.showConfirm('del'); } - - handleSave() { - // const { - // company - // } = this.props; - // const { - // isNew - // } = company; - // isNew && company.save(); - // !isNew && company.edit(); + handleSave() { + const { + company + } = this.props; + company.save(); } getTabBtn() { @@ -334,8 +359,9 @@ export default class Company extends React.Component { company } = this.props; const { - isPanelShow, companyName, conditionNum, visible, condition, form, - tableStore, dataSource, columns,loading + isPanelShow, companyName, conditionNum, visible, condition, form, + tableStore, dataSource, columns, loading, date,nEdialogTitle,dialogLoading, + form1,isEdit,newVisible } = company; @@ -376,17 +402,43 @@ export default class Company extends React.Component { onSearch={() => company.getTableInfo()} onSearchChange={val => this.onSearchChange(val)} /> - record.id} - dataSource={dataSource} childrenColumnName="children" - columns={this.reRenderColumns(columns)} - rowSelection={rowSelection} - indentSize={15} - defaultExpandedRowKeys={[1,2]} - loading={loading} - /> + { + loading ?
+ +
: + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={this.reRenderColumns(columns)} + rowSelection={rowSelection} + indentSize={15} + /> + } + - + company.setVisible(false)} + /> + this.handleSave()} + onCancel={() => company.setNewVisible(false)} + enable={false} //是否开启字段联动 + /> ) } diff --git a/pc4mobx/organization/components/group/Group.js b/pc4mobx/organization/components/group/Group.js index 4e26c0b..c33be85 100644 --- a/pc4mobx/organization/components/group/Group.js +++ b/pc4mobx/organization/components/group/Group.js @@ -174,7 +174,7 @@ export default class Group extends React.Component { group } = this.props; const { - nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey + nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey,date } = group; return ( diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 061c8c6..39ef1cb 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -347,7 +347,7 @@ export default class JobGrade extends React.Component { } = this.props; const { isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = jobGrade; diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index 61dedd5..b570e57 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -347,7 +347,7 @@ export default class JobLevel extends React.Component { } = this.props; const { isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = jobLevel; diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index d078ee6..2cb6601 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -2,7 +2,7 @@ import React from 'react' import * as mobx from 'mobx' import { inject, - observer, + observer } from 'mobx-react' import { WeaTop, @@ -340,7 +340,7 @@ export default class RankScheme extends React.Component { } = this.props; const { isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit + form,dialogLoading,isEdit,date } = rankScheme; return ( diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js index 2fa8554..78f702c 100644 --- a/pc4mobx/organization/components/sequence/Sequence.js +++ b/pc4mobx/organization/components/sequence/Sequence.js @@ -347,7 +347,7 @@ export default class Sequence extends React.Component { } = this.props; const { isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = sequence; diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index f5d6826..768c606 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -23,6 +23,7 @@ const { TableStore } = WeaTableNew; + export class CompanyStore { @observable topMenu = [] @observable rightMenu = []; @@ -30,15 +31,21 @@ export class CompanyStore { @observable columns = []; @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 companyName = ''; @observable conditionNum = 8; @observable ids = ''; //选择行id @observable id = ''; //页面跳转参数id @observable searchConditionLoading = true; @observable visible = false; + @observable newVisible = false; //新增弹窗 @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; @@ -52,6 +59,7 @@ export class CompanyStore { params = { ...this.form.getFormParams(), //companyName: this.companyName, + pageSize:20 }; } else { params = { @@ -128,6 +136,48 @@ export class CompanyStore { } + getForm() { + // 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.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()); + // } + // }); +} + @action getHasRight() { @@ -198,10 +248,12 @@ export class CompanyStore { setVisible(bool) { this.visible = bool; - this.formReset(); - !bool && this.dialogLoadingReset(); } + setDialogLoadingStatus(bool) { + this.dialogLoading = bool; +} + setSearchCondition(searchCondition) { this.searchCondition = searchCondition; @@ -239,4 +291,16 @@ export class CompanyStore { this.loading = bool; } + setNeDialogTitle(title) { + this.nEdialogTitle = title + } + + setCondition(condition) { + this.condition = condition; + } + + setNewVisible(bool) { + this.newVisible = bool; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 85cf6e5..d9b5d30 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -20,7 +20,7 @@ export class CompanyExtendStore { @observable topTab = []; @observable buttons = {}; @observable id = ''; //分部id - @observable date; + @observable date = ''; @observable personalEditTables; diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index adbe001..4705bd9 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -201,7 +201,7 @@ export class RankSchemeStore { @action - getHasRight() { + getHasRight() { Api.getHasRight().then(res => { if (res.code === 200) { res.data.rightMenu && this.setRightMenu(res.data.rightMenu); @@ -292,6 +292,7 @@ export class RankSchemeStore { this.schemeId = schemeId; } + @action setDate(date) { this.date = date; } From 4c2ff27e467b0d0600e196bcb985659321e33f2f Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 23 May 2022 17:28:38 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=88=86=E9=83=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/company.js | 86 +- .../organization/components/NewTableDialog.js | 18 +- .../components/company/CompanyExtend.js | 14 +- .../components/company/company.js | 50 +- pc4mobx/organization/stores/company.js | 164 ++- pc4mobx/organization/stores/companyextend.js | 1098 ++--------------- 6 files changed, 282 insertions(+), 1148 deletions(-) diff --git a/pc4mobx/organization/apis/company.js b/pc4mobx/organization/apis/company.js index 5fa5238..6fb261f 100644 --- a/pc4mobx/organization/apis/company.js +++ b/pc4mobx/organization/apis/company.js @@ -15,43 +15,55 @@ export const getSearchList = (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/level/deleteByIds', { -// 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/level/saveLevel', { -// method: 'POST', -// mode: 'cors', -// headers: { -// 'Content-Type': 'application/json' -// }, -// body: JSON.stringify(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 edit = (params) => { -// return fetch('/api/bs/hrmorganization/level/updateLevel', { -// 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', { @@ -64,13 +76,15 @@ export const updateForbiddenTag = (params) => { }) } -// export const getLevelForm = (params) => { -// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', 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 getTabInfo = (params) => { -// return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params); -// } export const getHasRight = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params); diff --git a/pc4mobx/organization/components/NewTableDialog.js b/pc4mobx/organization/components/NewTableDialog.js index bd7d2dc..ff7f1da 100644 --- a/pc4mobx/organization/components/NewTableDialog.js +++ b/pc4mobx/organization/components/NewTableDialog.js @@ -60,17 +60,13 @@ export default class NewTableDialog extends React.Component { buttons={buttons} style={{ width: width, height: height }} > - { - loading ?
- -
- : record.id} - dataSource={dataSource} childrenColumnName="children" - columns={columns} - indentSize={15} - defaultExpandedRowKeys={[1, 2]} - /> - } + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + indentSize={15} + loading={loading} + defaultExpandedRowKeys={[1, 2]} + /> ) } diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index 291fb27..5ce6162 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -33,17 +33,17 @@ export default class CompanyExtend extends React.Component { getTabChildren = () => { const { companyExtend } = this.props; - let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys } = companyExtend; + let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = companyExtend; let tabChildren = []; tableInfo = toJS(tableInfo); tableInfo && tableInfo.map((t, i) => { - if (tabkey == i) { + if (detailSelectedKey == i) { tabChildren.push( companyExtend.setPersonalEditTables(ref)} + ref={(ref)=>companyExtend.setPersonalEditTables(ref)} showTitle={isEditor} // title={'列表信息'} - // addFirstRow={isEditor} + //addFirstRow={isEditor} columns={t.tabinfo.columns} datas={t.tabinfo.datas} onChange={this.tableEditChange} @@ -131,10 +131,10 @@ export default class CompanyExtend extends React.Component { tableEditChange = (data) => { const { companyExtend } = this.props; - let { tabkey = '0', tableInfo } = companyExtend; + let { detailSelectedKey = '0', tableInfo } = companyExtend; tableInfo = toJS(tableInfo); let d = cloneDeep(tableInfo); - d[Number(tabkey)].tabinfo.datas = data; + d[Number(detailSelectedKey)].tabinfo.datas = data; companyExtend.updateTableInfo(d); } @@ -221,7 +221,7 @@ export default class CompanyExtend extends React.Component { render() { const { companyExtend } = this.props; - const { loading, detailSelectedKey, tabInfo,topTab,selectedKey,date } = companyExtend; + const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = companyExtend; // if(!hasRight && !loading){ // return ( diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 7549a7a..d3ac210 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-19 15:00:16 + * @LastEditTime: 2022-05-23 16:55:22 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -121,20 +121,19 @@ export default class Company extends React.Component { company.setNeDialogTitle(i18n.label.companyName()); company.setNewVisible(true); - //company.getTable(); - company.setDialogLoadingStatus(false); + company.getCompanyForm(); } //联查部门 - select() { + select(id) { const { company } = this.props; company.setNeDialogTitle(i18n.label.companyName()); company.setVisible(true); - //company.getTable(); + company.getDeptTable(id); company.setDialogLoadingStatus(false); } @@ -143,10 +142,9 @@ export default class Company extends React.Component { company } = this.props; const { - tableStore + selectedRowKeys } = company; - - let keys = toJS(tableStore.selectedRowKeys).toString(); + let keys = toJS(selectedRowKeys).toString(); company.setIds(keys); this.showConfirm('batchDel'); } @@ -246,7 +244,7 @@ export default class Company extends React.Component { return { _this.doDel(record.id) }}>删除 - { _this.select() }}>联查部门 + { _this.select(record.id) }}>联查部门 } } @@ -360,15 +358,27 @@ export default class Company extends React.Component { } = this.props; const { isPanelShow, companyName, conditionNum, visible, condition, form, - tableStore, dataSource, columns, loading, date,nEdialogTitle,dialogLoading, - form1,isEdit,newVisible + tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, + form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total } = company; const rowSelection = { onChange(selectedRowKeys, selectedRows) { company.setSelectedRowKeys(selectedRowKeys); + }, + }; + const pagination = { + total: total, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + // company.setCurrent(current); + // company.setPageSize(pageSize); + }, + onChange(current) { + //company.setCurrent(current); }, }; @@ -410,6 +420,12 @@ export default class Company extends React.Component { dataSource={dataSource} childrenColumnName="children" columns={this.reRenderColumns(columns)} rowSelection={rowSelection} + pagination={pagination} + onChange={(pagination, filters, sorter) => { + company.setCurrent(pagination.current); + company.setPageSize(pagination.pageSize); + company.getTableInfo(); + }} indentSize={15} /> } @@ -420,12 +436,12 @@ export default class Company extends React.Component { title={nEdialogTitle} visible={visible} loading={dialogLoading} - height={450} - dataSource = {dataSource} //联查部门数据 - columns= {columns} + height={400} + dataSource={deptDataSource} //联查部门数据 + columns={deptColumns} onCancel={() => company.setVisible(false)} - /> - + this.handleSave()} onCancel={() => company.setNewVisible(false)} enable={false} //是否开启字段联动 - /> + /> ) } diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 768c606..d5dd07f 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -29,6 +29,8 @@ export class CompanyStore { @observable rightMenu = []; @observable dataSource = []; @observable columns = []; + @observable deptDataSource = []; + @observable deptColumns = []; @observable tableStore = new TableStore(); @observable loading = true; @observable dialogLoading = true; @@ -49,20 +51,29 @@ export class CompanyStore { @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; + @observable total = 0; + @observable current = 1; + @observable pageSize = 10; + @action getTableInfo() { - let params; + this.setLoading(true); + let params = { + current:this.current, + pageSize:this.pageSize + } if (this.isEmptyObject(this.form.getFormParams())) { params = { + ...params, ...this.form.getFormParams(), - //companyName: this.companyName, - pageSize:20 + compName: this.companyName, }; } else { params = { + ...params, ...this.form.getFormParams(), }; } @@ -72,6 +83,7 @@ export class CompanyStore { 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); } else { message.warning(res.msg); @@ -81,6 +93,30 @@ export class CompanyStore { }) + + + + } + + @action("联查部门") + getDeptTable(id) { + 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); + } else { + message.warning(res.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } //删除 @@ -88,18 +124,18 @@ export class CompanyStore { let params = { ids: this.ids }; - // Api.deleteTableData(params).then(response => { - // return response.json() - // }).then(data => { - // if (data.code === 200) { - // message.success(i18n.message.deleteSuccess()); - // this.getTableInfo(); - // } else { - // message.warning(data.msg); - // } - // }).catch(error => { - // message.warning(error.msg); - // }) + Api.deleteTableData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.deleteSuccess()); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) } updateForbiddenTag(checked, id) { @@ -136,46 +172,47 @@ export class CompanyStore { } - getForm() { - // 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); - // }) + 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.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()); - // } - // }); + 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()); + } + }); } @@ -195,7 +232,7 @@ save() { updateFields(val) { this.form.updateFields({ - companyName: { + compName: { value: val } }); @@ -242,7 +279,7 @@ save() { formReset() { - this.form = new WeaForm(); + this.form1 = new WeaForm(); } @@ -279,10 +316,18 @@ save() { this.dataSource = dataSource; } + setDeptDataSource(deptDataSource) { + this.deptDataSource = deptDataSource; + } + setColumns(columns) { this.columns = columns } + setDeptColumns(deptColumns) { + this.deptColumns = deptColumns + } + setSelectedRowKeys(selectedRowKeys) { this.selectedRowKeys = selectedRowKeys; } @@ -300,7 +345,20 @@ save() { } setNewVisible(bool) { + this.formReset(); this.newVisible = bool; } + setTotal(total) { + this.total = total; + } + + setCurrent(current) { + this.current = current; + } + + setPageSize(pageSize) { + this.pageSize = pageSize; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index d9b5d30..8b317a2 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -4,6 +4,7 @@ import isEmpty from 'lodash/isEmpty' import { WeaTableNew } from "comsMobx"; import { Modal, message } from "antd"; import { i18n } from "../public/i18n"; +import forEach from 'lodash/forEach' import * as Api from '../apis/company'; // 引入API接口文件 @@ -15,13 +16,14 @@ export class CompanyExtendStore { @observable isNew = true; @observable loading = true; @observable tabInfo = []; - @observable selectedKey = 0; - @observable detailSelectedKey = 0; + @observable selectedKey = '0'; + @observable detailSelectedKey = '0'; @observable topTab = []; @observable buttons = {}; @observable id = ''; //分部id @observable date = ''; @observable personalEditTables; + @observable tabkey = '0' @observable selectedRowKeys = []; @@ -42,10 +44,12 @@ export class CompanyExtendStore { this.getData(); this.getTabInfo(); //this.tabkey = '0'; + this.detailSelectedKey = '0' } init = () => { //this.tabkey = '0'; + this.detailSelectedKey = '0' this.isEditor = false; } @@ -56,9 +60,8 @@ export class CompanyExtendStore { this.form.validateForm().then(f => { if (f.isValid) { if (this.personalEditTables) { - // const targetDatas = this.tableInfo[this.tabkey].tabinfo.datas, - // isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true - let isPass = true; + const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas, + isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true if (isPass) { this.editResource() } else { @@ -77,28 +80,25 @@ export class CompanyExtendStore { editResource = () => { let pDatas = this.form.getFormParams(); - - // API.editResource({ ...{ - // operation: 'editpersonalinfo', - // id: this.hrmId - // }, - // ...pDatas, - // ...this.getTableEditParams() - // }). - // then(data => { - // if (data.status == '1') { - // message.success(i18n.message.saveSuccess()); - // this.init(); - // this.getData(); - // this.selectedRowKeys = []; - // } else { - // message.warning(data.message); - // } - // this.loading = false; - // }, error => { - // message.warning(error.message); - // this.loading = false; - // }) + Api.editResource({ ...{ + id: this.id + }, + ...pDatas, + ...this.getTableEditParams() + }).then(data => { + if (data.code == 200) { + message.success(i18n.message.saveSuccess()); + this.init(); + this.getData(); + this.selectedRowKeys = []; + } else { + message.warning(data.message); + } + this.loading = false; + }, error => { + message.warning(error.message); + this.loading = false; + }) } getTableEditParams = () => { @@ -119,1002 +119,31 @@ export class CompanyExtendStore { - getData = (params) => { - this.loading = true; - params = { - ...params, - viewAttr: this.isEditor ? 2 : 1 + getData = () => { + this.setLoading(true); + let params = { + viewAttr: this.isEditor ? 2 : 1, + id: this.id } - let data = { - "result": { - "tables": [ - { - "tabinfo": { - "rownum": "rownum", - "columns": [ - { - "com": [ - { - "key": "member", - "label": "", - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "quickSearch": false, - "type": "INPUT", - "viewAttr": 1, - "width": "80%" - } - ], - "dataIndex": "member", - "width": "80%%", - "title": "成员", - "key": "member" - }, - { - "com": [ - { - "key": "title", - "label": "", - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "quickSearch": false, - "type": "INPUT", - "viewAttr": 1, - "width": "80%" - } - ], - "dataIndex": "title", - "width": "80%%", - "title": "称谓", - "key": "title" - }, - { - "com": [ - { - "key": "company", - "label": "", - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "quickSearch": false, - "type": "INPUT", - "viewAttr": 1, - "width": "80%" - } - ], - "dataIndex": "company", - "width": "80%%", - "title": "工作单位", - "key": "company" - }, - { - "com": [ - { - "key": "jobtitle", - "label": "", - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "quickSearch": false, - "type": "INPUT", - "viewAttr": 1, - "width": "80%" - } - ], - "dataIndex": "jobtitle", - "width": "80%%", - "title": "职务", - "key": "jobtitle" - }, - { - "com": [ - { - "key": "address", - "label": "", - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "quickSearch": false, - "type": "INPUT", - "viewAttr": 1, - "width": "80%" - } - ], - "dataIndex": "address", - "width": "80%%", - "title": "地址", - "key": "address" - } - ], - "datas": [ - { - "address": "", - "jobtitle": "1", - "member": "1", - "company": "1", - "title": "1" - } - ] - }, - "hide": false, - "tabname": "家庭情况" - } - ], - "buttons": { - "hasSave": true, - "hasEdit": true - }, - "id": "22", - "conditions": [ - { - "hide": false, - "title": "个人信息", - "defaultshow": true, - "items": [ - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "DATEPICKER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "birthday" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "出生日期", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "folk" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "民族", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "nativeplace" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "籍贯", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "regresidentplace" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "户口", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "certificatenum" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "身份证号码", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "SELECT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "maritalstatus" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "key": "0", - "label": "婚姻状况", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "options": [ - { - "disabled": false, - "key": "0", - "selected": true, - "showname": "未婚", - "visible": true - }, - { - "disabled": false, - "key": "1", - "selected": false, - "showname": "已婚", - "visible": true - }, - { - "disabled": false, - "key": "2", - "selected": false, - "showname": "离异", - "visible": true - } - ], - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "0", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "policy" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "政治面貌", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "DATEPICKER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "bememberdate" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "入团日期", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "DATEPICKER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "bepartydate" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "入党日期", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "SELECT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "islabouunion" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "key": "1", - "label": "工会会员", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "options": [ - { - "disabled": false, - "key": "1", - "selected": true, - "showname": "是", - "visible": true - }, - { - "disabled": false, - "key": "0", - "selected": false, - "showname": "否", - "visible": true - } - ], - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "1", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "browserConditionParam": { - "asynLoadAll": false, - "checkStrictly": true, - "completeParams": {}, - "conditionDataParams": {}, - "dataParams": {}, - "defaultCheckStrictly": true, - "defaultExpandedLevel": 0, - "destDataParams": {}, - "expandfirstnode": false, - "handleTypes": "", - "hasAddBtn": false, - "hasAdvanceSerach": true, - "hasBorder": false, - "hasTabConditions": false, - "hideAdvanceSearch": false, - "hideVirtualOrg": false, - "icon": "icon-coms-hrm", - "iconBgcolor": "#217346", - "idSeparator": ",", - "isAutoComplete": 1, - "isDetail": 0, - "isMultCheckbox": false, - "isSingle": true, - "linkUrl": "/spa/hrm/engine.html#/hrmengine/edu?id=", - "mobileLinkUrl": "", - "noOperate": true, - "otherParams": {}, - "pageSize": 10, - "quickSearchName": "", - "replaceDatas": [], - "replaceNotCtrl": false, - "scrollx": false, - "searchParams": {}, - "searchPlaceholder": "", - "showCheckStrictly": true, - "title": "学历", - "type": "30", - "viewAttr": 1 - }, - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "BROWSER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "educationlevel" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "学历", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "degree" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "学位", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "SELECT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "healthinfo" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "key": "0", - "label": "健康状况", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "options": [ - { - "disabled": false, - "key": "0", - "selected": true, - "showname": "优秀", - "visible": true - }, - { - "disabled": false, - "key": "1", - "selected": false, - "showname": "良好", - "visible": true - }, - { - "disabled": false, - "key": "2", - "selected": false, - "showname": "一般", - "visible": true - }, - { - "disabled": false, - "key": "3", - "selected": false, - "showname": "较差", - "visible": true - } - ], - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "0", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUTNUMBER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "height" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "身高(cm)", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "0", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUTNUMBER", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "weight" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "体重(kg)", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "0", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "residentplace" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "现居住地", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "homeaddress" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "家庭联系方式", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - }, - { - "belong": "PC", - "checkbox": false, - "checkboxValue": false, - "colSpan": 2, - "conditionType": "INPUT", - "dateGroup": false, - "defaultDisplayInBar": false, - "detailtype": 1, - "domkey": [ - "tempresidentnumber" - ], - "entSearch": false, - "fieldcol": 12, - "hasBorder": false, - "helpfulTipProps": {}, - "hide": false, - "isBase64": false, - "isQuickSearch": false, - "label": "暂住证号码", - "labelcol": 6, - "length": 0, - "maxFilesNumber": 0, - "maxUploadSize": 0, - "multiSelection": false, - "multiple": false, - "otherParams": { - "inputType": "multilang", - "isBase64": true - }, - "precision": 0, - "secretLimit": false, - "showOrder": 0, - "showTime": false, - "stringLength": 0, - "supportCancel": false, - "tipPosition": "bottom", - "value": "", - "valueList": [], - "viewAttr": 1 - } - ] - } - ], - "topTab": [ - { - "title": "总部信息", - "viewCondition": "1" - } - ] - } - } - // API.getResourceCard(params).then((data) => { - // this.loading = false; - // this.form.initFormFields(data.result.conditions); - // this.conditions = data.result.conditions; - // this.tableInfo = this.handleTable(data.result.tables); - // this.getTabInfo(); - // this.buttons = data.result.buttons; - // this.hrmId = data.result.id; + Api.getCompanyExtendForm(params).then((res) => { + if (res.code === 200) { + res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); + res.data.result.conditions && this.setConditions(res.data.result.conditions); + this.tableInfo = this.handleTable(res.data.result.tables); + this.getTabInfo(); + res.data.result.buttons && this.setButtons(res.data.result.buttons); + res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo); + this.isEditor && this.getSelectedRows(); + this.setLoading(false); - // this.isEditor && this.getSelectedRows(); - // }) - this.loading = false; - this.form.initFormFields(data.result.conditions); - this.conditions = data.result.conditions; - this.tableInfo = this.handleTable(data.result.tables); - this.getTabInfo(); - this.buttons = data.result.buttons; - this.setTopTab(data.result.topTab); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + } @@ -1140,18 +169,27 @@ export class CompanyExtendStore { }) } }) - if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key; + //if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key; + if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key; } setLoading(val) { - this.loading(false); + this.loading = val; } - updateDetailSelectedKey = (key) => { + updateTabKey = (key) => { + this.tabKey = key; + } + + updateDetailSelectedKey =(key) => { this.detailSelectedKey = key; } + updateTableInfo = (data) => { + this.tableInfo = data + } + setSelectedKey = (key) => { this.selectedKey = key; } @@ -1183,5 +221,17 @@ export class CompanyExtendStore { this.id = id; } + setPersonalEditTables = (ref) => { + this.personalEditTables = ref; + } + + setConditions(conditions) { + this.conditions = conditions; + } + + setButtons(buttons) { + this.buttons = buttons; + } + } From 0d449516e28c1aecce74ec56e364a6a526ed5c2a Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 24 May 2022 09:48:57 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E7=BC=96=E5=88=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/staffscheme.js | 64 +++ .../components/company/company.js | 18 +- .../components/staff/StaffScheme.js | 401 ++++++++++++++++++ pc4mobx/organization/index.js | 3 + pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/staffscheme.js | 308 ++++++++++++++ 6 files changed, 788 insertions(+), 10 deletions(-) create mode 100644 pc4mobx/organization/apis/staffscheme.js create mode 100644 pc4mobx/organization/components/staff/StaffScheme.js create mode 100644 pc4mobx/organization/stores/staffscheme.js diff --git a/pc4mobx/organization/apis/staffscheme.js b/pc4mobx/organization/apis/staffscheme.js new file mode 100644 index 0000000..c3fff25 --- /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/scheme/getTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/scheme/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/scheme/save', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/scheme/updateScheme', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getSchemeForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index d3ac210..076708b 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-23 18:54:44 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -374,11 +374,11 @@ export default class Company extends React.Component { showSizeChanger: true, showQuickJumper: true, onShowSizeChange(current, pageSize) { - // company.setCurrent(current); - // company.setPageSize(pageSize); + company.setCurrent(current); + company.setPageSize(pageSize); }, onChange(current) { - //company.setCurrent(current); + company.setCurrent(current); }, }; @@ -421,11 +421,11 @@ export default class Company extends React.Component { columns={this.reRenderColumns(columns)} rowSelection={rowSelection} pagination={pagination} - onChange={(pagination, filters, sorter) => { - company.setCurrent(pagination.current); - company.setPageSize(pagination.pageSize); - company.getTableInfo(); - }} + loading={loading} + // onChange={(pagination, filters, sorter) => { + // debugger + // company.getTableInfo(); + // }} indentSize={15} /> } diff --git a/pc4mobx/organization/components/staff/StaffScheme.js b/pc4mobx/organization/components/staff/StaffScheme.js new file mode 100644 index 0000000..cfc271f --- /dev/null +++ b/pc4mobx/organization/components/staff/StaffScheme.js @@ -0,0 +1,401 @@ +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.newRankScheme()); + 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.editRankScheme()); + staffScheme.setSchemeId(id); + staffScheme.setIsNew(false); + staffScheme.setVisible(true); + staffScheme.getForm(); + } + + 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 b8bc76d..2d85f12 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -12,6 +12,7 @@ import OfficeManage from "./components/office/officeManage"; import CompanyExtend from "./components/company/CompanyExtend" import BranchNumSetting from "./components/branchNumSetting" import Company from "./components/company/company"; +import StaffScheme from "./components/staff/StaffScheme"; import stores from "./stores"; import "./style/index"; @@ -46,6 +47,8 @@ const Routes = ( + + ); diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index ed60974..38d1d82 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -8,6 +8,7 @@ import { SequenceStore } from "./sequence"; import { GroupStore } from "./group"; import {CompanyExtendStore} from "./companyextend"; import {CompanyStore} from "./company" +import {StaffSchemeStore} from "./staffscheme"; module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -19,5 +20,6 @@ module.exports = { sequence: new SequenceStore(), group: new GroupStore(), companyExtend: new CompanyExtendStore(), - company: new CompanyStore() + company: new CompanyStore(), + staffScheme: new StaffSchemeStore() }; diff --git a/pc4mobx/organization/stores/staffscheme.js b/pc4mobx/organization/stores/staffscheme.js new file mode 100644 index 0000000..8e47db1 --- /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 = 2; + @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 From 786bac5aa1fb990687bca68c996983b7d9b35763 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 24 May 2022 10:11:29 +0800 Subject: [PATCH 15/26] =?UTF-8?q?=E7=BC=96=E5=88=B6=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/components/staff/StaffScheme.js | 6 +++--- pc4mobx/organization/public/i18n.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pc4mobx/organization/components/staff/StaffScheme.js b/pc4mobx/organization/components/staff/StaffScheme.js index cfc271f..385fd10 100644 --- a/pc4mobx/organization/components/staff/StaffScheme.js +++ b/pc4mobx/organization/components/staff/StaffScheme.js @@ -109,7 +109,7 @@ export default class StaffScheme extends React.Component { staffScheme } = this.props; - staffScheme.setNeDialogTitle(i18n.label.newRankScheme()); + staffScheme.setNeDialogTitle(i18n.label.newStaffScheme()); staffScheme.setIsNew(true); staffScheme.setVisible(true); staffScheme.getForm(); @@ -246,7 +246,7 @@ export default class StaffScheme extends React.Component { staffScheme } = this.props; - staffScheme.setNeDialogTitle(i18n.label.editRankScheme()); + staffScheme.setNeDialogTitle(i18n.label.ediStaffScheme()); staffScheme.setSchemeId(id); staffScheme.setIsNew(false); staffScheme.setVisible(true); @@ -350,7 +350,7 @@ export default class StaffScheme extends React.Component { onClick={key => this.handleMenuClick(key)} > } iconBgcolor='#217346' loading={true} diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 7de3ef6..0642645 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -130,6 +130,10 @@ export const i18n = { newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), branchNumSetting: () => getLabel(386246, '分部编号设置'), companyName: () => getLabel(385937, '分部'), + + staffName: () => getLabel(385936, '编制方案'), + newStaffScheme: () => getLabel(386246, '新建编制方案'), + ediStaffScheme: () => getLabel(386247, '编辑编制方案'), authorizationGroup: () => getLabel(492, '权限组'), From 5f478dcbfd9de8bd0092c767e99ea5794fc5f55d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 24 May 2022 19:00:33 +0800 Subject: [PATCH 16/26] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=88=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/NewWeaTable.js | 61 +++++++++++++++++++ .../components/company/company.js | 38 ++++++++---- pc4mobx/organization/stores/company.js | 13 ++-- pc4mobx/organization/stores/joblevel.js | 6 +- pc4mobx/organization/style/common.less | 9 ++- 5 files changed, 104 insertions(+), 23 deletions(-) create mode 100644 pc4mobx/organization/components/NewWeaTable.js diff --git a/pc4mobx/organization/components/NewWeaTable.js b/pc4mobx/organization/components/NewWeaTable.js new file mode 100644 index 0000000..c6934c8 --- /dev/null +++ b/pc4mobx/organization/components/NewWeaTable.js @@ -0,0 +1,61 @@ +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, + pagination, + loading, + indentSize + } = this.props + + + return ( + loading ?
+ +
: + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + rowSelection={rowSelection} + pagination={false} + loading={loading} + // onChange={(pagination, filters, sorter) => { + // debugger + // company.getTableInfo(); + // }} + indentSize={indentSize} + /> + ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 076708b..fd68a08 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 18:54:44 + * @LastEditTime: 2022-05-24 14:29:44 * @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文件引入公共的方法 @@ -134,7 +135,7 @@ export default class Company extends React.Component { company.setNeDialogTitle(i18n.label.companyName()); company.setVisible(true); company.getDeptTable(id); - company.setDialogLoadingStatus(false); + company.setDialogLoadingStatus(true); } batchDelete() { @@ -359,7 +360,7 @@ 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; @@ -370,16 +371,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} 条` + } }; @@ -413,21 +416,30 @@ export default class Company extends React.Component { onSearchChange={val => this.onSearchChange(val)} /> { - loading ?
- + init ?
+
: record.id} + loading={loading} dataSource={dataSource} childrenColumnName="children" columns={this.reRenderColumns(columns)} rowSelection={rowSelection} pagination={pagination} - loading={loading} - // onChange={(pagination, filters, sorter) => { - // debugger - // company.getTableInfo(); - // }} + onChange={(pagination, filters, sorter) => { + company.setCurrent(pagination.current); + company.setPageSize(pagination.pageSize); + company.getTableInfo(); + }} indentSize={15} /> + // } diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index d5dd07f..4baecc8 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -51,6 +51,7 @@ export class CompanyStore { @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; + @observable init = true; //是否首次加载 @observable total = 0; @observable current = 1; @observable pageSize = 10; @@ -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.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); + this.init = 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); } 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/style/common.less b/pc4mobx/organization/style/common.less index 5c3fad6..7ebbd2b 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -18,7 +18,12 @@ width: 400px !important; line-height: 30px; } - } + } +} + +.hrm-new-weatable-spin { + text-align: center; + margin-top: 10px; } @@ -47,4 +52,6 @@ padding-left: 25%; } } + + } \ No newline at end of file From bb8920e3a094139ba781af0499adf292bf070095 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 25 May 2022 11:50:31 +0800 Subject: [PATCH 17/26] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=85=AC=E5=8F=B8/?= =?UTF-8?q?=E5=88=86=E9=83=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/company/company.js | 16 ++++++++++------ pc4mobx/organization/stores/company.js | 14 +++++++++----- pc4mobx/organization/stores/companyextend.js | 4 +++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index fd68a08..279c8e5 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-24 14:29:44 + * @LastEditTime: 2022-05-25 11:00:00 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -286,7 +286,7 @@ export default class Company extends React.Component { } = company; const btn = [ - (), + (), (), (), ]; @@ -362,7 +362,7 @@ export default class Company extends React.Component { tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total,current,pageSize,init } = company; - + console.log("init",total) const rowSelection = { onChange(selectedRowKeys, selectedRows) { @@ -370,7 +370,7 @@ export default class Company extends React.Component { }, }; - const pagination = { + let pagination = { current:current, pageSize:pageSize, total: total, @@ -412,14 +412,18 @@ 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)} /> { init ?
: - record.id} + record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`} loading={loading} dataSource={dataSource} childrenColumnName="children" columns={this.reRenderColumns(columns)} diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 4baecc8..a365ad3 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -52,7 +52,7 @@ export class CompanyStore { @observable selectedRowKeys = ''; @observable date = ''; @observable init = true; //是否首次加载 - @observable total = 0; + @observable total = ''; @observable current = 1; @observable pageSize = 10; @@ -70,7 +70,7 @@ export class CompanyStore { params = { ...params, ...this.form.getFormParams(), - compName: this.companyName, + compName: this.companyName }; } else { params = { @@ -82,11 +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.setTotal(res.data.pageInfo.total); + res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list); this.setLoading(false); - this.init = false + this.setInit(false); } else { message.warning(res.msg); } @@ -362,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) { From 3c8f0cbfaf47ce05277cc880fd771ac45a62e9de Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 25 May 2022 14:58:27 +0800 Subject: [PATCH 18/26] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=88=97=E5=AE=9A=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/staff.js | 64 +++ .../components/company/company.js | 3 +- .../components/office/officeManage.js | 17 +- .../components/postionrank/JobGrade.js | 13 + .../components/postionrank/JobLevel.js | 10 + .../components/postionrank/RankScheme.js | 11 + .../components/sequence/Sequence.js | 11 + .../organization/components/staff/Staff.js | 414 ++++++++++++++++++ .../components/staff/StaffScheme.js | 15 +- pc4mobx/organization/index.js | 2 + pc4mobx/organization/public/i18n.js | 5 +- pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/staff.js | 308 +++++++++++++ 13 files changed, 871 insertions(+), 6 deletions(-) create mode 100644 pc4mobx/organization/apis/staff.js create mode 100644 pc4mobx/organization/components/staff/Staff.js create mode 100644 pc4mobx/organization/stores/staff.js diff --git a/pc4mobx/organization/apis/staff.js b/pc4mobx/organization/apis/staff.js new file mode 100644 index 0000000..c3fff25 --- /dev/null +++ b/pc4mobx/organization/apis/staff.js @@ -0,0 +1,64 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/scheme/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/scheme/save', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/scheme/updateScheme', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getSchemeForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 279c8e5..5f0a65f 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-25 11:00:00 + * @LastEditTime: 2022-05-25 13:52:21 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -362,7 +362,6 @@ export default class Company extends React.Component { tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading, form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total,current,pageSize,init } = company; - console.log("init",total) const rowSelection = { onChange(selectedRowKeys, selectedRows) { 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..2a28493 --- /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.ediStaff()); + 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 index 385fd10..9751373 100644 --- a/pc4mobx/organization/components/staff/StaffScheme.js +++ b/pc4mobx/organization/components/staff/StaffScheme.js @@ -253,6 +253,19 @@ export default class StaffScheme extends React.Component { staffScheme.getForm(); } + + custom = () => { + const { + staffScheme + } = this.props, { + tableStore, + } = staffScheme; + + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + + doDel(id) { const { staffScheme @@ -350,7 +363,7 @@ export default class StaffScheme extends React.Component { onClick={key => this.handleMenuClick(key)} > } iconBgcolor='#217346' loading={true} diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 2d85f12..c45c054 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -13,6 +13,7 @@ import CompanyExtend from "./components/company/CompanyExtend" import BranchNumSetting from "./components/branchNumSetting" import Company from "./components/company/company"; import StaffScheme from "./components/staff/StaffScheme"; +import Staff from "./components/staff/Staff"; import stores from "./stores"; import "./style/index"; @@ -49,6 +50,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 0642645..58054a5 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -131,9 +131,12 @@ export const i18n = { branchNumSetting: () => getLabel(386246, '分部编号设置'), companyName: () => getLabel(385937, '分部'), - staffName: () => getLabel(385936, '编制方案'), + staffSchemeName: () => getLabel(385936, '编制方案'), newStaffScheme: () => getLabel(386246, '新建编制方案'), ediStaffScheme: () => getLabel(386247, '编辑编制方案'), + staffName: () => getLabel(385936, '编制上报'), + newStaff: () => getLabel(386246, '新建编制'), + ediStaff: () => getLabel(386247, '编辑编制'), authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index 38d1d82..99abe88 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -9,6 +9,7 @@ import { GroupStore } from "./group"; import {CompanyExtendStore} from "./companyextend"; import {CompanyStore} from "./company" import {StaffSchemeStore} from "./staffscheme"; +import {StaffStore} from "./staff"; module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -21,5 +22,6 @@ module.exports = { group: new GroupStore(), companyExtend: new CompanyExtendStore(), company: new CompanyStore(), - staffScheme: new StaffSchemeStore() + staffScheme: new StaffSchemeStore(), + staff: new StaffStore() }; diff --git a/pc4mobx/organization/stores/staff.js b/pc4mobx/organization/stores/staff.js new file mode 100644 index 0000000..d22ec9a --- /dev/null +++ b/pc4mobx/organization/stores/staff.js @@ -0,0 +1,308 @@ +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 = 2; + @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()); + } + }); + } + + 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.staffId + } + 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({ + 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 From ed3a11e7b68568ee7790d977bd362a3cf82caa69 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 25 May 2022 15:39:34 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/common.js | 25 ++++++ pc4mobx/organization/components/Home.js | 78 +++++++++++++++++++ .../components/staff/StaffScheme.js | 8 ++ pc4mobx/organization/index.js | 42 +++++++++- 4 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 pc4mobx/organization/apis/common.js create mode 100644 pc4mobx/organization/components/Home.js 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/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/staff/StaffScheme.js b/pc4mobx/organization/components/staff/StaffScheme.js index 9751373..28ee2b8 100644 --- a/pc4mobx/organization/components/staff/StaffScheme.js +++ b/pc4mobx/organization/components/staff/StaffScheme.js @@ -253,6 +253,12 @@ export default class StaffScheme extends React.Component { staffScheme.getForm(); } + log = () => { + window.setLogViewProps({ + logSmallType: '3010', + }); + } + custom = () => { const { @@ -265,6 +271,8 @@ export default class StaffScheme extends React.Component { tableStore.tableColSet(true); } + + doDel(id) { const { diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index c45c054..fdcf214 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -1,6 +1,7 @@ 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"; @@ -29,7 +30,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, +// }; From 27c8a11576706bc77115f3159791823b9dc0efde Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 26 May 2022 13:55:26 +0800 Subject: [PATCH 20/26] =?UTF-8?q?=E7=BC=96=E5=88=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/staff.js | 27 +++++----------- pc4mobx/organization/apis/staffscheme.js | 16 +++++----- .../organization/components/NewTableDialog.js | 32 +++++++++++++++---- .../organization/components/NewWeaTable.js | 20 ++++++++---- .../components/company/company.js | 6 ++-- .../organization/components/staff/Staff.js | 10 +++--- pc4mobx/organization/stores/staff.js | 22 ++----------- pc4mobx/organization/stores/staffscheme.js | 2 +- 8 files changed, 66 insertions(+), 69 deletions(-) diff --git a/pc4mobx/organization/apis/staff.js b/pc4mobx/organization/apis/staff.js index c3fff25..adc688e 100644 --- a/pc4mobx/organization/apis/staff.js +++ b/pc4mobx/organization/apis/staff.js @@ -4,11 +4,11 @@ import { } from 'ecCom' export const getSearchList = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/scheme/deleteByIds', { + return fetch('/api/bs/hrmorganization/staff/deleteByIds', { method: 'POST', mode: 'cors', headers: { @@ -19,11 +19,11 @@ export const deleteTableData = (params) => { } export const getAdvanceSearchCondition = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params); } export const add = (params) => { - return fetch('/api/bs/hrmorganization/scheme/save', { + return fetch('/api/bs/hrmorganization/staff/saveStaff', { method: 'POST', mode: 'cors', headers: { @@ -34,7 +34,7 @@ export const add = (params) => { } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateScheme', { + return fetch('/api/bs/hrmorganization/staff/updateStaff', { method: 'POST', mode: 'cors', headers: { @@ -44,21 +44,10 @@ export const edit = (params) => { }) } -export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) -} - -export const getSchemeForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', 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/scheme/getTableBtn', 'GET', 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 index c3fff25..4b866ba 100644 --- a/pc4mobx/organization/apis/staffscheme.js +++ b/pc4mobx/organization/apis/staffscheme.js @@ -4,11 +4,11 @@ import { } from 'ecCom' export const getSearchList = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/scheme/deleteByIds', { + return fetch('/api/bs/hrmorganization/staffplan/deleteByIds', { method: 'POST', mode: 'cors', headers: { @@ -19,11 +19,11 @@ export const deleteTableData = (params) => { } export const getAdvanceSearchCondition = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSearchCondition', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getSearchCondition', 'GET', params); } export const add = (params) => { - return fetch('/api/bs/hrmorganization/scheme/save', { + return fetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', { method: 'POST', mode: 'cors', headers: { @@ -34,7 +34,7 @@ export const add = (params) => { } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateScheme', { + return fetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', { method: 'POST', mode: 'cors', headers: { @@ -45,7 +45,7 @@ export const edit = (params) => { } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', { + return fetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', { method: 'POST', mode: 'cors', headers: { @@ -56,9 +56,9 @@ export const updateForbiddenTag = (params) => { } export const getSchemeForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getSchemeForm', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getForm', 'GET', params); } export const getHasRight = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTableBtn', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getHasRight', 'GET', params); } \ 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 index c6934c8..f0d651c 100644 --- a/pc4mobx/organization/components/NewWeaTable.js +++ b/pc4mobx/organization/components/NewWeaTable.js @@ -34,11 +34,23 @@ export default class NewWeaTable extends React.Component { dataSource, columns, rowSelection, - pagination, loading, indentSize } = this.props + const pagination = { + total: dataSource.length, + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange(current, pageSize) { + }, + onChange(current) { + }, + showTotal(total){ + return `共 ${total} 条` + } + }; + return ( loading ?
@@ -48,12 +60,8 @@ export default class NewWeaTable extends React.Component { dataSource={dataSource} childrenColumnName="children" columns={columns} rowSelection={rowSelection} - pagination={false} + pagination={pagination} loading={loading} - // onChange={(pagination, filters, sorter) => { - // debugger - // company.getTableInfo(); - // }} indentSize={indentSize} /> ) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 5f0a65f..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-25 13:52:21 + * @LastEditTime: 2022-05-26 09:12:59 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -134,8 +134,8 @@ export default class Company extends React.Component { company.setNeDialogTitle(i18n.label.companyName()); company.setVisible(true); - company.getDeptTable(id); company.setDialogLoadingStatus(true); + company.getDeptTable(id); } batchDelete() { @@ -369,7 +369,7 @@ export default class Company extends React.Component { }, }; - let pagination = { + const pagination = { current:current, pageSize:pageSize, total: total, diff --git a/pc4mobx/organization/components/staff/Staff.js b/pc4mobx/organization/components/staff/Staff.js index 2a28493..b482a38 100644 --- a/pc4mobx/organization/components/staff/Staff.js +++ b/pc4mobx/organization/components/staff/Staff.js @@ -217,11 +217,11 @@ export default class Staff extends React.Component { 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)} /> - } - }; + // if (c.dataIndex == 'forbidden_tag') { + // c.render = function(text, record) { + // return _this.updateForbiddenTag(checked,record.id)} /> + // } + // }; }) } diff --git a/pc4mobx/organization/stores/staff.js b/pc4mobx/organization/stores/staff.js index d22ec9a..9a1b4f7 100644 --- a/pc4mobx/organization/stores/staff.js +++ b/pc4mobx/organization/stores/staff.js @@ -36,7 +36,7 @@ export class StaffStore { @observable form = new WeaForm(); @observable form1 = new WeaForm(); @observable staffName = ''; - @observable conditionNum = 2; + @observable conditionNum = 10; @observable ids = ''; //选择行id @observable searchConditionLoading = true; @observable nEdialogTitle = ''; @@ -145,24 +145,6 @@ export class StaffStore { }); } - 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 ? {} : { @@ -170,7 +152,7 @@ export class StaffStore { } this.setDialogLoadingStatus(true); - Api.getSchemeForm(params).then(res => { + Api.getForm(params).then(res => { if (res.code === 200) { this.setDialogLoadingStatus(false); res.data.condition && this.setCondition(res.data.condition); diff --git a/pc4mobx/organization/stores/staffscheme.js b/pc4mobx/organization/stores/staffscheme.js index 8e47db1..00b4a61 100644 --- a/pc4mobx/organization/stores/staffscheme.js +++ b/pc4mobx/organization/stores/staffscheme.js @@ -36,7 +36,7 @@ export class StaffSchemeStore { @observable form = new WeaForm(); @observable form1 = new WeaForm(); @observable schemeName = ''; - @observable conditionNum = 2; + @observable conditionNum = 8; @observable ids = ''; //选择行id @observable searchConditionLoading = true; @observable nEdialogTitle = ''; From 34107bee5509ae24ff7635a0a96a8dbe441626d4 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 26 May 2022 17:28:18 +0800 Subject: [PATCH 21/26] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/job.js | 91 +++ .../components/company/CompanyExtend.js | 19 +- pc4mobx/organization/components/job/Job.js | 531 ++++++++++++++++++ .../organization/components/job/JobExtend.js | 0 .../organization/components/staff/Staff.js | 2 +- pc4mobx/organization/index.js | 2 + pc4mobx/organization/public/i18n.js | 7 +- pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/job.js | 371 ++++++++++++ pc4mobx/organization/stores/jobextend.js | 0 pc4mobx/organization/style/common.less | 4 + 11 files changed, 1021 insertions(+), 10 deletions(-) create mode 100644 pc4mobx/organization/apis/job.js create mode 100644 pc4mobx/organization/components/job/Job.js create mode 100644 pc4mobx/organization/components/job/JobExtend.js create mode 100644 pc4mobx/organization/stores/job.js create mode 100644 pc4mobx/organization/stores/jobextend.js 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/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/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/staff/Staff.js b/pc4mobx/organization/components/staff/Staff.js index b482a38..38f7e08 100644 --- a/pc4mobx/organization/components/staff/Staff.js +++ b/pc4mobx/organization/components/staff/Staff.js @@ -246,7 +246,7 @@ export default class Staff extends React.Component { staff } = this.props; - staff.setNeDialogTitle(i18n.label.ediStaff()); + staff.setNeDialogTitle(i18n.label.editStaff()); staff.setSchemeId(id); staff.setIsNew(false); staff.setVisible(true); diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index fdcf214..876a336 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -15,6 +15,7 @@ import BranchNumSetting from "./components/branchNumSetting" import Company from "./components/company/company"; 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"; @@ -52,6 +53,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 58054a5..f90a0ab 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -130,13 +130,16 @@ export const i18n = { newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), branchNumSetting: () => getLabel(386246, '分部编号设置'), companyName: () => getLabel(385937, '分部'), - staffSchemeName: () => getLabel(385936, '编制方案'), newStaffScheme: () => getLabel(386246, '新建编制方案'), ediStaffScheme: () => getLabel(386247, '编辑编制方案'), staffName: () => getLabel(385936, '编制上报'), newStaff: () => getLabel(386246, '新建编制'), - ediStaff: () => getLabel(386247, '编辑编制'), + editStaff: () => getLabel(386247, '编辑编制'), + jobName: () => getLabel(385936, '岗位'), + newJob: () => getLabel(386246, '新建岗位'), + editJob: () => getLabel(386247, '编辑岗位'), + authorizationGroup: () => getLabel(492, '权限组'), diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index 99abe88..ce67d31 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -10,6 +10,7 @@ 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(), @@ -23,5 +24,6 @@ module.exports = { companyExtend: new CompanyExtendStore(), company: new CompanyStore(), staffScheme: new StaffSchemeStore(), - staff: new StaffStore() + 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/style/common.less b/pc4mobx/organization/style/common.less index 7ebbd2b..1f965bc 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -26,6 +26,10 @@ margin-top: 10px; } +.wea-left-right-layout-right { + overflow: scroll !important; +} + //集团管理 .organization-group { From 211c0e6634ab399836d0a18b648ac2aaf9c40152 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 30 May 2022 09:49:02 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/company/company.js | 70 +++++++-- pc4mobx/organization/components/job/Job.js | 146 +++++++++--------- pc4mobx/organization/stores/company.js | 3 +- pc4mobx/organization/stores/job.js | 21 +-- pc4mobx/organization/style/common.less | 6 + 5 files changed, 152 insertions(+), 94 deletions(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 1f9df79..6711875 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-26 09:12:59 + * @LastEditTime: 2022-05-27 15:05:49 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -25,7 +25,8 @@ import { Modal, Button, message, - Switch + Switch, + Menu, Dropdown, Icon } from 'antd' import { WeaSwitch, @@ -227,6 +228,40 @@ export default class Company extends React.Component { company } = this.props; let _this = this; + // `${columns}` && columns.push({ + // title: '', + // dataIndex: 'ops', + // key: 'ops', + // width: 80, + // className:"wea-table-operates", + // render: ( text, record, index )=> { + // const menu = ( + // + // + // { _this.doDel(record.id) }}>删除 + // + // + // { _this.select(record.id) }}>联查部门 + // + // + // ) + // return ( + // + // + // + // ) + // } + // }); + const menu = ( + + + { _this.doDel(record.id) }}>删除 + + + { _this.select(record.id) }}>联查部门 + + + ) columns.forEach((c, index) => { if (c.dataIndex == 'forbiddenTag') { c.render = function (text, record) { @@ -241,16 +276,27 @@ export default class Company extends React.Component { } } if (c.dataIndex == 'operate') { + c.className = "wea-table-operates" + c.width = 80 c.render = function (text, record) { - return - { _this.doDel(record.id) }}>删除 - - { _this.select(record.id) }}>联查部门 - + const menu = ( + + + { _this.doDel(record.id) }}>删除 + + + { _this.select(record.id) }}>联查部门 + + + ) + return + + } } }) + return columns; } @@ -286,7 +332,7 @@ export default class Company extends React.Component { } = company; const btn = [ - (), + (), (), (), ]; @@ -360,7 +406,7 @@ 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,current,pageSize,init + form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init } = company; const rowSelection = { @@ -370,8 +416,8 @@ export default class Company extends React.Component { }; const pagination = { - current:current, - pageSize:pageSize, + current: current, + pageSize: pageSize, total: total, showSizeChanger: true, showQuickJumper: true, @@ -379,7 +425,7 @@ export default class Company extends React.Component { }, onChange(current) { }, - showTotal(total){ + showTotal(total) { return `共 ${total} 条` } }; diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index 306ece3..c56e93a 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-05-26 16:42:44 + * @LastEditTime: 2022-05-30 09:48:35 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js */ @@ -18,6 +18,7 @@ import { WeaRightMenu, WeaTable, WeaLeftRightLayout, + WeaOrgTree } from 'ecCom' import { Row, @@ -26,7 +27,8 @@ import { Modal, Button, message, - Switch + Switch, + Menu, Dropdown, Icon } from 'antd' import { WeaSwitch, @@ -236,31 +238,34 @@ export default class Job extends React.Component { }; if (c.dataIndex == 'compName') { c.render = function (text, record) { - return { + return { window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") }}>{text} } } if (c.dataIndex == 'operate') { + c.className = "wea-table-operates" + c.width = 80 c.render = function (text, record) { - return - { _this.doDel(record.id) }}>删除 - - { _this.select(record.id) }}>联查部门 - + const menu = ( + + + { _this.doDel(record.id) }}>删除 + + + { _this.select(record.id) }}>联查部门 + + + ) + return + + } } - }) return columns; } - updateForbiddenTag(checked, id) { - const { - job - } = this.props; - job.updateForbiddenTag(checked, id); - } doDel(id) { const { @@ -353,55 +358,60 @@ export default class Job extends React.Component { //左侧树 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
; - } + const { + job + } = this.props; + const { + companysId, + } = job + + let tree = ( + ${i18n.label.organization()}`} + treeNodeClick={this.treeNodeClick} + expandAllChildrenOnSearch={true} + /> + ) + + return tree; + } + + treeNodeClick = (event, ids, nodeids, nodes) => { + const { + job + } = this.props; + const { + form, + companysId + } = job; + const type = event.node.props.type || '0'; + const id = event.node.props.id || ''; + let params = {}; + form.resetConditionValue(); + job.setPanelStatus(false) + // job.tabkey = 'default_3'; + job.nodeType = type; + if (type == '0') { + params['virtualtype'] = companysId; + } + if (type == '1') { + params['subcompanyid1'] = id; + } + if (type == '2') { + params['departmentid'] = id; + } + job.doSearch(params); + } @@ -490,14 +500,6 @@ export default class Job extends React.Component { }} indentSize={15} /> - // } diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index a365ad3..169abd3 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -121,7 +121,7 @@ export class CompanyStore { } //删除 - delete() { + @action delete() { let params = { ids: this.ids }; @@ -149,6 +149,7 @@ export class CompanyStore { }).then(data => { if (data.code === 200) { message.success(data.msg); + this.getTableInfo(); } else { message.warning(data.msg); } diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js index d54bd0d..12d33a3 100644 --- a/pc4mobx/organization/stores/job.js +++ b/pc4mobx/organization/stores/job.js @@ -56,15 +56,17 @@ import { @observable current = 1; @observable pageSize = 10; - @observable defaultShowLeft = true + @observable defaultShowLeft = true; + @observable companysId = 1 @action - getTableInfo() { + getTableInfo(params) { this.setLoading(true); - let params = { + params = { + ...params, current:this.current, pageSize:this.pageSize } @@ -94,12 +96,13 @@ import { } }).catch(error => { message.warning(error.msg); - }) - - - - - + }) + } + + @action("nodetree事件") + doSearch (params){ + this.setInit(true); + this.getTableInfo(params); } @action("联查部门") diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less index 1f965bc..5f506ee 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -31,6 +31,12 @@ } +.wea-table-operates { + width: 70px !important; +} + + + //集团管理 .organization-group { padding-left: 25%; From 24d9f3bc9eb16d25fdbef977427b470656a9d64b Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 30 May 2022 17:11:10 +0800 Subject: [PATCH 23/26] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/components/job/Job.js | 6 +- .../organization/components/job/JobExtend.js | 290 ++++++++++++++++++ pc4mobx/organization/index.js | 4 +- pc4mobx/organization/stores/index.js | 8 +- pc4mobx/organization/stores/jobextend.js | 239 +++++++++++++++ 5 files changed, 540 insertions(+), 7 deletions(-) diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index c56e93a..85a30c0 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-05-30 09:48:35 + * @LastEditTime: 2022-05-30 17:08:21 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js */ @@ -239,7 +239,7 @@ export default class Job extends React.Component { if (c.dataIndex == 'compName') { c.render = function (text, record) { return { - window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") + window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank") }}>{text} } } @@ -368,7 +368,7 @@ export default class Job extends React.Component { let tree = ( { + const { jobExtend,company } = this.props; + //const {id} = company; + 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()}
+ //
+ // ) + // } + + try { + return ( +
+ + + + + {this.getSearchs()} + { + !isEmpty(tabInfo) &&
+ { + jobExtend.updateDetailSelectedKey(v); + }} + /> + {this.getTabChildren()} +
+ } +
+
+
+ +
+ ) + } catch (e) { + return +
{i18n.message.authFailed()}
+
+ } + } + } + + \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 876a336..10abab7 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -15,7 +15,8 @@ import BranchNumSetting from "./components/branchNumSetting" import Company from "./components/company/company"; import StaffScheme from "./components/staff/StaffScheme"; import Staff from "./components/staff/Staff"; -import Job from "./components/job/job"; +import Job from "./components/job/Job"; +import JobExtend from "./components/job/JobExtend"; import stores from "./stores"; import "./style/index"; @@ -54,6 +55,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index ce67d31..678cb77 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -7,10 +7,11 @@ import { OfficeManageStore } from "./officeManage"; import { SequenceStore } from "./sequence"; import { GroupStore } from "./group"; import {CompanyExtendStore} from "./companyextend"; -import {CompanyStore} from "./company" +import {CompanyStore} from "./company"; import {StaffSchemeStore} from "./staffscheme"; import {StaffStore} from "./staff"; -import {JobStore} from "./job" +import {JobStore} from "./job"; +import {JobExtendStore} from "./jobextend"; module.exports = { simpleOrgStore: new SimpleOrgStore(), @@ -25,5 +26,6 @@ module.exports = { company: new CompanyStore(), staffScheme: new StaffSchemeStore(), staff: new StaffStore(), - job: new JobStore() + job: new JobStore(), + jobExtend: new JobExtendStore(), }; diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js index e69de29..de073bc 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -0,0 +1,239 @@ +import { observable, action, toJS } from "mobx"; +import { WeaForm } from "comsMobx"; +import isEmpty from 'lodash/isEmpty' +import { WeaTableNew } from "comsMobx"; +import { Modal, message } from "antd"; +import { i18n } from "../public/i18n"; +import forEach from 'lodash/forEach' +import * as Api from '../apis/job'; // 引入API接口文件 + + +export class JobExtendStore { + @observable form = new WeaForm(); + @observable tableInfo = [] + @observable conditions = []; + @observable isEditor = false; + @observable isNew = true; + @observable loading = true; + @observable tabInfo = []; + @observable selectedKey = '0'; + @observable detailSelectedKey = '0'; + @observable topTab = []; + @observable buttons = {}; + @observable id = ''; //岗位id + @observable date = ''; + @observable personalEditTables; + @observable tabkey = '0' + + + @observable selectedRowKeys = []; + @observable selectedRows = []; + + @action onRowSelect = (keys) => { + this.setSelectedRowKeys(keys); + } + + @action setSelectedRowKeys = (keys) => { + this.selectedRowKeys = keys; + } + + + @action + edit = () => { + this.isEditor = true; + this.getData(); + this.getTabInfo(); + //this.tabkey = '0'; + this.detailSelectedKey = '0' + } + + init = () => { + //this.tabkey = '0'; + this.detailSelectedKey = '0' + this.isEditor = false; + } + + save = () => { + if (this.loading) + return; + this.loading = true; + this.form.validateForm().then(f => { + if (f.isValid) { + if (this.personalEditTables) { + const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas, + isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true + if (isPass) { + this.editResource() + } else { + this.loading = false; + } + } else { + this.editResource(); + } + } else { + f.showErrors(); + this.setDate(new Date()); + this.loading = false; + } + }) + } + + editResource = () => { + let pDatas = this.form.getFormParams(); + Api.editResource({ ...{ + id: this.id + }, + ...pDatas, + ...this.getTableEditParams() + }).then(data => { + if (data.code == 200) { + message.success(i18n.message.saveSuccess()); + this.init(); + this.getData(); + this.selectedRowKeys = []; + } else { + message.warning(data.message); + } + this.loading = false; + }, error => { + message.warning(error.message); + this.loading = false; + }) + } + + getTableEditParams = () => { + const params = {}; + this.tableInfo && this.tableInfo.forEach(t => { + t.tabinfo.datas = t.tabinfo.datas || []; + params[t.tabinfo.rownum] = t.tabinfo.datas.length; + t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => { + !isEmpty(item) && forEach(item, (value, key) => { + Object.assign(params, { + [`${key}_${index}`]: value + }); + }) + }) + }) + return params + } + + + + getData = () => { + this.setLoading(true); + let params = { + viewAttr: this.isEditor ? 2 : 1, + id: this.id, + viewCondition:this.selectedKey + } + Api.getCompanyExtendForm(params).then((res) => { + if (res.code === 200) { + res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); + res.data.result.conditions && this.setConditions(res.data.result.conditions); + this.tableInfo = this.handleTable(res.data.result.tables); + this.getTabInfo(); + res.data.result.buttons && this.setButtons(res.data.result.buttons); + res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo); + this.isEditor && this.getSelectedRows(); + this.setLoading(false); + + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + + + + } + + handleTable = (datas) => { + return datas && datas.map(data => { + const { tabinfo: { columns } } = data; + const length = columns.length; + columns.map(c => { + c.width = `${95 / length}%` + }) + return data + }) + } + + getTabInfo = () => { + this.tabInfo = []; + this.tableInfo && this.tableInfo.forEach((c, idx) => { + if (!c.hide) { + this.tabInfo.push({ + key: `${idx}`, + title: c.tabname, + }) + } + }) + //if (!isEmpty(this.tabInfo)) this.tabkey = this.tabInfo[0].key; + if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key; + } + + setLoading(val) { + this.loading = val; + } + + + updateTabKey = (key) => { + this.tabKey = key; + } + + updateDetailSelectedKey =(key) => { + this.detailSelectedKey = key; + } + + updateTableInfo = (data) => { + this.tableInfo = data + } + + setSelectedKey = (key) => { + this.selectedKey = key; + } + + getSelectedRows = () => { + const selectedRows = []; + this.tableInfo.forEach(t => { + const singleTableRows = []; + t.tabinfo.datas.forEach((data, i) => { + if (data.viewAttr === 1) { + singleTableRows.push(i); + } + }); + selectedRows.push(singleTableRows); + }) + this.selectedRows = selectedRows; + } + + + setTopTab(topTab) { + this.topTab = topTab; + } + + changeData(key) { + this.setSelectedKey(key); + this.getData(); + } + + setId(id) { + this.id = id; + } + + setPersonalEditTables = (ref) => { + this.personalEditTables = ref; + } + + setConditions(conditions) { + this.conditions = conditions; + } + + setButtons(buttons) { + this.buttons = buttons; + } + + +} From 064c40d299f7f75f6af8280e48f1a78a5e5c8325 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 1 Jun 2022 16:22:56 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E5=89=A9=E4=BD=99?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/job.js | 62 +- .../organization/components/NewWeaTable.js | 69 -- .../components/NewWeaTableDialog.js | 71 ++ .../components/company/company.js | 4 +- pc4mobx/organization/components/job/Job.js | 96 ++- .../organization/components/job/JobExtend.js | 7 +- pc4mobx/organization/public/i18n.js | 1 + pc4mobx/organization/stores/job.js | 753 ++++++++++-------- pc4mobx/organization/stores/jobextend.js | 2 +- 9 files changed, 584 insertions(+), 481 deletions(-) delete mode 100644 pc4mobx/organization/components/NewWeaTable.js create mode 100644 pc4mobx/organization/components/NewWeaTableDialog.js diff --git a/pc4mobx/organization/apis/job.js b/pc4mobx/organization/apis/job.js index 6fb261f..6f44f6a 100644 --- a/pc4mobx/organization/apis/job.js +++ b/pc4mobx/organization/apis/job.js @@ -4,8 +4,7 @@ import { } from 'ecCom' export const getSearchList = (params) => { - //return WeaTools.callApi('/api/bs/hrmorganization/comp/listComp', 'POST', params); - return fetch('/api/bs/hrmorganization/comp/listComp', { + return fetch('/api/bs/hrmorganization/job/listPage', { method: 'POST', mode: 'cors', headers: { @@ -15,20 +14,8 @@ export const getSearchList = (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', { + return fetch('/api/bs/hrmorganization/job/deleteByIds', { method: 'POST', mode: 'cors', headers: { @@ -39,11 +26,30 @@ export const deleteTableData = (params) => { } export const getAdvanceSearchCondition = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/job/getSearchCondition', 'GET', params); +} + +export const getHrmListByJobId = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params); +} + +export const getCopyForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params); } export const add = (params) => { - return fetch('/api/bs/hrmorganization/comp/saveBaseComp', { + return fetch('/api/bs/hrmorganization/job/saveBaseForm', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const copy = (params) => { + return fetch('/api/bs/hrmorganization/job/copyJobItem', { method: 'POST', mode: 'cors', headers: { @@ -54,19 +60,11 @@ export const add = (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); + return WeaTools.callApi('/api/bs/hrmorganization/job/updateForm', 'POST', params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { + return fetch('/api/bs/hrmorganization/job/updateForbiddenTagById', { method: 'POST', mode: 'cors', headers: { @@ -76,16 +74,16 @@ export const updateForbiddenTag = (params) => { }) } -export const getCompanyForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompSaveForm', 'GET', params); +export const getJobForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getSaveForm', 'GET', params); } -export const getCompanyExtendForm = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/comp/getCompBaseForm', 'GET', params); +export const getJobExtendForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', 'GET', params); } export const getHasRight = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params); + return WeaTools.callApi('/api/bs/hrmorganization/job/getHasRight', 'GET', params); } \ No newline at end of file diff --git a/pc4mobx/organization/components/NewWeaTable.js b/pc4mobx/organization/components/NewWeaTable.js deleted file mode 100644 index f0d651c..0000000 --- a/pc4mobx/organization/components/NewWeaTable.js +++ /dev/null @@ -1,69 +0,0 @@ -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/NewWeaTableDialog.js b/pc4mobx/organization/components/NewWeaTableDialog.js new file mode 100644 index 0000000..5cb513c --- /dev/null +++ b/pc4mobx/organization/components/NewWeaTableDialog.js @@ -0,0 +1,71 @@ +import { + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, + WeaDialog +} from 'ecCom' + +import { + Spin, + Button, + Pagination +} from 'antd' + +import { + WeaSwitch, + WeaTableNew +} from 'comsMobx' + +import { + i18n +} from '../public/i18n'; + +import '../style/common.less'; + +const WeaTable = WeaTableNew.WeaTable; + +export default class NewWeaTableDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + width: 800, + } + } + + render() { + const { + title, + visible, + onCancel, + height, + tableStore + } = this.props, { + width, + } = this.state; + + const buttons = [ + //(), + () + ]; + + return ( + onCancel()} + buttons={buttons} + style={{ width: width, height: height }} + > + + + ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 6711875..9b07041 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-27 15:05:49 + * @LastEditTime: 2022-06-01 11:51:20 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -40,7 +40,7 @@ import '../../style/common.less'; import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; -import NewWeaTable from '../NewWeaTable'; +import NewWeaTable from '../NewWeaTableDialog'; import { renderLoading } from '../../util'; // 从util文件引入公共的方法 diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index 85a30c0..cebcf15 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-05-30 17:08:21 + * @LastEditTime: 2022-06-01 16:18:15 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js */ @@ -40,9 +40,8 @@ import { import '../../style/common.less'; -import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; -import NewWeaTable from '../NewWeaTable'; +import NewWeaTableDialog from '../NewWeaTableDialog'; import { renderLoading } from '../../util'; // 从util文件引入公共的方法 @@ -82,6 +81,7 @@ export default class Job extends React.Component { } = this.props; job.getTableInfo(); job.getHasRight(); + job.getCopyForm(); } getTopMenuBtns() { @@ -95,10 +95,13 @@ export default class Job extends React.Component { let btns = []; topMenu.map((item, i) => { - if (item.menuFun !== 'batchDelete') { - btns.push(); - } else { + if (item.menuFun === 'batchDelete') { btns.push(); + } else if (item.menuFun === 'copy') { + btns.push(); + } else { + btns.push(); + } }); @@ -125,20 +128,70 @@ export default class Job extends React.Component { job.setNeDialogTitle(i18n.label.jobName()); job.setNewVisible(true); - job.getCompanyForm(); + job.getJobForm(); } - //联查部门 + //联查人员 select(id) { const { job } = this.props; - job.setNeDialogTitle(i18n.label.jobName()); + job.setNeDialogTitle("联查人员"); job.setVisible(true); - job.setDialogLoadingStatus(true); - job.getDeptTable(id); + job.getHrmTable(id); + } + + copy() { + const { + job + } = this.props; + const { + selectedRowKeys + } = job; + let keys = toJS(selectedRowKeys).toString(); + job.setIds(keys); + confirm({ + title: i18n.confirm.defaultTitle(), + content: this.getCopyForm(), + okText: i18n.button.ok(), + cancelText: i18n.button.cancel(), + onOk() { + job.copy() + }, + onCancel() { + return false; + }, + }); + } + + getCopyForm() { + const { + job + } = this.props; + const { + copyCondition, + form2, + } = job; + let formParams = form2.getFormParams(); + const { + isFormInit + } = form2; + let arr = []; + isFormInit && copyCondition.map(c => { + c.items.map((field, index) => { + arr.push( + + {} + + ) + }) + }) + return arr; } batchDelete() { @@ -210,6 +263,13 @@ export default class Job extends React.Component { this[key] && this[key](); } + updateForbiddenTag(checked, id) { + const { + job + } = this.props; + job.updateForbiddenTag(checked, id); + } + onSearchChange(val) { @@ -220,7 +280,7 @@ export default class Job extends React.Component { form } = job; - job.setCompanyName(val); + job.setJobName(val); !this.isEmptyObject(form.getFormParams()) && job.updateFields(val); } @@ -236,7 +296,7 @@ export default class Job extends React.Component { return _this.updateForbiddenTag(checked, record.id)} /> } }; - if (c.dataIndex == 'compName') { + if (c.dataIndex == 'jobName') { c.render = function (text, record) { return { window.open(`/spa/organization/static/index.html#/main/organization/jobExtend/${record.id}`, "_blank") @@ -253,7 +313,7 @@ export default class Job extends React.Component { { _this.doDel(record.id) }}>删除 - { _this.select(record.id) }}>联查部门 + { _this.select(record.id) }}>联查人员 ) @@ -504,13 +564,11 @@ export default class Job extends React.Component {
- job.setVisible(false)} /> this.handleSave()} onCancel={() => job.setNewVisible(false)} enable={false} //是否开启字段联动 diff --git a/pc4mobx/organization/components/job/JobExtend.js b/pc4mobx/organization/components/job/JobExtend.js index 5e95600..ba34a54 100644 --- a/pc4mobx/organization/components/job/JobExtend.js +++ b/pc4mobx/organization/components/job/JobExtend.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-26 14:07:12 - * @LastEditTime: 2022-05-30 17:04:50 + * @LastEditTime: 2022-05-30 17:16:47 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/JobExtend.js */ @@ -21,7 +21,7 @@ @inject('jobExtend') - @inject('company') + @inject('job') @observer export default class JobExtend extends React.Component { @@ -29,8 +29,7 @@ this.init(); } init = () => { - const { jobExtend,company } = this.props; - //const {id} = company; + const { jobExtend,job } = this.props; let {hash} = window.location; hash = hash.split("?")[0]; let id = hash.match("[^/]+(?=/$|$)")[0]; diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index f90a0ab..5832fae 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -141,6 +141,7 @@ export const i18n = { editJob: () => getLabel(386247, '编辑岗位'), + authorizationGroup: () => getLabel(492, '权限组'), allAuthorization: () => getLabel(33363, '全部权限'), diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js index 12d33a3..8a06544 100644 --- a/pc4mobx/organization/stores/job.js +++ b/pc4mobx/organization/stores/job.js @@ -1,374 +1,419 @@ 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, + 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'; - @observable defaultShowLeft = true; - @observable companysId = 1 - - - - - @action - getTableInfo(params) { - this.setLoading(true); +const toJS = mobx.toJS; +const { + TableStore +} = WeaTableNew; + + +export class JobStore { + @observable tableStore = new TableStore(); + @observable topMenu = [] + @observable rightMenu = []; + @observable dataSource = []; + @observable columns = []; + @observable deptDataSource = []; + @observable deptColumns = []; + @observable loading = true; + @observable dialogLoading = true; + @observable isEdit = true; + @observable nEdialogTitle = ''; + @observable searchCondition = []; + @observable condition = []; + @observable copyCondition = []; + @observable isPanelShow = false; //高级搜索面板 + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); //新增主表表单 + @observable form2 = new WeaForm(); //复制表单 + @observable jobName = ''; + @observable conditionNum = 12; + @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; + @observable companysId = 1 + + + + + @action + getTableInfo(params) { + this.setLoading(true); + params = { + ...params, + current: this.current, + pageSize: this.pageSize + } + if (this.isEmptyObject(this.form.getFormParams())) { params = { - ...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("nodetree事件") - doSearch (params){ - this.setInit(true); - this.getTableInfo(params); - } - - @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 + ...params, + ...this.form.getFormParams(), + compName: this.jobName + }; + } else { + params = { + ...params, + ...this.form.getFormParams(), }; - 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.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); } - 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); - }) - + }).catch(error => { + message.warning(error.msg); + }) } - + + @action("nodetree事件") + doSearch(params) { + this.setInit(true); + this.getTableInfo(params); + } + + @action("联查人员") + getHrmTable(id) { + let params = { + jobId: id + } + this.tableStore = new TableStore(); + Api.getHrmListByJobId(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); + }) + } + + 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, 1); + } 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); + }) + } + + + getJobForm() { + let params = {}; + this.setDialogLoadingStatus(true); + Api.getJobForm(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); + }) + } + + @action("复制表单") + getCopyForm() { + let params = {}; + Api.getCopyForm(params).then(res => { + if (res.code === 200) { + res.data && this.setCopyCondition(res.data); + res.data && this.form2.initFormFields(res.data); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + } + + save() { let params = { - ...this.form1.getFormParams() + ...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()); - } + 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); + + copy() { + debugger + let params = { + ids: this.ids, + ...this.form2.getFormParams() + }; + this.form2.validateForm().then(f => { + if (f.isValid) { + Api.copy(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); } else { - message.warning(res.msg); + message.error(data.msg); } - }, error => { + }).catch(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(); + }) + } else { + f.showErrors(); + this.setDate(new Date()); } - } - - 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; + + + @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(); } - - setJobId(jobId) { - this.jobId = jobId; + } + + setJobName(val) { + this.jobName = val; + } + + isEmptyObject(obj) { + for (let key in obj) { + return false; } - - 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 + 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; + } + + setCopyCondition(copyCondition) { + this.copyCondition = copyCondition; + } + + 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 index de073bc..f16c8d7 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -126,7 +126,7 @@ export class JobExtendStore { id: this.id, viewCondition:this.selectedKey } - Api.getCompanyExtendForm(params).then((res) => { + Api.getJobExtendForm(params).then((res) => { if (res.code === 200) { res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); res.data.result.conditions && this.setConditions(res.data.result.conditions); From e2f8c060a6af10c81340524a66e6cd6c3fba3c06 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 1 Jun 2022 17:18:40 +0800 Subject: [PATCH 25/26] =?UTF-8?q?check=E5=8F=8A=E6=93=8D=E4=BD=9C=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/company/company.js | 31 ++++++------------- pc4mobx/organization/components/job/Job.js | 13 +++++--- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 9b07041..fcc0034 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-01 11:51:20 + * @LastEditTime: 2022-06-01 17:15:50 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js */ @@ -252,16 +252,6 @@ export default class Company extends React.Component { // ) // } // }); - const menu = ( - - - { _this.doDel(record.id) }}>删除 - - - { _this.select(record.id) }}>联查部门 - - - ) columns.forEach((c, index) => { if (c.dataIndex == 'forbiddenTag') { c.render = function (text, record) { @@ -281,9 +271,11 @@ export default class Company extends React.Component { c.render = function (text, record) { const menu = ( - - { _this.doDel(record.id) }}>删除 - + { + record.isUsed === 0 ? + { _this.doDel(record.id) }}>删除 + : '' + } { _this.select(record.id) }}>联查部门 @@ -413,6 +405,9 @@ export default class Company extends React.Component { onChange(selectedRowKeys, selectedRows) { company.setSelectedRowKeys(selectedRowKeys); }, + getCheckboxProps: record => ({ + disabled: record.isUsed === 1, // 配置无法勾选的列 + }), }; const pagination = { @@ -481,14 +476,6 @@ 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 index cebcf15..ad7a849 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-01 16:18:15 + * @LastEditTime: 2022-06-01 17:16:00 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js */ @@ -309,9 +309,11 @@ export default class Job extends React.Component { c.render = function (text, record) { const menu = ( - - { _this.doDel(record.id) }}>删除 - + { + record.isUsed === 0 ? + { _this.doDel(record.id) }}>删除 + : '' + } { _this.select(record.id) }}>联查人员 @@ -491,6 +493,9 @@ export default class Job extends React.Component { onChange(selectedRowKeys, selectedRows) { job.setSelectedRowKeys(selectedRowKeys); }, + getCheckboxProps: record => ({ + disabled: record.isUsed === 1, // 配置无法勾选的列 + }), }; const pagination = { From f5afc77283d37250a0faec3dca44ff3d251dfa81 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 2 Jun 2022 16:51:21 +0800 Subject: [PATCH 26/26] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/department.js | 89 +++ .../components/department/NewPopconfirm.js | 92 +++ .../components/department/department.js | 635 ++++++++++++++++++ .../components/department/departmentExtend.js | 282 ++++++++ pc4mobx/organization/components/job/Job.js | 15 +- pc4mobx/organization/index.js | 5 +- pc4mobx/organization/public/i18n.js | 4 +- pc4mobx/organization/stores/company.js | 1 + pc4mobx/organization/stores/department.js | 457 +++++++++++++ .../organization/stores/departmentextend.js | 235 +++++++ pc4mobx/organization/stores/index.js | 5 + pc4mobx/organization/stores/job.js | 42 +- 12 files changed, 1825 insertions(+), 37 deletions(-) create mode 100644 pc4mobx/organization/apis/department.js create mode 100644 pc4mobx/organization/components/department/NewPopconfirm.js create mode 100644 pc4mobx/organization/components/department/department.js create mode 100644 pc4mobx/organization/components/department/departmentExtend.js create mode 100644 pc4mobx/organization/stores/department.js create mode 100644 pc4mobx/organization/stores/departmentextend.js diff --git a/pc4mobx/organization/apis/department.js b/pc4mobx/organization/apis/department.js new file mode 100644 index 0000000..47ddcd6 --- /dev/null +++ b/pc4mobx/organization/apis/department.js @@ -0,0 +1,89 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return fetch('/api/bs/hrmorganization/dept/listPage', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/dept/deleteByIds', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getSearchCondition', 'GET', params); +} + +export const getHrmListByJobId = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params); +} + +export const getCopyForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/dept/saveBaseForm', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const copy = (params) => { + return fetch('/api/bs/hrmorganization/job/copyJobItem', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const editResource = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/updateForm', 'POST', params); +} + +export const updateForbiddenTag = (params) => { + return fetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getDeptForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getSaveForm', 'GET', params); +} + + +export const getDeptExtendForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getDeptBaseForm', 'GET', params); +} + + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/dept/getHasRight', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/department/NewPopconfirm.js b/pc4mobx/organization/components/department/NewPopconfirm.js new file mode 100644 index 0000000..e68370e --- /dev/null +++ b/pc4mobx/organization/components/department/NewPopconfirm.js @@ -0,0 +1,92 @@ +import { + WeaDialog, + WeaFormItem, + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, +} from 'ecCom' + +import { + Spin, + Button, +} from 'antd' + +import { + WeaSwitch +} from 'comsMobx' + +import { + i18n +} from '../../public/i18n'; + +export default class NewPopconfirm extends React.Component { + constructor(props) { + super(props); + this.state = { + width: 700, + } + } + + + getForm() { + const { + condition, + form, + isFormInit, + } = this.props; + + let arr = []; + isFormInit && condition.map(c => { + c.items.map((field, index) => { + arr.push( + {} + ) + }) + }) + return
{arr}
+ } + + render() { + const { + title, + visible, + save, + onCancel, + loading, + height, + } = this.props, { + width, + } = this.state; + + const buttons = [ + (), + () + ]; + + return ( + onCancel()} + buttons={buttons} + style={{ width: width, height: height }} + > + { + loading ?
+ +
+ : this.getForm() + } +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js new file mode 100644 index 0000000..dccdfe1 --- /dev/null +++ b/pc4mobx/organization/components/department/department.js @@ -0,0 +1,635 @@ +/** + * @Author: 程亮 + * @Date: 2022-06-02 09:19:37 + * @LastEditTime: 2022-06-02 16:41:55 + * @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 NewAndEditDialog from '../NewAndEditDialog'; + import NewWeaTableDialog from '../NewWeaTableDialog'; +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.deptManage()); + department.setNewVisible(true); + department.getDeptForm(); + + } + + //联查岗位 + select(id) { + // const { + // department + // } = this.props; + + // department.setNeDialogTitle("联查人员"); + // department.setVisible(true); + // department.getHrmTable(id); + } + + + //合并 + merge(id){ + const { + department + } = this.props; + + department.setNeDialogTitle(i18n.label.mergeDept()); + department.confirmVisible(true); + department.getMergeForm(); + } + + //转移 + transfer(id) { + const { + department + } = this.props; + + department.setNeDialogTitle(i18n.label.mergeDept()); + department.confirmVisible(true); + department.getTransferForm(); + + } + + 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; + } + + 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; + department.updateForbiddenTag(checked, id); + } + + + + 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 = ( + + { + record.isUsed === 0 ? + { _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.save(); + } + + 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 + } = department; + + const rowSelection = { + 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 ( +
+ 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.setCurrent(pagination.current); + department.setPageSize(pagination.pageSize); + department.getTableInfo(); + }} + indentSize={15} + /> + } +
+
+
+ department.setVisible(false)} + /> + this.handleSave()} + onCancel={() => department.setNewVisible(false)} + enable={false} //是否开启字段联动 + /> + this.handleSave()} + onCancel={() => department.setNewVisible(false)} + /> +
+ ) + } + } \ No newline at end of file diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js new file mode 100644 index 0000000..e54a2cb --- /dev/null +++ b/pc4mobx/organization/components/department/departmentExtend.js @@ -0,0 +1,282 @@ +/** + * @Author: 程亮 + * @Date: 2022-06-02 09:20:03 + * @LastEditTime: 2022-06-02 11:40:57 + * @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; + + try { + return ( +
+ + + + + {this.getSearchs()} + { + !isEmpty(tabInfo) &&
+ { + departmentExtend.updateDetailSelectedKey(v); + }} + /> + {this.getTabChildren()} +
+ } +
+
+
+ +
+ ) + } catch (e) { + return +
{i18n.message.authFailed()}
+
+ } + } + } + + \ No newline at end of file diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index ad7a849..f02b16a 100644 --- a/pc4mobx/organization/components/job/Job.js +++ b/pc4mobx/organization/components/job/Job.js @@ -1,9 +1,9 @@ /** * @Author: 程亮 * @Date: 2022-05-26 14:05:59 - * @LastEditTime: 2022-06-01 17:16:00 + * @LastEditTime: 2022-06-02 15:51:37 * @Description: - * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js + * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js */ import React from 'react' import * as mobx from 'mobx' @@ -81,7 +81,7 @@ export default class Job extends React.Component { } = this.props; job.getTableInfo(); job.getHasRight(); - job.getCopyForm(); + job.getCopyForm() } getTopMenuBtns() { @@ -143,12 +143,13 @@ export default class Job extends React.Component { job.getHrmTable(id); } - copy() { + + copy() { const { job } = this.props; const { - selectedRowKeys + selectedRowKeys, } = job; let keys = toJS(selectedRowKeys).toString(); job.setIds(keys); @@ -485,8 +486,8 @@ export default class Job extends React.Component { 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 + form1, isEdit, newVisible,selectedRowKeys, total, current, pageSize, init, + defaultShowLeft,form2 } = job; const rowSelection = { diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index 10abab7..fbfbc1b 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -17,6 +17,8 @@ import StaffScheme from "./components/staff/StaffScheme"; import Staff from "./components/staff/Staff"; import Job from "./components/job/Job"; import JobExtend from "./components/job/JobExtend"; +import Department from "./components/department/department"; +import DepartmentExtendStore from "./components/department/departmentExtend"; import stores from "./stores"; import "./style/index"; @@ -51,7 +53,8 @@ const Routes = ( - + + diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 5832fae..b322bdf 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -139,7 +139,9 @@ export const i18n = { jobName: () => getLabel(385936, '岗位'), newJob: () => getLabel(386246, '新建岗位'), editJob: () => getLabel(386247, '编辑岗位'), - + deptManage: () => getLabel(385936, '部门管理'), + newDept: () => getLabel(386246, '新建部门'), + mergeDept:()=> getLabel(386246, '合并部门'), diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 169abd3..a4e7768 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -130,6 +130,7 @@ export class CompanyStore { }).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); + this.setSelectedRowKeys(''); this.getTableInfo(); } else { message.warning(data.msg); diff --git a/pc4mobx/organization/stores/department.js b/pc4mobx/organization/stores/department.js new file mode 100644 index 0000000..fa19819 --- /dev/null +++ b/pc4mobx/organization/stores/department.js @@ -0,0 +1,457 @@ +import { + observable, + action + } from 'mobx'; + import * as mobx from 'mobx'; + import * as Api from '../apis/department'; // 引入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 DepartmentStore { + @observable tableStore = new TableStore(); + @observable topMenu = [] + @observable rightMenu = []; + @observable dataSource = []; + @observable columns = []; + @observable jobDataSource = []; + @observable jobColumns = []; + @observable loading = true; + @observable dialogLoading = true; + @observable isEdit = true; + @observable nEdialogTitle = ''; + @observable searchCondition = []; + @observable condition = []; + @observable copyCondition = []; + @observable isPanelShow = false; //高级搜索面板 + @observable form = new WeaForm(); + @observable form1 = new WeaForm(); //新增主表表单 + @observable form2 = new WeaForm(); //复制表单 + @observable departmentName = ''; + @observable conditionNum = 8; + @observable ids = ''; //选择行id + @observable id = ''; //页面跳转参数id + @observable searchConditionLoading = true; + @observable visible = false; + @observable newVisible = false; //新增弹窗 + @observable departmentId = ''; + @observable selectedRowKeys = ''; + @observable date = ''; + @observable init = true; //是否首次加载 + @observable total = ''; + @observable current = 1; + @observable pageSize = 10; + + @observable defaultShowLeft = true; + @observable companysId = 1 //集团id + + @observable confirmVisible = false; + @observable confirmLoading = true; + + + @action + getTableInfo(params) { + this.setLoading(true); + params = { + ...params, + current: this.current, + pageSize: this.pageSize + } + if (this.isEmptyObject(this.form.getFormParams())) { + params = { + ...params, + ...this.form.getFormParams(), + departmentName: this.departmentName + }; + } 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("nodetree事件") + doSearch(params) { + this.setInit(true); + this.getTableInfo(params); + } + + @action("联查人员") + getHrmTable(id) { + // let params = { + // departmentId: id + // } + // this.tableStore = new TableStore(); + // Api.getHrmListBydepartmentId(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.setSelectedRowKeys(''); + 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, 1); + } 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); + }) + } + + + getDeptForm() { + let params = {}; + this.setDialogLoadingStatus(true); + Api.getDeptForm(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); + }) + } + + @action("合并部门") + getMergeForm() { + // let params = {}; + // this.setConfirmLoading(true); + // Api.getDeptForm(params).then(res => { + // if (res.code === 200) { + // this.setConfirmLoading(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); + // }) + } + + @action("转移部门") + getTransferForm() { + // let params = {}; + // this.setConfirmLoading(true); + // Api.getDeptForm(params).then(res => { + // if (res.code === 200) { + // this.setConfirmLoading(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); + // }) + } + + @action("复制表单") + getCopyForm() { + let params = {}; + Api.getCopyForm(params).then(res => { + if (res.code === 200) { + res.data && this.setCopyCondition(res.data); + res.data && this.form2.initFormFields(res.data); + } 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()); + } + }); + } + + copy() { + let params = { + ids: this.ids, + ...this.form2.getFormParams() + }; + Api.copy(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.form2 = new WeaForm(); + this.setSelectedRowKeys(''); + } else { + message.error(data.msg); + } + }).catch(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.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(); + } + } + + setDepartmentName(val) { + this.departmentName = 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; + } + + setDepartmentId(departmentId) { + this.departmentId = departmentId; + } + + setDate(date) { + this.date = date; + } + + setTopMenu(topMenu) { + this.topMenu = topMenu; + } + + setRightMenu(rightMenu) { + this.rightMenu = rightMenu; + } + + setDataSource(dataSource) { + this.dataSource = dataSource; + } + + setJobDataSource(jobDataSource) { + this.jobDataSource = jobDataSource; + } + + setColumns(columns) { + this.columns = columns + } + + setJobColumns(jobColumns) { + this.jobColumns = jobColumns + } + + setSelectedRowKeys(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + } + + setLoading(bool) { + this.loading = bool; + } + + setNeDialogTitle(title) { + this.nEdialogTitle = title + } + + setCondition(condition) { + this.condition = condition; + } + + setCopyCondition(copyCondition) { + this.copyCondition = copyCondition; + } + + 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; + } + + setConfirmVisible(confirmVisible) { + this.confirmVisible = confirmVisible; + } + + setConfirmLoading(confirmLoading) { + this.confirmLoading = confirmLoading; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/departmentextend.js b/pc4mobx/organization/stores/departmentextend.js new file mode 100644 index 0000000..d95c3ec --- /dev/null +++ b/pc4mobx/organization/stores/departmentextend.js @@ -0,0 +1,235 @@ +import { observable, action, toJS } from "mobx"; +import { WeaForm } from "comsMobx"; +import isEmpty from 'lodash/isEmpty' +import { WeaTableNew } from "comsMobx"; +import { Modal, message } from "antd"; +import { i18n } from "../public/i18n"; +import forEach from 'lodash/forEach' +import * as Api from '../apis/department'; // 引入API接口文件 + + +export class DepartmentExtendStore { + @observable form = new WeaForm(); + @observable tableInfo = [] + @observable conditions = []; + @observable isEditor = false; + @observable isNew = true; + @observable loading = true; + @observable tabInfo = []; + @observable selectedKey = '0'; + @observable detailSelectedKey = '0'; + @observable topTab = []; + @observable buttons = {}; + @observable id = ''; //部门id + @observable date = ''; + @observable personalEditTables; + @observable tabkey = '0' + + @observable selectedRowKeys = []; + @observable selectedRows = []; + + @action onRowSelect = (keys) => { + this.setSelectedRowKeys(keys); + } + + @action setSelectedRowKeys = (keys) => { + this.selectedRowKeys = keys; + } + + + @action + edit = () => { + this.isEditor = true; + this.getData(); + this.getTabInfo(); + this.detailSelectedKey = '0' + } + + init = () => { + this.detailSelectedKey = '0' + this.isEditor = false; + } + + save = () => { + if (this.loading) + return; + this.loading = true; + this.form.validateForm().then(f => { + if (f.isValid) { + if (this.personalEditTables) { + const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas, + isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true + if (isPass) { + this.editResource() + } else { + this.loading = false; + } + } else { + this.editResource(); + } + } else { + f.showErrors(); + this.setDate(new Date()); + this.loading = false; + } + }) + } + + editResource = () => { + let pDatas = this.form.getFormParams(); + Api.editResource({ ...{ + id: this.id + }, + ...pDatas, + ...this.getTableEditParams() + }).then(data => { + if (data.code == 200) { + message.success(i18n.message.saveSuccess()); + this.init(); + this.getData(); + this.selectedRowKeys = []; + } else { + message.warning(data.message); + } + this.loading = false; + }, error => { + message.warning(error.message); + this.loading = false; + }) + } + + getTableEditParams = () => { + const params = {}; + this.tableInfo && this.tableInfo.forEach(t => { + t.tabinfo.datas = t.tabinfo.datas || []; + params[t.tabinfo.rownum] = t.tabinfo.datas.length; + t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => { + !isEmpty(item) && forEach(item, (value, key) => { + Object.assign(params, { + [`${key}_${index}`]: value + }); + }) + }) + }) + return params + } + + + + getData = () => { + this.setLoading(true); + let params = { + viewAttr: this.isEditor ? 2 : 1, + id: this.id, + viewCondition:this.selectedKey + } + Api.getDeptExtendForm(params).then((res) => { + if (res.code === 200) { + res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); + res.data.result.conditions && this.setConditions(res.data.result.conditions); + this.tableInfo = this.handleTable(res.data.result.tables); + this.getTabInfo(); + res.data.result.buttons && this.setButtons(res.data.result.buttons); + res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo); + this.isEditor && this.getSelectedRows(); + this.setLoading(false); + + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) + + + + + } + + handleTable = (datas) => { + return datas && datas.map(data => { + const { tabinfo: { columns } } = data; + const length = columns.length; + columns.map(c => { + c.width = `${95 / length}%` + }) + return data + }) + } + + getTabInfo = () => { + this.tabInfo = []; + this.tableInfo && this.tableInfo.forEach((c, idx) => { + if (!c.hide) { + this.tabInfo.push({ + key: `${idx}`, + title: c.tabname, + }) + } + }) + if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key; + } + + setLoading(val) { + this.loading = val; + } + + + updateTabKey = (key) => { + this.tabKey = key; + } + + updateDetailSelectedKey =(key) => { + this.detailSelectedKey = key; + } + + updateTableInfo = (data) => { + this.tableInfo = data + } + + setSelectedKey = (key) => { + this.selectedKey = key; + } + + getSelectedRows = () => { + const selectedRows = []; + this.tableInfo.forEach(t => { + const singleTableRows = []; + t.tabinfo.datas.forEach((data, i) => { + if (data.viewAttr === 1) { + singleTableRows.push(i); + } + }); + selectedRows.push(singleTableRows); + }) + this.selectedRows = selectedRows; + } + + + setTopTab(topTab) { + this.topTab = topTab; + } + + changeData(key) { + this.setSelectedKey(key); + this.getData(); + } + + setId(id) { + this.id = id; + } + + setPersonalEditTables = (ref) => { + this.personalEditTables = ref; + } + + setConditions(conditions) { + this.conditions = conditions; + } + + setButtons(buttons) { + this.buttons = buttons; + } + + +} diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index 678cb77..ca257b8 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -8,11 +8,14 @@ import { SequenceStore } from "./sequence"; import { GroupStore } from "./group"; import {CompanyExtendStore} from "./companyextend"; import {CompanyStore} from "./company"; +import {DepartmentStore} from "./department"; +import {DepartmentExtendStore} from "./departmentextend"; import {StaffSchemeStore} from "./staffscheme"; import {StaffStore} from "./staff"; import {JobStore} from "./job"; import {JobExtendStore} from "./jobextend"; + module.exports = { simpleOrgStore: new SimpleOrgStore(), standardOrgStore: new StandardOrgStore(), @@ -24,6 +27,8 @@ module.exports = { group: new GroupStore(), companyExtend: new CompanyExtendStore(), company: new CompanyStore(), + department: new DepartmentStore(), + departmentExtend: new DepartmentExtendStore(), staffScheme: new StaffSchemeStore(), staff: new StaffStore(), job: new JobStore(), diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js index 8a06544..063d4d1 100644 --- a/pc4mobx/organization/stores/job.js +++ b/pc4mobx/organization/stores/job.js @@ -30,8 +30,6 @@ export class JobStore { @observable rightMenu = []; @observable dataSource = []; @observable columns = []; - @observable deptDataSource = []; - @observable deptColumns = []; @observable loading = true; @observable dialogLoading = true; @observable isEdit = true; @@ -63,7 +61,6 @@ export class JobStore { - @action getTableInfo(params) { this.setLoading(true); @@ -134,6 +131,7 @@ export class JobStore { }).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); + this.setSelectedRowKeys(''); this.getTableInfo(); } else { message.warning(data.msg); @@ -236,30 +234,25 @@ export class JobStore { } copy() { - debugger let params = { ids: this.ids, ...this.form2.getFormParams() }; - this.form2.validateForm().then(f => { - if (f.isValid) { - Api.copy(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(data.msg); - this.getTableInfo(); - } else { - message.error(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) + Api.copy(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(data.msg); + this.getTableInfo(); + this.form2 = new WeaForm(); + this.setSelectedRowKeys(''); } else { - f.showErrors(); - this.setDate(new Date()); + message.error(data.msg); } - }); + }).catch(error => { + message.warning(error.msg); + }) + } @@ -363,17 +356,10 @@ export class JobStore { this.dataSource = dataSource; } - setDeptDataSource(deptDataSource) { - this.deptDataSource = deptDataSource; - } - setColumns(columns) { this.columns = columns } - setDeptColumns(deptColumns) { - this.deptColumns = deptColumns - } setSelectedRowKeys(selectedRowKeys) { this.selectedRowKeys = selectedRowKeys;