SListTableTreeLayout2.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. const e = `<template>
  2. <div class="list-layout" ref="layout">
  3. <div class="tools">
  4. <div class="title">
  5. {{ title }}
  6. </div>
  7. <div class="btns">
  8. <a-space :size="spaceSize">
  9. <span class="item-btn" v-for="btn in renderButtons" :key="btn.key">
  10. <a-button
  11. class="btn"
  12. v-action="btn.action || btn.key"
  13. v-show="btn.show !== false"
  14. :disabled="!!btn.disabled"
  15. :type="btn.type || btn.key === 'add' ? 'primary' : 'default'"
  16. @click="btnCallback(btn)"
  17. >
  18. <template #icon>
  19. <component v-if="renderIcon(btn)" :is="renderIcon(btn)" />
  20. </template>
  21. {{ $l(btn.name) }}
  22. </a-button>
  23. </span>
  24. <slot name="otherBtns" :selections="selectedRowKeys" />
  25. </a-space>
  26. </div>
  27. </div>
  28. <div class="list-layout-main">
  29. <div
  30. class="side s-side-tree"
  31. ref="side"
  32. :style="{ width: sideWidth + 'px' }"
  33. v-if="$slots.tree"
  34. >
  35. <slot name="tree" />
  36. </div>
  37. <div class="side-bar s-theme-bg" v-if="$slots.tree" v-sidedrag />
  38. <div class="layout-list-content" v-if="!$slots.empty">
  39. <div class="list-filter-wrap" ref="filters" v-if="!!$slots.filter || !!$slots.filterMore">
  40. <div class="filter-content" v-if="$slots.filter">
  41. <div class="filter">
  42. <slot name="filter" />
  43. </div>
  44. <a class="filter-more-btn" v-if="$slots.filterMore" @click="toggleFilter">
  45. {{ !isMoreFilter ? $l('更多') : $l('收起') }}
  46. <double-right-outlined
  47. style="font-size: 12px; transform: rotate(90deg)"
  48. v-if="!isMoreFilter"
  49. />
  50. <double-right-outlined style="font-size: 12px; transform: rotate(-90deg)" v-else />
  51. </a>
  52. <div class="reset-wrap" v-if="$slots.filter">
  53. <a-tooltip
  54. placement="top"
  55. :overlayStyle="{ maxWidth: '500px' }"
  56. :mouseEnterDelay="1.5"
  57. :mouseLeaveDelay="0.5"
  58. >
  59. <template #title>
  60. <span>{{ $l('条件重置') }}</span>
  61. </template>
  62. <a-button style="padding-bottom: 2px" @click="filterReset">
  63. <template #icon>
  64. <sync-outlined />
  65. </template>
  66. </a-button>
  67. </a-tooltip>
  68. </div>
  69. </div>
  70. <div class="filter-more-content" v-if="$slots.filterMore" v-show="isMoreFilter">
  71. <slot name="filterMore" />
  72. </div>
  73. <div class="desc-wrap" v-if="$slots.desc">
  74. <slot name="desc" />
  75. </div>
  76. </div>
  77. <div class="table-content">
  78. <div class="tabs-wrap" v-if="$slots.tabs" ref="tabs">
  79. <slot name="tabs" />
  80. </div>
  81. <div class="table-container">
  82. <a-table
  83. ref="table"
  84. size="middle"
  85. :scroll="{ y: tableScrollPx }"
  86. :rowKey="rowKey"
  87. :tableLoading="tableLoading"
  88. :columns="renderColumns"
  89. :dataSource="tableData"
  90. v-model:expandedRowKeys="expandedRowKeys"
  91. :rowSelection="
  92. showSelection || isSelection
  93. ? {
  94. selectedRowKeys: selectedRowKeys,
  95. onChange: onSelectChange,
  96. getcheckboxProps: getCheckboxProps
  97. }
  98. : null
  99. "
  100. :pagination="showPagination ? pagination : false"
  101. @expand="handExpand"
  102. @change="handTableChange"
  103. >
  104. <!-- 自定义单元格:template 渲染同名插槽、isClick 渲染可点击、action 渲染操作列 -->
  105. <template #bodyCell="scope">
  106. <template v-if="scope.column">
  107. <!-- cell-template -->
  108. <slot
  109. v-if="isTemplateColumn(scope.column.dataIndex)"
  110. :name="scope.column.dataIndex"
  111. :text="scope.text"
  112. :record="scope.record"
  113. :index="scope.index"
  114. :item="getColumn(scope.column.dataIndex)"
  115. />
  116. <!-- cell-click -->
  117. <a
  118. v-else-if="isClickColumn(scope.column.dataIndex)"
  119. @click="tableColCallback(scope.column.dataIndex, scope.record)"
  120. >{{ getCellText(scope.text) }}</a
  121. >
  122. <!-- cell-action -->
  123. <slot
  124. v-else-if="scope.column.dataIndex === 'action'"
  125. name="action"
  126. :record="scope.record"
  127. />
  128. </template>
  129. </template>
  130. </a-table>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="layout-list-content" v-else>
  135. <slot name="empty" />
  136. </div>
  137. </div>
  138. <div class="other">
  139. <slot name="other" />
  140. </div>
  141. <s-import-modal
  142. v-if="isShowImportModal"
  143. ref="importModalRef"
  144. :upload-url="importItem.importUploadUrl"
  145. v-model:value="importVisible"
  146. :columns="importItem.importColumns"
  147. :apis="importItem.importApis"
  148. @reload="reload"
  149. />
  150. </div>
  151. </template>
  152. <script setup>
  153. import { computed, getCurrentInstance, h, nextTick, onMounted, reactive, ref, watch } from 'vue'
  154. import { useRoute } from 'vue-router'
  155. import { createSideDrag } from '../../utils/side-drag'
  156. defineOptions({ name: 'SListTableTreeLayout' })
  157. const props = defineProps({
  158. // 页面标题
  159. title: {
  160. type: String,
  161. required: true
  162. },
  163. // 工具栏按钮配置(添加 / 批量删除 / 导入 / 导出)
  164. buttons: {
  165. type: Array,
  166. default: () => [
  167. {
  168. name: window.$l('添加'),
  169. key: 'add',
  170. show: true,
  171. type: 'primary',
  172. icon: 'plus-circle',
  173. api: null
  174. },
  175. {
  176. name: window.$l('批量删除'),
  177. key: 'remove',
  178. action: 'remove',
  179. show: true,
  180. icon: 'delete',
  181. api: null
  182. },
  183. {
  184. name: window.$l('导入'),
  185. key: 'import',
  186. show: true,
  187. icon: 'upload',
  188. importColumns: [], // 预览的表头信息
  189. importUploadUrl: null, // 上传url
  190. importApis: {
  191. templateDownload: null,
  192. importPreview: null,
  193. importData: null,
  194. exportExceptionData: null
  195. }
  196. },
  197. {
  198. name: window.$l('导出'),
  199. key: 'export',
  200. show: true,
  201. icon: 'download',
  202. api: null
  203. }
  204. ]
  205. },
  206. // 列表checkbox列
  207. isSelection: {
  208. type: Boolean,
  209. default: false
  210. },
  211. // 工具栏按钮是否显示图标
  212. showBtnIcon: {
  213. type: Boolean,
  214. default: true
  215. },
  216. // 是否显示分页
  217. showPagination: {
  218. type: Boolean,
  219. default: true
  220. },
  221. // 表格列配置
  222. columns: {
  223. type: Array,
  224. default: () => []
  225. },
  226. // 行主键字段名
  227. rowKey: {
  228. type: [Function, String],
  229. default: 'id'
  230. },
  231. // 表体 loading(外部控制)
  232. tableLoading: {
  233. type: Boolean,
  234. default: false
  235. },
  236. // 取数函数,返回 { list, total }
  237. loadData: {
  238. type: Function,
  239. required: true
  240. },
  241. // 透传 a-table,控制某行是否可勾选
  242. getCheckboxProps: {
  243. type: Function,
  244. default: (record = {}) => {
  245. return { props: record }
  246. }
  247. }
  248. })
  249. const emit = defineEmits(['reset', 'btnCallback', 'tableColCallback', 'handExpand'])
  250. const route = useRoute()
  251. const instance = getCurrentInstance()
  252. // ---------- 模板 ref ----------
  253. const layout = ref(null)
  254. const filters = ref(null)
  255. const tabs = ref(null)
  256. const table = ref(null)
  257. const spaceSize = ref(8)
  258. // ---------- 状态 ----------
  259. const importVisible = ref(false)
  260. // 表体滚动高度:仅作为 scroll.y 同步值(初值兜底),布局高度完全由 CSS flex 决定
  261. const tableScrollPx = ref(300)
  262. const isMoreFilter = ref(false)
  263. const spinning = ref(false)
  264. const sideWidth = ref(232)
  265. const selectedRowKeys = ref([])
  266. const renderColumns = ref([])
  267. const renderButtons = ref([])
  268. const showSelection = ref(false)
  269. const list = ref([])
  270. const tableData = ref([])
  271. const expandedRowKeys = ref([])
  272. // 服务端分页:showPagination 为真时才挂到 a-table 上(默认关,兼容原来「一次性全量」的用法)
  273. const pagination = reactive({
  274. current: 1,
  275. pageSize: 20,
  276. total: 0,
  277. showSizeChanger: true,
  278. showQuickJumper: true,
  279. pageSizeOptions: ['10', '20', '50', '100'],
  280. showTotal: (total) => \`\${window.$l('共')}\${total}\${window.$l('条')}\`
  281. })
  282. const iconMap = {
  283. add: 'PlusCircleOutlined',
  284. edit: 'FormOutlined',
  285. delete: 'DeleteOutlined',
  286. remove: 'DeleteOutlined',
  287. import: 'UploadOutlined',
  288. export: 'DownloadOutlined',
  289. assign: 'ClusterOutlined',
  290. execute: 'PlayCircleOutlined',
  291. pause: 'PauseCircleOutlined',
  292. resume: 'PoweroffOutlined',
  293. approve: 'HighlightOutlined',
  294. setting: 'SettingOutlined',
  295. TopOfType: 'VerticalAlignTopOutlined',
  296. TOP: 'VerticalAlignTopOutlined',
  297. synchronize: 'SyncOutlined'
  298. }
  299. // ---------- computed ----------
  300. const isShowImportModal = computed(() => renderButtons.value.map((i) => i.key).includes('import'))
  301. const importItem = computed(() => renderButtons.value.find((i) => i.key === 'import') || {})
  302. // ---------- watch ----------
  303. watch(
  304. () => props.buttons,
  305. (v) => {
  306. if (v && v.length) initRenderButtons(v)
  307. },
  308. { immediate: true, deep: true }
  309. )
  310. // ---------- 方法 ----------
  311. function isFunction(fn, name = '') {
  312. if (fn && typeof fn === 'function') {
  313. return true
  314. }
  315. const is = import.meta.env.NODE_ENV === 'development'
  316. if (is) {
  317. console.error(\`\${name}按钮未绑定接口Api方法,请绑定接口或从按钮回调事件"btnCallback"中自行处理\`)
  318. }
  319. return false
  320. }
  321. function renderIcon(v) {
  322. if (typeof v.icon === 'string') {
  323. return v.icon
  324. }
  325. if (typeof v.icon === 'boolean' && v.icon) {
  326. return iconMap[v.key] || ''
  327. }
  328. return ''
  329. }
  330. function initRenderButtons(list_) {
  331. // 后续可在这里对当前按钮集合编写逻辑
  332. renderButtons.value = list_.map((i) => {
  333. if (i.key === 'remove') showSelection.value = true
  334. return i
  335. })
  336. }
  337. function initTable() {
  338. nextTick(() => {
  339. // 高度一律 flex 撑满:这里只测主区域自身高度,再派生表格 scroll.y
  340. measureLayout()
  341. renderColumns.value = props.columns.map((i) => {
  342. if (
  343. (i.template || i.isClick || (i.dataIndex === 'action' && !i.customRender)) &&
  344. !i.scopedSlots
  345. ) {
  346. i.scopedSlots = { customRender: i.dataIndex }
  347. }
  348. return i
  349. })
  350. reload()
  351. })
  352. const timer = setTimeout(() => {
  353. const th = document.querySelector('.ant-table-cell.ant-table-cell-scrollbar')
  354. const thead = document.querySelector('.ant-table-thead tr')
  355. if (th && thead) thead.removeChild(th)
  356. clearTimeout(timer)
  357. }, 100)
  358. }
  359. function initComponent() {
  360. initTable()
  361. }
  362. function toggleFilter() {
  363. isMoreFilter.value = !isMoreFilter.value
  364. measureLayout()
  365. }
  366. // 按名字调用组件自身的方法(保持与 Options API 里 this[api] 一致的语义)
  367. function dispatchApi(api, payload) {
  368. const fn = actionMap[api]
  369. return fn(payload)
  370. }
  371. // 查询条件重置
  372. function filterReset() {
  373. emit('reset')
  374. }
  375. // 重新请求数据:resetPage=true 回到第一页(对齐 SListLayout 的 reload(true) 语义)
  376. // showPagination 为真走服务端分页(pageNo/pageSize 传后端并回写 total);
  377. // 为假时保持旧行为 pageSize:0(一次性取全量)。
  378. function reload(resetPage = false) {
  379. if (resetPage) pagination.current = 1
  380. const query = props.showPagination
  381. ? { pageNo: pagination.current, pageSize: pagination.pageSize }
  382. : { pageNo: 1, pageSize: 0 }
  383. return props.loadData(query).then((res) => {
  384. const rows = (res && (res.list || res.records)) || []
  385. tableData.value = rows.length ? rows : list.value
  386. pagination.total = Number((res && (res.total ?? res.totalCount)) ?? rows.length)
  387. return res
  388. })
  389. }
  390. function handTableChange(page) {
  391. pagination.current = page.current
  392. pagination.pageSize = page.pageSize
  393. reload()
  394. }
  395. // 树列表 - 新增/编辑/详情 时 不刷新
  396. function setFilterParams() {
  397. console.log(instance?.parent)
  398. }
  399. // 按钮回调
  400. function btnCallback(item) {
  401. emit('btnCallback', item.key, selectedRowKeys.value)
  402. const fn = actionMap[item.key]
  403. if (typeof fn === 'function') {
  404. fn(item)
  405. } else {
  406. handAction(item)
  407. }
  408. }
  409. // 其他未定义按钮方法生成
  410. function handAction(item) {
  411. if (item.selection !== false && !selectedRowKeys.value.length) {
  412. window.$message.warn(\`\${window.$l('请选择要')}\${window.$l(item.name)}\${window.$l('的数据')}\`)
  413. return
  414. }
  415. if (isFunction(item.api, item.name)) {
  416. if (item.confirm) {
  417. window.$confirm({
  418. title: \`\${item.name}\`,
  419. content: () =>
  420. h(
  421. 'div',
  422. { style: 'color:var(--s-color-error)' },
  423. \`\${window.$l('确认要')}{\${window.$l(item.name)}}\${window.$l('数据吗?')}\`
  424. ),
  425. onOk: () => {
  426. spinning.value = true
  427. item
  428. .api(selectedRowKeys.value)
  429. .then(() => {
  430. window.$message.success(\`\${window.$l(item.name)}\${window.$l('成功')}\`)
  431. emit('reset')
  432. })
  433. .finally(() => {
  434. spinning.value = false
  435. })
  436. }
  437. })
  438. return
  439. }
  440. spinning.value = true
  441. item
  442. .api(selectedRowKeys.value)
  443. .then(() => {
  444. window.$message.success(\`\${window.$l(item.name)}\${window.$l('成功')}\`)
  445. emit('reset')
  446. })
  447. .finally(() => {
  448. spinning.value = false
  449. })
  450. }
  451. }
  452. // 设置列表路由地址
  453. function setHistoryPath() {
  454. sessionStorage.setItem('backPath', route.path)
  455. }
  456. // 添加方法(业务自行处理,这里只做占位,不再走 handAction)
  457. function addAction() {
  458. emit('btnCallback', 'add')
  459. }
  460. // 删除方法
  461. function removeAction() {
  462. if (!selectedRowKeys.value.length) {
  463. window.$notice.warn({
  464. key: 'only-you',
  465. message: window.$l('操作失败'),
  466. description: window.$l('请选择要删除的数据')
  467. })
  468. return
  469. }
  470. if (isFunction('deletesApi')) {
  471. window.$confirm({
  472. title: window.$l('确认删除'),
  473. content: () =>
  474. h('div', { style: 'color: var(--s-color-error)' }, window.$l('确认要批量删除数据吗?')),
  475. onOk: () => {
  476. spinning.value = true
  477. dispatchApi('deletesApi', selectedRowKeys.value)
  478. .then(() => {
  479. window.$notice.success({
  480. key: 'only-you',
  481. message: window.$l('操作成功'),
  482. description: window.$l('删除成功')
  483. })
  484. emit('reset')
  485. })
  486. .finally(() => {
  487. spinning.value = false
  488. })
  489. }
  490. })
  491. }
  492. }
  493. // 导入方法
  494. function importAction() {
  495. if (!isShowImportModal.value) {
  496. emit('btnCallback', 'import')
  497. return
  498. }
  499. importVisible.value = true
  500. }
  501. // 导出方法
  502. function exportAction() {
  503. if (isFunction('exportApi')) {
  504. spinning.value = true
  505. dispatchApi('exportApi').then(() => {
  506. spinning.value = false
  507. })
  508. }
  509. }
  510. // 表格可点击列事件回调
  511. function tableColCallback(field, item) {
  512. emit('tableColCallback', field, item)
  513. }
  514. // 按 dataIndex 取列配置
  515. function getColumn(dataIndex) {
  516. return renderColumns.value.find((i) => i.dataIndex === dataIndex)
  517. }
  518. // 该列是否使用自定义插槽(列 dataIndex 即插槽名)
  519. function isTemplateColumn(dataIndex) {
  520. const col = getColumn(dataIndex)
  521. return !!(col && col.template)
  522. }
  523. // 该列是否为可点击列
  524. function isClickColumn(dataIndex) {
  525. const col = getColumn(dataIndex)
  526. return !!(col && col.isClick)
  527. }
  528. // 可点击列显示文本:对象取 name,其它原样
  529. function getCellText(text) {
  530. if (text === null || text === undefined) return ''
  531. if (typeof text === 'object') return text.name === undefined ? '' : text.name
  532. return text
  533. }
  534. function onSelectChange(keys) {
  535. selectedRowKeys.value = keys
  536. }
  537. // ---------- 高度 ----------
  538. // 布局高度全部交给 CSS flex(根 100% → 主区 flex:1 → 表格链条逐层贯通),
  539. // 这里只把 flex 撑出来的真实表体高度同步给 scroll.y —— antd 需要 scroll.y 才启用固定表头。
  540. // 旧的算术法(父高 − 工具条 − 过滤区 − 分页)死穴是首帧分页还没渲染,必然差十几像素;
  541. // 同步真实 clientHeight 没有这个问题,值偏小也不影响布局(.ant-table-body 已 max-height:none)。
  542. function measureLayout() {
  543. nextTick(syncTableHeight)
  544. }
  545. function syncTableHeight() {
  546. const el = table.value && table.value.$el
  547. const bodyEl = el && el.querySelector('.ant-table-body')
  548. const h = bodyEl && bodyEl.clientHeight
  549. if (h) tableScrollPx.value = Math.max(h - 8, 0)
  550. }
  551. // 树表格展开
  552. function handExpand(expanded, record) {
  553. emit('handExpand', expanded, record)
  554. }
  555. // 按钮 key → 处理函数(等价于原 Options API 里 this[item.key] 的语义)
  556. const actionMap = {
  557. add: addAction,
  558. remove: removeAction,
  559. import: importAction,
  560. export: exportAction,
  561. reload,
  562. filterReset,
  563. toggleFilter,
  564. handAction
  565. }
  566. // ---------- 拖拽分隔条指令 ----------
  567. const vSidedrag = createSideDrag(
  568. () => sideWidth.value,
  569. (width) => (sideWidth.value = width),
  570. { min: 232 }
  571. )
  572. // ---------- 生命周期 ----------
  573. onMounted(() => {
  574. initComponent()
  575. })
  576. defineExpose({
  577. reload,
  578. spinning,
  579. selectedRowKeys,
  580. expandedRowKeys,
  581. renderColumns,
  582. renderButtons,
  583. tableData,
  584. pagination,
  585. table,
  586. importVisible,
  587. measureLayout,
  588. toggleFilter,
  589. filterReset,
  590. btnCallback
  591. })
  592. <\/script>
  593. <style lang="less" scoped>
  594. .list-layout {
  595. height: 100%;
  596. min-height: 0;
  597. display: flex;
  598. flex-direction: column;
  599. overflow: hidden;
  600. }
  601. .list-layout > :deep(.ant-spin-nested-loading),
  602. .list-layout > :deep(.ant-spin-container) {
  603. flex: 1 1 auto;
  604. min-height: 0;
  605. display: flex;
  606. flex-direction: column;
  607. }
  608. .other {
  609. flex: 0 0 auto;
  610. }
  611. .tools {
  612. flex: 0 0 60px;
  613. height: 60px;
  614. display: flex;
  615. justify-content: space-between;
  616. align-items: center;
  617. box-sizing: border-box;
  618. .title {
  619. font-size: 18px;
  620. font-weight: 500;
  621. }
  622. }
  623. .list-layout-main {
  624. flex: 1 1 auto;
  625. min-height: 0;
  626. display: flex;
  627. justify-content: flex-start;
  628. align-items: stretch;
  629. border-radius: 6px;
  630. background-color: var(--s-bg-color-container);
  631. overflow: hidden;
  632. }
  633. .side {
  634. flex: 0 0 auto;
  635. min-width: 232px;
  636. padding: 10px;
  637. box-sizing: border-box;
  638. overflow: hidden;
  639. }
  640. .side-bar {
  641. flex: 0 0 10px;
  642. width: 10px;
  643. align-self: stretch;
  644. cursor: pointer;
  645. user-select: none;
  646. }
  647. .layout-list-content {
  648. flex: 1 1 auto;
  649. min-width: 0;
  650. min-height: 0;
  651. overflow: hidden;
  652. display: flex;
  653. flex-direction: column;
  654. justify-content: flex-start;
  655. align-items: flex-start;
  656. }
  657. .list-filter-wrap {
  658. width: 100%;
  659. padding: 10px 16px;
  660. box-sizing: border-box;
  661. border-bottom: 1px solid var(--s-bg-color);
  662. .filter-content {
  663. height: 32px;
  664. display: flex;
  665. justify-content: flex-start;
  666. align-items: center;
  667. }
  668. .filter {
  669. // flex: 1;
  670. }
  671. }
  672. .filter-more-content {
  673. // border-bottom: 1px solid var(--s-border-color-light);
  674. margin-top: 16px;
  675. // padding-top: 16px;
  676. // box-sizing: border-box;
  677. }
  678. .desc-wrap {
  679. width: 100%;
  680. padding: 16px 0 0;
  681. box-sizing: border-box;
  682. }
  683. .reset-wrap {
  684. margin-left: 24px;
  685. flex: 1;
  686. text-align: right;
  687. }
  688. .filter-more-btn {
  689. min-width: 60px;
  690. text-align: center;
  691. }
  692. .table-content {
  693. width: 100%;
  694. flex: 1;
  695. display: flex;
  696. flex-direction: column;
  697. min-height: 0;
  698. .tabs-wrap {
  699. padding: 0 20px;
  700. box-sizing: border-box;
  701. flex: 0 0 auto;
  702. }
  703. :deep(.ant-spin-nested-loading .ant-spin-blur) {
  704. opacity: 1;
  705. }
  706. :deep(.ant-table-pagination) {
  707. margin-top: 0;
  708. padding: 16px 16px 16px 0;
  709. border-top: 1px solid var(--s-border-color-split);
  710. // 不留底部外边距,否则分页与容器底边恒差一个 margin
  711. margin-bottom: 0;
  712. flex: 0 0 auto;
  713. }
  714. // ---- 撑满链路 ----
  715. :deep(.table-wrapper),
  716. :deep(.ant-table-wrapper),
  717. :deep(.ant-spin-nested-loading),
  718. :deep(.ant-spin-container),
  719. :deep(.ant-table),
  720. :deep(.ant-table-container) {
  721. flex: 1 1 auto;
  722. min-height: 0;
  723. display: flex;
  724. flex-direction: column;
  725. }
  726. :deep(.ant-table-header) {
  727. flex: 0 0 auto;
  728. }
  729. :deep(.ant-table-body) {
  730. flex: 1 1 auto;
  731. min-height: 0;
  732. max-height: none !important;
  733. }
  734. }
  735. .table-container {
  736. flex: 1 1 auto;
  737. min-height: 0;
  738. display: flex;
  739. flex-direction: column;
  740. box-sizing: border-box;
  741. }
  742. </style>
  743. `;
  744. export {
  745. e as default
  746. };