Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2023-02-15 17:10:07 +08:00
commit 9d992a0ea1
9 changed files with 242 additions and 143 deletions

View File

@ -72,11 +72,12 @@ public class DataSetTableController {
}, logical = Logical.AND) }, logical = Logical.AND)
@ApiOperation("更新") @ApiOperation("更新")
@PostMapping("update") @PostMapping("update")
public List<DatasetTable> save(@RequestBody DataSetTableRequest datasetTable) throws Exception { public List<VAuthModelDTO> save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
if (datasetTable.getType().equalsIgnoreCase("excel")) { if (datasetTable.getType().equalsIgnoreCase("excel")) {
return dataSetTableService.saveExcel(datasetTable); List<String> ids = dataSetTableService.saveExcel(datasetTable).stream().map(DatasetTable::getId).collect(Collectors.toList());
return vAuthModelService.queryAuthModelByIds("dataset", ids);
} else { } else {
return Collections.singletonList(dataSetTableService.save(datasetTable)); return vAuthModelService.queryAuthModelByIds("dataset", Collections.singletonList(dataSetTableService.save(datasetTable).getId()));
} }
} }

View File

@ -336,14 +336,15 @@ public class ApiProvider extends Provider {
o.put("deType", 0); o.put("deType", 0);
o.put("extField", 0); o.put("extField", 0);
o.put("checked", false); o.put("checked", false);
// for (DatasetTableFieldDTO fieldDTO : apiDefinition.getFields()) { if (!apiDefinition.isUseJsonPath()) {
// if (StringUtils.isNotEmpty(o.getString("jsonPath")) && StringUtils.isNotEmpty(fieldDTO.getJsonPath()) && fieldDTO.getJsonPath().equals(o.getString("jsonPath"))) { for (DatasetTableFieldDTO fieldDTO : apiDefinition.getFields()) {
// o.put("checked", true); if (StringUtils.isNotEmpty(o.getString("jsonPath")) && StringUtils.isNotEmpty(fieldDTO.getJsonPath()) && fieldDTO.getJsonPath().equals(o.getString("jsonPath"))) {
// o.put("deExtractType", fieldDTO.getDeExtractType()); o.put("checked", true);
// o.put("name", fieldDTO.getName()); o.put("deExtractType", fieldDTO.getDeExtractType());
// } o.put("name", fieldDTO.getName());
// } }
}
}
} }
static private boolean hasItem(ApiDefinition apiDefinition, List<JSONObject> fields, JSONObject item) { static private boolean hasItem(ApiDefinition apiDefinition, List<JSONObject> fields, JSONObject item) {

View File

@ -381,7 +381,10 @@ export function adaptCurThemeCommonStyle(component) {
if (isFilterComponent(component.component)) { if (isFilterComponent(component.component)) {
const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle
for (const styleKey in filterStyle) { for (const styleKey in filterStyle) {
Vue.set(component.style, styleKey, filterStyle[styleKey]) // 位置属性不修改
if (styleKey !== 'horizontal' && styleKey !== 'vertical') {
Vue.set(component.style, styleKey, filterStyle[styleKey])
}
} }
} else if (isTabComponent(component.component)) { } else if (isTabComponent(component.component)) {
const tabStyle = store.state.canvasStyleData.chartInfo.tabStyle const tabStyle = store.state.canvasStyleData.chartInfo.tabStyle

View File

@ -19,12 +19,14 @@
<el-radio-group <el-radio-group
v-model="styleInfo.horizontal" v-model="styleInfo.horizontal"
size="mini" size="mini"
@change="styleChange"
> >
<el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button> <el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button>
<el-radio-button <el-radio-button
:disabled="styleInfo.vertical === 'center' && elementType !== 'de-select-grid'" :disabled="styleInfo.vertical === 'center' && elementType !== 'de-select-grid'"
label="center" label="center"
>{{ $t('chart.text_pos_center') }}</el-radio-button> >{{ $t('chart.text_pos_center') }}
</el-radio-button>
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button> <el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@ -36,12 +38,14 @@
<el-radio-group <el-radio-group
v-model="styleInfo.vertical" v-model="styleInfo.vertical"
size="mini" size="mini"
@change="styleChange"
> >
<el-radio-button label="top">{{ $t('chart.text_pos_top') }}</el-radio-button> <el-radio-button label="top">{{ $t('chart.text_pos_top') }}</el-radio-button>
<el-radio-button <el-radio-button
:disabled="styleInfo.horizontal === 'center'" :disabled="styleInfo.horizontal === 'center'"
label="center" label="center"
>{{ $t('chart.text_pos_center') }}</el-radio-button> >{{ $t('chart.text_pos_center') }}
</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@ -73,6 +77,12 @@ export default {
type: String, type: String,
default: '' default: ''
} }
},
methods: {
styleChange() {
this.$store.commit('canvasChange')
}
} }
} }

