waitWork.vue 4.6 KB

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