diff --git a/dashboard/src2/components/JsiteServerOverview.vue b/dashboard/src2/components/JsiteServerOverview.vue
index fda9e3f..d73b20e 100644
--- a/dashboard/src2/components/JsiteServerOverview.vue
+++ b/dashboard/src2/components/JsiteServerOverview.vue
@@ -87,7 +87,58 @@
+
+
+
+
{{ info.value }}
+
+
+
+
+
+
+
+
+
+
{{ info.value }}
@@ -239,6 +290,9 @@ export default {
resetSystemLoading: false,
upgradeLoading: false,
copySuccess: false,
+ editingServerName: false,
+ editServerNameValue: '',
+ saveServerNameLoading: false,
};
},
methods: {
@@ -514,6 +568,78 @@ export default {
// 刷新服务器数据
this.$jsiteServer.reload();
},
+ startEditServerName() {
+ this.editServerNameValue = this.$jsiteServer.pg?.title || this.$jsiteServer.pg?.name || '';
+ this.editingServerName = true;
+ this.$nextTick(() => {
+ const input = this.$refs.serverNameInput;
+ if (input && typeof input.focus === 'function') {
+ input.focus();
+ if (typeof input.select === 'function') {
+ input.select();
+ }
+ }
+ });
+ },
+ cancelEditServerName() {
+ this.editingServerName = false;
+ this.editServerNameValue = '';
+ },
+ handleInputBlur() {
+ // 延迟处理,防止点击按钮时触发
+ setTimeout(() => {
+ if (this.editingServerName && !this.saveServerNameLoading) {
+ this.saveServerName();
+ }
+ }, 150);
+ },
+ async saveServerName() {
+ if (this.saveServerNameLoading) return;
+
+ const newName = this.editServerNameValue.trim();
+ if (!newName) {
+ toast.error('服务器名称不能为空');
+ return;
+ }
+
+ if (newName.length < 2) {
+ toast.error('服务器名称至少需要2个字符');
+ return;
+ }
+
+ if (newName.length > 100) {
+ toast.error('服务器名称不能超过100个字符');
+ return;
+ }
+
+ if (newName === (this.$jsiteServer.pg?.title || this.$jsiteServer.pg?.name)) {
+ this.cancelEditServerName();
+ return;
+ }
+
+ this.saveServerNameLoading = true;
+
+ try {
+ this.$jsiteServer.setValue.submit(
+ { title: newName },
+ {
+ onSuccess: () => {
+ toast.success('服务器名称已更新');
+ this.editingServerName = false;
+ this.editServerNameValue = '';
+ this.saveServerNameLoading = false;
+ },
+ onError: (error) => {
+ toast.error(getToastErrorMessage(error));
+ this.saveServerNameLoading = false;
+ }
+ }
+ );
+ } catch (error) {
+ toast.error('更新失败,请重试');
+ this.saveServerNameLoading = false;
+ }
+ },
},
computed: {
serverInformation() {