|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<script setup> |
|
|
|
|
import {onBeforeMount, ref, computed} from "vue"; |
|
|
|
|
import {useStore} from "vuex"; |
|
|
|
|
import {get_git_ver, get_update_option, handle_update} from "@/apis/update.js" |
|
|
|
|
import {get_git_ver, get_update_alter, get_update_option, handle_update} from "@/apis/update.js" |
|
|
|
|
import Tips from "@/components/update/Tips.vue" |
|
|
|
|
import config from "@/request/config.js" |
|
|
|
|
import ProcessIcon from "@/components/update/ProcessIcon.vue"; |
|
|
|
@ -16,6 +16,10 @@ const props = defineProps({ |
|
|
|
|
type: String, |
|
|
|
|
default: '' |
|
|
|
|
}, |
|
|
|
|
ver_id: { |
|
|
|
|
type: Number, |
|
|
|
|
default: 0 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// 配置状态 |
|
|
|
@ -153,6 +157,23 @@ onBeforeMount(async () => { |
|
|
|
|
}) |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 获取升级警告 |
|
|
|
|
const updateAlter = ref([]) |
|
|
|
|
onBeforeMount( |
|
|
|
|
async () => { |
|
|
|
|
await get_update_alter().then( |
|
|
|
|
res => { |
|
|
|
|
if (Array.isArray(res)) { |
|
|
|
|
updateAlter.value = [...res] |
|
|
|
|
console.log(updateAlter.value) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
).catch(err => { |
|
|
|
|
console.log(err) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// region 获取升级命令的功能 |
|
|
|
|
const updateCmd = ref({setup: [], teardown: [], sql: [], config: [], client: []}) |
|
|
|
|
|
|
|
|
@ -188,6 +209,38 @@ onBeforeMount( |
|
|
|
|
) |
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
// region 处理版本依赖 |
|
|
|
|
let selectedVerId = ref('9999') |
|
|
|
|
|
|
|
|
|
const handleChangeVersion = () => { |
|
|
|
|
git_ver.value.forEach( |
|
|
|
|
(item, index) => { |
|
|
|
|
if (item.short_release === selectedVersion.value) { |
|
|
|
|
selectedVerId.value = item.ver_id |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// 切换版本事件 |
|
|
|
|
const changeVersion = () => { |
|
|
|
|
handleChangeVersion() |
|
|
|
|
handleUpdateAlter() |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 处理版本警告 |
|
|
|
|
const handleUpdateAlter = () => { |
|
|
|
|
updateAlter.value.forEach( |
|
|
|
|
(item, index) => { |
|
|
|
|
if (selectedVerId.value < item.ver_id && props.ver_id >= item.ver_id) { |
|
|
|
|
alert("当前版本为" + props.ver_id + ":" + item.alter) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// region 处理按键文案 |
|
|
|
|
let updateBtn = ref("更新") |
|
|
|
|
const handleBtnName = (ip) => { |
|
|
|
@ -333,7 +386,7 @@ const handleUpdate = async () => { |
|
|
|
|
:close-on-click-modal="false" @opened="handleOpened" @close="handleClose"> |
|
|
|
|
<div><span class="update">更新单机:</span><span class="ip">{{ ip }}</span><span>目标版本:</span> |
|
|
|
|
|
|
|
|
|
<el-select v-model="selectedVersion" :disabled="disableAll"> |
|
|
|
|
<el-select v-model="selectedVersion" :disabled="disableAll" @change="changeVersion"> |
|
|
|
|
<el-option v-for="ver in git_ver" :label="ver.short_release" :value="ver.short_release" |
|
|
|
|
:key="ver.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
@ -346,7 +399,7 @@ const handleUpdate = async () => { |
|
|
|
|
<ProcessIcon v-if="showStatusTips" class="process_icon" |
|
|
|
|
:exec-status="updateStatus.setup"/> |
|
|
|
|
</el-divider> |
|
|
|
|
<el-checkbox v-for="cmd in updateCmd.setup" :label="cmd.id" :key="cmd.id" |
|
|
|
|
<el-checkbox v-for="cmd in updateCmd.setup" v-if="true" :label="cmd.id" :key="cmd.id" |
|
|
|
|
:checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }} |
|
|
|
|
<tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips> |
|
|
|
|
</el-checkbox> |
|
|
|
@ -374,10 +427,12 @@ const handleUpdate = async () => { |
|
|
|
|
<ProcessIcon v-if="showStatusTips" class="process_icon" |
|
|
|
|
:exec-status="updateStatus.config"/> |
|
|
|
|
</el-divider> |
|
|
|
|
<el-checkbox v-for="cmd in updateCmd.config" :label="cmd.id" :key="cmd.id" |
|
|
|
|
:checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }} |
|
|
|
|
<tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips> |
|
|
|
|
</el-checkbox> |
|
|
|
|
<template v-for="cmd in updateCmd.config"> |
|
|
|
|
<el-checkbox v-if="selectedVerId >= cmd.ver_id" :label="cmd.id" :key="cmd.id" |
|
|
|
|
:checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }} |
|
|
|
|
<tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips> |
|
|
|
|
</el-checkbox> |
|
|
|
|
</template> |
|
|
|
|
<el-divider content-position="left"> |
|
|
|
|
<span class="cmd_label">客户端</span> |
|
|
|
|
<ProcessIcon v-if="showStatusTips" class="process_icon" |
|
|
|
|