|  |  |  | @ -3,6 +3,7 @@ import {computed, ref, watch} from "vue"; | 
			
		
	
		
			
				
					|  |  |  |  | import {onBeforeMount, onUnmounted, onMounted, onBeforeUnmount} from "vue"; | 
			
		
	
		
			
				
					|  |  |  |  | import {mapState, useStore} from "vuex"; | 
			
		
	
		
			
				
					|  |  |  |  | import {get_git_ver, get_update_option, handle_update} from "@/apis/update.js" | 
			
		
	
		
			
				
					|  |  |  |  | import Tips from "@/components/update/Tips.vue" | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // 注册store | 
			
		
	
		
			
				
					|  |  |  |  | const store = useStore() | 
			
		
	
	
		
			
				
					|  |  |  | @ -29,7 +30,7 @@ onBeforeMount(async () => { | 
			
		
	
		
			
				
					|  |  |  |  | // endregion | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | // region 获取升级命令的功能 | 
			
		
	
		
			
				
					|  |  |  |  | const updateCmd = ref({setup: [], teardown: [], sql: [], client: []}) | 
			
		
	
		
			
				
					|  |  |  |  | const updateCmd = ref({setup: [], teardown: [], sql: [], config: [], client: []}) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | onBeforeMount( | 
			
		
	
		
			
				
					|  |  |  |  |     async () => { | 
			
		
	
	
		
			
				
					|  |  |  | @ -37,6 +38,7 @@ onBeforeMount( | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         // 返回值处理逻辑 | 
			
		
	
		
			
				
					|  |  |  |  |         if (Array.isArray(res)) { | 
			
		
	
		
			
				
					|  |  |  |  |           console.log(res) | 
			
		
	
		
			
				
					|  |  |  |  |           res.forEach( | 
			
		
	
		
			
				
					|  |  |  |  |               (value, index) => { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (value.process === "setup") { | 
			
		
	
	
		
			
				
					|  |  |  | @ -48,6 +50,9 @@ onBeforeMount( | 
			
		
	
		
			
				
					|  |  |  |  |                 if (value.process === "sql") { | 
			
		
	
		
			
				
					|  |  |  |  |                   updateCmd.value.sql.push(value) | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 if (value.process === "config") { | 
			
		
	
		
			
				
					|  |  |  |  |                   updateCmd.value.config.push(value) | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 if (value.process === "client") { | 
			
		
	
		
			
				
					|  |  |  |  |                   updateCmd.value.client.push(value) | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
	
		
			
				
					|  |  |  | @ -160,23 +165,30 @@ const handleUpdate = async () => { | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   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"] | 
			
		
	
		
			
				
					|  |  |  |  |     handleRep(ip) | 
			
		
	
		
			
				
					|  |  |  |  |     store.commit("clear_update_status", ip)  // 清除临时状态 | 
			
		
	
		
			
				
					|  |  |  |  |     if (res_data["result"] === "success") { | 
			
		
	
		
			
				
					|  |  |  |  |       handleRep(res_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 => { | 
			
		
	
		
			
				
					|  |  |  |  |     const ip = err.config.params.ip | 
			
		
	
		
			
				
					|  |  |  |  |     handleRep(ip) | 
			
		
	
		
			
				
					|  |  |  |  |     store.commit("clear_update_status", ip)  // 清除临时状态 | 
			
		
	
		
			
				
					|  |  |  |  |     alert("升级失败,请重试!") | 
			
		
	
		
			
				
					|  |  |  |  |     alert(ip + " 升级失败,请重试!") | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   }) | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | // endregion | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | </script> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | <template> | 
			
		
	
		
			
				
					|  |  |  |  |   <el-dialog v-model="store.state.update_dialog_show" title="更新影院" :modal="true" width="720px" | 
			
		
	
		
			
				
					|  |  |  |  |              :close-on-click-modal="false" @opened="handleOpened" @close="handleClose"> | 
			
		
	
	
		
			
				
					|  |  |  | @ -195,24 +207,36 @@ const handleUpdate = async () => { | 
			
		
	
		
			
				
					|  |  |  |  |           </el-divider> | 
			
		
	
		
			
				
					|  |  |  |  |           <el-checkbox v-for="cmd in updateCmd.setup" :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-divider content-position="left"> | 
			
		
	
		
			
				
					|  |  |  |  |             <span class="cmd_label">数据库</span> | 
			
		
	
		
			
				
					|  |  |  |  |           </el-divider> | 
			
		
	
		
			
				
					|  |  |  |  |           <el-checkbox v-for="cmd in updateCmd.sql" :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-divider content-position="left"> | 
			
		
	
		
			
				
					|  |  |  |  |             <span class="cmd_label">执行升级</span> | 
			
		
	
		
			
				
					|  |  |  |  |           </el-divider> | 
			
		
	
		
			
				
					|  |  |  |  |           <el-checkbox v-for="cmd in updateCmd.teardown" :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-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-divider content-position="left"> | 
			
		
	
		
			
				
					|  |  |  |  |             <span class="cmd_label">客户端</span> | 
			
		
	
		
			
				
					|  |  |  |  |           </el-divider> | 
			
		
	
		
			
				
					|  |  |  |  |           <el-checkbox v-for="cmd in updateCmd.client" :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-group> | 
			
		
	
		
			
				
					|  |  |  |  |       </el-form-item> | 
			
		
	
	
		
			
				
					|  |  |  | 
 |