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 />,
},
{
title: '编辑',
icon: <IconPack.BianJi />,
},
{
title: '删除',
icon: <IconPack.ShanChu />,
} }
] if (state?.includes('delete')) {
}, [readOnly, parent]) array.push({ title: '删除', icon: <IconPack.ShanChu /> })
}
return array
}, [state, parent])
const checkChange = (values) => { const checkChange = (values) => {
setChecks(values) setChecks(values)
...@@ -335,6 +324,9 @@ const TablePack = (props, ref) => { ...@@ -335,6 +324,9 @@ const TablePack = (props, ref) => {
render: (_, r, i) => i + 1 render: (_, r, i) => i + 1
}, },
...showColumns, ...showColumns,
]
if (btns.length) {
columns.push(
{ {
title: ( title: (
<div className={styles.operation}> <div className={styles.operation}>
...@@ -407,7 +399,8 @@ const TablePack = (props, ref) => { ...@@ -407,7 +399,8 @@ const TablePack = (props, ref) => {
) )
} }
} }
] )
}
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