综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-02-19 15:30:13
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-06-03 10:19:28
  6. -->
  7. <template>
  8. <view class="page-container">
  9. <!-- 搜索框 -->
  10. <view class="search-box">
  11. <uni-search-bar radius="34" placeholder="请输入流程名称" @input="inputChange" v-model="queryParams.name" />
  12. </view>
  13. <!-- 流程列表 -->
  14. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  15. :up="upOption" :fixed="false" :top="10" style="padding: 30rpx;">
  16. <view>
  17. <view v-for="(item, index) in finishedList" :key="index">
  18. <view class="list-item">
  19. <!-- 状态与标题行 -->
  20. <view class="header-line">
  21. <text class="proc-name" style="font-weight: bold; font-size: 30rpx; color: #FF5733;">{{ item.procDefName }}</text>
  22. </view>
  23. <!-- 主要内容 -->
  24. <view class="content-box">
  25. <!-- 标题 -->
  26. <view class="title-box">
  27. <uni-icons type="info" size="16" color="#666" class="title-icon"></uni-icons>
  28. <text class="title-text">{{ item.title }}</text>
  29. </view>
  30. <!-- 信息分割线 -->
  31. <uv-divider :dashed="true" margin="10rpx 0"></uv-divider>
  32. <!-- 详细信息 -->
  33. <view class="detail-grid">
  34. <view class="detail-item">
  35. <uni-icons type="person" size="14" color="#999"></uni-icons>
  36. <text class="detail-text">{{ item.startUserName }}</text>
  37. <uni-tag style="margin-left: 10rpx;" :text="item.startDeptName" type="info" size="mini" />
  38. </view>
  39. <view class="detail-item">
  40. <uni-icons type="calendar" size="14" color="#999"></uni-icons>
  41. <text class="detail-text">{{ item.createTime }}</text>
  42. </view>
  43. <view class="detail-item">
  44. <uni-icons type="clock" size="14" color="#999"></uni-icons>
  45. <text class="detail-text">{{ item.duration }}</text>
  46. </view>
  47. <view class="detail-item">
  48. <uni-icons type="location" size="14" color="#999"></uni-icons>
  49. <text class="detail-text">{{ item.taskName }}</text>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 操作按钮 -->
  54. <view class="action-box">
  55. <text class="view-detail" @click="handleFlowRecord(item)">办理进度</text>
  56. <text class="view-detail" @click="handleFlowNote(item)">表单信息</text>
  57. <text class="view-detail" @click="handleRevoke(item)" :class="{ disabled: beDisabled(item) }">撤回</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </mescroll-uni>
  63. <!-- 菜单抽屉 -->
  64. <uni-drawer ref="drawer" mode="right" :width="300">
  65. <flow-record :rows="selectedItem" v-if="active == 'record'"></flow-record>
  66. </uni-drawer>
  67. </view>
  68. </template>
  69. <script>
  70. import { debounce } from 'lodash-es';
  71. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  72. import { finishedList, revokeProcess } from "@/api/flowable/finished";
  73. import { getProcessVariables } from "@/api/flowable/definition";
  74. import FlowRecord from '@/pages/components/flowable/FlowRecord.vue';
  75. export default {
  76. components: { FlowRecord },
  77. mixins: [MescrollMixin],
  78. data() {
  79. return {
  80. mescroll: null, // mescroll实例
  81. // 已办任务列表数据
  82. finishedList: [],
  83. total: 0,
  84. queryParams: {
  85. name: '',
  86. pageNum: 1,
  87. pageSize: 10
  88. },
  89. selectedItem: null, // 当前选中项
  90. active: 'record',
  91. downOption: {
  92. auto: true,
  93. textOutOffset: '下拉刷新',
  94. textLoading: '加载中...'
  95. },
  96. upOption: {
  97. auto: false,
  98. page: { num: 1, size: 10 },
  99. noMoreSize: 5,
  100. empty: { tip: '暂无已办任务' },
  101. textNoMore: '~ 没有更多任务了 ~'
  102. }
  103. }
  104. },
  105. onLoad: function (options) {
  106. uni.startPullDownRefresh();
  107. },
  108. methods: {
  109. // 初始化mescroll
  110. mescrollInit(mescroll) {
  111. this.mescroll = mescroll;
  112. },
  113. // mescroll下拉刷新回调
  114. async downCallback() {
  115. this.finishedList = []; // 清空列表
  116. this.queryParams.pageNum = 1
  117. const res = await this.loadData()
  118. this.finishedList = res.data.list;
  119. this.mescroll.endSuccess(res.data.length)
  120. this.mescroll.endErr()
  121. uni.stopPullDownRefresh();
  122. },
  123. // mescroll上拉加载回调
  124. async upCallback(page) {
  125. this.queryParams.pageNum = page.num
  126. const res = await this.loadData()
  127. this.finishedList = this.finishedList.concat(res.data.list)
  128. this.mescroll.endSuccess(res.data.list.length, res.data.hasNextPage)
  129. },
  130. // 加载数据
  131. async loadData() {
  132. try {
  133. const res = await finishedList(this.queryParams)
  134. return {
  135. data: {
  136. list: res.data.records,
  137. }
  138. }
  139. } catch (e) {
  140. this.mescroll.endErr()
  141. return { data: { list: [] } }
  142. }
  143. },
  144. // 输入变化处理
  145. inputChange(res) {
  146. this.queryParams.name = res;
  147. this.search();
  148. },
  149. // 执行搜索
  150. search() {
  151. this.loadData()
  152. this.downCallback()
  153. },
  154. // 办理进度
  155. handleFlowRecord(row) {
  156. this.active = 'record';
  157. this.selectedItem = row;
  158. this.$refs.drawer.open();
  159. },
  160. // 表单信息
  161. handleFlowNote(row) {
  162. getProcessVariables(row.taskId).then(res => {
  163. if (res.data) {
  164. const query = {
  165. procInsId: row.procInsId,
  166. executionId: row.executionId,
  167. deployId: row.deployId,
  168. taskId: row.taskId,
  169. taskName: '',
  170. startUserName: row.startUserName,
  171. procDefName: row.procDefName,
  172. formId: res.data.formId
  173. }
  174. const encodedParams = encodeURIComponent(JSON.stringify(query));
  175. uni.navigateTo({
  176. url: `/pages/message/apply/detail?params=${encodedParams}`
  177. })
  178. }
  179. })
  180. },
  181. // 撤回任务
  182. handleRevoke(row) {
  183. if (this.beDisabled(row)) return;
  184. uni.showModal({
  185. title: '提示',
  186. content: '确定撤回任务吗?',
  187. success: (res) => {
  188. if (res.confirm) {
  189. const params = {
  190. instanceId: row.procInsId,
  191. taskId: row.taskId
  192. }
  193. revokeProcess(params).then(res => {
  194. this.$modal.msgSuccess(res.msg);
  195. this.downCallback();
  196. });
  197. }
  198. }
  199. });
  200. },
  201. // 判断是否禁用撤回
  202. beDisabled(row) {
  203. if (row.procDefName == '项目流转' && row.taskName == '项目安排') {
  204. return true
  205. }
  206. return false
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .list-item {
  213. padding: 24rpx;
  214. background: #fff;
  215. border-radius: 16rpx;
  216. margin-bottom: 20rpx;
  217. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  218. width: 100%;
  219. }
  220. /* 头部状态行 */
  221. .header-line {
  222. display: flex;
  223. align-items: center;
  224. margin-bottom: 20rpx;
  225. }
  226. .proc-name {
  227. font-size: 30rpx;
  228. color: #333;
  229. font-weight: 500;
  230. margin-left: 16rpx;
  231. }
  232. .status-tag {
  233. transform: translateY(-2rpx);
  234. }
  235. /* 内容区域 */
  236. .content-box {
  237. padding: 12rpx 0;
  238. }
  239. .title-box {
  240. display: flex;
  241. align-items: center;
  242. margin-bottom: 16rpx;
  243. }
  244. .title-icon {
  245. margin-right: 8rpx;
  246. }
  247. .title-text {
  248. font-size: 28rpx;
  249. color: #333;
  250. font-weight: 600;
  251. }
  252. /* 详细信息网格 */
  253. .detail-grid {
  254. display: grid;
  255. grid-template-columns: repeat(2, 1fr);
  256. gap: 16rpx 24rpx;
  257. margin-top: 20rpx;
  258. }
  259. .detail-item {
  260. display: flex;
  261. align-items: center;
  262. }
  263. .detail-text {
  264. font-size: 24rpx;
  265. color: #666;
  266. margin-left: 8rpx;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. }
  270. /* 操作区域 */
  271. .action-box {
  272. display: flex;
  273. justify-content: space-between;
  274. align-items: center;
  275. margin-top: 24rpx;
  276. padding-top: 16rpx;
  277. border-top: 1rpx solid #eee;
  278. }
  279. .view-detail {
  280. color: #2979FF;
  281. font-size: 26rpx;
  282. padding: 8rpx 16rpx;
  283. border-radius: 8rpx;
  284. background: #f5f7fa;
  285. }
  286. .view-detail.disabled {
  287. color: #c0c4cc;
  288. pointer-events: none;
  289. }
  290. /* 添加点击态效果 */
  291. .action-box:active {
  292. background: #f8f8f8;
  293. transform: scale(0.98);
  294. transition: all 0.2s;
  295. }
  296. /* 状态标签增强 */
  297. .status-tag {
  298. padding: 4rpx 12rpx !important;
  299. border-radius: 8rpx !important;
  300. }
  301. /* 颜色增强 */
  302. .proc-name {
  303. color: #1a1a1a;
  304. }
  305. .title-text {
  306. color: #2d2d2d;
  307. }
  308. /* 图标颜色统一 */
  309. .detail-item uni-icons {
  310. color: #909399 !important;
  311. }
  312. </style>