feat(search): 调整搜索组件j-advanced-search 组件改为 j-search 组件并调整搜索配置,应用名称改为dr-iot,去除头部菜单logo右侧间距
This commit is contained in:
parent
99f450eed3
commit
e7bfb4084e
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "jetlinks-vue",
|
"name": "dr-iot",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<j-advanced-search
|
<j-search
|
||||||
:target='target'
|
:target='target'
|
||||||
:type='type'
|
:columns='processedColumns'
|
||||||
:request='(data) => saveSearchHistory(data, target)'
|
|
||||||
:historyRequest='() => getSearchHistory(target)'
|
|
||||||
:deleteRequest='(_target: string, id: string) => deleteSearchHistory(target, id)'
|
|
||||||
:columns='columns'
|
|
||||||
:class='props.class'
|
:class='props.class'
|
||||||
style='padding-top: 18px; padding-bottom: 18px;'
|
style='padding-top: 18px; padding-bottom: 18px;'
|
||||||
@search='searchSubmit'
|
@search='searchSubmit'
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts' name='ProSearch'>
|
<script setup lang='ts' name='ProSearch'>
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
|
@ -29,7 +25,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'advanced'
|
default: 'terms'
|
||||||
},
|
},
|
||||||
target: {
|
target: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -44,10 +40,33 @@ const props = defineProps({
|
||||||
|
|
||||||
const emit = defineEmits<Emit>()
|
const emit = defineEmits<Emit>()
|
||||||
|
|
||||||
|
// 处理列配置,为每个带有search的列自动添加defaultValue(如果没有的话)
|
||||||
|
const processedColumns = computed(() => {
|
||||||
|
return props.columns.map(column => {
|
||||||
|
// 如果列有search配置但没有defaultValue,则添加一个空的defaultValue
|
||||||
|
if (column.search && !column.search.hasOwnProperty('defaultValue')) {
|
||||||
|
return {
|
||||||
|
...column,
|
||||||
|
search: {
|
||||||
|
...column.search,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return column
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交
|
* 提交
|
||||||
*/
|
*/
|
||||||
const searchSubmit = (data: any) => {
|
const searchSubmit = (data: any) => {
|
||||||
|
console.log("搜索--------",data)
|
||||||
|
data = {
|
||||||
|
terms:[{
|
||||||
|
terms:data
|
||||||
|
}]
|
||||||
|
}
|
||||||
emit('search', data)
|
emit('search', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ body {
|
||||||
|
|
||||||
.ant-pro-basicLayout {
|
.ant-pro-basicLayout {
|
||||||
.ant-pro-top-nav-header-main {
|
.ant-pro-top-nav-header-main {
|
||||||
gap: 16px;
|
//gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-pro-top-nav-header {
|
.ant-pro-top-nav-header {
|
||||||
|
|
|
@ -144,9 +144,9 @@ const columns = [
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -186,9 +186,9 @@ const columns = [
|
||||||
dataIndex: 'requestTime',
|
dataIndex: 'requestTime',
|
||||||
key: 'requestTime',
|
key: 'requestTime',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'date',
|
// type: 'rangePicker',
|
||||||
},
|
// },
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -172,9 +172,9 @@ const columns = [
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
search: {
|
// search: {
|
||||||
type: 'date',
|
// type: 'date',
|
||||||
},
|
// },
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
|
|
|
@ -102,27 +102,27 @@ const query = reactive({
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: '排序',
|
// title: '排序',
|
||||||
dataIndex: 'sortIndex',
|
// dataIndex: 'sortIndex',
|
||||||
key: 'sortIndex',
|
// key: 'sortIndex',
|
||||||
search: {
|
// search: {
|
||||||
type: 'number',
|
// type: 'number',
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
precision: 0,
|
// precision: 0,
|
||||||
min: 1,
|
// min: 1,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
scopedSlots: true,
|
// scopedSlots: true,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: '说明',
|
// title: '说明',
|
||||||
key: 'description',
|
// key: 'description',
|
||||||
dataIndex: 'description',
|
// dataIndex: 'description',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
|
|
|
@ -310,9 +310,9 @@ const columns = [
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
search: {
|
// search: {
|
||||||
type: 'date',
|
// type: 'date',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
@ -472,9 +472,9 @@ const columns = [
|
||||||
dataIndex: 'describe',
|
dataIndex: 'describe',
|
||||||
key: 'describe',
|
key: 'describe',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -555,9 +555,9 @@ const query = reactive({
|
||||||
title: '说明',
|
title: '说明',
|
||||||
key: 'describe',
|
key: 'describe',
|
||||||
dataIndex: 'describe',
|
dataIndex: 'describe',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '产品分类',
|
title: '产品分类',
|
||||||
|
|
|
@ -260,9 +260,9 @@ const columns = [
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -106,9 +106,9 @@ const columns = [
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -196,9 +196,9 @@ const columns = [
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -261,9 +261,9 @@ const columns = [
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -267,9 +267,9 @@ const columns = [
|
||||||
key: 'description',
|
key: 'description',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -259,9 +259,9 @@ const columns = [
|
||||||
key: 'description',
|
key: 'description',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -333,9 +333,9 @@ const columns = [
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -264,9 +264,9 @@ const columns = [
|
||||||
title: '最近告警时间',
|
title: '最近告警时间',
|
||||||
dataIndex: 'alarmTime',
|
dataIndex: 'alarmTime',
|
||||||
key: 'alarmTime',
|
key: 'alarmTime',
|
||||||
search: {
|
// search: {
|
||||||
type: 'date',
|
// type: 'rangePicker',
|
||||||
},
|
// },
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,9 +217,9 @@ const columns = [
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
title: '说明',
|
title: '说明',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -146,9 +146,9 @@ const columns = [
|
||||||
dataIndex: 'sortIndex',
|
dataIndex: 'sortIndex',
|
||||||
key: 'sortIndex',
|
key: 'sortIndex',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'number',
|
// type: 'number',
|
||||||
},
|
// },
|
||||||
width: 80,
|
width: 80,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -163,9 +163,9 @@ const columns = [
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
// search: {
|
||||||
type: 'date',
|
// type: 'date',
|
||||||
},
|
// },
|
||||||
width: 180,
|
width: 180,
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -146,9 +146,9 @@ const columns = [
|
||||||
key: 'description',
|
key: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
|
@ -89,9 +89,9 @@ const columns = [
|
||||||
key: 'description',
|
key: 'description',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
search: {
|
// search: {
|
||||||
type: 'string',
|
// type: 'string',
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|
Loading…
Reference in New Issue