diff --git a/src/components/AutoDataTable/components/ColumnSettingPopover.vue b/src/components/AutoDataTable/components/ColumnSettingPopover.vue index 18b3c8a11..3a00b3d7d 100644 --- a/src/components/AutoDataTable/components/ColumnSettingPopover.vue +++ b/src/components/AutoDataTable/components/ColumnSettingPopover.vue @@ -58,6 +58,10 @@ export default { minColumns: { type: Array, default: () => [] + }, + url: { + type: String, + default: '' } }, data() { @@ -67,15 +71,17 @@ export default { } }, mounted() { - this.$eventBus.$on('showColumnSettingPopover', () => { - this.showColumnSettingPopover = true - this.iCurrentColumns = this.currentColumns + this.$eventBus.$on('showColumnSettingPopover', ({ url }) => { + if (url === this.url) { + this.showColumnSettingPopover = true + this.iCurrentColumns = this.currentColumns + } }) }, methods: { handleColumnConfirm() { this.showColumnSettingPopover = false - this.$emit('columnsUpdate', this.iCurrentColumns) + this.$emit('columnsUpdate', { columns: this.iCurrentColumns, url: this.url }) } } } diff --git a/src/components/AutoDataTable/index.vue b/src/components/AutoDataTable/index.vue index 685672c06..6d733aead 100644 --- a/src/components/AutoDataTable/index.vue +++ b/src/components/AutoDataTable/index.vue @@ -5,6 +5,7 @@ :current-columns="popoverColumns.currentCols" :total-columns-list="popoverColumns.totalColumnsList" :min-columns="popoverColumns.minCols" + :url="config.url" @columnsUpdate="handlePopoverColumnsChange" /> @@ -15,6 +16,7 @@ import DataTable from '../DataTable' import { DateFormatter, DetailFormatter, DisplayFormatter, BooleanFormatter, ActionsFormatter } from '@/components/TableFormatters' import i18n from '@/i18n/i18n' import ColumnSettingPopover from './components/ColumnSettingPopover' +import { newURL } from '@/utils/common' export default { name: 'AutoDataTable', components: { @@ -228,7 +230,7 @@ export default { const _tableConfig = localStorage.getItem('tableConfig') ? JSON.parse(localStorage.getItem('tableConfig')) : {} - const tableName = this.config.name || this.$route.name + const tableName = this.config.name || this.$route.name + '_' + newURL(this.iConfig.url).pathname const configShowColumnsNames = _.get(_tableConfig[tableName], 'showColumns', null) let showColumnsNames = configShowColumnsNames || defaultColumnsNames if (showColumnsNames.length === 0) { @@ -249,7 +251,7 @@ export default { min: minColumnsNames, configShow: configShowColumnsNames } - this.$log.debug('Cleaned colums show: ', this.cleanedColumnsShow) + this.$log.debug('Cleaned columns show: ', this.cleanedColumnsShow) }, filterShowColumns() { this.cleanColumnsShow() @@ -265,13 +267,13 @@ export default { this.popoverColumns.minCols = this.cleanedColumnsShow.min this.$log.debug('Popover cols: ', this.popoverColumns) }, - handlePopoverColumnsChange(columns) { - // this.$log.debug('Columns change: ', columns) + handlePopoverColumnsChange({ columns, url }) { + this.$log.debug('Columns change: ', columns) this.popoverColumns.currentCols = columns const _tableConfig = localStorage.getItem('tableConfig') ? JSON.parse(localStorage.getItem('tableConfig')) : {} - const tableName = this.config.name || this.$route.name + const tableName = this.config.name || this.$route.name + '_' + newURL(url).pathname _tableConfig[tableName] = { 'showColumns': columns } diff --git a/src/components/ListTable/TableAction/ExportDialog.vue b/src/components/ListTable/TableAction/ExportDialog.vue index 4f6fba559..55e3b2ae1 100644 --- a/src/components/ListTable/TableAction/ExportDialog.vue +++ b/src/components/ListTable/TableAction/ExportDialog.vue @@ -115,8 +115,10 @@ export default { } }, mounted() { - this.$eventBus.$on('showExportDialog', (row) => { - this.showExportDialog = true + this.$eventBus.$on('showExportDialog', ({ selectedRows, url }) => { + if (url === this.url) { + this.showExportDialog = true + } }) }, methods: { diff --git a/src/components/ListTable/TableAction/ImportDialog.vue b/src/components/ListTable/TableAction/ImportDialog.vue index fc440f281..c24976ac9 100644 --- a/src/components/ListTable/TableAction/ImportDialog.vue +++ b/src/components/ListTable/TableAction/ImportDialog.vue @@ -7,7 +7,6 @@ :loading-status="loadStatus" width="80%" class="importDialog" - :confirm-title="confirmTitle" :show-cancel="false" :show-confirm="false" @close="handleImportCancel" @@ -118,9 +117,6 @@ export default { } else { return this.$t('common.Import') + this.$t('common.Update') } - }, - confirmTitle() { - return '导入' } }, watch: { @@ -129,8 +125,10 @@ export default { } }, mounted() { - this.$eventBus.$on('showImportDialog', (row) => { - this.showImportDialog = true + this.$eventBus.$on('showImportDialog', ({ url }) => { + if (url === this.url) { + this.showImportDialog = true + } }) }, methods: { diff --git a/src/components/ListTable/TableAction/RightSide.vue b/src/components/ListTable/TableAction/RightSide.vue index 65658eef9..e4cf949bf 100644 --- a/src/components/ListTable/TableAction/RightSide.vue +++ b/src/components/ListTable/TableAction/RightSide.vue @@ -1,6 +1,6 @@ @@ -27,21 +27,21 @@ export default { handleExport: { type: Function, default: function({ selectedRows }) { - this.$eventBus.$emit('showExportDialog', { selectedRows }) + this.$eventBus.$emit('showExportDialog', { selectedRows, url: this.tableUrl }) } }, hasImport: defaultTrue, handleImport: { type: Function, default: function({ selectedRows }) { - this.$eventBus.$emit('showImportDialog', { selectedRows }) + this.$eventBus.$emit('showImportDialog', { selectedRows, url: this.tableUrl }) } }, hasColumnSetting: defaultTrue, handleColumnConfig: { type: Function, - default: function() { - this.$eventBus.$emit('showColumnSettingPopover') + default: function({ selectedRows }) { + this.$eventBus.$emit('showColumnSettingPopover', { url: this.tableUrl }) } }, hasRefresh: defaultTrue, diff --git a/src/userviews/users/UserProfile/PasswordUpdate.vue b/src/userviews/users/UserProfile/PasswordUpdate.vue index 8f4f5d138..9a5440580 100644 --- a/src/userviews/users/UserProfile/PasswordUpdate.vue +++ b/src/userviews/users/UserProfile/PasswordUpdate.vue @@ -16,6 +16,7 @@ import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm' import UserPassword from '@/components/FormFields/UserPassword' import { IBox } from '@/components' +import rules from '@/components/DataForm/rules' export default { name: 'PasswordUpdate', @@ -42,8 +43,8 @@ export default { }, new_password: { label: this.$t('users.NewPassword'), - component: UserPassword, - rules: [] + rules: [rules.RequiredChange], + component: UserPassword }, new_password_again: { label: this.$t('users.ConfirmPassword'), diff --git a/src/utils/common.js b/src/utils/common.js index 7cfd1a3ec..bc67400d5 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -206,6 +206,16 @@ function customizer(objValue, srcValue) { return _.isUndefined(objValue) ? srcValue : objValue } +export function newURL(url) { + let obj + if (url.indexOf('//') > -1) { + obj = new URL(url) + } else { + obj = new URL(url, 'http://localhost') + } + return obj +} + export const assignIfNot = _.partialRight(_.assignInWith, customizer) const scheme = document.location.protocol diff --git a/src/views/assets/SystemUser/SystemUserCreate/fields.js b/src/views/assets/SystemUser/SystemUserCreate/fields.js index a947bac8f..ffdb30cb7 100644 --- a/src/views/assets/SystemUser/SystemUserCreate/fields.js +++ b/src/views/assets/SystemUser/SystemUserCreate/fields.js @@ -36,6 +36,8 @@ function getFields() { if (form.username_same_with_user) { this.fieldsMeta.username.el.disabled = true form.username = '' + } else { + this.fieldsMeta.username.el.disabled = false } } } diff --git a/src/views/sessions/CommandStorageCreateUpdate.vue b/src/views/sessions/CommandStorageCreateUpdate.vue index e6d61d532..babe3d4a9 100644 --- a/src/views/sessions/CommandStorageCreateUpdate.vue +++ b/src/views/sessions/CommandStorageCreateUpdate.vue @@ -53,21 +53,23 @@ export default { return `${url}?type=${commandType}` }, url: '/api/v1/terminal/command-storages/' - } }, computed: { - }, methods: { afterGetFormValue(validValues) { + if (!validValues?.meta?.HOSTS) { + return validValues + } validValues.meta.HOSTS = validValues.meta.HOSTS.toString() return validValues }, performSubmit(validValues) { const method = this.getMethod() validValues.meta.HOSTS = validValues.meta.HOSTS.split(',').map(item => (item.trim())) - return this.$axios[method](`${this.getUrl()}`, validValues) + const url = this.getUrl() + return this.$axios[method](url, validValues) }, getMethod() { const params = this.$route.params diff --git a/src/views/settings/DingTalk.vue b/src/views/settings/DingTalk.vue index 805140ddb..5b047476d 100644 --- a/src/views/settings/DingTalk.vue +++ b/src/views/settings/DingTalk.vue @@ -7,6 +7,7 @@ :fields-meta="fieldsMeta" :more-buttons="moreButtons" :has-detail-in-msg="false" + :clean-form-value="cleanFormValue" /> @@ -56,6 +57,13 @@ export default { methods: { getMethod() { return 'put' + }, + // 不清理的话,编辑secret,在删除提交会报错 + cleanFormValue(data) { + if (!data['DINGTALK_APPSECRET']) { + delete data['DINGTALK_APPSECRET'] + } + return data } } } diff --git a/src/views/settings/Email.vue b/src/views/settings/Email.vue index 41fad0cc5..d5cde7f27 100644 --- a/src/views/settings/Email.vue +++ b/src/views/settings/Email.vue @@ -3,7 +3,7 @@ @@ -56,6 +57,13 @@ export default { methods: { getMethod() { return 'put' + }, + // 不清理的话,编辑secret,在删除提交会报错 + cleanFormValue(data) { + if (!data['WECOM_SECRET']) { + delete data['WECOM_SECRET'] + } + return data } } } diff --git a/src/views/xpack/Cloud/Account/AccountCreateUpdate.vue b/src/views/xpack/Cloud/Account/AccountCreateUpdate.vue index 32414b596..b0471df16 100644 --- a/src/views/xpack/Cloud/Account/AccountCreateUpdate.vue +++ b/src/views/xpack/Cloud/Account/AccountCreateUpdate.vue @@ -40,8 +40,8 @@ export default { } } }, - updateSuccessNextRoute: { name: 'AccountList' }, - createSuccessNextRoute: { name: 'AccountList' }, + updateSuccessNextRoute: { name: 'CloudCenter', params: { activeMenu: 'AccountList' }}, + createSuccessNextRoute: { name: 'CloudCenter', params: { activeMenu: 'AccountList' }}, getUrl() { const params = this.$route.params let url = `/api/v1/xpack/cloud/accounts/`