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

26533 学生资助管理/助学贷款/助学贷款毕业生信息,2021020001 模块 按钮移动下位置

上级 16c8e292
import React, { useEffect, useRef, useState } from 'react';
import { Button } from 'antd';
import ImportUtil from '@/webPublic/one_stop_public/App/ImportUtil';
import ExportCurrentInfo from '@/webPublic/one_stop_public/App/ExportCurrentInfo';
import { Base16Encode } from '@/webPublic/one_stop_public/Base16';
export function FormListButtons(props) {
const [ConcatButtons, setConCatButtons] = useState([]);
const { btns, loading, importConfig, getPage, objId, query, custom, sql, exportConfig } = props;
const Before = btns && btns.before || [];
console.log(Before);
useEffect(() => {
let buttons = [];
buttons = Before.map((g) => {
g.ButtonType = 'Normal';
return g;
});
for (let item of importConfig) {
buttons.push({
...item,
ButtonType: 'import',
});
}
for (let item of exportConfig) {
buttons.push({
...item,
ButtonType: 'export',
});
}
buttons.sort((a, b) => {
let priorityA = a.priority || 0;
let priorityB = b.priority || 0;
return priorityA - priorityB;
});
setConCatButtons(buttons);
}, [exportConfig, importConfig, btns]);
if (!ConcatButtons || !ConcatButtons.length) {
return null;
}
return ConcatButtons.map((r, i) => {
if (r.ButtonType === 'Normal') {
return <Button {...r} loading={loading} key={r.children} />;
} else if (r.ButtonType === 'import') {
return (<ImportUtil
btn={r.btn}
key={r.btn?.name || '导入'}
ext={r.ext ? r.ext : 'xlsx'}
importConfig={r}
objId={objId}
callback={() => {
getPage();
if (r.callback && typeof r.callback === 'function') {
r.callback();
}
}}
/>);
} else if (r.ButtonType === 'export') {
return <ExportCurrentInfo
objId={objId}
key={r.children || '到处'}
query={query}
custom={custom}
index={i}
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
sql={Base16Encode(sql)}
/>;
}
});
// return Before.map((r) => <Button {...r} loading={loading} key={r.children} />);
}
......@@ -26,6 +26,8 @@ const text = [
'TIBYTEXT',
'VARBINARY',
'VARCHAR',
'VARCHAR2',
'NVARCHAR2',
];
const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT'];
......
......@@ -23,19 +23,18 @@ import moment from 'moment';
import router from 'umi/router';
import ExportInfo from '../../App/ExportInfo';
import ExportCurrentInfo from '../../App/ExportCurrentInfo';
import StatisticsInfo from '../../App/StatisticsInfo';
import ImportUtil from '../../App/ImportUtil';
import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index';
import { isEmpty } from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import ButtonDiy from '../../App/ButtonDiy/ButtonDiy';
import { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
import { text, number, date } from '@/webPublic/one_stop_public/libs/formList/config';
import { FormListButtons } from '@/webPublic/one_stop_public/libs/formList/SplitIndex';
const FormItem = Form.Item;
const Popconfirm = getPopconfirm();
......@@ -43,56 +42,11 @@ const Modal = getModal();
let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker;
const text = [
'BINARY',
'BIT',
'BLOB',
'CHAR',
'GEOMETRY',
'GEOMETRYCOLLECTION',
'JSON',
'LINESTRING',
'LONGBLOB',
'LONGTEXT',
'MEDIUMBLOB',
'MEDIUMINT',
'MEDIUMTEXT',
'MULTILINESTRING',
'MULTIPOINT',
'MULTIPOLYGON',
'POINT',
'POLYGON',
'REAL',
'DECIMAL',
'ENUM',
'SET',
'TEXT',
'TINYBLOB',
'TIBYTEXT',
'VARBINARY',
'VARCHAR',
'VARCHAR2',
'NVARCHAR2',
];
const number = [
'BIGINT',
'DOUBLE',
'FLOAT',
'INT',
'INTEGER',
'NUMERIC',
'SMALLINT',
'TINYINT',
'NUMBER',
];
const data = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'];
const CreateForm = Form.create()((props) => {
const {
modalVisible,
form,
handleAdd,
formLoading,
formData,
isAdd,
handleModalVisible,
......@@ -116,7 +70,8 @@ const CreateForm = Form.create()((props) => {
//处理日期何时入库问题
try {
fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss');
} catch (e) {}
} catch (e) {
}
break;
}
}
......@@ -137,7 +92,7 @@ const CreateForm = Form.create()((props) => {
//需要获取动态表单
return (
<Modal
width="700px"
width='700px'
maskClosable={false}
destroyOnClose
title={isView ? '查看详情' : isAdd ? '新增' : '编辑'}
......@@ -146,10 +101,10 @@ const CreateForm = Form.create()((props) => {
isView
? null
: [
<Button key="back" onClick={() => handleModalVisible()}>
<Button key='back' onClick={() => handleModalVisible()}>
取消
</Button>,
<Button key="submit" type="primary" onClick={okHandle}>
<Button key='submit' type='primary' onClick={okHandle}>
确定
</Button>,
]
......@@ -325,8 +280,6 @@ class FormList extends React.Component {
};
//渲染值
componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
......@@ -342,7 +295,7 @@ class FormList extends React.Component {
type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode },
callback: (dataObj) => {
this.setState({ objId: dataObj.id, isTable: data.isTable }, () => {
this.setState({ objId: dataObj.id, isTable: dataObj.isTable }, () => {
dispatch({
type: 'DataRight/getUserRight',
payload: { objId: this.state.objId },
......@@ -435,7 +388,7 @@ class FormList extends React.Component {
}
initColumn = () => {
const { dispatch, value, objCode} = this.props;
const { dispatch, value, objCode } = this.props;
const { rights, columnRights } = this.state;
if (value && value.columns) {
this.columns = value.columns;
......@@ -549,7 +502,7 @@ class FormList extends React.Component {
if (columnRights.length > 0 && !columnRights.includes(datas[t].id)) {
continue;
}
if (data.includes(datas[t].type)) {
if (date.includes(datas[t].type)) {
column.render = (val) => {
if (val == null) {
return val;
......@@ -890,7 +843,7 @@ class FormList extends React.Component {
<FormItem className={styles.hidden} key={item.id}>
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
})(<Input type="hidden" placeholder="请输入" />)}
})(<Input type='hidden' placeholder='请输入' />)}
</FormItem>
);
}
......@@ -904,7 +857,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入" />)}
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder='请输入' />)}
</FormItem>
);
}
......@@ -920,14 +873,14 @@ class FormList extends React.Component {
<Select
disabled={isView}
style={{ width: '70%' }}
optionFilterProp="children"
optionFilterProp='children'
showSearch
filterOption={(input, option) =>
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
: false
}
placeholder="请选择"
placeholder='请选择'
allowClear>
{ops.map((r) => (
<Option value={r[item.referenceCodeName]} key={r[item.referenceCodeName]}>
......@@ -945,7 +898,7 @@ class FormList extends React.Component {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(
<Select disabled={isView} style={{ width: '70%' }} placeholder="请选择" allowClear>
<Select disabled={isView} style={{ width: '70%' }} placeholder='请选择' allowClear>
<Option value={'0'} key={'0'}>
审核通过
</Option>
......@@ -985,8 +938,8 @@ class FormList extends React.Component {
<Select
disabled={isView}
style={{ width: 200 }}
placeholder="请选择"
optionFilterProp="children"
placeholder='请选择'
optionFilterProp='children'
showSearch
filterOption={(input, option) =>
option
......@@ -1009,7 +962,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)}
})(<Input disabled={isView} style={{ width: '70%' }} placeholder='请输入' />)}
</FormItem>
);
} else if (number.indexOf(item.type) > -1) {
......@@ -1028,10 +981,10 @@ class FormList extends React.Component {
callback(errors);
},
],
})(<Input disabled={isView} placeholder="请输入" />)}
})(<Input disabled={isView} placeholder='请输入' />)}
</FormItem>
);
} else if (isQuery && data.indexOf(item.type) > -1) {
} else if (isQuery && date.indexOf(item.type) > -1) {
return (
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, {
......@@ -1046,7 +999,7 @@ class FormList extends React.Component {
)}
</FormItem>
);
} else if (data.indexOf(item.type) > -1) {
} else if (date.indexOf(item.type) > -1) {
return (
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, {
......@@ -1061,7 +1014,7 @@ class FormList extends React.Component {
<DatePicker
format={item.dataFormatStrWeb == null ? 'YYYY-MM-DD HH:mm:ss' : item.dataFormatStrWeb}
style={{ width: '100%' }}
placeholder="请输入"
placeholder='请输入'
disabled={isView}
/>,
)}
......@@ -1073,7 +1026,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)}
})(<Input disabled={isView} style={{ width: '70%' }} placeholder='请输入' />)}
</FormItem>
);
}
......@@ -1088,7 +1041,7 @@ class FormList extends React.Component {
}
return (
<Form layout="inline">
<Form layout='inline'>
<Row style={{ padding: '15px' }}>
{querys.map((item) => (
<Col style={{ height: 58 }} span={get === 'mobile' ? 24 : 8} key={item.id}>
......@@ -1111,7 +1064,7 @@ class FormList extends React.Component {
paddingRight: get === 'mobile' ? 12 : '',
}}>
<span className={styles.submitButtons}>
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
<Button type='primary' loading={this.props.loading} onClick={this.handleSearch}>
查询
</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
......@@ -1152,6 +1105,8 @@ class FormList extends React.Component {
});
};
render() {
const { modalVisible, selectedRows, rights, data, isReady } = this.state;
......@@ -1183,14 +1138,14 @@ class FormList extends React.Component {
}
// console.log(json);
let showDiv = 500;
if(document.getElementsByClassName('ant-layout-content')?.length){ // 这是大学工项目 容器元素的宽度
if (document.getElementsByClassName('ant-layout-content')?.length) { // 这是大学工项目 容器元素的宽度
showDiv = document.getElementsByClassName('ant-layout-content')[0].clientWidth - 100;
}
if(document.querySelector('#mobelDiv')){ // 这个是一站式的元素的宽度
if (document.querySelector('#mobelDiv')) { // 这个是一站式的元素的宽度
showDiv = document.querySelector('#mobelDiv')?.parentNode.clientWidth;
}
if(json.twidth){ // 列表宽度配置项 在 组件的 扩展的配置里面
if (json.twidth) { // 列表宽度配置项 在 组件的 扩展的配置里面
showDiv = json.twidth;
}
// console.log(showDiv);
......@@ -1213,9 +1168,7 @@ class FormList extends React.Component {
!rights.includes('view') &&
!rights.includes('viewProcess')
) {
}
else
{
} else {
let width = 0;
if (rights && rights.includes('viewProcess')) {
width = width + 120;
......@@ -1255,10 +1208,10 @@ class FormList extends React.Component {
if (rights.includes('delete')) {
Dom.push(
<Popconfirm
title="确定删除该数据?"
title='确定删除该数据?'
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消">
okText='确定'
cancelText='取消'>
<a>删除</a>
</Popconfirm>,
);
......@@ -1272,7 +1225,7 @@ class FormList extends React.Component {
Dom.map((x, index) => (
<Fragment key={Math.random()}>
{x}
{index > 0 && index !== Dom.length - 1 && <Divider type="vertical" />}
{index > 0 && index !== Dom.length - 1 && <Divider type='vertical' />}
</Fragment>
))}
</div>
......@@ -1321,6 +1274,7 @@ class FormList extends React.Component {
}
}
}
const xxxx = (
<>
<Card
......@@ -1332,17 +1286,61 @@ class FormList extends React.Component {
{notShowBack ? (
notShowBack
) : (
<Button icon="rollback" type="primary" onClick={this.goBack}>
<Button icon='rollback' type='primary' onClick={this.goBack}>
返回
</Button>
)}
{btns && btns.before && btns.before.length > 0
? btns.before.map((r) => <Button {...r} loading={loading} />)
<FormListButtons btns={btns}
loading={loading}
importConfig={(this.props.value && this.props.value.importConfig) || []}
exportConfig={(this.props.value && this.props.value.exportConfig) || []}
getPage={this.getPage}
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={
this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null
}
sql={Base16Encode(this.props.sql)}
/>
{/* {this.props.value && this.props.value.importConfig // 导入配置项
? this.props.value.importConfig.map((r, i) => (
<ImportUtil
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
importConfig={r}
objId={this.state.objId}
callback={() => {
this.getPage();
if (r.callback) r.callback();
}}
/>
))
: ''}*/}
{/* {this.props.value && this.props.value.exportConfig // 导出配置项
? this.props.value.exportConfig.map((r, i) => (
<ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={
this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null
}
index={i}
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
sql={Base16Encode(this.props.sql)}
/>
))
: ''}
*/}
{rights && !rights.includes('add') ? (
''
) : (
<Button icon="plus" type="primary" onClick={this.add}>
<Button icon='plus' type='primary' onClick={this.add}>
新建
</Button>
)}
......@@ -1357,20 +1355,7 @@ class FormList extends React.Component {
) : (
<ImportUtil objId={this.state.objId} callback={() => this.getPage()} />
)}
{this.props.value && this.props.value.importConfig
? this.props.value.importConfig.map((r, i) => (
<ImportUtil
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
importConfig={r}
objId={this.state.objId}
callback={() => {
this.getPage();
if (r.callback) r.callback();
}}
/>
))
: ''}
{rights && !rights.includes('exportCurrent') ? (
''
) : (
......@@ -1381,21 +1366,7 @@ class FormList extends React.Component {
sql={Base16Encode(this.props.sql)}
/>
)}
{this.props.value && this.props.value.exportConfig
? this.props.value.exportConfig.map((r, i) => (
<ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={
this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null
}
index={i}
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
sql={Base16Encode(this.props.sql)}
/>
))
: ''}
{rights && !rights.includes('exportData') ? (
''
......@@ -1412,10 +1383,10 @@ class FormList extends React.Component {
: selectedRows.length > 0 && (
<span>
<Popconfirm
title="确定删除该数据?"
title='确定删除该数据?'
onConfirm={this.batchDelete}
okText="确定"
cancelText="取消">
okText='确定'
cancelText='取消'>
<Button>批量删除</Button>
</Popconfirm>
</span>
......@@ -1436,12 +1407,12 @@ class FormList extends React.Component {
/>
</div>
}
title="请选择表头展示"
trigger="click"
placement="bottom">
title='请选择表头展示'
trigger='click'
placement='bottom'>
<Button // 表头筛选控件
className={styles.filter_btn}
icon="filter">
icon='filter'>
表头筛选
</Button>
</Popover>
......@@ -1452,7 +1423,7 @@ class FormList extends React.Component {
</div>
{!istableCom || (this.props.value && this.props.value.columns) ? (
<div
id="mobelDiv"
id='mobelDiv'
style={{
overflow: 'hidden',
width: isMobile ? showMobileDiv : showDiv,
......@@ -1479,7 +1450,7 @@ class FormList extends React.Component {
</div>
) : (
<div
id="mobelDiv"
id='mobelDiv'
style={{
overflow: 'hidden',
width: isMobile ? showMobileDiv : showDiv,
......@@ -1518,7 +1489,7 @@ class FormList extends React.Component {
if (isFormCom) {
return xxxx;
}
return <PageHeaderWrapper title="">{xxxx}</PageHeaderWrapper>;
return <PageHeaderWrapper title=''>{xxxx}</PageHeaderWrapper>;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论