Commit dae7deda authored by 田翔's avatar 田翔

fix: 增加台账选择器列表显示

parent 700f0cf1
......@@ -202,7 +202,7 @@ const SearchGroup = forwardRef((props, ref) => {
};
const btnsClick = type => {
props && props.btnsClick(type, null);
props?.btnsClick?.(type, null);
};
return (
......
......@@ -29,7 +29,7 @@ const TablePack = (props, ref) => {
setFilteredInfo,
}))
const { parent, readOnly, config, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const { parent, readOnly, config, fieldList, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const [filteredInfo, setFilteredInfo] = useState({})
const inputRef = useRef()
......@@ -126,7 +126,12 @@ const TablePack = (props, ref) => {
const fileColumns = useMemo(() => {
const { webShowFieldGroup, formJson } = config
let showField = webShowFieldGroup ? webShowFieldGroup.split(',').filter(v => v) : []
let showField = []
if (Array.isArray(fieldList) && fieldList.length > 0) {
showField = fieldList
} else {
showField = webShowFieldGroup ? webShowFieldGroup.split(',').filter(v => v) : []
}
let json = getFileInfo(formJson)
let array = []
showField.forEach(v => {
......@@ -157,7 +162,7 @@ const TablePack = (props, ref) => {
})
})
return array
}, [config, filteredInfo])
}, [config, fieldList, filteredInfo])
const columns = useMemo(() => {
let columns = [
......
......@@ -1761,18 +1761,24 @@ const businessWidgets = [
name: '台账名称',
type: 'string',
widget: 'AccountName',
// required: true,
},
fieldshine: {
title: '映射字段',
name: '映射字段',
type: 'array',
widget: 'Fieldshine',
// required: true,
dependencies: ['accountName', '$id'],
default: [],
description: '多字段映射仅支持单选',
},
fieldList: {
title: '前端显示字段',
type: 'array',
default: [],
widget: 'FieldList',
dependencies: ['accountName', '$id'],
description: '默认获取前端台账字段',
},
siteFilter: {
title: '站点过滤',
name: '站点过滤',
......
......@@ -90,6 +90,7 @@ const XRender = (props, ref) => {
}, [schemaForm, form, startTime])
const getValues = async () => {
console.log('form', form)
let { data, errors } = await form.submit()
let formValue = []
Object.keys(data).map((k) => {
......
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import { Input, message, Pagination } from 'antd'
import { SnippetsOutlined } from '@ant-design/icons'
import { GetAccountConfigInfo, GetAccountPageList, getStationListByUserID } from '../../../../apis/process'
......@@ -12,7 +12,7 @@ const AccountSelector = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props
const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder } = schema
const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema
const [params, setParams] = useState({
userID: userID,
......@@ -28,6 +28,7 @@ const AccountSelector = (props) => {
const [config, setConfig] = useState({ webShowFieldGroup: '' })
const [visible, setVisible] = useState(false)
const [keys, setKeys] = useState([])
const tablePackRef = useRef(null)
const iconClick = () => {
if (addons) {
......@@ -154,6 +155,15 @@ const AccountSelector = (props) => {
getDataSource({ ...values })
}
const btnsClick = (type) => {
if (type === '重置') {
console.log('type', type)
tablePackRef.current.setFilteredInfo({})
setParams({ ...params, queryWheres: [] })
getDataSource({ queryWheres: [] })
}
}
const pageChange = (pageIndex, pageSize) => {
getDataSource({ pageIndex, pageSize })
}
......@@ -191,15 +201,18 @@ const AccountSelector = (props) => {
<SearchGroup
onChange={search}
readOnly={true}
btnsClick={btnsClick}
/>
</div>
<div className={styles.bottom}>
<TablePack
ref={tablePackRef}
loading={loading}
readOnly={true}
config={config}
dataSource={dataSource}
btnsClick={() => { }}
btnsClick={btnsClick}
fieldList={fieldList}
tableChange={tableChange}
parent='台账选择器'
rowSelection={{
......
import React, { useMemo, useState } from 'react'
import { Input, message, Row, Col, Checkbox } from 'antd'
import Drag from '../../../../components/Drag'
import {
GetAccountPageList,
GetAccountConfigInfo,
GetTableGroupMeta,
GetTableDataInfo,
SaveTableDataInfo,
EditTableDataInfo,
DeleteTableDataInfo
} from '../../../../../apis/process'
const FieldList = (props) => {
const { value, addons, onChange } = props
const { accountName } = addons.formData
const [visible, setVisible] = useState(false)
const [conifg, setConfig] = useState({})
const options = useMemo(() => {
const { webShowFieldGroup } = conifg
return webShowFieldGroup ? webShowFieldGroup.split(',').filter(v => v) : []
}, [conifg])
const getConfig = async () => {
const { code, data } = await GetAccountConfigInfo(accountName)
if (code === 0) {
setConfig(data)
}
}
const onOk = () => {
setVisible(false)
}
const checkChange = (value) => {
onChange(value)
}
const inputClick = () => {
if (!accountName) {
return message.error('请配置台账名称!')
}
getConfig()
setVisible(true)
}
return (
<div>
<Input value={value} onClick={inputClick} />
<Drag
title='前端显示字段'
onOk={onOk}
onCancel={() => setVisible(false)}
visible={visible}
>
<Checkbox.Group
value={value}
style={{ width: '100%' }}
onChange={checkChange}
>
<Row>
{
options.map(v => {
return (
<Col span={8}>
<Checkbox value={v}>{v}</Checkbox>
</Col>
)
})
}
</Row>
</Checkbox.Group>
</Drag>
</div>
)
}
export default FieldList
\ No newline at end of file
......@@ -6,6 +6,7 @@ import MappedField from './MappedField'
import ControlRules from './ControlRules'
import SourceType from './SourceType'
import TableName from './TableName'
import FieldList from './FieldList'
import FieldName from './FieldName'
import CalculateRule from './CalculateRule'
import AddressSync from './AddressSync'
......@@ -21,6 +22,7 @@ const groupSource = {
ControlRules,
SourceType,
TableName,
FieldList,
FieldName,
CalculateRule,
AddressSync,
......
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