mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-20 18:49:19 +00:00
@@ -962,6 +962,11 @@ export default {
|
|||||||
this.innerQuery = attrs
|
this.innerQuery = attrs
|
||||||
return this.getList()
|
return this.getList()
|
||||||
},
|
},
|
||||||
|
searchDate(attrs) {
|
||||||
|
this.extraQuery = attrs
|
||||||
|
return this.getList()
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置查询,相当于点击「重置」按钮
|
* 重置查询,相当于点击「重置」按钮
|
||||||
*
|
*
|
||||||
|
@@ -95,6 +95,9 @@ export default {
|
|||||||
getData() {
|
getData() {
|
||||||
return this.$refs.table.data
|
return this.$refs.table.data
|
||||||
},
|
},
|
||||||
|
searchDate(attrs) {
|
||||||
|
return this.$refs.table.searchDate(attrs)
|
||||||
|
},
|
||||||
search(attrs) {
|
search(attrs) {
|
||||||
return this.$refs.table.search(attrs)
|
return this.$refs.table.search(attrs)
|
||||||
},
|
},
|
||||||
|
52
src/components/DateTimePicker/index.vue
Normal file
52
src/components/DateTimePicker/index.vue
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="value"
|
||||||
|
type="daterange"
|
||||||
|
:range-separator="this.$t('common.To')"
|
||||||
|
:start-placeholder="this.$t('common.StartDate')"
|
||||||
|
:end-placeholder="this.$t('common.StartDate')"
|
||||||
|
align="center"
|
||||||
|
size="large"
|
||||||
|
value-format="timestamp"
|
||||||
|
:clearable="false"
|
||||||
|
class="datepicker"
|
||||||
|
@change="handleDateChange"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: '',
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleDateChange(val) {
|
||||||
|
this.$emit('dateChange', val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='less' scoped>
|
||||||
|
.datepicker{
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
.el-input__inner{
|
||||||
|
border: 1px solid #dcdee2;
|
||||||
|
border-radius: 3px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.el-date-editor /deep/ .el-input__icon{
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
.el-date-editor /deep/ .el-range-separator{
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
</style>
|
@@ -3,11 +3,13 @@
|
|||||||
<slot name="header">
|
<slot name="header">
|
||||||
<div class="table-header-left-side">
|
<div class="table-header-left-side">
|
||||||
<LeftSide v-if="hasLeftActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
|
<LeftSide v-if="hasLeftActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
|
||||||
<span v-else>
|
<span v-else style="display: flex;flex-direction: row">
|
||||||
|
<DateTimePicker v-if="hasDatePicker" class="datepicker" @dateChange="handleDateChange" />
|
||||||
<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" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-action-right-side">
|
<div class="table-action-right-side">
|
||||||
|
<DateTimePicker v-if="hasDatePicker && hasLeftActions" class="datepicker" @dateChange="handleDateChange" />
|
||||||
<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" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
|
||||||
<RightSide v-if="hasRightActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
|
<RightSide v-if="hasRightActions" :selected-rows="selectedRows" :table-url="tableUrl" v-bind="$attrs" v-on="$listeners" />
|
||||||
</div>
|
</div>
|
||||||
@@ -18,21 +20,24 @@
|
|||||||
<script>
|
<script>
|
||||||
import AutoDataSearch from '@/components/AutoDataSearch'
|
import AutoDataSearch from '@/components/AutoDataSearch'
|
||||||
import LeftSide from './LeftSide'
|
import LeftSide from './LeftSide'
|
||||||
|
import DateTimePicker from '@/components/DateTimePicker'
|
||||||
import RightSide from './RightSide'
|
import RightSide from './RightSide'
|
||||||
|
|
||||||
const defaultTrue = { type: Boolean, default: true }
|
const defaultTrue = { type: Boolean, default: true }
|
||||||
|
const defaultFalse = { type: Boolean, default: false }
|
||||||
export default {
|
export default {
|
||||||
name: 'TableAction',
|
name: 'TableAction',
|
||||||
components: {
|
components: {
|
||||||
AutoDataSearch,
|
AutoDataSearch,
|
||||||
LeftSide,
|
LeftSide,
|
||||||
|
DateTimePicker,
|
||||||
RightSide
|
RightSide
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
hasLeftActions: defaultTrue,
|
hasLeftActions: defaultTrue,
|
||||||
hasSearch: defaultTrue,
|
hasSearch: defaultTrue,
|
||||||
hasRightActions: defaultTrue,
|
hasRightActions: defaultTrue,
|
||||||
|
hasDatePicker: defaultFalse,
|
||||||
searchConfig: {
|
searchConfig: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
@@ -41,6 +46,10 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
|
datePick: {
|
||||||
|
type: Function,
|
||||||
|
default: (val) => {}
|
||||||
|
},
|
||||||
searchTable: {
|
searchTable: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: (val) => {}
|
default: (val) => {}
|
||||||
@@ -63,6 +72,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
handleTagSearch(val) {
|
handleTagSearch(val) {
|
||||||
this.searchTable(val)
|
this.searchTable(val)
|
||||||
|
},
|
||||||
|
handleDateChange(val) {
|
||||||
|
this.datePick(val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,5 +130,8 @@ export default {
|
|||||||
display: block;
|
display: block;
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
}
|
}
|
||||||
|
.datepicker{
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<TableAction :table-url="tableConfig.url" :search-table="search" v-bind="headerActions" :selected-rows="selectedRows" :reload-table="reloadTable" />
|
<TableAction :table-url="iTableConfig.url" :search-table="search" :date-pick="handleDateChange" v-bind="headerActions" :selected-rows="selectedRows" :reload-table="reloadTable" />
|
||||||
<IBox class="table-content">
|
<IBox class="table-content">
|
||||||
<AutoDataTable :key="tableConfig.url" ref="dataTable" :config="tableConfig" @selection-change="handleSelectionChange" v-on="$listeners" @update="handleDataChange" />
|
<AutoDataTable :key="iTableConfig.url" ref="dataTable" :config="iTableConfig" @selection-change="handleSelectionChange" v-on="$listeners" @update="handleDataChange" />
|
||||||
</IBox>
|
</IBox>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -35,7 +35,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedRows: [],
|
selectedRows: [],
|
||||||
init: false
|
init: false,
|
||||||
|
iTableConfig: {
|
||||||
|
extraQuery: {
|
||||||
|
date_from: '',
|
||||||
|
date_to: ''
|
||||||
|
},
|
||||||
|
...this.tableConfig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -57,6 +64,17 @@ export default {
|
|||||||
search(attrs) {
|
search(attrs) {
|
||||||
return this.dataTable.search(attrs)
|
return this.dataTable.search(attrs)
|
||||||
},
|
},
|
||||||
|
handleDateChange(attrs) {
|
||||||
|
console.log(attrs)
|
||||||
|
this.iTableConfig.extraQuery = {
|
||||||
|
date_from: attrs[0],
|
||||||
|
date_to: attrs[1]
|
||||||
|
}
|
||||||
|
return this.dataTable.searchDate({
|
||||||
|
date_from: attrs[0],
|
||||||
|
date_to: attrs[1]
|
||||||
|
})
|
||||||
|
},
|
||||||
toggleRowSelection(row, isSelected) {
|
toggleRowSelection(row, isSelected) {
|
||||||
return this.dataTable.toggleRowSelection(row, isSelected)
|
return this.dataTable.toggleRowSelection(row, isSelected)
|
||||||
},
|
},
|
||||||
|
@@ -155,6 +155,9 @@
|
|||||||
"Info": "提示",
|
"Info": "提示",
|
||||||
"Members": "成员",
|
"Members": "成员",
|
||||||
"More": "更多",
|
"More": "更多",
|
||||||
|
"StartDate": "开始日期",
|
||||||
|
"EndDate": "结束日期",
|
||||||
|
"To": "至",
|
||||||
"MoreActions": "更多操作",
|
"MoreActions": "更多操作",
|
||||||
"Name": "名称",
|
"Name": "名称",
|
||||||
"NoData": "暂无数据",
|
"NoData": "暂无数据",
|
||||||
|
@@ -136,6 +136,9 @@
|
|||||||
"Activate": "Activate",
|
"Activate": "Activate",
|
||||||
"Active": "Active",
|
"Active": "Active",
|
||||||
"Add": "Add",
|
"Add": "Add",
|
||||||
|
"StartDate": "Start date",
|
||||||
|
"EndDate": "End date",
|
||||||
|
"To": "To",
|
||||||
"Auth": "Authorization",
|
"Auth": "Authorization",
|
||||||
"Basic": "Basic",
|
"Basic": "Basic",
|
||||||
"BasicInfo": "Basic info",
|
"BasicInfo": "Basic info",
|
||||||
|
@@ -69,7 +69,8 @@ export default {
|
|||||||
headerActions: {
|
headerActions: {
|
||||||
hasLeftActions: false,
|
hasLeftActions: false,
|
||||||
hasImport: false,
|
hasImport: false,
|
||||||
hasExport: false
|
hasExport: false,
|
||||||
|
hasDatePicker: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -99,7 +99,8 @@ export default {
|
|||||||
hasLeftActions: false,
|
hasLeftActions: false,
|
||||||
hasExport: false,
|
hasExport: false,
|
||||||
hasImport: false,
|
hasImport: false,
|
||||||
hasRefresh: false
|
hasRefresh: false,
|
||||||
|
hasDatePicker: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user