Commit 955156cc authored by 田翔's avatar 田翔

fix: 详情按钮添加

parent 1656a41f
import React, { useEffect, useMemo, useState } from 'react'
import styles from './index.less'
import { Table, Tooltip, message } from 'antd'
import { Table, Tooltip, message, Button } from 'antd'
import SearchGroup from './components/SearchGroup'
import TablePack from './components/TablePack'
import { GetAccountConfigInfo, GetAccountPageList, getStationListByUserID, GetTableJson } from '../../apis/process'
import { isJson, isObject } from '../../utils/index'
import IconPack from '../widgets/IconPack'
const getFileInfo = (formJson) => {
let obj = {}
......@@ -27,6 +28,7 @@ const TableRender = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1
const { accountName } = props
const [detailShow, setDetailShow] = useState(false)
const [params, setParams] = useState({ userID: userID, accountName, direction: 'desc', timeField: '录入时间', pageIndex: 1, pageSize: 100 })
const [loading, setLoading] = useState(false)
const [config, setConfig] = useState({ webShowFieldGroup: '', formJson: '' })
......@@ -66,15 +68,52 @@ const TableRender = (props) => {
...fileColumns,
{
title: '操作',
width: 50,
width: 120,
fixed: 'right',
render: (r) => {
return '详情'
let btns = [
{
title: '详情',
icon: <IconPack.XiangQing />,
},
{
title: '编辑',
icon: <IconPack.BianJi />,
},
{
title: '删除',
icon: <IconPack.ShanChu />,
}
]
return (
<div>
{
btns.map(v => {
return (
<Button
type='link'
title={v.title}
icon={v.icon}
style={{ padding: '0 7px' }}
onClick={() => btnsClick(v.title, r)}
>
</Button>
)
})
}
</div>
)
}
}
]
}, [fileColumns])
const btnsClick = (type, row) => {
if (['详情', '编辑'].includes(type)) {
setDetailShow(true)
}
}
const search = (values) => {
setParams({ ...params, ...values })
getDataSource({ ...params, ...values })
......@@ -110,23 +149,33 @@ const TableRender = (props) => {
}, [])
return (
<div className={styles.tableRender}>
<div className={styles.top}>
<SearchGroup onChange={search} />
<div className={styles.account} style={{ width: '100%', height: '100%' }}>
<div className={styles.tableRender} style={{ display: !detailShow ? 'block' : 'none' }}>
<div className={styles.top}>
<SearchGroup onChange={search} />
</div>
<div className={styles.bottom}>
<Table
size='small'
rowKey='ID'
bordered
loading={loading}
columns={columns}
dataSource={dataSource}
pagination={false}
scroll={{ y: 'calc(100% - 50px)' }}
/>
</div>
</div>
<div className={styles.bottom}>
<Table
size='small'
rowKey='ID'
bordered
loading={loading}
columns={columns}
dataSource={dataSource}
pagination={false}
scroll={{ y: 'calc(100% - 50px)' }}
/>
<div className={styles.tableDetail} style={{ display: detailShow ? 'block' : 'none' }}>
<Button
onClick={() => setDetailShow(false)}
>
返回
</Button>
</div>
</div>
)
}
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666770499222" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18359" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M307.2 782.628571z" fill="#1685ff" p-id="18360"></path><path d="M958.171429 965.485714H65.828571c-21.942857 0-36.571429-14.628571-36.571428-36.571428s14.628571-36.571429 36.571428-36.571429H950.857143c21.942857 0 36.571429 14.628571 36.571428 36.571429s-14.628571 36.571429-29.257142 36.571428zM892.342857 175.542857l-109.714286-95.085714c-43.885714-36.571429-109.714286-21.942857-138.971428 14.628571-29.257143 21.942857-299.885714 343.771429-329.142857 373.028572-21.942857 21.942857-29.257143 51.2-43.885715 80.457143l-58.514285 204.8c-7.314286 29.257143 0 58.514286 21.942857 80.457142 14.628571 14.628571 29.257143 21.942857 51.2 21.942858 7.314286 0 21.942857 0 36.571428-7.314286L512 760.685714c29.257143-14.628571 43.885714-36.571429 65.828571-51.2 80.457143-95.085714 285.257143-351.085714 314.514286-373.028571 21.942857-21.942857 36.571429-51.2 36.571429-87.771429 0-29.257143-14.628571-58.514286-36.571429-73.142857zM526.628571 658.285714c-14.628571 14.628571-29.257143 29.257143-43.885714 36.571429l-197.485714 95.085714v-7.314286l58.514286-204.8c7.314286-29.257143 21.942857-43.885714 29.257142-58.514285C438.857143 438.857143 533.942857 329.142857 599.771429 248.685714l153.6 131.657143C665.6 482.742857 541.257143 636.342857 526.628571 658.285714z m314.514286-380.342857c-7.314286 7.314286-21.942857 21.942857-36.571428 43.885714L650.971429 190.171429c21.942857-21.942857 36.571429-43.885714 43.885714-43.885715 7.314286-7.314286 21.942857-14.628571 29.257143-14.628571 7.314286 0 7.314286 0 14.628571 7.314286l109.714286 95.085714c7.314286 7.314286 7.314286 14.628571 7.314286 21.942857 0 0 0 14.628571-14.628572 21.942857z" fill="#1685ff" p-id="18361"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666767675430" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7853" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M958.171 285.257H73.143c-21.943 0-36.572-14.628-36.572-36.571s14.629-36.572 36.572-36.572h877.714c21.943 0 36.572 14.629 36.572 36.572s-14.629 36.571-29.258 36.571z m-570.514 724.114c-21.943 0-36.571-14.628-36.571-36.571V394.971c0-21.942 14.628-36.571 36.571-36.571s36.572 14.629 36.572 36.571V972.8c0 21.943-14.629 36.571-36.572 36.571z m212.114 0c-21.942 0-36.571-14.628-36.571-36.571V394.971c0-21.942 14.629-36.571 36.571-36.571s36.572 14.629 36.572 36.571V972.8c0 21.943-21.943 36.571-36.572 36.571z" fill="#FF4D4F" p-id="7854"></path><path d="M672.914 1024H336.457c-102.4 0-182.857-80.457-182.857-182.857V394.97c0-21.942 14.629-36.571 36.571-36.571s36.572 14.629 36.572 36.571v446.172c0 65.828 51.2 109.714 109.714 109.714H680.23c65.828 0 109.714-51.2 109.714-109.714V394.97c0-21.942 14.628-36.571 36.571-36.571s36.572 14.629 36.572 36.571v446.172C855.77 943.543 775.314 1024 672.914 1024z m-14.628-738.743c-21.943 0-36.572-14.628-36.572-36.571V131.657c0-36.571-29.257-58.514-58.514-58.514H453.486c-29.257 0-58.515 21.943-58.515 58.514v117.029c0 21.943-14.628 36.571-36.571 36.571s-36.571-14.628-36.571-36.571V131.657C321.829 58.514 380.343 0 453.486 0H563.2c73.143 0 131.657 58.514 131.657 131.657v117.029c0 21.943-14.628 36.571-36.571 36.571z" fill="#FF4D4F" p-id="7855"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1666767495592" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7140" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M453.485714 643.657143H219.428571c-21.942857 0-36.571429-14.628571-36.571428-36.571429s14.628571-36.571429 36.571428-36.571428h234.057143c21.942857 0 36.571429 14.628571 36.571429 36.571428s-14.628571 36.571429-36.571429 36.571429zM541.257143 380.342857H219.428571c-21.942857 0-36.571429-21.942857-36.571428-36.571428s14.628571-36.571429 36.571428-36.571429h321.828572c21.942857 0 36.571429 14.628571 36.571428 36.571429s-14.628571 36.571429-36.571428 36.571428z" p-id="7141" fill="#1685ff"></path><path d="M373.028571 958.171429H160.914286c-65.828571 0-117.028571-51.2-117.028572-117.028572v-658.285714c0-65.828571 51.2-117.028571 117.028572-117.028572h541.257143c65.828571 0 117.028571 51.2 117.028571 117.028572v204.8c0 21.942857-14.628571 36.571429-36.571429 36.571428s-36.571429-14.628571-36.571428-36.571428V182.857143c0-21.942857-21.942857-43.885714-43.885714-43.885714H160.914286c-21.942857 0-43.885714 21.942857-43.885715 43.885714v665.6c0 21.942857 21.942857 43.885714 43.885715 43.885714h212.114285c21.942857 0 36.571429 14.628571 36.571429 36.571429s-14.628571 29.257143-36.571429 29.257143z" p-id="7142" fill="#1685ff"></path><path d="M1009.371429 921.6l-87.771429-87.771429c21.942857-29.257143 36.571429-73.142857 36.571429-109.714285 0-58.514286-14.628571-109.714286-51.2-153.6-36.571429-43.885714-87.771429-65.828571-146.285715-73.142857-58.514286-7.314286-124.342857 14.628571-168.228571 51.2-36.571429 36.571429-58.514286 87.771429-65.828572 146.285714 0 58.514286 14.628571 109.714286 51.2 153.6 36.571429 43.885714 87.771429 65.828571 146.285715 73.142857h14.628571c43.885714 0 87.771429-14.628571 124.342857-36.571429l87.771429 87.771429c7.314286 7.314286 14.628571 7.314286 29.257143 7.314286s21.942857 0 29.257143-7.314286c14.628571-14.628571 14.628571-36.571429 0-51.2z m-277.942858-73.142857c-36.571429 0-73.142857-21.942857-95.085714-43.885714-21.942857-36.571429-36.571429-73.142857-36.571428-109.714286s14.628571-65.828571 43.885714-95.085714c29.257143-21.942857 58.514286-36.571429 95.085714-36.571429h7.314286c36.571429 0 73.142857 21.942857 95.085714 43.885714 21.942857 29.257143 36.571429 65.828571 36.571429 102.4 0 36.571429-14.628571 65.828571-43.885715 95.085715-29.257143 21.942857-58.514286 36.571429-95.085714 36.571428l-7.314286 7.314286z" p-id="7143" fill="#1685ff"></path></svg>
\ No newline at end of file
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