zb-table.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  1. <template>
  2. <!-- #ifdef H5 || APP-PLUS -->
  3. <view
  4. :class="['zb-table','zb-table-fixed-header',!border&&(bodyTableLeft>50||headerTableLeft>50)&&'scroll-left-fixed']">
  5. <view class="zb-table-content" style="flex: 1">
  6. <view class="zb-table-scroll" style="height: 100%;">
  7. <template v-if="showHeader">
  8. <view class="zb-table-header top-header-uni">
  9. <scroll-view class="zb-table-headers" @scroll="handleTableScrollLeft" scroll-x="true"
  10. scroll-y="false" id="tableHeaders" scroll-anchoring="true" :scroll-left="headerTableLeft"
  11. style="
  12. height: 100%">
  13. <view class="zb-table-fixed">
  14. <view class="zb-table-thead" style="position: relative;">
  15. <view class="item-tr">
  16. <view @click.stop="sortAction(item,index)" class="item-th" :style="[{
  17. width:`${item.width?item.width:'100'}px`,
  18. flex:index===transColumns.length-1?1:'none',
  19. minWidth:`${item.width?item.width:'100'}px`,
  20. borderRight:`${border?'1px solid #e8e8e8':''}`,
  21. borderTop:`${border?'1px solid #e8e8e8':''}`,
  22. textAlign:item.align||'left'
  23. },getHeaderCellStyle(item,index)]" v-for="(item,index) in transColumns" :key="index">
  24. <template v-if="item.type==='selection'">
  25. <view class="checkbox-item">
  26. <tableCheckbox :indeterminate="indeterminate" :checked="checkedAll"
  27. @checkboxSelected="checkboxSelectedAll"></tableCheckbox>
  28. </view>
  29. </template>
  30. <template v-else>
  31. {{ item.label }}
  32. <view class="sorter-table" v-if="item.sorter">
  33. <view
  34. :class="['sorter-table-icon',item.sorterMode==='_asc'&&`sorting${item.sorterMode||''}`]">
  35. </view>
  36. <view
  37. :class="['sorter-table-icon',item.sorterMode==='_desc'&&`sorting${item.sorterMode||''}`]">
  38. </view>
  39. </view>
  40. </template>
  41. </view>
  42. <view v-if="scrollbarSize" class="item-th " :style="{
  43. borderTop:`${border?'1px solid #e8e8e8':''}`,
  44. padding:0,
  45. width:`${scrollbarSize}px`,
  46. }">
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </view>
  53. </template>
  54. <template v-if="!data.length">
  55. <view class="no-data">暂无数据~~</view>
  56. </template>
  57. <scroll-view class="zb-table-body" ref="tableBody" scroll-x="true" scroll-y="true" id="tableBody"
  58. :lower-threshold="40" :upper-threshold="10" @scrolltolower="scrolltolower"
  59. @scrolltoupper="(e)=>debounce(scrollToLeft)(e)" @scroll="handleBodyScroll"
  60. :scroll-left="bodyTableLeft" :scroll-top="bodyScrollTop"
  61. :style=" `height: calc(100% - ${showSummary?80:40}px)`">
  62. <view class="zb-table-fixed">
  63. <view class="zb-table-tbody">
  64. <view :class="['item-tr',highlight&&isHighlight(item,index)?'current-row':'']"
  65. @click.stop="rowClick(item,index)" v-for="(item,index) in transData" :key="item.key">
  66. <view :style="[{
  67. width:`${ite.width?ite.width:'100'}px`,
  68. flex:i===transColumns.length-1?1:'none',
  69. minWidth:`${ite.width?ite.width:'100'}px`,
  70. borderRight:`${border?'1px solid #e8e8e8':''}`,
  71. textAlign:ite.align||'left',
  72. },cellStyle&&getCellStyle(item,ite,index,i)]" @click="cellClick(item,index,ite)"
  73. :class="['item-td',stripe?(index % 2) != 0?'odd':'even':'']"
  74. v-for="(ite,i) in transColumns" :key="i">
  75. <template v-if="ite.type==='operation'">
  76. <view style="display: flex;align-items: center;height: 100%">
  77. <view v-for="ren,ind in permission(item,ite.renders,index)" :key="ind"
  78. @click.stop="$emit(ren.func,item,index)" :style="{
  79. display:'flex',
  80. alignItems: 'center',
  81. marginRight:ite.renders.length>1?'8px':'0'
  82. }">
  83. <template v-if="ren.type==='custom'">
  84. <view :class="ren.class||''" style="cursor: pointer">
  85. {{ren.name}}
  86. </view>
  87. </template>
  88. <template v-else>
  89. <button :class="ren.class||''" :type="ren.type||'primary'"
  90. :size="ren.size||'mini'">{{ren.name}}</button>
  91. </template>
  92. </view>
  93. </view>
  94. </template>
  95. <template v-else-if="ite.type==='selection'">
  96. <view class="checkbox-item">
  97. <tableCheckbox @checkboxSelected="(e)=>checkboxSelected(e,item)"
  98. :cellData="item" :checked="item.checked" />
  99. </view>
  100. </template>
  101. <!-- <template v-else-if="ite.type==='index'">
  102. {{index+1}}
  103. </template> -->
  104. <template v-else-if="ite.type==='img'">
  105. <view class="checkbox-item">
  106. <template v-if="item[ite.name]">
  107. <image @click.stop="previewImage(item,item[ite.name],iImage)"
  108. v-for="iImageTem,iImage in imgs(item[ite.name])"
  109. :show-menu-by-longpress="false" :key="iImage" :src="iImageTem"
  110. style="width: 40px;height:30px; " mode="aspectFit"></image>
  111. </template>
  112. <text v-else>{{ite.emptyString}}</text>
  113. </view>
  114. </template>
  115. <template v-else>
  116. <!-- {{ ite.filters?itemFilter(item,ite):(item[ite.name]==null||item[ite.name]==='')?ite.emptyString:item[ite.name] }}-->
  117. {{ ite.filters?itemFilter(item,ite):formatterAction(item,ite,index,i) }}
  118. </template>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </scroll-view>
  124. <table-h5-summary :scrollbarSize="scrollbarSize" :data="data"
  125. :handleFooterTableScrollLeft="handleFooterTableScrollLeft"
  126. :headerFooterTableLeft="headerFooterTableLeft" v-if="showSummary" :showSummary="showSummary"
  127. :transColumns="transColumns" :border="border" :summary-method="summaryMethod" :sumText="sumText"
  128. :fixedLeftColumns="fixedLeftColumns" />
  129. </view>
  130. <view class="zb-table-fixed-left" v-if="isFixedLeft" :style=" {height: `calc(100% - ${scrollbarSize}px)`}">
  131. <template v-if="showHeader">
  132. <view class="zb-table-header" style="display: flex">
  133. <view class="item-tr" style="" @click.stop="rowClick(item,index)"
  134. v-for="(item,index) in fixedLeftColumns" :key="index">
  135. <view :style="{
  136. width:`${item.width?item.width:'100'}px`,
  137. borderRight:`${border?'1px solid #e8e8e8':''}`,
  138. borderTop:`${border?'1px solid #e8e8e8':''}`,
  139. textAlign:item.align||'left'
  140. }" @click.stop="sortAction(item,index)" class="item-th">
  141. <template v-if="item.type==='selection'">
  142. <view class="checkbox-item">
  143. <tableCheckbox :indeterminate="indeterminate" :checked="checkedAll"
  144. @checkboxSelected="checkboxSelectedAll"></tableCheckbox>
  145. </view>
  146. </template>
  147. <template v-else>
  148. {{ item.label }}
  149. <view class="sorter-table" v-if="item.sorter">
  150. <view
  151. :class="['sorter-table-icon',item.sorterMode==='_asc'&&`sorting${item.sorterMode||''}`]">
  152. </view>
  153. <view
  154. :class="['sorter-table-icon',item.sorterMode==='_desc'&&`sorting${item.sorterMode||''}`]">
  155. </view>
  156. </view>
  157. </template>
  158. </view>
  159. </view>
  160. </view>
  161. </template>
  162. <scroll-view scroll-y="true" id="leftTableFixed" :upper-threshold="15"
  163. @scrolltoupper="(e)=>scrollToFixedLeft(e)" @scroll="leftFixedScrollAction"
  164. :scroll-top="leftFiexScrollTop" class="zb-table-body-inner"
  165. :style=" `height: calc(100% - ${showSummary?80:40}px)`">
  166. <view class="zb-table-fixed">
  167. <view class="zb-table-tbody">
  168. <view
  169. :class="['item-tr',stripe?(i % 2) != 0?'odd':'even':'',highlight&&isHighlight(ite,i)?'current-row':'']"
  170. v-for="(ite,i) in transData" @click.stop="rowClick(ite,i)" :key="ite.key" style="">
  171. <view class='item-td' @click="cellClick(ite,index,item)" :style="[{
  172. width:`${item.width?item.width:'100'}px`,
  173. borderRight:`${border?'1px solid #e8e8e8':''}`,
  174. textAlign:item.align||'left'
  175. },cellStyle&&getCellStyle(ite,item,i,index)]" :key="index"
  176. v-for="(item,index) in fixedLeftColumns">
  177. <template v-if="item.type==='selection'">
  178. <view class="checkbox-item">
  179. <tableCheckbox @checkboxSelected="(e)=>checkboxSelected(e,ite)"
  180. :cellData="ite" :checked="ite.checked" />
  181. </view>
  182. </template>
  183. <!-- <template v-else-if="item.type==='index'">
  184. {{i+1}}
  185. </template> -->
  186. <template v-else>
  187. {{ite[item.name]||item.emptyString}}
  188. </template>
  189. </view>
  190. </view>
  191. </view>
  192. </view>
  193. </scroll-view>
  194. <table-side-summary :scrollbarSize="scrollbarSize" v-if="showSummary&&!(scrollbarSize>0)" :data="data"
  195. :showSummary="showSummary" :transColumns="transColumns" :border="border"
  196. :summary-method="summaryMethod" :sumText="sumText" :fixedLeftColumns="fixedLeftColumns" />
  197. </view>
  198. </view>
  199. <zb-load-more v-if="isLoadMore&&!completeLoading" />
  200. </view>
  201. <!-- #endif -->
  202. <!-- #ifndef H5 || APP-PLUS -->
  203. <view class="zb-table-applet">
  204. <view class="zb-table-content" style="white-space: nowrap">
  205. <scroll-view <!-- #ifdef MP-ALIPAY -->
  206. @scroll="scrollAlipay"
  207. <!-- #endif -->
  208. @scrolltolower="scrolltolower"
  209. <!-- #ifdef MP-ALIPAY -->
  210. style=" height: 100%;overflow-x:scroll"
  211. <!-- #endif -->
  212. <!-- #ifndef MP-ALIPAY -->
  213. style=" height: 100%"
  214. <!-- #endif -->
  215. scroll-y="true"
  216. scroll-x="true">
  217. <view class="zb-table-scroll">
  218. <template v-if="showHeader">
  219. <view class="zb-table-header top-header-uni" style="">
  220. <view class="zb-table-fixed">
  221. <view class="zb-table-thead" style="position: relative;">
  222. <view class="item-tr">
  223. <view @click.stop="sortAction(item,index)"
  224. :class="['item-th',index <fixedLeftColumns.length&&'zb-stick-side']" :style="{
  225. left:`${item.left}px`,
  226. width:`${item.width?item.width:'100'}px`,
  227. flex:index===transColumns.length-1?1:'none',
  228. minWidth:`${item.width?item.width:'100'}px`,
  229. borderRight:`${border?'1px solid #e8e8e8':''}`,
  230. borderTop:`${border?'1px solid #e8e8e8':''}`,
  231. textAlign:item.align||'left'
  232. }" v-for="(item,index) in transColumns" :key="index">
  233. <template v-if="item.type==='selection'">
  234. <view class="checkbox-item">
  235. <tableCheckbox :indeterminate="indeterminate" :checked="checkedAll"
  236. @checkboxSelected="checkboxSelectedAll"></tableCheckbox>
  237. </view>
  238. </template>
  239. <template v-else>
  240. {{ item.label||'' }}
  241. <view class="sorter-table" v-if="item.sorter">
  242. <view
  243. :class="['sorter-table-icon',item.sorterMode==='_asc'&&`sorting${item.sorterMode||''}`]">
  244. </view>
  245. <view
  246. :class="['sorter-table-icon',item.sorterMode==='_desc'&&`sorting${item.sorterMode||''}`]">
  247. </view>
  248. </view>
  249. </template>
  250. </view>
  251. </view>
  252. </view>
  253. </view>
  254. </view>
  255. </template>
  256. <template v-if="!data.length">
  257. <view class="no-data">暂无数据~~</view>
  258. </template>
  259. <view class="zb-table-fixed">
  260. <view class="zb-table-tbody">
  261. <view :class="['item-tr',highlight&&isHighlight(item,index)?'current-row':'']"
  262. @click.stop="rowClick(item,index)" v-for="(item,index) in transData" :key="item.key">
  263. <view :style="[{
  264. left:`${ite.left}px`,
  265. width:`${ite.width?ite.width:'100'}px`,
  266. flex:i===transColumns.length-1?1:'none',
  267. minWidth:`${ite.width?ite.width:'100'}px`,
  268. borderRight:`${border?'1px solid #e8e8e8':''}`,
  269. textAlign:ite.align||'left',
  270. },getCellStyle(item,ite,index,i)]" @click="cellClick(item,index,ite)"
  271. :class="['item-td', i <fixedLeftColumns.length&&'zb-stick-side',stripe?(index % 2) != 0?'odd':'even':'']"
  272. v-for="(ite,i) in transColumns" :key="i">
  273. <template v-if="ite.type==='operation'">
  274. <view style="display: flex;align-items: center;height: 100%">
  275. <view v-for="ren,ind in permission(item,ite.renders,index)" :key="ind"
  276. @click.stop="$emit(ren.func,item,index)" :style="{
  277. display:'flex',
  278. alignItems: 'center',
  279. marginRight:ite.renders.length>1?'8px':'0'
  280. }">
  281. <template v-if="ren.type==='custom'">
  282. <view :class="ren.class||''" style="cursor: pointer">
  283. {{ren.name}}
  284. </view>
  285. </template>
  286. <template v-else>
  287. <button :class="ren.class||''" :type="ren.type||'primary'"
  288. :size="ren.size||'mini'">{{ren.name}}</button>
  289. </template>
  290. </view>
  291. </view>
  292. </template>
  293. <template v-else-if="ite.type==='selection'">
  294. <view class="checkbox-item">
  295. <tableCheckbox @checkboxSelected="(e)=>checkboxSelected(e,item)"
  296. :cellData="item" :checked="item.checked" />
  297. </view>
  298. </template>
  299. <template v-else-if="ite.type==='img'">
  300. <template v-if="item[ite.name]">
  301. <view class="checkbox-item" @click.stop>
  302. <image @click.stop="previewImage(iImageTem,item[ite.name],iImage)"
  303. v-for="iImageTem,iImage in imgs(item[ite.name])"
  304. :show-menu-by-longpress="false" :key="iImage" :src="iImageTem"
  305. style="width: 40px;height:30px; " mode="aspectFit"></image>
  306. </view>
  307. </template>
  308. <text v-else>{{ite.emptyString}}</text>
  309. </template>
  310. <template v-else-if="ite.type==='index'">
  311. <view :class="index==0?'sortOne':(index==1?'sortTow':(index==2?'sortThree':'sortFive'))">{{index+1}}</view>
  312. </template>
  313. <template v-else>
  314. <!-- {{ ite.filters?itemFilter(item,ite):(item[ite.name]==null||item[ite.name]==='')?ite.emptyString:item[ite.name] }}-->
  315. {{ ite.filters?itemFilter(item,ite):formatterAction(item,ite,index,i) }}
  316. </template>
  317. </view>
  318. </view>
  319. </view>
  320. </view>
  321. <table-summary v-if="showSummary" :data="data" :showSummary="showSummary"
  322. :fixedLeftColumns="fixedLeftColumns" :transColumns="transColumns" :border="border"
  323. :summary-method="summaryMethod" :sumText="sumText" />
  324. </view>
  325. </scroll-view>
  326. </view>
  327. <zb-load-more v-if="isLoadMore&&!completeLoading" />
  328. </view>
  329. <!-- #endif -->
  330. </template>
  331. <script>
  332. import TableCheckbox from './components/table-checkbox.vue'
  333. import TableSummary from "./components/table-summary.vue";
  334. import TableSideSummary from "./components/table-side-summary.vue";
  335. import TableH5Summary from './components/table-h5-summary'
  336. import ZbLoadMore from './components/zb-load-more'
  337. // #ifdef H5
  338. import {
  339. getScrollbarSize
  340. } from "./js/util";
  341. // #endif
  342. export default {
  343. components: {
  344. TableCheckbox,
  345. TableSummary,
  346. TableSideSummary,
  347. TableH5Summary,
  348. ZbLoadMore
  349. },
  350. props: {
  351. highlight: {
  352. type: Boolean,
  353. default: false
  354. },
  355. itemDate: {
  356. type: Object,
  357. default: () => {}
  358. },
  359. columns: {
  360. type: Array,
  361. default: () => []
  362. },
  363. showSummary: {
  364. type: Boolean,
  365. default: false
  366. },
  367. isShowLoadMore: {
  368. type: Boolean,
  369. default: false
  370. },
  371. data: {
  372. type: Array,
  373. default: () => []
  374. },
  375. sumText: {
  376. type: String,
  377. default: '合计'
  378. },
  379. showHeader: {
  380. type: Boolean,
  381. default: true
  382. },
  383. border: {
  384. type: Boolean,
  385. default: false
  386. },
  387. stripe: {
  388. type: Boolean,
  389. default: true
  390. },
  391. fit: {
  392. type: Boolean,
  393. default: false
  394. },
  395. rowKey: [String, Function],
  396. summaryMethod: Function,
  397. pullUpLoading: Function,
  398. formatter: Function,
  399. cellStyle: Function,
  400. cellHeaderStyle: Function,
  401. permissionBtn: Function,
  402. },
  403. computed: {
  404. loadMoreHeight() {
  405. return this.isLoadMore ? 40 : 0
  406. },
  407. fixedLeftColumns() {
  408. let arr = []
  409. for (let i = 0; i < this.columns.length; i++) {
  410. let item = this.columns[i]
  411. if (item.fixed) {
  412. arr.push(item)
  413. } else {
  414. break
  415. }
  416. }
  417. return arr
  418. },
  419. imgs() {
  420. return (item) => {
  421. return typeof item === 'string' ? [item] : item
  422. }
  423. },
  424. itemfilters() {
  425. return (item, ite) => {
  426. if (item[ite.name] == null) {
  427. return ite.emptyString
  428. }
  429. return item[ite.name]
  430. }
  431. },
  432. scrollbarSize() {
  433. // #ifdef H5
  434. return getScrollbarSize()
  435. // #endif
  436. // #ifndef H5
  437. return 0
  438. // #endif
  439. },
  440. isFixedLeft() {
  441. if (!this.columns.length) {
  442. return false
  443. }
  444. if (!this.data.length) {
  445. return false
  446. }
  447. let [firstArr] = this.columns
  448. return !!firstArr.fixed;
  449. },
  450. transColumns() {
  451. if (this.fit) {
  452. this.columns.forEach(column => {
  453. if (column.type === "operation" && column.renders) {
  454. let str = ''
  455. column.renders.map((item) => {
  456. str += item.name
  457. })
  458. column.width = this.getTextWidth(str) + column.renders.length * 40
  459. } else if (column.type === "img") {
  460. } else if (column.type === "selection") {} else {
  461. let arr = [this.getTextWidth(column.label)]
  462. this.data.forEach(data => {
  463. let str = (data[column.name] + '')
  464. if (str === 'undefined') {
  465. arr.push(30)
  466. } else {
  467. let width = this.getTextWidth(str)
  468. arr.push(width)
  469. }
  470. })
  471. column.width = Math.max(...arr) + 20
  472. }
  473. })
  474. }
  475. let number = 0
  476. this.columns.forEach((item, index) => {
  477. if (item.type === "operation" && item.renders && !item.width) {
  478. let str = ''
  479. item.renders.map((item) => {
  480. str += item.name
  481. })
  482. item.width = this.getTextWidth(str) + item.renders.length * 40
  483. }
  484. if (item.type === "img") {
  485. if (!item.width) {
  486. let arr = []
  487. let widImg = this.getTextWidth(item.label)
  488. this.data.forEach(data => {
  489. if (data[item.name]) {
  490. let urls = typeof data[item.name] === 'string' ? [data[item.name]] :
  491. data[item.name]
  492. arr.push(urls.length)
  493. }
  494. item.width = Math.max(...arr) * 40 + widImg
  495. })
  496. }
  497. }
  498. if (item.fixed) {
  499. if (index === 0) {
  500. item.left = 0
  501. number += item.width
  502. } else {
  503. item.left = number
  504. number += item.width
  505. }
  506. }
  507. item.emptyString = item.emptyString || '--'
  508. })
  509. return this.columns
  510. },
  511. transData() {
  512. let flag = this.columns.some(item => item.type === 'selection')
  513. this.data.forEach((item, index) => {
  514. if (flag) {
  515. if (item.checked) {
  516. if (!this.selectArr.length) {
  517. this.selectArr.push(item)
  518. }
  519. }
  520. }
  521. if (this.rowKey) {
  522. if (typeof this.rowKey === 'function') {
  523. item.key = Object.freeze(this.rowKey(item)) || Date.now()
  524. } else {
  525. item.key = Object.freeze(item[this.rowKey]) || Date.now()
  526. }
  527. } else {
  528. item.key = index
  529. }
  530. })
  531. if (flag) {
  532. if (this.data.length) {
  533. let le = this.data.filter(item => item.checked).length
  534. if (le) {
  535. if (le === this.data.length) {
  536. this.checkedAll = true
  537. } else {
  538. this.indeterminate = true
  539. }
  540. } else {
  541. this.checkedAll = false
  542. this.indeterminate = false
  543. this.selectArr = []
  544. }
  545. } else {
  546. this.checkedAll = false
  547. this.indeterminate = false
  548. this.selectArr = []
  549. }
  550. }
  551. return this.data
  552. },
  553. isHighlight() {
  554. return (item, index) => {
  555. if (this.rowKey) {
  556. return item.key === this.currentRow['key']
  557. } else {
  558. return index === this.currentRowIndex
  559. }
  560. }
  561. },
  562. getHeaderCellStyle() {
  563. return (column, columnIndex, childIndex) => {
  564. const cellStyle = this.cellHeaderStyle;
  565. if (typeof cellStyle === 'function') {
  566. return cellStyle({
  567. column,
  568. columnIndex
  569. })
  570. }
  571. return {}
  572. }
  573. },
  574. getCellStyle() {
  575. return (row, column, rowIndex, columnIndex) => {
  576. const cellStyle = this.cellStyle;
  577. if (typeof cellStyle === 'function') {
  578. return cellStyle({
  579. row,
  580. column,
  581. rowIndex,
  582. columnIndex
  583. })
  584. }
  585. return {}
  586. }
  587. },
  588. },
  589. data() {
  590. return {
  591. button: [],
  592. alipayScrollTop: 0,
  593. alipayScrollOldTop: 0,
  594. alipayFlag: false,
  595. bodyTableLeft: 0,
  596. headerTableLeft: 0,
  597. lastScrollLeft: 0,
  598. isLoadMore: false,
  599. headerFooterTableLeft: 0,
  600. leftFiexScrollTop: 0,
  601. bodyScrollTop: 0,
  602. currentDriver: null,
  603. currentDriver1: null,
  604. bodyTime: null,
  605. currentRowIndex: null,
  606. currentRow: {},
  607. bodyTime1: null,
  608. headerTime: null,
  609. debounceTime: null,
  610. operation: {},
  611. completedFlag: false,
  612. selectArr: [],
  613. indeterminate: false,
  614. checkedAll: false,
  615. completeLoading: false,
  616. aliTime: null,
  617. }
  618. },
  619. created() {},
  620. mounted() {
  621. // setTimeout(()=>{
  622. // uni.createSelectorQuery().in(this).select(".top-header-uni").boundingClientRect( data => {
  623. // console.log('data=======',data)
  624. // //data 可以打印data输出看详细数据,有很多数据信息
  625. // var left = data.width;//表示元素宽度
  626. // }).exec();
  627. // },1000)
  628. },
  629. beforeDestroy() {
  630. this.aliTime && clearTimeout(this.aliTime)
  631. this.debounceTime && clearTimeout(this.debounceTime)
  632. this.bodyTime1 && clearTimeout(this.bodyTime1)
  633. this.bodyTime && clearTimeout(this.bodyTime)
  634. this.selectArr = []
  635. this.indeterminate = false
  636. this.checkedAll = false
  637. },
  638. methods: {
  639. clearSelection() {
  640. this.transData.forEach(item => {
  641. item.checked = false
  642. })
  643. this.selectArr = []
  644. this.indeterminate = false
  645. this.checkedAll = false
  646. },
  647. formatterAction(row, column, rowIndex, columnIndex) {
  648. if (column.formatter && typeof this.formatter === 'function') {
  649. return this.formatter(row, column, rowIndex, columnIndex)
  650. }
  651. return (row[column.name] == null || row[column.name] === '') ? column.emptyString : row[column.name]
  652. },
  653. permission(item, renders, index) {
  654. if (this.permissionBtn && typeof this.permissionBtn === 'function') {
  655. return this.permissionBtn(item, renders, index)
  656. }
  657. return renders
  658. },
  659. pullUpCompleteLoading(type) {
  660. this.isLoadMore = false
  661. if (type === 'ok') {
  662. this.completeLoading = true
  663. }
  664. },
  665. scrollAlipay(e) {
  666. if (!this.alipayScrollOldTop) {
  667. this.alipayScrollOldTop = e.detail.scrollTop
  668. }
  669. this.aliTime && clearTimeout(this.aliTime)
  670. this.aliTime = setTimeout(() => {
  671. if (this.alipayFlag && e.detail.scrollTop > this.alipayScrollOldTop) {
  672. this.pullLoad()
  673. }
  674. this.alipayFlag = false
  675. this.alipayScrollOldTop = null
  676. }, 500)
  677. },
  678. pullLoad() {
  679. if (this.isShowLoadMore) {
  680. this.isLoadMore = true
  681. this.$emit('pullUpLoading')
  682. let that = this
  683. this.pullUpLoading && this.pullUpLoading.call(this.$parent.$parent, (type) => {
  684. that.isLoadMore = false
  685. if (type === 'ok') {
  686. that.completeLoading = true
  687. }
  688. })
  689. }
  690. },
  691. scrolltolower(e) {
  692. this.alipayFlag = true
  693. if (e.detail.direction === 'bottom') {
  694. this.pullLoad()
  695. }
  696. // this.pullUpLoading.call(this.$parent)
  697. },
  698. previewImage(item, url, current) {
  699. let urls = typeof url === 'string' ? [url] : url
  700. uni.previewImage({
  701. current,
  702. urls: urls
  703. })
  704. },
  705. resetHighlight() {
  706. this.currentRowIndex = null
  707. this.currentRow = {}
  708. },
  709. cellClick(row, index, column) {
  710. this.$emit('cellClick', row, index, column)
  711. },
  712. rowClick(row, index) {
  713. if (this.highlight) {
  714. this.currentRowIndex = index
  715. this.currentRow = row
  716. this.$emit('currentChange', row, index)
  717. }
  718. this.$emit('rowClick', row, index)
  719. },
  720. checkboxSelectedAll(e) {
  721. this.indeterminate = false
  722. if (e.checked) {
  723. this.selectArr = []
  724. this.checkedAll = true
  725. this.data.forEach(item => {
  726. // this.$set(item,'checked',true)
  727. item.checked = true
  728. this.selectArr.push(item)
  729. })
  730. } else {
  731. this.checkedAll = false
  732. this.data.forEach(item => {
  733. this.$set(item, 'checked', false)
  734. })
  735. this.selectArr = []
  736. }
  737. // #ifndef H5 || APP-PLUS
  738. this.$forceUpdate()
  739. // #endif
  740. this.$emit('toggleAllSelection', e.checked, this.selectArr)
  741. },
  742. checkboxSelected(e, item) {
  743. // #ifdef H5 || APP-PLUS
  744. this.$set(item, 'checked', e.checked)
  745. // #endif
  746. // #ifndef H5 || APP-PLUS
  747. this.data.forEach(item => {
  748. if (item.key === e.data.key) {
  749. item.checked = e.checked
  750. }
  751. })
  752. // #endif
  753. item.checked = e.checked
  754. e.data.checked = e.checked
  755. if (e.checked) {
  756. this.selectArr.push(e.data)
  757. } else {
  758. this.selectArr = this.selectArr.filter(item => item.key !== e.data.key)
  759. }
  760. if (this.selectArr.length === this.transData.length) {
  761. this.indeterminate = false
  762. this.checkedAll = true
  763. } else {
  764. this.indeterminate = true
  765. this.checkedAll = false
  766. }
  767. if (!this.selectArr.length) {
  768. this.checkedAll = false
  769. this.indeterminate = false
  770. }
  771. // #ifndef H5 || APP-PLUS
  772. this.$forceUpdate()
  773. // #endif
  774. this.$emit('toggleRowSelection', e.checked, this.selectArr)
  775. },
  776. itemFilter(item, ite) {
  777. if (ite.filters && ite.name) {
  778. let key = item[ite.name]
  779. return ite.filters[key] || ''
  780. }
  781. return item[ite.name] || ite.emptyString
  782. },
  783. // 默认字体为微软雅黑 Microsoft YaHei,字体大小为 14px
  784. getTextWidth(str) {
  785. if (str.length < 3) {
  786. return 40
  787. }
  788. let regx = /^[0-9]+.?[0-9]*$/
  789. let flexWidth = 0
  790. for (const char of str) {
  791. if ((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z')) {
  792. // 如果是英文字符,为字符分配8个单位宽度
  793. flexWidth += 10
  794. } else if (char >= '\u4e00' && char <= '\u9fa5') {
  795. // 如果是中文字符,为字符分配15个单位宽度
  796. flexWidth += 15
  797. } else if (regx.test(char)) {
  798. flexWidth += 9
  799. } else {
  800. // 其他种类字符,为字符分配8个单位宽度
  801. flexWidth += 7
  802. }
  803. }
  804. return flexWidth
  805. },
  806. width(item) {
  807. return `${item.width?item.width:'100'}px`
  808. },
  809. showStripe(index) {
  810. if (this.currentDriver) return
  811. if (this.stripe) {
  812. return (index % 2) != 0 ? 'odd' : 'even'
  813. } else {
  814. return ''
  815. }
  816. },
  817. //验证字符串是否是数字
  818. checkNumber(theObj) {
  819. var reg = /^[0-9]+.?[0-9]*$/;
  820. if (reg.test(theObj)) {
  821. return true;
  822. }
  823. return false;
  824. },
  825. isDate(data) {
  826. if (isNaN(data) && !isNaN(Date.parse(data))) {
  827. return true
  828. }
  829. return false
  830. },
  831. sortAction(item, index) {
  832. if (!item.sorter) {
  833. return false
  834. }
  835. this.$set(item, 'sorterMode', item.sorterMode === '_asc' ? '_desc' : '_asc')
  836. if (item.sorter === 'custom') {
  837. this.$emit('sort-change', item, item.sorterMode.replace('_', ''), index)
  838. } else {
  839. this.sortData(item)
  840. }
  841. // #ifndef H5 || APP-PLUS
  842. this.$forceUpdate()
  843. // #endif
  844. },
  845. sortData(item) {
  846. let key = item.name
  847. if (item.sorterMode === '_asc') {
  848. this.data.sort((a, b) => {
  849. if (this.checkNumber(a[key])) {
  850. return a[key] - b[key]
  851. }
  852. if (this.isDate(a[key])) {
  853. let a1 = new Date(a[key]).getTime()
  854. let b1 = new Date(b[key]).getTime()
  855. return a1 - b1
  856. }
  857. })
  858. } else {
  859. this.data.sort((a, b) => {
  860. if (this.checkNumber(a[key])) {
  861. return b[key] - a[key]
  862. }
  863. if (this.isDate(a[key])) {
  864. let a1 = new Date(a[key]).getTime()
  865. let b1 = new Date(b[key]).getTime()
  866. return b1 - a1
  867. }
  868. })
  869. }
  870. },
  871. throttle(method, delay = 60) {
  872. let time = null
  873. return (...args) => {
  874. if (!time) {
  875. time = setTimeout(() => {
  876. method(...args)
  877. time = null;
  878. }, delay)
  879. }
  880. }
  881. },
  882. debounce(method, delay = 1000) {
  883. return (...args) => {
  884. this.debounceTime && clearTimeout(this.debounceTime)
  885. this.debounceTime = setTimeout(() => {
  886. method(...args)
  887. }, delay)
  888. }
  889. },
  890. handleBodyScroll(e) {
  891. if (this.currentDriver && this.currentDriver !== e.currentTarget.id) return
  892. this.currentDriver = e.currentTarget.id
  893. this.headerTableLeft = e.detail.scrollLeft
  894. this.headerFooterTableLeft = e.detail.scrollLeft
  895. this.leftFiexScrollTop = e.detail.scrollTop
  896. this.bodyTime && clearTimeout(this.bodyTime)
  897. this.bodyTime = setTimeout(() => {
  898. this.currentDriver = null
  899. }, 200)
  900. },
  901. leftFixedScrollAction(e) {
  902. if (this.currentDriver && this.currentDriver !== e.currentTarget.id) return
  903. this.currentDriver = e.currentTarget.id
  904. this.bodyScrollTop = e.detail.scrollTop
  905. this.bodyTime && clearTimeout(this.bodyTime)
  906. this.bodyTime = setTimeout(() => {
  907. this.currentDriver = null
  908. }, 200)
  909. },
  910. scrollToLeft(e) {
  911. if (this.currentDriver1 && this.currentDriver1 !== e.currentTarget.id) return
  912. this.currentDriver1 = e.currentTarget.id
  913. if (e.detail.direction === 'left' && this.headerTableLeft < 10) {
  914. this.headerTableLeft = 0
  915. } else if (e.detail.direction === 'top' && this.leftFiexScrollTop < 10) {
  916. this.leftFiexScrollTop = 0
  917. }
  918. this.bodyTime && clearTimeout(this.bodyTime)
  919. this.bodyTime = setTimeout(() => {
  920. this.currentDriver1 = null
  921. }, 200)
  922. },
  923. scrollToFixedLeft(e) {
  924. if (this.currentDriver1 && this.currentDriver1 !== e.currentTarget.id) return
  925. this.currentDriver1 = e.currentTarget.id
  926. if (e.detail.direction === 'top' && this.bodyScrollTop < 10) {
  927. this.bodyScrollTop = 0
  928. }
  929. this.bodyTime && clearTimeout(this.bodyTime)
  930. this.bodyTime = setTimeout(() => {
  931. this.currentDriver1 = null
  932. }, 200)
  933. },
  934. handleTableScrollLeft(e, type) {
  935. if (this.currentDriver && this.currentDriver !== e.currentTarget.id) return
  936. this.currentDriver = e.currentTarget.id
  937. this.bodyTableLeft = e.detail.scrollLeft
  938. this.headerFooterTableLeft = e.detail.scrollLeft
  939. this.bodyTime && clearTimeout(this.bodyTime)
  940. this.bodyTime = setTimeout(() => {
  941. this.currentDriver = null
  942. }, 200)
  943. },
  944. handleFooterTableScrollLeft(e) {
  945. if (this.currentDriver && this.currentDriver !== e.currentTarget.id) return
  946. this.currentDriver = e.currentTarget.id
  947. this.bodyTableLeft = e.detail.scrollLeft
  948. this.headerTableLeft = e.detail.scrollLeft
  949. this.bodyTime && clearTimeout(this.bodyTime)
  950. this.bodyTime = setTimeout(() => {
  951. this.currentDriver = null
  952. }, 200)
  953. }
  954. }
  955. }
  956. </script>
  957. <style lang="scss">
  958. .zb-table-fixed-left {
  959. /*去除左边滚动条 */
  960. scroll-view ::-webkit-scrollbar {
  961. display: none !important;
  962. width: 0 !important;
  963. height: 0 !important;
  964. -webkit-appearance: none;
  965. background: transparent;
  966. }
  967. }
  968. .zb-table-header {
  969. ///*去除头部滚动条 */
  970. scroll-view ::-webkit-scrollbar {
  971. display: none !important;
  972. width: 0 !important;
  973. height: 0 !important;
  974. -webkit-appearance: none;
  975. background: transparent;
  976. }
  977. }
  978. .sortOne {
  979. display: inline-block;
  980. width: 40rpx;
  981. height: 40rpx;
  982. padding: 4rpx;
  983. box-sizing: border-box;
  984. background: rgba(255, 0, 0, 0.2);
  985. font-weight: 400;
  986. font-size: 28rpx;
  987. color: #FF0000;
  988. line-height: 40rpx;
  989. text-align: center;
  990. border-radius: 20rpx;
  991. }
  992. .sortTow {
  993. display: inline-block;
  994. width: 40rpx;
  995. height: 40rpx;
  996. padding: 4rpx;
  997. box-sizing: border-box;
  998. background: rgba(255, 153, 0, 0.2);
  999. font-weight: 400;
  1000. font-size: 28rpx;
  1001. color: #FF9900;
  1002. line-height: 40rpx;
  1003. text-align: center;
  1004. border-radius: 20rpx;
  1005. }
  1006. .sortThree {
  1007. display: inline-block;
  1008. width: 40rpx;
  1009. height: 40rpx;
  1010. padding: 4rpx;
  1011. box-sizing: border-box;
  1012. background: rgba(255, 242, 0, 0.2);
  1013. font-weight: 400;
  1014. font-size: 28rpx;
  1015. color: #FFF200;
  1016. line-height: 40rpx;
  1017. text-align: center;
  1018. border-radius: 20rpx;
  1019. }
  1020. .sortFive {
  1021. display: inline-block;
  1022. width: 40rpx;
  1023. height: 40rpx;
  1024. padding: 4rpx;
  1025. box-sizing: border-box;
  1026. background: rgba(1, 131, 250, 0.2);
  1027. font-weight: 400;
  1028. font-size: 28rpx;
  1029. color: #0183FA;
  1030. line-height: 40rpx;
  1031. text-align: center;
  1032. border-radius: 20rpx;
  1033. }
  1034. </style>
  1035. <style lang="scss" scoped>
  1036. .sorter-table {
  1037. position: absolute;
  1038. right: 6px;
  1039. top: 50%;
  1040. transform: translateY(-50%);
  1041. .sorter-table-icon {
  1042. width: 0;
  1043. height: 0;
  1044. color: #dcdcdc;
  1045. border-right: 4px solid transparent;
  1046. border-left: 4px solid transparent;
  1047. }
  1048. .sorter-table-icon:first-child {
  1049. border-bottom: 5px solid currentColor;
  1050. }
  1051. .sorter-table-icon:last-child {
  1052. margin-top: 1.5px;
  1053. border-top: 5px solid currentColor;
  1054. }
  1055. .sorting_desc {
  1056. color: #2979ff;
  1057. }
  1058. .sorting_asc {
  1059. color: #2979ff;
  1060. }
  1061. }
  1062. .checkbox-item {
  1063. display: flex;
  1064. align-items: center;
  1065. justify-content: center;
  1066. width: 100%;
  1067. height: 100%
  1068. }
  1069. .no-data {
  1070. width: 100%;
  1071. height: 80rpx;
  1072. display: flex;
  1073. justify-content: center;
  1074. align-items: center;
  1075. border-bottom: 1px solid #e8e8e8;
  1076. }
  1077. .item-th {
  1078. position: relative;
  1079. flex-shrink: 0;
  1080. width: 100px;
  1081. overflow-wrap: break-word;
  1082. //border-bottom: 1px solid #e8e8e8;
  1083. transition: background 0.3s;
  1084. padding-right: 20px;
  1085. word-break: keep-all;
  1086. /* 不换行 */
  1087. white-space: nowrap;
  1088. /* 不换行 */
  1089. overflow: hidden;
  1090. /* 内容超出宽度时隐藏超出部分的内容 */
  1091. text-overflow: ellipsis;
  1092. /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
  1093. overflow-wrap: break-word;
  1094. }
  1095. .zb-table {
  1096. height: 100%;
  1097. overflow: hidden;
  1098. width: 100%;
  1099. display: flex;
  1100. flex-direction: column;
  1101. font-size: 12px;
  1102. position: relative;
  1103. .zb-table-content {
  1104. //height: 100%;
  1105. //flex: 1;
  1106. position: relative;
  1107. overflow: hidden;
  1108. }
  1109. .zb-table-fixed {
  1110. min-width: 100%;
  1111. }
  1112. .zb-table-body {
  1113. position: relative;
  1114. background: #fff;
  1115. transition: opacity 0.3s;
  1116. }
  1117. .item-tr {
  1118. display: flex;
  1119. //height: 41px;
  1120. background: rgba(162, 162, 162, 0.2)
  1121. }
  1122. .item-td {
  1123. flex-shrink: 0;
  1124. width: 100px;
  1125. padding-left: 8px;
  1126. height: 40px;
  1127. line-height: 40px;
  1128. padding-right: 20px;
  1129. box-sizing: border-box;
  1130. word-break: keep-all;
  1131. /* 不换行 */
  1132. white-space: nowrap;
  1133. /* 不换行 */
  1134. overflow: hidden;
  1135. /* 内容超出宽度时隐藏超出部分的内容 */
  1136. text-overflow: ellipsis;
  1137. /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
  1138. overflow-wrap: break-word;
  1139. border-bottom: 1px solid #e8e8e8;
  1140. //transition: background 0.3s;
  1141. }
  1142. .zb-table-fixed-left .zb-table-header {
  1143. overflow-y: hidden;
  1144. }
  1145. .zb-table-header {
  1146. overflow: hidden;
  1147. background: #fafafa;
  1148. .item-th {
  1149. padding-left: 8px;
  1150. line-height: 39px;
  1151. height: 40px;
  1152. //display: flex;
  1153. //align-items: center;
  1154. box-sizing: border-box;
  1155. }
  1156. }
  1157. .zb-table-fixed-left .zb-table-fixed {
  1158. background: #fff;
  1159. }
  1160. .zb-table-fixed-right .zb-table-fixed {
  1161. background: #fff;
  1162. }
  1163. .zb-table-body-inner {
  1164. height: 100%;
  1165. // overflow: scroll;
  1166. }
  1167. .zb-table-fixed-left {
  1168. position: absolute;
  1169. top: 0;
  1170. z-index: 1;
  1171. overflow: hidden;
  1172. border-radius: 0;
  1173. height: 100%;
  1174. //transition: box-shadow 0.3s ease;
  1175. }
  1176. .odd {
  1177. background-color: rgba(249, 249, 249, 0.6);
  1178. //height: 100%;
  1179. width: 100%;
  1180. }
  1181. .even {
  1182. background-color: white;
  1183. //height: 100%;
  1184. width: 100%;
  1185. }
  1186. }
  1187. .scroll-left-fixed {
  1188. .zb-table-fixed-left {
  1189. left: 0;
  1190. box-shadow: 6px 0 6px -4px #ccc;
  1191. }
  1192. }
  1193. .zb-table-applet {
  1194. height: 100%;
  1195. //overflow: hidden;
  1196. width: 100%;
  1197. position: relative;
  1198. display: flex;
  1199. flex-direction: column;
  1200. font-size: 12px;
  1201. .zb-table-content {
  1202. //height: 100%;
  1203. flex: 1;
  1204. overflow: hidden;
  1205. position: relative;
  1206. }
  1207. .zb-table-fixed {
  1208. min-width: 100%;
  1209. width: fit-content;
  1210. }
  1211. .zb-table-body {
  1212. position: relative;
  1213. background: #fff;
  1214. transition: opacity 0.3s;
  1215. }
  1216. .item-tr {
  1217. display: flex;
  1218. background: rgba(162, 162, 162, 0.2) //height: 41px;
  1219. }
  1220. .item-td {
  1221. flex-shrink: 0;
  1222. width: 100px;
  1223. padding-left: 8px;
  1224. height: 40px;
  1225. line-height: 40px;
  1226. padding-right: 20px;
  1227. box-sizing: border-box;
  1228. color: #fff;
  1229. background: #3E414F;
  1230. word-break: keep-all;
  1231. /* 不换行 */
  1232. white-space: nowrap;
  1233. /* 不换行 */
  1234. overflow: hidden;
  1235. /* 内容超出宽度时隐藏超出部分的内容 */
  1236. text-overflow: ellipsis;
  1237. /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
  1238. overflow-wrap: break-word;
  1239. border-bottom: 1px dashed rgba(216, 216, 216, 0.2);
  1240. //transition: background 0.3s;
  1241. }
  1242. .zb-table-header {
  1243. //overflow: hidden;
  1244. position: sticky;
  1245. top: 0;
  1246. z-index: 2;
  1247. //width: fit-content;
  1248. .item-th {
  1249. padding-left: 8px;
  1250. line-height: 39px;
  1251. height: 40px;
  1252. box-sizing: border-box;
  1253. background: #A2A2A2;
  1254. color: #fff;
  1255. }
  1256. .zb-stick-side {
  1257. position: sticky;
  1258. top: 0;
  1259. left: 0;
  1260. z-index: 2;
  1261. //border-right: solid 1rpx #dbdbdb;
  1262. box-sizing: border-box;
  1263. background: #A2A2A2;
  1264. color: #fff;
  1265. //box-shadow: 6px 0 6px -4px #ccc;
  1266. }
  1267. }
  1268. .zb-table-fixed-left .zb-table-fixed {
  1269. background: #fff;
  1270. }
  1271. .zb-table-fixed-right .zb-table-fixed {
  1272. background: #fff;
  1273. }
  1274. .zb-table-fixed-header .zb-table-body-inner {
  1275. height: 100%;
  1276. // overflow: scroll;
  1277. }
  1278. .zb-table-fixed-left {
  1279. position: absolute;
  1280. top: 0;
  1281. z-index: 1;
  1282. overflow: hidden;
  1283. border-radius: 0;
  1284. height: 100%;
  1285. //transition: box-shadow 0.3s ease;
  1286. }
  1287. .scroll-left-fixed {
  1288. .zb-table-fixed-left {
  1289. left: 0;
  1290. box-shadow: 6px 0 6px -4px #ccc;
  1291. }
  1292. }
  1293. .odd {
  1294. background-color: rgba(249, 249, 249, 0.6);
  1295. //height: 100%;
  1296. width: 100%;
  1297. }
  1298. .even {
  1299. background-color: white;
  1300. //height: 100%;
  1301. width: 100%;
  1302. }
  1303. .zb-table-tbody {
  1304. .zb-stick-side {
  1305. position: sticky;
  1306. left: 0;
  1307. z-index: 1;
  1308. box-sizing: border-box;
  1309. background: #3E414F;
  1310. color: #fff;
  1311. //box-shadow: 6px 0 6px -2px #ccc;
  1312. }
  1313. .odd {
  1314. background: #f9f9f9;
  1315. //height: 100%;
  1316. width: 100%;
  1317. }
  1318. .even {
  1319. background: white;
  1320. //height: 100%;
  1321. width: 100%;
  1322. }
  1323. }
  1324. .current-row {
  1325. .item-td {
  1326. background-color: #ecf5ff;
  1327. }
  1328. }
  1329. }
  1330. .current-row {
  1331. .item-td {
  1332. background-color: #ecf5ff;
  1333. }
  1334. }
  1335. .zb-table-header {
  1336. height: 40px;
  1337. }
  1338. .scrollPosition {
  1339. position: absolute;
  1340. right: 0;
  1341. top: 0;
  1342. height: 100%;
  1343. background: red;
  1344. z-index: 999;
  1345. }
  1346. </style>