@meethive/components 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/EditTable/props.js +1 -1
- package/es/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/es/ProLayout/TopHeader/index.js +91 -99
- package/es/ProTable/Alert.js +1 -1
- package/es/ProTable/Content.js +4 -4
- package/es/ProTable/Pagination.js +1 -1
- package/es/ProTable/ProTable.js +3 -3
- package/es/ProTable/setting.js +1 -1
- package/es/Search/Advanced/History.js +142 -0
- package/es/Search/Advanced/SaveHistory.js +124 -0
- package/es/Search/Advanced/index.js +369 -0
- package/es/Search/index.js +3 -3
- package/es/VirtualTable/VirtualTable.js +4 -4
- package/es/components.js +1 -1
- package/lib/EditTable/props.js +1 -1
- package/lib/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/lib/ProLayout/TopHeader/index.js +91 -99
- package/lib/ProTable/Alert.js +1 -1
- package/lib/ProTable/Content.js +4 -4
- package/lib/ProTable/Pagination.js +1 -1
- package/lib/ProTable/ProTable.js +3 -3
- package/lib/ProTable/setting.js +1 -1
- package/lib/Search/Advanced/History.js +142 -0
- package/lib/Search/Advanced/SaveHistory.js +124 -0
- package/lib/Search/Advanced/index.js +369 -0
- package/lib/Search/index.js +3 -3
- package/lib/VirtualTable/VirtualTable.js +4 -4
- package/lib/components.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, withModifiers as _withModifiers } from "vue";
|
|
3
|
+
const _hoisted_1 = ["onClick"];
|
|
4
|
+
const _hoisted_2 = {
|
|
5
|
+
class: "delete"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_3 = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "search-history-empty"
|
|
10
|
+
};
|
|
11
|
+
import { computed, ref } from 'vue';
|
|
12
|
+
import { isFunction } from 'lodash-es';
|
|
13
|
+
import { AIcon, Empty, Ellipsis } from '../../';
|
|
14
|
+
import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue';
|
|
15
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
16
|
+
import useSearchStyle from '../style';
|
|
17
|
+
const __sfc_main__ = _defineComponent({
|
|
18
|
+
__name: 'History',
|
|
19
|
+
props: {
|
|
20
|
+
target: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
request: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
deleteRequest: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
deleteKey: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'key'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ['click', 'itemClick'],
|
|
39
|
+
setup(__props, {
|
|
40
|
+
emit: __emit
|
|
41
|
+
}) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const emit = __emit;
|
|
44
|
+
const prefixCls = computed(() => 'JSearch');
|
|
45
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls);
|
|
46
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
47
|
+
const historyList = ref([]);
|
|
48
|
+
const historyVisible = ref(false);
|
|
49
|
+
const showEmpty = computed(() => {
|
|
50
|
+
return historyList.value.length === 0;
|
|
51
|
+
});
|
|
52
|
+
const showHistoryList = async () => {
|
|
53
|
+
if (props.request) {
|
|
54
|
+
const resp = await props.request(props.target);
|
|
55
|
+
if (resp.success && resp.result.length) {
|
|
56
|
+
historyList.value = resp.result.filter(item => item.content);
|
|
57
|
+
} else {
|
|
58
|
+
historyList.value = [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const visibleChange = async v => {
|
|
63
|
+
historyVisible.value = v;
|
|
64
|
+
};
|
|
65
|
+
const click = () => {
|
|
66
|
+
emit('click');
|
|
67
|
+
};
|
|
68
|
+
const itemClick = content => {
|
|
69
|
+
historyVisible.value = false;
|
|
70
|
+
emit('itemClick', content);
|
|
71
|
+
};
|
|
72
|
+
const deleteHistory = async item => {
|
|
73
|
+
if (props.deleteRequest && isFunction(props.deleteRequest)) {
|
|
74
|
+
const resp = await props.deleteRequest(props.target, item[props.deleteKey]);
|
|
75
|
+
historyVisible.value = false;
|
|
76
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
77
|
+
message.success(contextLocale.value.advanced.saveHistory.success);
|
|
78
|
+
} else {
|
|
79
|
+
message.error(contextLocale.value.advanced.saveHistory.fail);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return (_ctx, _cache) => {
|
|
84
|
+
return _openBlock(), _createElementBlock("div", {
|
|
85
|
+
class: _normalizeClass(['search-history-warp', _unref(hashId)])
|
|
86
|
+
}, [_createVNode(_unref(FormItemRest), null, {
|
|
87
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
88
|
+
class: "search-history-button",
|
|
89
|
+
type: "primary",
|
|
90
|
+
"html-type": "submit"
|
|
91
|
+
}, {
|
|
92
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.history.search), 1 /* TEXT */)]),
|
|
93
|
+
_: 1 /* STABLE */
|
|
94
|
+
})]),
|
|
95
|
+
_: 1 /* STABLE */
|
|
96
|
+
}), _createVNode(_unref(Popover), {
|
|
97
|
+
placement: "bottom",
|
|
98
|
+
trigger: "click",
|
|
99
|
+
"overlay-class-name": "search-history-list-pop",
|
|
100
|
+
open: historyVisible.value,
|
|
101
|
+
onVisibleChange: visibleChange
|
|
102
|
+
}, {
|
|
103
|
+
content: _withCtx(() => [!showEmpty.value ? (_openBlock(), _createElementBlock("div", {
|
|
104
|
+
key: 0,
|
|
105
|
+
class: _normalizeClass(['search-history-items', _unref(hashId)])
|
|
106
|
+
}, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(historyList.value, item => {
|
|
107
|
+
return _openBlock(), _createElementBlock("div", {
|
|
108
|
+
key: item.id,
|
|
109
|
+
class: "search-history-item"
|
|
110
|
+
}, [_createElementVNode("div", {
|
|
111
|
+
class: "history-item--title",
|
|
112
|
+
onClick: $event => itemClick(item.content)
|
|
113
|
+
}, [_createVNode(_unref(Ellipsis), {
|
|
114
|
+
style: {
|
|
115
|
+
"width": "100%"
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(item.name), 1 /* TEXT */)]),
|
|
119
|
+
_: 2 /* DYNAMIC */
|
|
120
|
+
}, 1024 /* DYNAMIC_SLOTS */)], 8 /* PROPS */, _hoisted_1), _createVNode(_unref(Popconfirm), {
|
|
121
|
+
title: _unref(contextLocale).advanced.history.confirmDelete,
|
|
122
|
+
placement: "top",
|
|
123
|
+
onConfirm: $event => deleteHistory(item)
|
|
124
|
+
}, {
|
|
125
|
+
default: _withCtx(() => [_createElementVNode("span", _hoisted_2, [_createVNode(_unref(AIcon), {
|
|
126
|
+
type: "DeleteOutlined"
|
|
127
|
+
})])]),
|
|
128
|
+
_: 1 /* STABLE */
|
|
129
|
+
}, 8 /* PROPS */, ["title", "onConfirm"])]);
|
|
130
|
+
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */)) : (_openBlock(), _createElementBlock("div", _hoisted_3, [_createVNode(_unref(Empty))]))]),
|
|
131
|
+
default: _withCtx(() => [_createElementVNode("div", {
|
|
132
|
+
class: "search-history-button-icon",
|
|
133
|
+
onClick: _withModifiers(showHistoryList, ["stop"])
|
|
134
|
+
}, [_createVNode(_unref(AIcon), {
|
|
135
|
+
type: "DownOutlined"
|
|
136
|
+
})])]),
|
|
137
|
+
_: 1 /* STABLE */
|
|
138
|
+
}, 8 /* PROPS */, ["open"])], 2 /* CLASS */);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
style: {
|
|
6
|
+
"width": "240px"
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
import { ref, reactive } from 'vue';
|
|
10
|
+
import { Form, Button, FormItem, Popover, Textarea, message } from 'ant-design-vue';
|
|
11
|
+
import { isFunction } from 'lodash-es';
|
|
12
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
13
|
+
const __sfc_main__ = _defineComponent({
|
|
14
|
+
__name: 'SaveHistory',
|
|
15
|
+
props: {
|
|
16
|
+
terms: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
request: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: null
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
setup(__props) {
|
|
31
|
+
const props = __props;
|
|
32
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
33
|
+
const saveHistoryLoading = ref(false);
|
|
34
|
+
const visible = ref(false);
|
|
35
|
+
const formRef = ref();
|
|
36
|
+
const modelRef = reactive({
|
|
37
|
+
name: undefined
|
|
38
|
+
});
|
|
39
|
+
const visibleChange = e => {
|
|
40
|
+
visible.value = e;
|
|
41
|
+
if (!e) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
modelRef.name = undefined;
|
|
44
|
+
}, 100);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 保存当前查询条件
|
|
50
|
+
*/
|
|
51
|
+
const saveHistory = async () => {
|
|
52
|
+
// 获取当前查询条件并转化为字符串
|
|
53
|
+
const formData = await formRef.value.validate();
|
|
54
|
+
if (formData && props.request && isFunction(props.request)) {
|
|
55
|
+
formData.content = JSON.stringify(props.terms);
|
|
56
|
+
saveHistoryLoading.value = true;
|
|
57
|
+
const resp = await props.request(formData, props.target);
|
|
58
|
+
saveHistoryLoading.value = false;
|
|
59
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
60
|
+
message.success(contextLocale.value.advanced.saveHistory.success);
|
|
61
|
+
visibleChange(false);
|
|
62
|
+
} else {
|
|
63
|
+
message.error(contextLocale.value.advanced.saveHistory.fail);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return _openBlock(), _createBlock(_unref(Popover), {
|
|
69
|
+
open: visible.value,
|
|
70
|
+
"onUpdate:open": _cache[1] || (_cache[1] = $event => visible.value = $event),
|
|
71
|
+
title: _unref(contextLocale).advanced.saveHistory.searchName,
|
|
72
|
+
trigger: "click",
|
|
73
|
+
placement: "bottom",
|
|
74
|
+
onVisibleChange: visibleChange
|
|
75
|
+
}, {
|
|
76
|
+
content: _withCtx(() => [visible.value ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createVNode(_unref(Form), {
|
|
77
|
+
ref_key: "formRef",
|
|
78
|
+
ref: formRef,
|
|
79
|
+
model: modelRef
|
|
80
|
+
}, {
|
|
81
|
+
default: _withCtx(() => [_createVNode(_unref(FormItem), {
|
|
82
|
+
name: "name",
|
|
83
|
+
rules: [{
|
|
84
|
+
required: true,
|
|
85
|
+
message: _unref(contextLocale).advanced.saveHistory.placeholder
|
|
86
|
+
}, {
|
|
87
|
+
max: 64,
|
|
88
|
+
message: _unref(contextLocale).advanced.saveHistory.ruleName
|
|
89
|
+
}]
|
|
90
|
+
}, {
|
|
91
|
+
default: _withCtx(() => [_createVNode(_unref(Textarea), {
|
|
92
|
+
value: modelRef.name,
|
|
93
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => modelRef.name = $event),
|
|
94
|
+
rows: 3,
|
|
95
|
+
maxlength: 200
|
|
96
|
+
}, null, 8 /* PROPS */, ["value"])]),
|
|
97
|
+
_: 1 /* STABLE */
|
|
98
|
+
}, 8 /* PROPS */, ["rules"])]),
|
|
99
|
+
_: 1 /* STABLE */
|
|
100
|
+
}, 8 /* PROPS */, ["model"]), _createVNode(_unref(Button), {
|
|
101
|
+
loading: saveHistoryLoading.value,
|
|
102
|
+
type: "primary",
|
|
103
|
+
class: "save-btn",
|
|
104
|
+
style: {
|
|
105
|
+
"width": "100%"
|
|
106
|
+
},
|
|
107
|
+
onClick: saveHistory
|
|
108
|
+
}, {
|
|
109
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.saveHistory.save), 1 /* TEXT */)]),
|
|
110
|
+
_: 1 /* STABLE */
|
|
111
|
+
}, 8 /* PROPS */, ["loading"])])) : _createCommentVNode("v-if", true)]),
|
|
112
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
113
|
+
ghost: "",
|
|
114
|
+
type: "primary"
|
|
115
|
+
}, {
|
|
116
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.saveHistory.save), 1 /* TEXT */)]),
|
|
117
|
+
_: 1 /* STABLE */
|
|
118
|
+
})]),
|
|
119
|
+
_: 1 /* STABLE */
|
|
120
|
+
}, 8 /* PROPS */, ["open", "title"]);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createElementVNode as _createElementVNode, createVNode as _createVNode, normalizeClass as _normalizeClass, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, normalizeStyle as _normalizeStyle } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "left"
|
|
5
|
+
};
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
class: "left-items"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "center"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "right"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_5 = {
|
|
18
|
+
class: "right-items"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_6 = {
|
|
21
|
+
class: "JSearch-footer--btns"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_7 = {
|
|
24
|
+
class: "more-text"
|
|
25
|
+
};
|
|
26
|
+
const _hoisted_8 = {
|
|
27
|
+
class: "JSearch-content single big pack-up"
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_9 = {
|
|
30
|
+
class: "JSearch-items"
|
|
31
|
+
};
|
|
32
|
+
const _hoisted_10 = {
|
|
33
|
+
class: "left"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_11 = {
|
|
36
|
+
class: "JSearch-footer"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_12 = {
|
|
39
|
+
class: "JSearch-footer--btns"
|
|
40
|
+
};
|
|
41
|
+
import SearchItem from '../Item.js';
|
|
42
|
+
import { typeOptions } from '../setting';
|
|
43
|
+
import { useHandleColumns, useOptionMapContent, useRouteQuery } from '../hooks';
|
|
44
|
+
import { ref, reactive, watch, useAttrs, inject, computed } from 'vue';
|
|
45
|
+
import SaveHistory from './SaveHistory.js';
|
|
46
|
+
import History from './History.js';
|
|
47
|
+
import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat } from '../util';
|
|
48
|
+
import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
|
|
49
|
+
import AIcon from '../../Icon';
|
|
50
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
51
|
+
import { SearchConfig } from '../../utils/constants';
|
|
52
|
+
import { isObject } from 'lodash-es';
|
|
53
|
+
import useSearchStyle from '../style';
|
|
54
|
+
const __sfc_main__ = _defineComponent({
|
|
55
|
+
...{
|
|
56
|
+
name: 'JAdvancedSearch',
|
|
57
|
+
inheritAttrs: false
|
|
58
|
+
},
|
|
59
|
+
__name: 'index',
|
|
60
|
+
props: {
|
|
61
|
+
columns: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: () => [],
|
|
64
|
+
required: true
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'advanced'
|
|
69
|
+
},
|
|
70
|
+
target: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
request: {
|
|
76
|
+
type: Function,
|
|
77
|
+
default: undefined
|
|
78
|
+
},
|
|
79
|
+
historyRequest: {
|
|
80
|
+
type: Function,
|
|
81
|
+
default: undefined
|
|
82
|
+
},
|
|
83
|
+
deleteRequest: {
|
|
84
|
+
type: Function,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
87
|
+
deleteKey: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'key'
|
|
90
|
+
},
|
|
91
|
+
defaultValues: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: undefined
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
emits: ['search'],
|
|
97
|
+
setup(__props, {
|
|
98
|
+
expose: __expose,
|
|
99
|
+
emit: __emit
|
|
100
|
+
}) {
|
|
101
|
+
const props = __props;
|
|
102
|
+
const emit = __emit;
|
|
103
|
+
const columnsOptionMap = ref({}); // 存储每个columnItem的option
|
|
104
|
+
const terms = reactive({
|
|
105
|
+
terms: []
|
|
106
|
+
}); // 当前查询条件
|
|
107
|
+
const expand = ref(false);
|
|
108
|
+
const layout = ref('horizontal');
|
|
109
|
+
const compatible = ref(false);
|
|
110
|
+
const screenSize = ref(true);
|
|
111
|
+
const context = inject(SearchConfig);
|
|
112
|
+
const prefixCls = computed(() => 'JSearch');
|
|
113
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls);
|
|
114
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
115
|
+
const attrs = useAttrs();
|
|
116
|
+
const q = useRouteQuery('q');
|
|
117
|
+
const target = useRouteQuery('target');
|
|
118
|
+
const {
|
|
119
|
+
initValues,
|
|
120
|
+
columnsMap,
|
|
121
|
+
defaultCacheValues
|
|
122
|
+
} = useHandleColumns(props, terms, {
|
|
123
|
+
mode: 'advanced'
|
|
124
|
+
});
|
|
125
|
+
useOptionMapContent(columnsOptionMap);
|
|
126
|
+
const expandChange = () => {
|
|
127
|
+
expand.value = !expand.value;
|
|
128
|
+
terms.terms.length = 1;
|
|
129
|
+
if (expand.value) {
|
|
130
|
+
// 展开
|
|
131
|
+
let arr = Object.values(columnsMap.value);
|
|
132
|
+
const mergeArr = [];
|
|
133
|
+
for (let i = 1; i < 6; i++) {
|
|
134
|
+
const indexIn = i % arr.length;
|
|
135
|
+
const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues.value);
|
|
136
|
+
if (i === 3) {
|
|
137
|
+
obj.type = 'and';
|
|
138
|
+
}
|
|
139
|
+
mergeArr.push(obj);
|
|
140
|
+
}
|
|
141
|
+
terms.terms = [...terms.terms, ...mergeArr];
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const addUrlParams = () => {
|
|
145
|
+
if (props.target) {
|
|
146
|
+
q.value = encodeURI(JSON.stringify(terms));
|
|
147
|
+
target.value = props.target;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const submitData = () => {
|
|
151
|
+
const data = termsParamsFormat(terms, columnsMap.value);
|
|
152
|
+
emit('search', data);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 提交
|
|
157
|
+
*/
|
|
158
|
+
const searchSubmit = () => {
|
|
159
|
+
submitData();
|
|
160
|
+
if (props.type === 'advanced') {
|
|
161
|
+
addUrlParams();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 重置查询
|
|
167
|
+
*/
|
|
168
|
+
const reset = () => {
|
|
169
|
+
expand.value = false;
|
|
170
|
+
initValues();
|
|
171
|
+
if (props.type === 'advanced') {
|
|
172
|
+
q.value = null;
|
|
173
|
+
target.value = null;
|
|
174
|
+
}
|
|
175
|
+
emit('search', {
|
|
176
|
+
terms: []
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 历史下拉单选
|
|
182
|
+
* @param content {string}
|
|
183
|
+
*/
|
|
184
|
+
const historyItemClick = content => {
|
|
185
|
+
try {
|
|
186
|
+
const object = compatibleOldTerms(content, columnsMap.value, defaultCacheValues.value);
|
|
187
|
+
terms.terms = object.terms || [];
|
|
188
|
+
expand.value = object.expand;
|
|
189
|
+
searchSubmit();
|
|
190
|
+
} catch (e) {
|
|
191
|
+
console.warn(`Search组件中han.dleUrlParams处理JSON时异常:【${e}】`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* 处理URL中的查询参数
|
|
197
|
+
*/
|
|
198
|
+
const handleUrlParams = () => {
|
|
199
|
+
if (props.target && props.target === target.value) {
|
|
200
|
+
const params = decodeURI(q.value);
|
|
201
|
+
historyItemClick(params);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 处理传入的默认值
|
|
207
|
+
*/
|
|
208
|
+
const handleDefaultValues = value => {
|
|
209
|
+
if (!isObject(value)) return;
|
|
210
|
+
const _value = JSON.parse(JSON.stringify(value));
|
|
211
|
+
if (!(_value.terms.length === 1 && _value.terms[0].terms.length === 1)) {
|
|
212
|
+
let arr = Object.values(columnsMap.value);
|
|
213
|
+
for (let i = 1; i < 6; i++) {
|
|
214
|
+
const aIndex = i < 3 ? 0 : 1;
|
|
215
|
+
const bIndex = i % 3;
|
|
216
|
+
const item = _value.terms[aIndex].terms[bIndex];
|
|
217
|
+
if (!item) {
|
|
218
|
+
const fillItem = getItemDefaultValue(arr[aIndex * 3 + bIndex], defaultCacheValues.value);
|
|
219
|
+
if (i === 3) {
|
|
220
|
+
fillItem.type = 'and';
|
|
221
|
+
}
|
|
222
|
+
_value.terms[aIndex].terms[bIndex] = fillItem;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
historyItemClick(JSON.stringify(_value));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 清除值
|
|
231
|
+
*/
|
|
232
|
+
const clearValue = () => {
|
|
233
|
+
if (props.type === 'advanced' && props.target !== target.value) {
|
|
234
|
+
q.value = null;
|
|
235
|
+
target.value = null;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
handleUrlParams();
|
|
239
|
+
watch(() => props.target, () => {
|
|
240
|
+
clearValue();
|
|
241
|
+
}, {
|
|
242
|
+
immediate: true
|
|
243
|
+
});
|
|
244
|
+
__expose({
|
|
245
|
+
setValues: handleDefaultValues,
|
|
246
|
+
reset
|
|
247
|
+
});
|
|
248
|
+
return (_ctx, _cache) => {
|
|
249
|
+
return _openBlock(), _createBlock(_unref(Form), {
|
|
250
|
+
model: terms,
|
|
251
|
+
onFinish: searchSubmit
|
|
252
|
+
}, {
|
|
253
|
+
default: _withCtx(() => [_createElementVNode("div", {
|
|
254
|
+
ref: "searchRef",
|
|
255
|
+
class: _normalizeClass(['JSearch-warp senior', [_unref(attrs).class, _unref(hashId)]]),
|
|
256
|
+
style: _normalizeStyle(_unref(attrs).style)
|
|
257
|
+
}, [_createCommentVNode(" 高级模式 "), props.type === 'advanced' ? (_openBlock(), _createElementBlock("div", {
|
|
258
|
+
key: 0,
|
|
259
|
+
ref: "searchRefContentRef",
|
|
260
|
+
class: _normalizeClass(['JSearch-content', expand.value || compatible.value ? 'senior-expand' : 'pack-up', screenSize.value ? 'big' : 'small'])
|
|
261
|
+
}, [_createElementVNode("div", {
|
|
262
|
+
class: _normalizeClass(['JSearch-items', expand.value ? 'items-expand' : '', layout.value])
|
|
263
|
+
}, [_createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms.slice(0, 3), (item, index) => {
|
|
264
|
+
return _openBlock(), _createBlock(SearchItem, {
|
|
265
|
+
key: index,
|
|
266
|
+
expand: expand.value,
|
|
267
|
+
index: index + 1,
|
|
268
|
+
onlyValue: false,
|
|
269
|
+
value: item.value,
|
|
270
|
+
"onUpdate:value": $event => item.value = $event,
|
|
271
|
+
termType: item.termType,
|
|
272
|
+
"onUpdate:termType": $event => item.termType = $event,
|
|
273
|
+
column: item.column,
|
|
274
|
+
"onUpdate:column": $event => item.column = $event,
|
|
275
|
+
type: item.type,
|
|
276
|
+
"onUpdate:type": $event => item.type = $event
|
|
277
|
+
}, null, 8 /* PROPS */, ["expand", "index", "value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type"]);
|
|
278
|
+
}), 128 /* KEYED_FRAGMENT */))])]), expand.value ? (_openBlock(), _createElementBlock("div", _hoisted_3, [_createVNode(_unref(Select), {
|
|
279
|
+
value: terms.terms[3].type,
|
|
280
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => terms.terms[3].type = $event),
|
|
281
|
+
class: "center-select",
|
|
282
|
+
style: {
|
|
283
|
+
"width": "100px"
|
|
284
|
+
},
|
|
285
|
+
options: _unref(typeOptions)(_unref(contextLocale))
|
|
286
|
+
}, null, 8 /* PROPS */, ["value", "options"])])) : _createCommentVNode("v-if", true), expand.value ? (_openBlock(), _createElementBlock("div", _hoisted_4, [_createElementVNode("div", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms.slice(3, 6), (item, index) => {
|
|
287
|
+
return _openBlock(), _createElementBlock(_Fragment, {
|
|
288
|
+
key: index
|
|
289
|
+
}, [expand.value && index !== 4 ? (_openBlock(), _createBlock(SearchItem, {
|
|
290
|
+
key: 0,
|
|
291
|
+
expand: expand.value,
|
|
292
|
+
index: index + 4,
|
|
293
|
+
onlyValue: false,
|
|
294
|
+
value: item.value,
|
|
295
|
+
"onUpdate:value": $event => item.value = $event,
|
|
296
|
+
termType: item.termType,
|
|
297
|
+
"onUpdate:termType": $event => item.termType = $event,
|
|
298
|
+
column: item.column,
|
|
299
|
+
"onUpdate:column": $event => item.column = $event,
|
|
300
|
+
type: item.type,
|
|
301
|
+
"onUpdate:type": $event => item.type = $event
|
|
302
|
+
}, null, 8 /* PROPS */, ["expand", "index", "value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type"])) : _createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */);
|
|
303
|
+
}), 128 /* KEYED_FRAGMENT */))])])) : _createCommentVNode("v-if", true)], 2 /* CLASS */), _createElementVNode("div", {
|
|
304
|
+
class: _normalizeClass(['JSearch-footer', expand.value || compatible.value ? 'expand' : ''])
|
|
305
|
+
}, [_renderSlot(_ctx.$slots, "footerRender", {
|
|
306
|
+
reset: reset,
|
|
307
|
+
submit: searchSubmit,
|
|
308
|
+
expandChange: expandChange
|
|
309
|
+
}, () => [_createElementVNode("div", _hoisted_6, [_createVNode(_unref(Button), {
|
|
310
|
+
onClick: reset
|
|
311
|
+
}, {
|
|
312
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.reset), 1 /* TEXT */)]),
|
|
313
|
+
_: 1 /* STABLE */
|
|
314
|
+
}), _createVNode(SaveHistory, {
|
|
315
|
+
terms: terms,
|
|
316
|
+
target: _unref(target),
|
|
317
|
+
request: props.request || _unref(context)?.saveRequest
|
|
318
|
+
}, null, 8 /* PROPS */, ["terms", "target", "request"]), _createVNode(History, {
|
|
319
|
+
target: _unref(target),
|
|
320
|
+
request: props.historyRequest || _unref(context)?.historyRequest,
|
|
321
|
+
"delete-request": props.deleteRequest || _unref(context)?.deleteRequest,
|
|
322
|
+
"delete-key": props.deleteKey || _unref(context)?.deleteKey,
|
|
323
|
+
onClick: searchSubmit,
|
|
324
|
+
onItemClick: historyItemClick
|
|
325
|
+
}, null, 8 /* PROPS */, ["target", "request", "delete-request", "delete-key"])]), _createVNode(_unref(Button), {
|
|
326
|
+
type: "link",
|
|
327
|
+
class: "more-btn",
|
|
328
|
+
onClick: expandChange
|
|
329
|
+
}, {
|
|
330
|
+
default: _withCtx(() => [_createElementVNode("span", _hoisted_7, _toDisplayString(_unref(contextLocale).advanced.more), 1 /* TEXT */), _createVNode(_unref(AIcon), {
|
|
331
|
+
type: "DoubleRightOutlined",
|
|
332
|
+
class: _normalizeClass(['more-icon', expand.value ? 'more-up' : 'more-down'])
|
|
333
|
+
}, null, 8 /* PROPS */, ["class"])]),
|
|
334
|
+
_: 1 /* STABLE */
|
|
335
|
+
})])], 2 /* CLASS */)], 2 /* CLASS */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
336
|
+
key: 1
|
|
337
|
+
}, [_createCommentVNode(" 简单模式 "), _createElementVNode("div", _hoisted_8, [_createElementVNode("div", _hoisted_9, [_createElementVNode("div", _hoisted_10, [_createVNode(SearchItem, {
|
|
338
|
+
expand: false,
|
|
339
|
+
index: 1,
|
|
340
|
+
onlyValue: false,
|
|
341
|
+
value: terms.terms[0].value,
|
|
342
|
+
"onUpdate:value": _cache[1] || (_cache[1] = $event => terms.terms[0].value = $event),
|
|
343
|
+
termType: terms.terms[0].termType,
|
|
344
|
+
"onUpdate:termType": _cache[2] || (_cache[2] = $event => terms.terms[0].termType = $event),
|
|
345
|
+
column: terms.terms[0].column,
|
|
346
|
+
"onUpdate:column": _cache[3] || (_cache[3] = $event => terms.terms[0].column = $event),
|
|
347
|
+
type: terms.terms[0].type,
|
|
348
|
+
"onUpdate:type": _cache[4] || (_cache[4] = $event => terms.terms[0].type = $event)
|
|
349
|
+
}, null, 8 /* PROPS */, ["value", "termType", "column", "type"])])]), _createElementVNode("div", _hoisted_11, [_createElementVNode("div", _hoisted_12, [_createVNode(_unref(FormItemRest), null, {
|
|
350
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
351
|
+
onClick: reset
|
|
352
|
+
}, {
|
|
353
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.reset), 1 /* TEXT */)]),
|
|
354
|
+
_: 1 /* STABLE */
|
|
355
|
+
}), _createVNode(_unref(Button), {
|
|
356
|
+
"html-type": "submit",
|
|
357
|
+
type: "primary"
|
|
358
|
+
}, {
|
|
359
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.search), 1 /* TEXT */)]),
|
|
360
|
+
_: 1 /* STABLE */
|
|
361
|
+
})]),
|
|
362
|
+
_: 1 /* STABLE */
|
|
363
|
+
})])])])], 64 /* STABLE_FRAGMENT */))], 6 /* CLASS, STYLE */)]),
|
|
364
|
+
_: 3 /* FORWARDED */
|
|
365
|
+
}, 8 /* PROPS */, ["model"]);
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
export default __sfc_main__;
|
package/lib/Search/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import AdvancedSearch from './Advanced/index.js'
|
|
1
2
|
import Search from './Search.js'
|
|
2
3
|
|
|
3
4
|
Search.install = function (app) {
|
|
4
5
|
app.component(Search.name, Search)
|
|
6
|
+
app.component(AdvancedSearch.name, AdvancedSearch)
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
export { AdvancedSearch }
|
|
7
10
|
export default Search
|
|
8
|
-
export * from './hooks'
|
|
9
|
-
export * from './util'
|
|
10
|
-
export * from './setting'
|
|
@@ -27,7 +27,7 @@ export default defineComponent({
|
|
|
27
27
|
default: () => []
|
|
28
28
|
},
|
|
29
29
|
rowSelection: {
|
|
30
|
-
type: Object
|
|
30
|
+
type: [Object, Boolean]
|
|
31
31
|
},
|
|
32
32
|
rowKey: {
|
|
33
33
|
type: [String, Function],
|
|
@@ -220,10 +220,10 @@ export default defineComponent({
|
|
|
220
220
|
container,
|
|
221
221
|
selectedAll,
|
|
222
222
|
visibleRows,
|
|
223
|
-
_indeterminate,
|
|
223
|
+
checkIndeterminate: _indeterminate,
|
|
224
224
|
viewportHeight,
|
|
225
|
-
_columns,
|
|
226
|
-
_rowSelection,
|
|
225
|
+
tableColumns: _columns,
|
|
226
|
+
tableRowSelection: _rowSelection,
|
|
227
227
|
totalHeight,
|
|
228
228
|
offsetY,
|
|
229
229
|
firstColumn,
|
package/lib/components.js
CHANGED
|
@@ -10,7 +10,7 @@ export { default as PermissionButton } from './PermissionButton'
|
|
|
10
10
|
export { default as ProLayout, PageContainer } from './ProLayout'
|
|
11
11
|
export { default as ProTable } from './ProTable'
|
|
12
12
|
export { default as Scrollbar } from './Scrollbar'
|
|
13
|
-
export { default as Search } from './Search'
|
|
13
|
+
export { default as Search, AdvancedSearch } from './Search'
|
|
14
14
|
export { default as ValueItem } from './ValueItem'
|
|
15
15
|
export { default as TimeFormat } from './TimeFormat'
|
|
16
16
|
export { default as DragModal } from './DragModal'
|