z-table.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. <template>
  2. <view class="z-table">
  3. <view class="z-table-main" :style="compluteHeight">
  4. <view v-if="!tableLoaded && (!tableData || !columns)" :class="['z-loading', {ztableLoading: tableShow}]">
  5. <view class="z-loading-animate"></view>
  6. </view>
  7. <view class="z-table-container">
  8. <view class="z-table-pack">
  9. <view class="z-table-title">
  10. <view class="z-table-title-item" :class="{ 'z-table-stick-side': stickSide && index == 0 }" :style="{ width: item.width ? item.width + 'rpx' : '25%' }"
  11. v-for="(item, index) in columns" :key="index" @click="sort(item.key, index)">
  12. <view v-if="showSelect && !singleSelect && index === 0" class="select-box" @click="doSelect(true)">
  13. <view :class="['select-tip', {'selected': selectAll}]"></view>
  14. </view>
  15. <view :class="['z-table-col-text', {'text-left': titleTextAlign === 'left', 'text-center': titleTextAlign === 'center', 'text-right': titleTextAlign === 'right'}]">
  16. <view v-html="getTitleText(item.title)"></view>
  17. <view v-if="item.hasOwnProperty('key') && item.hasOwnProperty('sort') && tableData.length" class="sort">
  18. <view class="up-arrow" :class="{ action: nowSortKey == item.key && sortType == 'asc' }"></view>
  19. <view class="down-arrow" :class="{ action: nowSortKey == item.key && sortType == 'desc' }"></view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view v-if="tableData.length" :class="['table-container-box', {'short-table': !longTable && showBottomSum}]">
  25. <view class="z-table-container-row" :class="{ 'z-table-has-bottom': showBottomSum }" v-for="(row, iIndex) in tableData"
  26. :key="iIndex">
  27. <view :class="['z-table-container-col', { 'z-table-stick-side': stickSide && jIndex == 0 }]" :style="{ width: col.width ? col.width + 'rpx' : '25%' }"
  28. v-for="(col, jIndex) in columns" :key="jIndex" @click="itemClick(row, col)">
  29. <view v-if="showSelect && jIndex === 0" class="select-box" @click="doSelect(false, iIndex)">
  30. <view :class="['select-tip', {'selected': selectArr.includes(iIndex)}]"></view>
  31. </view>
  32. <view :class="['z-table-col-text', {'text-left': textAlign === 'left', 'text-center': textAlign === 'center', 'text-right': textAlign === 'right'}]">
  33. <view v-if="!col.isLink" v-html="getRowContent(row, col)">
  34. <!-- <view v-if="!col.render" v-html="getRowContent(row, col)"></view> -->
  35. <!-- <renderComponents v-else :row="row" :col="col" /> -->
  36. </view>
  37. <!-- #ifdef H5 -->
  38. <router-link v-else-if="setUrl(row, col).indexOf('http') != 0" :to="setUrl(row, col)" v-html="getRowContent(row, col)"></router-link>
  39. <a v-else-if="col.isLink" :href="setUrl(row, col)" v-html="getRowContent(row, col)"></a>
  40. <!-- #endif -->
  41. <!-- #ifndef H5 -->
  42. <navigator v-else-if="col.isLink" :url="setUrl(row, col)" v-html="getRowContent(row, col)"></navigator>
  43. <!-- #endif -->
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view :class="['z-table-bottom', {'long-table': longTable}]" v-if="showBottomSum && tableData.length">
  49. <view class="z-table-bottom-col" :class="{ 'z-table-stick-side': stickSide && sumIndex == 0 }" :style="{ width: sumCol.width ? sumCol.width + 'rpx' : '25%' }"
  50. v-for="(sumCol, sumIndex) in columns" :key="sumIndex">
  51. <view class="z-table-bottom-text">
  52. <!-- <view v-if="sumIndex != 0" class="z-table-bottom-text-title">{{ sumCol.title }}</view> -->
  53. <text :class="{ sum: sumIndex == 0 }">{{ sumIndex == 0 ? '总计' : dosum(sumCol) }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view v-if="tableData && tableData.length == 0 && !tableLoaded" class="table-empty">
  60. <!-- image v-if="!showLoading" class="empty-img" src="../static/empty.png"></image -->
  61. <view v-html="showLoading ? '' : emptyText"></view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. /*
  68. * 表格使用
  69. * 注意如果需要异步加载,需要把tableData初始值设为false,当没有数据的时候值为空数组
  70. * props: tableData [Array | Boolean] | 表格数据 如果为false则显示loading
  71. * columns [Array | Boolean] | 数据映射表 如果为false则显示loading 每列params => title(表头文字可以是html字符串模版), width(每列宽度) [, key(对应tableData的字段名) || format(自定义内容), sort(是否要排序), isLink(是否显示为超链接Object)]
  72. * format格式: {template: 字符串模版用#key#表示需要被替换的数据,names: 对应template属性内要被替换的内容的key}
  73. * isLink格式: {url: 链接地址, params: 地址带的参数Array[key|value, key|value, ...]每一项都是key和value以'|'链接,如果不带'|'默认键值同名
  74. * listenerClick(是否监听点击事件Boolean)}
  75. * stickSide Boolean | 是否固定右侧首栏 默认不显示
  76. * showBottomSum Boolean | 是否显示底部统计 默认不显示
  77. * showLoading Boolean | 是否首次加载首次加载不显示暂无数据内容
  78. * emptyText String | 空数据显示的文字内容
  79. * tableHeight Number | 设置表格高度会滚动
  80. * sort Boolean | 开启排序
  81. * showSelect Boolean | 开启选择
  82. * singleSelect Boolean | 在开启选择的状态下是否开起单选
  83. * textAlign String | 内容对齐方式 left center right
  84. * titleTextAlign String | 表头对齐方式 left center right
  85. *
  86. * event: onSort | 排序事件 返回{key: 被排序列的字段名, type: 正序'asc'/倒序'desc'}
  87. * onSelect | 选中时触发 返回选择的行的下标
  88. * onClick | 单元格点击事件 返回点击单元格所属行的数据
  89. *
  90. * function: resetSort | 调用后重置排序 *注意:不会触发sort事件
  91. *
  92. * */
  93. import Vue from 'vue'
  94. // import tableRender from './table-render'
  95. export default {
  96. data() {
  97. return {
  98. version: '1.1.3',
  99. nowSortKey: '',
  100. sortType: 'desc', // asc/desc 升序/降序
  101. longTable: true,
  102. lineHeight: uni.upx2px(64),
  103. tableLoaded: false,
  104. tableShow: true,
  105. selectAll: false,
  106. selectArr: []
  107. }
  108. },
  109. // mixin: [tableRender],
  110. computed: {
  111. compluteHeight() {
  112. return this.tableHeight ?
  113. 'height: ' + uni.upx2px(this.tableHeight) + 'px' :
  114. ''
  115. }
  116. },
  117. props: {
  118. tableData: {
  119. type: [Array, Boolean],
  120. default () {
  121. return false
  122. }
  123. },
  124. columns: {
  125. /*
  126. *
  127. * [{title: xxx, key: 当前列展示对象名, width: 列宽, render: function}]
  128. *
  129. * */
  130. type: [Array, Boolean],
  131. required: true
  132. },
  133. stickSide: {
  134. type: Boolean,
  135. default: false
  136. },
  137. showBottomSum: {
  138. type: Boolean,
  139. default: false
  140. },
  141. showLoading: {
  142. type: Boolean,
  143. default: true
  144. },
  145. emptyText: {
  146. type: String,
  147. default: '暂无数据'
  148. },
  149. tableHeight: {
  150. type: [Number, Boolean],
  151. default: 0
  152. },
  153. showSelect: {
  154. type: Boolean,
  155. default: false
  156. },
  157. singleSelect: {
  158. type: Boolean,
  159. default: false
  160. },
  161. textAlign: {
  162. type: String,
  163. default: 'left' // right|center|left
  164. },
  165. titleTextAlign: {
  166. type: String,
  167. default: 'left' // right|center|left
  168. }
  169. },
  170. mounted() {
  171. this.init()
  172. },
  173. // components: {
  174. // renderComponents: {
  175. // functional: true,
  176. // props: {
  177. // row: {
  178. // type: Object,
  179. // required: true
  180. // },
  181. // col: {
  182. // type: Object,
  183. // required: true
  184. // }
  185. // },
  186. // render: function(h, ctx) {
  187. // return _this[ctx.props.col.render](h, ctx.props)
  188. // }
  189. // }
  190. // },
  191. watch: {
  192. columns() {
  193. this.init()
  194. },
  195. tableData() {
  196. this.init()
  197. }
  198. },
  199. methods: {
  200. async init() {
  201. // 重置选择内容
  202. this.selectAll = false
  203. this.selectArr = []
  204. this.tableLoaded = false
  205. this.tableShow = true
  206. let _this = this
  207. let container = await _this.getPageSize('.z-table-container'),
  208. pack = await _this.getPageSize('.z-table-pack')
  209. _this.timer && clearTimeout(_this.timer)
  210. if (container && pack) {
  211. _this.$nextTick(function() {
  212. if (_this.tableData && _this.tableData.length) {
  213. _this.tableShow = false
  214. _this.timer = setTimeout(function() {
  215. _this.tableLoaded = true
  216. }, 300)
  217. }
  218. })
  219. if (container.height != pack.height) {
  220. _this.longTable = true
  221. } else {
  222. _this.longTable = false
  223. }
  224. } else {
  225. _this.tableLoaded = false
  226. _this.$nextTick(function() {
  227. _this.tableShow = true
  228. })
  229. }
  230. },
  231. getPageSize(selecter) {
  232. // 获取元素信息
  233. let query = uni.createSelectorQuery().in(this),
  234. _this = this
  235. return new Promise((resolve, reject) => {
  236. query
  237. .select(selecter)
  238. .boundingClientRect(res => {
  239. resolve(res)
  240. })
  241. .exec()
  242. })
  243. },
  244. dosum({key, noSum = false, formatNum = true}) {
  245. let sum = '-'
  246. if (noSum) return sum
  247. if (this.tableData) {
  248. if (
  249. this.tableData.every(item => {
  250. return !Number.isNaN(item[key] - 0)
  251. })
  252. ) {
  253. sum = 0
  254. this.tableData.map((item, index) => {
  255. if (!key && index != 0) {
  256. sum = '-'
  257. } else {
  258. let val = item[key] - 0
  259. if (Number.isNaN(val)) {
  260. sum += 0
  261. } else {
  262. sum += val
  263. }
  264. }
  265. })
  266. }
  267. }
  268. // sum = sum == 0 ? "-" : sum
  269. return formatNum ? this.numTransform(sum) : sum
  270. },
  271. getRowContent(row, col) {
  272. // 表格值处理函数
  273. // 如果columns带了key则显示对应的key
  274. // 如果columns带的format则按规定返回format后的html
  275. // format规定: params names <Array> 对应tableData的键名,作为匹配template中两个#之间动态内容的名字
  276. // params template <String> html字符串模版
  277. let tempHTML = ''
  278. let rowKey = row[col.key]
  279. if ([null, ''].includes(rowKey)) {
  280. rowKey = '-'
  281. }
  282. let { formatNum = true } = col
  283. if (rowKey || rowKey === 0) {
  284. tempHTML = isNaN(rowKey - 0) || !formatNum ?
  285. rowKey :
  286. this.numTransform(rowKey - 0)
  287. // tempHTML = tempHTML == 0 ? "-" : tempHTML
  288. } else if (!!col.format) {
  289. let tempFormat = col.format.template
  290. col.format.names.map(item => {
  291. let regexp = new RegExp(`\#${item}\#`, 'mg')
  292. tempFormat = tempFormat.replace(regexp, row[item])
  293. })
  294. tempHTML = tempFormat
  295. } else if (!col.render) {
  296. let error = new Error('数据的key或format值至少一个不为空')
  297. throw error
  298. }
  299. // console.log(tempHTML)
  300. return tempHTML.toString()
  301. },
  302. sort(key, index) {
  303. if (!key || !this.columns[index].sort) {
  304. return
  305. }
  306. // 排序功能: 如果点击的排序按钮是原先的 那么更改排序类型
  307. // 如果点击的另一个排序按钮 那么选择当前排序并且排序类型改为降序(desc)
  308. if (key != this.nowSortKey) {
  309. this.nowSortKey = key
  310. this.sortType = 'desc'
  311. } else {
  312. this.toggleSort()
  313. }
  314. this.$emit('onSort', {
  315. key: this.nowSortKey,
  316. type: this.sortType
  317. })
  318. },
  319. toggleSort() {
  320. this.sortType = this.sortType == 'asc' ? 'desc' : 'asc'
  321. },
  322. numTransform(n) {
  323. if (Number.isNaN(n - 0)) {
  324. return n
  325. }
  326. if (Math.abs(n) >= 100000000) {
  327. n = Number((n / 100000000).toFixed(1)) + '亿'
  328. } else if (Math.abs(n) >= 10000) {
  329. n = Number((n / 10000).toFixed(1)) + '万'
  330. }
  331. return n.toString()
  332. },
  333. resetSort() {
  334. // 重置排序状态
  335. this.nowSortKey = ''
  336. this.sortType = 'desc'
  337. },
  338. setUrl(row, col) {
  339. if (!col.isLink) {
  340. return
  341. }
  342. let urlParam = {}
  343. let {
  344. isLink: {
  345. url,
  346. params = []
  347. }
  348. } = col
  349. params.forEach(item => {
  350. if (~item.indexOf('|')) {
  351. let temp = item.split('|')
  352. urlParam[temp[0]] = row[temp[1]]
  353. } else {
  354. urlParam[item] = row[item]
  355. }
  356. })
  357. url = this.setUrlParams(url, urlParam)
  358. return url
  359. },
  360. setUrlParams(url, params) {
  361. let tempUrl = url,
  362. keyArr = Object.keys(params)
  363. keyArr.forEach(item => {
  364. tempUrl += `&${item}=${params[item]}`
  365. })
  366. tempUrl = tempUrl.replace(/\&/, '?')
  367. return tempUrl
  368. },
  369. itemClick(row, col) {
  370. if (col.listenerClick) {
  371. this.$emit('onClick', row)
  372. }
  373. },
  374. doSelect(isAll = false, index) {
  375. let temp = new Set()
  376. if (isAll) {
  377. // 全选
  378. if (!this.selectAll) {
  379. for (let i = 0; i < this.tableData.length; i++) {
  380. temp.add(i)
  381. }
  382. }
  383. } else {
  384. // if (!this.singleSelect) {
  385. // this.selectArr.forEach(item => {
  386. // temp.add(item)
  387. // })
  388. // }
  389. this.selectArr.forEach(item => {
  390. temp.add(item)
  391. })
  392. if (temp.has(index)) {
  393. temp.delete(index)
  394. } else {
  395. if (this.singleSelect) {
  396. temp.clear()
  397. }
  398. temp.add(index)
  399. }
  400. }
  401. this.selectArr = Array.from(temp)
  402. // console.log(this.selectArr)
  403. if (this.selectArr.length == this.tableData.length) {
  404. this.selectAll = true
  405. } else {
  406. this.selectAll = false
  407. }
  408. this.$emit('onSelect', this.selectArr)
  409. },
  410. // 1.1.1
  411. getTitleText(title) {
  412. // 自定义表头
  413. let tempHTML = title
  414. return tempHTML.toString()
  415. }
  416. }
  417. }
  418. </script>
  419. <style lang="scss">
  420. .navigator-hover {
  421. background: transparent;
  422. opacity: 1;
  423. }
  424. @mixin ellipsis($num: 1) {
  425. overflow: hidden;
  426. text-overflow: ellipsis;
  427. @if $num==1 {
  428. white-space: nowrap;
  429. }
  430. @else {
  431. display: -webkit-box;
  432. -webkit-line-clamp: $num;
  433. /* autoprefixer: off */
  434. -webkit-box-orient: vertical;
  435. /* autoprefixer: on */
  436. }
  437. }
  438. // 三角形
  439. %triangle-basic {
  440. content: '';
  441. height: 0;
  442. width: 0;
  443. overflow: hidden;
  444. }
  445. @mixin triangle($direction, $size, $borderColor) {
  446. @extend %triangle-basic;
  447. @if $direction==top {
  448. border-bottom: $size solid $borderColor;
  449. border-left: $size dashed transparent;
  450. border-right: $size dashed transparent;
  451. border-top: 0;
  452. }
  453. @else if $direction==right {
  454. border-left: $size solid $borderColor;
  455. border-top: $size dashed transparent;
  456. border-bottom: $size dashed transparent;
  457. border-right: 0;
  458. }
  459. @else if $direction==bottom {
  460. border-top: $size solid $borderColor;
  461. border-left: $size dashed transparent;
  462. border-right: $size dashed transparent;
  463. border-bottom: 0;
  464. }
  465. @else if $direction==left {
  466. border-right: $size solid $borderColor;
  467. border-top: $size dashed transparent;
  468. border-bottom: $size dashed transparent;
  469. border-left: 0;
  470. }
  471. }
  472. a {
  473. text-decoration: none;
  474. }
  475. .z-table {
  476. position: relative;
  477. display: inline-block;
  478. height: 100%;
  479. min-height: 130rpx;
  480. width: 100%;
  481. background: #fff;
  482. border: solid 1px #DCDCDC;
  483. font-size: $uni-font-size-sm;
  484. box-sizing: border-box;
  485. transform: translateZ(0);
  486. .z-table-main {
  487. height: 100%;
  488. box-sizing: border-box;
  489. }
  490. .z-table-container {
  491. height: 100%;
  492. overflow: scroll;
  493. box-sizing: border-box;
  494. }
  495. .z-table-pack {
  496. position: relative;
  497. min-height: 100%;
  498. width: 100% !important;
  499. }
  500. .z-table-title {
  501. position: sticky;
  502. top: 0;
  503. height: 64rpx;
  504. z-index: 1;
  505. width: 100% !important;
  506. .z-table-title-item {
  507. border-bottom: solid 1rpx #DCDCDC;
  508. background: #6495ED;
  509. color: #FFFFFF;
  510. }
  511. .z-table-stick-side {
  512. position: sticky;
  513. top: 0;
  514. left: 0;
  515. border-right: solid 1rpx #DCDCDC;
  516. box-sizing: border-box;
  517. }
  518. }
  519. .table-container-box.short-table {
  520. padding-bottom: 48rpx;
  521. }
  522. .z-table-title,
  523. .z-table-container-row {
  524. display: flex;
  525. width: 100%;
  526. white-space: nowrap;
  527. box-sizing: border-box;
  528. .z-table-title-item,
  529. .z-table-container-col {
  530. @include ellipsis();
  531. display: flex;
  532. padding-left: 18px;
  533. height: 64rpx;
  534. line-height: 64rpx;
  535. box-sizing: border-box;
  536. }
  537. }
  538. .z-table-container-row {
  539. z-index: 0;
  540. border-bottom: solid 1rpx #DCDCDC;
  541. box-sizing: border-box;
  542. }
  543. .z-table-stick-side {
  544. position: sticky;
  545. left: 0;
  546. background: #f7f9ff;
  547. border-right: solid 1rpx #DCDCDC;
  548. box-sizing: border-box;
  549. }
  550. .z-table-bottom {
  551. position: absolute;
  552. bottom: 0;
  553. z-index: 9;
  554. display: flex;
  555. justify-items: center;
  556. width: 100%;
  557. background: #6495ED !important;
  558. color: #fff !important;
  559. white-space: nowrap;
  560. box-sizing: border-box;
  561. &.long-table {
  562. position: sticky;
  563. }
  564. .z-table-stick-side {
  565. background: #6495ED !important;
  566. box-sizing: border-box;
  567. }
  568. .z-table-bottom-col {
  569. display: inline-flex;
  570. align-items: center;
  571. text-align: center;
  572. padding: 16rpx;
  573. box-sizing: border-box;
  574. }
  575. .z-table-bottom-text {
  576. line-height: 100%;
  577. box-sizing: border-box;
  578. margin-left: 18rpx;
  579. }
  580. .z-table-bottom-text-title {
  581. margin-bottom: 10rpx;
  582. font-size: 22rpx;
  583. color: #aad0ff;
  584. box-sizing: border-box;
  585. }
  586. .sum {
  587. font-size: 28rpx;
  588. box-sizing: border-box;
  589. }
  590. }
  591. .table-empty {
  592. position: absolute;
  593. top: 64rpx;
  594. height: 64rpx;
  595. line-height: 64rpx;
  596. width: 100%;
  597. text-align: center;
  598. }
  599. .sort {
  600. display: flex;
  601. padding: 5rpx;
  602. flex-direction: column;
  603. justify-content: center;
  604. .up-arrow {
  605. @include triangle(top, 10rpx, #ccc);
  606. display: block;
  607. margin-bottom: 5rpx;
  608. &.action {
  609. @include triangle(top, 10rpx, #4298f7);
  610. }
  611. }
  612. .down-arrow {
  613. @include triangle(bottom, 10rpx, #ccc);
  614. display: block;
  615. &.action {
  616. @include triangle(bottom, 10rpx, #4298f7);
  617. }
  618. }
  619. }
  620. // 1.0.5
  621. .z-loading {
  622. position: absolute;
  623. top: 0;
  624. left: 0;
  625. z-index: 2;
  626. display: flex;
  627. align-items: center;
  628. justify-content: center;
  629. height: 100%;
  630. width: 100%;
  631. background: #fff;
  632. opacity: 0;
  633. transition: all 0.3s;
  634. &.ztableLoading {
  635. opacity: 1;
  636. }
  637. .z-loading-animate {
  638. position: relative;
  639. display: inline-block;
  640. width: 30rpx;
  641. height: 30rpx;
  642. margin-right: 20rpx;
  643. border-radius: 100%;
  644. border: solid 6rpx #ccc;
  645. vertical-align: middle;
  646. animation: rotate 1s ease-in-out infinite;
  647. &::after {
  648. content: '';
  649. display: block;
  650. position: absolute;
  651. top: -10rpx;
  652. z-index: 1;
  653. background: #fff;
  654. width: 20rpx;
  655. height: 20rpx;
  656. border-radius: 10rpx;
  657. }
  658. }
  659. @keyframes rotate {
  660. from {
  661. transform: rotate(0deg);
  662. }
  663. to {
  664. transform: rotate(360deg);
  665. }
  666. }
  667. }
  668. // 1.1.0
  669. .select-box {
  670. display: inline-block;
  671. width: 26rpx;
  672. height: 26rpx;
  673. line-height: 14rpx;
  674. margin-right: 15rpx;
  675. border: solid 2rpx #4298f7;
  676. border-radius: 4rpx;
  677. background: #fff;
  678. text-align: center;
  679. }
  680. .select-tip {
  681. display: inline-block;
  682. opacity: 0;
  683. transform: rotate(90deg);
  684. transition: all .3s;
  685. &.selected {
  686. position: relative;
  687. top: 4rpx;
  688. left: -4rpx;
  689. height: 4rpx;
  690. background: #4298f7;
  691. width: 10rpx;
  692. opacity: 1;
  693. transform: rotate(45deg);
  694. &:before,
  695. &:after {
  696. content: '';
  697. position: absolute;
  698. display: block;
  699. height: 4rpx;
  700. background: #4298f7;
  701. }
  702. &:before {
  703. bottom: -2rpx;
  704. left: -4rpx;
  705. width: 8rpx;
  706. transform: rotate(-90deg);
  707. }
  708. &:after {
  709. bottom: 16rpx;
  710. right: -16rpx;
  711. width: 34rpx;
  712. transform: rotate(-90deg);
  713. }
  714. }
  715. }
  716. // 1.1.1
  717. .z-table-col-text {
  718. display: flex;
  719. width: 100%;
  720. flex: 1;
  721. justify-content: flex-start;
  722. align-content: center;
  723. &.text-center {
  724. justify-content: center;
  725. }
  726. &.text-right {
  727. justify-content: flex-end;
  728. }
  729. }
  730. }
  731. </style>