Merge branch 'master' of https://github.com/AstrBotDevs/AstrBot
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-dialog v-model="showDialog" max-width="800px" height="90%">
|
<v-dialog v-model="showDialog" max-width="800px" height="90%" @after-enter="prepareData">
|
||||||
<v-card
|
<v-card
|
||||||
:title="updatingMode ? `${tm('dialog.edit')} ${updatingPlatformConfig.id} ${tm('dialog.adapter')}` : tm('dialog.addPlatform')">
|
:title="updatingMode ? `${tm('dialog.edit')} ${updatingPlatformConfig.id} ${tm('dialog.adapter')}` : tm('dialog.addPlatform')">
|
||||||
<v-card-text class="pa-4 ml-2" style="overflow-y: auto;">
|
<v-card-text class="pa-4 ml-2" style="overflow-y: auto;">
|
||||||
@@ -145,32 +145,38 @@
|
|||||||
添加路由规则
|
添加路由规则
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
<v-btn :color="isEditingRoutes ? 'grey' : 'primary'" variant="tonal" size="small" @click="toggleEditMode">
|
<v-btn :color="isEditingRoutes ? 'grey' : 'primary'" variant="tonal" size="small"
|
||||||
|
@click="toggleEditMode">
|
||||||
<v-icon start>{{ isEditingRoutes ? 'mdi-eye' : 'mdi-pencil' }}</v-icon>
|
<v-icon start>{{ isEditingRoutes ? 'mdi-eye' : 'mdi-pencil' }}</v-icon>
|
||||||
{{ isEditingRoutes ? '查看' : '编辑' }}
|
{{ isEditingRoutes ? '查看' : '编辑' }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-data-table :headers="routeTableHeaders" :items="platformRoutes" item-value="umop"
|
<v-data-table :headers="routeTableHeaders" :items="platformRoutes" item-value="umop"
|
||||||
no-data-text="该平台暂无路由规则,将使用默认配置文件" hide-default-footer :items-per-page="-1" class="mt-2" variant="outlined">
|
no-data-text="该平台暂无路由规则,将使用默认配置文件" hide-default-footer :items-per-page="-1" class="mt-2"
|
||||||
|
variant="outlined">
|
||||||
|
|
||||||
<template v-slot:item.source="{ item }">
|
<template v-slot:item.source="{ item }">
|
||||||
<div class="d-flex align-center" style="min-width: 250px;">
|
<div class="d-flex align-center" style="min-width: 250px;">
|
||||||
<v-select v-if="isEditingRoutes" v-model="item.messageType" :items="messageTypeOptions" item-title="label" item-value="value"
|
<v-select v-if="isEditingRoutes" v-model="item.messageType" :items="messageTypeOptions"
|
||||||
variant="outlined" density="compact" hide-details style="max-width: 120px;" class="mr-2">
|
item-title="label" item-value="value" variant="outlined" density="compact" hide-details
|
||||||
|
style="max-width: 120px;" class="mr-2">
|
||||||
</v-select>
|
</v-select>
|
||||||
<span v-else class="mr-2">{{ getMessageTypeLabel(item.messageType) }}</span>
|
<span v-else class="mr-2">{{ getMessageTypeLabel(item.messageType) }}</span>
|
||||||
<span class="mx-1">:</span>
|
<span class="mx-1">:</span>
|
||||||
<v-text-field v-if="isEditingRoutes" v-model="item.sessionId" variant="outlined" density="compact" hide-details
|
<v-text-field v-if="isEditingRoutes" v-model="item.sessionId" variant="outlined" density="compact"
|
||||||
placeholder="会话ID或*" style="max-width: 120px;">
|
hide-details placeholder="会话ID或*" style="max-width: 120px;">
|
||||||
</v-text-field>
|
</v-text-field>
|
||||||
<span v-else>{{ item.sessionId === '*' ? '全部会话' : item.sessionId }}</span>
|
<span v-else>{{ item.sessionId === '*' ? '全部会话' : item.sessionId }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:item.configId="{ item }">
|
<template v-slot:item.configId="{ item }">
|
||||||
<v-select v-if="isEditingRoutes" v-model="item.configId" :items="configInfoList" item-title="name" item-value="id"
|
<v-select v-if="isEditingRoutes" v-model="item.configId" :items="configInfoList" item-title="name"
|
||||||
variant="outlined" density="compact" hide-details style="min-width: 200px;">
|
item-value="id" variant="outlined" density="compact" style="min-width: 200px;"
|
||||||
|
:hide-details="configInfoList.findIndex(c => c.id === item.configId) !== -1"
|
||||||
|
:error="configInfoList.findIndex(c => c.id === item.configId) === -1"
|
||||||
|
:error-messages="configInfoList.findIndex(c => c.id === item.configId) === -1 ? '配置文件不存在' : ''">
|
||||||
</v-select>
|
</v-select>
|
||||||
<span v-else>{{ getConfigName(item.configId) }}</span>
|
<span v-else>{{ getConfigName(item.configId) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -180,7 +186,8 @@
|
|||||||
<v-btn icon size="x-small" variant="text" @click="moveRouteUp(index)" :disabled="index === 0">
|
<v-btn icon size="x-small" variant="text" @click="moveRouteUp(index)" :disabled="index === 0">
|
||||||
<v-icon>mdi-arrow-up</v-icon>
|
<v-icon>mdi-arrow-up</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon size="x-small" variant="text" @click="moveRouteDown(index)" :disabled="index === platformRoutes.length - 1">
|
<v-btn icon size="x-small" variant="text" @click="moveRouteDown(index)"
|
||||||
|
:disabled="index === platformRoutes.length - 1">
|
||||||
<v-icon>mdi-arrow-down</v-icon>
|
<v-icon>mdi-arrow-down</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon size="x-small" variant="text" color="error" @click="deleteRoute(index)">
|
<v-btn icon size="x-small" variant="text" color="error" @click="deleteRoute(index)">
|
||||||
@@ -191,7 +198,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
<small class="ml-2 mt-2 d-block">*消息下发时,根据会话来源按顺序从上到下匹配首个符合条件的配置文件。使用 * 表示匹配所有。使用 /sid 指令获取会话 ID。</small>
|
<small class="ml-2 mt-2 d-block">*消息下发时,根据会话来源按顺序从上到下匹配首个符合条件的配置文件。使用 * 表示匹配所有。使用 /sid 指令获取会话
|
||||||
|
ID。全部不匹配时将使用默认配置文件。</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -882,16 +890,17 @@ export default {
|
|||||||
toggleShowConfigSection() {
|
toggleShowConfigSection() {
|
||||||
this.showConfigSection = false;
|
this.showConfigSection = false;
|
||||||
this.showConfigSection = true;
|
this.showConfigSection = true;
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
|
prepareData() {
|
||||||
this.getConfigInfoList();
|
this.getConfigInfoList();
|
||||||
this.getConfigForPreview(this.selectedAbConfId);
|
this.getConfigForPreview(this.selectedAbConfId);
|
||||||
if (this.updatingMode && this.updatingPlatformConfig && this.updatingPlatformConfig.id) {
|
if (this.updatingMode && this.updatingPlatformConfig && this.updatingPlatformConfig.id) {
|
||||||
this.getPlatformConfigs(this.updatingPlatformConfig.id);
|
this.getPlatformConfigs(this.updatingPlatformConfig.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user