From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/bpm/processInstance/manager/index.vue |  259 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 259 insertions(+), 0 deletions(-)

diff --git a/src/views/bpm/processInstance/manager/index.vue b/src/views/bpm/processInstance/manager/index.vue
new file mode 100644
index 0000000..21e3a9e
--- /dev/null
+++ b/src/views/bpm/processInstance/manager/index.vue
@@ -0,0 +1,259 @@
+<template>
+  <doc-alert title="宸ヤ綔娴佹墜鍐�" url="https://doc.iocoder.cn/bpm/" />
+
+  <ContentWrap>
+    <!-- 鎼滅储宸ヤ綔鏍� -->
+    <el-form
+      class="-mb-15px"
+      :model="queryParams"
+      ref="queryFormRef"
+      :inline="true"
+      label-width="68px"
+    >
+      <el-form-item label="鍙戣捣浜�" prop="startUserId">
+        <el-select v-model="queryParams.startUserId" placeholder="璇烽�夋嫨鍙戣捣浜�" class="!w-240px">
+          <el-option
+            v-for="user in userList"
+            :key="user.id"
+            :label="user.nickname"
+            :value="user.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="娴佺▼鍚嶇О" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="璇疯緭鍏ユ祦绋嬪悕绉�"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="鎵�灞炴祦绋�" prop="processDefinitionId">
+        <el-input
+          v-model="queryParams.processDefinitionId"
+          placeholder="璇疯緭鍏ユ祦绋嬪畾涔夌殑缂栧彿"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="娴佺▼鍒嗙被" prop="category">
+        <el-select
+          v-model="queryParams.category"
+          placeholder="璇烽�夋嫨娴佺▼鍒嗙被"
+          clearable
+          class="!w-240px"
+        >
+          <el-option
+            v-for="category in categoryList"
+            :key="category.code"
+            :label="category.name"
+            :value="category.code"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="娴佺▼鐘舵��" prop="status">
+        <el-select
+          v-model="queryParams.status"
+          placeholder="璇烽�夋嫨娴佺▼鐘舵��"
+          clearable
+          class="!w-240px"
+        >
+          <el-option
+            v-for="dict in getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="鍙戣捣鏃堕棿" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 鍒楄〃 -->
+  <ContentWrap>
+    <el-table v-loading="loading" :data="list">
+      <el-table-column label="娴佺▼鍚嶇О" align="center" prop="name" min-width="200px" fixed="left" />
+      <el-table-column
+        label="娴佺▼鍒嗙被"
+        align="center"
+        prop="categoryName"
+        min-width="100"
+        fixed="left"
+      />
+      <el-table-column label="娴佺▼鍙戣捣浜�" align="center" prop="startUser.nickname" width="120" />
+      <el-table-column label="鍙戣捣閮ㄩ棬" align="center" prop="startUser.deptName" width="120" />
+      <el-table-column label="娴佺▼鐘舵��" prop="status" width="120">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="scope.row.status" />
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="鍙戣捣鏃堕棿"
+        align="center"
+        prop="startTime"
+        width="180"
+        :formatter="dateFormatter"
+      />
+      <el-table-column
+        label="缁撴潫鏃堕棿"
+        align="center"
+        prop="endTime"
+        width="180"
+        :formatter="dateFormatter"
+      />
+      <el-table-column align="center" label="鑰楁椂" prop="durationInMillis" width="169">
+        <template #default="scope">
+          {{ scope.row.durationInMillis > 0 ? formatPast2(scope.row.durationInMillis) : '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="褰撳墠瀹℃壒浠诲姟" align="center" prop="tasks" min-width="120px">
+        <template #default="scope">
+          <el-button type="primary" v-for="task in scope.row.tasks" :key="task.id" link>
+            <span>{{ task.name }}</span>
+          </el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="娴佺▼缂栧彿" align="center" prop="id" min-width="320px" />
+      <el-table-column label="鎿嶄綔" align="center" fixed="right" width="180">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            v-hasPermi="['bpm:process-instance:cancel']"
+            @click="handleDetail(scope.row)"
+          >
+            璇︽儏
+          </el-button>
+          <el-button
+            link
+            type="primary"
+            v-if="scope.row.status === 1"
+            v-hasPermi="['bpm:process-instance:query']"
+            @click="handleCancel(scope.row)"
+          >
+            鍙栨秷
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 鍒嗛〉 -->
+    <Pagination
+      :total="total"
+      v-model:page="queryParams.pageNo"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </ContentWrap>
+</template>
+<script lang="ts" setup>
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
+import { dateFormatter, formatPast2 } from '@/utils/formatTime'
+import { ElMessageBox } from 'element-plus'
+import * as ProcessInstanceApi from '@/api/bpm/processInstance'
+import { CategoryApi } from '@/api/bpm/category'
+import * as UserApi from '@/api/system/user'
+import { cancelProcessInstanceByAdmin } from '@/api/bpm/processInstance'
+
+// 瀹冨拰銆愭垜鐨勬祦绋嬨�戠殑宸紓鏄紝璇ヨ彍鍗曞彲浠ョ湅鍏ㄩ儴鐨勬祦绋嬪疄渚�
+defineOptions({ name: 'BpmProcessInstanceManager' })
+
+const router = useRouter() // 璺敱
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  startUserId: undefined,
+  name: '',
+  processDefinitionId: undefined,
+  category: undefined,
+  status: undefined,
+  createTime: []
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const categoryList = ref([]) // 娴佺▼鍒嗙被鍒楄〃
+const userList = ref<any[]>([]) // 鐢ㄦ埛鍒楄〃
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await ProcessInstanceApi.getProcessInstanceManagerPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 鏌ョ湅璇︽儏 */
+const handleDetail = (row) => {
+  router.push({
+    name: 'BpmProcessInstanceDetail',
+    query: {
+      id: row.id
+    }
+  })
+}
+
+/** 鍙栨秷鎸夐挳鎿嶄綔 */
+const handleCancel = async (row) => {
+  // 浜屾纭
+  const { value } = await ElMessageBox.prompt('璇疯緭鍏ュ彇娑堝師鍥�', '鍙栨秷娴佺▼', {
+    confirmButtonText: t('common.ok'),
+    cancelButtonText: t('common.cancel'),
+    inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 鍒ゆ柇闈炵┖锛屼笖闈炵┖鏍�
+    inputErrorMessage: '鍙栨秷鍘熷洜涓嶈兘涓虹┖'
+  })
+  // 鍙戣捣鍙栨秷
+  await ProcessInstanceApi.cancelProcessInstanceByAdmin(row.id, value)
+  message.success('鍙栨秷鎴愬姛')
+  // 鍒锋柊鍒楄〃
+  await getList()
+}
+
+/** 婵�娲绘椂 **/
+onActivated(() => {
+  getList()
+})
+
+/** 鍒濆鍖� **/
+onMounted(async () => {
+  await getList()
+  categoryList.value = await CategoryApi.getCategorySimpleList()
+  userList.value = await UserApi.getSimpleUserList()
+})
+</script>

--
Gitblit v1.8.0