SSuperListLayout2.js 22 KB

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