checkReportListCache.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 list" :key="index">
  7. <!-- 自定义 body -->
  8. <template v-slot:body>
  9. <view style="height: 200px;width: 100%;display: flex;flex-direction: column;">
  10. <view style="display: flex;flex-direction: row;width: 100%;justify-content: flex-start;">
  11. <view style="font-size: 18px;font-weight: bold;width: 88%;">问题编号:{{item.failureCheckNo}}
  12. </view>
  13. <view style="width: 10%;" @click="delRecord(item.failureCheckNo)">
  14. <uni-icons type="trash" size="30"></uni-icons>
  15. </view>
  16. </view>
  17. <view>
  18. <text
  19. style="margin-right: 10px;font-weight: bolder;">检查点位:</text><text>{{item.failureCheckPointDesc}}</text>
  20. </view>
  21. <view>
  22. <text style="margin-right: 10px;font-weight: bolder;">问题描述:</text>
  23. <view style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
  24. {{item.failureHiddenDangerDesc}}
  25. </view>
  26. </view>
  27. <view style="display: flex;flex-direction: row;min-height: 30px;">
  28. <view style="width: 200px;">{{item.createTime}}</view>
  29. <view style="color: #18B566;">{{item.createUserName}}</view>
  30. </view>
  31. <view style="margin-top: 5px;padding-left: 0px;padding-right: 0px;">
  32. <button type="default" @click="openPage(item.failureCheckNo)">编辑</button>
  33. </view>
  34. </view>
  35. </template>
  36. </uni-list-item>
  37. </uni-list>
  38. </view>
  39. <!-- <view class="list-wrap">
  40. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item.failureCheckNo)"
  41. :title="item.failureCheckNo" v-for="(item, index) in list" :key="index">
  42. </u-cell-item>
  43. </view> -->
  44. <u-gap height="70"></u-gap>
  45. </view>
  46. </template>
  47. <script>
  48. import pageNav from '@/components/page-nav/page-nav.vue';
  49. import http from '@/http/api.js';
  50. export default {
  51. components: {
  52. pageNav
  53. },
  54. onLoad(option) {
  55. var reportList = [];
  56. var list = uni.getStorageSync('check_report_storage_index');
  57. if (list != null && list.length > 0) {
  58. list.forEach(itemKey => {
  59. var data = uni.getStorageSync('check_report_storage_' + itemKey);
  60. if (data != null) {
  61. reportList.push(data);
  62. }
  63. });
  64. }
  65. this.list = reportList;
  66. },
  67. data() {
  68. return {
  69. list: [],
  70. title: '缓存问题列表管理',
  71. desc: ''
  72. }
  73. },
  74. computed: {
  75. getIcon() {
  76. return path => {
  77. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  78. }
  79. },
  80. },
  81. onShow() {
  82. uni.setNavigationBarTitle({
  83. title: ""
  84. });
  85. var reportList = [];
  86. var list = uni.getStorageSync('check_report_storage_index');
  87. if (list != null && list.length > 0) {
  88. list.forEach(itemKey => {
  89. var data = uni.getStorageSync('check_report_storage_' + itemKey);
  90. if (data != null) {
  91. reportList.push(data);
  92. }
  93. });
  94. }
  95. this.list = reportList;
  96. },
  97. created() {
  98. },
  99. methods: {
  100. openPage(checkNo) {
  101. uni.navigateTo({
  102. url: '/pages/checkReport/editCacheCheckReport?checkNo=' + checkNo
  103. })
  104. },
  105. delRecord(checkNo) {
  106. const that = this;
  107. uni.showModal({
  108. content: '确定删除记录?',
  109. showCancel: true,
  110. success(res) {
  111. if (res.confirm) {
  112. var reportList = [];
  113. var reportIndexList = [];
  114. var list = uni.getStorageSync('check_report_storage_index');
  115. if (list != null && list.length > 0) {
  116. list.forEach(itemKey => {
  117. if (checkNo !== itemKey) {
  118. var data = uni.getStorageSync('check_report_storage_' + itemKey);
  119. if (data != null) {
  120. reportList.push(data);
  121. }
  122. reportIndexList.push(itemKey);
  123. } else {
  124. uni.removeStorageSync('check_report_storage_' + itemKey);
  125. uni.removeStorageSync('check_report_storage_image_' + itemKey);
  126. }
  127. });
  128. }
  129. uni.setStorageSync('check_report_storage_index', reportIndexList);
  130. that.list = reportList;
  131. }
  132. }
  133. });
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. /* page {
  140. background-color: rgb(240, 242, 244);
  141. } */
  142. </style>
  143. <style lang="scss" scoped>
  144. .u-cell-icon {
  145. width: 36rpx;
  146. height: 36rpx;
  147. margin-right: 8rpx;
  148. }
  149. .slot-box {
  150. /* #ifndef APP-NVUE */
  151. display: flex;
  152. /* #endif */
  153. flex-direction: row;
  154. align-items: center;
  155. }
  156. .slot-image {
  157. /* #ifndef APP-NVUE */
  158. display: block;
  159. /* #endif */
  160. margin-right: 10px;
  161. width: 30px;
  162. height: 30px;
  163. }
  164. .slot-text {
  165. flex: 1;
  166. font-size: 14px;
  167. color: #4cd964;
  168. margin-right: 10px;
  169. }
  170. </style>