data1.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view>
  3. <u-navbar title="数据明细">
  4. </u-navbar>
  5. <u-calendar v-model="show" mode="date" @change="change2"></u-calendar>
  6. <view class="mainHead">
  7. <view class="headO headOindex" @click="btnHead(-1)">
  8. <u-icon name="arrow-left" size="20"></u-icon>
  9. </view>
  10. <view @click="show = true">
  11. {{time}}<u-icon style="margin-left: 6px;" name="arrow-down"></u-icon>
  12. </view>
  13. <view class="headO" @click="btnHead(1)" :class="{
  14. headOindex:nowtime!=time
  15. }" >
  16. <u-icon name="arrow-right" size="20" ></u-icon>
  17. </view>
  18. </view>
  19. <view class="mainBody">
  20. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  21. <view class="table">
  22. <view class="tableHead" :style="'top:'+top">
  23. <table>
  24. <tr :style="data1style1" >
  25. <td :style="data1style2">
  26. 单位
  27. </td>
  28. </tr>
  29. <tr v-for="(item,i) in list[current].list" :key="i" :style="item.data1style1" >
  30. <td >
  31. {{item.a}}
  32. </td>
  33. </tr>
  34. </table>
  35. </view>
  36. <view class="tableBody">
  37. <scroll-view class="scroll-view_H" scroll-x="true" style="white-space: nowrap;">
  38. <table>
  39. <tr class="tabbleHeadTr">
  40. <td rowspan="3" class="get_td_top" >
  41. 单位
  42. </td>
  43. <td rowspan="3">
  44. 本月完成
  45. </td>
  46. <td rowspan="3">
  47. 累计完成
  48. </td>
  49. <td rowspan="3">
  50. 同期
  51. </td>
  52. <td rowspan="3">
  53. 增幅
  54. </td>
  55. <td rowspan="1" colspan="12">
  56. 其中
  57. </td>
  58. </tr>
  59. <tr class="tabbleHeadTr">
  60. <td colspan="2">
  61. 增值税
  62. </td>
  63. <td rowspan="2" >
  64. 增幅
  65. </td><td colspan="2">
  66. 企业所得税
  67. </td><td rowspan="2">
  68. 增幅
  69. </td><td colspan="2">
  70. 个人所得税
  71. </td><td rowspan="2">
  72. 增幅
  73. </td><td colspan="2">
  74. 城建税
  75. </td><td rowspan="2">
  76. 增幅
  77. </td>
  78. </tr>
  79. <tr class="tabbleHeadTr">
  80. <td >
  81. 本年
  82. </td>
  83. <td >
  84. 上年
  85. </td>
  86. <td >
  87. 本年
  88. </td>
  89. <td >
  90. 上年
  91. </td>
  92. <td >
  93. 本年
  94. </td>
  95. <td >
  96. 上年
  97. </td>
  98. <td >
  99. 本年
  100. </td>
  101. <td >
  102. 上年
  103. </td>
  104. </tr>
  105. <tr v-for="(item,i) in list[current].list" :key="i" class="tabbleBodyTr">
  106. <td :class="'get_td get_td_i_'+i">
  107. {{item.a}}
  108. </td>
  109. <td >
  110. {{item.b}}
  111. </td>
  112. <td >
  113. {{item.c}}
  114. </td>
  115. <td >
  116. {{item.d}}
  117. </td>
  118. </tr>
  119. </table>
  120. </scroll-view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. import {
  128. newDate,
  129. currentTimeStamp,
  130. parseUnixTime,
  131. afterTimeStamp,
  132. } from '@/apis/utils'
  133. export default {
  134. data() {
  135. return {
  136. nowtime:"",
  137. show:false,
  138. time:"",
  139. data1style:"",
  140. top: '0px',
  141. current:0,
  142. list:[{
  143. name:"车务段",
  144. list:[
  145. {a:"223223223223223223223223223223223223223223",b:"222222222222",c:"223",d:"qwe223"},
  146. {a:"123",b:"223",c:"223",d:"tda223tda223tda223tda223tda223tda223tda223tda223"}
  147. ]
  148. },{
  149. name:"机务段"
  150. },
  151. ]
  152. }
  153. },
  154. onLoad(){
  155. this.nowtime=parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  156. this.time=parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  157. },
  158. onReady() {
  159. const query = uni.createSelectorQuery().in(this);
  160. query.select('.tableBody').boundingClientRect(data => {
  161. ("得到布局位置信息" + JSON.stringify(data));
  162. // //("节点离页面顶部的距离为" + data.top);
  163. this.top=data.top+"px"
  164. }).exec();
  165. query.select('.get_td_top').boundingClientRect(data => {
  166. //(".get_td得到布局位置信息" + JSON.stringify(data));
  167. this.data1style1="height:"+data.height+"px"
  168. this.data1style2="width:"+(data.width-2)+"px;text-align: center;"
  169. }).exec();
  170. query.selectAll('.get_td').boundingClientRect(data => {
  171. (".get_td得到布局位置信息" + JSON.stringify(data));
  172. (".get_td节点离页面顶部的距离为" + data.top);
  173. for(var i in data){
  174. var style="width:"+data[i].width+"px;height:"+data[i].height+"px"
  175. this.list[this.current].list[i].data1style1=style
  176. }
  177. }).exec();
  178. },
  179. methods: {
  180. btnHead(a){
  181. if(a>0){
  182. if(this.nowtime==this.time){
  183. return
  184. }else{
  185. }
  186. }else{
  187. }
  188. this.time=parseUnixTime(afterTimeStamp(a,newDate(this.time)), '{y}-{m}-{d}');
  189. },
  190. change2(e) {
  191. this.time=e.result;
  192. },
  193. change(index) {
  194. this.current = index;
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped >
  200. .headO{
  201. color:#D4D6D9 ;
  202. border: 1px solid #D4D6D9 ;
  203. border-radius: 58px;
  204. width: 20px;
  205. height: 20px;
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. }
  210. .headOindex{
  211. color:#1677FF ;
  212. border: 1px solid #1677FF ;
  213. }
  214. .mainHead{
  215. background-color: rgba(255, 255, 255, 1);
  216. margin: 12px 16px;
  217. border-radius: 8px;
  218. display: flex;
  219. justify-content: space-around;
  220. padding: 14px 0;
  221. }
  222. .scroll-Y {
  223. height: 300rpx;
  224. }
  225. .scroll-view_H {
  226. white-space: nowrap;
  227. width: 100%;
  228. }
  229. .scroll-view-item {
  230. height: 300rpx;
  231. line-height: 300rpx;
  232. text-align: center;
  233. font-size: 36rpx;
  234. }
  235. .scroll-view-item_H {
  236. display: inline-block;
  237. //width: 85%;
  238. height: 300rpx;
  239. line-height: 300rpx;
  240. text-align: center;
  241. font-size: 36rpx;
  242. }
  243. .table{
  244. // display: flex;
  245. table{
  246. border-top: 1px solid #dbdbdb;
  247. border-spacing:0;
  248. td{
  249. border-right: 1px solid #dbdbdb;
  250. border-bottom: 1px solid #dbdbdb;
  251. line-height: 20px;
  252. background-color: rgba(255, 255, 255, 1);
  253. max-width: 140px;
  254. overflow: hidden;
  255. white-space: nowrap;
  256. text-overflow: ellipsis;
  257. white-space: pre-line;
  258. padding :0 3px;
  259. }
  260. .tabbleHeadTr td{
  261. width: 80px;
  262. min-width: 80px;
  263. text-align: center;
  264. //height: 60px;
  265. //color: rgba(255, 255, 255, 1);
  266. }
  267. .tabbleBodyTr td{
  268. height: 60px;
  269. }
  270. }
  271. }
  272. .tableHead{
  273. position: relative;
  274. position: absolute;
  275. z-index: 99;
  276. }
  277. .mainBody{
  278. .mainItem{
  279. color: rgba(16, 16, 16, 1);
  280. font-size: 32rpx;
  281. line-height: 20px;
  282. border-radius: 8px;
  283. background-color: rgba(255, 255, 255, 1);
  284. margin: 16px;
  285. padding: 12px 16px;
  286. .name{
  287. }
  288. .left{
  289. }
  290. }
  291. }
  292. </style>