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) => { export const handle_update = (params) => {
return request({ return request({

@ -1,7 +1,7 @@
<script setup> <script setup>
import {onBeforeMount, ref, computed} from "vue"; import {onBeforeMount, ref, computed} from "vue";
import {useStore} from "vuex"; 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 Tips from "@/components/update/Tips.vue"
import config from "@/request/config.js" import config from "@/request/config.js"
import ProcessIcon from "@/components/update/ProcessIcon.vue"; import ProcessIcon from "@/components/update/ProcessIcon.vue";
@ -16,6 +16,10 @@ const props = defineProps({
type: String, type: String,
default: '' default: ''
}, },
ver_id: {
type: Number,
default: 0
}
}) })
// //
@ -153,6 +157,23 @@ onBeforeMount(async () => {
}) })
// endregion // 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 // region
const updateCmd = ref({setup: [], teardown: [], sql: [], config: [], client: []}) const updateCmd = ref({setup: [], teardown: [], sql: [], config: [], client: []})
@ -188,6 +209,38 @@ onBeforeMount(
) )
//endregion //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 // region
let updateBtn = ref("更新") let updateBtn = ref("更新")
const handleBtnName = (ip) => { const handleBtnName = (ip) => {
@ -333,7 +386,7 @@ const handleUpdate = async () => {
:close-on-click-modal="false" @opened="handleOpened" @close="handleClose"> :close-on-click-modal="false" @opened="handleOpened" @close="handleClose">
<div><span class="update">更新单机</span><span class="ip">{{ ip }}</span><span>目标版本</span> <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" <el-option v-for="ver in git_ver" :label="ver.short_release" :value="ver.short_release"
:key="ver.id"></el-option> :key="ver.id"></el-option>
</el-select> </el-select>
@ -346,7 +399,7 @@ const handleUpdate = async () => {
<ProcessIcon v-if="showStatusTips" class="process_icon" <ProcessIcon v-if="showStatusTips" class="process_icon"
:exec-status="updateStatus.setup"/> :exec-status="updateStatus.setup"/>
</el-divider> </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 }} :checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }}
<tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips> <tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips>
</el-checkbox> </el-checkbox>
@ -374,10 +427,12 @@ const handleUpdate = async () => {
<ProcessIcon v-if="showStatusTips" class="process_icon" <ProcessIcon v-if="showStatusTips" class="process_icon"
:exec-status="updateStatus.config"/> :exec-status="updateStatus.config"/>
</el-divider> </el-divider>
<el-checkbox v-for="cmd in updateCmd.config" :label="cmd.id" :key="cmd.id" <template v-for="cmd in updateCmd.config">
:checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }} <el-checkbox v-if="selectedVerId >= cmd.ver_id" :label="cmd.id" :key="cmd.id"
<tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips> :checked="cmd.is_checked" :disabled="cmd.is_force">{{ cmd.desc }}
</el-checkbox> <tips v-if="cmd.comment !==''" title="设置说明" :width="400" :content="cmd.comment"></tips>
</el-checkbox>
</template>
<el-divider content-position="left"> <el-divider content-position="left">
<span class="cmd_label">客户端</span> <span class="cmd_label">客户端</span>
<ProcessIcon v-if="showStatusTips" class="process_icon" <ProcessIcon v-if="showStatusTips" class="process_icon"

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

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

Loading…
Cancel
Save