提交 83127b29 authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

......@@ -75,7 +75,6 @@ class AffairPage extends React.Component {
getFormDetail = (workId) => {
service.getFormDetail(workId).then((response) => {
console.log(response);
if (typeof response.unifiedServicePatternModel === 'undefined') {
return false;
}
......@@ -386,7 +385,10 @@ class AffairPage extends React.Component {
}}
/>
) : (
<ApplyForZyd {...this.props} returnList={this.returnList} id={workId} />
<ApplyForZyd {...this.props}
returnList={this.returnList}
id={workId === '1549319936277479424' ? '1590627747913269248' : workId} />
/* 姚鑫国说的 北电科违纪要用另外一个id发起 2022年11月10日 */
)
) : null}
</div>
......
import pageSetting from './pageSetting';
import React, { Component } from 'react';
import React, { Component, useContext } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import ListTab from './ListTab';
import { getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import CreateC from '@/webPublic/FormInsertDiy/ExportComponent/ContextCreate';
export default class AuditPage extends Component {
class AuditPage extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {}
// componentDidMount() {
// console.log(this.context);
// }
handleButtonSet = () => {
const { hasBatchAudit, batchAuditButtonName, noNeedForm, tab2Buttons = [] } = this.props;
......@@ -76,6 +80,7 @@ export default class AuditPage extends Component {
scroll: { x: 'max-content' },
getPageService: getWaitPage,
beforeSearchData: (data) => {
console.log(data);
let searcherKeyValue = {};
for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined' && item.key !== 'taskDefKey') {
......@@ -109,6 +114,7 @@ export default class AuditPage extends Component {
tableRowKey: 'id',
columns,
};
console.log(this.context.locationState?.tab2Props?.search?.field);
const tab2 = {
search: {
field: {},
......@@ -119,7 +125,8 @@ export default class AuditPage extends Component {
},
beforeSearchData: (data) => {
let searcherKeyValue = {};
for (let item of searchCondition) {
console.log(data);
for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined' && item.key !== 'taskDefKey') {
searcherKeyValue[item.base52] = data[item.key];
}
......@@ -144,9 +151,11 @@ export default class AuditPage extends Component {
big: 4,
small: 4,
},
...this.context.locationState?.tab2Props?.search,
},
tableRowKey: 'id',
columns,
};
return {
tab1,
......@@ -154,10 +163,11 @@ export default class AuditPage extends Component {
};
};
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props;
return (
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props;
// const { locationState } = useContext(CreateC);
// console.log(locationState);
return (
<PageHeaderWrapper title="">
<ListTab
tabList={pageSetting.tabList}
......@@ -166,9 +176,15 @@ export default class AuditPage extends Component {
dataBaseId={dataBaseId}
searchCondition={searchCondition}
addFields={addFields}
locationState={this.context.locationState}
pageSearch={this.handleSearchSet({})}
/>
</PageHeaderWrapper>
);
}
}
AuditPage.contextType = CreateC;
export default AuditPage;
......@@ -55,16 +55,16 @@ export default class List extends Component {
const { pagination, formValues } = this.state;
const search = pageSearch.search;
let data = deepCopy(formValues);
/** 如果配置了默认值 则 加进去 **/
for (let item in search.field) {
let one = search.field[item];
if (one.required && typeof data[item] === 'undefined') {
/**
* 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
* */
data[item] = one.defaultValue;
}
}
// /** 如果配置了默认值 则 加进去 **/
// for (let item in search.field) {
// let one = search.field[item];
// if (one.required && typeof data[item] === 'undefined') {
// /**
// * 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
// * */
// data[item] = one.defaultValue;
// }
// }
if (listConfig.paging) {
// 是否分页
data.pageSize = pagination.pageSize;
......
import React, { Component, Fragment } from 'react';
import { Tabs } from 'antd';
import styles from '@/baseComponent/index.less';
import PropTypes from 'prop-types';
import CreateC from '@/webPublic/FormInsertDiy/ExportComponent/ContextCreate';
import Shell from '@/baseComponent/Shell';
import List from './List';
const TabPane = Tabs.TabPane;
export default class ListTab extends Component {
constructor(props) {
super(props);
const { tabList } = this.props;
const tabKeys = Object.keys(tabList);
this.state = {
activeKey: tabKeys[0],
tabKeys: tabKeys,
};
}
class ListTab extends Component {
constructor(props) {
super(props);
const { tabList } = this.props;
const tabKeys = Object.keys(tabList);
this.state = {
activeKey: this.props.locationState?.activeKey || tabKeys[0],
tabKeys: tabKeys,
};
}
handleChangeTab = (activeKey) => {
this.setState(
{
activeKey: '-111111',
},
() => {
setTimeout(() => {
this.setState({
activeKey: activeKey,
});
}, 30);
},
);
};
handleChangeTab = (activeKey) => {
this.setState(
{
activeKey: '-111111',
},
() => {
setTimeout(() => {
this.setState({
activeKey: activeKey,
});
}, 30);
},
);
};
render() {
const {
tabList,
pageSearch,
pageButton,
workId,
dataBaseId,
addFields,
searchCondition,
} = this.props;
const { activeKey, tabKeys } = this.state;
return (
<Fragment>
<Shell styleShell={{ marginTop: 0 }}>
{/*<SearchDom />*/}
<Tabs activeKey={activeKey} className={styles.ListTab} onChange={this.handleChangeTab}>
{tabKeys.map((item) => {
return <TabPane tab={tabList[item].name} key={item} />;
})}
</Tabs>
</Shell>
{tabKeys.map((item) => {
return activeKey === item ? (
<List
listConfig={tabList[item].listConfig}
key={item}
workId={workId}
addFields={addFields}
searchCondition={searchCondition}
dataBaseId={dataBaseId}
pageSearch={pageSearch[item]}
pageButton={pageButton[item]}
/>
) : null;
})}
</Fragment>
);
}
render() {
const {
tabList,
pageSearch,
pageButton,
workId,
dataBaseId,
addFields,
searchCondition,
} = this.props;
const {
activeKey,
tabKeys
} = this.state;
return (
<Fragment>
<Shell styleShell={{ marginTop: 0 }}>
{/*<SearchDom />*/}
<Tabs activeKey={activeKey} className={styles.ListTab} onChange={this.handleChangeTab}>
{tabKeys.map((item) => {
return <TabPane tab={tabList[item].name} key={item}/>;
})}
</Tabs>
</Shell>
{tabKeys.map((item) => {
if (activeKey === item && pageSearch[item]) {
const search = pageSearch[item].search;
if (search.mustHaveCondition && !search.condition.length) {
// 如果配置了 mustHaveCondition 则 必须有搜索条件才渲染页面 保证 搜索条件正常传给后台
return null;
}
}
return activeKey === item ? (
<List
listConfig={tabList[item].listConfig}
key={item}
workId={workId}
addFields={addFields}
searchCondition={searchCondition}
dataBaseId={dataBaseId}
pageSearch={pageSearch[item]}
pageButton={pageButton[item]}
/>
) : null;
})}
</Fragment>
);
}
}
ListTab.propTypes = {};
ListTab.contextType = CreateC;
ListTab.propTypes = {};
ListTab.defaultProps = {};
export default ListTab;
......@@ -10,7 +10,7 @@ import * as service from '../publicApiService';
import AuditPage from './AuditPage';
import * as destructionFunc from '../destruction';
import { Link } from 'dva/router';
import { CreateC } from '../../ExportComponent/ActiveMenuComponent';
import CreateC from '../../ExportComponent/ContextCreate';
class Index extends React.Component {
static defaultProps = {
......@@ -134,7 +134,6 @@ class Index extends React.Component {
response = response.filter((x) => {
return x.title !== '流程进度';
});
console.log(response);
if (response && response.length) {
this.setState(
{
......@@ -199,7 +198,7 @@ class Index extends React.Component {
});
}
}
console.log(JSON.stringify(d));
// console.log(JSON.stringify(d));
}
return (
<AuditPage
......@@ -222,5 +221,6 @@ class Index extends React.Component {
export default function Pr(props) {
const { routerConfig } = useContext(CreateC);
// console.log(routerConfig);
return <Index {...props} routerConfig={routerConfig}/>;
}
......@@ -17,10 +17,7 @@ import exportHandledInfo from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/ex
import ApplyMerge from './ApplyMerge'; // merge
import AuditMerge from './AuditMerge';
import CheckRecordMerge from './CheckRecordMerge';
export const CreateC = createContext({
routerConfig: {},
});
import CreateC from './ContextCreate';
window.iframeParentComponent = {
Modal,
......@@ -116,10 +113,12 @@ function ActiveMenuComponent({ routerConfig, ...otherProps }) {
default:
break;
}
console.log('112233');
return (
<CreateC.Provider
value={{
routerConfig,
locationState: location?.state,
}}>
{Res}
</CreateC.Provider>
......
import { createContext } from 'react';
const CreateC = createContext({
routerConfig: {},
locationState: {},
});
export default CreateC;
......@@ -9,20 +9,21 @@
import React from 'react';
import FormList from './formList';
import TreeList from './formList/TreeList';
import { Spin } from 'antd';
export default class TableList extends React.Component {
constructor(props) {
super(props);
const value = props.value || {};
this.otherProps = {};
if (props.json.otherProps && props.json.otherProps.length) {
try {
this.otherProps = new Function(props.json.otherProps)();
} catch (e) {
console.log('Table 列表组件 otherProps 获取失败');
}
}
// console.log(this.otherProps);
this.otherProps = {};
if (props.json.otherProps && props.json.otherProps.length) {
try {
this.otherProps = new Function(props.json.otherProps)();
} catch (e) {
console.log('Table 列表组件 otherProps 获取失败');
}
}
// console.log(this.otherProps);
this.state = {
isAll: value.isAll,
querys: value.querys,
......@@ -40,38 +41,43 @@ export default class TableList extends React.Component {
}
};
static getDerivedStateFromProps(nextProps, prevState) {
// ...
if('value' in nextProps){
return {...nextProps.value}; // 更新state
}
return null; //不需要更新任何state
}
static getDerivedStateFromProps(nextProps, prevState) {
// ...
if ('value' in nextProps) {
return { ...nextProps.value }; // 更新state
}
return null; //不需要更新任何state
}
componentDidUpdate(prevProps, prevState) {
if(prevState?.columns !== this.state.columns){
this.setState({
showNo: true,
}, () => {
setTimeout(()=>{
this.setState({
showNo: false,
});
}, 1000);
});
}
}
componentDidUpdate(prevProps, prevState) {
if (prevState?.columns !== this.state.columns) {
console.log(prevState.columns, this.state.columns);
this.setState(
{
showNo: true,
},
() => {
setTimeout(() => { // 如果两次的表头不同 重新渲染组件
this.setState({
showNo: false,
});
}, 10);
},
);
}
}
render() {
render() {
const { isTree, json, uuid } = this.props;
const { showNo } = this.state;
if(showNo){
return null;
}
// console.log(showNo);
if (showNo) {
return null;
}
return isTree ? (
<TreeList
otherProps={this.otherProps}
json={json}
otherProps={this.otherProps}
json={json}
onSelectRow={this.props.value.onSelectRow}
istableCom={true}
showHeader={this.props.showHeader}
......@@ -84,26 +90,26 @@ export default class TableList extends React.Component {
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
uuid={uuid}
uuid={uuid}
sql={this.props.sql}
/>
) : (
<FormList
otherProps={this.otherProps}
otherProps={this.otherProps}
json={json}
onSelectRow={this.props.value.onSelectRow}
getCheckboxProps={this.props.value.getCheckboxProps}
getCheckboxProps={this.props.value.getCheckboxProps}
istableCom={true}
showHeader={this.props.showHeader}
get={this.props.get}
isHiddenPage={this.props.isHiddenPage != null ? this.props.isHiddenPage : false}
pageSize={this.props.pageSize || 10}
value={{...this.state}}
value={{ ...this.state }}
notShowBack={true}
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
uuid={uuid}
uuid={uuid}
sql={this.props.sql}
/>
);
......
......@@ -293,6 +293,7 @@ class FormList extends React.Component {
if (Number(objCode) === 1) {
this.initColumn();
} else {
console.log('componentDidMount-296');
dispatch({
type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode },
......@@ -442,7 +443,6 @@ class FormList extends React.Component {
if(this.props.json?.isDiy){ // 2022年11月8日 姚鑫国说的 开起了这个 自定义模式 就不调接口查表头了. 也不调接口查枚举项那些
this.getPage();
return undefined;
}
dispatch({
type: 'formList/getHead',
......@@ -638,7 +638,7 @@ class FormList extends React.Component {
getPage = (params, values, callPage, pageNo) => {
const { objCode } = this.props;
if (this.columns == null || this.columns.length === 0) {
if (!this.columns || !Array.isArray(this.columns) || this.columns.length === 0) {
return;
}
const { dispatch } = this.props;
......@@ -1159,7 +1159,6 @@ class FormList extends React.Component {
render() {
const { modalVisible, selectedRows, rights, data, isReady } = this.state;
if (!isReady) {
return (
<div
......
......@@ -3163,12 +3163,16 @@ ${obj[dataColumn.base52]}
otherProps = {};
}
}
console.log(selectDis,'selectDis',disabled,'disabled');
const optDiy = Array.isArray(json?.options) ? json.options : Array.isArray(options) ? options : [];
if(dataColumn.base52 === 'KjWXQFIprRc'){
// console.log(json, required, dataColumn, optDiy);
}
cm = getFieldDecorator(dataColumn.base52, {
initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue,
rules:
json.vlds && json.vlds.length > 0
Array.isArray(json.vlds) && json.vlds.length > 0
? json.vlds
: [
{
......
......@@ -183,7 +183,6 @@ export async function requestOrigin(url, data, options = {}){
})
.then(response => {
// console.log(response);
if (response && response.errMsg) {
response.errMsg = response.errMsg.slice(0, 50);
}
......
import { Button, Drawer, Input, message } from 'antd';
import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'dva';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import moment from 'moment';
import styles from './styles.less';
import { getUserInfo } from '@/webPublic/one_stop_public/utils/token';
const { TextArea } = Input;
function EditDrawer(props) {
const { dispatch, templateData, TEMPLATE } = props;
const [loading, setLoading] = useState(false);
const [showEdit, setShowEdit] = useState(process.env.NODE_ENV === 'development');
const saveTimeOut = useRef();
const [lowCodeEdit, setLowCodeEdit] = useState({});
useEffect(
() => {
if (templateData) {
setLowCodeEdit({ ...templateData });
}
},
[templateData],
);
const onClose = () => {
setShowEdit(!showEdit);
};
const handleSaveTemplate = () => {
lowCodeEdit.updateTime = moment().format('YYYY-MM-DD HH:mm:ss');
const content = JSON.stringify(lowCodeEdit);
message.info('正在保存数据,请耐心等待');
setLoading(true);
dispatch({
type: 'lowCode_design/saveTemplateApi',
payload: {
name: lowCodeEdit.name,
content,
TEMPLATE,
},
callback: () => {
saveTimeOut.current = null;
setLoading(false);
},
});
};
const changeKey = (value, key) => {
let newCodeEdit = lowCodeEdit;
newCodeEdit[key] = value;
setLowCodeEdit(newCodeEdit);
};
// TODO localStorage 事件中获取的state 不是最新的.
const handleLocalStorageSave = (e) => {
if (e.key === 'save-low-code-local') {
const newV = e.newValue;
if (newV && newV.length > 20) {
changeKey(newV, 'beforeShow');
if (!saveTimeOut.current) {
saveTimeOut.current = window.setTimeout(() => {
message.info('正在保存');
handleSaveTemplate();
}, 500);
}
}
}
};
useEffect(
() => {
if (lowCodeEdit?.beforeShow) {
window.addEventListener('storage', handleLocalStorageSave);
}
return () => {
window.removeEventListener('storage', handleLocalStorageSave);
};
},
[lowCodeEdit.beforeShow],
);
const editFullScreen = () => {
localStorage.setItem('edit-low-code-local', JSON.stringify(lowCodeEdit));
if(process.env.NODE_ENV === 'development'){
window.open('http://scjoyedu.eicp.net:51352/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE);
}
window.open(window.location.origin + '/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE);
};
return (
<>
<Drawer
title="编辑"
placement="right"
onClose={onClose}
visible={showEdit}
width={700}
maskClosable={false}>
<TextArea
autoSize={{
minRows: 5,
maxRows: 10,
}}
value={JSON.stringify(templateData, null, '\t')}
disabled={true}
style={{ marginBottom: '20px' }}
/>
{
loading ? '正在保存中请勿编辑' :
<>
挂载前执行
<ButtonDiy name={'全屏编辑'} handleClick={editFullScreen} type={'danger'} />
<TextArea
autoSize={{
minRows: 10,
maxRows: 15,
}}
defaultValue={lowCodeEdit?.beforeShow || ''}
onChange={(e) => {
changeKey(e.target.value, 'beforeShow');
}}
// readOnly={true}
style={{ marginBottom: '20px' }}
/>
<Button onClick={handleSaveTemplate} type={'primary'}>
保存
</Button>
</>
}
</Drawer>
<div
data-edit-point={'EditDrawer'}
className={styles.editPoint}
style={{
display: getUserInfo().stuNo === 'admin' ? 'block' : 'none',
}}
onClick={() => {
setShowEdit(!showEdit);
}}
>.</div>
</>
);
}
export default connect(({ lowCode_design }) => {
return {
templateData: lowCode_design.templateData,
};
})(EditDrawer);
.editPoint{
position: absolute;
z-index: 10;
right: 0;
top: 64px;
cursor: pointer;
}
......@@ -309,7 +309,8 @@ export function checkInputType(data, type) {
}
break;
case 'email':
if (!/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(data)) {
const reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/;
if (!reg.test(data)) {
message.warning('邮箱格式错误!');
return false;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论