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

自定义导入bug

上级 ca6a992d
......@@ -459,7 +459,7 @@ export default class StatisticsInfo extends React.Component {
};
componentDidMount() {
this.open();
// this.open();
}
pageConfig = (item = 0) => {
......
......@@ -35,6 +35,7 @@ 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';
const FormItem = Form.Item;
let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker;
......@@ -72,7 +73,7 @@ const text = [
const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT'];
const data = ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'];
const CreateForm = Form.create()(props => {
const CreateForm = Form.create()((props) => {
const {
modalVisible,
form,
......@@ -129,8 +130,7 @@ const CreateForm = Form.create()(props => {
]
}
onOk={okHandle}
onCancel={() => handleModalVisible()}
>
onCancel={() => handleModalVisible()}>
{formItem.map((item, index) =>
getItem(false, form, item, isAdd, formData, { span: 5 }, { span: 15 }),
)}
......@@ -200,16 +200,16 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: options => {
callback: (options) => {
this.setState({ options: { ...this.state.options, ...options } });
},
});
}
};
getList = (values, callback,isFirst) => {
getList = (values, callback, isFirst) => {
const {
dispatch,
json: { treeParentIdName,ctgFilterSql},
json: { treeParentIdName, ctgFilterSql },
} = this.props;
if (!values) {
......@@ -218,11 +218,16 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/tree',
payload: { ...values,ctgFilterSql:ctgFilterSql, parentIdName: treeParentIdName, dataObjId: this.state.objId },
payload: {
...values,
ctgFilterSql: ctgFilterSql,
parentIdName: treeParentIdName,
dataObjId: this.state.objId,
},
callback: callback,
});
};
modify = record => {
modify = (record) => {
// if (this.state.formItem.length < 10) {
this.getOptions();
this.setState({
......@@ -245,7 +250,7 @@ class TreeList extends React.Component {
// }
};
view = record => {
view = (record) => {
// if (this.state.formItem.length < 10) {
this.getOptions();
this.setState({
......@@ -268,7 +273,7 @@ class TreeList extends React.Component {
// }
};
isJSON = str => {
isJSON = (str) => {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
......@@ -285,7 +290,7 @@ class TreeList extends React.Component {
console.log('这不是个字符串');
};
delete = record => {
delete = (record) => {
//找出主键
let Keys = {};
Keys[this.state.primaryKey] = record[this.state.primaryKey];
......@@ -296,7 +301,7 @@ class TreeList extends React.Component {
objId: this.state.objId,
},
callback: () => {
this.getPage({ parentId: this.state.parentId }, null, null, list => {
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
......@@ -307,14 +312,14 @@ class TreeList extends React.Component {
});
};
viewProcess = record => {
viewProcess = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'formList/getAppId',
payload: {
code: record.process_biz_key,
},
callback: data => {
callback: (data) => {
router.push({ pathname: '/portal/serviceCentre/getdetail', state: { id: data.id } });
},
});
......@@ -323,7 +328,7 @@ class TreeList extends React.Component {
/**
* 宽度自适应函数
*/
resize = e => {
resize = (e) => {
let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度
let showMobileDiv = scrollWidth - 77;
if (document.querySelector('#previewDiv')) {
......@@ -337,6 +342,7 @@ class TreeList extends React.Component {
});
}
};
//渲染值
componentDidMount() {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
......@@ -350,19 +356,19 @@ class TreeList extends React.Component {
dispatch({
type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode },
callback: dataObj => {
callback: (dataObj) => {
this.setState({ objId: dataObj.id, isTable: data.isTable }, () => {
dispatch({
type: 'DataRight/getUserRight',
payload: { objId: this.state.objId },
callback: data => {
callback: (data) => {
if (!this.props.rights) {
this.setState({ rights: data });
}
dispatch({
type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId },
callback: data => {
callback: (data) => {
this.setState({ columnRights: data });
this.initColumn();
},
......@@ -377,21 +383,21 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/getObjDetail',
payload: { id: this.state.objId },
callback: data => {
callback: (data) => {
this.setState({ isTable: data.isTable });
},
});
dispatch({
type: 'DataRight/getUserRight',
payload: { objId: this.state.objId },
callback: data => {
callback: (data) => {
if (!this.props.rights) {
this.setState({ rights: data });
}
dispatch({
type: 'DataRight/getUserColumnRight',
payload: { objId: this.state.objId },
callback: data => {
callback: (data) => {
this.setState({ columnRights: data });
this.initColumn();
},
......@@ -400,13 +406,16 @@ class TreeList extends React.Component {
});
}
}
/**
* 移除监听器
*/
componentWillUnmount() {
window.removeEventListener('resize', this.resize);
}
custom = this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null;
componentWillReceiveProps(nextProps) {
const b = nextProps.value || {};
const a = this.props.value || {};
......@@ -434,6 +443,7 @@ class TreeList extends React.Component {
this.setState({ selects: x });
}
}
initColumn = () => {
const { dispatch, isFormCom, isSelect, callback, valueName } = this.props;
......@@ -448,7 +458,7 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/getHead',
payload: { dataObjId: this.state.objId },
callback: datas => {
callback: (datas) => {
const querys = [];
const refIds = [];
const groups = {};
......@@ -471,7 +481,7 @@ class TreeList extends React.Component {
continue;
}
if (data.includes(datas[t].type)) {
column.render = val => {
column.render = (val) => {
if (val == null) {
return val;
}
......@@ -482,10 +492,10 @@ class TreeList extends React.Component {
}
};
} else if (datas[t].name.indexOf('process_status') > -1) {
column.render = val => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
column.render = (val) => (val ? (val === '0' ? '审核通过' : '审核未通过') : null);
} else if (datas[t].extendTypeId && datas[t].extendTypeId.indexOf('file') > -1) {
//特殊处理附件
column.render = val => {
column.render = (val) => {
if (this.isJSON(val)) {
val = JSON.parse(val);
let files = val.files;
......@@ -506,7 +516,7 @@ class TreeList extends React.Component {
}
};
} else {
column.render = val =>
column.render = (val) =>
val && val.length > 100 ? (
<Tooltip title={val} overlayStyle={{ width: 1000 }}>
<span
......@@ -517,8 +527,7 @@ class TreeList extends React.Component {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
}}>
{val}
</span>
</Tooltip>
......@@ -539,7 +548,7 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/getGroupList',
payload: { columnId: datas[t].id },
callback: gourp => {
callback: (gourp) => {
groups[datas[t].id] = gourp;
this.setState({ groups });
},
......@@ -554,7 +563,7 @@ class TreeList extends React.Component {
dispatch({
type: 'formList/getBatchOptions',
payload: { ids: refIds },
callback: options => {
callback: (options) => {
this.setState({ options });
},
});
......@@ -588,7 +597,7 @@ class TreeList extends React.Component {
if (this.props.objCode && (this.props.objCode == '1' || this.props.objCode == 1)) {
if (callPage) {
callPage(params, data => {
callPage(params, (data) => {
if (!this.state.isReady) {
this.setState({ data, isReady: true });
} else {
......@@ -596,7 +605,7 @@ class TreeList extends React.Component {
}
});
} 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) {
this.setState({ data, isReady: true });
} else {
......@@ -614,7 +623,7 @@ class TreeList extends React.Component {
sql: this.sqlBs16,
dataObjId: this.state.objId,
},
callback: list => {
callback: (list) => {
const data = {
list: list,
pagination: false,
......@@ -673,7 +682,7 @@ class TreeList extends React.Component {
callback: () => {
message.success('操作成功');
this.getPage({ parentId: this.state.parentId }, null, null, list => {
this.getPage({ parentId: this.state.parentId }, null, null, (list) => {
const treeData = this.refesh(this.state.parentId, list, this.state.treeData);
this.setState({
modalVisible: false,
......@@ -700,15 +709,9 @@ class TreeList extends React.Component {
isAdd: true,
isView: false,
});
// } else {
// router.push({
// pathname: '/admin/ddl/dataObj/formEdit',
// state: { id: this.state.objId,isAdd: true,isView:false }
// });
// }
};
handleSelectRows = rows => {
handleSelectRows = (rows) => {
if (this.props.onSelectRow) {
this.props.onSelectRow(rows);
}
......@@ -717,7 +720,7 @@ class TreeList extends React.Component {
});
};
batchDelete = e => {
batchDelete = (e) => {
const { dispatch } = this.props;
const { selectedRows } = this.state;
......@@ -729,7 +732,7 @@ class TreeList extends React.Component {
for (let i in columns) {
if (columns[i].isPrimaryKey) {
//key
Keys[columns[i].name] = selectedRows.map(row => row[columns[i].name]).join(',');
Keys[columns[i].name] = selectedRows.map((row) => row[columns[i].name]).join(',');
}
}
this.props.dispatch({
......@@ -751,7 +754,7 @@ class TreeList extends React.Component {
goBack = () => {
router.goBack();
};
handleSearch = e => {
handleSearch = (e) => {
e.preventDefault();
const { dispatch, form } = this.props;
......@@ -790,7 +793,7 @@ class TreeList extends React.Component {
});
};
hanldeHighSearch = e => {
hanldeHighSearch = (e) => {
const pagination = this.props.formList.data.pagination;
let params = {
pageNo: pagination.current ? pagination.current : 1,
......@@ -838,7 +841,7 @@ class TreeList extends React.Component {
rules: [{ required: !item.isNull }],
})(
<Select style={{ width: '70%' }} placeholder="请选择" allowClear>
{ops.map(r => (
{ops.map((r) => (
<Option value={r[item.referenceCodeName]} key={r[item.referenceCodeName]}>
{r[item.referenceNameName]}
</Option>
......@@ -892,7 +895,7 @@ class TreeList extends React.Component {
rules: [{ required: !item.isNull }],
})(
<Select style={{ width: '70%' }} placeholder="请选择" allowClear>
{ops.map(r => (
{ops.map((r) => (
<Option value={r.value} key={r.value}>
{r.value}
</Option>
......@@ -976,7 +979,7 @@ class TreeList extends React.Component {
return (
<Form layout="inline">
<Row style={{ padding: '15px' }}>
{querys.map(item => (
{querys.map((item) => (
<Col style={{ height: 58 }} span={get === 'mobile' ? 24 : 8} key={item.id}>
{this.getItem(
true,
......@@ -995,8 +998,7 @@ class TreeList extends React.Component {
style={{
textAlign: get === 'mobile' ? 'right' : '',
paddingRight: get === 'mobile' ? 12 : '',
}}
>
}}>
<span className={styles.submitButtons}>
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
查询
......@@ -1013,6 +1015,7 @@ class TreeList extends React.Component {
</Form>
);
}
onSelect = (selectedKeys, info) => {
if (info.selectedNodes.length > 0) {
const parentId = selectedKeys[0] != '0-0' ? selectedKeys[0] : null;
......@@ -1020,29 +1023,33 @@ class TreeList extends React.Component {
this.getPage({ parentId: parentId });
}
};
onLoadData = treeNode => {
return new Promise(resolve => {
onLoadData = (treeNode) => {
return new Promise((resolve) => {
if (treeNode.props.childs) {
resolve();
return;
}
const parentId = treeNode.props.eventKey != '0-0' ? treeNode.props.eventKey : null;
this.getList({ parentId: parentId }, list => {
this.getList(
{ parentId: parentId },
(list) => {
treeNode.props.dataRef.childs = list;
this.setState({
treeData: [...this.state.treeData],
});
resolve();
},true);
},
true,
);
});
};
renderTreeNodes = list => {
renderTreeNodes = (list) => {
const {
json: { treeTitleName, treeKeyName },
} = this.props;
return list.map(item => {
return list.map((item) => {
item.title = item[treeTitleName];
item.key = item[treeKeyName];
if (item.childs) {
......@@ -1073,6 +1080,7 @@ class TreeList extends React.Component {
return data;
};
render() {
const { modalVisible, selectedRows, querys, tableWidth, rights, data, isReady } = this.state;
if (!isReady) {
......@@ -1191,8 +1199,7 @@ class TreeList extends React.Component {
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消"
>
cancelText="取消">
<a>删除</a>
</Popconfirm>
</>
......@@ -1250,8 +1257,7 @@ class TreeList extends React.Component {
showLine
defaultExpandedKeys={['0-0']}
onSelect={this.onSelect}
loadData={this.onLoadData}
>
loadData={this.onLoadData}>
{this.renderTreeNodes(this.state.treeData)}
</Tree>
</Card>
......@@ -1269,7 +1275,7 @@ class TreeList extends React.Component {
</Button>
)}
{btns && btns.before && btns.before.length > 0
? btns.before.map(r => <Button {...r} />)
? btns.before.map((r) => <Button {...r} />)
: ''}
{rights && !rights.includes('add') ? (
''
......@@ -1302,17 +1308,21 @@ class TreeList extends React.Component {
/>
)}
{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)}
/>):""}
{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') ? (
''
) : (
......@@ -1331,14 +1341,13 @@ sql={Base16Encode(this.props.sql)}
title="确定删除该数据?"
onConfirm={this.batchDelete}
okText="确定"
cancelText="取消"
>
cancelText="取消">
<Button>批量删除</Button>
</Popconfirm>
</span>
)}
{btns && btns.after && btns.after.length > 0
? btns.after.map(r => <Button {...r} loading={loading} />)
? btns.after.map((r) => <Button {...r} loading={loading} />)
: ''}
</div>
{!istableCom || (this.props.value && this.props.value.columns) ? (
......@@ -1365,8 +1374,7 @@ sql={Base16Encode(this.props.sql)}
overflow: 'hidden',
width: isMobile ? showMobileDiv : showDiv,
height: '100%',
}}
>
}}>
<div>
{get === 'mobile' ? <div>手机端,请将手机横屏查看</div> : null}
{showDiv && (
......
......@@ -111,4 +111,6 @@ const getFormArrayConfig = (header,isAdd,options) => {
return config;
};
export { text, number, date, getFormArrayConfig };
......@@ -4,12 +4,10 @@ import {
Card,
DatePicker,
Divider,
Table,
Form,
Row,
Col,
Input,
InputNumber,
message,
Modal,
Select,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论