Skip to content

Commit 8ecb6a8

Browse files
fix: workflow multi-selection
1 parent e17bb8f commit 8ecb6a8

File tree

10 files changed

+332
-272
lines changed

10 files changed

+332
-272
lines changed

ui/src/components/app-icon/icons/application.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,4 +740,25 @@ export default {
740740
])
741741
},
742742
},
743+
'app-raisehand': {
744+
iconReader: () => {
745+
return h('i', [
746+
h(
747+
'svg',
748+
{
749+
style: { height: '100%', width: '100%' },
750+
viewBox: '0 0 1024 1024',
751+
version: '1.1',
752+
xmlns: 'http://www.w3.org/2000/svg',
753+
},
754+
[
755+
h('path', {
756+
d: 'M919.466667 347.733333c0-64-53.333333-117.333333-117.333334-117.333333-12.8 0-23.466667 2.133333-34.133333 4.266667-12.8-51.2-57.6-89.6-115.2-89.6-10.666667 0-21.333333 2.133333-32 4.266666v-14.933333C620.8 70.4 567.466667 17.066667 503.466667 17.066667S386.133333 70.4 386.133333 134.4v14.933333c-10.666667-2.133333-21.333333-4.266667-32-4.266666-64 0-117.333333 53.333333-117.333333 117.333333v174.933333l-4.266667-2.133333c-53.333333-34.133333-110.933333-21.333333-151.466666 4.266667-40.533333 25.6-51.2 83.2-21.333334 121.6l232.533334 300.8c61.866667 87.466667 166.4 142.933333 283.733333 142.933333 91.733333 0 177.066667-25.6 241.066667-83.2s102.4-140.8 102.4-247.466667V347.733333zM836.266667 422.4V674.133333c0 85.333333-32 145.066667-76.8 183.466667-44.8 40.533333-108.8 61.866667-185.6 61.866667-89.6 0-168.533333-42.666667-215.466667-108.8v-2.133334l-230.4-298.666666c23.466667-14.933333 42.666667-14.933333 59.733333-4.266667 2.133333 0 2.133333 2.133333 4.266667 2.133333L260.266667 554.666667c12.8 6.4 29.866667 6.4 42.666666 0 12.8-8.533333 21.333333-21.333333 21.333334-36.266667V264.533333c0-17.066667 14.933333-32 32-32s32 14.933333 32 32v234.666667c0 23.466667 19.2 42.666667 42.666666 42.666667s42.666667-19.2 42.666667-42.666667V134.4c0-17.066667 14.933333-32 32-32s32 14.933333 32 32v362.666667c0 23.466667 19.2 42.666667 42.666667 42.666666s42.666667-19.2 42.666666-42.666666v-234.666667c0-17.066667 14.933333-32 32-32s32 14.933333 32 32v236.8c0 23.466667 19.2 42.666667 42.666667 42.666667s42.666667-19.2 42.666667-42.666667V349.866667c0-17.066667 14.933333-32 32-32s32 14.933333 32 32v72.533333z',
757+
fill: 'currentColor',
758+
}),
759+
],
760+
),
761+
])
762+
},
763+
},
743764
}

ui/src/views/chat-log/component/EditContentDialog.vue

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</el-dialog>
7171
</template>
7272
<script setup lang="ts">
73-
import {ref, watch, reactive, computed, onMounted} from 'vue'
73+
import { ref, watch, reactive, computed, onMounted } from 'vue'
7474
import { useRoute } from 'vue-router'
7575
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
7676
import type { FormInstance, FormRules } from 'element-plus'
@@ -93,16 +93,27 @@ const apiType = computed(() => {
9393
}
9494
})
9595
96-
const postKnowledgeHandler = (knowledgeList: Array<any>) => {
97-
return knowledgeList.filter(item => {
96+
const postKnowledgeHandler = (knowledgeList: Array<any>) => {
97+
return knowledgeList.filter((item) => {
9898
if (apiType.value === 'workspace') {
99-
return hasPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole(),
100-
new Permission("KNOWLEDGE_DOCUMENT:READ+EDIT").getWorkspacePermissionWorkspaceManageRole,
101-
new Permission("KNOWLEDGE_DOCUMENT:READ+EDIT").getWorkspaceResourcePermission('KNOWLEDGE', item.id)], 'OR')
99+
return hasPermission(
100+
[
101+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole(),
102+
new Permission('KNOWLEDGE_DOCUMENT:READ+EDIT').getWorkspacePermissionWorkspaceManageRole,
103+
new Permission('KNOWLEDGE_DOCUMENT:READ+EDIT').getWorkspaceResourcePermission(
104+
'KNOWLEDGE',
105+
item.id,
106+
),
107+
],
108+
'OR',
109+
)
102110
} else if (apiType.value === 'systemManage') {
103-
return hasPermission([RoleConst.ADMIN, PermissionConst.RESOURCE_KNOWLEDGE_DOCUMENT_EDIT],'OR')
111+
return hasPermission(
112+
[RoleConst.ADMIN, PermissionConst.RESOURCE_KNOWLEDGE_DOCUMENT_EDIT],
113+
'OR',
114+
)
104115
}
105-
})
116+
})
106117
}
107118
108119
const emit = defineEmits(['refresh'])
@@ -202,6 +213,7 @@ function changeDocument(document_id: string) {
202213
}
203214
204215
const open = (data: any) => {
216+
getDetail()
205217
form.value.chat_id = data.chat_id
206218
form.value.record_id = data.id
207219
form.value.problem_text = data.problem_text ? data.problem_text.substring(0, 256) : ''
@@ -246,10 +258,6 @@ function getDetail(isLoading = false) {
246258
})
247259
}
248260
249-
onMounted(()=>{
250-
getDetail()
251-
})
252-
253261
defineExpose({ open })
254262
</script>
255263
<style lang="scss" scoped></style>

