checkProjectSelect.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 @click="openPage(item)" :clickable="true" :showArrow="isNext" :title="getFieldTitle(item)"
  7. v-for="(item, index) in projectList" :key="index" :thumb="getIcon('cell')" thumb-size="sm">
  8. <!-- <template v-slot:body>
  9. <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
  10. <view @click="openPage(item)">
  11. <text>{{getFieldTitle(item)}}</text>
  12. </view>
  13. </template>
  14. <template v-slot:footer>
  15. <uni-icons type="right" size="20" style="color: #969799;"></uni-icons>
  16. </template> -->
  17. </uni-list-item>
  18. </uni-list>
  19. </view>
  20. <!-- <view class="list-wrap">
  21. <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="getGroupTitle(item)"
  22. v-for="(item, index) in projectList" :key="index">
  23. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1)" :title="getFieldTitle(item1)"
  24. v-for="(item1, index1) in item.list" :key="index1">
  25. <image slot="icon" class="u-cell-icon" :src="getIcon('cell')" mode="widthFix"></image>
  26. </u-cell-item>
  27. </u-cell-group>
  28. </view> -->
  29. <u-gap height="70"></u-gap>
  30. </view>
  31. </template>
  32. <script>
  33. import pageNav from '@/components/page-nav/page-nav.vue';
  34. import http from '@/http/api.js'
  35. export default {
  36. components: {
  37. pageNav
  38. },
  39. onLoad(option) {
  40. const current = 1;
  41. const size = 1000;
  42. // let projectList = {};
  43. // projectList['groupName'] = '项目列表';
  44. var list = [];
  45. http.request({
  46. url: '/blade-business/report/projectInfo/listByUserId',
  47. method: 'GET',
  48. params: {
  49. current,
  50. size
  51. }
  52. }).then(res => {
  53. console.log(res.data)
  54. if (res.data != null && res.data.length > 0) {
  55. for (let i in res.data) {
  56. var projectInfo = {
  57. id: res.data[i].id,
  58. title: '' + res.data[i].projectName
  59. };
  60. list.push(projectInfo);
  61. }
  62. }
  63. }).catch(err => {
  64. console.log(err)
  65. })
  66. //projectList['list'] = list;
  67. this.projectList = list;
  68. this.model = option.model;
  69. if (this.model == '0') {
  70. this.isNext = true;
  71. } else {
  72. this.isNext = false;
  73. }
  74. console.log(option.model)
  75. },
  76. data() {
  77. return {
  78. projectList: [],
  79. title: '选择项目',
  80. desc: '',
  81. model: '0',
  82. isNext: true,
  83. }
  84. },
  85. computed: {
  86. getIcon() {
  87. return path => {
  88. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  89. }
  90. },
  91. },
  92. onShow() {
  93. uni.setNavigationBarTitle({
  94. title: "选择项目"
  95. });
  96. },
  97. created() {
  98. },
  99. methods: {
  100. openPage(item) {
  101. if (this.model == '0') {
  102. uni.navigateTo({
  103. url: '/pages/checkReport/addCheckReport' + '?id=' + item.id
  104. })
  105. } else {
  106. uni.$emit("handClickProjectSelect", {
  107. projectId: item.id,
  108. title: item.title
  109. });
  110. uni.navigateBack();
  111. }
  112. },
  113. getGroupTitle(item) {
  114. return item.groupName
  115. },
  116. getFieldTitle(item) {
  117. return item.title
  118. }
  119. }
  120. }
  121. </script>
  122. <style>
  123. /* page {
  124. background-color: rgb(240, 242, 244);
  125. } */
  126. </style>
  127. <style lang="scss" scoped>
  128. .u-cell-icon {
  129. width: 36rpx;
  130. height: 36rpx;
  131. margin-right: 8rpx;
  132. }
  133. .slot-box {
  134. /* #ifndef APP-NVUE */
  135. display: flex;
  136. /* #endif */
  137. flex-direction: row;
  138. align-items: center;
  139. }
  140. .slot-image {
  141. /* #ifndef APP-NVUE */
  142. display: block;
  143. /* #endif */
  144. margin-right: 10px;
  145. width: 30px;
  146. height: 30px;
  147. }
  148. .slot-text {
  149. flex: 1;
  150. font-size: 14px;
  151. color: #4cd964;
  152. margin-right: 10px;
  153. }
  154. </style>