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

28974 辅导员考核相关需求,有疑问联系我

onestop 增加 步骤条组件
上级 cdcb10b2
import React, { useState, useEffect, useMemo, useCallback } from 'react';
import { Steps } from 'antd';
import ZdyTable from '@/webPublic/one_stop_public/Table';
const { Step } = Steps;
export default function StepDiy(props) {
const { value, onChange, json, form } = props;
const { value, json, partFormProps, dataColumn, onChange } = props;
const diyProps = useMemo(() => {
let b = {};
if (value && typeof value === 'object') {
b = {
...value,
};
delete b.formValues;
}
if (json.otherProps && typeof json.otherProps === 'string') {
try {
......@@ -30,21 +32,65 @@ export default function StepDiy(props) {
}
}, [json.otherProps, value]);
/**
* 按姚鑫国的要求 在切换步骤时将表单的值保存起来
* */
const [current, setCurrent] = useState(diyProps?.StepsProps?.current || 0);
const [formValues, setFormValues] = useState({});
const partFormKey = useMemo(() => {
if (typeof current !== 'undefined') {
let item = diyProps.Step.find((g, index) => {
return index === current;
});
if (item) {
return item.formKey;
}
}
return undefined;
}, [current]);
useEffect(() => {
console.log(JSON.stringify(form.getFieldsValue()));
}, [diyProps?.StepsProps.current]);
if (diyProps?.StepsProps?.current !== current) {
const oldValues = partFormProps.form.getFieldsValue();
let newV = {
...oldValues,
};
delete newV[dataColumn.base52];
setFormValues({
...formValues,
...newV,
});
}
setCurrent(diyProps?.StepsProps?.current);
}, [diyProps?.StepsProps?.current]);
useEffect(() => {
onChange({
...value,
formValues,
})
}, [formValues]);
console.log(value);
return (
<div style={diyProps.outSideDivStyle}>
<Steps {...diyProps.StepsProps}>
<Steps {...diyProps.StepsProps}
current={current}>
{Array.isArray(diyProps.Step) &&
diyProps.Step.map(g => {
return <Step {...g} key={g.title} />;
})}
</Steps>
{!!partFormKey && (
<div>
<ZdyTable
{...partFormProps}
currentFormTitle={'Steps组件的子表单' + partFormKey}
key={partFormKey}
currentFormKey={partFormKey}
{...partFormProps?.datas[partFormKey]}
/>
</div>
)}
</div>
);
}
......@@ -80,16 +80,11 @@ import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUp
import SwitchWeb from '@/webPublic/one_stop_public/tableCompon/Split_Index/SwitchWeb';
import CronEditorDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/CronEditorDiy/index';
import ButtonDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/ButtonDiy';
import giveVarcharRules
from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
import getPopupContainer
from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer';
import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
import getPopupContainer from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer';
import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy';
const {
MonthPicker,
WeekPicker,
} = DatePicker;
const { MonthPicker, WeekPicker } = DatePicker;
/**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
*/
......@@ -111,12 +106,7 @@ const giveRender = (column = {}) => {
return column;
};
@connect(({
DataColumn,
SqlManageEntity,
formList,
loading,
}) => ({
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn,
SqlManageEntity,
formList,
......@@ -163,13 +153,12 @@ export default class TableCom extends Component {
});
};
changeTabsActiveKey = (activeKey) => {
changeTabsActiveKey = activeKey => {
this.setState({
activeKey,
});
};
showModal = (fk, title, data, modalProps) => {
// console.log(fk, title, data, modalProps);
......@@ -230,12 +219,7 @@ export default class TableCom extends Component {
};
getColumnSearchProps = (dataIndex, title) => ({
filterDropdown: ({
setSelectedKeys,
selectedKeys,
confirm,
clearFilters,
}) => (
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
<div style={{ padding: 8 }}>
<Input
ref={node => {
......@@ -252,11 +236,11 @@ export default class TableCom extends Component {
}}
/>
<Button
type='primary'
type="primary"
onClick={() => this.handleSearch(selectedKeys, confirm)}
icon='search'
icon="search"
loading={this.props.loading}
size='small'
size="small"
style={{
width: 90,
marginRight: 8,
......@@ -267,14 +251,14 @@ export default class TableCom extends Component {
<Button
loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)}
size='small'
size="small"
style={{ width: 90 }}
>
重置
</Button>
</div>
),
filterIcon: filtered => <Icon type='search' style={{ color: filtered ? '#1890ff' : 'red' }} />,
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
onFilter: (value, record) =>
record[dataIndex]
? record[dataIndex]
......@@ -322,11 +306,7 @@ export default class TableCom extends Component {
};
componentWillReceiveProps(props) {
const {
json,
mapData,
obj,
} = props;
const { json, mapData, obj } = props;
if (json == null || this.props.safe) {
return;
}
......@@ -439,10 +419,7 @@ export default class TableCom extends Component {
dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];
getData = (json, dataColumn, obj, init) => {
const {
formKey,
uuid,
} = this.props;
const { formKey, uuid } = this.props;
let jsonStatic = json;
json = {
...jsonStatic,
......@@ -453,10 +430,7 @@ export default class TableCom extends Component {
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props;
const {
sqlKey,
optionType,
} = json;
const { sqlKey, optionType } = json;
if (optionType === 'sql') {
dispatch({
type: 'SqlManageEntity/find',
......@@ -478,8 +452,7 @@ export default class TableCom extends Component {
if (
['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
) {
column.render = val => moment(val)
.format('YYYY-MM-DD HH:mm:ss');
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
......@@ -516,8 +489,7 @@ export default class TableCom extends Component {
break;
}
column.render = val => moment(parseInt(val))
.format(ff);
column.render = val => moment(parseInt(val)).format(ff);
}
if (cll[k].isQuery) {
column = {
......@@ -563,8 +535,7 @@ export default class TableCom extends Component {
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val)
.format('YYYY-MM-DD HH:mm:ss');
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
columns.push(column);
......@@ -803,8 +774,7 @@ export default class TableCom extends Component {
delete params[i];
}
}
noPrefixRequest(url, params)
.then(data => {
noPrefixRequest(url, params).then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
......@@ -1006,8 +976,7 @@ export default class TableCom extends Component {
if (getToken() != null) {
pp.token = getToken();
}
uaaRequest(url, pp)
.then(data => {
uaaRequest(url, pp).then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
......@@ -1108,7 +1077,6 @@ export default class TableCom extends Component {
};
}
let obj = {};
if (!isEdit && fatherCode) {
obj = {
......@@ -1178,7 +1146,6 @@ export default class TableCom extends Component {
messageData,
concealModel,
};
};
getFunctionValue = (fun, column, json, callback) => {
......@@ -1277,12 +1244,7 @@ export default class TableCom extends Component {
};
componentDidMount() {
const {
json,
mapData,
obj,
init,
} = this.props;
const { json, mapData, obj, init } = this.props;
if (json == null) {
return;
}
......@@ -1327,13 +1289,7 @@ export default class TableCom extends Component {
}
fetchData3 = (obj, dataColumn, init, json, allValues) => {
const {
sqlKey,
labelName,
valueName,
isMeta,
filterSql,
} = json;
const { sqlKey, labelName, valueName, isMeta, filterSql } = json;
if (isMeta) {
// 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
// 解决禅道bug 28017
......@@ -1573,10 +1529,7 @@ export default class TableCom extends Component {
}
};
getColumn = key => {
let {
mapData,
json,
} = this.props;
let { mapData, json } = this.props;
const columnIds = json?.columnIds;
......@@ -1632,20 +1585,8 @@ export default class TableCom extends Component {
// console.log(formKey, json);
// }
const {
options,
labels,
selectDis,
modalCode,
modalTitle,
modalInit,
modalProps,
} = this.state;
const {
getFieldDecorator,
getFieldError,
getFieldProps,
} = this.props.form;
const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
if (json?.label === '账号') {
......@@ -1683,53 +1624,64 @@ export default class TableCom extends Component {
/>
);
}
if (json.comName == 'Graph') {
if (json.comName === 'Graph') {
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
}
if (['PartForm', 'Steps'].includes(json.comName)) {
this.partFormProps = {
taskId: this.props.taskId,
importExcel: this.props.importExcel,
setRealTimeValues: this.props.setRealTimeValues,
hfInstance: this.props.hfInstance,
getCellValue: getCellValue,
taskAssignee: taskAssignee,
isWebPrint: this.props.isWebPrint || false,
userId: userId,
isPreview: isPreview,
modalInit: modalInit,
datas: datas,
trees: this.props.trees,
get: get,
isChild: true,
isEdit: isEdit,
obj: obj,
init: init,
formCode: this.props.formCode,
formId: this.props.formId,
form: this.props.form,
mapData: mapData,
sqlData: sqlData,
defaultValues: defaultValues,
// currentFormTitle={
// this.props.getCurrentFormTitle ? this.props.getCurrentFormTitle(fk) : null
// }
// key={fk}
// currentFormKey={fk}
// {...datas[fk]}
};
}
if (json.comName == 'PartForm') {
if (json.comName === 'PartForm') {
const fk = this.props.form.getFieldsValue()[uuid] || json.childFormKey;
if (fk == null) {
return <></>;
}
if (formKey == fk) {
if (formKey === fk) {
return <>片段表单key不能和自身相同</>;
}
return (
<>
{this.props.form.getFieldDecorator(uuid, {
initialValue: fk,
})(<Input type='hidden' />)}{' '}
})(<Input type="hidden" />)}{' '}
<ZdyTable
taskId={this.props.taskId}
importExcel={this.props.importExcel}
setRealTimeValues={this.props.setRealTimeValues}
hfInstance={this.props.hfInstance}
{...this.partFormProps}
currentFormTitle={
this.props.getCurrentFormTitle ? this.props.getCurrentFormTitle(fk) : null
}
getCellValue={getCellValue}
taskAssignee={taskAssignee}
isWebPrint={this.props.isWebPrint || false}
userId={userId}
key={fk}
isPreview={isPreview}
modalInit={modalInit}
datas={datas}
trees={this.props.trees}
get={get}
isChild={true}
currentFormKey={fk}
isEdit={isEdit}
obj={obj}
init={init}
formCode={this.props.formCode}
formId={this.props.formId}
form={this.props.form}
mapData={mapData}
sqlData={sqlData}
{...datas[fk]}
defaultValues={defaultValues}
/>
</>
);
......@@ -1775,7 +1727,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[uuid] || json.initialValue,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1792,7 +1744,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1884,8 +1836,7 @@ export default class TableCom extends Component {
case 'DatePicker':
cm = value ? (
<span>
{moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')}
{moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br /> : ''}
</span>
) : (
......@@ -1901,7 +1852,7 @@ export default class TableCom extends Component {
{filesX.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name}
</a>
</li>
......@@ -1921,7 +1872,7 @@ export default class TableCom extends Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name}
</a>
</li>
......@@ -2014,7 +1965,7 @@ export default class TableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -2027,7 +1978,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -2121,7 +2072,7 @@ export default class TableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -2134,7 +2085,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -2215,12 +2166,15 @@ export default class TableCom extends Component {
if (!value || value === 'null') {
return <div />;
}
cm = <MobileCard value={value}
cm = (
<MobileCard
value={value}
json={json}
getArguments={this.functionArguments}
tableComProps={this.props}
dataColumn={dataColumn}
/>;
/>
);
break;
case 'WangEditor':
let textV = obj[dataColumn.base52];
......@@ -2329,7 +2283,7 @@ ${obj[dataColumn.base52]}
<Table
get={get}
columns={this.state.columns}
size='small'
size="small"
dataSource={ds}
pagination={false}
/>
......@@ -2361,13 +2315,11 @@ ${obj[dataColumn.base52]}
} else {
cm = (
<span>
{moment(parseInt(obj[begin.base52]))
.format(
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52]))
.format(
{moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
......@@ -2383,16 +2335,14 @@ ${obj[dataColumn.base52]}
if (vTime && typeof vTime === 'string' && vTime.indexOf('-') <= -1) {
cm = (
<span>
{moment(parseInt(vTime))
.format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
{moment(parseInt(vTime)).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
</span>
);
} else {
cm = (
<span>
{vTime
? moment(+new Date(vTime))
.format(
? moment(+new Date(vTime)).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)
: ''}
......@@ -2500,7 +2450,7 @@ ${obj[dataColumn.base52]}
}
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryFileUrl(f.path)}>
<a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name}
</a>
</li>
......@@ -2527,7 +2477,7 @@ ${obj[dataColumn.base52]}
}
return (
<li key={index2}>
<a target='_blank' key={f.filePath} href={queryFileUrl(f.filePath)}>
<a target="_blank" key={f.filePath} href={queryFileUrl(f.filePath)}>
{f.fileName}
</a>
</li>
......@@ -2630,14 +2580,14 @@ ${obj[dataColumn.base52]}
marginLeft: 5,
width:
get === 'mobile'
? document.documentElement.clientWidth - 10 || document.body.clientWidth - 10
? document.documentElement.clientWidth - 10 ||
document.body.clientWidth - 10
: json.width,
height: get === 'mobile' ? '' : json.height,
}}
/>
);
}
}
break;
......@@ -2698,7 +2648,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <ButtonDiy loading={this.props.loading} type='primary' {...ev} />;
cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />;
}
}
......@@ -2781,7 +2731,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <ButtonDiy loading={this.props.loading} type='primary' {...ev} />;
cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />;
}
}
......@@ -2922,10 +2872,7 @@ ${obj[dataColumn.base52]}
otherProps = {};
}
}
const {
disabledInputStyle = {},
addonAfter,
} = otherProps;
const { disabledInputStyle = {}, addonAfter } = otherProps;
let inputStyle = {
width: json.width,
};
......@@ -2975,7 +2922,7 @@ ${obj[dataColumn.base52]}
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type='hidden' />);
})(<Input type="hidden" />);
break;
case 'InputNumber':
if (json?.otherProps) {
......@@ -3042,11 +2989,9 @@ ${obj[dataColumn.base52]}
const tabPaneProps = configOption.tabPaneProps || {};
let activeKey = this.state.activeKey || configOption.data[0].key;
console.log(configOption);
cm = <Tabs
onChange={this.changeTabsActiveKey}
activeKey={activeKey}
{...tabsProps}>
{configOption.data.map((r) => {
cm = (
<Tabs onChange={this.changeTabsActiveKey} activeKey={activeKey} {...tabsProps}>
{configOption.data.map(r => {
return (
<Tabs.TabPane tab={r.title} key={r.key} {...tabPaneProps}>
{activeKey === r.key ? (
......@@ -3072,7 +3017,7 @@ ${obj[dataColumn.base52]}
{...datas[r.key]}
defaultValues={defaultValues}
/>
/**
) : /**
<ZdyTable
key={r}
modalInit={modalInit}
......@@ -3102,11 +3047,12 @@ ${obj[dataColumn.base52]}
defaultValues={defaultValues}
/>
* */
) : null}
null}
</Tabs.TabPane>
);
})}
</Tabs>;
</Tabs>
);
break;
/**
* 为Radio为单选
......@@ -3151,7 +3097,7 @@ ${obj[dataColumn.base52]}
case 'Checkbox':
if (get === 'mobile') {
cm = (
<Flex direction='column' align='start'>
<Flex direction="column" align="start">
{getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值
rules:
......@@ -3234,7 +3180,7 @@ ${obj[dataColumn.base52]}
disabled={selectDis || disabled}
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp='children'
optionFilterProp="children"
getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出
......@@ -3255,8 +3201,7 @@ ${obj[dataColumn.base52]}
}}
filterOption={(input, option) =>
option
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
: false
}
{...otherProps}
......@@ -3313,8 +3258,7 @@ ${obj[dataColumn.base52]}
}
const filterF = function filter(inputValue, path) {
return path.some(
option => option?.label?.toLowerCase()
?.indexOf(inputValue.toLowerCase()) > -1,
option => option?.label?.toLowerCase()?.indexOf(inputValue.toLowerCase()) > -1,
);
};
// if(this.props.uuid === 'id_32691685234912400529714267d34dc585a2'){
......@@ -3467,13 +3411,11 @@ ${obj[dataColumn.base52]}
if (!isEdit) {
cm = (
<span>
{moment(parseInt(obj[begin.base52]))
.format(
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52]))
.format(
{moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
......@@ -3586,8 +3528,7 @@ ${obj[dataColumn.base52]}
}
});
}
: () => {
}
: () => {}
}
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
{...otherProps}
......@@ -3723,12 +3664,15 @@ ${obj[dataColumn.base52]}
case 'Steps':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<StepDiy json={json}
})(
<StepDiy
json={json}
dataColumn={dataColumn}
disabled={disabled}
uuid={uuid}
form={this.props.form}
/>);
partFormProps={this.partFormProps}
/>,
);
break;
case 'MobileCard':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3740,7 +3684,8 @@ ${obj[dataColumn.base52]}
getArguments={this.functionArguments}
tableComProps={this.props}
dataColumn={dataColumn}
/>);
/>,
);
break;
case 'RichText':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3801,8 +3746,7 @@ ${obj[dataColumn.base52]}
let errors = [];
console.log(valueThis);
if (
(!valueThis || !JSON.stringify(valueThis)
.includes('address')) &&
(!valueThis || !JSON.stringify(valueThis).includes('address')) &&
required
) {
errors.push(new Error('请获取定位信息', rule.field));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论