forked from github/dataease
Merge pull request #8997 from dataease/pr@dev-v2_bug_fix
Pr@dev v2 bug fix
This commit is contained in:
commit
e90da94055
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, computed, ref, nextTick, inject, type Ref } from 'vue'
|
import { reactive, computed, ref, nextTick, inject, type Ref, watch } from 'vue'
|
||||||
import AddSql from './AddSql.vue'
|
import AddSql from './AddSql.vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import zeroNodeImg from '@/assets/img/drag.png'
|
import zeroNodeImg from '@/assets/img/drag.png'
|
||||||
@ -108,9 +108,22 @@ const dfsNodeNameList = (list, arr) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isUpdate = false
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => state.nodeList,
|
||||||
|
() => {
|
||||||
|
if (isUpdate) {
|
||||||
|
emits('changeUpdate')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
)
|
||||||
|
|
||||||
const initState = nodeList => {
|
const initState = nodeList => {
|
||||||
Object.assign(state.nodeList, nodeList)
|
Object.assign(state.nodeList, nodeList)
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
isUpdate = true
|
||||||
emits('addComplete')
|
emits('addComplete')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -775,7 +788,7 @@ const defaultParam = {
|
|||||||
}
|
}
|
||||||
const dfsNodeListRename = arr => {
|
const dfsNodeListRename = arr => {
|
||||||
arr.some(ele => {
|
arr.some(ele => {
|
||||||
if (ele.id === renameParam.id) {
|
if (ele.id === renameParam.id && ele.tableName !== renameParam.name) {
|
||||||
ele.tableName = renameParam.name
|
ele.tableName = renameParam.name
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -829,7 +842,7 @@ const handleActiveNode = ele => {
|
|||||||
handleCommand(ele, 'editerField')
|
handleCommand(ele, 'editerField')
|
||||||
}
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['addComplete', 'joinEditor', 'updateAllfields'])
|
const emits = defineEmits(['addComplete', 'joinEditor', 'updateAllfields', 'changeUpdate'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -84,6 +84,7 @@ const currentField = ref({
|
|||||||
name: '',
|
name: '',
|
||||||
idArr: []
|
idArr: []
|
||||||
})
|
})
|
||||||
|
let isUpdate = false
|
||||||
|
|
||||||
const fieldTypes = index => {
|
const fieldTypes = index => {
|
||||||
return [
|
return [
|
||||||
@ -96,6 +97,10 @@ const fieldTypes = index => {
|
|||||||
][index]
|
][index]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const changeUpdate = () => {
|
||||||
|
isUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
const fieldOptions = [
|
const fieldOptions = [
|
||||||
{ label: t('dataset.text'), value: 0 },
|
{ label: t('dataset.text'), value: 0 },
|
||||||
{
|
{
|
||||||
@ -230,7 +235,7 @@ const pushDataset = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const backToMain = () => {
|
const backToMain = () => {
|
||||||
if (!nodeInfo.id) {
|
if (isUpdate) {
|
||||||
ElMessageBox.confirm('数据集未保存,确认退出吗?', {
|
ElMessageBox.confirm('数据集未保存,确认退出吗?', {
|
||||||
confirmButtonText: t('dataset.confirm'),
|
confirmButtonText: t('dataset.confirm'),
|
||||||
cancelButtonText: t('common.cancel'),
|
cancelButtonText: t('common.cancel'),
|
||||||
@ -307,7 +312,7 @@ const confirmCustomTime = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(searchTable, val => {
|
watch(searchTable, val => {
|
||||||
state.tableData = tableList.filter(ele => ele.name.includes(val))
|
state.tableData = tableList.filter(ele => ele.name.toLowerCase().includes(val.toLowerCase()))
|
||||||
})
|
})
|
||||||
const editeSave = () => {
|
const editeSave = () => {
|
||||||
const union = []
|
const union = []
|
||||||
@ -321,6 +326,7 @@ const editeSave = () => {
|
|||||||
nodeType: 'dataset'
|
nodeType: 'dataset'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
isUpdate = false
|
||||||
ElMessage.success('保存成功')
|
ElMessage.success('保存成功')
|
||||||
if (willBack) {
|
if (willBack) {
|
||||||
pushDataset()
|
pushDataset()
|
||||||
@ -332,6 +338,7 @@ const editeSave = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleFieldMore = (ele, type) => {
|
const handleFieldMore = (ele, type) => {
|
||||||
|
changeUpdate()
|
||||||
if (tabActive.value === 'manage') {
|
if (tabActive.value === 'manage') {
|
||||||
dimensionsSelection.value = dimensionsTable.value.getSelectionRows().map(ele => ele.id)
|
dimensionsSelection.value = dimensionsTable.value.getSelectionRows().map(ele => ele.id)
|
||||||
quotaSelection.value = quotaTable.value.getSelectionRows().map(ele => ele.id)
|
quotaSelection.value = quotaTable.value.getSelectionRows().map(ele => ele.id)
|
||||||
@ -654,7 +661,6 @@ const addComplete = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
nameList: [],
|
|
||||||
nodeNameList: [],
|
nodeNameList: [],
|
||||||
editArr: [],
|
editArr: [],
|
||||||
nodeList: [],
|
nodeList: [],
|
||||||
@ -1067,7 +1073,10 @@ const cascaderChangeArr = val => {
|
|||||||
})
|
})
|
||||||
recoverSelection()
|
recoverSelection()
|
||||||
}
|
}
|
||||||
|
const filterNode = (value: string, data: BusiTreeNode) => {
|
||||||
|
if (!value) return true
|
||||||
|
return data.name?.toLowerCase().includes(value.toLowerCase())
|
||||||
|
}
|
||||||
const recoverSelection = () => {
|
const recoverSelection = () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
quota.value.forEach(ele => {
|
quota.value.forEach(ele => {
|
||||||
@ -1228,6 +1237,7 @@ const getDsIconName = data => {
|
|||||||
@change="dsChange"
|
@change="dsChange"
|
||||||
:placeholder="t('dataset.pls_slc_data_source')"
|
:placeholder="t('dataset.pls_slc_data_source')"
|
||||||
class="ds-list"
|
class="ds-list"
|
||||||
|
:filter-node-method="filterNode"
|
||||||
filterable
|
filterable
|
||||||
popper-class="tree-select-ds_popper"
|
popper-class="tree-select-ds_popper"
|
||||||
v-model="dataSource"
|
v-model="dataSource"
|
||||||
@ -1294,16 +1304,11 @@ const getDsIconName = data => {
|
|||||||
</div>
|
</div>
|
||||||
<template v-for="ele in state.tableData" :key="ele.name">
|
<template v-for="ele in state.tableData" :key="ele.name">
|
||||||
<div
|
<div
|
||||||
:class="[
|
|
||||||
{
|
|
||||||
'not-allow': state.nodeNameList.includes(`${ele.tableName}${dataSource}`)
|
|
||||||
}
|
|
||||||
]"
|
|
||||||
class="list-item_primary"
|
class="list-item_primary"
|
||||||
:title="ele.name"
|
:title="ele.name"
|
||||||
@dragstart="$event => dragstart($event, ele)"
|
@dragstart="$event => dragstart($event, ele)"
|
||||||
@dragend="maskShow = false"
|
@dragend="maskShow = false"
|
||||||
:draggable="!state.nodeNameList.includes(`${ele.tableName}${dataSource}`)"
|
:draggable="true"
|
||||||
@click="setActiveName(ele)"
|
@click="setActiveName(ele)"
|
||||||
>
|
>
|
||||||
<el-icon class="icon-color">
|
<el-icon class="icon-color">
|
||||||
@ -1317,6 +1322,7 @@ const getDsIconName = data => {
|
|||||||
<div class="drag-right" :style="{ width: `calc(100vw - ${showLeft ? LeftWidth : 0}px)` }">
|
<div class="drag-right" :style="{ width: `calc(100vw - ${showLeft ? LeftWidth : 0}px)` }">
|
||||||
<dataset-union
|
<dataset-union
|
||||||
@join-editor="joinEditor"
|
@join-editor="joinEditor"
|
||||||
|
@changeUpdate="changeUpdate"
|
||||||
:maskShow="maskShow"
|
:maskShow="maskShow"
|
||||||
:dragHeight="dragHeight"
|
:dragHeight="dragHeight"
|
||||||
:getDsName="getDsName"
|
:getDsName="getDsName"
|
||||||
|
@ -494,7 +494,7 @@ const changeSideTreeStatus = val => {
|
|||||||
|
|
||||||
const filterNode = (value: string, data: BusiTreeNode) => {
|
const filterNode = (value: string, data: BusiTreeNode) => {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.name?.includes(value)
|
return data.name?.toLowerCase().includes(value.toLowerCase())
|
||||||
}
|
}
|
||||||
const mouseenter = () => {
|
const mouseenter = () => {
|
||||||
appStore.setArrowSide(true)
|
appStore.setArrowSide(true)
|
||||||
|
@ -44,6 +44,12 @@ const creatDsFolder = ref()
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { wsCache } = useCache()
|
const { wsCache } = useCache()
|
||||||
const dsLoading = ref(false)
|
const dsLoading = ref(false)
|
||||||
|
let isFormUpdate = false
|
||||||
|
let isForm2Update = false
|
||||||
|
let isUpdate = false
|
||||||
|
const changeUpdate = val => {
|
||||||
|
isUpdate = val
|
||||||
|
}
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
datasourceTree: []
|
datasourceTree: []
|
||||||
})
|
})
|
||||||
@ -302,6 +308,7 @@ const typeTitle = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const saveDS = () => {
|
const saveDS = () => {
|
||||||
|
isUpdate = false
|
||||||
const request = JSON.parse(JSON.stringify(form)) as unknown as Omit<
|
const request = JSON.parse(JSON.stringify(form)) as unknown as Omit<
|
||||||
Form,
|
Form,
|
||||||
'configuration' | 'apiConfiguration'
|
'configuration' | 'apiConfiguration'
|
||||||
@ -429,6 +436,26 @@ const visible = ref(false)
|
|||||||
const editDs = ref(false)
|
const editDs = ref(false)
|
||||||
const pid = ref('0')
|
const pid = ref('0')
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form,
|
||||||
|
() => {
|
||||||
|
if (isFormUpdate) {
|
||||||
|
changeUpdate(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form2,
|
||||||
|
() => {
|
||||||
|
if (isForm2Update) {
|
||||||
|
changeUpdate(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
)
|
||||||
|
|
||||||
const init = (nodeInfo: Form | Param, id?: string, res?: object) => {
|
const init = (nodeInfo: Form | Param, id?: string, res?: object) => {
|
||||||
editDs.value = !!nodeInfo
|
editDs.value = !!nodeInfo
|
||||||
showFinishPage.value = false
|
showFinishPage.value = false
|
||||||
@ -449,6 +476,10 @@ const init = (nodeInfo: Form | Param, id?: string, res?: object) => {
|
|||||||
activeApiStep.value = activeStep.value
|
activeApiStep.value = activeStep.value
|
||||||
|
|
||||||
visible.value = true
|
visible.value = true
|
||||||
|
nextTick(() => {
|
||||||
|
isForm2Update = true
|
||||||
|
isFormUpdate = true
|
||||||
|
})
|
||||||
if (!!nodeInfo) {
|
if (!!nodeInfo) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
currentDsType.value = nodeInfo.type
|
currentDsType.value = nodeInfo.type
|
||||||
@ -477,7 +508,7 @@ const beforeClose = () => {
|
|||||||
emits('refresh')
|
emits('refresh')
|
||||||
wsCache.set('ds-new-success', false)
|
wsCache.set('ds-new-success', false)
|
||||||
}
|
}
|
||||||
if (!showFinishPage.value && (editDs.value || activeStep.value !== 0)) {
|
if (!showFinishPage.value && ((!editDs.value && activeStep.value !== 0) || isUpdate)) {
|
||||||
ElMessageBox.confirm(t('chart.tips'), {
|
ElMessageBox.confirm(t('chart.tips'), {
|
||||||
confirmButtonType: 'primary',
|
confirmButtonType: 'primary',
|
||||||
tip: '你填写的信息未保存,确认退出吗?',
|
tip: '你填写的信息未保存,确认退出吗?',
|
||||||
@ -625,7 +656,7 @@ defineExpose({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="editor-footer" v-loading="dsLoading">
|
<div class="editor-footer" v-loading="dsLoading">
|
||||||
<el-button secondary @click="visible = false"> {{ t('common.cancel') }}</el-button>
|
<el-button secondary @click="beforeClose"> {{ t('common.cancel') }}</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-show="!(activeStep === 0 || (editDs && activeApiStep <= 1))"
|
v-show="!(activeStep === 0 || (editDs && activeApiStep <= 1))"
|
||||||
secondary
|
secondary
|
||||||
|
@ -563,7 +563,7 @@ const nodeCollapse = data => {
|
|||||||
|
|
||||||
const filterNode = (value: string, data: BusiTreeNode) => {
|
const filterNode = (value: string, data: BusiTreeNode) => {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.name?.includes(value)
|
return data.name?.toLowerCase().includes(value.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
const editDatasource = (editType?: number) => {
|
const editDatasource = (editType?: number) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user