diff --git a/packages/api/src/core/task.ts b/packages/api/src/core/task.ts index 4f36bada1..97888b3df 100644 --- a/packages/api/src/core/task.ts +++ b/packages/api/src/core/task.ts @@ -143,6 +143,10 @@ export function batchUpdateTaskListtags(params: any) { return requestClient.patch(`${BASE_URL}/batchUpdateListtags`, params) } +export function batchApplyTaskListtags(params: any) { + return requestClient.patch(`${BASE_URL}/batchApplyListtags`, params) +} + export function saveTask(params: any, config?: any) { return requestClient.patch( `${BASE_URL}/confirm/${params.id || ''}`, diff --git a/packages/business/src/components/BatchTagDialog.vue b/packages/business/src/components/BatchTagDialog.vue new file mode 100644 index 000000000..b76717b10 --- /dev/null +++ b/packages/business/src/components/BatchTagDialog.vue @@ -0,0 +1,792 @@ + + + + + diff --git a/packages/business/src/components/TablePage.vue b/packages/business/src/components/TablePage.vue index 43cfe8948..b7ff3d95c 100644 --- a/packages/business/src/components/TablePage.vue +++ b/packages/business/src/components/TablePage.vue @@ -399,6 +399,10 @@ export default defineComponent({ classifyRef.value?.show(tagList) } + const refreshClassifyTags = () => { + classification.value?.getData?.() + } + const getData = () => { return list.value } @@ -695,6 +699,7 @@ export default defineComponent({ nodeChecked, handleSelectionChange, showClassify, + refreshClassifyTags, getData, clearSelection, toggleRowSelection, diff --git a/packages/business/src/views/connections/List.vue b/packages/business/src/views/connections/List.vue index 418984733..c3d39bc7b 100644 --- a/packages/business/src/views/connections/List.vue +++ b/packages/business/src/views/connections/List.vue @@ -36,6 +36,7 @@ import PermissionseSettingsCreate from '../../components/permissionse-settings/C import SchemaProgress from '../../components/SchemaProgress.vue' import TablePage from '../../components/TablePage.vue' import UploadDialog from '../../components/UploadDialog.vue' +import BatchTagDialog from '../../components/BatchTagDialog.vue' import { useHas } from '../../composables' import { CONNECTION_STATUS_MAP, CONNECTION_TYPE_MAP } from '../../shared' import Preview from './Preview.vue' @@ -88,6 +89,7 @@ const previewRef = ref() const test = ref() const dialog = ref() const permissionseSettingsCreate = ref() +const batchTagDialog = ref | null>(null) // State let timeout: NodeJS.Timeout | null = null @@ -434,22 +436,6 @@ const remove = async (row: any) => { } } -const handleSelectTag = () => { - const tagList = [] - const tagMap: Record = {} - - multipleSelection.value.forEach((row: any) => { - row.listtags?.forEach((item: any) => { - if (!tagMap[item.id]) { - tagList.push(item) - tagMap[item.id] = true - } - }) - }) - - return tagList -} - const handleOperationClassify = async (listtags: any[]) => { const attributes = { id: multipleSelection.value.map((r: any) => r.id), @@ -464,6 +450,20 @@ const handleOperationClassify = async (listtags: any[]) => { } } +const openBatchTagDialog = () => { + if (!multipleSelection.value.length) return + batchTagDialog.value?.open(multipleSelection.value as any) +} + +const handleBatchTagSaved = () => { + table.value?.clearSelection?.() + table.value?.fetch() +} + +const handleBatchTagCreated = () => { + table.value?.refreshClassifyTags?.() +} + const handleDialogDatabaseTypeVisible = () => { dialogDatabaseTypeVisible.value = false } @@ -795,7 +795,7 @@ onUnmounted(() => { {{ $t('public_button_bulk_tag') }} @@ -1006,6 +1006,13 @@ onUnmounted(() => { + r.id) - } - const attributes = { - id: ids, - listtags, - } - batchUpdateTaskListtags(attributes).then(() => { - this.dataFlowId = '' - this.table.fetch() - }) + openBatchTagDialog() { + if (!this.multipleSelection.length) return + this.$refs.batchTagDialog?.open(this.multipleSelection) }, - handleSelectTag() { - const tagList = [] - const tagMap = {} - - this.multipleSelection.forEach((row) => { - row.listtags?.forEach((item) => { - if (!tagMap[item.id]) { - tagList.push(item) - tagMap[item.id] = true - } - }) - }) + handleBatchTagSaved() { + this.table.clearSelection() + this.table.fetch() + }, - return tagList + handleBatchTagCreated() { + this.table.refreshClassifyTags() }, create() { @@ -1036,7 +1016,7 @@ export default { }), )}`, ) - .then(async (data) => { + .then((data) => { const { items = [] } = data if (items.some((t) => t.status === 'Stopped')) { @@ -1067,8 +1047,8 @@ export default { }) }, - handlePipelineSelectVisible(val) { - if (val) { + handlePipelineSelectVisible() { + if (this.pipelineSelected) { this.loadPipelineOptions() } }, @@ -1106,7 +1086,6 @@ export default { multipleSelection = val } " - @classify-submit="handleOperationClassify" @sort-change="handleSortTable" > + diff --git a/packages/business/src/views/verification/List.vue b/packages/business/src/views/verification/List.vue index e70bcb451..05252de02 100644 --- a/packages/business/src/views/verification/List.vue +++ b/packages/business/src/views/verification/List.vue @@ -26,6 +26,7 @@ import { escapeRegExp } from 'lodash-es' import { computed, onBeforeMount, onUnmounted, ref, watch } from 'vue' import { useRoute, useRouter } from 'vue-router' import { ErrorMessage } from '../../components/error-message' +import BatchTagDialog from '../../components/BatchTagDialog.vue' import PageContainer from '../../components/PageContainer.vue' import PermissionseSettingsCreate from '../../components/permissionse-settings/Create.vue' import TablePage from '../../components/TablePage.vue' @@ -70,6 +71,11 @@ interface InspectItem { lastStartTime: string sourceTotal: string | number targetTotal: string | number + listtags?: Array<{ + id: string + value: string + name?: string + }> InspectResult?: InspectResult errorMsg?: string difference_number?: number @@ -142,6 +148,7 @@ const taskOptionsLoading = ref(false) // Computed const tableRef = computed(() => table.value) +const batchTagDialog = ref | null>(null) // Methods const inspectMethodChange = (val: string) => { @@ -474,22 +481,6 @@ const onImportDialogClosed = () => { importForm.value.type = 'task' } -const handleSelectTag = () => { - const tagList = [] - const tagMap = {} - - multipleSelection.value.forEach((row) => { - row.listtags?.forEach((item) => { - if (!tagMap[item.id]) { - tagList.push(item) - tagMap[item.id] = true - } - }) - }) - - return tagList -} - const handleOperationClassify = async (listtags) => { if (!listtags.length || !multipleSelection.value.length) { return @@ -508,6 +499,20 @@ const handleOperationClassify = async (listtags) => { console.error(error) } } + +const openBatchTagDialog = () => { + if (!multipleSelection.value.length) return + batchTagDialog.value?.open(multipleSelection.value as any) +} + +const handleBatchTagSaved = () => { + table.value?.clearSelection?.() + table.value?.fetch() +} + +const handleBatchTagCreated = () => { + table.value?.refreshClassifyTags?.() +} // Watchers watch( () => route.query, @@ -684,7 +689,7 @@ onUnmounted(() => { {{ $t('packages_business_permissionse_settings_create_quanxianshezhi') }} - + {{ $t('public_button_bulk_tag') }} @@ -976,6 +981,13 @@ onUnmounted(() => { + diff --git a/packages/i18n/src/locale/lang/en.js b/packages/i18n/src/locale/lang/en.js index 6ceace288..e819b2ab6 100644 --- a/packages/i18n/src/locale/lang/en.js +++ b/packages/i18n/src/locale/lang/en.js @@ -625,6 +625,25 @@ export default { public_tag_priority: 'Priority Setting', public_tag_priority_desc: 'Select label priority. Smaller numbers mean higher priority. Batch tasks run in priority order.', + packages_business_batch_tag_dialog_title: 'Batch Set Tags', + packages_business_batch_tag_dialog_subtitle: + '{count} tasks selected · Checked means add, unchecked means remove', + packages_business_batch_tag_dialog_search_placeholder: + 'Search tags, or press Enter to create a name', + packages_business_batch_tag_dialog_create_tag: 'Create tag "{name}"', + packages_business_batch_tag_dialog_empty: 'No matching tags', + packages_business_batch_tag_dialog_state_some: + 'Some tasks have it ({count}/{total})', + packages_business_batch_tag_dialog_state_add_all: 'Will add to all', + packages_business_batch_tag_dialog_state_all: 'All tasks have it', + packages_business_batch_tag_dialog_state_remove_all: 'Will remove from all', + packages_business_batch_tag_dialog_summary_title: 'Changes', + packages_business_batch_tag_dialog_add: 'Add', + packages_business_batch_tag_dialog_remove: 'Remove', + packages_business_batch_tag_dialog_task_count: '{count} tasks', + packages_business_batch_tag_dialog_no_changes: + 'No changes · Partially selected tags will keep each task as-is', + packages_business_batch_tag_dialog_save: 'Save Changes', public_priority_highest: 'Highest', public_priority_high: 'High', public_priority_medium_high: 'Medium High', diff --git a/packages/i18n/src/locale/lang/zh-CN.js b/packages/i18n/src/locale/lang/zh-CN.js index 6e09a3099..fca8798c4 100644 --- a/packages/i18n/src/locale/lang/zh-CN.js +++ b/packages/i18n/src/locale/lang/zh-CN.js @@ -618,6 +618,25 @@ export default { public_tag_priority: '优先级设置', public_tag_priority_desc: '选择标签优先级,数字越小优先级越高,批量启动时会按优先级顺序执行', + packages_business_batch_tag_dialog_title: '批量设置标签', + packages_business_batch_tag_dialog_subtitle: + '已选择 {count} 个任务 · 勾选表示添加,取消勾选表示移除', + packages_business_batch_tag_dialog_search_placeholder: + '搜索标签,或输入名称回车新建', + packages_business_batch_tag_dialog_create_tag: '新建标签 “{name}”', + packages_business_batch_tag_dialog_empty: '没有匹配的标签', + packages_business_batch_tag_dialog_state_some: + '部分任务拥有({count}/{total})', + packages_business_batch_tag_dialog_state_add_all: '将添加到全部', + packages_business_batch_tag_dialog_state_all: '全部拥有', + packages_business_batch_tag_dialog_state_remove_all: '将从全部移除', + packages_business_batch_tag_dialog_summary_title: '本次改动', + packages_business_batch_tag_dialog_add: '添加', + packages_business_batch_tag_dialog_remove: '移除', + packages_business_batch_tag_dialog_task_count: '{count} 个任务', + packages_business_batch_tag_dialog_no_changes: + '尚无改动 · 半选标签将保持各任务原样', + packages_business_batch_tag_dialog_save: '保存改动', public_priority_highest: '最高', public_priority_high: '高', public_priority_medium_high: '中高', diff --git a/packages/i18n/src/locale/lang/zh-TW.js b/packages/i18n/src/locale/lang/zh-TW.js index 7f37e635a..9ff3286f2 100644 --- a/packages/i18n/src/locale/lang/zh-TW.js +++ b/packages/i18n/src/locale/lang/zh-TW.js @@ -615,6 +615,25 @@ export default { public_tag_priority: '優先級設置', public_tag_priority_desc: '選擇標籤優先級,數字越小優先級越高,批量啟動時會按優先級順序執行', + packages_business_batch_tag_dialog_title: '批量設置標籤', + packages_business_batch_tag_dialog_subtitle: + '已選擇 {count} 個任務 · 勾選表示添加,取消勾選表示移除', + packages_business_batch_tag_dialog_search_placeholder: + '搜索標籤,或輸入名稱回車新建', + packages_business_batch_tag_dialog_create_tag: '新建標籤 “{name}”', + packages_business_batch_tag_dialog_empty: '沒有匹配的標籤', + packages_business_batch_tag_dialog_state_some: + '部分任務擁有({count}/{total})', + packages_business_batch_tag_dialog_state_add_all: '將添加到全部', + packages_business_batch_tag_dialog_state_all: '全部擁有', + packages_business_batch_tag_dialog_state_remove_all: '將從全部移除', + packages_business_batch_tag_dialog_summary_title: '本次改動', + packages_business_batch_tag_dialog_add: '添加', + packages_business_batch_tag_dialog_remove: '移除', + packages_business_batch_tag_dialog_task_count: '{count} 個任務', + packages_business_batch_tag_dialog_no_changes: + '尚無改動 · 半選標籤將保持各任務原樣', + packages_business_batch_tag_dialog_save: '保存改動', public_priority_highest: '最高', public_priority_high: '高', public_priority_medium_high: '中高',