1. 增加设置更具目标版本变化而变化的逻辑

2. 增加降级时的警告提示
main
RogerWork 9 months ago
parent e8007b9fde
commit 68192d12d2
  1. 6
      src/apis/update.js
  2. 69
      src/components/update/CinemaUpdate.vue
  3. 4
      src/components/update/ProcessIcon.vue
  4. 10
      src/views/update/index.vue

@ -61,6 +61,12 @@ export const get_git_ver = () => {
})
}
export const get_update_alter = () => {
return request({
url: `/update/update_alter/`,
method: 'get',
})
}
export const handle_update = (params) => {
return request({

@ -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"

@ -12,9 +12,9 @@ const props = defineProps({
<!-- :content="props.execStatus.msg"-->
<template>
<el-popover
placement="top-start"
placement="right-start"
title='执行结果'
width="400"
width="600"
trigger="hover"
>
<div class="content" v-html="props.execStatus.msg">

@ -143,10 +143,12 @@ const cinemaUserChange = (user, id) => {
// region
const update_ip = ref('')
const ver_id = ref(0)
const changeDialogStatus = (val) => {
const changeDialogStatus = (ip, ver) => {
store.state.update_dialog_show = true
update_ip.value = val
update_ip.value = ip
ver_id.value = ver
}
// endregion
@ -184,7 +186,7 @@ const changeDialogStatus = (val) => {
<el-table-column prop="update_time" label="最后查询时间" min-width="180"></el-table-column>
<el-table-column prop="ip" label="操作" min-width="80">
<template v-slot="scope">
<el-button type="info" size="small" @click="changeDialogStatus(scope.row.ip)">更新</el-button>
<el-button type="info" size="small" @click="changeDialogStatus(scope.row.ip, scope.row.ver_id)">更新</el-button>
</template>
</el-table-column>
<el-table-column prop="selectedUser" label="当前使用人" min-width="120">
@ -215,7 +217,7 @@ const changeDialogStatus = (val) => {
<el-table-column prop="db_user" label="数据库账号" min-width="100"></el-table-column>
<el-table-column prop="db_pwd" label="数据库密码" min-width="120"></el-table-column>
</el-table>
<CinemaUpdate :ip="update_ip"></CinemaUpdate>
<CinemaUpdate :ip="update_ip" :ver_id="ver_id"></CinemaUpdate>
</template>

Loading…
Cancel
Save