checkItemSelect.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" :title="title"></page-nav>
  4. <view class="container">
  5. <uni-list>
  6. <uni-list-item v-for="(item, index) in dictList" :key="index">
  7. <template v-slot:body>
  8. <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
  9. <view @click="selectItem(item)">
  10. <text>{{item.dictValue}}</text>
  11. </view>
  12. </template>
  13. </uni-list-item>
  14. </uni-list>
  15. </view>
  16. <!-- <view class="list-wrap">
  17. <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="item.groupName" v-for="(item, index) in dictList"
  18. :key="index">
  19. <u-cell-item :titleStyle="{fontWeight: 500}" @click="selectItem(item1)" :title="item1.dictValue"
  20. v-for="(item1, index1) in item.list" :key="index1">
  21. <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
  22. </u-cell-item>
  23. </u-cell-group>
  24. </view> -->
  25. <u-gap height="70"></u-gap>
  26. </view>
  27. </template>
  28. <script>
  29. import pageNav from '@/components/page-nav/page-nav.vue';
  30. import http from '@/http/api.js'
  31. export default {
  32. components: {
  33. pageNav
  34. },
  35. onLoad(option) {
  36. //let dictList = {};
  37. // dictList['groupName'] = '列表信息';
  38. var list = [];
  39. http.request({
  40. //url: '/galaxy-system/dict-biz/child-list?parentId='+dictId,
  41. url: '/galaxy-system/dict-biz/list?parentId=1511974496622145537',
  42. method: 'GET'
  43. }).then(res => {
  44. console.log(res.data)
  45. if (res.data != null) {
  46. const dictLength = res.data['length'];
  47. for (var i = 0; i < dictLength; i++) {
  48. let dict = res.data['' + i];
  49. list.push(dict);
  50. }
  51. }
  52. }).catch(err => {
  53. console.log(err)
  54. })
  55. // dictList['list'] = list;
  56. this.dictList = list;
  57. },
  58. data() {
  59. return {
  60. dictList: [],
  61. title: '选择安全问题隐患类型',
  62. desc: ''
  63. }
  64. },
  65. computed: {
  66. getIcon() {
  67. return path => {
  68. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  69. }
  70. },
  71. },
  72. onShow() {
  73. uni.setNavigationBarTitle({
  74. title: ""
  75. });
  76. },
  77. created() {
  78. },
  79. methods: {
  80. selectItem(dict) {
  81. uni.$emit("handClickItemSelect", {
  82. id: dict['id'],
  83. dictKey: dict['dictKey'],
  84. dictValue: dict['dictValue']
  85. });
  86. uni.navigateBack();
  87. },
  88. }
  89. }
  90. </script>
  91. <style>
  92. /* page {
  93. background-color: rgb(240, 242, 244);
  94. } */
  95. </style>
  96. <style lang="scss" scoped>
  97. .u-cell-icon {
  98. width: 36rpx;
  99. height: 36rpx;
  100. margin-right: 8rpx;
  101. }
  102. .slot-box {
  103. /* #ifndef APP-NVUE */
  104. display: flex;
  105. /* #endif */
  106. flex-direction: row;
  107. align-items: center;
  108. }
  109. .slot-image {
  110. /* #ifndef APP-NVUE */
  111. display: block;
  112. /* #endif */
  113. margin-right: 10px;
  114. width: 30px;
  115. height: 30px;
  116. }
  117. .slot-text {
  118. flex: 1;
  119. font-size: 14px;
  120. color: #4cd964;
  121. margin-right: 10px;
  122. }
  123. </style>