Update publicUnit.vue

This commit is contained in:
TimSpan 2024-11-29 17:09:34 +08:00
parent 59b58cf6f7
commit edff88dd0c
1 changed files with 37 additions and 26 deletions

View File

@ -9,7 +9,7 @@
:request-api="reqApi" :request-api="reqApi"
:columns="columns" :columns="columns"
:searchFormOptions="searchFormOptions" :searchFormOptions="searchFormOptions"
:scroll="{ x }" :scroll="{ x: x }"
> >
<template #tableHeader> <template #tableHeader>
<a-space> <a-space>
@ -53,6 +53,7 @@ const columns: TableProps['columns'] = [
{ {
dataIndex: 'name', dataIndex: 'name',
title: '单位名称', title: '单位名称',
width: 200,
}, },
{ {
@ -61,11 +62,14 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => { customRender: ({ record }) => {
return `${record?.provinceName}/${record?.cityName}/${record?.districtsName}/${record?.streetName}` return `${record?.provinceName}/${record?.cityName}/${record?.districtsName}/${record?.streetName}`
}, },
width: 300,
}, },
{ {
dataIndex: 'address', dataIndex: 'address',
title: '详细地址', title: '详细地址',
width: 200,
ellipsis: true,
}, },
{ {
@ -74,6 +78,7 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => { customRender: ({ record }) => {
return record?.contactPersonInfo?.name return record?.contactPersonInfo?.name
}, },
width: 200,
}, },
{ {
dataIndex: 'contactPersonInfo', dataIndex: 'contactPersonInfo',
@ -81,16 +86,21 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => { customRender: ({ record }) => {
return record?.contactPersonInfo?.telephone return record?.contactPersonInfo?.telephone
}, },
width: 150,
}, },
{ {
dataIndex: 'createTime', dataIndex: 'createTime',
title: '创建时间', title: '创建时间',
width: 120,
ellipsis: true,
}, },
{ {
dataIndex: 'remark', dataIndex: 'remark',
title: '备注', width: 120,
ellipsis: true,
}, },
{ {
width: 200,
dataIndex: 'opt', dataIndex: 'opt',
title: '操作', title: '操作',
customRender: ({ record }) => ( customRender: ({ record }) => (
@ -136,7 +146,11 @@ const columns: TableProps['columns'] = [
), ),
}, },
] ]
const x: number = columns.reduce((a, b) => a + (b.width as number), 0) // const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
const x: number = columns.reduce((a, b) => {
console.log('x_____________________', a, b, b.width)
return a + (b.width as number)
}, 0)
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const _formRef = ref<FormExpose>(null) const _formRef = ref<FormExpose>(null)
@ -627,16 +641,14 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
}, },
}, },
] ]
// const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0) const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0)
const _reqApi: _TableProps['requestApi'] = async () => { const _reqApi: _TableProps['requestApi'] = async () => {
// @ts-ignore // @ts-ignore
return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId }) return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId })
} }
return ( return (
<div style={{ width: '100%' }}>
<TableProMax <TableProMax
style={{ width: '1600px' }} scroll={{ x: x2 }}
scroll={{ x: '1600px' }}
ref={_tableRef} ref={_tableRef}
size='small' size='small'
columns={_columns} columns={_columns}
@ -654,7 +666,6 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
}, },
}} }}
/> />
</div>
) )
} }