From 0cc7debe396b586239e28066d7b4017a76ad8058 Mon Sep 17 00:00:00 2001 From: cuiwenlong7 Date: Fri, 22 Apr 2022 18:09:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20detail=E3=80=81=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=A1=B9=E3=80=81steps=E5=A2=9E=E5=8A=A0loadPageList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/common.tsx | 2 ++ src/components/detail/custom/index.tsx | 2 +- src/components/detail/group/index.tsx | 1 + src/components/detail/table/index.tsx | 2 ++ src/components/formFields/any/index.tsx | 3 +++ src/components/formFields/common.tsx | 2 ++ src/components/formFields/custom/index.tsx | 6 ++++-- src/components/formFields/form/index.tsx | 1 + src/components/formFields/group/index.tsx | 1 + src/components/formFields/importSubform/index.tsx | 1 + src/components/formFields/object/index.tsx | 1 + src/components/formFields/tabs/index.tsx | 1 + src/components/tableColumns/custom/index.tsx | 2 +- src/main.tsx | 5 +++++ src/steps/common.tsx | 2 ++ src/steps/detail/index.tsx | 1 + src/steps/filter/index.tsx | 1 + src/steps/form/index.tsx | 2 ++ src/steps/header/index.tsx | 2 ++ src/steps/table/index.tsx | 2 ++ src/util/operation.tsx | 6 +++++- 21 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/components/detail/common.tsx b/src/components/detail/common.tsx index 81eed86..889933c 100644 --- a/src/components/detail/common.tsx +++ b/src/components/detail/common.tsx @@ -4,6 +4,7 @@ import { ColumnsConfig, ParamConfig } from '../../interface' import { DetailFieldConfigs as getFieldConfigs } from './' import ParamHelper from '../../util/param' import { CCMSConfig } from '../../main' +import { TreeSelectFieldOption } from '../formFields/treeSelect' /** * 详情页表单项基类配置文件格式定义 @@ -93,6 +94,7 @@ export interface DetailFieldProps { baseRoute: string, loadDomain: (domain: string) => Promise loadPageConfig: (pageID: any) => Promise + loadPageList: () => Promise> handlePageRedirect: (path: string) => void checkPageAuth: (pageID: any) => Promise onUnmount: (reload?: boolean, data?: any) => Promise diff --git a/src/components/detail/custom/index.tsx b/src/components/detail/custom/index.tsx index 19a582f..a11553e 100644 --- a/src/components/detail/custom/index.tsx +++ b/src/components/detail/custom/index.tsx @@ -40,7 +40,7 @@ export default class CustomDtail extends DetailField Promise} loadPageFrameURL={this.props.loadPageFrameURL as (pageID: any) => Promise} loadPageConfig={this.props.loadPageConfig as (pageID: any) => Promise} + loadPageList={this.props.loadPageList} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} onMount={() => { diff --git a/src/components/formFields/any/index.tsx b/src/components/formFields/any/index.tsx index 996a04c..e7a4a8a 100644 --- a/src/components/formFields/any/index.tsx +++ b/src/components/formFields/any/index.tsx @@ -100,6 +100,7 @@ export default class AnyField extends Field : ( type === 'number' @@ -121,6 +122,7 @@ export default class AnyField extends Field : {}} @@ -140,6 +142,7 @@ export default class AnyField extends Field) })} diff --git a/src/components/formFields/common.tsx b/src/components/formFields/common.tsx index c6118a3..011d05d 100644 --- a/src/components/formFields/common.tsx +++ b/src/components/formFields/common.tsx @@ -7,6 +7,7 @@ import { updateCommonPrefixItem } from '../../util/value' import { ConditionConfig } from '../../util/condition' import { StatementConfig } from '../../util/statement' import { isEqual, get } from 'lodash' +import { TreeSelectFieldOption } from './treeSelect' /** * 表单项基类配置文件格式定义 @@ -99,6 +100,7 @@ export interface FieldProps { onReportFields?: (field: string) => Promise // 向父组件上报依赖字段 1.3.0新增 step: { [field: string]: any } // 传递formValue loadDomain: (domain: string) => Promise + loadPageList: () => Promise> } /** diff --git a/src/components/formFields/custom/index.tsx b/src/components/formFields/custom/index.tsx index 672607e..a0d81df 100644 --- a/src/components/formFields/custom/index.tsx +++ b/src/components/formFields/custom/index.tsx @@ -49,7 +49,7 @@ export default class CustomField extends Field imple if (snapshot.includes('entry')) { this.loadCustomField(this.props.config.entry) } else { - if (this.customField && this.customField.update) { + if (this.customField && this.customField.update && this.customField.getStatus && this.customField.getStatus() === 'UPDATING') { this.customField.update({ value: this.props.value, record: this.props.record, @@ -64,9 +64,10 @@ export default class CustomField extends Field imple onValueListSplice: this.props.onValueListSplice, base: this.props.baseRoute, loadDomain: this.props.loadDomain, + loadPageList: this.props.loadPageList, bindValidate: this.bindValidate, bindGet: this.bindGet - }); + }) } } } @@ -93,6 +94,7 @@ export default class CustomField extends Field imple onValueListSplice: this.props.onValueListSplice, base: this.props.baseRoute, loadDomain: this.props.loadDomain, + loadPageList: this.props.loadPageList, bindValidate: this.bindValidate, bindGet: this.bindGet } diff --git a/src/components/formFields/form/index.tsx b/src/components/formFields/form/index.tsx index cbf19b9..f5c0f57 100644 --- a/src/components/formFields/form/index.tsx +++ b/src/components/formFields/form/index.tsx @@ -521,6 +521,7 @@ export default class FormField extends Field await this.props.loadDomain(domain)} containerPath={getChainPath(this.props.containerPath, this.props.config.field, index)} onReportFields={async (field: string) => await this.handleReportFields(field)} + loadPageList={async () => await this.props.loadPageList()} /> ) }) diff --git a/src/components/formFields/group/index.tsx b/src/components/formFields/group/index.tsx index d5fc658..57a0d70 100644 --- a/src/components/formFields/group/index.tsx +++ b/src/components/formFields/group/index.tsx @@ -344,6 +344,7 @@ export default class GroupField extends Field await this.props.loadDomain(domain)} containerPath={getChainPath(this.props.containerPath, this.props.config.field)} onReportFields={async (field: string) => await this.handleReportFields(field)} + loadPageList={async () => await this.props.loadPageList()} /> ) } diff --git a/src/components/formFields/importSubform/index.tsx b/src/components/formFields/importSubform/index.tsx index e16aa67..50d51e9 100644 --- a/src/components/formFields/importSubform/index.tsx +++ b/src/components/formFields/importSubform/index.tsx @@ -455,6 +455,7 @@ export default class ImportSubformField extends Field await this.props.loadDomain(domain)} containerPath={getChainPath(this.props.containerPath, this.props.config.field)} onReportFields={async (field: string) => await this.handleReportFields(field)} + loadPageList={async () => await this.props.loadPageList()} /> ) } diff --git a/src/components/formFields/object/index.tsx b/src/components/formFields/object/index.tsx index b43626a9..3f0eaab 100644 --- a/src/components/formFields/object/index.tsx +++ b/src/components/formFields/object/index.tsx @@ -485,6 +485,7 @@ export default class ObjectField extends Field this.props.loadDomain(domain)} containerPath={getChainPath(this.props.containerPath, this.props.config.field, key)} onReportFields={async (field: string) => await this.handleReportFields(field)} + loadPageList={async () => await this.props.loadPageList()} /> ) }) diff --git a/src/components/formFields/tabs/index.tsx b/src/components/formFields/tabs/index.tsx index 8993b5e..b6316cb 100644 --- a/src/components/formFields/tabs/index.tsx +++ b/src/components/formFields/tabs/index.tsx @@ -398,6 +398,7 @@ export default class TabsField extends Field await this.props.loadDomain(domain)} containerPath={getChainPath(this.props.containerPath, this.props.config.field, tab.field)} onReportFields={async (field: string) => await this.handleReportFields(field)} + loadPageList={async () => await this.props.loadPageList()} /> ) })} diff --git a/src/components/tableColumns/custom/index.tsx b/src/components/tableColumns/custom/index.tsx index dbfff51..094bddd 100644 --- a/src/components/tableColumns/custom/index.tsx +++ b/src/components/tableColumns/custom/index.tsx @@ -31,7 +31,7 @@ export default class CustomColumn extends Column im if (snapshot.includes('entry')) { this.loadCustomColumn(this.props.config.entry) } else { - if (this.customColumn && this.customColumn.update) { + if (this.customColumn && this.customColumn.update && this.customColumn.getStatus && this.customColumn.getStatus() === 'UPDATING') { this.customColumn.update({ value: this.props.value, record: this.props.record, diff --git a/src/main.tsx b/src/main.tsx index 9097913..7bed1a1 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -3,6 +3,8 @@ import marked from 'marked' import Step, { StepProps } from './steps/common' import StepComponents, { StepConfigs } from './steps' import { RichStringConfig } from './interface' +import { TreeSelectFieldOption } from './components/formFields/treeSelect' + /** * 页面配置文件格式定义 * - basic: 页面基本配置 @@ -45,6 +47,7 @@ export interface CCMSProps { loadPageURL: (pageID: any) => Promise loadPageFrameURL: (pageID: any) => Promise loadPageConfig: (pageID: any) => Promise + loadPageList: () => Promise> loadDomain: (domain: string) => Promise handlePageRedirect?: (path: string, replaceHistory: boolean) => void callback: (success: boolean) => void @@ -233,6 +236,7 @@ export default class CCMS extends React.Component { loadPageURL, loadPageFrameURL, loadPageConfig, + loadPageList, loadDomain, handlePageRedirect } = this.props @@ -275,6 +279,7 @@ export default class CCMS extends React.Component { loadPageURL, loadPageFrameURL, loadPageConfig, + loadPageList, loadDomain, handlePageRedirect, handleFormValue diff --git a/src/steps/common.tsx b/src/steps/common.tsx index a9a0d61..fec990b 100644 --- a/src/steps/common.tsx +++ b/src/steps/common.tsx @@ -1,5 +1,6 @@ import React from 'react' import { CCMSConfig } from '../main' +import { TreeSelectFieldOption } from '../components/formFields/treeSelect' /** * 页面流转步骤基类配置定义 @@ -30,6 +31,7 @@ export interface StepProps { loadPageURL: (pageID: any) => Promise loadPageFrameURL: (pageID: any) => Promise loadPageConfig: (pageID: any) => Promise + loadPageList: () => Promise> baseRoute: string loadDomain: (domain: string) => Promise handlePageRedirect?: (path: string, replaceHistory: boolean) => void diff --git a/src/steps/detail/index.tsx b/src/steps/detail/index.tsx index 7545e8b..232a28e 100644 --- a/src/steps/detail/index.tsx +++ b/src/steps/detail/index.tsx @@ -384,6 +384,7 @@ export default class DetailStep extends Step { onUnmount={this.props.onUnmount} checkPageAuth={this.props.checkPageAuth} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} handlePageRedirect={() => this.props.handlePageRedirect} diff --git a/src/steps/filter/index.tsx b/src/steps/filter/index.tsx index e6aad5e..d35c22a 100644 --- a/src/steps/filter/index.tsx +++ b/src/steps/filter/index.tsx @@ -507,6 +507,7 @@ export default class FilterStep extends Step { baseRoute={this.props.baseRoute} loadDomain={async (domain: string) => await this.props.loadDomain(domain)} containerPath={''} + loadPageList={async () => await this.props.loadPageList()} /> ) } diff --git a/src/steps/form/index.tsx b/src/steps/form/index.tsx index 45d0e85..afe51db 100644 --- a/src/steps/form/index.tsx +++ b/src/steps/form/index.tsx @@ -625,6 +625,7 @@ export default class FormStep extends Step { // ts对clas loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} baseRoute={this.props.baseRoute} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} @@ -739,6 +740,7 @@ export default class FormStep extends Step { // ts对clas baseRoute={this.props.baseRoute} loadDomain={async (domain: string) => await this.props.loadDomain(domain)} containerPath={''} + loadPageList={async () => await this.props.loadPageList()} /> ) } diff --git a/src/steps/header/index.tsx b/src/steps/header/index.tsx index 8e8861f..78cd9c5 100644 --- a/src/steps/header/index.tsx +++ b/src/steps/header/index.tsx @@ -234,6 +234,7 @@ export default class HeaderStep extends Step { loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} /> @@ -306,6 +307,7 @@ export default class HeaderStep extends Step { loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} baseRoute={this.props.baseRoute} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index cb1c73d..b47104f 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -892,6 +892,7 @@ export default class TableStep extends Step { loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} onMount={() => { @@ -931,6 +932,7 @@ export default class TableStep extends Step { loadPageURL={this.props.loadPageURL} loadPageFrameURL={this.props.loadPageFrameURL} loadPageConfig={this.props.loadPageConfig} + loadPageList={this.props.loadPageList} loadDomain={this.props.loadDomain} handlePageRedirect={this.props.handlePageRedirect} onMount={() => { diff --git a/src/util/operation.tsx b/src/util/operation.tsx index 0aae172..14222c9 100644 --- a/src/util/operation.tsx +++ b/src/util/operation.tsx @@ -1,10 +1,10 @@ import React from 'react' import queryString from 'query-string' -// import { set } from "lodash"; import { set } from '../util/produce' import { ParamConfig } from '../interface' import { CCMSConfig, CCMSProps } from '../main' import { getParam } from './value' +import { TreeSelectFieldOption } from '../components/formFields/treeSelect' export type OperationConfig = CCMSOperationConfig @@ -57,6 +57,7 @@ interface OperationHelperProps { loadPageURL: (pageID: any) => Promise, loadPageFrameURL: (pageID: any) => Promise, loadPageConfig: (pageID: any) => Promise, + loadPageList: () => Promise>, baseRoute: string, loadDomain: (domain: string) => Promise handlePageRedirect?: (path: string, replaceHistory: boolean) => void @@ -97,6 +98,7 @@ export default class OperationHelper extends React.Component { @@ -152,6 +154,7 @@ export default class OperationHelper extends React.Component { @@ -180,6 +183,7 @@ export default class OperationHelper extends React.Component { -- Gitee From 0b904513858c1ed3e3c7e889a8ee471cd362bf49 Mon Sep 17 00:00:00 2001 From: cuiwenlong7 Date: Fri, 22 Apr 2022 18:48:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E5=8E=BB=E9=99=A4=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/custom/index.tsx | 2 +- src/components/formFields/common.tsx | 4 ---- src/components/formFields/custom/index.tsx | 2 +- src/components/tableColumns/custom/index.tsx | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/detail/custom/index.tsx b/src/components/detail/custom/index.tsx index a11553e..19a582f 100644 --- a/src/components/detail/custom/index.tsx +++ b/src/components/detail/custom/index.tsx @@ -40,7 +40,7 @@ export default class CustomDtail extends DetailField extends React.Component< } shouldComponentUpdate (nextProps: FieldProps, nextState: S) { - // console.log('nextProps', nextProps, this.props, nextProps.value == this.props.value); - const dependentFieldsArr = this.dependentFields - // console.log('dependentFieldsArr',dependentFieldsArr); let dependentIsChange = false if (dependentFieldsArr && dependentFieldsArr.length) { for (let i = dependentFieldsArr.length; i >= 0; i--) { @@ -214,7 +211,6 @@ export class Field extends React.Component< * record也不比较,需要比较的话就在dependentFieldsArr取出record绝对路径 * */ if (!dependentIsChange && isEqual(this.state, nextState) && nextProps.value === this.props.value && this.props.config === nextProps.config) { - // console.log('no update' ); return false } return true diff --git a/src/components/formFields/custom/index.tsx b/src/components/formFields/custom/index.tsx index a0d81df..fcbafa7 100644 --- a/src/components/formFields/custom/index.tsx +++ b/src/components/formFields/custom/index.tsx @@ -49,7 +49,7 @@ export default class CustomField extends Field imple if (snapshot.includes('entry')) { this.loadCustomField(this.props.config.entry) } else { - if (this.customField && this.customField.update && this.customField.getStatus && this.customField.getStatus() === 'UPDATING') { + if (this.customField && this.customField.update) { this.customField.update({ value: this.props.value, record: this.props.record, diff --git a/src/components/tableColumns/custom/index.tsx b/src/components/tableColumns/custom/index.tsx index 094bddd..dbfff51 100644 --- a/src/components/tableColumns/custom/index.tsx +++ b/src/components/tableColumns/custom/index.tsx @@ -31,7 +31,7 @@ export default class CustomColumn extends Column im if (snapshot.includes('entry')) { this.loadCustomColumn(this.props.config.entry) } else { - if (this.customColumn && this.customColumn.update && this.customColumn.getStatus && this.customColumn.getStatus() === 'UPDATING') { + if (this.customColumn && this.customColumn.update) { this.customColumn.update({ value: this.props.value, record: this.props.record, -- Gitee