mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-22 20:56:53 +00:00
feat: 优化 400请求的提示,优化tagsearch
This commit is contained in:
@@ -954,9 +954,13 @@ export default {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
search(attrs) {
|
||||
search(attrs, reset) {
|
||||
// Orange 重置查询对象
|
||||
this.innerQuery = merge(this.innerQuery, attrs)
|
||||
if (reset) {
|
||||
this.innerQuery = merge({}, attrs)
|
||||
} else {
|
||||
this.innerQuery = merge(this.innerQuery, attrs)
|
||||
}
|
||||
return this.getList()
|
||||
},
|
||||
searchDate(attrs) {
|
||||
|
||||
@@ -102,8 +102,8 @@ export default {
|
||||
searchDate(attrs) {
|
||||
return this.$refs.table.searchDate(attrs)
|
||||
},
|
||||
search(attrs) {
|
||||
return this.$refs.table.search(attrs)
|
||||
search(attrs, reset) {
|
||||
return this.$refs.table.search(attrs, reset)
|
||||
},
|
||||
getQuery() {
|
||||
return this.$refs.table.getQuery()
|
||||
|
||||
@@ -94,7 +94,7 @@ export default {
|
||||
this.$axios.put(
|
||||
this.upLoadUrl,
|
||||
item.file,
|
||||
{ headers: { 'Content-Type': 'text/csv' }, disableFlashMsg: true }
|
||||
{ headers: { 'Content-Type': 'text/csv' }, disableFlashErrorMsg: true }
|
||||
).then((data) => {
|
||||
const msg = this.$t('common.imExport.updateSuccessMsg', { count: data.length })
|
||||
this.onSuccess(msg)
|
||||
@@ -106,7 +106,7 @@ export default {
|
||||
this.$axios.post(
|
||||
this.upLoadUrl,
|
||||
item.file,
|
||||
{ headers: { 'Content-Type': 'text/csv' }, disableFlashMsg: true }
|
||||
{ headers: { 'Content-Type': 'text/csv' }, disableFlashErrorMsg: true }
|
||||
).then((data) => {
|
||||
const msg = this.$t('common.imExport.createSuccessMsg', { count: data.length })
|
||||
this.onSuccess(msg)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import ActionsGroup from '@/components/ActionsGroup'
|
||||
import DialogAction from './ImExportDialog'
|
||||
import { cleanActions } from './utils'
|
||||
import _ from 'lodash'
|
||||
|
||||
const defaultTrue = { type: Boolean, default: true }
|
||||
|
||||
@@ -65,9 +64,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSearch: _.debounce(function() {
|
||||
this.searchTable({ search: this.keyword })
|
||||
}, 500),
|
||||
handleTagSearch(val) {
|
||||
this.searchTable(val)
|
||||
},
|
||||
|
||||
@@ -58,10 +58,9 @@ export default {
|
||||
this.dataTable.getList()
|
||||
},
|
||||
search(attrs) {
|
||||
return this.dataTable.search(attrs)
|
||||
return this.dataTable.search(attrs, true)
|
||||
},
|
||||
handleDateChange(attrs) {
|
||||
console.log(attrs)
|
||||
this.iTableConfig.extraQuery = {
|
||||
date_from: attrs[0],
|
||||
date_to: attrs[1]
|
||||
|
||||
@@ -63,9 +63,9 @@ export default {
|
||||
watch: {
|
||||
filterTags: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.$emit('tagSearch', this.filterMaps)
|
||||
}
|
||||
console.log(this.filterTags)
|
||||
this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
|
||||
// this.$emit('tagSearch', this.filterMaps)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
},
|
||||
"common": {
|
||||
"CrontabHelpTips": "eg:每周日 03:05 执行 <5 3 * * 0> <br> 提示: 使用5位 Linux crontab 表达式 <分 时 日 月 星期> (<a href='https://tool.lu/crontab/' target='_blank'>在线工具</a>) <br>注意: 如果同时设置了定期执行和周期执行,优先使用定期执行",
|
||||
"BadRequestErrorMsg": "请求错误,请检查填写内容",
|
||||
"Action": "动作",
|
||||
"Actions": "操作",
|
||||
"Activate": "激活",
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
},
|
||||
"common": {
|
||||
"CrontabHelpTips": "eg: Every Sunday 03:05 run <5 3 * * 0> <br>Tips:Using 5 digits linux crontab expressions<min hour day month week> (<a href='https://tool.lu/crontab/' target='_blank'>Online tools</a>) <br>Note:If both Regularly perform and Cycle perform are set,give priority to Regularly perform",
|
||||
"BadRequestErrorMsg" : "Bad request, please check again",
|
||||
"Action": "Action",
|
||||
"Actions": "Actions",
|
||||
"Activate": "Activate",
|
||||
|
||||
@@ -65,10 +65,22 @@ function ifUnauthorized({ response, error }) {
|
||||
}
|
||||
}
|
||||
|
||||
function ifBadRequest({ response, error }) {
|
||||
console.log(response)
|
||||
if (response.status === 400) {
|
||||
error.message = i18n.t('common.BadRequestErrorMsg')
|
||||
}
|
||||
}
|
||||
|
||||
function flashErrorMsg({ response, error }) {
|
||||
if (!response.config.disableFlashMsg) {
|
||||
if (!response.config.disableFlashErrorMsg) {
|
||||
let msg = error.message
|
||||
const data = response.data
|
||||
if (data && (data.error || data.msg)) {
|
||||
msg = data.error || data.msg
|
||||
}
|
||||
Message({
|
||||
message: error.message,
|
||||
message: msg,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
@@ -102,6 +114,7 @@ service.interceptors.response.use(
|
||||
|
||||
const response = error.response
|
||||
ifUnauthorized({ response, error })
|
||||
ifBadRequest({ response, error })
|
||||
flashErrorMsg({ response, error })
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
ip: {
|
||||
width: '130px'
|
||||
width: '140px'
|
||||
},
|
||||
status: {
|
||||
width: '80px'
|
||||
|
||||
@@ -15,13 +15,19 @@ export default {
|
||||
url: '/api/v1/audits/operate-logs/',
|
||||
columns: ['user', 'action', 'resource_type', 'resource', 'remote_addr', 'datetime'],
|
||||
columnsMeta: {
|
||||
},
|
||||
hasSelection: false
|
||||
datetime: {
|
||||
width: '160px'
|
||||
},
|
||||
remote_addr: {
|
||||
width: '140px'
|
||||
},
|
||||
action: {
|
||||
width: '90px'
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSelection: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasLeftActions: false,
|
||||
hasImport: false,
|
||||
hasRefresh: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user