zb-tablesearch.vue 42 KB

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