Commit af4a21c6 authored by 田翔's avatar 田翔

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

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