综合办公系统
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.vue 11KB

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