fix: 修改自动生成的数据搜索,修改command execution日志列表

This commit is contained in:
ibuler
2020-06-05 14:29:16 +08:00
parent 0a41180c68
commit 6f439751cb
7 changed files with 42 additions and 35 deletions

View File

@@ -1,10 +1,8 @@
<template>
<TagSearch v-if="options !== []" :options="options" :config="defaultConfig" v-on="$listeners" />
<TagSearch :options="options" v-bind="$attrs" v-on="$listeners" />
</template>
<script>
const merge = require('deepmerge')
// import { optionUrlMeta } from '@/api/common'
import TagSearch from '@/components/TagSearch'
export default {
name: 'AutoDataSearch',
@@ -12,24 +10,11 @@ export default {
props: {
url: {
type: String,
default: () => {}
default: ''
},
config: {
type: Object,
default: () => {}
}
},
data() {
return {
defaultConfig: {
expandTrigger: 'hover'
},
options: []
}
},
computed: {
iConfig() {
return this.config ? merge(this.defaultConfig, this.config) : this.defaultConfig
options: {
type: Array,
default: () => []
}
},
watch: {
@@ -38,7 +23,9 @@ export default {
}
},
mounted() {
this.genericOptions()
if (this.url) {
this.genericOptions()
}
},
methods: {
async genericOptions() {

View File

@@ -175,7 +175,7 @@ export default {
})
// TODO 修改默认确认框
const msg = '你想移动节点: `' + treeNodesNames.join(',') + '` 到 `' + targetNode.name + '` 下吗?'
const msg = this.$t('common.tree.DropConfirmMsg', { src: treeNodesNames.join(','), dst: targetNode.name })
return confirm(msg)
},
onDrop: function(event, treeId, treeNodes, targetNode, moveType) {
@@ -184,9 +184,9 @@ export default {
$.each(treeNodes, function(index, value) {
treeNodesIds.push(value.meta.node.id)
})
const the_url = `${this.treeSetting.nodeUrl}${targetNode.meta.node.id}/children/add/`
const theUrl = `${this.treeSetting.nodeUrl}${targetNode.meta.node.id}/children/add/`
this.$axios.put(
the_url, {
theUrl, {
nodes: treeNodesIds
}
).then((res) => {
@@ -218,10 +218,11 @@ export default {
}
newNode.checked = this.zTree.getSelectedNodes()[0].checked
this.zTree.addNodes(parentNode, 0, newNode)
vm.$refs.dataztree.refresh()
// const node = this.zTree.getNodeByParam('id', newNode.id, parentNode)
// this.zTree.editName(node)
this.$message.success(this.$t('common.updateSuccessMsg'))
// vm.$refs.dataztree.refresh()
console.log(vm.zTree)
const node = vm.zTree.getNodeByParam('id', newNode.id, parentNode)
vm.zTree.editName(node)
vm.$message.success(this.$t('common.updateSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + error))
})

View File

@@ -4,12 +4,12 @@
<div class="table-header-left-side">
<LeftSide v-if="hasLeftActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
<span v-else style="display: flex;flex-direction: row">
<AutoDataSearch v-if="hasSearch" class="right-side-item action-search" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
<AutoDataSearch v-if="hasSearch" class="right-side-item action-search" v-bind="iSearchTableConfig" @tagSearch="handleTagSearch" />
<DatetimeRangePicker v-if="hasDatePicker" v-bind="datePicker" class="datepicker" @dateChange="handleDateChange" />
</span>
</div>
<div class="table-action-right-side">
<AutoDataSearch v-if="hasLeftActions && hasSearch" class="right-side-item action-search" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
<AutoDataSearch v-if="hasLeftActions && hasSearch" class="right-side-item action-search" v-bind="iSearchTableConfig" @tagSearch="handleTagSearch" />
<DatetimeRangePicker v-if="hasDatePicker && hasLeftActions" v-bind="datePicker" class="datepicker" @dateChange="handleDateChange" />
<RightSide v-if="hasRightActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
</div>
@@ -66,12 +66,17 @@ export default {
data() {
return {
keyword: ''
}
},
computed: {
hasSelectedRows() {
return this.selectedRows.length > 0
},
iSearchTableConfig() {
const configDefault = {
url: this.tableUrl
}
return Object.assign(configDefault, this.searchConfig)
}
},
methods: {

View File

@@ -63,7 +63,6 @@ export default {
watch: {
filterTags: {
handler(val) {
console.log(this.filterTags)
this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
// this.$emit('tagSearch', this.filterMaps)
},

View File

@@ -239,7 +239,8 @@
"rows": "行",
"tree": {
"Empty": "空",
"Loading": "加载中"
"Loading": "加载中",
"DropConfirmMsg": "你想移动节点: {src} 到 {dst} 下吗?"
},
"updateErrorMsg": "更新失败",
"updateSelected": "更新所选",
@@ -655,7 +656,10 @@
},
"audits": {
"View": "查看",
"Hosts": "主机"
"Hosts": "主机",
"User": "用户",
"Command": "命令",
"RunUser": "运行用户"
},
"users": {
"SSHKey": "SSH公钥",

View File

@@ -17,7 +17,6 @@ router.beforeEach(async(to, from, next) => {
} catch (e) {
const msg = 'Start service error: ' + e
console.log(msg)
alert(msg)
}
})

View File

@@ -91,6 +91,18 @@ export default {
hasLeftActions: false,
hasDatePicker: true,
hasImport: false,
searchConfig: {
options: [
{
label: this.$t('audits.User'),
value: 'user__name'
},
{
label: this.$t('audits.RunUser'),
value: 'run_as__name'
}
]
},
datePicker: {
dateStart: dateFrom,
dateEnd: dateTo