1. 增加设置类型

2. 增加设置提示
3. 维护错误提示逻辑
main
RogerWork 10 months ago
parent 6df1cc069c
commit 63676e4d2a
  1. 38
      src/components/update/CinemaUpdate.vue
  2. 40
      src/components/update/Tips.vue
  3. 2
      src/views/update/index.vue

@ -3,6 +3,7 @@ import {computed, ref, watch} from "vue";
import {onBeforeMount, onUnmounted, onMounted, onBeforeUnmount} from "vue"; import {onBeforeMount, onUnmounted, onMounted, onBeforeUnmount} from "vue";
import {mapState, useStore} from "vuex"; import {mapState, useStore} from "vuex";
import {get_git_ver, get_update_option, handle_update} from "@/apis/update.js" import {get_git_ver, get_update_option, handle_update} from "@/apis/update.js"
import Tips from "@/components/update/Tips.vue"
// store // store
const store = useStore() const store = useStore()
@ -29,7 +30,7 @@ onBeforeMount(async () => {
// endregion // endregion
// region // region
const updateCmd = ref({setup: [], teardown: [], sql: [], client: []}) const updateCmd = ref({setup: [], teardown: [], sql: [], config: [], client: []})
onBeforeMount( onBeforeMount(
async () => { async () => {
@ -37,6 +38,7 @@ onBeforeMount(
// //
if (Array.isArray(res)) { if (Array.isArray(res)) {
console.log(res)
res.forEach( res.forEach(
(value, index) => { (value, index) => {
if (value.process === "setup") { if (value.process === "setup") {
@ -48,6 +50,9 @@ onBeforeMount(
if (value.process === "sql") { if (value.process === "sql") {
updateCmd.value.sql.push(value) updateCmd.value.sql.push(value)
} }
if (value.process === "config") {
updateCmd.value.config.push(value)
}
if (value.process === "client") { if (value.process === "client") {
updateCmd.value.client.push(value) updateCmd.value.client.push(value)
} }
@ -160,23 +165,30 @@ const handleUpdate = async () => {
} }
await handle_update(params).then(res => { await handle_update(params).then(res => {
const res_data = JSON.parse(JSON.stringify(res))
const res_ip = res_data["ip"]
// //
const ip = JSON.parse(JSON.stringify(res))["ip"] if (res_data["result"] === "success") {
handleRep(ip) handleRep(res_ip)
store.commit("clear_update_status", ip) // store.commit("clear_update_status", res_ip) //
}
if (res_data["result"] === "fail") {
alert(res_ip + ' 升级失败:' + res_data["msg"])
handleRep(res_ip)
store.commit("clear_update_status", res_ip) //
}
}).catch(err => { }).catch(err => {
const ip = err.config.params.ip const ip = err.config.params.ip
handleRep(ip) handleRep(ip)
store.commit("clear_update_status", ip) // store.commit("clear_update_status", ip) //
alert("升级失败,请重试!") alert(ip + " 升级失败,请重试!")
}) })
} }
// endregion // endregion
</script> </script>
<template> <template>
<el-dialog v-model="store.state.update_dialog_show" title="更新影院" :modal="true" width="720px" <el-dialog v-model="store.state.update_dialog_show" title="更新影院" :modal="true" width="720px"
:close-on-click-modal="false" @opened="handleOpened" @close="handleClose"> :close-on-click-modal="false" @opened="handleOpened" @close="handleClose">
@ -195,24 +207,36 @@ const handleUpdate = async () => {
</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" :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>
</el-checkbox> </el-checkbox>
<el-divider content-position="left"> <el-divider content-position="left">
<span class="cmd_label">数据库</span> <span class="cmd_label">数据库</span>
</el-divider> </el-divider>
<el-checkbox v-for="cmd in updateCmd.sql" :label="cmd.id" :key="cmd.id" <el-checkbox v-for="cmd in updateCmd.sql" :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>
</el-checkbox> </el-checkbox>
<el-divider content-position="left"> <el-divider content-position="left">
<span class="cmd_label">执行升级</span> <span class="cmd_label">执行升级</span>
</el-divider> </el-divider>
<el-checkbox v-for="cmd in updateCmd.teardown" :label="cmd.id" :key="cmd.id" <el-checkbox v-for="cmd in updateCmd.teardown" :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>
</el-checkbox>
<el-divider content-position="left">
<span class="cmd_label">修改设置</span>
</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> </el-checkbox>
<el-divider content-position="left"> <el-divider content-position="left">
<span class="cmd_label">客户端</span> <span class="cmd_label">客户端</span>
</el-divider> </el-divider>
<el-checkbox v-for="cmd in updateCmd.client" :label="cmd.id" :key="cmd.id" <el-checkbox v-for="cmd in updateCmd.client" :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>
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>

@ -0,0 +1,40 @@
<script setup>
import {InfoFilled} from "@element-plus/icons-vue";
const props = defineProps({
title:{
type: String,
default: '说明'
},
width:{
type: Number,
default: 400
},
content: {
type: String,
default: ''
}
})
</script>
<template>
<el-popover
placement="top-start"
:title=props.title
:width=props.width
trigger="hover"
:content=props.content
>
<template #reference>
<el-icon>
<InfoFilled/>
</el-icon>
</template>
</el-popover>
</template>
<style scoped>
</style>

@ -211,7 +211,7 @@ const changeDialogStatus = (val) => {
<el-table-column prop="sys_ver" label="系统版本" min-width="175"></el-table-column> <el-table-column prop="sys_ver" label="系统版本" min-width="175"></el-table-column>
<el-table-column prop="client_ver" label="客户端版本" min-width="150"></el-table-column> <el-table-column prop="client_ver" label="客户端版本" min-width="150"></el-table-column>
<el-table-column prop="is_cloud" label="云版本" min-width="80"></el-table-column> <el-table-column prop="is_cloud" label="云版本" min-width="80"></el-table-column>
<el-table-column prop="remote_label" label="远程办公识别码" min-width="200" class-name="remote"></el-table-column> <el-table-column prop="remote_label" label="远程办公识别码" min-width="160" class-name="remote"></el-table-column>
<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>

Loading…
Cancel
Save