topic.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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">
  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. getdataList(data){
  38. let _that = this
  39. if (!data) {
  40. data = {
  41. objectOfHandling: 0,
  42. yesOrNoShow: "0"
  43. }
  44. }
  45. listAll(data).then(res => {
  46. _that.dataList = res.data
  47. })
  48. console.log(_that.dataList)
  49. },
  50. onclick(row) {
  51. let data = {
  52. objectOfHandling: row.dictValue,
  53. yesOrNoShow: "0"
  54. }
  55. this.getdataList(data)
  56. },
  57. getdictData() {
  58. let _that = this
  59. getDicts("object_application").then(res => {
  60. _that.userType = res.data
  61. })
  62. },
  63. changeUserType(type) {
  64. this.userType = type
  65. }
  66. },
  67. }
  68. </script>
  69. <style>
  70. /* view {
  71. display: flex;
  72. flex-direction: column;
  73. align-items: center;
  74. justify-content: center;
  75. height: 100vh;
  76. } */
  77. button {
  78. margin-bottom: 10px;
  79. }
  80. .selected {
  81. background-color: #007bff;
  82. color: #fff;
  83. }
  84. .grid-item-box {
  85. flex: 1;
  86. // position: relative;
  87. /* #ifndef APP-NVUE */
  88. display: flex;
  89. /* #endif */
  90. flex-direction: column;
  91. align-items: center;
  92. justify-content: center;
  93. padding: 15px 0;
  94. }
  95. .grid-item-box-row {
  96. flex: 1;
  97. // position: relative;
  98. /* #ifndef APP-NVUE */
  99. display: flex;
  100. /* #endif */
  101. flex-direction: row;
  102. align-items: center;
  103. justify-content: center;
  104. padding: 15px 0;
  105. }
  106. </style>