修复bug 173、157、174、175、176、177
This commit is contained in:
@@ -9,6 +9,25 @@ export enum FLOW_USE_STATUS {
|
||||
USED = 1,
|
||||
}
|
||||
|
||||
export enum FLOW_OPERATION_TYPE {
|
||||
/**
|
||||
* 创建
|
||||
*/
|
||||
CREATE = 'create',
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
EDIT = 'edit',
|
||||
/**
|
||||
* 升版
|
||||
*/
|
||||
UPGRADE = 'upgrade',
|
||||
/**
|
||||
* 复制
|
||||
*/
|
||||
COPY = 'copy',
|
||||
}
|
||||
|
||||
export enum FLOW_APPROVE_STATUS_ENUM {
|
||||
/**
|
||||
* 未审核
|
||||
|
||||
@@ -15,18 +15,21 @@
|
||||
v-model="approveForm.approve"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新模式:">
|
||||
<!-- <el-form-item label="更新模式:" v-if="operationType !== FLOW_OPERATION_TYPE.UPGRADE">
|
||||
<el-radio-group v-model="approveForm.updateMode">
|
||||
<el-radio value="update" size="large">更新草稿</el-radio>
|
||||
<el-radio value="upgrade" size="large">升版草稿</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="升级方式:" v-if="approveForm.updateMode === 'upgrade'">
|
||||
</el-form-item> -->
|
||||
<el-form-item label="升级方式:" v-if="approveForm.updateMode === 'upgrade' ">
|
||||
<el-radio-group v-model="approveForm.versionType">
|
||||
<el-radio value="1" size="large">大版本</el-radio>
|
||||
<el-radio value="0" size="large">小版本</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="通过后版本:">
|
||||
{{ approveForm.updateMode === 'upgrade'? upgradeToVersion: templateVersion }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div>
|
||||
@@ -44,6 +47,7 @@ import { computed, reactive, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import ApproveList from '@/components/common/approveList/index.vue';
|
||||
import { releaseFlowTemplateApi, upgradeFlowTemplateDraftApi } from '@/api/capability/flow';
|
||||
import { FLOW_OPERATION_TYPE } from '@/utils/enum/flow';
|
||||
|
||||
const props = defineProps<{
|
||||
showDialog: boolean;
|
||||
@@ -52,6 +56,8 @@ const props = defineProps<{
|
||||
graph: any;
|
||||
nodeRelation: any[];
|
||||
flowDetail: any;
|
||||
operationType: string;
|
||||
templateVersion: string;
|
||||
}>();
|
||||
|
||||
const loadingInterface = ref(false);
|
||||
@@ -68,10 +74,26 @@ const emits = defineEmits(['update:showDialog', 'confirm', 'saveDraft' ]);
|
||||
|
||||
const approveForm = reactive<any>({
|
||||
approve: '',
|
||||
updateMode: 'update',
|
||||
updateMode: props.operationType === FLOW_OPERATION_TYPE.UPGRADE ? 'upgrade' : 'update',
|
||||
versionType: '1',
|
||||
});
|
||||
|
||||
const upgradeToVersion = computed(() => {
|
||||
try {
|
||||
const version = Number(props.templateVersion.split('V')[1]);
|
||||
// if (props.operationType === FLOW_OPERATION_TYPE.UPGRADE) {
|
||||
if (approveForm.versionType === '1') {
|
||||
return `V${Math.floor(version) + 1}`;
|
||||
} else {
|
||||
return `V${version + 0.1}`;
|
||||
}
|
||||
// }
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
return 'V1.0';
|
||||
});
|
||||
|
||||
const approveFormRef = ref();
|
||||
|
||||
const approveFormRules = reactive<any>({
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<img src="@/assets/imgs/dragFlow/lateral-distribution.svg" alt="">
|
||||
</div>
|
||||
<div class="right-box">
|
||||
<el-button @click="saveDraftFun()">保存草稿</el-button>
|
||||
<el-button v-if="operationType !== FLOW_OPERATION_TYPE.UPGRADE" @click="saveDraftFun()">保存草稿</el-button>
|
||||
<el-button type="primary" @click="openApproveDiaFun">提交评审</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,7 +47,9 @@
|
||||
:graph="graph"
|
||||
:nodeRelation="nodeRelation"
|
||||
:flowDetail="flowDetail"
|
||||
:operationType="operationType"
|
||||
@saveDraft="saveDraftFun"
|
||||
:templateVersion="templateVersion"
|
||||
></ApproveDialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -61,7 +63,7 @@ import { queryFlowTemplateDetailApi, queryFlowTemplateVersionApi, updateFlowTemp
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { FLOW_CREATE_ID, initGraph } from './components/initGraph';
|
||||
import ApproveDialog from './components/approveDialog.vue';
|
||||
import { FLOW_APPROVE_MAP } from '@/utils/enum/flow';
|
||||
import { FLOW_APPROVE_MAP, FLOW_OPERATION_TYPE } from '@/utils/enum/flow';
|
||||
import { getRelationNodeAndVerifyFlowFun } from './components/flow';
|
||||
import { cancelKeyboardEvents } from './components/keyboard';
|
||||
|
||||
@@ -70,6 +72,17 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
// operationType: {
|
||||
// type: FLOW_OPERATION_TYPE,
|
||||
// },
|
||||
templateVersion: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
operationType: {
|
||||
type: String,
|
||||
default: FLOW_OPERATION_TYPE.CREATE,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['goBack']);
|
||||
|
||||
@@ -9,7 +9,20 @@
|
||||
@close="closeFun"
|
||||
show-footer
|
||||
>
|
||||
<TableForm ref="tableFormRef" tableName="SIMULATION_FLOW_LIB_LIST" />
|
||||
<TableForm
|
||||
ref="tableFormRef"
|
||||
tableName="SIMULATION_FLOW_LIB_LIST"
|
||||
:showDisabled="dialogType === 'upgrade'"
|
||||
>
|
||||
<template #form-templateVersion>
|
||||
<div>
|
||||
{{ dialogType === FLOW_OPERATION_TYPE.CREATE?'V1.0':
|
||||
dialogType === FLOW_OPERATION_TYPE.EDIT?templateVersion:
|
||||
dialogType === FLOW_OPERATION_TYPE.UPGRADE?templateVersion:'V1.0'
|
||||
}}
|
||||
</div>
|
||||
</template>
|
||||
</TableForm>
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="closeFun">取消</el-button>
|
||||
@@ -27,11 +40,13 @@ import { computed, nextTick, ref } from 'vue';
|
||||
import TableForm from '@/components/common/table/tableForm.vue';
|
||||
import { addFlowTemplateDraftApi, updateFlowTemplateDraftApi } from '@/api/capability/flow';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { FLOW_OPERATION_TYPE } from '@/utils/enum/flow';
|
||||
|
||||
const props = defineProps<{
|
||||
showDialog: boolean;
|
||||
dialogType: string;
|
||||
dialogType: FLOW_OPERATION_TYPE;
|
||||
flowContent: any;
|
||||
templateVersion: string;
|
||||
}>();
|
||||
|
||||
const tableFormRef = ref();
|
||||
@@ -57,21 +72,21 @@ const confirmFun = async (type:string) => {
|
||||
if (await tableFormRef.value.validateFun()) {
|
||||
loadingInterface.value = true;
|
||||
const flowForm = tableFormRef.value.getFormDataFun();
|
||||
if (props.dialogType === 'create' || props.dialogType === 'copy') {
|
||||
if (props.dialogType === 'copy') {
|
||||
if (props.dialogType === FLOW_OPERATION_TYPE.CREATE || props.dialogType === FLOW_OPERATION_TYPE.COPY) {
|
||||
if (props.dialogType === FLOW_OPERATION_TYPE.COPY) {
|
||||
flowForm.viewContent = props.flowContent.viewContent;
|
||||
flowForm.templateContent = props.flowContent.templateContent;
|
||||
}
|
||||
const flowRes = await createFlow(flowForm);
|
||||
emits('confirm', { type, uuid: flowRes.uuid });
|
||||
if (flowRes?.uuid) {
|
||||
emits('confirm', { type, uuid: flowRes.uuid });
|
||||
}
|
||||
} else {
|
||||
// console.log('编辑项目', projectForm);
|
||||
await editFlow(flowForm);
|
||||
emits('confirm', { type, uuid: flowForm.uuid });
|
||||
}
|
||||
loadingInterface.value = false;
|
||||
|
||||
closeFun();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -87,6 +102,7 @@ const createFlow = async(params: any) => {
|
||||
const res:any = await addFlowTemplateDraftApi(params);
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success('创建流程成功!');
|
||||
closeFun();
|
||||
return res.data;
|
||||
} else {
|
||||
ElMessage.error(res.msg || '创建流程失败');
|
||||
@@ -108,10 +124,13 @@ const editFlow = async(params: any) => {
|
||||
if (editFlag) {
|
||||
const res:any = await updateFlowTemplateDraftApi(params);
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success('编辑流程基本属性成功!');
|
||||
ElMessage.success('更新流程基本属性成功!');
|
||||
closeFun();
|
||||
} else {
|
||||
ElMessage.error(res.msg || '编辑流程基本属性失败!');
|
||||
}
|
||||
} else {
|
||||
closeFun();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="btn-box">...</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="openDiaFun('edit', flow)">重命名</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDiaFun(FLOW_OPERATION_TYPE.EDIT, flow)">重命名</el-dropdown-item>
|
||||
<el-dropdown-item @click="goFlowDetailFun(flow.uuid)">编辑</el-dropdown-item>
|
||||
<el-dropdown-item v-if="flow.templateStatus === FLOW_USE_STATUS.USED" @click="changeFlowStatusMessageBox(flow.uuid,FLOW_USE_STATUS.STOP)">
|
||||
<span class="flow-delete-btn">弃用</span>
|
||||
@@ -75,7 +75,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #leftOptions>
|
||||
<el-button v-if="flowType !== FLOW_TEMPLATE_PUBLIC_STATUS.PUBLIC" icon="plus" @click="openDiaFun('create')" type="primary">
|
||||
<el-button v-if="flowType !== FLOW_TEMPLATE_PUBLIC_STATUS.PUBLIC" icon="plus" @click="openDiaFun(FLOW_OPERATION_TYPE.CREATE)" type="primary">
|
||||
{{ $t('项目列表.新增') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -92,7 +92,7 @@
|
||||
row.approveType === FLOW_APPROVE_STATUS_ENUM.APPROVING?
|
||||
'dot dot-approving approving':
|
||||
row.approveType === FLOW_APPROVE_STATUS_ENUM.APPROVED?
|
||||
'dot dot-success':'dot-refuse'"
|
||||
'dot dot-success':'dot dot-refuse'"
|
||||
>.</span>
|
||||
<span
|
||||
:class="row.approveType !== FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED?'approving-span':''"
|
||||
@@ -131,11 +131,14 @@
|
||||
:dialogType="dialogType"
|
||||
@confirm="addOrEditFun"
|
||||
:flowContent="copyFlowContent"
|
||||
:templateVersion="templateVersion"
|
||||
></addDialog>
|
||||
<flowCreate
|
||||
v-if="showFlowDetailVisible"
|
||||
:flowUuid="flowUuid"
|
||||
@goBack="showFlowDetailVisible = false"
|
||||
:operationType="dialogType"
|
||||
:templateVersion="templateVersion"
|
||||
></flowCreate>
|
||||
<flowViewDialog
|
||||
v-if="showFlowViewVisible"
|
||||
@@ -146,14 +149,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
import { useDict } from '@/utils/useDict';
|
||||
import addDialog from './components/addDialog.vue';
|
||||
import flowCreate from '@/views/simulation/creation/index.vue';
|
||||
import { deleteFlowTemplateDraftApi, queryFlowTemplateApi, updateFlowTemplateUseStatusApi } from '@/api/capability/flow';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { FLOW_APPROVE_STATUS_ENUM, FLOW_TEMPLATE_PUBLIC_STATUS, FLOW_USE_STATUS } from '@/utils/enum/flow';
|
||||
import { FLOW_APPROVE_STATUS_ENUM, FLOW_OPERATION_TYPE, FLOW_TEMPLATE_PUBLIC_STATUS, FLOW_USE_STATUS } from '@/utils/enum/flow';
|
||||
import flowViewDialog from '@/components/common/flow/flowViewDialog.vue';
|
||||
import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
|
||||
|
||||
@@ -174,12 +177,14 @@ const { FLOW_APPROVE_STATUS, FLOW_USE_TYPE } = useDict('FLOW_APPROVE_STATUS', 'F
|
||||
|
||||
const showDialog = ref(false);
|
||||
|
||||
const dialogType = ref('create'); // create 编辑 edit
|
||||
const dialogType = ref<FLOW_OPERATION_TYPE>(FLOW_OPERATION_TYPE.CREATE); // create 编辑 edit
|
||||
|
||||
const viewType = ref('list');
|
||||
|
||||
const addDiaRef = ref();
|
||||
|
||||
const templateVersion = ref('');
|
||||
|
||||
const actionList = ref<any>([
|
||||
{
|
||||
title: '预览',
|
||||
@@ -200,10 +205,20 @@ const actionList = ref<any>([
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
// goFlowDetailFun(row.uuid);
|
||||
openDiaFun('edit', row);
|
||||
openDiaFun(FLOW_OPERATION_TYPE.EDIT, row);
|
||||
},
|
||||
hide: (row: any) => {
|
||||
return row.approveType === FLOW_APPROVE_STATUS_ENUM.APPROVING;
|
||||
return row.approveType === FLOW_APPROVE_STATUS_ENUM.APPROVING || row.approveType === FLOW_APPROVE_STATUS_ENUM.APPROVED;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '升版',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
upgradeFlowFun( row);
|
||||
},
|
||||
hide: (row: any) => {
|
||||
return row.approveType !== FLOW_APPROVE_STATUS_ENUM.APPROVED;
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -251,16 +266,17 @@ const actionList = ref<any>([
|
||||
},
|
||||
]);
|
||||
|
||||
const openDiaFun = (tag: string, row?: any) => {
|
||||
const openDiaFun = (tag: FLOW_OPERATION_TYPE, row?: any) => {
|
||||
dialogType.value = tag;
|
||||
showDialog.value = true;
|
||||
console.log('addDiaRef.value', addDiaRef.value);
|
||||
if (tag === 'create') {
|
||||
nextTick(() => {
|
||||
addDiaRef.value.resetForm();
|
||||
});
|
||||
if (tag === FLOW_OPERATION_TYPE.CREATE) {
|
||||
// nextTick(() => {
|
||||
addDiaRef.value.resetForm();
|
||||
// });
|
||||
} else {
|
||||
if (row) {
|
||||
templateVersion.value = row.templateVersion;
|
||||
// 待优化
|
||||
// setTimeout(() => {
|
||||
// nextTick(() => {
|
||||
@@ -284,6 +300,7 @@ const addOrEditFun = ({ type, uuid }:any) => {
|
||||
flowUuid.value = uuid;
|
||||
if (type === 'next') {
|
||||
goFlowDetailFun(uuid);
|
||||
showDialog.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -378,9 +395,19 @@ const copyFlowContent = reactive({
|
||||
});
|
||||
const copyFlowFun = (flow:any) => {
|
||||
showDialog.value = true;
|
||||
dialogType.value = 'copy';
|
||||
dialogType.value = FLOW_OPERATION_TYPE.COPY;
|
||||
copyFlowContent.viewContent = flow.viewContent;
|
||||
copyFlowContent.templateContent = flow.templateContent;
|
||||
addDiaRef.value.setEditForm({ });
|
||||
|
||||
};
|
||||
|
||||
const upgradeFlowFun = (flow:any) => {
|
||||
showDialog.value = true;
|
||||
dialogType.value = FLOW_OPERATION_TYPE.UPGRADE;
|
||||
addDiaRef.value.setEditForm({ ...flow });
|
||||
templateVersion.value = flow.templateVersion;
|
||||
|
||||
};
|
||||
|
||||
const flowType = ref<string>(FLOW_TEMPLATE_PUBLIC_STATUS.PRIVATE);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
v-model="formVisible"
|
||||
:loading="loadingInterface"
|
||||
:diaTitle="isCreateDialog?'创建需求':'编辑需求'"
|
||||
:width="500"
|
||||
:width="800"
|
||||
:height="500"
|
||||
@close="closeFun"
|
||||
show-footer
|
||||
@@ -42,6 +42,7 @@
|
||||
@change="changeFun($event,'form')"
|
||||
@remove="removeFileFun"
|
||||
@load="loadTableForm"
|
||||
:colNum="2"
|
||||
>
|
||||
<slot name="tableFormSlot"></slot>
|
||||
</TableForm>
|
||||
@@ -234,7 +235,8 @@ const createDemandApiFun = async(fromData:any) => {
|
||||
};
|
||||
const res:any = await addDemandApi(params);
|
||||
if (res.code === 200) {
|
||||
formVisible.value = true;
|
||||
formVisible.value = false;
|
||||
ElMessage.success('创建成功');
|
||||
return res.data;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user