checkAreaSelect.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 dictList" :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/list?parentId=1513484347324018689',
  41. //url: '/galaxy-system/dict-biz/child-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. console.log("d " + dict.toString());
  50. list.push(dict);
  51. // "dictKey": "rqaq",
  52. // "dictValue": "燃气安全",
  53. // "hasChildren": false,
  54. // "id": "1511918319641100290",
  55. // "parentId": "1511974496622145537",
  56. }
  57. }
  58. }).catch(err => {
  59. console.log(err)
  60. })
  61. //dictList['list'] = list;
  62. this.dictList = list;
  63. },
  64. data() {
  65. return {
  66. dictList: [],
  67. title: '选择检查区域',
  68. desc: '',
  69. }
  70. },
  71. computed: {
  72. getIcon() {
  73. return path => {
  74. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  75. }
  76. },
  77. },
  78. onShow() {
  79. uni.setNavigationBarTitle({
  80. title: ""
  81. });
  82. },
  83. created() {
  84. },
  85. methods: {
  86. selectItem(dict) {
  87. uni.$emit("handClickAreaSelect", {
  88. id: dict['id'],
  89. dictKey: dict['dictKey'],
  90. dictValue: dict['dictValue']
  91. });
  92. uni.navigateBack();
  93. },
  94. }
  95. }
  96. </script>
  97. <style>
  98. /* page {
  99. background-color: rgb(240, 242, 244);
  100. } */
  101. </style>
  102. <style lang="scss" scoped>
  103. .u-cell-icon {
  104. width: 36rpx;
  105. height: 36rpx;
  106. margin-right: 8rpx;
  107. }
  108. .slot-box {
  109. /* #ifndef APP-NVUE */
  110. display: flex;
  111. /* #endif */
  112. flex-direction: row;
  113. align-items: center;
  114. }
  115. .slot-image {
  116. /* #ifndef APP-NVUE */
  117. display: block;
  118. /* #endif */
  119. margin-right: 10px;
  120. width: 30px;
  121. height: 30px;
  122. }
  123. .slot-text {
  124. flex: 1;
  125. font-size: 14px;
  126. color: #4cd964;
  127. margin-right: 10px;
  128. }
  129. </style>