Commit afe236ae authored by 田翔's avatar 田翔

fix: 台账列表权限问题

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