Commit af4a21c6 authored by 田翔's avatar 田翔

fix: 台账列表接口取值修改

parent e61f79cf
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "4.4.3", "version": "4.4.4",
"description": "4.4.3 更换地图版本暂时去除loading", "description": "4.4.4 台账列表接口取值修改",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -17,9 +17,9 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -17,9 +17,9 @@ const SearchGroup = forwardRef((props, ref) => {
getQueryInfo, getQueryInfo,
})) }))
const { accountName, readOnly, checkName, btnsClick } = props const { accountName, config, readOnly, checkName, btnsClick } = props
const { enableBatchOperation, enableImportExport, enablePrint, enableQuickSearch, enableTimeFilter } = config
const [form] = Form.useForm() const [form] = Form.useForm()
const [showPicker, setShowPicker] = useState(true)
const [dateArray, setDateArray] = useState([]) const [dateArray, setDateArray] = useState([])
const [formatterStr, setFormatterStr] = useState('YYYY-MM-DD HH:mm:ss') const [formatterStr, setFormatterStr] = useState('YYYY-MM-DD HH:mm:ss')
const [queryInfo, setQueryInfo] = useState({ info: '', timeFrom: '', timeTo: '' }) const [queryInfo, setQueryInfo] = useState({ info: '', timeFrom: '', timeTo: '' })
...@@ -287,7 +287,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -287,7 +287,7 @@ const SearchGroup = forwardRef((props, ref) => {
<Row className={styles.controlRow}> <Row className={styles.controlRow}>
<Form layout={'inline'} form={form} onValuesChange={onValuesChange}> <Form layout={'inline'} form={form} onValuesChange={onValuesChange}>
{ {
showPicker ? ( enableTimeFilter ? (
<Form.Item label={`录入时间`} name="time" style={{ marginBottom: 0 }}> <Form.Item label={`录入时间`} name="time" style={{ marginBottom: 0 }}>
<RangePicker <RangePicker
size="middle" size="middle"
...@@ -302,29 +302,37 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -302,29 +302,37 @@ const SearchGroup = forwardRef((props, ref) => {
</Form.Item> </Form.Item>
) : null ) : null
} }
<Form.Item label={'快捷搜索'} name="info" style={{ marginBottom: 0 }}> {
<Search enableQuickSearch ? (
size="middle" <Form.Item label={'快捷搜索'} name="info" style={{ marginBottom: 0 }}>
style={{ <Search
width: 320, size="middle"
verticalAlign: 'middle', style={{
marginLeft: '10px', width: 320,
}} verticalAlign: 'middle',
placeholder="请输入值" marginLeft: '10px',
onSearch={onSearch} }}
/> placeholder="请输入值"
</Form.Item> onSearch={onSearch}
<Form.Item style={{ marginBottom: 0 }}> />
<Button type="primary" onClick={() => reset()}> </Form.Item>
重置 ) : null
</Button> }
</Form.Item> {
(enableTimeFilter || enableQuickSearch) ? (
<Form.Item style={{ marginBottom: 0 }}>
<Button type="primary" onClick={() => reset()}>
重置
</Button>
</Form.Item>
) : null
}
</Form> </Form>
{/* 按钮区域 */} {/* 按钮区域 */}
<div className={styles.controlRowRight}> <div className={styles.controlRowRight}>
<div className={styles.controlBtns}> <div className={styles.controlBtns}>
{ {
!readOnly ? ( !readOnly && enableImportExport ? (
<Dropdown.Button <Dropdown.Button
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
icon={<DownOutlined />} icon={<DownOutlined />}
...@@ -335,7 +343,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -335,7 +343,7 @@ const SearchGroup = forwardRef((props, ref) => {
) : null ) : null
} }
{ {
!readOnly ? ( !readOnly && enableBatchOperation ? (
<Dropdown.Button <Dropdown.Button
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
icon={<DownOutlined />} icon={<DownOutlined />}
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
right: -2.5px; right: -2.5px;
cursor: col-resize; cursor: col-resize;
z-index: 1; z-index: 1;
opacity: 0.3;
&:hover { &:hover {
width: 20px; width: 20px;
right: -10px; right: -10px;
......
import React from 'react'
import { Tooltip } from 'antd'
const style = {
display: 'inline-block',
width: '100%',
overflow: 'hidden',
wordSpacing: 'normal',
textOverflow: 'ellipsis',
}
const Text = (props) => {
const { text } = props
if (text && text.length > 10) {
return (
<Tooltip title={text}>
<div style={style}>{text}</div>
</Tooltip>
)
}
return <div>{text}</div>
}
export default Text
\ No newline at end of file
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
} }
} }
} }
.headerTitle {
width: 100%;
overflow: hidden;
word-spacing: normal;
text-overflow: ellipsis;
}
.@{ant-prefix}-table-wrapper { .@{ant-prefix}-table-wrapper {
height: 100%; height: 100%;
.@{ant-prefix}-spin-nested-loading { .@{ant-prefix}-spin-nested-loading {
......
import React, { useEffect, useMemo, useRef, useState } from 'react' import React, { useEffect, useMemo, useRef, useState, useImperativeHandle, forwardRef } from 'react'
import styles from './index.less' import styles from './index.less'
import { message, Button, Pagination, Modal } from 'antd' import { message, Button, Pagination, Modal } from 'antd'
import { ExclamationCircleOutlined } from '@ant-design/icons' import { ExclamationCircleOutlined } from '@ant-design/icons'
...@@ -18,25 +18,44 @@ import { ...@@ -18,25 +18,44 @@ import {
import { isJson, isObject } from '../../utils/index' import { isJson, isObject } from '../../utils/index'
import FormRender from '../FormRender' import FormRender from '../FormRender'
const Account = (props) => { const initConfig = {
accountFieids: [],
formJson: {},
enableBatchOperation: 0, //批量操作
enableImportExport: 0, //导入导出
enablePrint: 0, //打印
enableQuickSearch: 0, //快捷搜索
enableSiteFilter: 0, //站点过滤
enableTimeFilter: 0, //时间筛选
}
const Account = (props, ref) => {
useImperativeHandle(ref, () => (
{
getTableColumns
}
))
const { accountName, readOnly } = props const { accountName, readOnly } = props
const userID = window?.globalConfig?.userInfo?.OID || 1 const userID = window?.globalConfig?.userInfo?.OID || 1
const initParams = { const initParams = {
userID: userID, user: userID,
accountName, accountName,
sortFields: '录入时间', sortFields: '录入时间',
direction: 'desc', direction: 'desc',
total: 0, total: 0,
pageIndex: 1, pageIndex: 1,
pageSize: 100, pageSize: 100,
timeFrom: '',
timeTo: '',
queryWheres: [], queryWheres: [],
} }
const [detailShow, setDetailShow] = useState(false) const [detailShow, setDetailShow] = useState(false)
const [params, setParams] = useState(initParams) const [params, setParams] = useState(initParams)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [dataSource, setDataSource] = useState([]) const [dataSource, setDataSource] = useState([])
const [config, setConfig] = useState({ accountFieids: [], webShowFieldGroup: '', addFieldGroup: '', formJson: {} }) const [config, setConfig] = useState(initConfig)
const [schemaValues, setSchemaValues] = useState({ formJson: {}, values: [] }) const [schemaValues, setSchemaValues] = useState({ formJson: {}, values: [] })
const [submitLoading, setSubmitLoading] = useState(false) const [submitLoading, setSubmitLoading] = useState(false)
const [operation, setOperation] = useState({ id: null, state: '添加' }) const [operation, setOperation] = useState({ id: null, state: '添加' })
...@@ -45,10 +64,15 @@ const Account = (props) => { ...@@ -45,10 +64,15 @@ const Account = (props) => {
const tablePackRef = useRef() const tablePackRef = useRef()
const batchEditRef = useRef() const batchEditRef = useRef()
const getTableColumns = () => {
return tablePackRef.current.fileColumns
}
const btnsClick = async ({ type, row }) => { const btnsClick = async ({ type, row }) => {
const { addFieldGroup, editFieldGroup, formJson } = config const { accountFieids, formJson } = config
const addField = addFieldGroup ? addFieldGroup.split(',').filter(v => v) : [] const addField = accountFieids.filter(v => v.isAdd).map(v => v.fieldName)
const editField = editFieldGroup ? editFieldGroup.split(',').filter(v => v) : [] const editField = accountFieids.filter(v => v.isEdit).map(v => v.fieldName)
console.log(tablePackRef.current.fileColumns)
if (type === '添加') { if (type === '添加') {
setOperation({ type, id: null }) setOperation({ type, id: null })
saveClick(addField, formJson, [], type) saveClick(addField, formJson, [], type)
...@@ -170,7 +194,7 @@ const Account = (props) => { ...@@ -170,7 +194,7 @@ const Account = (props) => {
}) })
} }
const saveClick = (addField, formJson, values, type) => { const saveClick = (field, formJson, values, type) => {
let json = JSON.parse(JSON.stringify(formJson)) let json = JSON.parse(JSON.stringify(formJson))
let parent = json?.properties let parent = json?.properties
if (isObject(parent)) { if (isObject(parent)) {
...@@ -182,7 +206,7 @@ const Account = (props) => { ...@@ -182,7 +206,7 @@ const Account = (props) => {
if (type === '详情') { if (type === '详情') {
child[s].disabled = true child[s].disabled = true
} }
if (addField.includes(s)) { if (field.includes(s)) {
child[s].hidden = false child[s].hidden = false
hidden = false hidden = false
} else { } else {
...@@ -240,10 +264,12 @@ const Account = (props) => { ...@@ -240,10 +264,12 @@ const Account = (props) => {
} }
const getConfig = async () => { const getConfig = async () => {
const { code, data } = await GetAccountConfigInfo(accountName) const { code, data, msg } = await GetAccountConfigInfo(accountName)
if (code === 0) { if (code === 0) {
setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} }) setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} })
getDataSource({ siteFilter: Boolean(data.enableSiteFilter) }) getDataSource({ siteFilter: Boolean(data.enableSiteFilter) })
} else {
message.error(msg)
} }
} }
...@@ -298,6 +324,7 @@ const Account = (props) => { ...@@ -298,6 +324,7 @@ const Account = (props) => {
onChange={search} onChange={search}
btnsClick={btnsClick} btnsClick={btnsClick}
accountName={accountName} accountName={accountName}
config={config}
readOnly={readOnly} readOnly={readOnly}
/> />
</div> </div>
...@@ -362,4 +389,4 @@ const Account = (props) => { ...@@ -362,4 +389,4 @@ const Account = (props) => {
} }
export default Account export default forwardRef(Account)
\ No newline at end of file \ No newline at end of file
import React, { useMemo, useState, useRef, useLayoutEffect, useEffect } from 'react' import React, { useMemo, useState, useRef, useLayoutEffect, useEffect } from 'react'
import { Button, message, Popconfirm } from 'antd' import { Button, message } from 'antd'
import styles from './index.less' import styles from './index.less'
import { import {
GetAccountPageList, GetAccountPageList,
...@@ -10,20 +10,13 @@ import { ...@@ -10,20 +10,13 @@ import {
EditTableDataInfo, EditTableDataInfo,
DeleteTableDataInfo DeleteTableDataInfo
} from '../../../../apis/process' } from '../../../../apis/process'
import { SnippetsOutlined, PlusOutlined, FormOutlined, DeleteOutlined } from '@ant-design/icons' import { PlusOutlined } from '@ant-design/icons'
import { GetTableJson } from '../../../../apis/process' import { GetTableJson } from '../../../../apis/process'
import BaseForm from './BaseForm' import BaseForm from './BaseForm'
// import BaseTable from './BaseTable'
import TablePack from '../../../Account/components/TablePack' import TablePack from '../../../Account/components/TablePack'
import { isObject, isJson } from '../../../../utils' import { isObject, isJson } from '../../../../utils'
import Drag from '../../../components/Drag' import Drag from '../../../components/Drag'
const icons = {
'详情': <SnippetsOutlined />,
'编辑': <FormOutlined />,
'删除': <DeleteOutlined />,
}
let formStateStr = '添加' let formStateStr = '添加'
const getFormDataObj = (formData) => { const getFormDataObj = (formData) => {
...@@ -40,7 +33,7 @@ const getFormDataObj = (formData) => { ...@@ -40,7 +33,7 @@ const getFormDataObj = (formData) => {
const RelationForm = (props) => { const RelationForm = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1; const userID = window?.globalConfig?.userInfo?.OID || 1
const codes = window?.pandaXform?.codes || {} const codes = window?.pandaXform?.codes || {}
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, '台账名称': accountName, '默认显示': defaultShow, '控制规则': controlShow, titleShow, '映射字段': mappedField } = schema const { disabled, '台账名称': accountName, '默认显示': defaultShow, '控制规则': controlShow, titleShow, '映射字段': mappedField } = schema
...@@ -210,7 +203,7 @@ const RelationForm = (props) => { ...@@ -210,7 +203,7 @@ const RelationForm = (props) => {
message.info('映射字段配置错误!') message.info('映射字段配置错误!')
} }
let params = { let params = {
userID: userID, user: userID,
accountName: accountName, accountName: accountName,
direction: 'desc', direction: 'desc',
timeField: '录入时间', timeField: '录入时间',
......
...@@ -10,7 +10,6 @@ import Drag from '../../../components/Drag' ...@@ -10,7 +10,6 @@ import Drag from '../../../components/Drag'
const AccountSelector = (props) => { const AccountSelector = (props) => {
console.log('props', props)
const userID = window?.globalConfig?.userInfo?.OID || 1 const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema
...@@ -48,7 +47,7 @@ const AccountSelector = (props) => { ...@@ -48,7 +47,7 @@ const AccountSelector = (props) => {
const getDataSource = async (outParams = {}) => { const getDataSource = async (outParams = {}) => {
setLoading(true); setLoading(true);
let param = { let param = {
userID: userID, user: userID,
accountName: accountName, accountName: accountName,
condition: sql ? window.btoa(encodeURIComponent(sql)) : '', condition: sql ? window.btoa(encodeURIComponent(sql)) : '',
sortFields: '录入时间', sortFields: '录入时间',
......
...@@ -160,7 +160,7 @@ const ComboBox = (props) => { ...@@ -160,7 +160,7 @@ const ComboBox = (props) => {
showArrow={!disabled} showArrow={!disabled}
showSearch={isSearch} showSearch={isSearch}
value={valueShow} value={valueShow}
placeholder={disabled ? null : placeholder} placeholder={placeholder}
onChange={handleChange} onChange={handleChange}
allowClear allowClear
// getPopupContainer={(targterNode) => targterNode.parentElement || document.body} // getPopupContainer={(targterNode) => targterNode.parentElement || document.body}
......
...@@ -112,6 +112,8 @@ export const isJson = (json) => { ...@@ -112,6 +112,8 @@ export const isJson = (json) => {
export const isObject = (obj) => typeof obj === 'object' export const isObject = (obj) => typeof obj === 'object'
export const isArray = (array) => Array.isArray(array) && array.length
//防抖 //防抖
export const debounce = (fn) => { export const debounce = (fn) => {
let t = null let t = null
......
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