From 72a3d27b16962a2168d2a2287c37679225934e29 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Fri, 4 Aug 2023 17:49:42 +0800
Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/company/CompanyExtend.js | 17 +++++++++++------
.../components/department/departmentExtend.js | 14 ++++++++++----
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js
index 9ae029f..ab0ccab 100644
--- a/pc4mobx/organization/components/company/CompanyExtend.js
+++ b/pc4mobx/organization/components/company/CompanyExtend.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-18 14:52:39
- * @LastEditTime: 2023-07-26 18:59:02
+ * @LastEditTime: 2023-08-04 16:52:47
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js
*/
@@ -28,11 +28,16 @@ import AttachToNumberField from "../NewNumberField";
export default class CompanyExtend extends React.Component {
componentDidMount() {
- this.init();
+ this.handleHashChange();
+ window.addEventListener('hashchange', this.handleHashChange);
}
- init = () => {
+
+ componentWillUnmount() {
+ window.removeEventListener('hashchange', this.handleHashChange);
+ }
+
+ handleHashChange = () => {
const { companyExtend, company } = this.props;
- //const {id} = company;
let { hash } = window.location;
hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0];
@@ -129,7 +134,7 @@ export default class CompanyExtend extends React.Component {
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
- {field.domkey[0] == 'subcompanycode' && }
+ {field.domkey[0] == 'subcompanycode' && isEditor &&}
),
colSpan: 1
});
@@ -231,7 +236,7 @@ export default class CompanyExtend extends React.Component {
}
backCard = () => {
- this.init();
+ this.handleHashChange();
}
view = () => {
diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js
index c230801..3dc6f6f 100644
--- a/pc4mobx/organization/components/department/departmentExtend.js
+++ b/pc4mobx/organization/components/department/departmentExtend.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-02 09:20:03
- * @LastEditTime: 2023-07-26 18:59:14
+ * @LastEditTime: 2023-08-04 16:51:56
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js
*/
@@ -29,9 +29,15 @@ import '../../style/common.less';
export default class DepartmentExtendStore extends React.Component {
componentDidMount() {
- this.init();
+ this.handleHashChange();
+ window.addEventListener('hashchange', this.handleHashChange);
}
- init = () => {
+
+ componentWillUnmount() {
+ window.removeEventListener('hashchange', this.handleHashChange);
+ }
+
+ handleHashChange = () => {
const { departmentExtend, department } = this.props;
let { hash } = window.location;
hash = hash.split("?")[0];
@@ -242,7 +248,7 @@ export default class DepartmentExtendStore extends React.Component {
}
backCard = () => {
- this.init();
+ this.handleHashChange();
}
changeData(key) {