兰宝车间质量管理系统-前端
gssong
2024-05-31 58e6fdef78e4e8a8cb3bd7090ef900e9032cf714
src/views/workflow/processInstance/index.vue
@@ -81,7 +81,7 @@
            </el-table-column>
            <el-table-column align="center" prop="startTime" label="启动时间" width="160"></el-table-column>
            <el-table-column v-if="tab === 'finish'" align="center" prop="endTime" label="结束时间" width="160"></el-table-column>
            <el-table-column label="操作" align="center" :width="tab === 'finish' ? '130' : '160'">
            <el-table-column label="操作" align="center" :width="130">
              <template #default="scope">
                <el-row v-if="tab === 'running'" :gutter="10" class="mb8">
                  <el-col :span="1.5">
@@ -97,22 +97,12 @@
                    </el-popover>
                  </el-col>
                  <el-col :span="1.5">
                    <el-button
                      link
                      type="primary"
                      size="small"
                      icon="Sort"
                      @click="getProcessDefinitionHitoryList(scope.row.processDefinitionId, scope.row.processDefinitionKey)"
                      >切换版本</el-button
                    >
                    <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
                  </el-col>
                </el-row>
                <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 :span="1.5">
                    <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
                  </el-col>
                </el-row>
              </template>
@@ -177,6 +167,8 @@
const loading = ref(true);
// 选中数组
const ids = ref<Array<any>>([]);
// 选中业务id数组
const businessKeys = ref<Array<any>>([]);
// 非单个禁用
const single = ref(true);
// 非多个禁用
@@ -267,6 +259,7 @@
// 多选框选中数据
const handleSelectionChange = (selection: ProcessInstanceVO[]) => {
  ids.value = selection.map((item: any) => item.id);
  businessKeys.value = selection.map((item: any) => item.businessKey);
  single.value = selection.length !== 1;
  multiple.value = !selection.length;
};
@@ -291,14 +284,14 @@
/** 删除按钮操作 */
const handleDelete = async (row: any) => {
  const id = row.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除id为【' + id + '】的数据项?');
  const businessKey = row.businessKey || businessKeys.value;
  await proxy?.$modal.confirm('是否确认删除业务id为【' + businessKey + '】的数据项?');
  loading.value = true;
  if ('running' === tab.value) {
    await deleteRunAndHisInstance(id).finally(() => (loading.value = false));
    await deleteRunAndHisInstance(businessKey).finally(() => (loading.value = false));
    getProcessInstanceRunningList();
  } else {
    await deleteFinishAndHisInstance(id).finally(() => (loading.value = false));
    await deleteFinishAndHisInstance(businessKey).finally(() => (loading.value = false));
    getProcessInstanceFinishList();
  }
  proxy?.$modal.msgSuccess('删除成功');
@@ -318,7 +311,7 @@
  loading.value = true;
  if ('running' === tab.value) {
    let param = {
      processInstanceId: row.id,
      businessKey: row.businessKey,
      deleteReason: deleteReason.value
    };
    await deleteRunInstance(param).finally(() => (loading.value = false));