综合办公系统
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-02-19 15:36:34
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-05-29 10:29:10
  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 myProcessList" :key="index">
  18. <view class="list-item">
  19. <!-- 状态与标题行 -->
  20. <view class="header-line">
  21. <uni-tag :text="item.finishTime ? '已完成' : '进行中'" :type="item.finishTime ? 'success' : 'warning'"
  22. size="small" class="status-tag" />
  23. <text class="proc-name">{{ item.procDefName }}</text>
  24. </view>
  25. <!-- 主要内容 -->
  26. <view class="content-box">
  27. <!-- 标题 -->
  28. <view class="title-box">
  29. <uni-icons type="info" size="16" color="#666" class="title-icon"></uni-icons>
  30. <text class="title-text">{{ item.title }}</text>
  31. </view>
  32. <!-- 信息分割线 -->
  33. <uv-divider :dashed="true" margin="10rpx 0"></uv-divider>
  34. <!-- 详细信息 -->
  35. <view class="detail-grid">
  36. <view class="detail-item">
  37. <uni-icons type="calendar" size="14" color="#999"></uni-icons>
  38. <text class="detail-text">{{ item.createTime }}</text>
  39. </view>
  40. <view class="detail-item">
  41. <uni-icons type="clock" size="14" color="#999"></uni-icons>
  42. <text class="detail-text">{{ item.duration }}</text>
  43. </view>
  44. <view class="detail-item">
  45. <uni-icons type="location" size="14" color="#999"></uni-icons>
  46. <text class="detail-text">{{ item.taskName }}</text>
  47. </view>
  48. <view class="detail-item">
  49. <uni-icons type="person" size="14" color="#999"></uni-icons>
  50. <text class="detail-text">{{ item.assigneeName || '暂无待办人' }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 操作按钮 -->
  55. <view class="action-box">
  56. <text class="view-detail">查看详情</text>
  57. <uni-icons type="more-filled" size="20" color="#666" @click="showAction(item)"
  58. class="action-icon"></uni-icons>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </mescroll-uni>
  64. <!-- 操作菜单 -->
  65. <uni-popup ref="actionPopup" type="bottom">
  66. <view class="action-menu">
  67. <view class="menu-item" @click="handleFlowRecord(selectedItem)">
  68. <text>办理进度</text>
  69. </view>
  70. <view class="menu-item" @click="handleFlowNote(selectedItem)">
  71. <text>表单信息</text>
  72. </view>
  73. <view class="menu-item danger" @click="handleDelete(selectedItem)"
  74. :class="{ disabled: selectedItem && beDeleted(selectedItem) }">
  75. <text>取消流程</text>
  76. </view>
  77. </view>
  78. </uni-popup>
  79. <!-- 菜单抽屉 -->
  80. <uni-drawer ref="drawer" mode="right" :width="300">
  81. <flow-record :rows="selectedItem" v-if="active == 'record'"></flow-record>
  82. </uni-drawer>
  83. </view>
  84. </template>
  85. <script>
  86. import { debounce } from 'lodash-es';
  87. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  88. import { myProcessList, stopProcess } from "@/api/flowable/process";
  89. import FlowRecord from '@/pages/components/flowable/FlowRecord.vue';
  90. import { getProcessVariables } from "@/api/flowable/definition";
  91. import { getDeployment, delDeployment, addDeployment, updateDeployment, exportDeployment, flowRecord } from "@/api/flowable/finished";
  92. import { deleteResources } from "@/utils/deleteResource";
  93. export default {
  94. components: { FlowRecord },
  95. mixins: [MescrollMixin],
  96. data() {
  97. return {
  98. activeTabs: 0,
  99. mescroll: null, // mescroll实例
  100. // 我发起的流程列表数据
  101. myProcessList: [],
  102. total: 0,
  103. queryParams: {
  104. name: '',
  105. pageNum: 1,
  106. pageSize: 10
  107. },
  108. selectedItem: null, // 当前选中项
  109. debounceSearch: null, // 初始化防抖方法
  110. clickRow: {},
  111. active: 'record',
  112. downOption: {
  113. auto: true, // 手动初始化后需要关闭自动加载
  114. textOutOffset: '下拉刷新',
  115. textLoading: '加载中...'
  116. },
  117. upOption: {
  118. auto: false, // 自动加载初始页
  119. page: { num: 1, size: 10 }, // 初始页码和每页数量
  120. noMoreSize: 5, // 数据不足时显示"没有更多"
  121. empty: { tip: '暂无待审任务' },
  122. textNoMore: '~ 没有更多任务了 ~'
  123. }
  124. }
  125. },
  126. created() {
  127. },
  128. onLoad: function (options) {
  129. uni.startPullDownRefresh();
  130. },
  131. mounted() {
  132. },
  133. methods: {
  134. switchTabs(item) {
  135. this.activeTabs = item.index;
  136. this.queryParams.finishTime
  137. },
  138. // 初始化mescroll
  139. mescrollInit(mescroll) {
  140. this.mescroll = mescroll;
  141. },
  142. // mescroll下拉刷新回调
  143. async downCallback() {
  144. this.myProcessList = []; // 清空列表
  145. this.queryParams.pageNum = 1
  146. const res = await this.loadData()
  147. this.myProcessList = res.data.list;
  148. this.mescroll.endSuccess(res.data.length)
  149. this.mescroll.endErr()
  150. uni.stopPullDownRefresh();
  151. },
  152. // mescroll上拉加载回调
  153. async upCallback(page) {
  154. this.queryParams.pageNum = page.num
  155. const res = await this.loadData()
  156. this.myProcessList = this.myProcessList.concat(res.data.list)
  157. this.mescroll.endSuccess(res.data.list.length, res.data.hasNextPage)
  158. },
  159. // 加载数据
  160. async loadData() {
  161. try {
  162. const res = await myProcessList(this.queryParams)
  163. return {
  164. data: {
  165. list: res.data.records,
  166. }
  167. }
  168. } catch (e) {
  169. this.mescroll.endErr()
  170. return { data: { list: [] } }
  171. }
  172. },
  173. getMyprogressList() {
  174. myProcessList({
  175. pageNum: 1,
  176. pageSize: 10,
  177. }).then(response => {
  178. this.total = response.data.total;
  179. this.myProcessList = response.data.records;
  180. uni.stopPullDownRefresh();
  181. });
  182. },
  183. // 显示操作菜单
  184. showAction(item) {
  185. this.selectedItem = item
  186. this.$refs.actionPopup.open()
  187. },
  188. // 输入变化处理
  189. inputChange(res) {
  190. this.queryParams.name = res;
  191. this.search();
  192. },
  193. // 执行搜索
  194. search() {
  195. this.loadData()
  196. this.downCallback()
  197. },
  198. handleFlowRecord(row) {
  199. this.active = 'record';
  200. this.$refs.drawer.open();
  201. },
  202. handleFlowNote(row) {
  203. const query = {
  204. procInsId: row.procInsId,
  205. executionId: row.executionId,
  206. deployId: row.deployId,
  207. taskId: row.taskId,
  208. taskName: '',
  209. startUserName: row.startUserName,
  210. procDefName: row.procDefName
  211. }
  212. const encodedParams = encodeURIComponent(JSON.stringify(query));
  213. uni.navigateTo({
  214. url: `/pages/message/apply/detail?params=${encodedParams}`
  215. })
  216. this.$refs.actionPopup.close();
  217. },
  218. handleDelete(row) {
  219. const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
  220. // 显示确认提交对话框
  221. uni.showModal({
  222. title: '提示',
  223. content: '删除流程后不可撤回,确认删除该流程吗?',
  224. success: (res) => {
  225. if (!res.confirm) {
  226. return;
  227. }
  228. getProcessVariables(row.taskId).then(res => {
  229. if (res.data) {
  230. let delId = res.data.formId;
  231. deleteResources(row.procDefName, delId)
  232. }
  233. return delDeployment(ids);
  234. }).then(() => {
  235. this.downCallback();
  236. this.$modal.msgSuccess("流程取消成功");
  237. this.$refs.actionPopup.close()
  238. })
  239. }
  240. });
  241. },
  242. beDeleted(row) {
  243. if (row.procDefName == '项目预算' || row.procDefName == '技术方案' || row.procDefName == '安全交底' || row.procDefName == '技术交底' || row.finishTime != null) {
  244. return true
  245. } else if (row.procDefName == '项目流转' && row.taskName != '项目登记') {
  246. return true
  247. } else {
  248. return false
  249. }
  250. },
  251. },
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. .list-item {
  256. padding: 24rpx;
  257. background: #fff;
  258. border-radius: 16rpx;
  259. margin-bottom: 20rpx;
  260. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  261. width: 100%;
  262. }
  263. /* 头部状态行 */
  264. .header-line {
  265. display: flex;
  266. align-items: center;
  267. margin-bottom: 20rpx;
  268. }
  269. .proc-name {
  270. font-size: 30rpx;
  271. color: #333;
  272. font-weight: 500;
  273. margin-left: 16rpx;
  274. }
  275. .status-tag {
  276. transform: translateY(-2rpx);
  277. }
  278. /* 内容区域 */
  279. .content-box {
  280. padding: 12rpx 0;
  281. }
  282. .title-box {
  283. display: flex;
  284. align-items: center;
  285. margin-bottom: 16rpx;
  286. }
  287. .title-icon {
  288. margin-right: 8rpx;
  289. }
  290. .title-text {
  291. font-size: 28rpx;
  292. color: #333;
  293. font-weight: 600;
  294. }
  295. /* 详细信息网格 */
  296. .detail-grid {
  297. display: grid;
  298. grid-template-columns: repeat(2, 1fr);
  299. gap: 16rpx 24rpx;
  300. margin-top: 20rpx;
  301. }
  302. .detail-item {
  303. display: flex;
  304. align-items: center;
  305. }
  306. .detail-text {
  307. font-size: 24rpx;
  308. color: #666;
  309. margin-left: 8rpx;
  310. overflow: hidden;
  311. text-overflow: ellipsis;
  312. }
  313. /* 操作区域 */
  314. .action-box {
  315. display: flex;
  316. justify-content: space-between;
  317. align-items: center;
  318. margin-top: 24rpx;
  319. padding-top: 16rpx;
  320. border-top: 1rpx solid #eee;
  321. }
  322. .view-detail {
  323. color: #2979FF;
  324. font-size: 26rpx;
  325. padding: 8rpx 16rpx;
  326. border-radius: 8rpx;
  327. background: #f5f7fa;
  328. }
  329. .action-icon {
  330. padding: 8rpx;
  331. }
  332. /* 添加点击态效果 */
  333. .action-box:active {
  334. background: #f8f8f8;
  335. transform: scale(0.98);
  336. transition: all 0.2s;
  337. }
  338. /* 状态标签增强 */
  339. .status-tag {
  340. padding: 4rpx 12rpx !important;
  341. border-radius: 8rpx !important;
  342. }
  343. /* 颜色增强 */
  344. .proc-name {
  345. color: #1a1a1a;
  346. }
  347. .title-text {
  348. color: #2d2d2d;
  349. }
  350. /* 图标颜色统一 */
  351. .detail-item uni-icons {
  352. color: #909399 !important;
  353. }
  354. .action-menu {
  355. background: #fff;
  356. border-radius: 16rpx 16rpx 0 0;
  357. padding: 30rpx;
  358. }
  359. .menu-item {
  360. padding: 30rpx;
  361. border-bottom: 1rpx solid #eee;
  362. }
  363. .menu-item.danger {
  364. color: #f56c6c;
  365. }
  366. .menu-item.disabled {
  367. color: #c0c4cc;
  368. pointer-events: none;
  369. }
  370. </style>