ui/src/views/document/tag/TagDrawer.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,19 @@ function openCreateTagDialog(row?: any) {
218218
}
219219
220220
function batchDelete() {
221-
const tagsToDelete = multipleSelection.value.map((item) => item.id)
222-
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
223-
.delMulTag(id, tagsToDelete)
221+
MsgConfirm(t('views.document.tag.deleteConfirm'), t('views.document.tag.deleteTip'), {
222+
confirmButtonText: t('common.delete'),
223+
confirmButtonClass: 'danger',
224+
})
224225
.then(() => {
225-
getList()
226+
const tagsToDelete = multipleSelection.value.map((item) => item.id)
227+
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
228+
.delMulTag(id, tagsToDelete)
229+
.then(() => {
230+
getList()
231+
})
226232
})
233+
.catch(() => {})
227234
}
228235
229236
const editTagDialogRef = ref()

ui/src/views/document/tag/TagSettingDrawer.vue

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,44 +132,26 @@ const handleSelectionChange = (val: any[]) => {
132132
}
133133
134134
function batchDelete() {
135-
MsgConfirm(t('views.document.tag.deleteConfirm'), t('views.document.tag.deleteTip'), {
136-
confirmButtonText: t('common.delete'),
137-
confirmButtonClass: 'danger',
138-
})
135+
const tagsToDelete = multipleSelection.value.reduce((acc, item) => {
136+
// 找出当前选中项的key对应的所有value id
137+
const sameKeyItems = tableData.value.filter((data) => data.key === item.key)
138+
const sameKeyIds = sameKeyItems.map((data) => data.id)
139+
return [...acc, ...sameKeyIds]
140+
}, [] as string[])
141+
142+
loadSharedApi({ type: 'document', systemType: apiType.value })
143+
.delMulDocumentTag(id, document_id.value, tagsToDelete, loading)
139144
.then(() => {
140-
const tagsToDelete = multipleSelection.value.reduce((acc, item) => {
141-
// 找出当前选中项的key对应的所有value id
142-
const sameKeyItems = tableData.value.filter((data) => data.key === item.key)
143-
const sameKeyIds = sameKeyItems.map((data) => data.id)
144-
return [...acc, ...sameKeyIds]
145-
}, [] as string[])
146-
147-
loadSharedApi({ type: 'document', systemType: apiType.value })
148-
.delMulDocumentTag(id, document_id.value, tagsToDelete, loading)
149-
.then(() => {
150-
getList()
151-
})
145+
getList()
152146
})
153-
.catch(() => {})
154147
}
155148
156149
function delTagValue(row: any) {
157-
MsgConfirm(
158-
t('views.document.tag.deleteConfirm') + row.key + '-' + row.value,
159-
t('views.document.tag.deleteTip'),
160-
{
161-
confirmButtonText: t('common.delete'),
162-
confirmButtonClass: 'danger',
163-
},
164-
)
150+
loadSharedApi({ type: 'document', systemType: apiType.value })
151+
.delMulDocumentTag(id, document_id.value, [row.id], loading)
165152
.then(() => {
166-
loadSharedApi({ type: 'document', systemType: apiType.value })
167-
.delMulDocumentTag(id, document_id.value, [row.id], loading)
168-
.then(() => {
169-
getList()
170-
})
153+
getList()
171154
})
172-
.catch(() => {})
173155
}
174156
175157
function getList() {

ui/src/views/paragraph/component/ParagraphCard.vue

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
ref="SelectDocumentDialogRef"
141141
@refresh="refreshMigrateParagraph"
142142
:apiType="apiType"
143-
:workspace-id="knowledgeDetail.workspace_id"
144143
/>
145144
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
146145
</el-card>
@@ -195,7 +194,6 @@ const emit = defineEmits([
195194
])
196195
const loading = ref(false)
197196
const changeStateloading = ref(false)
198-
const knowledgeDetail = ref<any>({})
199197
const show = ref(false)
200198
// card上面存在dropdown菜单
201199
const subHovered = ref(false)
@@ -222,13 +220,6 @@ async function changeState(row: any) {
222220
return false
223221
})
224222
}
225-
function getDetail() {
226-
loadSharedApi({ type: 'knowledge', systemType: apiType.value, isShared: shareDisabled.value })
227-
.getKnowledgeDetail(id, loading)
228-
.then((res: any) => {
229-
knowledgeDetail.value = res.data
230-
})
231-
}
232223
233224
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
234225
function openGenerateDialog(row: any) {
@@ -304,10 +295,6 @@ const dialogVisible = computed(
304295
GenerateRelatedDialogRef.value?.dialogVisible,
305296
)
306297
307-
onMounted(() => {
308-
getDetail()
309-
})
310-
311298
watch(dialogVisible, (val: boolean) => {
312299
emit('dialogVisibleChange', val)
313300
})

ui/src/views/paragraph/component/SelectDocumentDialog.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</el-dialog>
2727
</template>
2828
<script setup lang="ts">
29-
import {ref, watch, reactive, computed, onMounted} from 'vue'
29+
import { ref, watch, reactive, computed, onMounted } from 'vue'
3030
import { useRoute } from 'vue-router'
3131
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
3232
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
@@ -60,6 +60,7 @@ watch(dialogVisible, (bool) => {
6060
})
6161
6262
const open = (list: any) => {
63+
getDetail()
6364
paragraphList.value = list
6465
dialogVisible.value = true
6566
}
@@ -92,11 +93,6 @@ function getDetail() {
9293
})
9394
}
9495
95-
onMounted(() => {
96-
getDetail()
97-
})
98-
99-
10096
function changeKnowledge(dataset_id: string) {
10197
localStorage.setItem(id + 'chat_dataset_id', dataset_id)
10298
}

