hookehuyr

fix 细节调整

Showing 1 changed file with 33 additions and 36 deletions
......@@ -319,7 +319,7 @@
<div style="position: absolute; top:20px; right: 15px;">
<el-dropdown trigger="click">
<div style="margin-left: 15px;">
<div v-if="state.flow_version === state.current_version_code" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<div v-if="state.flow_version === state.current_enable_version" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<div v-else style="width: 10px; height: 10px; background-color: #f0a800; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<span style="font-size: 13px;">流程版本 (V{{ state.flow_version }})</span>
</div>
......@@ -329,7 +329,7 @@
<i v-if="item.code === state.flow_version" class="el-icon-check" style="color: #009688; margin-right: 8px;"></i>
<div v-else style="width: 15px; height: 15px;display: inline-block; margin-right: 8px;"></div>
<span>流程版本 (V{{ item.code }})</span>
<span v-if="item.code === state.current_version_code" style="background: #edf9f1; border-color: #46c26f; color: #46c26f;font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 8px;">启用中</span>
<span v-if="item.code === state.current_enable_version" style="background: #edf9f1; border-color: #46c26f; color: #46c26f;font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 8px;">启用中</span>
<!-- <span @click="showEditFlowVersion(item.id, item.code, item.note)" style="margin-left: 10px;">
<i class="el-icon-edit-outline"></i>
</span> -->
......@@ -358,7 +358,7 @@
<template #footer>
<span class="dialog-footer">
<el-popconfirm
v-if="state.current_version_code !== state.versionForm.code"
v-if="state.current_enable_version !== state.versionForm.code"
title="是否确认启用该版本流程?"
width="220px"
confirm-button-text="确认"
......@@ -369,7 +369,7 @@
</template>
</el-popconfirm>
<el-popconfirm
v-if="state.current_version_code !== state.versionForm.code"
v-if="state.current_enable_version !== state.versionForm.code"
title="是否确认删除该版本流程?"
width="220px"
confirm-button-text="确认"
......@@ -571,7 +571,7 @@ export default {
auth_all_edit: false,
field_auths: [],
field_extend: [],
current_version_code: 0,
current_enable_version: 0,
flow_version: 0,
flow_version_list: [],
version_list: [],
......@@ -654,39 +654,35 @@ export default {
axios.get('/admin/?a=flow_version&form_id=' + form_id)
.then(res => {
if (res.data.code) {
// 启用的版本号
res.data.data.forEach((ele) => {
if (ele.status === '1') {
flow_id = ele.id;
updateUrl(flow_id); // 更新url
// 版本显示信息
state.flow_version = ele.code;
state.current_version_code = ele.code;
state.versionForm = { // 当前版本信息
code: ele.code,
id: ele.id,
note: ele.note,
type: null,
}
}
});
// 版本列表
state.version_list = res.data.data;
// 版本列表不含有启用的版本
state.flow_version_list = res.data.data.filter((ele) => {
return ele.status !== '1';
});
// 如果列表里没有启用的版本
if (state.version_list.length && !state.flow_version_list) {
let ele = state.version_list[0];
flow_id = ele.id;
updateUrl(flow_id); // 更新url
state.flow_version = ele.code;
state.versionForm = { // 当前版本信息
code: ele.code,
id: ele.id,
note: ele.note,
type: null,
if (flow_id) {
if (state.version_list.length) {
// 启用的版本号
state.version_list.forEach((ele) => {
if (ele.id === +flow_id) {
// 流程版本显示信息
state.flow_version = ele.code;
}
if (ele.status === '1') {
// 流程版本列表显示启用项
state.current_enable_version = ele.code;
}
});
}
} else {
// 如果列表里没有启用的版本获取flow_id不存在时,默认选中第一个
if (state.version_list.length) {
if (!state.flow_version_list) {
let ele = state.version_list[0];
flow_id = ele.id;
updateUrl(flow_id); // 更新url
state.flow_version = ele.code;
}
}
}
// 没有默认版本列表,自动新增流程
......@@ -722,7 +718,7 @@ export default {
// TAG: 接口获取流程图数据
const flowData = ref<any>(null);
const getFlowData = (flow_id) => {
const getFlowData = (flow_id: any) => {
flowData.value = null;
axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id)
.then(res => {
......@@ -813,12 +809,12 @@ export default {
// 版本列表
state.version_list = res.data.data;
state.version_list.forEach((ele) => {
if (ele.id === flow_id) {
if (ele.id === +flow_id) {
// 选中新增的版本
state.flow_version = ele.code;
}
if (ele.status === '1') {
state.current_version_code = ele.code;
state.current_enable_version = ele.code;
}
});
} else {
......@@ -843,7 +839,7 @@ export default {
axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm))
.then(res => {
if (res.data.code) {
state.current_version_code = state.versionForm.code;
state.current_enable_version = state.versionForm.code;
state.dialogVersionFormVisible = false;
ElMessage({
type: 'success',
......@@ -904,6 +900,7 @@ export default {
type: 'success',
message: '保存成功',
});
getVersionList(); // 刷新版本列表
} else {
ElMessage({
type: 'error',
......