topic.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view>
  3. <view class="btnContain">
  4. <button
  5. v-for="(item,idx) in userType"
  6. @click="onclick(item,idx)"
  7. :class="idx == currentIdx ? 'highlight' : 'not-highlight'"
  8. :style="idx == 0 ? 'text-align:left' : 'text-align:right'"
  9. >
  10. {{item.dictLabel}}
  11. </button>
  12. </view>
  13. <view>
  14. <uni-grid :column="2" :square="false" :highlight="false" >
  15. <uni-grid-item v-for="(item, index) in dataList" :index="index" :key="index" >
  16. <view class="grid-item-box" @click="onMatters(item)">
  17. <text class="text" >{{ item.deptName }}</text>
  18. </view>
  19. </uni-grid-item>
  20. </uni-grid>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getDicts
  27. } from "@/api/system/dict/data.js"
  28. import {
  29. listAll
  30. } from "@/api/handleAffairs/topicType.js"
  31. export default {
  32. data() {
  33. return {
  34. userType: [], // 初始化用户类型为空
  35. dataList: [],
  36. currentIdx:0,
  37. }
  38. },
  39. created() {
  40. this.getdictData()//初始化字典按钮
  41. this.getdataList()//初始化数据
  42. },
  43. methods: {
  44. onMatters(data){
  45. uni.setStorageSync('data', {type:data.deptName,examine:1})
  46. uni.navigateTo({
  47. url: '/pages/matterAll/matterAll',
  48. });
  49. },
  50. getdataList(data){
  51. let _that = this
  52. if (!data) {
  53. data = {
  54. objectOfHandling: 0,
  55. yesOrNoShow: "0"
  56. }
  57. }
  58. listAll(data).then(res => {
  59. _that.dataList = res.data
  60. })
  61. console.log(_that.dataList)
  62. },
  63. onclick(row,idx) {
  64. this.currentIdx = idx
  65. let data = {
  66. objectOfHandling: row.dictValue,
  67. yesOrNoShow: "0"
  68. }
  69. this.getdataList(data)
  70. },
  71. getdictData() {
  72. let _that = this
  73. getDicts("object_application").then(res => {
  74. _that.userType = res.data
  75. })
  76. },
  77. changeUserType(type) {
  78. this.userType = type
  79. }
  80. },
  81. }
  82. </script>
  83. <style>
  84. /* view {
  85. display: flex;
  86. flex-direction: column;
  87. align-items: center;
  88. justify-content: center;
  89. height: 100vh;
  90. } */
  91. .not-highlight{
  92. color:#000;
  93. }
  94. .highlight{
  95. color:#FF673D;
  96. }
  97. .btnContain{
  98. position: relative;
  99. width: 100%;
  100. display: flex;
  101. height: 20%;
  102. background-color: #fff;
  103. justify-content: space-between;
  104. }
  105. .btnContain::after{
  106. content: '';
  107. position: absolute;
  108. width: 4rpx;
  109. height: 40%;
  110. left: 50%;
  111. top: 30%;
  112. z-index: 10;
  113. margin: auto;
  114. background-color: #E1E1E1;
  115. }
  116. button {
  117. width: 30%;
  118. border: none;
  119. background-color: #fff;
  120. }
  121. button:after{
  122. border: none;
  123. }
  124. .selected {
  125. background-color: #007bff;
  126. color: #fff;
  127. }
  128. .grid-item-box {
  129. flex: 1;
  130. // position: relative;
  131. /* #ifndef APP-NVUE */
  132. display: flex;
  133. /* #endif */
  134. flex-direction: column;
  135. align-items: center;
  136. justify-content: center;
  137. padding: 15px 0;
  138. }
  139. .grid-item-box-row {
  140. flex: 1;
  141. // position: relative;
  142. /* #ifndef APP-NVUE */
  143. display: flex;
  144. /* #endif */
  145. flex-direction: row;
  146. align-items: center;
  147. justify-content: center;
  148. padding: 15px 0;
  149. }
  150. </style>