From 8ca38016a7fc542c2ccc13222a9bf68c8355ee31 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Fri, 21 Oct 2022 14:35:06 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=88=86=E6=9D=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/managerDetach.js | 54 +++
.../components/detach/ManagerDetach.js | 437 ++++++++++++++++++
.../components/postionrank/RankScheme.js | 2 +-
pc4mobx/organization/index.js | 2 +
pc4mobx/organization/public/i18n.js | 3 +-
pc4mobx/organization/stores/index.js | 4 +-
pc4mobx/organization/stores/managerDetach.js | 286 ++++++++++++
pc4mobx/organization/stores/rankscheme.js | 1 -
8 files changed, 785 insertions(+), 4 deletions(-)
create mode 100644 pc4mobx/organization/apis/managerDetach.js
create mode 100644 pc4mobx/organization/components/detach/ManagerDetach.js
create mode 100644 pc4mobx/organization/stores/managerDetach.js
diff --git a/pc4mobx/organization/apis/managerDetach.js b/pc4mobx/organization/apis/managerDetach.js
new file mode 100644
index 0000000..6d001cb
--- /dev/null
+++ b/pc4mobx/organization/apis/managerDetach.js
@@ -0,0 +1,54 @@
+
+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 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/detach/ManagerDetach.js b/pc4mobx/organization/components/detach/ManagerDetach.js
new file mode 100644
index 0000000..cf549ab
--- /dev/null
+++ b/pc4mobx/organization/components/detach/ManagerDetach.js
@@ -0,0 +1,437 @@
+import React from 'react'
+import * as mobx from 'mobx'
+import {
+ inject,
+ observer
+} from 'mobx-react'
+import {
+ WeaTop,
+ WeaTab,
+ WeaFormItem,
+ WeaRightMenu,
+ WeaAlertPage
+} 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';
+import { renderNoright } from '../../util'; // 从util文件引入公共的方法
+
+
+
+const toJS = mobx.toJS;
+const confirm = Modal.confirm;
+const WeaTable = WeaTableNew.WeaTable;
+
+
+@inject('managerDetach')
+@observer
+export default class ManagerDetach extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ }
+
+ componentDidMount() {
+ this.init();
+ }
+
+ componentWillUnmount() {
+ }
+
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ managerDetach
+ } = this.props;
+
+ if (this.props.location.key !== nextProps.location.key) {
+ this.init();
+ }
+ }
+
+ init() {
+ const {
+ managerDetach
+ } = this.props;
+ managerDetach.getHasRight();
+ managerDetach.getTableInfo();
+ }
+
+ getTopMenuBtns() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ topMenu,
+ tableStore
+ } = managerDetach;
+
+ let btns = [];
+ topMenu.map((item, i) => {
+ if (item.menuFun !== 'batchDelete') {
+ btns.push();
+ } else {
+ btns.push();
+ }
+
+ });
+
+ return btns;
+ }
+
+ handleClick(item) {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ isPanelShow
+ } = managerDetach;
+
+ isPanelShow && managerDetach.setPanelStatus(false);
+ this[item.menuFun] && this[item.menuFun]();
+ }
+
+ new() {
+ const {
+ managerDetach
+ } = this.props;
+
+ managerDetach.setNeDialogTitle(i18n.label.newRankScheme());
+ managerDetach.setIsNew(true);
+ managerDetach.setVisible(true);
+ managerDetach.getForm();
+ }
+
+ batchDelete() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ tableStore
+ } = managerDetach;
+
+ let keys = toJS(tableStore.selectedRowKeys).toString();
+ managerDetach.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 {
+ managerDetach
+ } = this.props;
+ managerDetach.delete();
+ }
+
+
+ getDropMenuDatas() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ rightMenu
+ } = managerDetach;
+
+ 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 {
+ managerDetach
+ } = this.props;
+ const {
+ isPanelShow
+ } = managerDetach;
+
+ isPanelShow && managerDetach.setPanelStatus(false);
+ this[key] && this[key]();
+ }
+
+ getTabBtn() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ form2
+ } = managerDetach;
+
+ const btn = [
+ (),
+ (),
+ (),
+ ];
+
+ return btn;
+ }
+
+ custom = () => {
+ const {
+ managerDetach
+ } = this.props, {
+ tableStore,
+ } = managerDetach;
+
+ tableStore.setColSetVisible(true);
+ tableStore.tableColSet(true);
+ }
+
+ onSearchChange(val) {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ form2
+ } = managerDetach;
+
+ managerDetach.setSchemeName(val);
+ !this.isEmptyObject(form2.getFormParams()) && managerDetach.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 {
+ managerDetach
+ } = this.props;
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ managerDetach.updateForbiddenTag(checked, id);
+ },
+ onCancel() {
+ return false;
+ },
+ });
+
+ }
+
+ onOperatesClick(record, rowIndex, operate) {
+ const {
+ index
+ } = operate;
+ (index == '0') && this.doEdit(record.randomFieldId);
+ (index == '1') && this.doDel(record.randomFieldId);
+
+ }
+
+ doEdit(id) {
+ const {
+ managerDetach
+ } = this.props;
+
+ managerDetach.setNeDialogTitle(i18n.label.editRankScheme());
+ managerDetach.setSchemeId(id);
+ managerDetach.setIsNew(false);
+ managerDetach.setVisible(true);
+ managerDetach.getForm();
+ }
+
+ doDel(id) {
+ const {
+ managerDetach
+ } = this.props;
+ managerDetach.setIds(id);
+ this.showConfirm('del');
+ }
+
+
+ log = () => {
+ window.setLogViewProp({
+ logMoudleType: 1,
+ keys: new Date().getTime(),
+ });
+ }
+
+
+ handleSave() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ isNew
+ } = managerDetach;
+
+ isNew && managerDetach.save();
+ !isNew && managerDetach.edit();
+ }
+
+ getPanelComponents() {
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ searchCondition,
+ form2,
+ searchConditionLoading
+ } = managerDetach;
+
+ 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") {
+ managerDetach.getTableInfo();
+ managerDetach.setPanelStatus(false)
+ }
+ }}>{arr}
+ }
+
+ }
+
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+
+ render() {
+
+ const {
+ managerDetach
+ } = this.props;
+ const {
+ isPanelShow, form2, schemeName, conditionNum, tableStore, nEdialogTitle, visible, condition,
+ form, dialogLoading, isEdit, date, hasRight
+ } = managerDetach;
+
+ if (hasRight === false) {
+ return renderNoright();
+ }
+
+ return (
+ hasRight &&
+
this.handleMenuClick(key)}
+ >
+ }
+ iconBgcolor='#217346'
+ loading={true}
+ buttons={this.getTopMenuBtns()}
+ showDropIcon={true}
+ dropMenuDatas={this.getDropMenuDatas()}
+ onDropMenuClick={(e) => this.handleMenuClick(e)}
+ >
+ managerDetach.setPanelStatus(bool)}
+ hideSearchAd={() => managerDetach.setPanelStatus(false)}
+ searchsAd={isPanelShow ? this.getPanelComponents() : }
+ advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
+ hasMask={false}
+ buttonsAd={this.getTabBtn()}
+ onSearch={() => managerDetach.getTableInfo()}
+ onSearchChange={val => this.onSearchChange(val)}
+ />
+ this.reRenderColumns(c)}
+ onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
+ />
+
+
+
this.handleSave()}
+ onCancel={() => managerDetach.setVisible(false)}
+ />
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js
index efe0e7c..4ea0567 100644
--- a/pc4mobx/organization/components/postionrank/RankScheme.js
+++ b/pc4mobx/organization/components/postionrank/RankScheme.js
@@ -51,7 +51,7 @@ export default class RankScheme extends React.Component {
}
componentDidMount() {
- this.init();
+ this.init();
}
componentWillUnmount() {
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 11feb4c..e12005d 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -32,6 +32,7 @@ import NewImport from "./components/newImport"
import StaffWorkflowSet from "./components/staff/StaffWorkflowSet"
import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
import ResourceCard from "./components/resource/ResourceCard";
+import ManagerDetach from "./components/detach/ManagerDetach";
import stores from "./stores";
import "./style/index";
@@ -96,6 +97,7 @@ const Routes = (
+
);
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 9b4c907..8c00f7d 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -163,7 +163,8 @@ export const i18n = {
newResourceBasicType: () => getLabel(386246, '新建人员资料类型'),
editResourceBasicInfo: () => getLabel(386246, '编辑人员资料'),
editResourceBasicType: () => getLabel(386246, '编辑人员资料类型'),
- forbidden: () => getLabel('531114', '已禁用'),
+ forbidden: () => getLabel(531114, '已禁用'),
+ mangerDetachName: () => getLabel(385936, '模块管理分权'),
authorizationGroup: () => getLabel(492, '权限组'),
allAuthorization: () => getLabel(33363, '全部权限'),
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index 83502fe..6e300ed 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -26,6 +26,7 @@ import {NewImportStore} from "./newImport";
import {ResourceBasicInfoStore} from "./reserouseBasicInfo";
import {ImportDialogStore} from "./importDialog";
import {ResourceCardStore} from "./resourceCard";
+import {ManagerDetachStore} from "./managerDetach";
module.exports = {
@@ -56,5 +57,6 @@ module.exports = {
newImport: new NewImportStore(),
resourceBasicInfo: new ResourceBasicInfoStore(),
importDialog: new ImportDialogStore(),
- resourceCard:new ResourceCardStore()
+ resourceCard:new ResourceCardStore(),
+ managerDetach: new ManagerDetachStore()
};
diff --git a/pc4mobx/organization/stores/managerDetach.js b/pc4mobx/organization/stores/managerDetach.js
new file mode 100644
index 0000000..623884d
--- /dev/null
+++ b/pc4mobx/organization/stores/managerDetach.js
@@ -0,0 +1,286 @@
+import {
+ observable,
+ action
+} from 'mobx';
+import * as mobx from 'mobx';
+import * as Api from '../apis/managerDetach';
+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 ManagerDetachStore {
+ @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 managerName = '';
+ @observable conditionNum = 2;
+ @observable ids = ''; //选择行id
+ @observable searchConditionLoading = true;
+ @observable nEdialogTitle = '';
+ @observable visible = false;
+ @observable dialogLoading = true;
+ @observable detachId = '';
+ @observable date = '';
+ @observable hasRight = '';
+
+ @action("列表数据加载") getTableInfo(isOnChange = false) {
+ let params;
+ const { current } = this.tableStore;
+ if (this.isEmptyObject(this.form2.getFormParams())) {
+ params = {
+ ...this.form2.getFormParams(),
+ managerName: this.managerName
+ };
+ } else {
+ params = {
+ ...this.form2.getFormParams()
+ };
+ }
+ Api.getSearchList(params).then(res => {
+ if (res.code === 200) {
+ this.setHasRight(res.data.hasRight);
+ isOnChange ? this.tableStore.getDatas(res.data.datas, current) : this.tableStore.getDatas(res.data.datas,1);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+
+ }
+
+ @action("数据删除") delete() {
+ let params = {
+ ids: this.ids
+ };
+ Api.deleteTableData(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ this.getTableInfo();
+ message.success(i18n.message.deleteSuccess());
+ } else {
+ message.warning(data.msg);
+ }
+ })
+ .catch(error => {
+ message.warning(error.msg);
+ })
+ }
+
+ @action("新建删除") 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());
+ }
+ });
+ }
+
+ @action("编辑保存") edit() {
+ let params = { ...this.form.getFormParams(), id: this.detachId };
+ 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(true);
+ this.setVisible(false);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ }
+ });
+ }
+
+
+ @action("新建编辑表单") getForm() {
+ let params = this.isNew ? {} : {
+ id: this.detachId
+ }
+ 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);
+ })
+
+ }
+
+ @action("高级搜索") 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({
+ managerName: {
+ value: val
+ }
+ });
+ }
+
+ setSearchCondition(condition) {
+ this.searchCondition = condition;
+ }
+
+ setScLoadingStatus(bool) {
+ this.searchConditionLoading = bool;
+ }
+
+ setPanelStatus(bool) {
+ this.isPanelShow = bool;
+ bool && this.getSearchCondition();
+ if (!bool) {
+ this.scLoadingReset();
+ }
+ }
+
+ setManagerName(val) {
+ this.managerName = 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;
+ }
+
+ setDetachId(detachId) {
+ this.detachId = detachId;
+ }
+
+ setDate(date) {
+ this.date = date;
+ }
+
+ setTopMenu(topMenu) {
+ this.topMenu = topMenu;
+ }
+
+ setRightMenu(rightMenu) {
+ this.rightMenu = rightMenu;
+ }
+
+ setHasRight(bool) {
+ this.hasRight = bool;
+ }
+
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js
index a61d18b..5891ddb 100644
--- a/pc4mobx/organization/stores/rankscheme.js
+++ b/pc4mobx/organization/stores/rankscheme.js
@@ -295,7 +295,6 @@ export class RankSchemeStore {
this.schemeId = schemeId;
}
- @action
setDate(date) {
this.date = date;
}
From f9cb61f1408c3e23c0e6b536ef9863f9ac4a5b0f Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Fri, 21 Oct 2022 14:40:47 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=88=86=E6=9D=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/stores/managerDetach.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pc4mobx/organization/stores/managerDetach.js b/pc4mobx/organization/stores/managerDetach.js
index 623884d..d7ad9df 100644
--- a/pc4mobx/organization/stores/managerDetach.js
+++ b/pc4mobx/organization/stores/managerDetach.js
@@ -71,7 +71,7 @@ export class ManagerDetachStore {
}
- @action("数据删除") delete() {
+ @action("批量删除") delete() {
let params = {
ids: this.ids
};