Commit afe236ae authored by 田翔's avatar 田翔

fix: 台账列表权限问题

parent b6689c56
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "4.5.6", "version": "4.5.7",
"description": "4.5.6 防止出现图片为空问题", "description": "4.5.7 台账列表权限问题",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -17,7 +17,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -17,7 +17,7 @@ const SearchGroup = forwardRef((props, ref) => {
getQueryInfo, getQueryInfo,
})) }))
const { accountName, config, readOnly, checkName, btnsClick } = props const { accountName, config, state, checkName, btnsClick } = props
const { enableBatchOperation, enableImportExport, enablePrint, enableQuickSearch, enableTimeFilter } = config const { enableBatchOperation, enableImportExport, enablePrint, enableQuickSearch, enableTimeFilter } = config
const [form] = Form.useForm() const [form] = Form.useForm()
const [dateArray, setDateArray] = useState([]) const [dateArray, setDateArray] = useState([])
...@@ -293,7 +293,6 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -293,7 +293,6 @@ const SearchGroup = forwardRef((props, ref) => {
size="middle" size="middle"
value={[...dateArray]} value={[...dateArray]}
locale={locale} locale={locale}
// defaultValue={rangerOptions[timeQuantumStr]}
showTime={formatterStr === 'YYYY-MM-DD HH:mm:ss'} showTime={formatterStr === 'YYYY-MM-DD HH:mm:ss'}
ranges={{ ...rangerOptions }} ranges={{ ...rangerOptions }}
format={formatterStr} format={formatterStr}
...@@ -332,7 +331,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -332,7 +331,7 @@ const SearchGroup = forwardRef((props, ref) => {
<div className={styles.controlRowRight}> <div className={styles.controlRowRight}>
<div className={styles.controlBtns}> <div className={styles.controlBtns}>
{ {
!readOnly && enableImportExport ? ( enableImportExport ? (
<Dropdown.Button <Dropdown.Button
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
icon={<DownOutlined />} icon={<DownOutlined />}
...@@ -343,7 +342,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -343,7 +342,7 @@ const SearchGroup = forwardRef((props, ref) => {
) : null ) : null
} }
{ {
!readOnly && enableBatchOperation ? ( enableBatchOperation ? (
<Dropdown.Button <Dropdown.Button
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
icon={<DownOutlined />} icon={<DownOutlined />}
...@@ -354,7 +353,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -354,7 +353,7 @@ const SearchGroup = forwardRef((props, ref) => {
) : null ) : null
} }
{ {
!readOnly ? ( state?.includes('add') ? (
<Button <Button
type="primary" type="primary"
size="middle" size="middle"
......
...@@ -19,7 +19,7 @@ const TablePack = (props, ref) => { ...@@ -19,7 +19,7 @@ const TablePack = (props, ref) => {
fileColumns, fileColumns,
})) }))
const { parent, readOnly, config, fieldList, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props const { parent, state, config, fieldList, loading, dataSource, rowSelection, onRow, tableChange, btnsClick } = props
const { accountFieids, webShowFieldGroup, formJson } = config const { accountFieids, webShowFieldGroup, formJson } = config
const [fieldResize, setFieldResize] = useState({}) const [fieldResize, setFieldResize] = useState({})
const [filteredInfo, setFilteredInfo] = useState({}) const [filteredInfo, setFilteredInfo] = useState({})
...@@ -243,29 +243,18 @@ const TablePack = (props, ref) => { ...@@ -243,29 +243,18 @@ const TablePack = (props, ref) => {
} }
const btns = useMemo(() => { const btns = useMemo(() => {
if (readOnly) { let array = []
return [ if (state?.includes('read')) {
{ array.push({ title: '详情', icon: <IconPack.XiangQing />, })
title: '详情',
icon: <IconPack.XiangQing />,
},
]
} }
return [ if (state?.includes('edit')) {
{ array.push({ title: '编辑', icon: <IconPack.BianJi /> })
title: '详情', }
icon: <IconPack.XiangQing />, if (state?.includes('delete')) {
}, array.push({ title: '删除', icon: <IconPack.ShanChu /> })
{ }
title: '编辑', return array
icon: <IconPack.BianJi />, }, [state, parent])
},
{
title: '删除',
icon: <IconPack.ShanChu />,
}
]
}, [readOnly, parent])
const checkChange = (values) => { const checkChange = (values) => {
setChecks(values) setChecks(values)
...@@ -335,79 +324,83 @@ const TablePack = (props, ref) => { ...@@ -335,79 +324,83 @@ const TablePack = (props, ref) => {
render: (_, r, i) => i + 1 render: (_, r, i) => i + 1
}, },
...showColumns, ...showColumns,
{ ]
title: ( if (btns.length) {
<div className={styles.operation}> columns.push(
<span>操作</span> {
<span className={styles.operationSpan}> title: (
<Popover <div className={styles.operation}>
placement='bottomRight' <span>操作</span>
title={ <span className={styles.operationSpan}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> <Popover
<div>列配置</div> placement='bottomRight'
<Button size='small' type="link" onClick={() => setOpen(false)}>确定</Button> title={
</div> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
} <div>列配置</div>
trigger='click' <Button size='small' type="link" onClick={() => setOpen(false)}>确定</Button>
open={open} </div>
content={content} }
onOpenChange={(value) => { trigger='click'
setOpen(value) open={open}
}} content={content}
arrowPointAtCenter onOpenChange={(value) => {
> setOpen(value)
}}
arrowPointAtCenter
>
{
fileColumns.length ? <FormOutlined /> : null
}
</Popover>
</span>
</div>
),
width: btns.length * 35 + 30,
align: 'center',
filteredValue: null,
fixed: 'right',
render: (r) => {
return (
<div style={{ display: 'flex', justifyContent: 'center' }}>
{ {
fileColumns.length ? <FormOutlined /> : null btns.map(v => {
} if (v.title === '删除') {
</Popover> return (
</span> <Popconfirm
</div> key={v.title}
), title='确定要删除数据吗?'
width: btns.length * 35 + 30, onConfirm={() => btnsClick({ type: v.title, row: r })}
align: 'center', okText='确定'
filteredValue: null, cancelText='取消'
fixed: 'right', >
render: (r) => { <Button
return ( type='link'
<div style={{ display: 'flex', justifyContent: 'center' }}> title='删除'
{ style={{ padding: '0 7px' }}
btns.map(v => { icon={v.icon}
if (v.title === '删除') { />
</Popconfirm>
)
}
return ( return (
<Popconfirm <Button
key={v.title} key={v.title}
title='确定要删除数据吗?' type='link'
onConfirm={() => btnsClick({ type: v.title, row: r })} title={v.title}
okText='确定' icon={v.icon}
cancelText='取消' style={{ padding: '0 7px' }}
onClick={() => btnsClick({ type: v.title, row: r })}
> >
<Button </Button>
type='link'
title='删除'
style={{ padding: '0 7px' }}
icon={v.icon}
/>
</Popconfirm>
) )
} })
return ( }
<Button </div>
key={v.title} )
type='link' }
title={v.title}
icon={v.icon}
style={{ padding: '0 7px' }}
onClick={() => btnsClick({ type: v.title, row: r })}
>
</Button>
)
})
}
</div>
)
} }
} )
] }
if (parent === '台账选择器') { if (parent === '台账选择器') {
return fileColumns return fileColumns
} }
......
import React, { useEffect, useMemo, useRef, useState, useImperativeHandle, forwardRef } from 'react' import React, { useEffect, 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'
...@@ -37,7 +37,7 @@ const Account = (props, ref) => { ...@@ -37,7 +37,7 @@ const Account = (props, ref) => {
} }
)) ))
const { accountName, parentConfig, readOnly } = props const { accountName, parentConfig, state } = props
const userID = window?.globalConfig?.userInfo?.OID || 1 const userID = window?.globalConfig?.userInfo?.OID || 1
const initParams = { const initParams = {
user: userID, user: userID,
...@@ -72,7 +72,6 @@ const Account = (props, ref) => { ...@@ -72,7 +72,6 @@ const Account = (props, ref) => {
const { accountFieids, formJson } = config const { accountFieids, formJson } = config
const addField = accountFieids.filter(v => v.isAdd).map(v => v.fieldName) const addField = accountFieids.filter(v => v.isAdd).map(v => v.fieldName)
const editField = accountFieids.filter(v => v.isEdit).map(v => v.fieldName) 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)
...@@ -320,13 +319,13 @@ const Account = (props, ref) => { ...@@ -320,13 +319,13 @@ const Account = (props, ref) => {
btnsClick={btnsClick} btnsClick={btnsClick}
accountName={accountName} accountName={accountName}
config={config} config={config}
readOnly={readOnly} state={state}
/> />
</div> </div>
<div className={styles.bottom}> <div className={styles.bottom}>
<TablePack <TablePack
loading={loading} loading={loading}
readOnly={readOnly} state={state}
config={config} config={config}
dataSource={dataSource} dataSource={dataSource}
rowSelection={{ rowSelection={{
......
...@@ -312,7 +312,7 @@ const RelationForm = (props) => { ...@@ -312,7 +312,7 @@ const RelationForm = (props) => {
<TablePack <TablePack
parent='关联表单' parent='关联表单'
loading={loading} loading={loading}
readOnly={disabled} state={disabled ? 'read' : 'read, edit, add, delete'}
config={config} config={config}
dataSource={dataSource} dataSource={dataSource}
btnsClick={btnsClick} btnsClick={btnsClick}
......
...@@ -190,7 +190,7 @@ const AccountSelector = (props) => { ...@@ -190,7 +190,7 @@ const AccountSelector = (props) => {
<div className={styles.top}> <div className={styles.top}>
<SearchGroup <SearchGroup
onChange={search} onChange={search}
readOnly={true} state={'read'}
btnsClick={btnsClick} btnsClick={btnsClick}
config={config} config={config}
/> />
...@@ -199,7 +199,7 @@ const AccountSelector = (props) => { ...@@ -199,7 +199,7 @@ const AccountSelector = (props) => {
<TablePack <TablePack
ref={tablePackRef} ref={tablePackRef}
loading={loading} loading={loading}
readOnly={true} state={'read'}
config={config} config={config}
dataSource={dataSource} dataSource={dataSource}
btnsClick={btnsClick} btnsClick={btnsClick}
......
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