report-query.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="query-box">
  3. <view class="query">
  4. <u-search placeholder="请输入报表名称" v-model="queryParams.reportName" :show-action="false" shape="square"
  5. @search="search">
  6. </u-search>
  7. <view class="screen" @click="openQuery">
  8. <image class="screen-img" src="@/static/image/sx.png" alt="">
  9. <view>筛选</view>
  10. </view>
  11. </view>
  12. <view class="list-box">
  13. <uni-list>
  14. <uni-list-item v-for="item in reportList" :key="item.id" :title="item.reportTableName"
  15. :note="item.createTime" thumb="../../static/image/sjcx.png" thumb-size="medium" link
  16. :to="`/pages/reportForm/report-detail/index?id=${item.id}&title=${item.reportTableName}`">
  17. </uni-list-item>
  18. </uni-list>
  19. <view v-if="monthQuery" class="query-screen">
  20. <view>
  21. 报表时间选择
  22. </view>
  23. <view class="month">
  24. <view :class="monthCurrent===item.current?'month-select':'month-item'" v-for="item in monthList"
  25. :key="item.current" @click="monthChange(item.current)">
  26. {{item.name}}
  27. </view>
  28. </view>
  29. <uni-datetime-picker v-model="queryParams.range" type="daterange" start-placeholder="起始时间"
  30. end-placeholder="终止时间" @change="change" />
  31. <view class="month-btn">
  32. <u-button class="reset" style="width:200rpx" @click="search">重置</u-button>
  33. <u-button type="primary" style="width:200rpx" @click="search">确认</u-button>
  34. </view>
  35. </view>
  36. <view class="modal" v-if="monthQuery"></view>
  37. <u-empty v-if="!reportList.length" class="empty" icon="../../static/data.png" text="暂无数据">
  38. </u-empty>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. props: {
  45. queryParams: Object
  46. },
  47. data() {
  48. return {
  49. // 报表列表数据
  50. reportList: [],
  51. // 时间选择
  52. monthList: [{
  53. name: '近一周',
  54. current: 0
  55. },
  56. {
  57. name: '近1个月',
  58. current: 1
  59. },
  60. {
  61. name: '近3个月',
  62. current: 2
  63. },
  64. {
  65. name: '近6个月',
  66. current: 3
  67. }
  68. ],
  69. monthCurrent: 0,
  70. monthQuery: false,
  71. }
  72. },
  73. mounted() {
  74. this.getAllReport()
  75. },
  76. methods: {
  77. // 获取报表数据
  78. getAllReport() {
  79. uni.$http.get('/reportTable/getAllOkReportTable', this.queryParams).then(res => {
  80. const data = res.data
  81. if (data.code === 200) {
  82. this.reportList = data.data.reportTableList
  83. uni.stopPullDownRefresh()
  84. }
  85. })
  86. },
  87. // 打开筛选
  88. openQuery() {
  89. this.monthQuery = !this.monthQuery
  90. },
  91. // 切换时间
  92. monthChange(current) {
  93. this.monthCurrent = current
  94. },
  95. // 选中范围时间
  96. change(val) {
  97. this.$emit('handelDate', val)
  98. },
  99. //搜索
  100. search() {
  101. this.getAllReport()
  102. this.monthQuery = false
  103. this.$emit('reset')
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .query-box {
  110. .query {
  111. margin-top: 40rpx;
  112. padding: 0 40rpx;
  113. display: flex;
  114. justify-content: space-around;
  115. align-items: center;
  116. .screen {
  117. display: flex;
  118. align-items: center;
  119. margin-left: 30rpx;
  120. .screen-img {
  121. width: 40rpx;
  122. height: 40rpx;
  123. }
  124. }
  125. }
  126. .query-screen {
  127. width: 96vw;
  128. padding: 0 20rpx;
  129. background: #ffffff;
  130. position: absolute;
  131. top: 0;
  132. z-index: 999;
  133. .month {
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: center;
  137. font-size: 28rpx;
  138. margin: 40rpx 0;
  139. .month-item {
  140. padding: 10rpx 20rpx;
  141. background: #ECECEC;
  142. color: #000000;
  143. border-radius: 12rpx;
  144. }
  145. .month-select {
  146. padding: 10rpx 20rpx;
  147. border-radius: 12rpx;
  148. background: #289BFF;
  149. color: #ffffff;
  150. }
  151. }
  152. .month-btn {
  153. display: flex;
  154. justify-content: space-around;
  155. margin-top: 40rpx;
  156. margin-bottom: 40rpx;
  157. .reset {
  158. background: #EAF4FF;
  159. color: #469DED;
  160. border: 1px solid #A3B8CB;
  161. }
  162. }
  163. }
  164. }
  165. .list-box {
  166. margin-top: 40rpx;
  167. position: relative;
  168. .modal {
  169. width: 100%;
  170. height: 76vh;
  171. position: absolute;
  172. top: 0;
  173. background: rgba(0, 0, 0, 0.5);
  174. }
  175. }
  176. </style>