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

一站式 服务 列表 新增 Modal 字段显示bug修改 hidden 的自定义不应该显示高度

操作列的 分栏修改
上级 b13984f1
...@@ -83,3 +83,6 @@ ...@@ -83,3 +83,6 @@
border-radius: 2px; border-radius: 2px;
border-color: #1998f0; border-color: #1998f0;
} }
.hidden{
margin: 0px;
}
import React, { Fragment } from 'react'; import React, {Fragment} from 'react';
import { import {
Button, Button,
Card, Card,
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
Popover, Popover,
Checkbox, Checkbox,
} from 'antd'; } from 'antd';
import { connect } from 'dva'; import {connect} from 'dva';
import PageHeaderWrapper from './PageHeaderWrapper'; import PageHeaderWrapper from './PageHeaderWrapper';
import styles from './TableList.less'; import styles from './TableList.less';
import StandardTable from './StandardTable'; import StandardTable from './StandardTable';
...@@ -31,17 +31,18 @@ import ExportCurrentInfo from '../../App/ExportCurrentInfo'; ...@@ -31,17 +31,18 @@ import ExportCurrentInfo from '../../App/ExportCurrentInfo';
import StatisticsInfo from '../../App/StatisticsInfo'; import StatisticsInfo from '../../App/StatisticsInfo';
import ImportUtil from '../../App/ImportUtil'; import ImportUtil from '../../App/ImportUtil';
import SearchInfo from '../../App/SearchInfo'; import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index'; import {Base16Encode} from '../../Base16/index';
import { isEmpty } from 'lodash'; import {isEmpty} from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview'; import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import {queryApiActionPath} from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom'; import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import ButtonDiy from '../../App/ButtonDiy/ButtonDiy'; import ButtonDiy from '../../App/ButtonDiy/ButtonDiy';
import { cloneDeep } from '../../copy/index'; import {cloneDeep} from '../../copy/index';
const FormItem = Form.Item; const FormItem = Form.Item;
let AllWidth = 0; // 表格总长度 let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker; const {RangePicker} = DatePicker;
const text = [ const text = [
'BINARY', 'BINARY',
...@@ -74,7 +75,7 @@ const text = [ ...@@ -74,7 +75,7 @@ const text = [
'VARCHAR2', 'VARCHAR2',
'NVARCHAR2' 'NVARCHAR2'
]; ];
const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT','NUMBER']; const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT', 'NUMBER'];
const data = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR']; const data = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'];
const CreateForm = Form.create()(props => { const CreateForm = Form.create()(props => {
...@@ -106,7 +107,8 @@ const CreateForm = Form.create()(props => { ...@@ -106,7 +107,8 @@ const CreateForm = Form.create()(props => {
//处理日期何时入库问题 //处理日期何时入库问题
try { try {
fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss'); fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss');
} catch (e) {} } catch (e) {
}
break; break;
} }
} }
...@@ -119,7 +121,7 @@ const CreateForm = Form.create()(props => { ...@@ -119,7 +121,7 @@ const CreateForm = Form.create()(props => {
} }
} }
}); });
let params = { ...fieldsValue }; let params = {...fieldsValue};
handleAdd(params, isAdd); handleAdd(params, isAdd);
}); });
}; };
...@@ -136,25 +138,25 @@ const CreateForm = Form.create()(props => { ...@@ -136,25 +138,25 @@ const CreateForm = Form.create()(props => {
isView isView
? null ? null
: [ : [
<Button key="back" onClick={() => handleModalVisible()}> <Button key="back" onClick={() => handleModalVisible()}>
取消 取消
</Button>, </Button>,
<Button key="submit" type="primary" onClick={okHandle}> <Button key="submit" type="primary" onClick={okHandle}>
确定 确定
</Button>, </Button>,
] ]
} }
onOk={okHandle} onOk={okHandle}
onCancel={() => handleModalVisible()} onCancel={() => handleModalVisible()}
> >
{formItem.map((item, index) => {formItem.map((item, index) =>
getItem(false, form, item, isAdd, formData, { span: 5 }, { span: 15 }), getItem(false, form, item, isAdd, formData, {span: 5}, {span: 15}),
)} )}
</Modal> </Modal>
); );
}); });
@connect(({ formList, DataColumn, DataObj, loading }) => ({ @connect(({formList, DataColumn, DataObj, loading}) => ({
formList, formList,
DataColumn, DataColumn,
DataObj, DataObj,
...@@ -207,9 +209,9 @@ class FormList extends React.Component { ...@@ -207,9 +209,9 @@ class FormList extends React.Component {
if (refIds.length > 0) { if (refIds.length > 0) {
this.props.dispatch({ this.props.dispatch({
type: 'formList/getBatchOptions', type: 'formList/getBatchOptions',
payload: { ids: refIds }, payload: {ids: refIds},
callback: options => { callback: options => {
this.setState({ options: { ...this.state.options, ...options } }); this.setState({options: {...this.state.options, ...options}});
}, },
}); });
} }
...@@ -219,8 +221,13 @@ class FormList extends React.Component { ...@@ -219,8 +221,13 @@ class FormList extends React.Component {
this.getOptions(); this.getOptions();
this.props.dispatch({ this.props.dispatch({
type: 'formList/getDetail', type: 'formList/getDetail',
payload: { dataObjId:this.state.objId,key:this.state.primaryKey ,value:record[this.state.primaryKey] ,isBase:false }, payload: {
callback:record => { dataObjId: this.state.objId,
key: this.state.primaryKey,
value: record[this.state.primaryKey],
isBase: false
},
callback: record => {
this.setState({ this.setState({
formData: record, formData: record,
modalVisible: true, modalVisible: true,
...@@ -230,22 +237,9 @@ class FormList extends React.Component { ...@@ -230,22 +237,9 @@ class FormList extends React.Component {
}, },
}); });
// } else {
// router.push({
// pathname: '/admin/ddl/dataObj/formEdit',
// state: {
// id: this.state.objId,
// recordId: record[this.state.primaryKey],
// recordKey: this.state.primaryKey,
// isAdd: false,
// isView:false
// },
// });
// }
}; };
view = record => { view = record => {
// if (this.state.formItem.length < 10) {
this.getOptions(); this.getOptions();
this.setState({ this.setState({
formData: record, formData: record,
...@@ -253,18 +247,7 @@ class FormList extends React.Component { ...@@ -253,18 +247,7 @@ class FormList extends React.Component {
isAdd: false, isAdd: false,
isView: true, isView: true,
}); });
// } else {
// router.push({
// pathname: '/admin/ddl/dataObj/formEdit',
// state: {
// id: this.state.objId,
// recordId: record[this.state.primaryKey],
// recordKey: this.state.primaryKey,
// isAdd: false,
// isView:true
// },
// });
// }
}; };
isJSON = str => { isJSON = str => {
...@@ -301,7 +284,7 @@ class FormList extends React.Component { ...@@ -301,7 +284,7 @@ class FormList extends React.Component {
}; };
viewProcess = record => { viewProcess = record => {
const { dispatch } = this.props; const {dispatch} = this.props;
dispatch({ dispatch({
type: 'formList/getAppId', type: 'formList/getAppId',
payload: { payload: {
...@@ -335,33 +318,34 @@ class FormList extends React.Component { ...@@ -335,33 +318,34 @@ class FormList extends React.Component {
}); });
} }
}; };
//渲染值 //渲染值
componentDidMount() { componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props; const {dispatch, isFormCom, isSelect, callback, valueName} = this.props;
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize);
if (this.props.objCode) { if (this.props.objCode) {
const { dispatch, objCode, sql } = this.props; const {dispatch, objCode, sql} = this.props;
if (objCode == 1 || objCode == '1') { if (objCode == 1 || objCode == '1') {
this.initColumn(); this.initColumn();
} else { } else {
dispatch({ dispatch({
type: 'DataObj/findByCode', type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode }, payload: {objCode: this.props.objCode},
callback: dataObj => { callback: dataObj => {
this.setState({ objId: dataObj.id, isTable: data.isTable }, () => { this.setState({objId: dataObj.id, isTable: data.isTable}, () => {
dispatch({ dispatch({
type: 'DataRight/getUserRight', type: 'DataRight/getUserRight',
payload: { objId: this.state.objId }, payload: {objId: this.state.objId},
callback: data => { callback: data => {
if (!this.props.rights) { if (!this.props.rights) {
this.setState({ rights: data }); this.setState({rights: data});
} }
dispatch({ dispatch({
type: 'DataRight/getUserColumnRight', type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId }, payload: {objId: this.state.objId},
callback: data => { callback: data => {
this.setState({ columnRights: data }); this.setState({columnRights: data});
this.initColumn(); this.initColumn();
}, },
}); });
...@@ -374,23 +358,23 @@ class FormList extends React.Component { ...@@ -374,23 +358,23 @@ class FormList extends React.Component {
} else { } else {
dispatch({ dispatch({
type: 'formList/getObjDetail', type: 'formList/getObjDetail',
payload: { id: this.state.objId }, payload: {id: this.state.objId},
callback: data => { callback: data => {
this.setState({ isTable: data.isTable }); this.setState({isTable: data.isTable});
}, },
}); });
dispatch({ dispatch({
type: 'DataRight/getUserRight', type: 'DataRight/getUserRight',
payload: { objId: this.state.objId }, payload: {objId: this.state.objId},
callback: data => { callback: data => {
if (!this.props.rights) { if (!this.props.rights) {
this.setState({ rights: data }); this.setState({rights: data});
} }
dispatch({ dispatch({
type: 'DataRight/getUserColumnRight', type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId }, payload: {objId: this.state.objId},
callback: data => { callback: data => {
this.setState({ columnRights: data }); this.setState({columnRights: data});
this.initColumn(); this.initColumn();
}, },
}); });
...@@ -398,13 +382,16 @@ class FormList extends React.Component { ...@@ -398,13 +382,16 @@ class FormList extends React.Component {
}); });
} }
} }
/** /**
* 移除监听器 * 移除监听器
*/ */
componentWillUnmount() { componentWillUnmount() {
window.removeEventListener('resize', this.resize); window.removeEventListener('resize', this.resize);
} }
custom = this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null; custom = this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null;
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const b = nextProps.value || {}; const b = nextProps.value || {};
...@@ -433,28 +420,29 @@ class FormList extends React.Component { ...@@ -433,28 +420,29 @@ class FormList extends React.Component {
const x = nextProps.selects; const x = nextProps.selects;
const y = this.props.selects; const y = this.props.selects;
if (JSON.stringify(x) != JSON.stringify(y)) { if (JSON.stringify(x) != JSON.stringify(y)) {
this.setState({ selects: x }); this.setState({selects: x});
} }
} }
initColumn = () => { initColumn = () => {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props; const {dispatch, isFormCom, isSelect, callback, valueName} = this.props;
const { rights, columnRights } = this.state; const {rights, columnRights} = this.state;
if (this.props.value && this.props.value.columns) { if (this.props.value && this.props.value.columns) {
this.columns = this.props.value.columns; this.columns = this.props.value.columns;
let cacheList = []; let cacheList = [];
let cacheChecked = []; let cacheChecked = [];
// 表头筛选逻辑 // 表头筛选逻辑
Array.isArray(this.props.value.columns) && Array.isArray(this.props.value.columns) &&
this.props.value.columns.map(item => { this.props.value.columns.map(item => {
if (item.dataIndex != null) { if (item.dataIndex != null) {
cacheList.push({ cacheList.push({
label: item.title, label: item.title,
value: item.dataIndex, value: item.dataIndex,
}); });
cacheChecked.push(item.dataIndex); cacheChecked.push(item.dataIndex);
} }
}); });
this.checkList = cacheList; this.checkList = cacheList;
this.setState({ this.setState({
...@@ -466,9 +454,9 @@ class FormList extends React.Component { ...@@ -466,9 +454,9 @@ class FormList extends React.Component {
} else { } else {
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
payload: { dataObjId: this.state.objId }, payload: {dataObjId: this.state.objId},
callback: datas => { callback: datas => {
this.state.formItem=datas this.state.formItem = datas
const querys = []; const querys = [];
const groups = {}; const groups = {};
const refIds = []; const refIds = [];
...@@ -482,23 +470,23 @@ class FormList extends React.Component { ...@@ -482,23 +470,23 @@ class FormList extends React.Component {
if (datas[t].isGroupQuery != null) { if (datas[t].isGroupQuery != null) {
dispatch({ dispatch({
type: 'formList/getGroupList', type: 'formList/getGroupList',
payload: { columnId: datas[t].id }, payload: {columnId: datas[t].id},
callback: gourp => { callback: gourp => {
groups[datas[t].id] = gourp; groups[datas[t].id] = gourp;
this.setState({ groups }); this.setState({groups});
}, },
}); });
} }
} }
} }
if (querys.length > 0) { if (querys.length > 0) {
this.setState({ querys }); this.setState({querys});
if (refIds.length > 0) { if (refIds.length > 0) {
dispatch({ dispatch({
type: 'formList/getBatchOptions', type: 'formList/getBatchOptions',
payload: { ids: refIds }, payload: {ids: refIds},
callback: options => { callback: options => {
this.setState({ options }); this.setState({options});
}, },
}); });
} }
...@@ -514,7 +502,7 @@ class FormList extends React.Component { ...@@ -514,7 +502,7 @@ class FormList extends React.Component {
} else { } else {
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
payload: { dataObjId: this.state.objId }, payload: {dataObjId: this.state.objId},
callback: datas => { callback: datas => {
const querys = []; const querys = [];
const refIds = []; const refIds = [];
...@@ -576,7 +564,7 @@ class FormList extends React.Component { ...@@ -576,7 +564,7 @@ class FormList extends React.Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} /> <FilePreview path={queryApiActionPath() + f.path} pathName={f.name}/>
</li> </li>
); );
})} })}
...@@ -590,7 +578,7 @@ class FormList extends React.Component { ...@@ -590,7 +578,7 @@ class FormList extends React.Component {
} else { } else {
column.render = val => column.render = val =>
val && val.length > 100 ? ( val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}> <Tooltip title={val} overlayStyle={{width: 1000}}>
<span <span
style={{ style={{
width: column.width || 200, width: column.width || 200,
...@@ -609,7 +597,7 @@ class FormList extends React.Component { ...@@ -609,7 +597,7 @@ class FormList extends React.Component {
); );
} }
this.setState({ tableWidth: (datas.length - 1) * 200 }); this.setState({tableWidth: (datas.length - 1) * 200});
this.columns.push(column); this.columns.push(column);
this.setState({ this.setState({
cacheColumns: cloneDeep(this.columns), cacheColumns: cloneDeep(this.columns),
...@@ -622,10 +610,10 @@ class FormList extends React.Component { ...@@ -622,10 +610,10 @@ class FormList extends React.Component {
if (datas[t].isGroupQuery != null) { if (datas[t].isGroupQuery != null) {
dispatch({ dispatch({
type: 'formList/getGroupList', type: 'formList/getGroupList',
payload: { columnId: datas[t].id }, payload: {columnId: datas[t].id},
callback: gourp => { callback: gourp => {
groups[datas[t].id] = gourp; groups[datas[t].id] = gourp;
this.setState({ groups }); this.setState({groups});
}, },
}); });
} }
...@@ -633,13 +621,13 @@ class FormList extends React.Component { ...@@ -633,13 +621,13 @@ class FormList extends React.Component {
i++; i++;
} }
if (querys.length > 0) { if (querys.length > 0) {
this.setState({ querys }); this.setState({querys});
if (refIds.length > 0) { if (refIds.length > 0) {
dispatch({ dispatch({
type: 'formList/getBatchOptions', type: 'formList/getBatchOptions',
payload: { ids: refIds }, payload: {ids: refIds},
callback: options => { callback: options => {
this.setState({ options }); this.setState({options});
}, },
}); });
} }
...@@ -657,7 +645,7 @@ class FormList extends React.Component { ...@@ -657,7 +645,7 @@ class FormList extends React.Component {
if (this.columns == null || this.columns.length == 0) { if (this.columns == null || this.columns.length == 0) {
return; return;
} }
const { dispatch } = this.props; const {dispatch} = this.props;
const pagination = this.state.data.pagination; const pagination = this.state.data.pagination;
if (params == null) { if (params == null) {
...@@ -668,25 +656,25 @@ class FormList extends React.Component { ...@@ -668,25 +656,25 @@ class FormList extends React.Component {
query: JSON.stringify(values != null ? values : this.state.formValues), query: JSON.stringify(values != null ? values : this.state.formValues),
}; };
}else{ } else {
if(params.pageNo==null&&callPage==null&&this.props.value.getPage==null) return; if (params.pageNo == null && callPage == null && this.props.value.getPage == null) return;
} }
if (this.props.objCode && (this.props.objCode == '1' || this.props.objCode == 1)) { if (this.props.objCode && (this.props.objCode == '1' || this.props.objCode == 1)) {
if (callPage) { if (callPage) {
callPage(params, data => { callPage(params, data => {
if (!this.state.isReady) { if (!this.state.isReady) {
this.setState({ data, isReady: true }); this.setState({data, isReady: true});
} else { } else {
this.setState({ data }); this.setState({data});
} }
}); });
} else if (this.props.value && this.props.value.getPage) { } else if (this.props.value && this.props.value.getPage) {
this.props.value.getPage(params, data => { this.props.value.getPage(params, data => {
if (!this.state.isReady) { if (!this.state.isReady) {
this.setState({ data, isReady: true }); this.setState({data, isReady: true});
} else { } else {
this.setState({ data }); this.setState({data});
} }
}); });
} }
...@@ -702,9 +690,9 @@ class FormList extends React.Component { ...@@ -702,9 +690,9 @@ class FormList extends React.Component {
}, },
callback: data => { callback: data => {
if (!this.state.isReady) { if (!this.state.isReady) {
this.setState({ data, isReady: true }); this.setState({data, isReady: true});
} else { } else {
this.setState({ data }); this.setState({data});
} }
}, },
}); });
...@@ -713,7 +701,7 @@ class FormList extends React.Component { ...@@ -713,7 +701,7 @@ class FormList extends React.Component {
handleStandardTableChange = (pagination, filtersArg, sorter) => { handleStandardTableChange = (pagination, filtersArg, sorter) => {
const filters = Object.keys(filtersArg).reduce((obj, key) => { const filters = Object.keys(filtersArg).reduce((obj, key) => {
const newObj = { ...obj }; const newObj = {...obj};
newObj[key] = getValue(filtersArg[key]); newObj[key] = getValue(filtersArg[key]);
return newObj; return newObj;
}, {}); }, {});
...@@ -788,8 +776,8 @@ class FormList extends React.Component { ...@@ -788,8 +776,8 @@ class FormList extends React.Component {
}; };
batchDelete = e => { batchDelete = e => {
const { dispatch } = this.props; const {dispatch} = this.props;
const { selectedRows } = this.state; const {selectedRows} = this.state;
if (!selectedRows) return; if (!selectedRows) return;
...@@ -824,9 +812,9 @@ class FormList extends React.Component { ...@@ -824,9 +812,9 @@ class FormList extends React.Component {
handleSearch = e => { handleSearch = e => {
e.preventDefault(); e.preventDefault();
const { dispatch, form } = this.props; const {dispatch, form} = this.props;
const { formValues } = this.state; const {formValues} = this.state;
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
...@@ -871,11 +859,11 @@ class FormList extends React.Component { ...@@ -871,11 +859,11 @@ class FormList extends React.Component {
pageSize: pagination.pageSize ? pagination.pageSize : this.props.pageSize || 10, pageSize: pagination.pageSize ? pagination.pageSize : this.props.pageSize || 10,
...e, ...e,
}; };
this.setState({ formValues: { ...e, ...this.state.formValues } }); this.setState({formValues: {...e, ...this.state.formValues}});
this.getPage(params); this.getPage(params);
}; };
handleFormReset = () => { handleFormReset = () => {
const { form, dispatch } = this.props; const {form, dispatch} = this.props;
form.resetFields(); form.resetFields();
this.setState( this.setState(
{ {
...@@ -887,15 +875,15 @@ class FormList extends React.Component { ...@@ -887,15 +875,15 @@ class FormList extends React.Component {
); );
}; };
getItem = (isQuery, form, item, isAdd, formData, labelCol, wrapperCol) => { getItem = (isQuery, form, item, isAdd, formData, labelCol, wrapperCol) => {
const { groups, isView } = this.state; const {groups, isView} = this.state;
// console.log(item);
//如果隐藏的话 就用隐藏域放置 //如果隐藏的话 就用隐藏域放置
if (item.isHidden) { if (item.isHidden) {
return ( return (
<FormItem> <FormItem className={styles.hidden}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
})(<Input type="hidden" placeholder="请输入" />)} })(<Input type="hidden" placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} }
...@@ -908,23 +896,23 @@ class FormList extends React.Component { ...@@ -908,23 +896,23 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入" />)} })(<Input style={{width: '70%'}} readOnly={!isAdd} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} }
} else if (item.referenceObjId != null) { } else if (item.referenceObjId != null) {
const { options } = this.state; const {options} = this.state;
const ops = options[item.id + ''] || []; const ops = options[item.id + ''] || [];
return ( return (
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})( })(
<Select <Select
disabled={isView} disabled={isView}
style={{ width: '70%' }} style={{width: '70%'}}
optionFilterProp="children" optionFilterProp="children"
showSearch showSearch
filterOption={(input, option) => filterOption={(input, option) =>
...@@ -936,10 +924,10 @@ class FormList extends React.Component { ...@@ -936,10 +924,10 @@ class FormList extends React.Component {
allowClear allowClear
> >
{ops.map(r => {ops.map(r =>
<Option value={r[item.referenceCodeName]} key={r[item.referenceCodeName]}> <Option value={r[item.referenceCodeName]} key={r[item.referenceCodeName]}>
{r[item.referenceNameName]} {r[item.referenceNameName]}
</Option> </Option>
)} )}
</Select>, </Select>,
)} )}
</FormItem> </FormItem>
...@@ -949,9 +937,9 @@ class FormList extends React.Component { ...@@ -949,9 +937,9 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], 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 value={'0'} key={'0'}>
审核通过 审核通过
</Option> </Option>
...@@ -974,8 +962,8 @@ class FormList extends React.Component { ...@@ -974,8 +962,8 @@ class FormList extends React.Component {
: formData[item.name] && this.isJSON(formData[item.name]) : formData[item.name] && this.isJSON(formData[item.name])
? JSON.parse(formData[item.name]) ? JSON.parse(formData[item.name])
: null, : null,
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})(<UploadCom disabled={isView} />)} })(<UploadCom disabled={isView}/>)}
</FormItem> </FormItem>
); );
} else if (isQuery && item.isGroupQuery != null && item.isGroupQuery) { } else if (isQuery && item.isGroupQuery != null && item.isGroupQuery) {
...@@ -986,11 +974,11 @@ class FormList extends React.Component { ...@@ -986,11 +974,11 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})( })(
<Select <Select
disabled={isView} disabled={isView}
style={{ width: 200 }} style={{width: 200}}
placeholder="请选择" placeholder="请选择"
optionFilterProp="children" optionFilterProp="children"
showSearch showSearch
...@@ -1015,8 +1003,8 @@ class FormList extends React.Component { ...@@ -1015,8 +1003,8 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)} })(<Input disabled={isView} style={{width: '70%'}} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} else if (number.indexOf(item.type) > -1) { } else if (number.indexOf(item.type) > -1) {
...@@ -1025,7 +1013,7 @@ class FormList extends React.Component { ...@@ -1025,7 +1013,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [ rules: [
{ required: !item.isNull }, {required: !item.isNull},
(rule, value, callback) => { (rule, value, callback) => {
var errors = []; var errors = [];
var reg = new RegExp(/(^-?[0-9][0-9]*(.[0-9]+)?)$/); var reg = new RegExp(/(^-?[0-9][0-9]*(.[0-9]+)?)$/);
...@@ -1035,7 +1023,7 @@ class FormList extends React.Component { ...@@ -1035,7 +1023,7 @@ class FormList extends React.Component {
callback(errors); callback(errors);
}, },
], ],
})(<Input disabled={isView} placeholder="请输入" />)} })(<Input disabled={isView} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} else if (isQuery && data.indexOf(item.type) > -1) { } else if (isQuery && data.indexOf(item.type) > -1) {
...@@ -1043,12 +1031,12 @@ class FormList extends React.Component { ...@@ -1043,12 +1031,12 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? null : moment(formData[item.name]), initialValue: formData == null ? null : moment(formData[item.name]),
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})( })(
<RangePicker <RangePicker
disabled={isView} disabled={isView}
format={item.dataFormatStrWeb == null ? 'YYYY-MM-DD HH:mm:ss' : item.dataFormatStrWeb} format={item.dataFormatStrWeb == null ? 'YYYY-MM-DD HH:mm:ss' : item.dataFormatStrWeb}
style={{ width: '95%' }} style={{width: '95%'}}
/>, />,
)} )}
</FormItem> </FormItem>
...@@ -1063,11 +1051,11 @@ class FormList extends React.Component { ...@@ -1063,11 +1051,11 @@ class FormList extends React.Component {
: formData[item.name] : formData[item.name]
? moment(formData[item.name]) ? moment(formData[item.name])
: null, : null,
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})( })(
<DatePicker <DatePicker
format={item.dataFormatStrWeb == null ? 'YYYY-MM-DD HH:mm:ss' : item.dataFormatStrWeb} format={item.dataFormatStrWeb == null ? 'YYYY-MM-DD HH:mm:ss' : item.dataFormatStrWeb}
style={{ width: '100%' }} style={{width: '100%'}}
placeholder="请输入" placeholder="请输入"
disabled={isView} disabled={isView}
/>, />,
...@@ -1079,26 +1067,26 @@ class FormList extends React.Component { ...@@ -1079,26 +1067,26 @@ class FormList extends React.Component {
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{required: !item.isNull}],
})(<Input disabled={isView} style={{ width: '70%' }} placeholder="请输入" />)} })(<Input disabled={isView} style={{width: '70%'}} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} }
}; };
renderForm() { renderForm() {
const { form, get } = this.props; const {form, get} = this.props;
const { querys } = this.state; const {querys} = this.state;
if (querys.length == 0) { if (querys.length == 0) {
return ''; return '';
} }
return ( return (
<Form layout="inline"> <Form layout="inline">
<Row style={{ padding: '15px' }}> <Row style={{padding: '15px'}}>
{querys.map(item => ( {querys.map(item => (
<Col style={{ height: 58 }} span={get === 'mobile' ? 24 : 8} key={item.id}> <Col style={{height: 58}} span={get === 'mobile' ? 24 : 8} key={item.id}>
{this.getItem( {this.getItem(
true, true,
form, form,
...@@ -1122,7 +1110,7 @@ class FormList extends React.Component { ...@@ -1122,7 +1110,7 @@ class FormList extends React.Component {
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}> <Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
查询 查询
</Button> </Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}> <Button style={{marginLeft: 8}} onClick={this.handleFormReset}>
重置 重置
</Button> </Button>
{/* <a style={{ marginLeft: 8 }} onClick={this.toggleForm}> {/* <a style={{ marginLeft: 8 }} onClick={this.toggleForm}>
...@@ -1134,6 +1122,7 @@ class FormList extends React.Component { ...@@ -1134,6 +1122,7 @@ class FormList extends React.Component {
</Form> </Form>
); );
} }
/** /**
* @description: 表头筛选复选框 根据用户筛选将表头内容重置 * @description: 表头筛选复选框 根据用户筛选将表头内容重置
* @param { Array<string> } 用户选择参数 * @param { Array<string> } 用户选择参数
...@@ -1145,7 +1134,7 @@ class FormList extends React.Component { ...@@ -1145,7 +1134,7 @@ class FormList extends React.Component {
message.error('至少选择一项'); message.error('至少选择一项');
return; return;
} }
const { cacheColumns } = this.state; const {cacheColumns} = this.state;
let initList = []; let initList = [];
checkedValues.map(item => { checkedValues.map(item => {
let ary = cacheColumns.filter(data => data.dataIndex === item); let ary = cacheColumns.filter(data => data.dataIndex === item);
...@@ -1158,12 +1147,13 @@ class FormList extends React.Component { ...@@ -1158,12 +1147,13 @@ class FormList extends React.Component {
checkedList: checkedValues, checkedList: checkedValues,
}); });
}; };
render() { render() {
const { modalVisible, selectedRows, querys, tableWidth, rights, data, isReady } = this.state; const {modalVisible, selectedRows, querys, tableWidth, rights, data, isReady} = this.state;
if (!isReady) { if (!isReady) {
return ( return (
<div style={{ width: 20, margin: 'auto' }}> <div style={{width: 20, margin: 'auto'}}>
<Spin /> <Spin/>
</div> </div>
); );
} }
...@@ -1176,11 +1166,11 @@ class FormList extends React.Component { ...@@ -1176,11 +1166,11 @@ class FormList extends React.Component {
notShowBack, notShowBack,
json, json,
istableCom, // 是否有模板设计器调用 istableCom, // 是否有模板设计器调用
value: { btns }, value: {btns},
loading, loading,
} = this.props; } = this.props;
const { showMobileDiv, isView } = this.state; const {showMobileDiv, isView} = this.state;
let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度 let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度
let isMobile = scrollWidth < 1000; let isMobile = scrollWidth < 1000;
...@@ -1188,7 +1178,7 @@ class FormList extends React.Component { ...@@ -1188,7 +1178,7 @@ class FormList extends React.Component {
isMobile = true; isMobile = true;
} }
let showDiv =json.twidth?json.twidth:( let showDiv = json.twidth ? json.twidth : (
document.querySelector('#mobelDiv') && document.querySelector('#mobelDiv') &&
document.querySelector('#mobelDiv')?.parentNode.clientWidth); document.querySelector('#mobelDiv')?.parentNode.clientWidth);
const parentMethods = { const parentMethods = {
...@@ -1227,63 +1217,43 @@ class FormList extends React.Component { ...@@ -1227,63 +1217,43 @@ class FormList extends React.Component {
fixed: 'right', fixed: 'right',
width: width, width: width,
render: (text, record) => { render: (text, record) => {
let Dom = [];
if (isSelect) {
if (this.state.selects.includes(record[valueName])) {
Dom.push(<span>已选择</span>);
} else {
Dom.push(<a onClick={callback.bind(this, record, this.columns)}>选择</a>);
}
}
if (rights) {
if (rights.includes('view')) {
Dom.push(
<a onClick={this.view.bind(this, record)}>查看详情</a>
);
}
if (rights.includes('edit')) {
Dom.push(<a onClick={this.modify.bind(this, record)}>编辑</a>);
}
if (rights.includes('viewProcess') && record.process_biz_key) {
Dom.push(<a onClick={this.viewProcess.bind(this, record)}>流程详情</a>);
}
if (rights.includes('delete')) {
Dom.push(<Popconfirm
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消"
>
<a>删除</a>
</Popconfirm>)
}
}
return ( return (
<Fragment> <Fragment>
<div style={{ textAlign: 'center', paddingLeft: '0px', paddingRight: '0px' }}> <div style={{textAlign: 'center', paddingLeft: '0px', paddingRight: '0px'}}>
{isSelect ? ( {Dom && Dom.length && Dom.map((x, index) => <Fragment key={Math.random()}>{x}
this.state.selects.includes(record[valueName]) ? ( {index > 0 && index !== Dom.length - 1 && <Divider type="vertical"/>}
<> </Fragment>)}
<span>已选择</span>
<Divider type="vertical" />
</>
) : (
<>
<a onClick={callback.bind(this, record, this.columns)}>选择</a>
<Divider type="vertical" />
</>
)
) : (
''
)}
{rights && !rights.includes('view') ? (
''
) : (
<div>
<a onClick={this.view.bind(this, record)}>查看详情</a>
<Divider type="vertical" />
</div>
)}
{rights && !rights.includes('edit') ? (
''
) : (
<>
<a onClick={this.modify.bind(this, record)}>编辑</a>
<Divider type="vertical" />
</>
)}
{rights && rights.includes('viewProcess') && record.process_biz_key ? (
<>
<a onClick={this.viewProcess.bind(this, record)}>流程详情</a>
{rights.includes('delete') ? <Divider type="vertical" /> : ''}
</>
) : (
''
)}
{rights && !rights.includes('delete') ? (
''
) : (
<>
{' '}
<Popconfirm
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消"
>
<a>删除</a>
</Popconfirm>
</>
)}
</div> </div>
</Fragment> </Fragment>
); );
...@@ -1332,7 +1302,7 @@ class FormList extends React.Component { ...@@ -1332,7 +1302,7 @@ class FormList extends React.Component {
} }
const xxxx = ( const xxxx = (
<> <>
<Card bordered={false} bodyStyle={{ padding: 0,width:json.twidth?json.twidth:"100%" }}> <Card bordered={false} bodyStyle={{padding: 0, width: json.twidth ? json.twidth : "100%"}}>
<div className={styles.tableList}> <div className={styles.tableList}>
<div className={styles.tableListForm}>{this.renderForm()}</div> <div className={styles.tableListForm}>{this.renderForm()}</div>
<div className={styles.tableListOperator}> <div className={styles.tableListOperator}>
...@@ -1344,7 +1314,7 @@ class FormList extends React.Component { ...@@ -1344,7 +1314,7 @@ class FormList extends React.Component {
</Button> </Button>
)} )}
{btns && btns.before && btns.before.length > 0 {btns && btns.before && btns.before.length > 0
? btns.before.map(r => <Button {...r} loading={loading} />) ? btns.before.map(r => <Button {...r} loading={loading}/>)
: ''} : ''}
{rights && !rights.includes('add') ? ( {rights && !rights.includes('add') ? (
'' ''
...@@ -1356,13 +1326,13 @@ class FormList extends React.Component { ...@@ -1356,13 +1326,13 @@ class FormList extends React.Component {
{rights && !rights.includes('searchData') ? ( {rights && !rights.includes('searchData') ? (
'' ''
) : ( ) : (
<SearchInfo hanldeHighSearch={this.hanldeHighSearch} objId={this.state.objId} /> <SearchInfo hanldeHighSearch={this.hanldeHighSearch} objId={this.state.objId}/>
)} )}
{rights && !rights.includes('importData') ? ( {rights && !rights.includes('importData') ? (
'' ''
) : ( ) : (
<ImportUtil objId={this.state.objId} callback={()=>this.getPage()} /> <ImportUtil objId={this.state.objId} callback={() => this.getPage()}/>
)} )}
{rights && !rights.includes('exportCurrent') ? ( {rights && !rights.includes('exportCurrent') ? (
'' ''
...@@ -1377,17 +1347,17 @@ class FormList extends React.Component { ...@@ -1377,17 +1347,17 @@ class FormList extends React.Component {
{rights && !rights.includes('exportData') ? ( {rights && !rights.includes('exportData') ? (
'' ''
) : ( ) : (
<ExportInfo objId={this.state.objId} /> <ExportInfo objId={this.state.objId}/>
)} )}
{rights && !rights.includes('statistics') ? ( {rights && !rights.includes('statistics') ? (
'' ''
) : ( ) : (
<StatisticsInfo objId={this.state.objId} /> <StatisticsInfo objId={this.state.objId}/>
)} )}
{rights && !rights.includes('delete') {rights && !rights.includes('delete')
? '' ? ''
: selectedRows.length > 0 && ( : selectedRows.length > 0 && (
<span> <span>
<Popconfirm <Popconfirm
title="确定删除该数据?" title="确定删除该数据?"
onConfirm={this.batchDelete} onConfirm={this.batchDelete}
...@@ -1397,7 +1367,7 @@ class FormList extends React.Component { ...@@ -1397,7 +1367,7 @@ class FormList extends React.Component {
<Button>批量删除</Button> <Button>批量删除</Button>
</Popconfirm> </Popconfirm>
</span> </span>
)} )}
{rights && !rights.includes('headerFilter') ? ( {rights && !rights.includes('headerFilter') ? (
'' ''
) : ( ) : (
...@@ -1428,7 +1398,7 @@ class FormList extends React.Component { ...@@ -1428,7 +1398,7 @@ class FormList extends React.Component {
</Popover> </Popover>
)} )}
{btns && btns.after && btns.after.length > 0 {btns && btns.after && btns.after.length > 0
? btns.after.map(r => <Button {...r} loading={loading} />) ? btns.after.map(r => <Button {...r} loading={loading}/>)
: ''} : ''}
</div> </div>
{!istableCom || (this.props.value && this.props.value.columns) ? ( {!istableCom || (this.props.value && this.props.value.columns) ? (
...@@ -1447,11 +1417,11 @@ class FormList extends React.Component { ...@@ -1447,11 +1417,11 @@ class FormList extends React.Component {
this.props.onSelectRow == null && this.props.onSelectRow == null &&
(rights == null || !rights.includes('delete')) (rights == null || !rights.includes('delete'))
} }
rowKey={this.props.value?.rowKey?this.props.value.rowKey:"row_id"} rowKey={this.props.value?.rowKey ? this.props.value.rowKey : "row_id"}
data={data} data={data}
isHiddenPage={this.props.isHiddenPage != null ? this.props.isHiddenPage : false} isHiddenPage={this.props.isHiddenPage != null ? this.props.isHiddenPage : false}
columns={this.columns} columns={this.columns}
scroll={{ x: AllWidth }} scroll={{x: AllWidth}}
selectedRows={selectedRows} selectedRows={selectedRows}
onSelectRow={this.handleSelectRows} onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange} onChange={this.handleStandardTableChange}
...@@ -1477,10 +1447,10 @@ class FormList extends React.Component { ...@@ -1477,10 +1447,10 @@ class FormList extends React.Component {
this.props.onSelectRow == null && this.props.onSelectRow == null &&
(rights == null || !rights.includes('delete')) (rights == null || !rights.includes('delete'))
} }
rowKey={this.props.value?.rowKey?this.props.value.rowKey:"row_id"} rowKey={this.props.value?.rowKey ? this.props.value.rowKey : "row_id"}
data={data} data={data}
columns={this.columns} columns={this.columns}
scroll={this.props.value && this.props.value.columns ? {} : { x: AllWidth }} scroll={this.props.value && this.props.value.columns ? {} : {x: AllWidth}}
selectedRows={selectedRows} selectedRows={selectedRows}
isHiddenPage={ isHiddenPage={
this.props.isHiddenPage != null ? this.props.isHiddenPage : false this.props.isHiddenPage != null ? this.props.isHiddenPage : false
...@@ -1495,7 +1465,7 @@ class FormList extends React.Component { ...@@ -1495,7 +1465,7 @@ class FormList extends React.Component {
)} )}
</div> </div>
</Card> </Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} /> <CreateForm {...parentMethods} modalVisible={modalVisible}/>
</> </>
); );
if (isFormCom) { if (isFormCom) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论