Commit 4e4bf0c7 authored by 田翔's avatar 田翔

fix: 一键布局BUG修复

parent 3c941206
{
"name": "panda-xform",
"version": "4.3.4",
"description": "4.3.4 强行增加分组,分组套分组解析成一个分组",
"version": "4.3.5",
"description": "4.3.5 一键布局BUG修复",
"keywords": [
"panda-xform"
],
......
......@@ -268,6 +268,17 @@ export function DeleteTableDataInfo(data) {
});
}
//导出数据
export function ImportAccountData(options, params, data) {
return request({
url: `${BASEURL}/ImportAccountData`,
method: 'post',
...options,
params,
data,
});
}
//导出数据
export function ExportAccountData({ accountName, ids, exportAll }) {
return request({
......
......@@ -5,6 +5,7 @@ import locale from 'antd/es/date-picker/locale/zh_CN'
import { PlusOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, QuestionCircleOutlined, EditOutlined, DownOutlined } from '@ant-design/icons'
import styles from './search.less'
import moment from 'moment'
import { ImportAccountData } from '../../../../apis/process'
const { Search } = Input;
const { RangePicker } = DatePicker;
......@@ -16,7 +17,7 @@ const SearchGroup = forwardRef((props, ref) => {
getQueryInfo,
}))
const { readOnly, btnsClick } = props
const { accountName, readOnly, checkName, btnsClick } = props
const [form] = Form.useForm()
const [showPicker, setShowPicker] = useState(true)
const [dateArray, setDateArray] = useState([])
......@@ -137,7 +138,7 @@ const SearchGroup = forwardRef((props, ref) => {
}
// 默认开启检查全部字段
_data.isCheck = true;
importAccountData(
ImportAccountData(
{
headers: {
'Content-Type': 'multipart/form-data',
......@@ -148,7 +149,7 @@ const SearchGroup = forwardRef((props, ref) => {
).then(res => {
if (res.code === 0) {
message.success('导入成功!');
getAccountData();
// getAccountData();
} else {
message.warning(res.msg);
}
......
import React, { useMemo, useState, useRef, forwardRef, useImperativeHandle } from 'react'
import { Table, Tooltip, Button, Popconfirm, Input, Space, Tag } from 'antd'
import React, { useMemo, useState, forwardRef, useImperativeHandle } from 'react'
import { Table, Tooltip, Button, Popconfirm, Input, Space, Tag, Popover, Checkbox } from 'antd'
import { TweenOneGroup } from 'rc-tween-one'
import styles from './index.less'
import { SearchOutlined } from '@ant-design/icons'
import { SearchOutlined, FormOutlined } from '@ant-design/icons'
import ResizeableTitle from './components/ResizeableTitle'
import FileView from './components/FileView'
import CoordView from './components/CoordView'
......@@ -34,9 +34,12 @@ const TablePack = (props, ref) => {
}))
const { parent, readOnly, config, fieldList, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const { webShowFieldGroup, formJson } = config
const [fieldResize, setFieldResize] = useState({})
const [filteredInfo, setFilteredInfo] = useState({})
const [sortedInfo, setSortedInfo] = useState({})
const [open, setOpen] = useState(false)
const [checks, setChecks] = useState([])
const filtered = useMemo(() => {
let array = []
......@@ -284,7 +287,11 @@ const TablePack = (props, ref) => {
]
}, [readOnly, parent])
const fileColumns = useMemo(() => {
const checkChange = (values) => {
setChecks(values)
}
const showField = useMemo(() => {
const { webShowFieldGroup, formJson } = config
let showField = []
if (Array.isArray(fieldList) && fieldList.length > 0) {
......@@ -292,6 +299,11 @@ const TablePack = (props, ref) => {
} else {
showField = webShowFieldGroup ? webShowFieldGroup.split(',').filter(v => v) : []
}
setChecks(showField)
return showField
}, [webShowFieldGroup, fieldList])
const fileColumns = useMemo(() => {
let json = getFileInfo(formJson)
let array = []
showField.forEach((v, i) => {
......@@ -302,7 +314,31 @@ const TablePack = (props, ref) => {
}
})
return array
}, [parent, config, fieldList, fieldResize, filteredInfo, sortedInfo])
}, [parent, formJson, showField, fieldResize, filteredInfo, sortedInfo])
const showColumns = useMemo(() => {
return fileColumns.filter(v => checks.includes(v.dataIndex))
}, [checks, fileColumns])
const content = (
<div>
<Checkbox.Group
value={checks}
style={{ width: '100%' }}
onChange={checkChange}
>
{
fileColumns.map(v => {
return (
<div key={v.dataIndex}>
<Checkbox value={v.dataIndex}>{v.title}</Checkbox>
</div>
)
})
}
</Checkbox.Group>
</div>
)
const columns = useMemo(() => {
let columns = [
......@@ -313,9 +349,33 @@ const TablePack = (props, ref) => {
filteredValue: null,
render: (_, r, i) => i + 1
},
...fileColumns,
...showColumns,
{
title: '操作',
title: (
<div className={styles.operation}>
<span>操作</span>
<span className={styles.operationSpan}>
<Popover
placement='bottomRight'
title={
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>列配置</div>
<Button size='small' type="link" onClick={() => setOpen(false)}>确定</Button>
</div>
}
trigger='click'
open={open}
content={content}
onOpenChange={(value) => {
setOpen(value)
}}
arrowPointAtCenter
>
<FormOutlined />
</Popover>
</span>
</div>
),
width: btns.length * 35 + 30,
align: 'center',
filteredValue: null,
......@@ -365,7 +425,7 @@ const TablePack = (props, ref) => {
return fileColumns
}
return columns
}, [parent, btns, fileColumns])
}, [parent, btns, dataSource, fileColumns, checks, open])
const onChange = (page, filters, sorter) => {
setFilteredInfo(filters)
......@@ -454,6 +514,24 @@ const TablePack = (props, ref) => {
}
}}
/>
{/* <Drag
title={'列配置'}
width={500}
bodyStyle={{ height: '400px', overflow: 'auto' }}
onOk={() => setVisible(false)}
onCancel={() => setVisible(false)}
visible={visible}
getContainer={false}
>
{
checks.map(v => {
return (
)
})
}
</Drag> */}
</div>
)
......
......@@ -13,6 +13,16 @@
display: flex;
align-items: center;
}
.operation {
.operationSpan {
margin-left: 10px;
display: inline-block;
&:hover {
cursor: pointer;
color: #1890ff;
}
}
}
.@{ant-prefix}-table-wrapper {
height: 100%;
.@{ant-prefix}-spin-nested-loading {
......
......@@ -296,6 +296,7 @@ const Account = (props) => {
<SearchGroup
onChange={search}
btnsClick={btnsClick}
accountName={accountName}
readOnly={readOnly}
/>
</div>
......
......@@ -110,69 +110,6 @@ const RelationForm = (props) => {
return array
}, [formDataObj, config, mappedField, codes, dataSource])
const columns = useMemo(() => {
let btn = ['详情']
if (!disabled) {
btn = ['详情', '编辑', '删除']
}
const { webShowFieldGroup } = config
let field = webShowFieldGroup ? webShowFieldGroup.split(',').filter(v => v) : []
let array = []
if (field.length > 0) {
array.push({ title: '序号', width: 50, align: 'center', render: (_, r, i) => i + 1 })
field.forEach(v => {
array.push({
title: v,
dataIndex: v,
key: v,
ellipsis: {
visibleTitle: false,
},
})
})
array.push({
title: '操作',
dataIndex: '',
key: 'action',
width: btn.length === 1 ? 80 : btn.length * 40,
fixed: 'right',
render: (t, r) => {
return (
<div style={{ display: 'flex', justifyContent: 'center' }}>
{
btn.map(v => {
if (v === '删除') {
return (
<Popconfirm
// disabled={selectedRowKeys.length}
title='确定要删除数据吗?'
onConfirm={() => rowClick(v, r)}
onCancel={() => { }}
okText='确定'
cancelText='取消'
>
<Button type='link' icon={icons[v]} title={v} />
</Popconfirm>
)
}
return (
<Button
type='link'
icon={icons[v]}
title={v}
onClick={() => rowClick(v, r)}
/>
)
})
}
</div>
)
}
})
}
return array
}, [disabled, config, dataSource, formState])
const rowClick = async (v, r) => {
if (addons) {
setRow(r)
......@@ -214,7 +151,7 @@ const RelationForm = (props) => {
let listItem = { type: 'delete', accountTable: accountName, id: r.ID, values: getItem('delete', r) }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
if (r.ID.includes('前端ID')) {
let list = relationForm.data.filter(v => v.id !== r.ID)
let list = relationForm.data.filter(v => v.ID !== r.ID)
addons.setValue('relationForm', { ...relationForm, data: list })
} else {
addons.setValue('relationForm', { ...relationForm, data: [...relationForm.data, listItem] })
......
......@@ -201,7 +201,7 @@ const getWidgetSetting = (type, { title, tableName, tableType }) => {
}
} else if (type === '数值') {
return {
title: "数值",
title: title,
"type": "string",
"widget": "NumberInput",
"presetValue": "0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment