forked from github/dataease
Merge pull request #3271 from dataease/pr@dev_dataset_bugfix
fix: 创建数据集左侧列表可拉宽 保存数据集校验 数据请求添加loading
This commit is contained in:
commit
4a3d27b1b3
@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dataset-api" v-loading="loading">
|
<div class="dataset-api" @mouseup="mouseupDrag" v-loading="loading">
|
||||||
<p v-show="!showLeft" class="arrow-right" @click="showLeft = true">
|
<p v-show="!showLeft" class="arrow-right" @click="showLeft = true">
|
||||||
<i class="el-icon-d-arrow-right" />
|
<i class="el-icon-d-arrow-right" />
|
||||||
</p>
|
</p>
|
||||||
<div v-show="showLeft" class="table-list">
|
<div v-show="showLeft" @mousedown="mousedownDrag" :style="{ left: LeftWidth + 'px' }" class="drag-left"></div>
|
||||||
|
<div v-show="showLeft" :style="{ width: LeftWidth + 'px' }" class="table-list">
|
||||||
<p class="select-ds">
|
<p class="select-ds">
|
||||||
{{ $t('deDataset.select_data_source') }}
|
{{ $t('deDataset.select_data_source') }}
|
||||||
<i class="el-icon-d-arrow-left" @click="showLeft = false" />
|
<i class="el-icon-d-arrow-left" @click="showLeft = false" />
|
||||||
@ -36,7 +37,7 @@
|
|||||||
没有找到相关内容
|
没有找到相关内容
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-checkbox-list" v-else>
|
<div v-loading="dsLoading" class="table-checkbox-list" v-else>
|
||||||
<el-checkbox-group v-model="checkTableList" size="small">
|
<el-checkbox-group v-model="checkTableList" size="small">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-for="t in tableData"
|
v-for="t in tableData"
|
||||||
@ -51,6 +52,7 @@
|
|||||||
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
||||||
]"
|
]"
|
||||||
class="item"
|
class="item"
|
||||||
|
:title="t.name"
|
||||||
@click="setActiveName(t)"
|
@click="setActiveName(t)"
|
||||||
>
|
>
|
||||||
<svg-icon v-if="!t.enableCheck" icon-class="Checkbox" style="margin-right: 8px"/>
|
<svg-icon v-if="!t.enableCheck" icon-class="Checkbox" style="margin-right: 8px"/>
|
||||||
@ -180,12 +182,14 @@ export default {
|
|||||||
showLeft: true,
|
showLeft: true,
|
||||||
tableLoading: false,
|
tableLoading: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
LeftWidth: 240,
|
||||||
height: 400,
|
height: 400,
|
||||||
fields: [],
|
fields: [],
|
||||||
fieldsData: [],
|
fieldsData: [],
|
||||||
searchTable: '',
|
searchTable: '',
|
||||||
options: [],
|
options: [],
|
||||||
dataSource: '',
|
dataSource: '',
|
||||||
|
dsLoading: false,
|
||||||
tables: [],
|
tables: [],
|
||||||
checkTableList: [],
|
checkTableList: [],
|
||||||
mode: '1',
|
mode: '1',
|
||||||
@ -222,6 +226,7 @@ export default {
|
|||||||
if (val) {
|
if (val) {
|
||||||
this.checkTableList = []
|
this.checkTableList = []
|
||||||
this.activeName = ''
|
this.activeName = ''
|
||||||
|
this.dsLoading = true
|
||||||
const dsName = this.options.find((ele) => ele.id === val).name
|
const dsName = this.options.find((ele) => ele.id === val).name
|
||||||
post('/datasource/getTables/' + val, {}).then((response) => {
|
post('/datasource/getTables/' + val, {}).then((response) => {
|
||||||
this.tables = response.data
|
this.tables = response.data
|
||||||
@ -231,6 +236,8 @@ export default {
|
|||||||
this.$set(ele, 'nameExsit', false)
|
this.$set(ele, 'nameExsit', false)
|
||||||
})
|
})
|
||||||
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
||||||
|
}).finally(() => {
|
||||||
|
this.dsLoading = false
|
||||||
})
|
})
|
||||||
for (let i = 0; i < this.options.length; i++) {
|
for (let i = 0; i < this.options.length; i++) {
|
||||||
if (this.options[i].id === val) {
|
if (this.options[i].id === val) {
|
||||||
@ -272,6 +279,27 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
mousedownDrag() {
|
||||||
|
document
|
||||||
|
.querySelector('.dataset-api')
|
||||||
|
.addEventListener('mousemove', this.caculateHeight)
|
||||||
|
},
|
||||||
|
mouseupDrag() {
|
||||||
|
document
|
||||||
|
.querySelector('.dataset-api')
|
||||||
|
.removeEventListener('mousemove', this.caculateHeight)
|
||||||
|
},
|
||||||
|
caculateHeight(e) {
|
||||||
|
if (e.pageX < 240) {
|
||||||
|
this.LeftWidth = 240
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.pageX > 500) {
|
||||||
|
this.LeftWidth = 500
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.LeftWidth = e.pageX
|
||||||
|
},
|
||||||
nameExsitValidator(activeIndex) {
|
nameExsitValidator(activeIndex) {
|
||||||
this.tableData[activeIndex].nameExsit =
|
this.tableData[activeIndex].nameExsit =
|
||||||
this.nameList
|
this.nameList
|
||||||
@ -385,6 +413,15 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
.drag-left {
|
||||||
|
position: absolute;
|
||||||
|
height: calc(100vh - 56px);
|
||||||
|
width: 2px;
|
||||||
|
top: 0;
|
||||||
|
z-index: 5;
|
||||||
|
cursor: col-resize;
|
||||||
|
}
|
||||||
|
|
||||||
.arrow-right {
|
.arrow-right {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
@ -438,7 +475,7 @@ export default {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
.item {
|
.item {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 215px;
|
width: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dataset-db" v-loading="loading">
|
<div class="dataset-db" @mouseup="mouseupDrag" v-loading="loading">
|
||||||
<p v-show="!showLeft" @click="showLeft = true" class="arrow-right">
|
<p v-show="!showLeft" @click="showLeft = true" class="arrow-right">
|
||||||
<i class="el-icon-d-arrow-right"></i>
|
<i class="el-icon-d-arrow-right"></i>
|
||||||
</p>
|
</p>
|
||||||
<div class="table-list" v-show="showLeft">
|
<div v-show="showLeft" @mousedown="mousedownDrag" :style="{ left: LeftWidth + 'px' }" class="drag-left"></div>
|
||||||
|
<div class="table-list" :style="{ width: LeftWidth + 'px' }" v-show="showLeft">
|
||||||
<p class="select-ds">
|
<p class="select-ds">
|
||||||
{{ $t('deDataset.select_data_source') }}
|
{{ $t('deDataset.select_data_source') }}
|
||||||
<i @click="showLeft = false" class="el-icon-d-arrow-left"></i>
|
<i @click="showLeft = false" class="el-icon-d-arrow-left"></i>
|
||||||
@ -37,7 +38,7 @@
|
|||||||
没有找到相关内容
|
没有找到相关内容
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="table-checkbox-list">
|
<div v-loading="dsLoading" v-else class="table-checkbox-list">
|
||||||
<el-checkbox-group v-model="checkTableList" size="small">
|
<el-checkbox-group v-model="checkTableList" size="small">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
:disabled="t.enableCheck"
|
:disabled="t.enableCheck"
|
||||||
@ -52,6 +53,7 @@
|
|||||||
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
{ active: activeName === t.name, 'not-allow': !t.enableCheck }
|
||||||
]"
|
]"
|
||||||
class="item"
|
class="item"
|
||||||
|
:title="t.name"
|
||||||
@click="setActiveName(t)"
|
@click="setActiveName(t)"
|
||||||
>
|
>
|
||||||
<svg-icon v-if="!t.enableCheck" icon-class="Checkbox" style="margin-right: 8px"/>
|
<svg-icon v-if="!t.enableCheck" icon-class="Checkbox" style="margin-right: 8px"/>
|
||||||
@ -181,6 +183,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showLeft: true,
|
showLeft: true,
|
||||||
|
LeftWidth: 240,
|
||||||
tableLoading: false,
|
tableLoading: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
height: 400,
|
height: 400,
|
||||||
@ -189,6 +192,7 @@ export default {
|
|||||||
searchTable: '',
|
searchTable: '',
|
||||||
options: [],
|
options: [],
|
||||||
dataSource: '',
|
dataSource: '',
|
||||||
|
dsLoading: false,
|
||||||
tables: [],
|
tables: [],
|
||||||
checkTableList: [],
|
checkTableList: [],
|
||||||
mode: '0',
|
mode: '0',
|
||||||
@ -223,6 +227,7 @@ export default {
|
|||||||
},
|
},
|
||||||
dataSource(val) {
|
dataSource(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
this.dsLoading = true
|
||||||
this.checkTableList = []
|
this.checkTableList = []
|
||||||
this.activeName = ''
|
this.activeName = ''
|
||||||
const dsName = this.options.find((ele) => ele.id === val).name
|
const dsName = this.options.find((ele) => ele.id === val).name
|
||||||
@ -234,6 +239,8 @@ export default {
|
|||||||
this.$set(ele, 'nameExsit', false)
|
this.$set(ele, 'nameExsit', false)
|
||||||
})
|
})
|
||||||
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
||||||
|
}).finally(() => {
|
||||||
|
this.dsLoading = false
|
||||||
})
|
})
|
||||||
for (let i = 0; i < this.options.length; i++) {
|
for (let i = 0; i < this.options.length; i++) {
|
||||||
if (this.options[i].id === val) {
|
if (this.options[i].id === val) {
|
||||||
@ -285,6 +292,27 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
mousedownDrag() {
|
||||||
|
document
|
||||||
|
.querySelector('.dataset-db')
|
||||||
|
.addEventListener('mousemove', this.caculateHeight)
|
||||||
|
},
|
||||||
|
mouseupDrag() {
|
||||||
|
document
|
||||||
|
.querySelector('.dataset-db')
|
||||||
|
.removeEventListener('mousemove', this.caculateHeight)
|
||||||
|
},
|
||||||
|
caculateHeight(e) {
|
||||||
|
if (e.pageX < 240) {
|
||||||
|
this.LeftWidth = 240
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.pageX > 500) {
|
||||||
|
this.LeftWidth = 500
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.LeftWidth = e.pageX
|
||||||
|
},
|
||||||
nameExsitValidator(activeIndex) {
|
nameExsitValidator(activeIndex) {
|
||||||
this.tableData[activeIndex].nameExsit =
|
this.tableData[activeIndex].nameExsit =
|
||||||
this.nameList
|
this.nameList
|
||||||
@ -398,6 +426,15 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
.drag-left {
|
||||||
|
position: absolute;
|
||||||
|
height: calc(100vh - 56px);
|
||||||
|
width: 2px;
|
||||||
|
top: 0;
|
||||||
|
z-index: 5;
|
||||||
|
cursor: col-resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.arrow-right {
|
.arrow-right {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -452,7 +489,7 @@ export default {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
.item {
|
.item {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 215px;
|
width: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
>{{ $t('deDataset.selected') }} {{ tableNum }}
|
>{{ $t('deDataset.selected') }} {{ tableNum }}
|
||||||
{{ ['excel'].includes(datasetType) ? $t('deDataset.table') : '项' }}</span
|
{{ ['excel'].includes(datasetType) ? $t('deDataset.table') : '项' }}</span
|
||||||
>
|
>
|
||||||
<deBtn @click="datasetSave" type="primary">{{
|
<deBtn :disabled="['db', 'excel', 'api'].includes(datasetType) && !tableNum" @click="datasetSave" type="primary">{{
|
||||||
$t('commons.save')
|
$t('commons.save')
|
||||||
}}</deBtn>
|
}}</deBtn>
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user