checkItemLabelSelect.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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"
  18. v-for="(item, index) in dictList" :key="index">
  19. <u-cell-item :titleStyle="{fontWeight: 500}" @click="selectItem(item1)"
  20. :title="item1.dictValue" 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 dictId = option.id;
  37. // let dictList = {};
  38. // dictList['groupName'] = '列表信息';
  39. var list = [];
  40. http.request({
  41. url: '/galaxy-system/dict-biz/list?parentId=' + dictId,
  42. //url: '/galaxy-system/dict-biz/child-list?parentId=' + dictId,
  43. method: 'GET'
  44. }).then(res => {
  45. console.log(res.data)
  46. if (res.data != null) {
  47. const dictLength = res.data['length'];
  48. for (var i = 0; i < dictLength; i++) {
  49. let dict = res.data['' + i];
  50. list.push(dict);
  51. }
  52. }
  53. }).catch(err => {
  54. console.log(err)
  55. })
  56. // dictList['list'] = list;
  57. this.dictList = list;
  58. },
  59. data() {
  60. return {
  61. dictList: [],
  62. title: '选择检查部位',
  63. desc: ''
  64. }
  65. },
  66. computed: {
  67. getIcon() {
  68. return path => {
  69. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  70. }
  71. },
  72. },
  73. onShow() {
  74. uni.setNavigationBarTitle({
  75. title: ""
  76. });
  77. },
  78. created() {
  79. },
  80. methods: {
  81. selectItem(dict) {
  82. uni.$emit("handClickItemLabelSelect", {
  83. id: dict['id'],
  84. dictKey: dict['dictKey'],
  85. dictValue: dict['dictValue']
  86. });
  87. uni.navigateBack();
  88. },
  89. }
  90. }
  91. </script>
  92. <style>
  93. /* page {
  94. background-color: rgb(240, 242, 244);
  95. } */
  96. </style>
  97. <style lang="scss" scoped>
  98. .u-cell-icon {
  99. width: 36rpx;
  100. height: 36rpx;
  101. margin-right: 8rpx;
  102. }
  103. .slot-box {
  104. /* #ifndef APP-NVUE */
  105. display: flex;
  106. /* #endif */
  107. flex-direction: row;
  108. align-items: center;
  109. }
  110. .slot-image {
  111. /* #ifndef APP-NVUE */
  112. display: block;
  113. /* #endif */
  114. margin-right: 10px;
  115. width: 30px;
  116. height: 30px;
  117. }
  118. .slot-text {
  119. flex: 1;
  120. font-size: 14px;
  121. color: #4cd964;
  122. margin-right: 10px;
  123. }
  124. </style>