|
|
@@ -165,8 +165,20 @@ function handleUpdate(row: any) {
|
|
|
/** 删除按钮操作 */
|
|
|
function handleDelete(rows: any[]) {
|
|
|
const ids = rows.map((item) => item.id)
|
|
|
- if (queryParams.value.runStatus == "1") {
|
|
|
- }
|
|
|
+ message.confirm("是否确认删除流程定义?", "确认删除").then(() => {
|
|
|
+ if (queryParams.value.runStatus == "1") {
|
|
|
+ apis.workflow.processInstanceApi.deleteByInstanceIds(ids).then(() => {
|
|
|
+ message.msgSuccess("删除成功")
|
|
|
+ handleQuery()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ apis.workflow.processInstanceApi.deleteHisByInstanceIds(ids).then(() => {
|
|
|
+ message.msgSuccess("删除成功")
|
|
|
+ handleQuery()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
tableRef.value.defaultHandleFuns.handleDelete("", rows)
|
|
|
}
|
|
|
function handleExport(rows: any) {
|
|
|
@@ -211,10 +223,10 @@ function handleConfirmInvalid(row: any) {
|
|
|
}
|
|
|
function formatToJsonObject(data: string) {
|
|
|
try {
|
|
|
- return JSON.parse(data);
|
|
|
- } catch (error) {
|
|
|
- return data;
|
|
|
- }
|
|
|
+ return JSON.parse(data)
|
|
|
+ } catch (error) {
|
|
|
+ return data
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const pdTableRef = ref()
|
|
|
@@ -251,16 +263,52 @@ const pdVersion = ref("")
|
|
|
function handleView(row: any) {
|
|
|
wfTaskJump(row)
|
|
|
}
|
|
|
+const instanceId = ref()
|
|
|
const variableModalRef = ref()
|
|
|
-const variableModalTitle = ref("")
|
|
|
+const variableFormRef = ref()
|
|
|
+const variableForm = ref({
|
|
|
+ instanceId: undefined,
|
|
|
+ key: undefined,
|
|
|
+ value: undefined
|
|
|
+})
|
|
|
+const variableFormRules = reactive<Record<string, any>>({
|
|
|
+ key: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入KEY",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ value: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入变量值",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+})
|
|
|
const variables = ref<any>()
|
|
|
const flowName = ref("")
|
|
|
function handleVariable(row: any) {
|
|
|
flowName.value = row.flowName
|
|
|
+ instanceId.value = row.id
|
|
|
apis.workflow.processInstanceApi.instanceVariable(row.id).then((res: any) => {
|
|
|
variables.value = res.data.variable
|
|
|
variableModalRef.value.show()
|
|
|
-})
|
|
|
+ })
|
|
|
+}
|
|
|
+function onVariableSubmit() {
|
|
|
+ form.value.instanceId = instanceId.value
|
|
|
+ message.confirm("是否确认保存变量?", "确认保存").then(() => {
|
|
|
+ variableFormRef.value.validate().then(() => {
|
|
|
+ apis.workflow.processInstanceApi.updateVariable(variableForm.value).then((res: any) => {
|
|
|
+ message.msgSuccess("保存成功")
|
|
|
+ apis.workflow.processInstanceApi.instanceVariable(instanceId.value).then((res: any) => {
|
|
|
+ variables.value = res.data.variable
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
function onCategoryChange(data: any) {
|
|
|
queryParams.value.category = data.categoryId
|
|
|
@@ -285,10 +333,10 @@ function getTableListFun(query: any) {
|
|
|
queryParams.value.runStatus == "1"
|
|
|
? apis.workflow.processInstanceApi.getPageByRunning(query).then((res: any) => {
|
|
|
resolve(res)
|
|
|
- })
|
|
|
+ })
|
|
|
: apis.workflow.processInstanceApi.getPageByFinish(query).then((res: any) => {
|
|
|
resolve(res)
|
|
|
- })
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
function init() {
|
|
|
@@ -322,9 +370,7 @@ onMounted(init)
|
|
|
:check-multiple="true"
|
|
|
:reset-search-form-fun="resetQuery"
|
|
|
:custom-search-fun="handleQuery">
|
|
|
- <template #flowName="{ row }">
|
|
|
- {{ row.flowName }}_V{{ row.version }}
|
|
|
- </template>
|
|
|
+ <template #flowName="{ row }">{{ row.flowName }}_V{{ row.version }}</template>
|
|
|
<template #flowStatus="{ row }">
|
|
|
<DictTag type="wf_business_status" :value="row.flowStatus"></DictTag>
|
|
|
</template>
|
|
|
@@ -409,16 +455,38 @@ onMounted(init)
|
|
|
<VueJsonPretty :data="formatToJsonObject(variables)" />
|
|
|
</template>
|
|
|
</VbModal> -->
|
|
|
- <VbModal v-model:modal="variableModalRef" title="流程变量" :confirm-btn="false" append-to-body>
|
|
|
+ <VbModal
|
|
|
+ v-model:modal="variableModalRef"
|
|
|
+ title="流程变量"
|
|
|
+ :save-auto-close="false"
|
|
|
+ @confirm="onVariableSubmit"
|
|
|
+ append-to-body>
|
|
|
<template #body>
|
|
|
- <span>
|
|
|
- 流程定义名称:
|
|
|
- <el-tag>{{ flowName }}</el-tag>
|
|
|
- </span>
|
|
|
- <dl v-for="(v, index) in formatToJsonObject(variables)" :key="index">
|
|
|
- <dt>{{ v.key }}:</dt>
|
|
|
- <dd>{{ v.value }}</dd>
|
|
|
- </dl>
|
|
|
+ <el-card>
|
|
|
+ <span>
|
|
|
+ 流程定义名称:
|
|
|
+ <el-tag>{{ flowName }}</el-tag>
|
|
|
+ </span>
|
|
|
+ <dl v-for="(v, index) in formatToJsonObject(variables)" :key="index">
|
|
|
+ <dt>{{ v.key }}:</dt>
|
|
|
+ <dd>{{ v.value }}</dd>
|
|
|
+ </dl>
|
|
|
+ </el-card>
|
|
|
+ <el-card>
|
|
|
+ <el-form
|
|
|
+ ref="variableFormRef"
|
|
|
+ :model="variableForm"
|
|
|
+ :inline="true"
|
|
|
+ :rules="variableFormRules"
|
|
|
+ label-width="120px">
|
|
|
+ <el-form-item label="变量KEY" prop="key">
|
|
|
+ <el-input v-model="form.key" placeholder="请输入变量KEY" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="变量值" prop="value">
|
|
|
+ <el-input v-model="form.value" placeholder="请输入变量值" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
</template>
|
|
|
</VbModal>
|
|
|
<VbModal
|