waitWork.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="container">
  3. <!-- 待办任务与流程统计 -->
  4. <view class="stats-container">
  5. <view class="stat-item" @click="goToTodos">
  6. <text class="ygoa-icon icon-waitWork2" style="font-size: 120rpx;"></text>
  7. <text class="stat-label">
  8. 待办任务
  9. <text class="stat-value">{{ todoCount }}</text>
  10. </text>
  11. </view>
  12. <view class="divider"></view>
  13. <view class="stat-item" @click="goToProcesses">
  14. <text class="ygoa-icon icon-waitProcess" style="font-size: 120rpx;"></text>
  15. <text class="stat-label">
  16. 发布流程
  17. <text class="stat-value">{{ processCount }}</text>
  18. </text>
  19. </view>
  20. </view>
  21. <!-- 待办任务列表 -->
  22. <view class="tasks-section">
  23. <view class="section-header">
  24. <text class="section-title">任务列表</text>
  25. </view>
  26. <scroll-view class="task-list" scroll-y>
  27. <view class="task-item" v-for="(todo, index) in todos" :key="index" @click="showTaskDetail(todo)">
  28. <view>
  29. <text class="ygoa-icon icon-waitWork2"></text>
  30. <text class="task-content">{{ todo.content }}</text>
  31. </view>
  32. <text class="task-detail-icon">›</text>
  33. </view>
  34. </scroll-view>
  35. </view>
  36. <!-- 流程列表 -->
  37. <view class="processes-section">
  38. <view class="section-header">
  39. <text class="section-title">流程列表</text>
  40. </view>
  41. <scroll-view class="process-list" scroll-y>
  42. <view class="process-item" v-for="(process, index) in processes" :key="index"
  43. @click="showProcessDetail(process)">
  44. <view>
  45. <text class="ygoa-icon icon-waitProcess"></text>
  46. <text class="process-content">{{ process.content }}</text>
  47. </view>
  48. <text class="process-detail-icon">›</text>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </view>
  53. </template>
  54. <script setup>
  55. import {
  56. ref,
  57. computed,
  58. reactive,
  59. } from 'vue';
  60. import $tabs from "@/plugins/tab.js"
  61. // 定义待办任务数据
  62. const todos = reactive([{
  63. id: 1,
  64. content: '完成报告1',
  65. detail: '完成11月5日的今日报告'
  66. },
  67. {
  68. id: 2,
  69. content: '参加会议2',
  70. detail: '参加11月5日下午5点的会议'
  71. },
  72. {
  73. id: 3,
  74. content: '完成报告3',
  75. detail: '完成11月5日的今日报告'
  76. },
  77. {
  78. id: 4,
  79. content: '参加会议4',
  80. detail: '参加11月5日下午5点的会议'
  81. },
  82. ]);
  83. // 定义流程数据
  84. const processes = reactive([{
  85. id: 1,
  86. content: '审批流程',
  87. detail: '来自张三的请假申请'
  88. },
  89. {
  90. id: 2,
  91. content: '财务流程',
  92. detail: '来自张三的报销申请'
  93. },
  94. ]);
  95. // 计算待办任务数量
  96. const todoCount = computed(() => todos.length);
  97. // 计算流程数量
  98. const processCount = computed(() => processes.length);
  99. // 显示待办任务详情
  100. function showTaskDetail(todo) {
  101. uni.showModal({
  102. title: '任务详情',
  103. content: todo.detail,
  104. cancelText: '完成',
  105. success: function (res) {
  106. if (res.confirm) {
  107. console.log('用户点击确定');
  108. } else if (res.cancel) {
  109. console.log('用户点击完成', todo);
  110. // 找到要移除的对象的索引
  111. let index = todos.findIndex(item => item.id === todo.id);
  112. // 如果找到了,使用splice移除它
  113. if (index > -1) {
  114. todos.splice(index, 1);
  115. }
  116. }
  117. }
  118. });
  119. }
  120. // 显示流程详情
  121. function showProcessDetail(process) {
  122. uni.showModal({
  123. title: '流程详情',
  124. content: process.detail,
  125. showCancel: false
  126. });
  127. }
  128. function goToTodos() {
  129. // 跳转到待办任务列表详情页面
  130. $tabs.switchTab('/pages/process/index');
  131. }
  132. function goToProcesses() {
  133. // 跳转到流程申请详情页面
  134. $tabs.switchTab('/pages/work/index');
  135. }
  136. </script>
  137. <style scoped>
  138. @import "@/static/font/ygoa/iconfont.css";
  139. .ygoa-icon{
  140. font-size: 30rpx;
  141. margin-right: 30rpx;
  142. }
  143. .container {
  144. display: flex;
  145. flex-direction: column;
  146. align-items: center;
  147. background-color: #f5f5f5;
  148. height: 100%;
  149. }
  150. .stats-container {
  151. display: flex;
  152. justify-content: space-around;
  153. width: 100%;
  154. margin-top: 20px;
  155. background-color: white;
  156. border-radius: 10px;
  157. padding: 10px 0;
  158. }
  159. .stat-item {
  160. display: flex;
  161. flex-direction: column;
  162. align-items: center;
  163. width: 50%;
  164. }
  165. .stat-value {
  166. font-size: 24px;
  167. font-weight: bold;
  168. color: #333;
  169. }
  170. .stat-label {
  171. font-size: 16px;
  172. color: #666;
  173. }
  174. .divider {
  175. width: 1px;
  176. height: 40px;
  177. background-color: #e5e5e5;
  178. }
  179. .tasks-section,
  180. .processes-section {
  181. width: 100%;
  182. margin-top: 20px;
  183. }
  184. .section-header {
  185. padding: 10px;
  186. background-color: #f8f8f8;
  187. border-bottom: 1px solid #e5e5e5;
  188. }
  189. .section-title {
  190. font-size: 20px;
  191. font-weight: bold;
  192. }
  193. .task-list,
  194. .process-list {
  195. height: 200px;
  196. background-color: white;
  197. }
  198. .task-item,
  199. .process-item {
  200. display: flex;
  201. justify-content: space-between;
  202. align-items: center;
  203. padding: 15px;
  204. }
  205. </style>