DisposeRubbishListDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="u-content">
  3. <section style="margin-top: 1.5em; overflow-x: auto;">
  4. <table style="min-width: 400px;" cellspacing="0" cellpadding="5">
  5. <thead>
  6. <tr>
  7. <th colspan="4" style="text-align: center; font-size: 20px; font-weight: bold;">
  8. 清运列表
  9. </th>
  10. </tr>
  11. <tr>
  12. <th v-for="(header, index) in tableHeaders" :key="index">{{ header }}</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <tr v-for="(row, rowIndex) in tableData" :key="rowIndex" :style="rowIndex % 2 === 1 ? 'background-color: #f6f8fa;' : ''">
  17. <td
  18. v-for="(cell, cellIndex) in row"
  19. :key="cellIndex"
  20. align="center"
  21. :style="cellIndex === 1 ? '' : ''"
  22. >
  23. <!-- 根据 cellIndex 来判断显示内容 -->
  24. <template v-if="cellIndex === 0">
  25. <a href="#" @click.prevent="handleLinkClick(cell)">{{ cell }}</a>
  26. </template>
  27. <template v-else>
  28. {{ cell }}
  29. </template>
  30. </td>
  31. </tr>
  32. </tbody>
  33. </table>
  34. </section>
  35. </view>
  36. </template>
  37. <script>
  38. import disposeRubbishService from '@/api/garbageClearance/disposeRubbishService'
  39. import taskService from "@/api/flowable/taskService"
  40. import pick from "lodash.pick";
  41. export default {
  42. data() {
  43. return {
  44. id:'',
  45. yearMonth:'',
  46. // 表格的头部
  47. tableHeaders: ["清运编号", "完成状态", "完成时间", "处理方式"],
  48. // 表格的数据,二维数组表示每一行
  49. tableData: []
  50. };
  51. },
  52. onLoad(val) {
  53. this.id = val.id;
  54. this.yearMonth = val.yearMonth;
  55. this.load();
  56. },
  57. methods: {
  58. load() {
  59. // 根据所属村落id将所有清运数据进行统计展示
  60. disposeRubbishService.getDetailCollectByOfficeIdAndMonth(this.id,this.yearMonth).then((data) => {
  61. this.tableData = data.map(item => [
  62. item.no,
  63. item.status,
  64. item.auditPassDateStr,
  65. item.disposeType
  66. ]);
  67. }).catch(error => {
  68. console.error('数据加载失败:', error);
  69. });
  70. },
  71. async handleLinkClick(cell) {
  72. try {
  73. // 先根据编号查询具体信息
  74. const dispose = await disposeRubbishService.getByNo(cell);
  75. // 获取流程名称
  76. let rowName = await taskService.getProcessNameByInstanceId(dispose.procInsId);
  77. if (dispose.status === '5') {
  78. // 如果流程状态为 '5',获取历史流程定义ID
  79. const row = await taskService.getHistoryProcessDefinitionIdByInstanceId(dispose.procInsId);
  80. const data = await taskService.getTaskDef({
  81. taskDefKey: row.taskDefinitionKey,
  82. procInsId: dispose.procInsId,
  83. procDefId: row.processDefinitionId
  84. });
  85. // 构建导航所需的查询参数
  86. let query = {
  87. readOnly: true,
  88. taskId: row.executionId,
  89. title: `${rowName}【${rowName}】`,
  90. formTitle: `${rowName}`,
  91. ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
  92. };
  93. // 执行导航
  94. uni.navigateTo({
  95. url: '/pages/workbench/task/TaskFormDetail?flow=' + JSON.stringify(query)
  96. });
  97. } else {
  98. // 如果流程状态不是 '5',获取当前的流程定义ID
  99. const row = await taskService.getProcessDefinitionIdByInstanceId(dispose.procInsId);
  100. const data = await taskService.getTaskDef({
  101. taskDefKey: row.taskDefinitionKey,
  102. procInsId: row.processInstanceId,
  103. procDefId: row.processDefinitionId
  104. });
  105. // 构建导航所需的查询参数
  106. let query = {
  107. readOnly: true,
  108. taskId: row.executionId,
  109. title: `${rowName}【${rowName}】`,
  110. formTitle: `${rowName}`,
  111. ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')
  112. };
  113. // 执行导航
  114. uni.navigateTo({
  115. url: '/pages/workbench/task/TaskFormDetail?flow=' + JSON.stringify(query)
  116. });
  117. }
  118. } catch (error) {
  119. console.error('数据加载失败:', error);
  120. }
  121. }
  122. }
  123. };
  124. </script>
  125. <style lang="scss">
  126. .u-content {
  127. padding: 24rpx;
  128. font-size: 32rpx;
  129. color: #333;
  130. line-height: 1.6;
  131. }
  132. table {
  133. box-sizing: border-box;
  134. border-top: 1px solid #dfe2e5;
  135. border-left: 1px solid #dfe2e5;
  136. }
  137. th {
  138. border-right: 1px solid #dfe2e5;
  139. border-bottom: 1px solid #dfe2e5;
  140. }
  141. td {
  142. border-right: 1px solid #dfe2e5;
  143. border-bottom: 1px solid #dfe2e5;
  144. }
  145. a {
  146. color: rgb(41, 121, 255); /* 设置默认链接颜色 */
  147. text-decoration: none; /* 可选: 去掉下划线 */
  148. font-size: 16px; /* 设置所有链接的字体大小 */
  149. }
  150. a:hover {
  151. color: rgb(41, 121, 255); /* 鼠标悬停时的颜色,与默认颜色一致 */
  152. }
  153. a:visited {
  154. color: rgb(41, 121, 255); /* 已访问链接的颜色,与默认颜色一致 */
  155. }
  156. a:active {
  157. color: rgb(41, 121, 255); /* 点击链接时的颜色,与默认颜色一致 */
  158. }
  159. </style>