topic.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <view style="height: 20%;">
  4. <button v-for="(item,index) in userType" @click="onclick(item)">{{item.dictLabel}}
  5. </button>
  6. </view>
  7. <view>
  8. <uni-grid :column="2" :square="false" :highlight="false" >
  9. <uni-grid-item v-for="(item, index) in dataList" :index="index" :key="index" >
  10. <view class="grid-item-box" @click="onMatters(item)">
  11. <text class="text" >{{ item.deptName }}</text>
  12. </view>
  13. </uni-grid-item>
  14. </uni-grid>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import {
  20. getDicts
  21. } from "@/api/system/dict/data.js"
  22. import {
  23. listAll
  24. } from "@/api/handleAffairs/topicType.js"
  25. export default {
  26. data() {
  27. return {
  28. userType: [], // 初始化用户类型为空
  29. dataList: [],
  30. }
  31. },
  32. created() {
  33. this.getdictData()//初始化字典按钮
  34. this.getdataList()//初始化数据
  35. },
  36. methods: {
  37. onMatters(data){
  38. uni.setStorageSync('data', {type:data.deptName})
  39. uni.navigateTo({
  40. url: '/pages/matterAll/matterAll',
  41. });
  42. },
  43. getdataList(data){
  44. let _that = this
  45. if (!data) {
  46. data = {
  47. objectOfHandling: 0,
  48. yesOrNoShow: "0"
  49. }
  50. }
  51. listAll(data).then(res => {
  52. _that.dataList = res.data
  53. })
  54. console.log(_that.dataList)
  55. },
  56. onclick(row) {
  57. let data = {
  58. objectOfHandling: row.dictValue,
  59. yesOrNoShow: "0"
  60. }
  61. this.getdataList(data)
  62. },
  63. getdictData() {
  64. let _that = this
  65. getDicts("object_application").then(res => {
  66. _that.userType = res.data
  67. })
  68. },
  69. changeUserType(type) {
  70. this.userType = type
  71. }
  72. },
  73. }
  74. </script>
  75. <style>
  76. /* view {
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. justify-content: center;
  81. height: 100vh;
  82. } */
  83. button {
  84. margin-bottom: 10px;
  85. }
  86. .selected {
  87. background-color: #007bff;
  88. color: #fff;
  89. }
  90. .grid-item-box {
  91. flex: 1;
  92. // position: relative;
  93. /* #ifndef APP-NVUE */
  94. display: flex;
  95. /* #endif */
  96. flex-direction: column;
  97. align-items: center;
  98. justify-content: center;
  99. padding: 15px 0;
  100. }
  101. .grid-item-box-row {
  102. flex: 1;
  103. // position: relative;
  104. /* #ifndef APP-NVUE */
  105. display: flex;
  106. /* #endif */
  107. flex-direction: row;
  108. align-items: center;
  109. justify-content: center;
  110. padding: 15px 0;
  111. }
  112. </style>