View File

@ -393,7 +393,6 @@ export default {
}, },
getItemTagType() { getItemTagType() {
this.$refs['markForm'].validate((valid) => { this.$refs['markForm'].validate((valid) => {
console.log(valid)
}) })
} }
} }

View File

@ -5,7 +5,7 @@
class="title-text" class="title-text"
> >
<span style="line-height: 26px;"> <span style="line-height: 26px;">
{{ param.tableId?$t('dataset.edit_custom_table'):$t('dataset.add_custom_table') }} {{ param.tableId ? $t('dataset.edit_custom_table') : $t('dataset.add_custom_table') }}
</span> </span>
<el-row style="float: right"> <el-row style="float: right">
<el-button <el-button
@ -24,7 +24,7 @@
</el-button> </el-button>
</el-row> </el-row>
</el-row> </el-row>
<el-divider /> <el-divider/>
<el-row> <el-row>
<el-form :inline="true"> <el-form :inline="true">
<el-form-item <el-form-item
@ -105,9 +105,10 @@
</template> </template>
<script> <script>
import { post, getTable } from '@/api/dataset/dataset' import { getTable, post } from '@/api/dataset/dataset'
import DatasetGroupSelector from '../common/DatasetGroupSelector' import DatasetGroupSelector from '../common/DatasetGroupSelector'
import DatasetCustomField from '../common/DatasetCustomField' import DatasetCustomField from '../common/DatasetCustomField'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default { export default {
name: 'AddCustom', name: 'AddCustom',
@ -252,6 +253,12 @@ export default {
} }
post('/dataset/table/update', table).then(response => { post('/dataset/table/update', table).then(response => {
// this.$store.dispatch('dataset/setSceneData', new Date().getTime()) // this.$store.dispatch('dataset/setSceneData', new Date().getTime())
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.$emit('saveSuccess', table) this.$emit('saveSuccess', table)
this.cancel() this.cancel()
}) })
@ -296,49 +303,50 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-divider--horizontal { .el-divider--horizontal {
margin: 12px 0; margin: 12px 0;
} }
.form-item { .form-item {
margin-bottom: 6px; margin-bottom: 6px;
} }
.el-checkbox { .el-checkbox {
margin-bottom: 14px; margin-bottom: 14px;
margin-left: 0; margin-left: 0;
margin-right: 14px; margin-right: 14px;
} }
.el-checkbox.is-bordered + .el-checkbox.is-bordered { .el-checkbox.is-bordered + .el-checkbox.is-bordered {
margin-left: 0; margin-left: 0;
} }
.dataPreview ::v-deep .el-card__header{ .dataPreview ::v-deep .el-card__header {
padding: 0 8px 12px; padding: 0 8px 12px;
} }
.dataPreview ::v-deep .el-card__body{ .dataPreview ::v-deep .el-card__body {
padding:10px; padding: 10px;
} }
span{ span {
font-size: 14px; font-size: 14px;
} }
.panel-height{ .panel-height {
height: calc(100vh - 56px - 15px - 26px - 25px - 43px); height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
} }
.blackTheme .panel-height{ .blackTheme .panel-height {
height: calc(100vh - 56px - 15px - 26px - 25px - 43px); height: calc(100vh - 56px - 15px - 26px - 25px - 43px);
border-color: var(--TableBorderColor) !important; border-color: var(--TableBorderColor) !important;
} }
.span-number{ .span-number {
color: #0a7be0; color: #0a7be0;
} }
.table-count{
color: #606266; .table-count {
} color: #606266;
}
</style> </style>

View File

@ -8,7 +8,7 @@
class="arrow-right" class="arrow-right"
@click="showLeft = true" @click="showLeft = true"
> >
<i class="el-icon-d-arrow-right" /> <i class="el-icon-d-arrow-right"/>
</p> </p>
<div <div
v-show="showLeft" v-show="showLeft"
@ -21,16 +21,16 @@
effect="dark" effect="dark"
placement="right" placement="right"
> >
<div slot="content"> <div slot="content">
{{ $t('dataset.excel_info_1') }}<br> {{ $t('dataset.excel_info_1') }}<br>
{{ $t('dataset.excel_info_2') }}<br> {{ $t('dataset.excel_info_2') }}<br>
{{ $t('dataset.excel_info_3') }} {{ $t('dataset.excel_info_3') }}
</div> </div>
<i class="el-icon-warning-outline" /> </el-tooltip></span> <i class="el-icon-warning-outline"/> </el-tooltip></span>
<i <i
class="el-icon-d-arrow-left" class="el-icon-d-arrow-left"
@click="showLeft = false" @click="showLeft = false"
/> />
</p> </p>
<el-upload <el-upload
:action="baseUrl + 'dataset/table/excel/upload'" :action="baseUrl + 'dataset/table/excel/upload'"
@ -160,7 +160,7 @@
:key="field.fieldName + field.fieldType" :key="field.fieldName + field.fieldType"
@command="(type) => handleCommand(type, field)" @command="(type) => handleCommand(type, field)"
> >
<span class="type-switch"> <span class="type-switch">
<svg-icon <svg-icon
v-if="field.fieldType === 'TEXT'" v-if="field.fieldType === 'TEXT'"
icon-class="field_text" icon-class="field_text"
@ -179,7 +179,7 @@
icon-class="field_value" icon-class="field_value"
class="field-icon-value" class="field-icon-value"
/> />
<i class="el-icon-arrow-down el-icon--right" /></span> <i class="el-icon-arrow-down el-icon--right"/></span>
<el-dropdown-menu <el-dropdown-menu
slot="dropdown" slot="dropdown"
style="width: 178px" style="width: 178px"
@ -237,8 +237,11 @@ import { $alert } from '@/utils/message'
import store from '@/store' import store from '@/store'
import msgCfm from '@/components/msgCfm/index' import msgCfm from '@/components/msgCfm/index'
import cancelMix from './cancelMix' import cancelMix from './cancelMix'
import Config from "@/settings";
import { updateCacheTree } from '@/components/canvas/utils/utils'
const token = getToken() const token = getToken()
const RefreshTokenKey = Config.RefreshTokenKey
export default { export default {
name: 'AddExcel', name: 'AddExcel',
@ -453,6 +456,12 @@ export default {
this.$refs.tree.setCheckedKeys(this.defaultCheckedKeys) this.$refs.tree.setCheckedKeys(this.defaultCheckedKeys)
}) })
this.fileList = fileList this.fileList = fileList
if (response.headers[RefreshTokenKey]) {
const refreshToken = response.headers[RefreshTokenKey]
setToken(refreshToken)
store.dispatch('user/refreshToken', refreshToken)
}
}, },
save() { save() {
@ -569,6 +578,9 @@ export default {
table.mergeSheet = false table.mergeSheet = false
post('/dataset/table/update', table) post('/dataset/table/update', table)
.then((response) => { .then((response) => {
if (!table.id) {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully') this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data) this.cancel(response.data)
}) })
@ -582,6 +594,9 @@ export default {
this.loading = true this.loading = true
post('/dataset/table/update', table) post('/dataset/table/update', table)
.then((response) => { .then((response) => {
if (!table.id) {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully') this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data) this.cancel(response.data)
}) })
@ -637,10 +652,12 @@ export default {
border-top-right-radius: 13px; border-top-right-radius: 13px;
border-bottom-right-radius: 13px; border-bottom-right-radius: 13px;
} }
.table-list { .table-list {
p { p {
margin: 0; margin: 0;
} }
height: 100%; height: 100%;
width: 240px; width: 240px;
padding: 16px 12px; padding: 16px 12px;
@ -653,6 +670,7 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
color: var(--deTextPrimary, #1f2329); color: var(--deTextPrimary, #1f2329);
i { i {
font-size: 14px; font-size: 14px;
color: var(--deTextPlaceholder, #8f959e); color: var(--deTextPlaceholder, #8f959e);
@ -666,10 +684,12 @@ export default {
.table-checkbox-list { .table-checkbox-list {
height: calc(100% - 100px); height: calc(100% - 100px);
overflow-y: auto; overflow-y: auto;
.custom-tree-node { .custom-tree-node {
position: relative; position: relative;
width: 80%; width: 80%;
display: flex; display: flex;
.label { .label {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
@ -677,11 +697,13 @@ export default {
width: 85%; width: 85%;
} }
} }
.error-name-exist { .error-name-exist {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
.item { .item {
height: 40px; height: 40px;
width: 215px; width: 215px;
@ -719,6 +741,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
.name { .name {
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
@ -749,10 +772,12 @@ export default {
padding: 2px 1.5px; padding: 2px 1.5px;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
i { i {
margin-left: 4px; margin-left: 4px;
font-size: 12px; font-size: 12px;
} }
&:hover { &:hover {
background: rgba(31, 35, 41, 0.1); background: rgba(31, 35, 41, 0.1);
border-radius: 4px; border-radius: 4px;

View File

@ -70,7 +70,7 @@
class="de-text-btn" class="de-text-btn"
@click="dataReference = true" @click="dataReference = true"
> >
<svg-icon icon-class="data-reference" /> <svg-icon icon-class="data-reference"/>
{{ $t('deDataset.data_reference') }} {{ $t('deDataset.data_reference') }}
</el-button> </el-button>
<el-button <el-button
@ -80,17 +80,17 @@
class="de-text-btn" class="de-text-btn"
@click="variableMgm" @click="variableMgm"
> >
<svg-icon icon-class="reference-setting" /> <svg-icon icon-class="reference-setting"/>
{{ $t('sql_variable.variable_mgm') }} {{ $t('sql_variable.variable_mgm') }}
</el-button> </el-button>
<el-divider direction="vertical" /> <el-divider direction="vertical"/>
<el-button <el-button
class="de-text-btn" class="de-text-btn"
type="text" type="text"
size="small" size="small"
@click="getSQLPreview" @click="getSQLPreview"
> >
<svg-icon icon-class="reference-play" /> <svg-icon icon-class="reference-play"/>
{{ $t('deDataset.run_a_query') }} {{ $t('deDataset.run_a_query') }}
</el-button> </el-button>
</el-col> </el-col>
@ -111,7 +111,7 @@
dataTable = '' dataTable = ''
;keywords = '' ;keywords = ''
" "
><i class="el-icon-arrow-left" /> {{ $t('chart.back') }}</span> ><i class="el-icon-arrow-left"/> {{ $t('chart.back') }}</span>
<span v-else>{{ $t('deDataset.data_reference') }}</span> <span v-else>{{ $t('deDataset.data_reference') }}</span>
<i <i
style="cursor: pointer" style="cursor: pointer"
@ -131,7 +131,7 @@
:title="(showTable && dataTable) || selectedDatasource.name" :title="(showTable && dataTable) || selectedDatasource.name"
class="grey-name" class="grey-name"
> >
<svg-icon icon-class="db-de" /> <svg-icon icon-class="db-de"/>
{{ (showTable && dataTable) || selectedDatasource.name }} {{ (showTable && dataTable) || selectedDatasource.name }}
</span> </span>
<span class="grey"> <span class="grey">
@ -146,59 +146,61 @@
v-if="!dataSource" v-if="!dataSource"
class="no-select-datasource" class="no-select-datasource"
>{{ >{{
$t('deDataset.to_start_using') $t('deDataset.to_start_using')
}}</span> }}</span>
<template v-else> <template v-else>
<el-input :placeholder="$t('fu.search_bar.please_input')" style="padding: 5px" size="small" v-model="keywords"></el-input> <el-input :placeholder="$t('fu.search_bar.please_input')" style="padding: 5px" size="small"
v-model="keywords"
></el-input>
<div <div
v-if="dataSource && !dataTable" v-if="dataSource && !dataTable"
v-loading="tableLoading" v-loading="tableLoading"
class="item-list" class="item-list"
>
<div
v-for="ele in tableDataCopy"
:key="ele.name"
class="table-or-field"
@click="typeSwitch(ele)"
> >
<div
v-for="ele in tableDataCopy"
:key="ele.name"
class="table-or-field"
@click="typeSwitch(ele)"
>
<span <span
:title="ele.remark" :title="ele.remark"
class="name" class="name"
>{{ ele.name }}</span> >{{ ele.name }}</span>
<i <i
v-clipboard:copy="ele.name" v-clipboard:copy="ele.name"
v-clipboard:success="onCopy" v-clipboard:success="onCopy"
v-clipboard:error="onError" v-clipboard:error="onError"
class="el-icon-document-copy" class="el-icon-document-copy"
@click.stop @click.stop
/> />
</div>
</div> </div>
</div>
<div
v-else-if="dataSource && dataTable"
v-loading="tableLoading"
class="item-list"
>
<div <div
v-for="ele in fieldDataCopy" v-else-if="dataSource && dataTable"
:key="ele.fieldName" v-loading="tableLoading"
class="table-or-field field" class="item-list"
> >
<div
v-for="ele in fieldDataCopy"
:key="ele.fieldName"
class="table-or-field field"
>
<span <span
:title="ele.remarks" :title="ele.remarks"
class="name" class="name"
>{{ ele.fieldName }}</span> >{{ ele.fieldName }}</span>
<i <i
v-clipboard:copy="ele.fieldName" v-clipboard:copy="ele.fieldName"
v-clipboard:success="onCopy" v-clipboard:success="onCopy"
v-clipboard:error="onError" v-clipboard:error="onError"
class="el-icon-document-copy" class="el-icon-document-copy"
@click.stop @click.stop
/> />
</div>
</div> </div>
</div>
</template> </template>
</div> </div>
<div class="sql-table"> <div class="sql-table">
<div <div
@ -229,10 +231,10 @@
v-if="tabActive === 'result'" v-if="tabActive === 'result'"
class="result-num" class="result-num"
>{{ >{{
`(${$t('dataset.preview_show')} 1000 ${$t( `(${$t('dataset.preview_show')} 1000 ${$t(
'dataset.preview_item' 'dataset.preview_item'
)})` )})`
}}</span> }}</span>
<span <span
class="drag" class="drag"
@ -269,7 +271,8 @@
:image-size="60" :image-size="60"
:image="errImg" :image="errImg"
:description="$t('deDataset.run_failed')" :description="$t('deDataset.run_failed')"
>{{ errMsgCont }}</el-empty> >{{ errMsgCont }}
</el-empty>
<el-table <el-table
v-else v-else
:data="plxTableData" :data="plxTableData"
@ -365,7 +368,7 @@
direction="rtl" direction="rtl"
> >
<div class="content"> <div class="content">
<i class="el-icon-info" /> <i class="el-icon-info"/>
{{ $t('dataset.sql_variable_limit_1') }}<br> {{ $t('dataset.sql_variable_limit_1') }}<br>
{{ $t('dataset.sql_variable_limit_2') }}<br> {{ $t('dataset.sql_variable_limit_2') }}<br>
</div> </div>
@ -451,7 +454,7 @@
:content="$t('commons.parameter_effect')" :content="$t('commons.parameter_effect')"
placement="top" placement="top"
> >
<i class="el-icon-warning" /> <i class="el-icon-warning"/>
</el-tooltip> </el-tooltip>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
@ -519,14 +522,16 @@
secondary secondary
@click="closeVariableMgm" @click="closeVariableMgm"
>{{ >{{
$t('dataset.cancel') $t('dataset.cancel')
}}</deBtn> }}
</deBtn>
<deBtn <deBtn
type="primary" type="primary"
@click="saveVariable()" @click="saveVariable()"
>{{ >{{
$t('dataset.confirm') $t('dataset.confirm')
}}</deBtn> }}
</deBtn>
</div> </div>
</el-drawer> </el-drawer>
</div> </div>
@ -536,9 +541,8 @@
</template> </template>
<script> <script>
import { post, listDatasource, isKettleRunning } from '@/api/dataset/dataset' import { getTable, isKettleRunning, listDatasource, post } from '@/api/dataset/dataset'
import { codemirror } from 'vue-codemirror' import { codemirror } from 'vue-codemirror'
import { getTable } from '@/api/dataset/dataset'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
// //
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
@ -568,6 +572,8 @@ import cancelMix from './cancelMix'
import { pySort } from './util' import { pySort } from './util'
import _ from 'lodash' import _ from 'lodash'
import GridTable from '@/components/gridTable/index.vue' import GridTable from '@/components/gridTable/index.vue'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default { export default {
name: 'AddSQL', name: 'AddSQL',
components: { codemirror, GridTable }, components: { codemirror, GridTable },
@ -575,7 +581,8 @@ export default {
props: { props: {
param: { param: {
type: Object, type: Object,
default: () => {} default: () => {
}
} }
}, },
data() { data() {
@ -762,7 +769,7 @@ export default {
this.fieldData = res.data this.fieldData = res.data
this.fieldDataCopy = this.arrSort([...this.fieldData]) this.fieldDataCopy = this.arrSort([...this.fieldData])
}) })
.finally(() => { .finally(() => {
this.tableLoading = false this.tableLoading = false
}) })
}, },
@ -827,8 +834,8 @@ export default {
}, },
arrSort(arr = [], field = 'fieldName') { arrSort(arr = [], field = 'fieldName') {
arr.sort((a, b) => { arr.sort((a, b) => {
return a[field][0].toLowerCase().charCodeAt() - b[field][0].toLowerCase().charCodeAt() return a[field][0].toLowerCase().charCodeAt() - b[field][0].toLowerCase().charCodeAt()
}) })
return arr return arr
}, },
@ -923,16 +930,17 @@ export default {
listSqlLog() { listSqlLog() {
post( post(
'/dataset/table/sqlLog/' + '/dataset/table/sqlLog/' +
this.paginationConfig.currentPage + this.paginationConfig.currentPage +
'/' + '/' +
this.paginationConfig.pageSize, this.paginationConfig.pageSize,
{ id: this.param.tableId, dataSourceId: this.dataSource } { id: this.param.tableId, dataSourceId: this.dataSource }
) )
.then((response) => { .then((response) => {
this.sqlData = response.data.listObject this.sqlData = response.data.listObject
this.paginationConfig.total = response.data.itemCount this.paginationConfig.total = response.data.itemCount
}) })
.catch(() => {}) .catch(() => {
})
}, },
save() { save() {
if (!this.dataSource || this.datasource === '') { if (!this.dataSource || this.datasource === '') {
@ -965,6 +973,12 @@ export default {
} }
post('/dataset/table/update', table) post('/dataset/table/update', table)
.then((response) => { .then((response) => {
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.openMessageSuccess('deDataset.set_saved_successfully') this.openMessageSuccess('deDataset.set_saved_successfully')
this.cancel(response.data) this.cancel(response.data)
}) })
@ -975,14 +989,16 @@ export default {
onCopy(e) { onCopy(e) {
this.openMessageSuccess('commons.copy_success') this.openMessageSuccess('commons.copy_success')
}, },
onError(e) {}, onError(e) {
},
showSQL(val) { showSQL(val) {
this.sql = val || '' this.sql = val || ''
}, },
onCmReady(cm) { onCmReady(cm) {
this.codemirror.setSize('-webkit-fill-available', 'auto') this.codemirror.setSize('-webkit-fill-available', 'auto')
}, },
onCmFocus(cm) {}, onCmFocus(cm) {
},
onCmCodeChange(newCode) { onCmCodeChange(newCode) {
this.sql = newCode this.sql = newCode
this.$emit('codeChange', this.sql) this.$emit('codeChange', this.sql)
@ -1068,6 +1084,7 @@ export default {
.select-type { .select-type {
width: 180px; width: 180px;
.el-input__inner { .el-input__inner {
padding-left: 32px; padding-left: 32px;
} }
@ -1079,6 +1096,7 @@ export default {
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.content { .content {
height: 62px; height: 62px;
width: 822px; width: 822px;
@ -1097,14 +1115,17 @@ export default {
font-size: 14px; font-size: 14px;
color: var(--primary, #3370ff); color: var(--primary, #3370ff);
} }
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
.dataset-sql { .dataset-sql {
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.sql-editer { .sql-editer {
background: #f5f6f7; background: #f5f6f7;
padding: 16px 24px; padding: 16px 24px;
@ -1115,11 +1136,13 @@ export default {
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
overflow: hidden; overflow: hidden;
.data-reference { .data-reference {
width: 280px; width: 280px;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
border-left: 1px solid var(--deCardStrokeColor, #dee0e3); border-left: 1px solid var(--deCardStrokeColor, #dee0e3);
.no-select-datasource { .no-select-datasource {
font-family: PingFang SC; font-family: PingFang SC;
font-size: 14px; font-size: 14px;
@ -1129,6 +1152,7 @@ export default {
width: 100%; width: 100%;
padding: 16px 12px; padding: 16px 12px;
} }
.table-database-name { .table-database-name {
font-family: PingFang SC; font-family: PingFang SC;
font-size: 16px; font-size: 16px;
@ -1136,6 +1160,7 @@ export default {
color: var(--deTextPrimary, #1f2329); color: var(--deTextPrimary, #1f2329);
padding: 16px 12px; padding: 16px 12px;
border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3); border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3);
p { p {
display: flex; display: flex;
align-items: center; align-items: center;
@ -1161,6 +1186,7 @@ export default {
padding: 16px 8px; padding: 16px 8px;
height: calc(100vh - 242px); height: calc(100vh - 242px);
overflow: auto; overflow: auto;
.table-or-field { .table-or-field {
height: 40px; height: 40px;
width: 100%; width: 100%;
@ -1203,34 +1229,40 @@ export default {
i { i {
display: block; display: block;
} }
background: rgba(31, 35, 41, 0.1); background: rgba(31, 35, 41, 0.1);
} }
} }
} }
} }
.sql-table { .sql-table {
flex: 1; flex: 1;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
.code-container { .code-container {
background: #f5f6f7; background: #f5f6f7;
box-sizing: border-box; box-sizing: border-box;
min-height: 248px; min-height: 248px;
color: var(--deTextPrimary, #1f2329); color: var(--deTextPrimary, #1f2329);
.CodeMirror { .CodeMirror {
height: 100% !important; height: 100% !important;
} }
} }
} }
} }
.sql-result { .sql-result {
font-family: PingFang SC; font-family: PingFang SC;
font-size: 14px; font-size: 14px;
overflow-y: auto; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
.sql-title { .sql-title {
user-select: none; user-select: none;
height: 54px; height: 54px;
@ -1247,6 +1279,7 @@ export default {
color: var(--deTextSecondary, #646a73); color: var(--deTextSecondary, #646a73);
margin-left: 12px; margin-left: 12px;
} }
.drag { .drag {
position: absolute; position: absolute;
top: 0; top: 0;
@ -1271,6 +1304,7 @@ export default {
padding: 0 25px 18px 25px; padding: 0 25px 18px 25px;
overflow-y: auto; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
.el-empty__bottom, .el-empty__bottom,
.el-empty__description p { .el-empty__description p {
font-family: PingFang SC; font-family: PingFang SC;
@ -1281,16 +1315,20 @@ export default {
} }
} }
} }
.table-container { .table-container {
height: calc(100% - 125px); height: calc(100% - 125px);
padding: 0 24px; padding: 0 24px;
.mar6 { .mar6 {
margin-right: 6px; margin-right: 6px;
} }
.mar3 { .mar3 {
margin-left: -3px; margin-left: -3px;
} }
} }
.table-container-filter { .table-container-filter {
height: calc(100% - 110px); height: calc(100% - 110px);
} }

View File

@ -53,8 +53,8 @@
<div class="sql-title"> <div class="sql-title">
{{ $t('deDataset.data_preview') }} {{ $t('deDataset.data_preview') }}
<span class="result-num">{{ <span class="result-num">{{
`(${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')})` `(${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')})`
}}</span> }}</span>
<span <span
class="drag" class="drag"
@mousedown="mousedownDrag" @mousedown="mousedownDrag"
@ -96,13 +96,15 @@
secondary secondary
@click="closeSelectDs()" @click="closeSelectDs()"
>{{ >{{
$t('dataset.cancel') $t('dataset.cancel')
}}</deBtn> }}
</deBtn>
<deBtn <deBtn
:disabled="!tempDs.id" :disabled="!tempDs.id"
type="primary" type="primary"
@click="confirmSelectDs()" @click="confirmSelectDs()"
>{{ $t('dataset.confirm') }}</deBtn> >{{ $t('dataset.confirm') }}
</deBtn>
</div> </div>
</el-drawer> </el-drawer>
@ -120,20 +122,22 @@
size="840px" size="840px"
direction="rtl" direction="rtl"
> >
<union-edit :union-param="unionParam" /> <union-edit :union-param="unionParam"/>
<div class="de-foot"> <div class="de-foot">
<deBtn <deBtn
secondary secondary
@click="closeEditUnion()" @click="closeEditUnion()"
>{{ >{{
$t('dataset.cancel') $t('dataset.cancel')
}}</deBtn> }}
</deBtn>
<deBtn <deBtn
type="primary" type="primary"
@click="confirmEditUnion()" @click="confirmEditUnion()"
>{{ >{{
$t('dataset.confirm') $t('dataset.confirm')
}}</deBtn> }}
</deBtn>
</div> </div>
</el-drawer> </el-drawer>
</div> </div>
@ -148,6 +152,8 @@ import { post } from '@/api/dataset/dataset'
import UnionPreview from '@/views/dataset/add/union/UnionPreview' import UnionPreview from '@/views/dataset/add/union/UnionPreview'
import cancelMix from './cancelMix' import cancelMix from './cancelMix'
import msgCfm from '@/components/msgCfm/index' import msgCfm from '@/components/msgCfm/index'
import { updateCacheTree } from '@/components/canvas/utils/utils'
export default { export default {
name: 'AddUnion', name: 'AddUnion',
components: { components: {
@ -267,6 +273,12 @@ export default {
} }
post('/dataset/table/update', table) post('/dataset/table/update', table)
.then((response) => { .then((response) => {
if (table.id) {
const renameNode = { id: table.id, name: table.name, label: table.name }
updateCacheTree('rename', 'dataset-tree', renameNode, JSON.parse(localStorage.getItem('dataset-tree')))
} else {
updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree')))
}
this.$emit('saveSuccess', table) this.$emit('saveSuccess', table)
this.cancel(response.data) this.cancel(response.data)
}) })
@ -413,6 +425,7 @@ export default {
overflow-y: auto; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
.sql-title { .sql-title {
user-select: none; user-select: none;
height: 54px; height: 54px;
@ -437,6 +450,7 @@ export default {
color: var(--deTextSecondary, #646a73); color: var(--deTextSecondary, #646a73);
margin-left: 12px; margin-left: 12px;
} }
.drag { .drag {
position: absolute; position: absolute;
top: 0; top: 0;