refactor: 格式化

This commit is contained in:
taojinlong 2022-09-20 17:41:45 +08:00
parent d522122fb2
commit d9d5c1cd08
2 changed files with 62 additions and 67 deletions

View File

@ -1,16 +1,16 @@
<template> <template>
<div class="dataset-api"> <div class="dataset-api">
<p v-if="!showLeft" @click="showLeft = true" class="arrow-right"> <p v-if="!showLeft" class="arrow-right" @click="showLeft = true">
<i class="el-icon-d-arrow-right"></i> <i class="el-icon-d-arrow-right" />
</p> </p>
<div class="table-list" v-else> <div v-else class="table-list">
<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 class="el-icon-d-arrow-left" @click="showLeft = false" />
</p> </p>
<el-select <el-select
class="ds-list"
v-model="dataSource" v-model="dataSource"
class="ds-list"
filterable filterable
:placeholder="$t('dataset.pls_slc_data_source')" :placeholder="$t('dataset.pls_slc_data_source')"
size="small" size="small"
@ -35,10 +35,10 @@
<!-- <div class="item" v-for="(ele, index) in tableData"> --> <!-- <div class="item" v-for="(ele, index) in tableData"> -->
<el-checkbox-group v-model="checkTableList" size="small"> <el-checkbox-group v-model="checkTableList" size="small">
<el-tooltip <el-tooltip
:disabled="t.enableCheck"
effect="dark"
v-for="t in tableData" v-for="t in tableData"
:key="t.name" :key="t.name"
:disabled="t.enableCheck"
effect="dark"
:content="$t('dataset.table_already_add_to') + ': ' + t.datasetPath" :content="$t('dataset.table_already_add_to') + ': ' + t.datasetPath"
placement="right" placement="right"
> >
@ -49,10 +49,9 @@
class="item" class="item"
@click="setActiveName(t)" @click="setActiveName(t)"
> >
<el-checkbox :label="t.name" :disabled="!t.enableCheck"> <el-checkbox :label="t.name" :disabled="!t.enableCheck" />
</el-checkbox>
<span class="label">{{ showTableNameWithComment(t) }}</span> <span class="label">{{ showTableNameWithComment(t) }}</span>
<span class="error-name-exsit" v-if="t.nameExsit"> <span v-if="t.nameExsit" class="error-name-exsit">
<svg-icon icon-class="exclamationmark" class="ds-icon-scene" /> <svg-icon icon-class="exclamationmark" class="ds-icon-scene" />
</span> </span>
</div> </div>
@ -86,21 +85,21 @@
</el-select> </el-select>
</div> </div>
<el-empty <el-empty
v-if="!dataSource"
style="padding-top: 160px" style="padding-top: 160px"
size="125" size="125"
v-if="!dataSource"
:description="$t('dataset.pls_slc_data_source')" :description="$t('dataset.pls_slc_data_source')"
:image="noSelectTable" :image="noSelectTable"
></el-empty> />
<template v-else-if="activeName"> <template v-else-if="activeName">
<div class="dataset"> <div class="dataset">
<span class="name">{{ $t('dataset.name') }}</span> <span class="name">{{ $t('dataset.name') }}</span>
<el-input <el-input
@change="validateName"
v-if="activeIndex !== -1" v-if="activeIndex !== -1"
v-model="tableData[activeIndex].datasetName" v-model="tableData[activeIndex].datasetName"
size="small" size="small"
clearable clearable
@change="validateName"
/> />
<div <div
v-if="tableData[activeIndex].nameExsit" v-if="tableData[activeIndex].nameExsit"
@ -110,7 +109,7 @@
{{ $t('deDataset.already_exists') }} {{ $t('deDataset.already_exists') }}
</div> </div>
</div> </div>
<div class="data" v-loading="tableLoading"> <div v-loading="tableLoading" class="data">
<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>
@ -136,26 +135,26 @@
</div> </div>
</template> </template>
<el-empty <el-empty
v-else-if="avilibelTable"
style="padding-top: 160px" style="padding-top: 160px"
size="125" size="125"
v-else-if="avilibelTable"
:description="$t('deDataset.is_currently_available')" :description="$t('deDataset.is_currently_available')"
:image="noAvilibelTableImg" :image="noAvilibelTableImg"
></el-empty> />
<el-empty <el-empty
v-else-if="!activeName"
style="padding-top: 160px" style="padding-top: 160px"
size="125" size="125"
v-else-if="!activeName"
:description="$t('deDataset.left_to_edit')" :description="$t('deDataset.left_to_edit')"
:image="noSelectTable" :image="noSelectTable"
></el-empty> />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { listApiDatasource, post, isKettleRunning } from '@/api/dataset/dataset' import { listApiDatasource, post, isKettleRunning } from '@/api/dataset/dataset'
import {dbPreview, engineMode} from '@/api/system/engine' import { dbPreview, engineMode } from '@/api/system/engine'
export default { export default {
name: 'AddApi', name: 'AddApi',
@ -282,7 +281,7 @@ export default {
}, },
calHeight() { calHeight() {
const that = this const that = this
setTimeout(function () { setTimeout(function() {
const currentHeight = document.documentElement.clientHeight const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 195 - 54 that.height = currentHeight - 195 - 54
}, 10) }, 10)
@ -336,7 +335,7 @@ export default {
const tables = [] const tables = []
const mode = this.mode const mode = this.mode
const syncType = this.syncType const syncType = this.syncType
this.checkTableList.forEach(function (name) { this.checkTableList.forEach(function(name) {
const datasetName = this.tableData.find( const datasetName = this.tableData.find(
(ele) => ele.name === name (ele) => ele.name === name
).datasetName ).datasetName

View File

@ -1,21 +1,19 @@
<template> <template>
<div class="dataset-excel"> <div class="dataset-excel">
<p v-if="!showLeft" @click="showLeft = true" class="arrow-right"> <p v-if="!showLeft" class="arrow-right" @click="showLeft = true">
<i class="el-icon-d-arrow-right"></i> <i class="el-icon-d-arrow-right" />
</p> </p>
<div class="table-list" v-else> <div v-else class="table-list">
<p class="select-ds"> <p class="select-ds">
<span <span>{{ $t('deDataset.select_data_table ') }}
>{{ $t('deDataset.select_data_table ') }}
<el-tooltip class="item" effect="dark" placement="right"> <el-tooltip class="item" effect="dark" 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"></i> </el-tooltip <i class="el-icon-warning-outline" /> </el-tooltip></span>
></span> <i class="el-icon-d-arrow-left" @click="showLeft = false" />
<i @click="showLeft = false" class="el-icon-d-arrow-left"></i>
</p> </p>
<el-upload <el-upload
:action="baseUrl + 'dataset/table/excel/upload'" :action="baseUrl + 'dataset/table/excel/upload'"
@ -23,7 +21,7 @@
:show-file-list="false" :show-file-list="false"
:file-list="fileList" :file-list="fileList"
:data="param" :data="param"
accept=".xls,.xlsx,csv" accept=".xls,.xlsx,.csv"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:on-error="uploadFail" :on-error="uploadFail"
@ -57,12 +55,12 @@
</div> </div>
<div class="table-detail"> <div class="table-detail">
<el-empty <el-empty
v-if="!excelData.length"
style="padding-top: 172px" style="padding-top: 172px"
:image-size="125" :image-size="125"
v-if="!excelData.length"
:image="errImg" :image="errImg"
:description="$t('deDataset.excel_data_first')" :description="$t('deDataset.excel_data_first')"
></el-empty> />
<template v-else> <template v-else>
<div class="dataset"> <div class="dataset">
<span class="name">{{ $t('dataset.name') }}</span> <span class="name">{{ $t('dataset.name') }}</span>
@ -105,24 +103,26 @@
<svg-icon <svg-icon
v-if="field.fieldType === 'TEXT'" v-if="field.fieldType === 'TEXT'"
icon-class="field_text" icon-class="field_text"
class="field-icon-text" /> class="field-icon-text"
/>
<svg-icon <svg-icon
v-if="field.fieldType === 'DATETIME'" v-if="field.fieldType === 'DATETIME'"
icon-class="field_time" icon-class="field_time"
class="field-icon-time" /> class="field-icon-time"
/>
<svg-icon <svg-icon
v-if=" v-if="
field.fieldType === 'LONG' || field.fieldType === 'LONG' ||
field.fieldType === 'DOUBLE' field.fieldType === 'DOUBLE'
" "
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"></i />
></span> <i class="el-icon-arrow-down el-icon--right" /></span>
<el-dropdown-menu <el-dropdown-menu
slot="dropdown"
style="width: 178px" style="width: 178px"
class="de-card-dropdown" class="de-card-dropdown"
slot="dropdown"
> >
<el-dropdown-item <el-dropdown-item
v-for="item in fieldOptions" v-for="item in fieldOptions"
@ -153,9 +153,7 @@
font-size: 14px; font-size: 14px;
margin-left: 10px; margin-left: 10px;
" "
>{{ item.label }}</span >{{ item.label }}</span></el-dropdown-item>
></el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<span style="font-size: 14px; margin-left: 10px"> <span style="font-size: 14px; margin-left: 10px">
@ -170,7 +168,6 @@
</div> </div>
</template> </template>
<script> <script>
import { post } from '@/api/dataset/dataset' import { post } from '@/api/dataset/dataset'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
@ -297,7 +294,7 @@ export default {
}, },
calHeight() { calHeight() {
const that = this const that = this
setTimeout(function () { setTimeout(function() {
const currentHeight = document.documentElement.clientHeight const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10 that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10
}, 10) }, 10)
@ -424,7 +421,6 @@ export default {
} }
if (this.param.editType === 0 && this.param.tableId && (effectExtField || changeFiled)) { if (this.param.editType === 0 && this.param.tableId && (effectExtField || changeFiled)) {
var msg = effectExtField ? i18n.t('dataset.effect_ext_field') + ', ' + i18n.t('dataset.excel_replace_msg') : i18n.t('dataset.excel_replace_msg') var msg = effectExtField ? i18n.t('dataset.effect_ext_field') + ', ' + i18n.t('dataset.excel_replace_msg') : i18n.t('dataset.excel_replace_msg')
$confirm(msg, () => { $confirm(msg, () => {
this.saveExcelData(sheetFileMd5, table) this.saveExcelData(sheetFileMd5, table)