SListCardLayout2.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  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. style="overflow-y: auto"
  34. v-if="$slots.tree"
  35. >
  36. <slot name="tree" />
  37. </div>
  38. <div class="side-bar s-theme-bg" v-if="$slots.tree" v-sidedrag />
  39. <div class="layout-list-content" v-if="!$slots.empty">
  40. <div class="list-filter-wrap" ref="filters" v-show="$slots.filter">
  41. <div class="filter-content" v-if="$slots.filter">
  42. <div class="filter">
  43. <slot name="filter" />
  44. </div>
  45. <a class="filter-more-btn" v-if="$slots.filterMore" @click="toggleFilter">
  46. {{ !isMoreFilter ? $l('更多') : $l('收起') }}
  47. <double-right-outlined
  48. style="font-size: 12px; transform: rotate(90deg)"
  49. v-if="!isMoreFilter"
  50. />
  51. <double-right-outlined style="font-size: 12px; transform: rotate(-90deg)" v-else />
  52. </a>
  53. <div class="reset-wrap" v-if="$slots.filter">
  54. <a-tooltip
  55. placement="top"
  56. :overlayStyle="{ maxWidth: '500px' }"
  57. :mouseEnterDelay="1.5"
  58. :mouseLeaveDelay="0.5"
  59. >
  60. <template #title>
  61. <span>{{ $l('条件重置') }}</span>
  62. </template>
  63. <a-button style="padding-bottom: 2px" @click="filterReset">
  64. <template #icon>
  65. <sync-outlined />
  66. </template>
  67. </a-button>
  68. </a-tooltip>
  69. </div>
  70. </div>
  71. <div class="filter-more-content" v-if="$slots.filterMore" v-show="isMoreFilter">
  72. <slot name="filterMore" />
  73. </div>
  74. <div class="desc-wrap" v-if="$slots.desc">
  75. <slot name="desc" />
  76. </div>
  77. </div>
  78. <div class="table-content">
  79. <div class="tabs-wrap" v-if="$slots.tabs" ref="tabs">
  80. <slot name="tabs" />
  81. </div>
  82. <div class="table-container">
  83. <a-spin :spinning="loading">
  84. <div class="s-card-grid" :style="{ gridTemplateColumns: \`repeat(\${column}, 1fr)\` }">
  85. <div class="s-card-item" v-for="(item, index) in list" :key="cardKey(item, index)">
  86. <!-- header:优先用 cardHeader 插槽,其次数据项 title,两者都空则不渲染 -->
  87. <div class="s-card-header" v-if="$slots.cardHeader || item.title">
  88. <slot name="cardHeader" :item="item" :index="index">{{ item.title }}</slot>
  89. </div>
  90. <!-- 内容区:完全由业务自定义(作用域插槽拿到 item / index) -->
  91. <div class="s-card-body">
  92. <slot :item="item" :index="index" />
  93. </div>
  94. <!-- footer:默认底部按钮区,传 footer 插槽则完全替换按钮 -->
  95. <div class="s-card-footer">
  96. <slot name="cardFooter" :item="item" :index="index">
  97. <a-button
  98. type="link"
  99. size="small"
  100. @click="handCardAction('edit', item, index)"
  101. >
  102. {{ $l('编辑') }}
  103. </a-button>
  104. <a-button
  105. type="link"
  106. size="small"
  107. danger
  108. @click="handCardAction('delete', item, index)"
  109. >
  110. {{ $l('删除') }}
  111. </a-button>
  112. </slot>
  113. </div>
  114. </div>
  115. <a-empty
  116. class="s-card-empty"
  117. v-if="!loading && !list.length"
  118. :description="$l('暂无数据')"
  119. />
  120. </div>
  121. </a-spin>
  122. </div>
  123. <div class="s-card-pagination" v-if="showPagination" ref="pager">
  124. <a-pagination
  125. size="small"
  126. v-model:current="pageNo"
  127. :page-size="Number(pageSize)"
  128. :total="total"
  129. show-size-changer
  130. :page-size-options="pageSizeOptions"
  131. :show-total="(t) => \`\${$l('共')}\${t}\${$l('条')}\`"
  132. @change="handPageChange"
  133. />
  134. </div>
  135. </div>
  136. </div>
  137. <div class="layout-list-content" v-else>
  138. <slot name="empty" />
  139. </div>
  140. </div>
  141. <div class="other">
  142. <slot name="other" />
  143. </div>
  144. <s-import-modal
  145. v-if="isShowImportModal"
  146. ref="importModalRef"
  147. :upload-url="importItem.importUploadUrl"
  148. v-model:value="importVisible"
  149. :columns="importItem.importColumns"
  150. :apis="importItem.importApis"
  151. @reload="reload"
  152. />
  153. </div>
  154. </template>
  155. <script setup>
  156. import { computed, h, nextTick, onActivated, onMounted, ref, watch } from 'vue'
  157. import { createSideDrag } from '../../utils/side-drag'
  158. defineOptions({ name: 'SListCardLayout' })
  159. const props = defineProps({
  160. // 每行卡片个数(不传默认每行 5 个)
  161. column: {
  162. type: [Number, String],
  163. default: 5
  164. },
  165. // 卡片数据主键字段(用于 v-for key)
  166. rowKey: {
  167. type: [Function, String],
  168. default: 'id'
  169. },
  170. // 每页条数可选项
  171. pageSizeOptions: {
  172. type: Array,
  173. default: () => ['10', '20', '40', '80']
  174. },
  175. // 页面标题
  176. title: {
  177. type: String,
  178. required: true
  179. },
  180. // 工具栏按钮配置
  181. buttons: {
  182. type: Array,
  183. default: () => [
  184. {
  185. name: window.$l('添加'),
  186. key: 'add',
  187. show: true,
  188. type: 'primary',
  189. icon: true,
  190. api: null
  191. },
  192. {
  193. name: window.$l('批量删除'),
  194. key: 'remove',
  195. action: 'remove',
  196. show: true,
  197. icon: true,
  198. api: null
  199. },
  200. {
  201. name: window.$l('导入'),
  202. key: 'import',
  203. show: true,
  204. icon: true,
  205. importColumns: [], // 预览的表头信息
  206. importUploadUrl: null, // 上传url
  207. importApis: {
  208. templateDownload: null,
  209. importPreview: null,
  210. importData: null,
  211. exportExceptionData: null
  212. }
  213. },
  214. {
  215. name: window.$l('导出'),
  216. key: 'export',
  217. show: true,
  218. icon: true,
  219. api: null
  220. }
  221. ]
  222. },
  223. // 是否显示分页
  224. showPagination: {
  225. type: Boolean,
  226. default: true
  227. },
  228. // 取数函数,返回 { list, total }
  229. loadData: {
  230. type: Function,
  231. required: true
  232. },
  233. // 每页条数
  234. pSize: {
  235. type: [String, Number],
  236. default: 20
  237. }
  238. })
  239. const emit = defineEmits(['reset', 'btnCallback', 'cardAction'])
  240. // ---------- 模板 ref ----------
  241. const layout = ref(null)
  242. const filters = ref(null)
  243. const tabs = ref(null)
  244. const table = ref(null)
  245. // 卡片分页条(高度要从卡片区里扣掉,否则出现双滚动条)
  246. const pager = ref(null)
  247. const spaceSize = ref(8)
  248. // ---------- 状态 ----------
  249. const importVisible = ref(false)
  250. // 卡片区高度已交给 CSS flex,不再需要 JS 测量
  251. const isMoreFilter = ref(false)
  252. const spinning = ref(false)
  253. const pageSize = ref(20)
  254. const sideWidth = ref(232)
  255. const showSelection = ref(false)
  256. const selectedRowKeys = ref([])
  257. const renderButtons = ref([])
  258. // ---------- 卡片列表 ----------
  259. const list = ref([])
  260. const total = ref(0)
  261. const pageNo = ref(1)
  262. const loading = ref(false)
  263. const iconMap = {
  264. add: 'PlusCircleOutlined',
  265. edit: 'FormOutlined',
  266. delete: 'DeleteOutlined',
  267. remove: 'DeleteOutlined',
  268. import: 'UploadOutlined',
  269. export: 'DownloadOutlined',
  270. assign: 'ClusterOutlined',
  271. execute: 'PlayCircleOutlined',
  272. pause: 'PauseCircleOutlined',
  273. resume: 'PoweroffOutlined',
  274. approve: 'HighlightOutlined',
  275. setting: 'SettingOutlined',
  276. TopOfType: 'VerticalAlignTopOutlined',
  277. TOP: 'VerticalAlignTopOutlined',
  278. synchronize: 'SyncOutlined'
  279. }
  280. // ---------- computed ----------
  281. const isShowImportModal = computed(() => renderButtons.value.map((i) => i.key).includes('import'))
  282. const importItem = computed(() => renderButtons.value.find((i) => i.key === 'import') || {})
  283. // ---------- watch ----------
  284. watch(
  285. () => props.buttons,
  286. (v) => {
  287. if (v && v.length) initRenderButtons(v)
  288. },
  289. { immediate: true, deep: true }
  290. )
  291. // ---------- 方法 ----------
  292. function isFunction(fn, name = '') {
  293. if (fn && typeof fn === 'function') {
  294. return true
  295. }
  296. const is = import.meta.env.NODE_ENV === 'development'
  297. if (is) {
  298. console.error(\`\${name}按钮未绑定接口方法Api,请绑定接口或从按钮回调事件"btnCallback"中自行处理\`)
  299. }
  300. return false
  301. }
  302. function renderIcon(v) {
  303. if (typeof v.icon === 'string') {
  304. return v.icon
  305. }
  306. if (typeof v.icon === 'boolean' && v.icon) {
  307. return iconMap[v.key] || ''
  308. }
  309. return ''
  310. }
  311. function initRenderButtons(list) {
  312. // 后续可在这里对当前按钮集合编写逻辑
  313. renderButtons.value = list.map((i) => {
  314. if (i.key === 'remove') showSelection.value = true
  315. return i
  316. })
  317. }
  318. function initComponent() {
  319. nextTick(() => {
  320. // 高度一律 flex 撑满:这里只测主区域自身高度,再派生出 card 区滚动高度
  321. measureLayout()
  322. pageSize.value = props.pSize
  323. fetchList()
  324. })
  325. }
  326. function toggleFilter() {
  327. isMoreFilter.value = !isMoreFilter.value
  328. measureLayout()
  329. }
  330. // 查询条件重置
  331. function filterReset() {
  332. emit('reset')
  333. }
  334. // 刷新卡片列表:true 回到第一页
  335. function reload(forceFirst = false) {
  336. fetchList(forceFirst)
  337. }
  338. /**
  339. * 取卡片数据。
  340. * 与 STable 的取数约定完全一致:loadData({ pageNo, pageSize }) → { list, total }
  341. * 兼容后端 PageHelper 的几种外层包裹:顶层 total / pagination.total / totalCount。
  342. */
  343. async function fetchList(forceFirst = false) {
  344. if (typeof props.loadData !== 'function') return
  345. if (forceFirst) pageNo.value = 1
  346. loading.value = true
  347. try {
  348. const res =
  349. (await props.loadData({ pageNo: pageNo.value, pageSize: Number(pageSize.value) })) || {}
  350. const rows = res.list || res.data || []
  351. list.value = Array.isArray(rows) ? rows : []
  352. total.value = res.total ?? res.pagination?.total ?? res.totalCount ?? 0
  353. const current = res.pageNo || res.pageNum || res.pagination?.current
  354. if (current) pageNo.value = current
  355. } catch (e) {
  356. // 接口异常时结束 loading,避免卡片区一直转圈
  357. console.warn('[SListCardLayout] 卡片数据加载失败:', e)
  358. list.value = []
  359. total.value = 0
  360. } finally {
  361. loading.value = false
  362. }
  363. }
  364. // 翻页 / 切每页条数(a-pagination 切条数时会连触发 change,这里统一在 change 里判断,
  365. // 避免同一动作发两次请求)
  366. function handPageChange(page, size) {
  367. if (size && Number(size) !== Number(pageSize.value)) {
  368. pageSize.value = Number(size)
  369. pageNo.value = 1
  370. } else {
  371. pageNo.value = page
  372. }
  373. fetchList()
  374. }
  375. // 卡片默认底部按钮回调,业务自行处理
  376. function handCardAction(key, item, index) {
  377. emit('cardAction', key, item, index)
  378. }
  379. // 卡片 v-for key:rowKey 支持字段名或函数,取不到时退回下标
  380. function cardKey(item, index) {
  381. if (typeof props.rowKey === 'function') return props.rowKey(item, index)
  382. const k = item?.[props.rowKey]
  383. return k === undefined || k === null || k === '' ? index : k
  384. }
  385. // 按钮回调
  386. function btnCallback(item) {
  387. emit('btnCallback', item.key, selectedRowKeys.value)
  388. const fn = actionMap[item.key]
  389. if (typeof fn === 'function') {
  390. fn(item)
  391. } else {
  392. handAction(item)
  393. }
  394. }
  395. // 其他未定义按钮方法生成
  396. function handAction(item) {
  397. if (item.selection !== false && !selectedRowKeys.value.length) {
  398. window.$message.warn(\`\${window.$l('请选择要')}\${window.$l(item.name)}\${window.$l('的数据')}\`)
  399. return
  400. }
  401. if (isFunction(item.api, item.name, item.key)) {
  402. if (item.confirm) {
  403. window.$confirm({
  404. title: \`\${item.name}\`,
  405. content: () =>
  406. h(
  407. 'div',
  408. { style: 'color:var(--s-color-error)' },
  409. \`\${window.$l('确认要')}{\${window.$l(item.name)}}\${window.$l('数据吗?')}\`
  410. ),
  411. onOk: () => {
  412. spinning.value = true
  413. item
  414. .api(selectedRowKeys.value)
  415. .then(() => {
  416. window.$message.success(\`\${window.$l(item.name)}\${window.$l('成功')}\`)
  417. emit('reset')
  418. })
  419. .finally(() => {
  420. spinning.value = false
  421. })
  422. }
  423. })
  424. return
  425. }
  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. // 变更按钮状态
  439. function setStateBtn(action, opt) {
  440. if (typeof action === 'string') {
  441. setStateBtnItem(action, opt)
  442. } else {
  443. action.forEach((i) => {
  444. setStateBtnItem(i, opt)
  445. })
  446. }
  447. }
  448. function setStateBtnItem(action, opt) {
  449. const item = renderButtons.value.find((i) => i.key === action)
  450. if (!item) {
  451. console.error(\`按钮(\${action})未定义, 请确认该变更状态按钮是否设置正确\`)
  452. return
  453. }
  454. Object.keys(opt).forEach((i) => {
  455. item[i] = opt[i]
  456. })
  457. }
  458. // 添加方法(业务自行处理,这里只做占位,不再走 handAction)
  459. function addAction() {}
  460. // 删除方法
  461. function deleteAction(item) {
  462. handAction(item)
  463. }
  464. // 导入方法
  465. function importAction() {
  466. if (!isShowImportModal.value) {
  467. emit('btnCallback', 'import')
  468. return
  469. }
  470. importVisible.value = true
  471. }
  472. // ---------- 高度 ----------
  473. // 卡片区高度由 CSS flex 决定(根 100% → 主区 flex:1 → 卡片区吃掉剩余并内部滚动),
  474. // 这里保留空实现,只为兼容既有的 measureLayout 调用点(toggleFilter / keep-alive 切换)。
  475. function measureLayout() {
  476. nextTick(syncTableHeight)
  477. }
  478. function syncTableHeight() {}
  479. // 按钮 key → 处理函数(等价于原 Options API 里 this[item.key] 的语义)
  480. const actionMap = {
  481. add: addAction,
  482. delete: deleteAction,
  483. import: importAction,
  484. reload,
  485. filterReset,
  486. toggleFilter,
  487. setStateBtn,
  488. handAction
  489. }
  490. // ---------- 拖拽分隔条指令 ----------
  491. const vSidedrag = createSideDrag(
  492. () => sideWidth.value,
  493. (width) => (sideWidth.value = width),
  494. { min: 232 }
  495. )
  496. // ---------- 生命周期 ----------
  497. onMounted(() => {
  498. initComponent()
  499. })
  500. // keep-alive 缓存页切回来时 DOM 重新可见,下一帧补同步一次
  501. onActivated(() => {
  502. nextTick(syncTableHeight)
  503. })
  504. defineExpose({
  505. reload,
  506. spinning,
  507. selectedRowKeys,
  508. renderButtons,
  509. setStateBtn,
  510. btnCallback,
  511. filterReset,
  512. toggleFilter,
  513. table,
  514. importVisible,
  515. measureLayout,
  516. // 卡片列表
  517. list,
  518. total,
  519. pageNo,
  520. fetchList
  521. })
  522. <\/script>
  523. <style lang="less" scoped>
  524. // 高度实现:纯 CSS flex,零 JS 测量。
  525. // 根节点撑满父容器 → 工具条定高 → 主区吃掉剩余高度 → 表格链条逐层贯通到表体。
  526. // 前提:父容器有确定高度(基座 BasicLayout 的 router-view 已带 height);
  527. // 父级高度不确定时退化为「按内容撑开」,不会像旧版那样测量成 0 直接塌掉。
  528. .list-layout {
  529. height: 100%;
  530. min-height: 0;
  531. display: flex;
  532. flex-direction: column;
  533. overflow: hidden;
  534. }
  535. // 根节点外再包一层 a-spin 时(如 SNewestDataListLayout),把剩余高度透传下去,
  536. // 否则 .list-layout-main 拿不到高度,整页退化成内容高度
  537. .list-layout > :deep(.ant-spin-nested-loading),
  538. .list-layout > :deep(.ant-spin-container) {
  539. flex: 1 1 auto;
  540. min-height: 0;
  541. display: flex;
  542. flex-direction: column;
  543. }
  544. .other {
  545. flex: 0 0 auto;
  546. }
  547. .tools {
  548. flex: 0 0 60px;
  549. height: 60px;
  550. display: flex;
  551. justify-content: space-between;
  552. align-items: center;
  553. // border-bottom: 1px solid var(--s-bg-color);
  554. // padding: 0 16px;
  555. box-sizing: border-box;
  556. .title {
  557. font-size: 18px;
  558. font-weight: 500;
  559. }
  560. }
  561. .list-layout-main {
  562. flex: 1 1 auto;
  563. min-height: 0;
  564. display: flex;
  565. justify-content: flex-start;
  566. // stretch 让左右两栏撑满主区高度;flex-start 会让子栏退回内容高度,表格就不吃剩余空间了
  567. align-items: stretch;
  568. border-radius: 8px;
  569. background-color: var(--s-bg-color-container);
  570. overflow: hidden;
  571. }
  572. .side {
  573. // 宽度由模板内联的 sideWidth 决定,不参与伸缩,否则拖拽后的宽度会被挤掉
  574. flex: 0 0 auto;
  575. min-width: 232px;
  576. padding: 10px;
  577. box-sizing: border-box;
  578. overflow: hidden;
  579. }
  580. .side-bar {
  581. // 必须禁止伸缩:主区和左树都带 flex-grow,空间不足时这根 10px 的分隔条会被压成 0 宽,
  582. // 表现就是「分隔条不见了、左侧树拖不动」
  583. flex: 0 0 10px;
  584. width: 10px;
  585. align-self: stretch;
  586. cursor: pointer;
  587. user-select: none;
  588. }
  589. .layout-list-content {
  590. flex: 1 1 auto;
  591. min-width: 0;
  592. min-height: 0;
  593. overflow: hidden;
  594. display: flex;
  595. flex-direction: column;
  596. justify-content: flex-start;
  597. align-items: flex-start;
  598. }
  599. .list-filter-wrap {
  600. width: 100%;
  601. padding: 10px 16px;
  602. box-sizing: border-box;
  603. border-bottom: 1px solid var(--s-bg-color);
  604. .filter-content {
  605. height: 32px;
  606. display: flex;
  607. justify-content: flex-start;
  608. align-items: center;
  609. }
  610. .filter {
  611. // flex: 1;
  612. }
  613. }
  614. .table-content {
  615. width: 100%;
  616. flex: 1;
  617. // 卡片网格自身撑满剩余高度,超出部分在容器内滚动,不撑破页面可视区
  618. display: flex;
  619. flex-direction: column;
  620. min-height: 0;
  621. :deep(.ant-spin-nested-loading .ant-spin-blur) {
  622. opacity: 1;
  623. }
  624. :deep(.ant-table-pagination) {
  625. border-top: 1px solid var(--s-border-color-base);
  626. margin-top: 0;
  627. margin-bottom: 0;
  628. padding: 16px 0;
  629. flex: 0 0 auto;
  630. }
  631. }
  632. .table-container {
  633. flex: 1 1 auto;
  634. min-height: 0;
  635. box-sizing: border-box;
  636. padding: 12px 16px;
  637. overflow: hidden auto;
  638. .item-card {
  639. border: 1px solid var(--s-border-color-split);
  640. border-radius: 6px;
  641. background-color: var(--s-bg-color-container);
  642. }
  643. }
  644. // ---------- 卡片列表(列数由 column 控制,行内 style 只负责 gridTemplateColumns)----------
  645. .s-card-grid {
  646. display: grid;
  647. gap: 12px;
  648. // 卡片按行从顶部开始排,不随容器剩余高度拉伸
  649. align-content: start;
  650. }
  651. .s-card-item {
  652. display: flex;
  653. flex-direction: column;
  654. // 高度与宽度一致:正方形卡片(宽由列宽决定,高自动等于宽)
  655. aspect-ratio: 1 / 1;
  656. min-width: 0;
  657. box-sizing: border-box;
  658. border: 1px solid var(--s-border-color-split);
  659. border-radius: 8px;
  660. background-color: var(--s-bg-color-container);
  661. overflow: hidden;
  662. }
  663. .s-card-header {
  664. flex: 0 0 auto;
  665. padding: 10px 12px;
  666. border-bottom: 1px solid var(--s-bg-color);
  667. font-size: 15px;
  668. font-weight: 500;
  669. color: var(--s-text-color);
  670. overflow: hidden;
  671. white-space: nowrap;
  672. text-overflow: ellipsis;
  673. }
  674. .s-card-body {
  675. flex: 1 1 auto;
  676. min-height: 0;
  677. padding: 10px 12px;
  678. // 卡片是正方形,内容超出时在内容区内部滚动,不撑破卡片
  679. overflow: hidden;
  680. }
  681. .s-card-footer {
  682. flex: 0 0 auto;
  683. min-height: 36px;
  684. padding: 2px 8px;
  685. display: flex;
  686. align-items: center;
  687. justify-content: space-between;
  688. border-top: 1px solid var(--s-bg-color);
  689. }
  690. .s-card-empty {
  691. // 跨满整行,避免只占第一格
  692. grid-column: 1 / -1;
  693. margin: 24px 0;
  694. }
  695. .s-card-pagination {
  696. width: 100%;
  697. flex: 0 0 auto;
  698. display: flex;
  699. justify-content: flex-end;
  700. padding: 16px 16px 16px 0;
  701. border-top: 1px solid var(--s-border-color-split);
  702. box-sizing: border-box;
  703. }
  704. .filter-more-content {
  705. // border-bottom: 1px solid var(--s-border-color-light);
  706. margin-top: 16px;
  707. // padding-top: 16px;
  708. // box-sizing: border-box;
  709. }
  710. .desc-wrap {
  711. padding: 16px 0 0;
  712. box-sizing: border-box;
  713. }
  714. .reset-wrap {
  715. margin-left: 24px;
  716. flex: 1;
  717. text-align: right;
  718. }
  719. .filter-more-btn {
  720. min-width: 60px;
  721. text-align: center;
  722. }
  723. </style>
  724. `;
  725. export {
  726. e as default
  727. };