commit
0ca9f1f4fd
@ -159,6 +159,18 @@ const calculateHeight = (e: MouseEvent) => {
|
||||
dragHeight.value = e.pageY - 164
|
||||
}
|
||||
|
||||
const calculateWidth = (e: MouseEvent) => {
|
||||
if (e.pageX < 240) {
|
||||
LeftWidth.value = 240
|
||||
return
|
||||
}
|
||||
if (e.pageX > 400) {
|
||||
LeftWidth.value = 400
|
||||
return
|
||||
}
|
||||
LeftWidth.value = e.pageX
|
||||
}
|
||||
|
||||
const insertParamToCodeMirror = (value: string) => {
|
||||
codeCom.value.dispatch({
|
||||
changes: { from: 0, to: codeCom.value.state.doc.toString().length, insert: '' }
|
||||
@ -329,6 +341,7 @@ const copyInfo = async (value: string) => {
|
||||
|
||||
const mouseupDrag = () => {
|
||||
const dom = document.querySelector('.sql-eidtor')
|
||||
dom.removeEventListener('mousemove', calculateWidth)
|
||||
dom.removeEventListener('mousemove', calculateHeight)
|
||||
}
|
||||
|
||||
@ -377,7 +390,7 @@ const saveVariable = () => {
|
||||
ElMessage.success('参数设置成功')
|
||||
}
|
||||
const mousedownDrag = () => {
|
||||
document.querySelector('.sql-eidtor').addEventListener('mousemove', calculateHeight)
|
||||
document.querySelector('.sql-eidtor').addEventListener('mousemove', calculateWidth)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import { ref, reactive, computed, watch, nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus-secondary'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import {
|
||||
getDatasetTree,
|
||||
moveDatasetTree,
|
||||
@ -270,6 +271,7 @@ const saveDataset = () => {
|
||||
ElMessage.success('重命名成功')
|
||||
break
|
||||
default:
|
||||
useEmitt().emitter.emit('onDatasetSave')
|
||||
ElMessage.success(t('common.save_success'))
|
||||
break
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import {
|
||||
onBeforeUnmount
|
||||
} from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { ElIcon, ElMessageBox, ElMessage } from 'element-plus-secondary'
|
||||
import type { Action } from 'element-plus-secondary'
|
||||
import FieldMore from './FieldMore.vue'
|
||||
@ -70,7 +71,6 @@ const editUnion = ref(false)
|
||||
const datasetDrag = ref()
|
||||
const datasetName = ref('未命名数据集')
|
||||
const tabActive = ref('preview')
|
||||
const originName = ref('')
|
||||
const activeName = ref('')
|
||||
const dataSource = ref('')
|
||||
const searchTable = ref('')
|
||||
@ -316,6 +316,9 @@ const editeSave = () => {
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
if (willBack) {
|
||||
pushDataset()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
@ -563,23 +566,26 @@ const getTableName = async (datasourceId, tableName) => {
|
||||
|
||||
const initEdite = () => {
|
||||
const { id, datasourceId, tableName } = route.query
|
||||
const { id: copyId } = route.params
|
||||
if (datasourceId) {
|
||||
dataSource.value = datasourceId as string
|
||||
getTableName(datasourceId as string, tableName)
|
||||
}
|
||||
if (!id) return
|
||||
if (!id && !copyId) return
|
||||
loading.value = true
|
||||
getDatasetDetails(id)
|
||||
getDatasetDetails(copyId || id)
|
||||
.then(res => {
|
||||
let arr = []
|
||||
const { id, pid, name } = res || {}
|
||||
nodeInfo = {
|
||||
id,
|
||||
pid,
|
||||
name
|
||||
name: copyId ? '复制数据集' : name
|
||||
}
|
||||
datasetName.value = name
|
||||
originName.value = name
|
||||
if (copyId) {
|
||||
nodeInfo.id = ''
|
||||
}
|
||||
datasetName.value = nodeInfo.name
|
||||
allfields.value = res.allFields || []
|
||||
dfsUnion(arr, res.union || [])
|
||||
const [fir] = res.union as { currentDs: { datasourceId: string } }[]
|
||||
@ -822,8 +828,17 @@ const handleResize = debounce(() => {
|
||||
}
|
||||
dragHeight.value = clientHeight - sqlResultHeight.value - 56
|
||||
}, 60)
|
||||
let willBack = false
|
||||
const saveAndBack = () => {
|
||||
if (!willBack) return
|
||||
pushDataset()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
useEmitt({
|
||||
name: 'onDatasetSave',
|
||||
callback: saveAndBack
|
||||
})
|
||||
window.addEventListener('resize', handleResize)
|
||||
getSqlResultHeight()
|
||||
quotaTableHeight.value = sqlResultHeight.value - 242
|
||||
@ -855,7 +870,7 @@ const datasetSave = () => {
|
||||
}
|
||||
const union = []
|
||||
dfsNodeList(union, datasetDrag.value.nodeList)
|
||||
const { pid } = route.query
|
||||
const pid = route.query.pid || nodeInfo.pid
|
||||
if (!union.length) {
|
||||
ElMessage.error('数据集不能为空')
|
||||
return
|
||||
@ -868,6 +883,10 @@ const datasetSave = () => {
|
||||
datasetName.value
|
||||
)
|
||||
}
|
||||
const datasetSaveAndBack = () => {
|
||||
willBack = true
|
||||
datasetSave()
|
||||
}
|
||||
|
||||
const datasetPreviewLoading = ref(false)
|
||||
|
||||
@ -1118,6 +1137,9 @@ const getDsIconName = data => {
|
||||
</template>
|
||||
</span>
|
||||
<span class="oprate">
|
||||
<el-button :disabled="showInput" type="primary" @click="datasetSaveAndBack"
|
||||
>保存并返回</el-button
|
||||
>
|
||||
<el-button :disabled="showInput" type="primary" @click="datasetSave">保存</el-button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -320,6 +320,15 @@ const handleClick = (tabName: TabPaneName) => {
|
||||
}
|
||||
|
||||
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
||||
if (cmd === 'copy') {
|
||||
router.push({
|
||||
name: 'dataset-form',
|
||||
params: {
|
||||
id: data.id
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (cmd === 'delete') {
|
||||
let options = {
|
||||
confirmButtonType: 'danger',
|
||||
@ -417,6 +426,18 @@ const filterNode = (value: string, data: BusiTreeNode) => {
|
||||
if (!value) return true
|
||||
return data.name?.toLocaleLowerCase().includes(value.toLocaleLowerCase())
|
||||
}
|
||||
|
||||
const getMenuList = (val: boolean) => {
|
||||
return !val
|
||||
? menuList
|
||||
: [
|
||||
{
|
||||
label: t('common.copy'),
|
||||
svgName: 'icon_copy_filled',
|
||||
command: 'copy'
|
||||
}
|
||||
].concat(menuList)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -498,7 +519,7 @@ const filterNode = (value: string, data: BusiTreeNode) => {
|
||||
</el-icon>
|
||||
<handle-more
|
||||
@handle-command="cmd => operation(cmd, data, data.leaf ? 'dataset' : 'folder')"
|
||||
:menu-list="menuList"
|
||||
:menu-list="getMenuList(data.leaf)"
|
||||
></handle-more>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@ -964,6 +964,9 @@ defineExpose({
|
||||
}
|
||||
|
||||
.input-with-append {
|
||||
:deep(.ed-input__wrapper) {
|
||||
padding-right: 1px;
|
||||
}
|
||||
:deep(.ed-input-group__append) {
|
||||
width: 55px;
|
||||
background: #eff0f1;
|
||||
|
||||
@ -381,7 +381,7 @@ const saveDS = () => {
|
||||
const validate = detail.value.submitForm()
|
||||
validate(val => {
|
||||
if (val) {
|
||||
if (editDs.value) {
|
||||
if (editDs.value && form.id) {
|
||||
let options = {
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
@ -478,7 +478,7 @@ const drawTitle = computed(() => {
|
||||
if (creator && id && currentDsType.value == 'Excel') {
|
||||
return editType === 1 ? '追加数据' : '替换数据'
|
||||
}
|
||||
return editDs.value ? t('datasource.modify') : '创建数据源'
|
||||
return editDs.value ? (!form.id ? '复制数据源' : t('datasource.modify')) : '创建数据源'
|
||||
})
|
||||
|
||||
const beforeClose = () => {
|
||||
|
||||
@ -424,6 +424,7 @@ const handleNodeClick = data => {
|
||||
createTime,
|
||||
creator,
|
||||
type,
|
||||
pid,
|
||||
configuration,
|
||||
syncSetting,
|
||||
apiConfigurationStr,
|
||||
@ -440,6 +441,7 @@ const handleNodeClick = data => {
|
||||
}
|
||||
Object.assign(nodeInfo, {
|
||||
name,
|
||||
pid,
|
||||
description,
|
||||
fileName,
|
||||
size,
|
||||
@ -534,6 +536,13 @@ const handleEdit = async data => {
|
||||
datasourceEditor.value.init(nodeInfo)
|
||||
}
|
||||
|
||||
const handleCopy = async data => {
|
||||
await handleNodeClick(data)
|
||||
nodeInfo.id = ''
|
||||
nodeInfo.name = '复制数据源'
|
||||
datasourceEditor.value.init(nodeInfo)
|
||||
}
|
||||
|
||||
const handleDatasourceTree = (cmd: string, data?: Tree) => {
|
||||
if (cmd === 'datasource') {
|
||||
createDatasource(data)
|
||||
@ -543,6 +552,10 @@ const handleDatasourceTree = (cmd: string, data?: Tree) => {
|
||||
}
|
||||
}
|
||||
const operation = (cmd: string, data: Tree, nodeType: string) => {
|
||||
if (cmd === 'copy') {
|
||||
handleCopy(data)
|
||||
return
|
||||
}
|
||||
if (cmd === 'delete') {
|
||||
let options = {
|
||||
confirmButtonText: t('common.sure'),
|
||||
@ -633,6 +646,18 @@ onMounted(() => {
|
||||
datasourceEditor.value.init(null, null)
|
||||
}
|
||||
})
|
||||
|
||||
const getMenuList = (val: boolean) => {
|
||||
return !val
|
||||
? menuList
|
||||
: [
|
||||
{
|
||||
label: t('common.copy'),
|
||||
svgName: 'icon_copy_filled',
|
||||
command: 'copy'
|
||||
}
|
||||
].concat(menuList)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -718,7 +743,7 @@ onMounted(() => {
|
||||
@handle-command="
|
||||
cmd => operation(cmd, data, data.leaf ? 'datasource' : 'folder')
|
||||
"
|
||||
:menu-list="menuList"
|
||||
:menu-list="getMenuList(!['Excel', 'API'].includes(data.type) && data.leaf)"
|
||||
></handle-more>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user