From a63543a5c793c8954fa2f9da0ee4fb215c62d8c2 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 20 五月 2024 10:26:46 +0800
Subject: [PATCH] !118 ♥️发布 5.2.0-BETA 公测版本 Merge pull request !118 from 疯狂的狮子Li/dev

---
 src/views/workflow/task/allTaskWaiting.vue |  286 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 286 insertions(+), 0 deletions(-)

diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue
new file mode 100644
index 0000000..fe530b8
--- /dev/null
+++ b/src/views/workflow/task/allTaskWaiting.vue
@@ -0,0 +1,286 @@
+<template>
+  <div class="p-2">
+    <div class="mb-[10px]">
+      <el-card shadow="hover" class="text-center">
+        <el-radio-group v-model="tab" @change="changeTab(tab)">
+          <el-radio-button value="waiting">寰呭姙浠诲姟</el-radio-button>
+          <el-radio-button value="finish">宸插姙浠诲姟</el-radio-button>
+        </el-radio-group>
+      </el-card>
+    </div>
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+      <div v-show="showSearch" class="mb-[10px]">
+        <el-card shadow="hover">
+          <el-form v-show="showSearch" ref="queryFormRef" :model="queryParams" :inline="true">
+            <el-form-item label="浠诲姟鍚嶇О" prop="name">
+              <el-input v-model="queryParams.name" placeholder="璇疯緭鍏ヤ换鍔″悕绉�" @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="娴佺▼瀹氫箟鍚嶇О" label-width="100" prop="processDefinitionName">
+              <el-input v-model="queryParams.processDefinitionName" placeholder="璇疯緭鍏ユ祦绋嬪畾涔夊悕绉�" @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="娴佺▼瀹氫箟KEY" label-width="100" prop="processDefinitionKey">
+              <el-input v-model="queryParams.processDefinitionKey" placeholder="璇疯緭鍏ユ祦绋嬪畾涔塊EY" @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+              <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
+            </el-form-item>
+          </el-form>
+        </el-card>
+      </div>
+    </transition>
+    <el-card shadow="hover">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">淇敼鍔炵悊浜�</el-button>
+          </el-col>
+          <right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
+        </el-row>
+      </template>
+
+      <el-table v-loading="loading" border :data="taskList" @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column align="center" type="index" label="搴忓彿" width="60"></el-table-column>
+        <el-table-column :show-overflow-tooltip="true" align="center" label="娴佺▼瀹氫箟鍚嶇О">
+          <template #default="scope">
+            <span>{{ scope.row.processDefinitionName }}v{{ scope.row.processDefinitionVersion }}.0</span>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="processDefinitionKey" label="娴佺▼瀹氫箟KEY"></el-table-column>
+        <el-table-column align="center" prop="name" label="浠诲姟鍚嶇О"></el-table-column>
+        <el-table-column align="center" prop="assigneeName" label="鍔炵悊浜�">
+          <template v-if="tab === 'waiting'" #default="scope">
+            <template v-if="scope.row.participantVo && scope.row.assignee === null">
+              <el-tag v-for="(item, index) in scope.row.participantVo.candidateName" :key="index" type="success">
+                {{ item }}
+              </el-tag>
+            </template>
+            <template v-else>
+              <el-tag type="success">
+                {{ scope.row.assigneeName || '鏃�' }}
+              </el-tag>
+            </template>
+          </template>
+          <template v-else-if="tab === 'finish'" #default="scope">
+            <el-tag type="success">
+              {{ scope.row.assigneeName || '鏃�' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="娴佺▼鐘舵��" min-width="70">
+          <template #default="scope">
+            <dict-tag v-if="tab === 'waiting'" :options="wf_business_status" :value="scope.row.businessStatus"></dict-tag>
+            <el-tag v-else type="success">宸插畬鎴�</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column v-if="tab === 'waiting'" align="center" prop="createTime" label="鍒涘缓鏃堕棿" width="160"></el-table-column>
+        <el-table-column v-if="tab === 'finish'" align="center" prop="startTime" label="鍒涘缓鏃堕棿" width="160"></el-table-column>
+        <el-table-column label="鎿嶄綔" align="center" :width="tab === 'finish' ? '80' : '151'">
+          <template #default="scope">
+            <el-row :gutter="10" class="mb8">
+              <el-col :span="1.5">
+                <el-button link type="primary" size="small" icon="View" @click="handleView(scope.row)">鏌ョ湅</el-button>
+              </el-col>
+              <el-col v-if="tab === 'waiting'" :span="1.5">
+                <el-button link type="primary" size="small" icon="Document" @click="handleInstanceVariable(scope.row)">娴佺▼鍙橀噺</el-button>
+              </el-col>
+            </el-row>
+            <el-row v-if="scope.row.multiInstance" :gutter="10" class="mb8">
+              <el-col :span="1.5">
+                <el-button link type="primary" size="small" icon="Remove" @click="deleteMultiInstanceUser(scope.row)">鍑忕</el-button>
+              </el-col>
+              <el-col :span="1.5">
+                <el-button link type="primary" size="small" icon="CirclePlus" @click="addMultiInstanceUser(scope.row)">鍔犵</el-button>
+              </el-col>
+            </el-row>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        :total="total"
+        @pagination="handleQuery"
+      />
+    </el-card>
+    <!-- 鍔犵缁勪欢 -->
+    <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback="handleQuery" />
+    <!-- 閫変汉缁勪欢 -->
+    <UserSelect ref="userSelectRef" :multiple="false" @confirm-call-back="submitCallback"></UserSelect>
+    <!-- 娴佺▼鍙橀噺寮�濮� -->
+    <el-dialog v-model="variableVisible" draggable title="娴佺▼鍙橀噺" width="60%" :close-on-click-modal="false">
+      <el-card v-loading="variableLoading" class="box-card">
+        <template #header>
+          <div class="clearfix">
+            <span
+              >娴佺▼瀹氫箟鍚嶇О锛�<el-tag>{{ processDefinitionName }}</el-tag></span
+            >
+          </div>
+        </template>
+        <div v-for="(v, index) in variableList" :key="index">
+          <el-form v-if="v.key !== '_FLOWABLE_SKIP_EXPRESSION_ENABLED'" :label-position="'right'" label-width="150px">
+            <el-form-item :label="v.key + '锛�'">
+              {{ v.value }}
+            </el-form-item>
+          </el-form>
+        </div>
+      </el-card>
+    </el-dialog>
+    <!-- 娴佺▼鍙橀噺缁撴潫 -->
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { getPageByAllTaskWait, getPageByAllTaskFinish, updateAssignee, getInstanceVariable } from '@/api/workflow/task';
+import MultiInstanceUser from '@/components/Process/multiInstanceUser.vue';
+import UserSelect from '@/components/UserSelect';
+import { TaskQuery, TaskVO, VariableVo } from '@/api/workflow/task/types';
+import workflowCommon from '@/api/workflow/workflowCommon';
+import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
+//瀹℃壒璁板綍缁勪欢
+//鍔犵缁勪欢
+const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>();
+//閫変汉缁勪欢
+const userSelectRef = ref<InstanceType<typeof UserSelect>>();
+
+const queryFormRef = ref<ElFormInstance>();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
+// 閬僵灞�
+const loading = ref(true);
+// 閫変腑鏁扮粍
+const ids = ref<Array<any>>([]);
+// 闈炲崟涓鐢�
+const single = ref(true);
+// 闈炲涓鐢�
+const multiple = ref(true);
+// 鏄剧ず鎼滅储鏉′欢
+const showSearch = ref(true);
+// 鎬绘潯鏁�
+const total = ref(0);
+// 妯″瀷瀹氫箟琛ㄦ牸鏁版嵁
+const taskList = ref([]);
+const title = ref('');
+// 娴佺▼鍙橀噺鏄惁鏄剧ず
+const variableVisible = ref(false);
+const variableLoading = ref(true);
+// 娴佺▼鍙橀噺
+const variableList = ref<VariableVo>({
+  key: '',
+  value: ''
+});
+//娴佺▼瀹氫箟鍚嶇О
+const processDefinitionName = ref();
+// 鏌ヨ鍙傛暟
+const queryParams = ref<TaskQuery>({
+  pageNum: 1,
+  pageSize: 10,
+  name: undefined,
+  processDefinitionName: undefined,
+  processDefinitionKey: undefined
+});
+const tab = ref('waiting');
+
+//鍔犵
+const addMultiInstanceUser = (row: TaskVO) => {
+  if (multiInstanceUserRef.value) {
+    title.value = '鍔犵浜哄憳';
+    multiInstanceUserRef.value.getAddMultiInstanceList(row.id, []);
+  }
+};
+//鍑忕
+const deleteMultiInstanceUser = (row: TaskVO) => {
+  if (multiInstanceUserRef.value) {
+    title.value = '鍑忕浜哄憳';
+    multiInstanceUserRef.value.getDeleteMultiInstanceList(row.id);
+  }
+};
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  if ('waiting' === tab.value) {
+    getWaitingList();
+  } else {
+    getFinishList();
+  }
+};
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+  queryFormRef.value?.resetFields();
+  queryParams.value.pageNum = 1;
+  queryParams.value.pageSize = 10;
+  handleQuery();
+};
+// 澶氶�夋閫変腑鏁版嵁
+const handleSelectionChange = (selection: any) => {
+  ids.value = selection.map((item: any) => item.id);
+  single.value = selection.length !== 1;
+  multiple.value = !selection.length;
+};
+const changeTab = async (data: string) => {
+  taskList.value = [];
+  queryParams.value.pageNum = 1;
+  if ('waiting' === data) {
+    getWaitingList();
+  } else {
+    getFinishList();
+  }
+};
+//鍒嗛〉
+const getWaitingList = () => {
+  loading.value = true;
+  getPageByAllTaskWait(queryParams.value).then((resp) => {
+    taskList.value = resp.rows;
+    total.value = resp.total;
+    loading.value = false;
+  });
+};
+const getFinishList = () => {
+  loading.value = true;
+  getPageByAllTaskFinish(queryParams.value).then((resp) => {
+    taskList.value = resp.rows;
+    total.value = resp.total;
+    loading.value = false;
+  });
+};
+//鎵撳紑淇敼閫変汉
+const handleUpdate = () => {
+  userSelectRef.value.open();
+};
+//淇敼鍔炵悊浜�
+const submitCallback = async (data) => {
+  if (data && data.length > 0) {
+    await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�');
+    loading.value = true;
+    await updateAssignee(ids.value, data[0].userId);
+    handleQuery();
+    proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
+  } else {
+    proxy?.$modal.msgWarning('璇烽�夋嫨鐢ㄦ埛锛�');
+  }
+};
+//鏌ヨ娴佺▼鍙橀噺
+const handleInstanceVariable = async (row: TaskVO) => {
+  variableLoading.value = true;
+  variableVisible.value = true;
+  processDefinitionName.value = row.processDefinitionName;
+  let data = await getInstanceVariable(row.id);
+  variableList.value = data.data;
+  variableLoading.value = false;
+};
+/** 鏌ョ湅鎸夐挳鎿嶄綔 */
+const handleView = (row) => {
+  const routerJumpVo = reactive<RouterJumpVo>({
+    wfDefinitionConfigVo: row.wfDefinitionConfigVo,
+    wfNodeConfigVo: row.wfNodeConfigVo,
+    businessKey: row.businessKey,
+    taskId: row.id,
+    type: 'view'
+  });
+  workflowCommon.routerJump(routerJumpVo, proxy);
+};
+onMounted(() => {
+  getWaitingList();
+});
+</script>

--
Gitblit v1.9.3