snapshotManage.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!-- pages/snapshot/snapshotManage.vue -->
  2. <template>
  3. <view class="mainBox">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="随手拍管理" @clickLeft="back" />
  5. <view class="top-wrapper">
  6. <uni-forms :modelValue="where" label-width="100px" class="search-form">
  7. <uni-forms-item label="处理结果">
  8. <uni-data-select v-model="where.handleResult" :localdata="resultOptions" placeholder="全部"
  9. clearable />
  10. </uni-forms-item>
  11. </uni-forms>
  12. <button class="search_btn" @click="handleSearch">搜索</button>
  13. </view>
  14. <view class="wrapper">
  15. <u-list @scrolltolower="scrolltolower" class="listContent">
  16. <view v-for="(item, idx) in tableList" :key="item.id" style="position: relative">
  17. <myCard :item="item" :index="idx + 1" :btnList="manageBtnList" :columns="columns"
  18. :title="item.description" :status="statusMap[item.handleResult]" @goDetail="goDetail"
  19. @handleProcess="handleProcess" />
  20. </view>
  21. <view style="width: 100%; height: 40rpx"></view>
  22. <view style="margin-top: 20vh" v-if="tableList.length == 0">
  23. <u-empty iconSize="150" textSize="32" text="暂无数据" />
  24. </view>
  25. </u-list>
  26. </view>
  27. <snapshot-dialog ref="snapshotDialog" @rectify="onRectify" @discard="onDiscard" />
  28. <discard-dialog ref="discardDialogRef" @confirm="doDiscard" />
  29. <!-- <hazardDialog ref="hazardDialogRef" @reload="doRectify" /> -->
  30. </view>
  31. </template>
  32. <script>
  33. import myCard from "@/components/myCard.vue";
  34. import snapshotDialog from './components/snapshotDialog.vue';
  35. import discardDialog from './components/discardDialog.vue';
  36. // import hazardDialog from '@/views/hazardManagement/hazardDialog.vue';
  37. import {
  38. getList,
  39. discard,
  40. handle
  41. } from '@/api/snapshot/index.js';
  42. export default {
  43. components: {
  44. myCard,
  45. snapshotDialog,
  46. discardDialog,
  47. // hazardDialog
  48. },
  49. data() {
  50. return {
  51. where: {
  52. reporterName: '',
  53. handleResult: '',
  54. createTime: ''
  55. },
  56. resultOptions: [{
  57. value: 0,
  58. text: '待处理'
  59. },
  60. {
  61. value: 1,
  62. text: '下发整改'
  63. },
  64. {
  65. value: 2,
  66. text: '废弃'
  67. }
  68. ],
  69. statusMap: {
  70. 0: '待处理',
  71. 1: '已整改',
  72. 2: '已废弃'
  73. },
  74. columns: [
  75. [{
  76. prop: 'location',
  77. label: '位置',
  78. className: 'perce100'
  79. }],
  80. [{
  81. prop: 'problemDeptName',
  82. label: '所属部门',
  83. className: 'perce100'
  84. }],
  85. [{
  86. prop: 'reporterName',
  87. label: '上报人',
  88. className: 'perce100'
  89. }],
  90. [{
  91. prop: 'createTime',
  92. label: '上报时间',
  93. className: 'perce100'
  94. }],
  95. [{
  96. prop: 'handleResult',
  97. label: '处理结果',
  98. className: 'perce100',
  99. formatter: (row) => this.statusMap[row.handleResult]
  100. }]
  101. ],
  102. tableList: [],
  103. page: 1,
  104. size: 10,
  105. isEnd: false,
  106. currentId: null
  107. };
  108. },
  109. computed: {
  110. manageBtnList() {
  111. return [{
  112. name: '处理',
  113. apiName: 'handleProcess',
  114. btnType: 'primary',
  115. judge: [{
  116. fn: (item) => item.handleResult === 0
  117. }]
  118. }];
  119. }
  120. },
  121. onLoad() {
  122. this.getList();
  123. },
  124. methods: {
  125. back() {
  126. uni.navigateBack();
  127. },
  128. goDetail(item, type) {
  129. this.$refs.snapshotDialog.open(type, item);
  130. },
  131. handleProcess(row) {
  132. this.$refs.snapshotDialog.open('handle', row);
  133. },
  134. onRectify(data) {
  135. this.currentId = data.id;
  136. this.$refs.hazardDialogRef.open('add', '', 'report', {
  137. sourceType: 4,
  138. sourceId: data.id,
  139. sourceName: '随手拍',
  140. foundUserName: data.reporterName,
  141. foundUserId: data.reporterId,
  142. foundTime: data.createTime,
  143. description: data.location + data.description,
  144. reportAttachments: data.attachment
  145. });
  146. },
  147. doRectify(opinion) {
  148. handle({
  149. id: this.currentId,
  150. handleOpinion: opinion,
  151. invHazardId: '下发整改'
  152. }).then(() => {
  153. uni.showToast({
  154. title: '下发整改成功',
  155. icon: 'success'
  156. });
  157. this.reloadList();
  158. });
  159. },
  160. onDiscard(data) {
  161. this.$refs.discardDialogRef.open(data);
  162. },
  163. doDiscard({
  164. id,
  165. handleOpinion
  166. }) {
  167. discard({
  168. id,
  169. handleOpinion
  170. }).then(() => {
  171. uni.showToast({
  172. title: '废弃成功',
  173. icon: 'success'
  174. });
  175. this.reloadList();
  176. });
  177. },
  178. reloadList() {
  179. this.page = 1;
  180. this.isEnd = false;
  181. this.getList();
  182. },
  183. handleSearch() {
  184. this.page = 1;
  185. this.isEnd = false;
  186. this.getList();
  187. },
  188. async getList() {
  189. if (this.isEnd) return;
  190. uni.showLoading({
  191. title: '加载中'
  192. });
  193. try {
  194. const data = {
  195. pageNum: this.page,
  196. size: this.size,
  197. reporterName: this.where.reporterName || undefined,
  198. handleResult: this.where.handleResult !== '' ? this.where.handleResult : undefined,
  199. createTime: this.where.createTime || undefined
  200. };
  201. const res = await getList(data);
  202. const newList = res.rows || [];
  203. if (this.page === 1) this.tableList = newList;
  204. else this.tableList.push(...newList);
  205. this.isEnd = newList.length < this.size;
  206. this.page += 1;
  207. } catch (e) {
  208. console.error(e);
  209. } finally {
  210. uni.hideLoading();
  211. }
  212. },
  213. scrolltolower() {
  214. if (!this.isEnd) this.getList();
  215. }
  216. }
  217. };
  218. </script>
  219. <style lang="scss" scoped>
  220. @import './common-style.scss';
  221. </style>