综合办公系统
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.vue 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-02-19 15:36:34
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-03-20 15:27:00
  6. -->
  7. <template>
  8. <view class="page-container">
  9. <!-- 搜索框 -->
  10. <view class="search-box">
  11. <uni-search-bar radius="34" placeholder="请输入流程名称" @confirm="search" @input="inputChange"
  12. v-model="queryParams.procDefName" />
  13. </view>
  14. <!-- 流程列表 -->
  15. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :fixed="false" :top="10">
  16. <uni-list>
  17. <uni-list-item v-for="(item, index) in list" :key="index" clickable>
  18. <template v-slot:body>
  19. <view class="list-item">
  20. <!-- 状态与标题行 -->
  21. <view class="header-line">
  22. <uni-tag :text="item.finishTime ? '已完成' : '进行中'" :type="item.finishTime ? 'success' : 'warning'"
  23. size="small" class="status-tag" />
  24. <text class="proc-name">{{ item.procDefName }}</text>
  25. </view>
  26. <!-- 主要内容 -->
  27. <view class="content-box">
  28. <!-- 标题 -->
  29. <view class="title-box">
  30. <uni-icons type="info" size="16" color="#666" class="title-icon"></uni-icons>
  31. <text class="title-text">{{ item.title }}</text>
  32. </view>
  33. <!-- 信息分割线 -->
  34. <uv-divider :dashed="true" margin="10rpx 0"></uv-divider>
  35. <!-- 详细信息 -->
  36. <view class="detail-grid">
  37. <view class="detail-item">
  38. <uni-icons type="calendar" size="14" color="#999"></uni-icons>
  39. <text class="detail-text">{{ item.createTime }}</text>
  40. </view>
  41. <view class="detail-item">
  42. <uni-icons type="clock" size="14" color="#999"></uni-icons>
  43. <text class="detail-text">{{ item.duration }}</text>
  44. </view>
  45. <view class="detail-item">
  46. <uni-icons type="location" size="14" color="#999"></uni-icons>
  47. <text class="detail-text">{{ item.taskName }}</text>
  48. </view>
  49. <view class="detail-item">
  50. <uni-icons type="person" size="14" color="#999"></uni-icons>
  51. <text class="detail-text">{{ item.assigneeName || '暂无待办人' }}</text>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 操作按钮 -->
  56. <view class="action-box">
  57. <text class="view-detail">查看详情</text>
  58. <uni-icons type="more-filled" size="20" color="#666" @click="showAction(item)"
  59. class="action-icon"></uni-icons>
  60. </view>
  61. </view>
  62. </template>
  63. </uni-list-item>
  64. </uni-list>
  65. </mescroll-uni>
  66. <!-- 操作菜单 -->
  67. <uni-popup ref="actionPopup" type="bottom">
  68. <view class="action-menu">
  69. <view class="menu-item" @click="handleFlowRecord(selectedItem)">
  70. <text>办理进度</text>
  71. </view>
  72. <view class="menu-item" @click="handleFlowNote(selectedItem)">
  73. <text>表单信息</text>
  74. </view>
  75. <view class="menu-item danger" @click="handleDelete(selectedItem)"
  76. :class="{ disabled: !beDeleted(selectedItem) }">
  77. <text>取消流程</text>
  78. </view>
  79. </view>
  80. </uni-popup>
  81. <!-- 菜单抽屉 -->
  82. <uni-drawer ref="drawer" mode="right" :width="300">
  83. <flow-record :rows="selectedItem" v-if="active == 'record'"></flow-record>
  84. </uni-drawer>
  85. </view>
  86. </template>
  87. <script>
  88. import { debounce } from 'lodash-es';
  89. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  90. import { myProcessList, stopProcess } from "@/api/flowable/process";
  91. import FlowRecord from '../../components/flowable/FlowRecord.vue';
  92. export default {
  93. components: { FlowRecord },
  94. mixins: [MescrollMixin],
  95. data() {
  96. return {
  97. // 我发起的流程列表数据
  98. myProcessList: [],
  99. list: [], // 列表数据
  100. queryParams: {
  101. keyword: '',
  102. pageNum: 1,
  103. pageSize: 10
  104. },
  105. selectedItem: null, // 当前选中项
  106. debounceSearch: null, // 初始化防抖方法
  107. clickRow: {},
  108. active: 'record'
  109. }
  110. },
  111. created() {
  112. // 在生命周期中创建防抖方法
  113. this.debounceSearch = debounce(() => {
  114. this.search()
  115. }, 500)
  116. },
  117. methods: {
  118. // mescroll下拉刷新回调
  119. async downCallback() {
  120. this.queryParams.pageNum = 1
  121. const res = await this.loadData()
  122. this.list = res.data.list;
  123. this.mescroll.endSuccess(res.data.length)
  124. this.mescroll.endErr()
  125. },
  126. // mescroll上拉加载回调
  127. async upCallback(page) {
  128. this.queryParams.pageNum = page.num
  129. const res = await this.loadData()
  130. this.list = this.list.concat(res.data.list)
  131. this.mescroll.endSuccess(res.data.list.length, res.data.hasNextPage)
  132. },
  133. // 加载数据
  134. async loadData() {
  135. try {
  136. const res = await myProcessList(this.queryParams)
  137. return {
  138. data: {
  139. list: res.data.records,
  140. hasNextPage: res.hasNextPage
  141. }
  142. }
  143. } catch (e) {
  144. this.mescroll.endErr()
  145. return { data: { list: [], hasNextPage: false } }
  146. }
  147. },
  148. // 显示操作菜单
  149. showAction(item) {
  150. this.selectedItem = item
  151. this.$refs.actionPopup.open()
  152. },
  153. // 输入变化处理
  154. inputChange() {
  155. this.debounceSearch()
  156. },
  157. // 执行搜索
  158. search() {
  159. this.loadData()
  160. this.mescroll.resetUpScroll()
  161. },
  162. handleFlowRecord(row) {
  163. console.log(row);
  164. this.active = 'record';
  165. this.$refs.drawer.open();
  166. },
  167. handleFlowNote(row) { /* ... */ },
  168. handleDelete(row) { /* ... */ },
  169. beDeleted(row) { /* ... */ },
  170. },
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .list-item {
  175. padding: 24rpx;
  176. background: #fff;
  177. border-radius: 16rpx;
  178. margin: 16rpx 24rpx;
  179. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  180. width: 100%;
  181. }
  182. /* 头部状态行 */
  183. .header-line {
  184. display: flex;
  185. align-items: center;
  186. margin-bottom: 20rpx;
  187. }
  188. .proc-name {
  189. font-size: 30rpx;
  190. color: #333;
  191. font-weight: 500;
  192. margin-left: 16rpx;
  193. }
  194. .status-tag {
  195. transform: translateY(-2rpx);
  196. }
  197. /* 内容区域 */
  198. .content-box {
  199. padding: 12rpx 0;
  200. }
  201. .title-box {
  202. display: flex;
  203. align-items: center;
  204. margin-bottom: 16rpx;
  205. }
  206. .title-icon {
  207. margin-right: 8rpx;
  208. }
  209. .title-text {
  210. font-size: 28rpx;
  211. color: #333;
  212. font-weight: 600;
  213. }
  214. /* 详细信息网格 */
  215. .detail-grid {
  216. display: grid;
  217. grid-template-columns: repeat(2, 1fr);
  218. gap: 16rpx 24rpx;
  219. margin-top: 20rpx;
  220. }
  221. .detail-item {
  222. display: flex;
  223. align-items: center;
  224. }
  225. .detail-text {
  226. font-size: 24rpx;
  227. color: #666;
  228. margin-left: 8rpx;
  229. overflow: hidden;
  230. text-overflow: ellipsis;
  231. }
  232. /* 操作区域 */
  233. .action-box {
  234. display: flex;
  235. justify-content: space-between;
  236. align-items: center;
  237. margin-top: 24rpx;
  238. padding-top: 16rpx;
  239. border-top: 1rpx solid #eee;
  240. }
  241. .view-detail {
  242. color: #2979FF;
  243. font-size: 26rpx;
  244. padding: 8rpx 16rpx;
  245. border-radius: 8rpx;
  246. background: #f5f7fa;
  247. }
  248. .action-icon {
  249. padding: 8rpx;
  250. }
  251. /* 添加点击态效果 */
  252. .action-box:active {
  253. background: #f8f8f8;
  254. transform: scale(0.98);
  255. transition: all 0.2s;
  256. }
  257. /* 状态标签增强 */
  258. .status-tag {
  259. padding: 4rpx 12rpx !important;
  260. border-radius: 8rpx !important;
  261. }
  262. /* 颜色增强 */
  263. .proc-name {
  264. color: #1a1a1a;
  265. }
  266. .title-text {
  267. color: #2d2d2d;
  268. }
  269. /* 图标颜色统一 */
  270. .detail-item uni-icons {
  271. color: #909399 !important;
  272. }
  273. .action-menu {
  274. background: #fff;
  275. border-radius: 16rpx 16rpx 0 0;
  276. padding: 30rpx;
  277. }
  278. .menu-item {
  279. padding: 30rpx;
  280. border-bottom: 1rpx solid #eee;
  281. }
  282. .menu-item.danger {
  283. color: #f56c6c;
  284. }
  285. .menu-item.disabled {
  286. color: #c0c4cc;
  287. pointer-events: none;
  288. }
  289. </style>