综合办公系统
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 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-02-19 15:36:34
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-05-23 15:42:14
  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. },
  151. // mescroll上拉加载回调
  152. async upCallback(page) {
  153. this.queryParams.pageNum = page.num
  154. const res = await this.loadData()
  155. this.myProcessList = this.myProcessList.concat(res.data.list)
  156. this.mescroll.endSuccess(res.data.list.length, res.data.hasNextPage)
  157. },
  158. // 加载数据
  159. async loadData() {
  160. try {
  161. const res = await myProcessList(this.queryParams)
  162. return {
  163. data: {
  164. list: res.data.records,
  165. }
  166. }
  167. } catch (e) {
  168. this.mescroll.endErr()
  169. return { data: { list: [] } }
  170. }
  171. },
  172. getMyprogressList() {
  173. myProcessList({
  174. pageNum: 1,
  175. pageSize: 10,
  176. }).then(response => {
  177. this.total = response.data.total;
  178. this.myProcessList = response.data.records;
  179. uni.stopPullDownRefresh();
  180. });
  181. },
  182. // 显示操作菜单
  183. showAction(item) {
  184. this.selectedItem = item
  185. this.$refs.actionPopup.open()
  186. },
  187. // 输入变化处理
  188. inputChange(res) {
  189. this.queryParams.name = res;
  190. this.search();
  191. },
  192. // 执行搜索
  193. search() {
  194. this.loadData()
  195. this.downCallback()
  196. },
  197. handleFlowRecord(row) {
  198. this.active = 'record';
  199. this.$refs.drawer.open();
  200. },
  201. handleFlowNote(row) {
  202. const query = {
  203. procInsId: row.procInsId,
  204. executionId: row.executionId,
  205. deployId: row.deployId,
  206. taskId: row.taskId,
  207. taskName: '',
  208. startUserName: row.startUserName,
  209. procDefName: row.procDefName
  210. }
  211. const encodedParams = encodeURIComponent(JSON.stringify(query));
  212. uni.navigateTo({
  213. url: `/pages/message/apply/detail?params=${encodedParams}`
  214. })
  215. this.$refs.actionPopup.close();
  216. },
  217. handleDelete(row) {
  218. const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
  219. // 显示确认提交对话框
  220. uni.showModal({
  221. title: '提示',
  222. content: '删除流程后不可撤回,确认删除该流程吗?',
  223. success: (res) => {
  224. if (!res.confirm) {
  225. return;
  226. }
  227. getProcessVariables(row.taskId).then(res => {
  228. if (res.data) {
  229. let delId = res.data.formId;
  230. deleteResources(row.procDefName, delId)
  231. }
  232. return delDeployment(ids);
  233. }).then(() => {
  234. this.upCallback();
  235. this.$modal.msgSuccess("流程取消成功");
  236. this.$refs.actionPopup.close()
  237. })
  238. }
  239. });
  240. },
  241. beDeleted(row) {
  242. if (row.procDefName == '项目预算' || row.procDefName == '技术方案' || row.procDefName == '安全交底' || row.procDefName == '技术交底' || row.finishTime != null) {
  243. return true
  244. } else if (row.procDefName == '项目流转' && row.taskName != '项目登记') {
  245. return true
  246. } else {
  247. return false
  248. }
  249. },
  250. },
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .list-item {
  255. padding: 24rpx;
  256. background: #fff;
  257. border-radius: 16rpx;
  258. margin-bottom: 20rpx;
  259. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  260. width: 100%;
  261. }
  262. /* 头部状态行 */
  263. .header-line {
  264. display: flex;
  265. align-items: center;
  266. margin-bottom: 20rpx;
  267. }
  268. .proc-name {
  269. font-size: 30rpx;
  270. color: #333;
  271. font-weight: 500;
  272. margin-left: 16rpx;
  273. }
  274. .status-tag {
  275. transform: translateY(-2rpx);
  276. }
  277. /* 内容区域 */
  278. .content-box {
  279. padding: 12rpx 0;
  280. }
  281. .title-box {
  282. display: flex;
  283. align-items: center;
  284. margin-bottom: 16rpx;
  285. }
  286. .title-icon {
  287. margin-right: 8rpx;
  288. }
  289. .title-text {
  290. font-size: 28rpx;
  291. color: #333;
  292. font-weight: 600;
  293. }
  294. /* 详细信息网格 */
  295. .detail-grid {
  296. display: grid;
  297. grid-template-columns: repeat(2, 1fr);
  298. gap: 16rpx 24rpx;
  299. margin-top: 20rpx;
  300. }
  301. .detail-item {
  302. display: flex;
  303. align-items: center;
  304. }
  305. .detail-text {
  306. font-size: 24rpx;
  307. color: #666;
  308. margin-left: 8rpx;
  309. overflow: hidden;
  310. text-overflow: ellipsis;
  311. }
  312. /* 操作区域 */
  313. .action-box {
  314. display: flex;
  315. justify-content: space-between;
  316. align-items: center;
  317. margin-top: 24rpx;
  318. padding-top: 16rpx;
  319. border-top: 1rpx solid #eee;
  320. }
  321. .view-detail {
  322. color: #2979FF;
  323. font-size: 26rpx;
  324. padding: 8rpx 16rpx;
  325. border-radius: 8rpx;
  326. background: #f5f7fa;
  327. }
  328. .action-icon {
  329. padding: 8rpx;
  330. }
  331. /* 添加点击态效果 */
  332. .action-box:active {
  333. background: #f8f8f8;
  334. transform: scale(0.98);
  335. transition: all 0.2s;
  336. }
  337. /* 状态标签增强 */
  338. .status-tag {
  339. padding: 4rpx 12rpx !important;
  340. border-radius: 8rpx !important;
  341. }
  342. /* 颜色增强 */
  343. .proc-name {
  344. color: #1a1a1a;
  345. }
  346. .title-text {
  347. color: #2d2d2d;
  348. }
  349. /* 图标颜色统一 */
  350. .detail-item uni-icons {
  351. color: #909399 !important;
  352. }
  353. .action-menu {
  354. background: #fff;
  355. border-radius: 16rpx 16rpx 0 0;
  356. padding: 30rpx;
  357. }
  358. .menu-item {
  359. padding: 30rpx;
  360. border-bottom: 1rpx solid #eee;
  361. }
  362. .menu-item.danger {
  363. color: #f56c6c;
  364. }
  365. .menu-item.disabled {
  366. color: #c0c4cc;
  367. pointer-events: none;
  368. }
  369. </style>