ui/src/workflow/common/NodeContainer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ const mousedown = (event?: any) => {
269269
if (!event?.shiftKey) {
270270
props.nodeModel.graphModel.clearSelectElements()
271271
}
272-
set(props.nodeModel, 'isSelected', true)
273-
set(props.nodeModel, 'isHovered', true)
272+
set(props.nodeModel, 'isSelected', !props.nodeModel.isSelected)
273+
set(props.nodeModel, 'isHovered', !props.nodeModel.isSelected)
274274
props.nodeModel.graphModel.toFront(props.nodeModel.id)
275275
}
276276
const showicon = ref<number | null>(null)

ui/src/workflow/common/NodeControl.vue

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<template>
22
<el-card shadow="always" style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px">
3+
<el-button
4+
@click="changeCursor(true)"
5+
style="border: none; padding: 4px; height: 24px"
6+
:class="{ 'is-drag-active': isDrag }"
7+
>
8+
<el-icon :size="16"><Position /></el-icon>
9+
</el-button>
10+
<el-button
11+
@click="changeCursor(false)"
12+
style="border: none; padding: 4px; height: 24px;margin-left: 8px;"
13+
:class="{ 'is-drag-active': !isDrag }"
14+
>
15+
<AppIcon iconName="app-raisehand" :size="16"></AppIcon>
16+
</el-button>
17+
<el-divider direction="vertical" />
318
<el-button link @click="zoomOut" style="border: none">
419
<el-tooltip
520
effect="dark"
@@ -78,10 +93,13 @@
7893
</template>
7994

8095
<script setup lang="ts">
96+
import { ref } from 'vue'
8197
const props = defineProps({
8298
lf: Object || String || null,
8399
})
84100
101+
const isDrag = ref(false)
102+
85103
function zoomIn() {
86104
props.lf?.zoom(true, [0, 0])
87105
}
@@ -106,5 +124,22 @@ const extend = () => {
106124
element.properties.showNode = true
107125
})
108126
}
127+
const changeCursor = (bool: boolean) => {
128+
const element: HTMLElement = document.querySelector('.lf-drag-able') as HTMLElement
129+
isDrag.value = bool
130+
if (bool) {
131+
element.style.cursor = 'default'
132+
props.lf?.openSelectionSelect()
133+
props.lf?.extension.selectionSelect.setSelectionSense(true, false)
134+
} else {
135+
element.style.cursor = 'pointer'
136+
props.lf?.closeSelectionSelect()
137+
}
138+
}
109139
</script>
110-
<style scoped></style>
140+
<style scoped lang="scss">
141+
.is-drag-active {
142+
background-color: var(--el-color-primary-light-9);
143+
color: var(--el-color-primary);
144+
}
145+
</style>

ui/src/workflow/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const renderGraphData = (data?: any) => {
109109
data.nodeModel.clear_next_node_field(false)
110110
})
111111
// lf.value.openSelectionSelect()
112+
// lf.value.extension.selectionSelect.setSelectionSense(true, false)
112113
setTimeout(() => {
113114
lf.value?.fitView()
114115
}, 500)

0 commit comments

Comments
 (0)