From d902c7807d63cd740858b788a5f09063fcdd5739 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:41:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E6=BA=90=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=20bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/dataset/dataset.js | 3 +- frontend/src/components/msgCfm/index.js | 9 +- frontend/src/utils/message.js | 2 +- frontend/src/utils/request.js | 2 +- frontend/src/views/dataset/add/AddExcel.vue | 133 +++++++++--------- frontend/src/views/dataset/add/AddSQL.vue | 11 +- frontend/src/views/dataset/add/AddUnion.vue | 43 ++++-- .../src/views/dataset/data/UpdateInfo.vue | 32 ++--- frontend/src/views/dataset/form.vue | 16 ++- frontend/src/views/dataset/group/Group.vue | 1 + .../system/datasource/DsConfiguration.vue | 60 +++++++- .../src/views/system/datasource/DsForm.vue | 18 ++- frontend/src/views/system/task/form.vue | 1 + 13 files changed, 219 insertions(+), 112 deletions(-) diff --git a/frontend/src/api/dataset/dataset.js b/frontend/src/api/dataset/dataset.js index 8f1ddb69a2..d29956a17a 100644 --- a/frontend/src/api/dataset/dataset.js +++ b/frontend/src/api/dataset/dataset.js @@ -145,11 +145,12 @@ export function batchEdit(data) { }) } -export function post(url, data, showLoading = true, timeout = 60000) { +export function post(url, data, showLoading = true, timeout = 60000, hideMsg) { return request({ url: url, method: 'post', loading: showLoading, + hideMsg, data }) } diff --git a/frontend/src/components/msgCfm/index.js b/frontend/src/components/msgCfm/index.js index 7ccc95a8fb..59331628b1 100644 --- a/frontend/src/components/msgCfm/index.js +++ b/frontend/src/components/msgCfm/index.js @@ -12,7 +12,7 @@ export default { }); }, handlerConfirm(options,confirmButtonTextInfo) { - let { title, content, type = 'danger', cb, confirmButtonText = confirmButtonTextInfo?confirmButtonTextInfo:this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t("commons.cancel"), cancelCb = () => {} } = options; + let { title, content, type = 'danger', cb, confirmButtonText = confirmButtonTextInfo?confirmButtonTextInfo:this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t("commons.cancel"), cancelCb = () => {}, finallyCb = () => {} } = options; let text = content ? `${ this.$t(title) }
${ this.$t(content) }` : this.$t(title); const dangerouslyUseHTMLString = Boolean(content); let customClass = `de-confirm de-confirm-fail ${ dangerouslyUseHTMLString && 'de-use-html'}` @@ -34,8 +34,11 @@ export default { .then(() => { cb(); }) - .catch(() => { - cancelCb() + .catch((action) => { + cancelCb(action) + }) + .finally(() => { + finallyCb() }); }, }, diff --git a/frontend/src/utils/message.js b/frontend/src/utils/message.js index 74f3daa4de..da7a19d12d 100644 --- a/frontend/src/utils/message.js +++ b/frontend/src/utils/message.js @@ -17,7 +17,7 @@ export const $confirm = (message, callback, options = {}) => { const title = i18n.t('commons.message_box.confirm') MessageBox.confirm(message, title, defaultOptions).then(() => { callback() - }) + }).catch(() => {}) } export const $success = (message, duration) => { diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 313bf12fcb..d6fb40edeb 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -116,7 +116,7 @@ service.interceptors.response.use(response => { msg = error.message } !config.hideMsg && (!headers['authentication-status']) && $error(msg) - return Promise.reject(error) + return Promise.reject(config.url === '/dataset/table/sqlPreview' ? msg : error) }) const checkDownError = response => { if (response.request && response.request.responseType && response.request.responseType === 'blob' && response.headers && response.headers['de-down-error-msg']) { diff --git a/frontend/src/views/dataset/add/AddExcel.vue b/frontend/src/views/dataset/add/AddExcel.vue index 22d23e45ec..10aafa2aca 100644 --- a/frontend/src/views/dataset/add/AddExcel.vue +++ b/frontend/src/views/dataset/add/AddExcel.vue @@ -5,14 +5,16 @@

- {{ $t('deDataset.select_data_table ') }} + {{ $t('deDataset.select_data_table ') }}

- {{ $t('dataset.excel_info_1') }}
- {{ $t('dataset.excel_info_2') }}
+ {{ $t('dataset.excel_info_1') }}
+ {{ $t('dataset.excel_info_2') }}
{{ $t('dataset.excel_info_3') }}
- +

{{ $t('deDataset.upload_data') }} + >{{ $t('deDataset.upload_data') }}
@@ -53,7 +55,10 @@ > {{ data.excelLable }} - + @@ -118,24 +123,20 @@ + class="field-icon-text" /> + class="field-icon-time" /> - + class="field-icon-value" /> + - - - - + > + + + + {{ item.label }} + >{{ item.label }} @@ -219,7 +222,7 @@ export default { originName: { type: String, default: '' - }, + } }, data() { return { @@ -292,9 +295,7 @@ export default { this.defaultCheckedKeys.splice(index, 1) } this.validateName() - const labelList = this.$refs.tree - .getCheckedNodes() - .map((ele) => ele.id) + const labelList = this.$refs.tree.getCheckedNodes().map((ele) => ele.id) const excelList = this.excelData.map((ele) => ele.id) this.$emit( 'setTableNum', @@ -351,7 +352,7 @@ export default { }, calHeight() { const that = this - setTimeout(function() { + setTimeout(function () { const currentHeight = document.documentElement.clientHeight that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10 }, 10) @@ -478,14 +479,15 @@ export default { this.param.tableId && (effectExtField || changeFiled) ) { - var msg = effectExtField - ? i18n.t('dataset.task.effect_ext_field') + - ', ' + - i18n.t('dataset.task.excel_replace_msg') - : i18n.t('dataset.task.excel_replace_msg') - $confirm(msg, () => { - this.saveExcelData(sheetFileMd5, table) - }) + const options = { + title: 'deDataset.replace_the_data', + confirmButtonText: this.$t('commons.confirm'), + content: + '替换可能会影响自定义数据集、关联数据集、仪表板等,是否替换?', + type: 'primary', + cb: () => this.saveExcelData(sheetFileMd5, table) + } + this.handlerConfirm(options) } else { this.saveExcelData(sheetFileMd5, table) } @@ -495,25 +497,23 @@ export default { new Set(sheetFileMd5).size !== sheetFileMd5.length && !this.param.tableId ) { - this.$confirm( - this.$t('dataset.task.excel_replace_msg'), - this.$t('dataset.merge_title'), - { - distinguishCancelAndClose: true, - confirmButtonText: this.$t('dataset.merge'), - cancelButtonText: this.$t('dataset.no_merge'), - type: 'info' - } - ) - .then(() => { + const options = { + title: 'dataset.merge_title', + content: 'dataset.task.excel_replace_msg', + confirmButtonText: this.$t('dataset.merge'), + cancelButtonText: this.$t('dataset.no_merge'), + type: 'primary', + cb: () => { table.mergeSheet = true this.loading = true post('/dataset/table/update', table).then((response) => { this.openMessageSuccess('deDataset.set_saved_successfully') this.cancel(response.data) - }) - }) - .catch((action) => { + }).finally(() => { + this.loading = false + }) + }, + cancelCb: (action) => { if (action === 'close') { return } @@ -527,10 +527,9 @@ export default { .finally(() => { this.loading = false }) - }) - .finally(() => { - this.loading = false - }) + } + } + this.handlerConfirm(options) } else { this.loading = true post('/dataset/table/update', table) diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index 435ed76da1..ecad900e12 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -179,7 +179,7 @@ :image-size="60" :image="errImg" :description="$t('deDataset.run_failed')" - /> + >{{ errMsgCont }} { this.fields = response.data.fields this.data = response.data.data @@ -626,7 +628,8 @@ export default { this.$refs.plxTable?.reloadData(datas) }) }) - .catch((err) => { + .catch((err, msg) => { + this.errMsgCont = err this.errMsg = true }) }, diff --git a/frontend/src/views/dataset/add/AddUnion.vue b/frontend/src/views/dataset/add/AddUnion.vue index 2d4fffd52e..b9db47bfc7 100644 --- a/frontend/src/views/dataset/add/AddUnion.vue +++ b/frontend/src/views/dataset/add/AddUnion.vue @@ -40,8 +40,20 @@ `(${$t('dataset.preview_show')} 1000 ${$t('dataset.preview_item')})` }} + + {{ $t('deDataset.data_preview') }} +
- +
{ - this.$emit('saveSuccess', table) - this.cancel(response.data) - }).finally(() => { - this.loading = false; - }) + post('/dataset/table/update', table) + .then((response) => { + this.$emit('saveSuccess', table) + this.cancel(response.data) + }) + .finally(() => { + this.loading = false + }) }, selectDs() { this.selectDsDialog = true @@ -367,7 +382,7 @@ export default { .unio-editer-container { min-height: 298px; width: 100%; - background: #F5F6F7; + background: #f5f6f7; } .preview-container { @@ -382,12 +397,20 @@ export default { height: 54px; display: flex; align-items: center; + position: relative; padding: 16px 24px; font-weight: 500; position: relative; color: var(--deTextPrimary, #1f2329); border-bottom: 1px solid rgba(31, 35, 41, 0.15); + .posi-right { + position: absolute; + right: 24px; + top: 50%; + transform: translateY(-50%); + } + .result-num { font-weight: 400; color: var(--deTextSecondary, #646a73); diff --git a/frontend/src/views/dataset/data/UpdateInfo.vue b/frontend/src/views/dataset/data/UpdateInfo.vue index 1a8e0e2b76..ac25ba10c4 100644 --- a/frontend/src/views/dataset/data/UpdateInfo.vue +++ b/frontend/src/views/dataset/data/UpdateInfo.vue @@ -49,19 +49,6 @@ - - - - + + + + @@ -280,7 +280,7 @@ > -
+
- + { + this.back() + } + } + this.handlerConfirm(options) + }, nameBlur() { this.nameExsitValidator() this.showInput = this.nameExsit diff --git a/frontend/src/views/dataset/group/Group.vue b/frontend/src/views/dataset/group/Group.vue index bbab6be283..97cbb5bb50 100644 --- a/frontend/src/views/dataset/group/Group.vue +++ b/frontend/src/views/dataset/group/Group.vue @@ -562,6 +562,7 @@ export default { } else { const currentNodeId = sessionStorage.getItem('dataset-current-node') if (currentNodeId) { + sessionStorage.setItem('dataset-current-node', '') this.dfsTableData(this.tData, currentNodeId) } } diff --git a/frontend/src/views/system/datasource/DsConfiguration.vue b/frontend/src/views/system/datasource/DsConfiguration.vue index 277c5bc0dc..c721071058 100644 --- a/frontend/src/views/system/datasource/DsConfiguration.vue +++ b/frontend/src/views/system/datasource/DsConfiguration.vue @@ -246,7 +246,7 @@ " :label="$t('datasource.extra_params')" > - + {{ $t('datasource.column_info') }}
-
+
@@ -540,7 +540,8 @@ @@ -567,6 +568,20 @@ >{{ item.label }} + + + + + + + + @@ -712,7 +727,7 @@ export default { name: [ { required: true, - message: i18n.t('datasource.input_name'), + validator: this.nameRepeat, trigger: 'blur' } ], @@ -955,6 +970,22 @@ export default { } }) }, + nameRepeat(rule, value, callback) { + let hasRepeatName = false + this.form.apiConfiguration.forEach((item) => { + if ( + item.name === this.apiItem.name && + item.serialNumber !== this.apiItem.serialNumber + ) { + hasRepeatName = true + } + }) + if (hasRepeatName) { + callback(new Error(i18n.t('theme.name_repeat'))); + return + } + callback(); + }, next() { if (this.active === 1) { let hasRepeatName = false @@ -1502,4 +1533,23 @@ export default { } } } +.de-svg-in-table { + .select-type { + width: 180px; + ::v-deep.el-input__inner { + padding-left: 32px; + } + } + .select-svg-icon { + position: absolute; + left: 24px; + top: 15px; + } + + ::v-deep.el-table__expand-icon { + .el-icon-arrow-right::before { + content: "\E791" !important; + } + } +} diff --git a/frontend/src/views/system/datasource/DsForm.vue b/frontend/src/views/system/datasource/DsForm.vue index caf7966df5..41a6597add 100644 --- a/frontend/src/views/system/datasource/DsForm.vue +++ b/frontend/src/views/system/datasource/DsForm.vue @@ -2,7 +2,7 @@
- + {{ params && params.id && @@ -17,7 +17,7 @@