Browse Source

工具页面样式修改3.0

mh
hanyuqing 3 months ago
parent
commit
2611157c44
  1. 126
      vue/src/system/GraphStyle.vue

126
vue/src/system/GraphStyle.vue

@ -270,7 +270,7 @@
<el-dialog v-model="saveDialogVisible" title="保存样式至方案" width="400px"> <el-dialog v-model="saveDialogVisible" title="保存样式至方案" width="400px">
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="所属方案"> <el-form-item label="所属方案" required>
<el-select <el-select
v-model="saveForm.group_name" v-model="saveForm.group_name"
filterable filterable
@ -282,7 +282,7 @@
<el-option v-for="g in existingGroups" :key="g.id" :label="g.group_name" :value="g.group_name"/> <el-option v-for="g in existingGroups" :key="g.id" :label="g.group_name" :value="g.group_name"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="配置名称"> <el-form-item label="配置名称" required>
<el-input v-model="saveForm.canvas_name" placeholder="请输入配置名称"/> <el-input v-model="saveForm.canvas_name" placeholder="请输入配置名称"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -304,7 +304,7 @@ import {
deleteGraphStyle, deleteGraphStyle,
batchDeleteGraphStyle, batchDeleteGraphStyle,
deleteGraphStyleGroup, deleteGraphStyleGroup,
applyGraphStyleGroup // applyGraphStyleGroup
} from '@/api/style'; } from '@/api/style';
import {ElMessageBox, ElMessage} from 'element-plus'; import {ElMessageBox, ElMessage} from 'element-plus';
import {markRaw} from 'vue'; import {markRaw} from 'vue';
@ -597,19 +597,18 @@ export default {
})) }))
})); }));
// --- --- //
this.activeCollapseNames = []; if (this.usingConfigIds.length === 0) {
this.usingConfigIds = []; this.styleGroups.forEach(group => {
if (group.is_active) {
this.styleGroups.forEach(group => { if (!this.activeCollapseNames.includes(group.id)) {
if (group.is_active) { this.activeCollapseNames.push(group.id);
// 1. }
this.activeCollapseNames.push(group.id); const ids = group.configs.map(c => c.id);
// 2. this.usingConfigIds = [...this.usingConfigIds, ...ids];
const ids = group.configs.map(c => c.id); }
this.usingConfigIds = [...this.usingConfigIds, ...ids]; });
} }
});
this.updateAllElements(); this.updateAllElements();
} }
@ -638,25 +637,63 @@ export default {
} }
this.updateAllElements(); this.updateAllElements();
}, },
/**
* 修改后的应用全案方法
* 逻辑保留当前已手动选中的配置新方案中冲突的配置不予应用
*/
async applyWholeGroup(group) { async applyWholeGroup(group) {
try { try {
// 1. // 1. 使
const currentlyUsingConfigs = [];
this.styleGroups.forEach(g => {
g.configs.forEach(c => {
if (this.usingConfigIds.includes(c.id)) {
currentlyUsingConfigs.push(c);
}
});
});
// 2. (: ['', ''])
const currentlySelectedLabels = currentlyUsingConfigs.map(c => c.current_label);
// 3.
const filteredNewConfigIds = group.configs
.filter(newConf => !currentlySelectedLabels.includes(newConf.current_label))
.map(newConf => newConf.id);
// 4. ID
this.usingConfigIds = [...this.usingConfigIds, ...filteredNewConfigIds];
// 5.
const res = await applyGraphStyleGroup(group.id); const res = await applyGraphStyleGroup(group.id);
if (res.code === 200) { if (res.code === 200) {
// 2. fetchConfigs usingConfigIds expanded // UI
await this.fetchConfigs(); await this.fetchConfigs();
ElMessage.success(`方案【${group.group_name}】已成功应用全案`); ElMessage.success(`方案【${group.group_name}】已应用,已保留您手动选择的标签`);
} }
} catch (err) { } catch (err) {
console.error(err);
ElMessage.error("应用全案失败"); ElMessage.error("应用全案失败");
} }
}, },
handleSaveClick() { handleSaveClick() {
this.fetchGroupNames(); this.fetchGroupNames();
this.saveForm.canvas_name = Date.now().toString(); this.saveForm.canvas_name = `${this.activeTags}_${Date.now()}`;
this.saveDialogVisible = true; this.saveDialogVisible = true;
}, },
async confirmSave() { async confirmSave() {
if (!this.saveForm.group_name || !this
.saveForm.group_name.trim()) {
return this.$message.warning("请选择或输入方案名称"
);
}
if (!this.saveForm.canvas_name || !this
.saveForm.canvas_name.trim()) {
return this.$message.warning("请输入配置名称"
);
}
const payload = { const payload = {
canvas_name: this.saveForm.canvas_name, canvas_name: this.saveForm.canvas_name,
group_name: this.saveForm.group_name, group_name: this.saveForm.group_name,
@ -779,30 +816,32 @@ export default {
.knowledge-graph-container { .knowledge-graph-container {
display: flex; display: flex;
height: 100vh; height: 100vh;
background-color: #f3f3f3; /* 全局背景改为 f3f3f3 */ background-color: #f3f3f3;
overflow: hidden; overflow: hidden;
} }
.control-panel { .control-panel {
width: 260px; width: 260px;
background: #ffffff; background: #ffffff;
border-right: 1px solid #e2e8f0; box-shadow: 4px 0 12px rgba(0, 0, 0, 0.08);
padding: 10px; padding: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: auto; overflow-y: auto;
flex-shrink: 0; flex-shrink: 0;
z-index: 5;
} }
.config-list-panel { .config-list-panel {
width: 320px; width: 320px;
background: #ffffff; background: #ffffff;
border-left: 1px solid #ffffff; box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
padding: 18px; padding: 18px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
z-index: 5;
} }
.panel-header-container { .panel-header-container {
@ -1037,7 +1076,8 @@ export default {
} }
.config-card:hover { .config-card:hover {
background-color: #e2e4e6 !important; background-color: #eff6ff !important;
outline: 1.5px solid #1559f3;
} }
.card-using { .card-using {
@ -1052,22 +1092,23 @@ export default {
.card-left { .card-left {
display: flex; display: flex;
flex-direction: column;
align-items: flex-start; align-items: flex-start;
flex: 1; flex: 1;
min-width: 0; min-width: 0;
gap: 8px;
} }
.checkbox-wrapper { .checkbox-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: flex-start;
margin-right: 12px; margin-right: 0;
padding-right: 10px; padding-right: 0;
border-right: 1px solid #d1d5db; border-right: none;
flex-shrink: 0; flex-shrink: 0;
height: 20px; height: auto;
} }
.config-checkbox { .config-checkbox {
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
@ -1234,6 +1275,31 @@ export default {
background-color: #1559f3 !important; background-color: #1559f3 !important;
border-color: #1559f3 !important; border-color: #1559f3 !important;
} }
:deep(.el-dialog) {
--el-color-primary: #ebf0ff !important;
--el-input-hover-border-color: #ebf0ff !important;
--el-input-focus-border-color: #ebf0ff !important;
--el-border-color-hover: #ebf0ff !important;
}
:deep(.el-dialog .el-input__wrapper) {
box-shadow: 0 0 0 1px #ebf0ff inset !important;
background-color: #ffffff !important;
}
:deep(.el-dialog .el-input.is-focus .el-input__wrapper),
:deep(.el-dialog .el-input__wrapper.is-focus),
:deep(.el-dialog .el-select .el-input__wrapper.is-focus),
:deep(.el-dialog .el-select:hover .el-input__wrapper) {
box-shadow: 0 0 0 1px #ebf0ff inset !important;
}
:deep(.el-dialog .el-input__inner) {
outline: none !important;
}
</style> </style>
<style> <style>

Loading…
Cancel
Save