@jetlinks-web/components 2.0.2 → 2.0.3
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/AMap/Map.js +124 -0
- package/es/AMap/index.js +2 -0
- package/es/AMap/util.js +56 -0
- package/es/BadgeStatus/Badge.js +54 -0
- package/es/BadgeStatus/color.js +21 -0
- package/es/BadgeStatus/index.js +3 -0
- package/es/CardSelect/CardSelect.js +123 -0
- package/es/CardSelect/index.js +2 -0
- package/es/CheckButton/CheckButton.js +121 -0
- package/es/CheckButton/index.js +2 -0
- package/es/ConfigProvider/context.js +12 -0
- package/es/ConfigProvider/index.js +31 -0
- package/es/Echarts/Echarts.js +47 -0
- package/es/Echarts/index.js +2 -0
- package/es/Ellipsis/Ellipsis.js +189 -0
- package/es/Ellipsis/index.js +2 -0
- package/es/Empty/Empty.js +56 -0
- package/es/Empty/image.js +2 -0
- package/es/Empty/index.js +2 -0
- package/es/FullPage/FullPage.js +31 -0
- package/es/FullPage/index.js +2 -0
- package/es/Icon/icon.js +42 -0
- package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
- package/es/MonacoEditor/Monaco.js +238 -0
- package/es/MonacoEditor/index.js +2 -0
- package/es/PermissionButton/index.js +117 -0
- package/es/ProLayout/Basic/BasicLayout.js +259 -0
- package/es/ProLayout/Basic/Header.js +97 -0
- package/es/ProLayout/PageContainer/index.js +324 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +285 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +278 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +163 -0
- package/es/ProLayout/defaultSettings.js +66 -0
- package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
- package/{src → es}/ProLayout/style/default.less +4 -4
- package/es/ProLayout/style/index.js +1 -0
- package/es/ProLayout/typings.js +1 -0
- package/es/ProLayout/util.js +61 -0
- package/es/ProTable/index.js +411 -0
- package/es/ProTable/proTableTypes.js +11 -0
- package/es/ProTable/style/index.css +65 -0
- package/es/ProTable/style/index.js +1 -0
- package/es/Scrollbar/Bar.js +114 -0
- package/es/Scrollbar/Scrollbar.js +212 -0
- package/es/Scrollbar/Thumb.js +189 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/thumbProps.js +10 -0
- package/es/Scrollbar/util.js +30 -0
- package/es/Search/Advanced/History.js +183 -0
- package/es/Search/Advanced/SaveHistory.js +153 -0
- package/es/Search/Advanced/index.js +520 -0
- package/es/Search/Item.js +497 -0
- package/es/Search/Search.js +249 -0
- package/es/Search/hooks/index.js +1 -0
- package/es/Search/hooks/useSearchItems.js +40 -0
- package/es/Search/index.js +4 -0
- package/es/Search/setting.js +91 -0
- package/es/Search/style/Item.less +33 -0
- package/es/Search/style/Search.less +179 -0
- package/es/Search/style/index.js +2 -0
- package/es/Search/typing.js +1 -0
- package/es/Search/util.js +234 -0
- package/es/ValueItem/ValueItem.js +233 -0
- package/es/ValueItem/index.js +2 -0
- package/es/ValueItem/util.js +16 -0
- package/es/index.js +24 -0
- package/es/style/index.js +3 -0
- package/es/style/variable.css +0 -0
- package/{src → es}/style/variable.less +0 -2
- package/es/style.js +3 -0
- package/lib/AMap/Map.js +124 -0
- package/lib/AMap/index.js +9 -0
- package/lib/AMap/util.js +62 -0
- package/lib/BadgeStatus/Badge.js +54 -0
- package/lib/BadgeStatus/color.js +27 -0
- package/lib/BadgeStatus/index.js +22 -0
- package/lib/CardSelect/CardSelect.js +123 -0
- package/lib/CardSelect/index.js +9 -0
- package/lib/CheckButton/CheckButton.js +121 -0
- package/lib/CheckButton/index.js +9 -0
- package/lib/ConfigProvider/context.js +19 -0
- package/lib/ConfigProvider/index.js +37 -0
- package/lib/Echarts/Echarts.js +47 -0
- package/lib/Echarts/index.js +9 -0
- package/lib/Ellipsis/Ellipsis.js +189 -0
- package/lib/Ellipsis/index.js +9 -0
- package/lib/Empty/Empty.js +56 -0
- package/lib/Empty/image.js +8 -0
- package/lib/Empty/index.js +9 -0
- package/lib/FullPage/FullPage.js +31 -0
- package/lib/FullPage/index.js +9 -0
- package/lib/Icon/icon.js +52 -0
- package/lib/Icon/index.js +9 -0
- package/lib/MonacoEditor/Monaco.js +238 -0
- package/lib/MonacoEditor/index.js +9 -0
- package/lib/PermissionButton/index.js +124 -0
- package/lib/ProLayout/Basic/BasicLayout.js +268 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +103 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +327 -0
- package/lib/ProLayout/PageContainer/index.less +103 -0
- package/lib/ProLayout/PageContainer/typings.js +5 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +290 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +287 -0
- package/lib/ProLayout/SiderMenu/index.js +20 -0
- package/lib/ProLayout/SiderMenu/index.less +212 -0
- package/lib/ProLayout/SiderMenu/typings.js +5 -0
- package/lib/ProLayout/TopHeader/index.js +168 -0
- package/lib/ProLayout/TopHeader/index.less +174 -0
- package/lib/ProLayout/defaultSettings.js +72 -0
- package/lib/ProLayout/index.js +16 -0
- package/lib/ProLayout/style/default.less +4 -0
- package/lib/ProLayout/style/index.js +3 -0
- package/lib/ProLayout/style/style.less +7 -0
- package/lib/ProLayout/typings.js +5 -0
- package/lib/ProLayout/util.js +72 -0
- package/lib/ProTable/index.js +417 -0
- package/lib/ProTable/proTableTypes.js +17 -0
- package/lib/ProTable/style/index.css +65 -0
- package/lib/ProTable/style/index.js +3 -0
- package/lib/ProTable/style/index.less +92 -0
- package/lib/Scrollbar/Bar.js +114 -0
- package/lib/Scrollbar/Scrollbar.js +212 -0
- package/lib/Scrollbar/Thumb.js +189 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -0
- package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
- package/lib/Scrollbar/thumbProps.js +16 -0
- package/lib/Scrollbar/util.js +37 -0
- package/lib/Search/Advanced/History.js +183 -0
- package/lib/Search/Advanced/SaveHistory.js +153 -0
- package/lib/Search/Advanced/index.js +520 -0
- package/lib/Search/Item.js +497 -0
- package/lib/Search/Search.js +249 -0
- package/lib/Search/hooks/index.js +16 -0
- package/lib/Search/hooks/useSearchItems.js +47 -0
- package/lib/Search/index.js +16 -0
- package/lib/Search/setting.js +97 -0
- package/lib/Search/style/Item.less +33 -0
- package/lib/Search/style/Search.less +179 -0
- package/lib/Search/style/index.js +4 -0
- package/lib/Search/typing.js +5 -0
- package/lib/Search/util.js +241 -0
- package/lib/ValueItem/ValueItem.js +233 -0
- package/lib/ValueItem/index.js +9 -0
- package/lib/ValueItem/util.js +22 -0
- package/lib/index.js +158 -0
- package/lib/style/components.less +1 -0
- package/lib/style/index.js +4 -0
- package/lib/style/variable.css +0 -0
- package/lib/style/variable.less +2 -0
- package/lib/style.js +5 -0
- package/package.json +122 -13
- package/index.ts +0 -64
- package/src/AMap/Map.vue +0 -110
- package/src/AMap/index.ts +0 -1
- package/src/AMap/util.ts +0 -56
- package/src/BadgeStatus/Badge.vue +0 -41
- package/src/BadgeStatus/color.ts +0 -25
- package/src/BadgeStatus/index.ts +0 -4
- package/src/CardSelect/CardSelect.vue +0 -136
- package/src/CardSelect/index.ts +0 -3
- package/src/CheckButton/CheckButton.vue +0 -146
- package/src/CheckButton/index.md +0 -27
- package/src/CheckButton/index.ts +0 -3
- package/src/ConfigProvider/context.ts +0 -17
- package/src/ConfigProvider/index.tsx +0 -42
- package/src/Echarts/Echarts.vue +0 -43
- package/src/Echarts/index.ts +0 -3
- package/src/Ellipsis/Ellipsis.vue +0 -182
- package/src/Ellipsis/index.ts +0 -3
- package/src/Empty/Empty.vue +0 -43
- package/src/Empty/image.ts +0 -3
- package/src/Empty/index.ts +0 -2
- package/src/FullPage/FullPage.vue +0 -30
- package/src/FullPage/index.ts +0 -3
- package/src/Icon/icon.tsx +0 -40
- package/src/MonacoEditor/Monaco.vue +0 -242
- package/src/MonacoEditor/index.md +0 -26
- package/src/MonacoEditor/index.ts +0 -2
- package/src/PermissionButton/index.tsx +0 -110
- package/src/ProLayout/Basic/BasicLayout.tsx +0 -392
- package/src/ProLayout/Basic/Header.tsx +0 -115
- package/src/ProLayout/PageContainer/index.tsx +0 -441
- package/src/ProLayout/PageContainer/typings.ts +0 -56
- package/src/ProLayout/RouteContext.ts +0 -87
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
- package/src/ProLayout/SiderMenu/index.ts +0 -2
- package/src/ProLayout/SiderMenu/typings.ts +0 -49
- package/src/ProLayout/TopHeader/index.tsx +0 -210
- package/src/ProLayout/defaultSettings.ts +0 -106
- package/src/ProLayout/style/index.ts +0 -1
- package/src/ProLayout/typings.ts +0 -87
- package/src/ProLayout/util.ts +0 -64
- package/src/ProTable/index.md +0 -53
- package/src/ProTable/index.tsx +0 -551
- package/src/ProTable/proTableTypes.ts +0 -70
- package/src/ProTable/style/index.ts +0 -1
- package/src/Scrollbar/Bar.vue +0 -75
- package/src/Scrollbar/Scrollbar.vue +0 -260
- package/src/Scrollbar/Thumb.vue +0 -163
- package/src/Scrollbar/constants.ts +0 -10
- package/src/Scrollbar/index.ts +0 -4
- package/src/Scrollbar/thumb.ts +0 -16
- package/src/Scrollbar/util.ts +0 -38
- package/src/Search/Advanced/History.vue +0 -140
- package/src/Search/Advanced/SaveHistory.vue +0 -108
- package/src/Search/Advanced/index.vue +0 -435
- package/src/Search/Item.vue +0 -525
- package/src/Search/Search.vue +0 -398
- package/src/Search/hooks/index.ts +0 -1
- package/src/Search/hooks/useSearchItems.ts +0 -68
- package/src/Search/index.md +0 -57
- package/src/Search/index.ts +0 -5
- package/src/Search/setting.ts +0 -55
- package/src/Search/typing.ts +0 -76
- package/src/Search/util.ts +0 -263
- package/src/ValueItem/ValueItem.vue +0 -192
- package/src/ValueItem/index.ts +0 -3
- package/src/ValueItem/util.ts +0 -16
- package/src/style/index.ts +0 -3
- /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
- /package/{src → es}/ProLayout/Basic/Header.less +0 -0
- /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
- /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
- /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
- /package/{src → es}/ProLayout/style/style.less +0 -0
- /package/{src → es}/ProTable/style/index.less +0 -0
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Popover
|
|
3
|
-
v-model:visible="visible"
|
|
4
|
-
title="搜索名称"
|
|
5
|
-
trigger="click"
|
|
6
|
-
placement="bottom"
|
|
7
|
-
@visibleChange="visibleChange"
|
|
8
|
-
>
|
|
9
|
-
<template #content>
|
|
10
|
-
<div v-if="visible" style="width: 240px">
|
|
11
|
-
<Form ref="formRef" :model="modelRef">
|
|
12
|
-
<FormItem
|
|
13
|
-
name="name"
|
|
14
|
-
:rules="[
|
|
15
|
-
{ required: true, message: '请输入名称' },
|
|
16
|
-
{ max: 64, message: '最多64个字符' },
|
|
17
|
-
]"
|
|
18
|
-
>
|
|
19
|
-
<Textarea
|
|
20
|
-
v-model:value="modelRef.name"
|
|
21
|
-
:rows="3"
|
|
22
|
-
:maxlength="200"
|
|
23
|
-
/>
|
|
24
|
-
</FormItem>
|
|
25
|
-
</Form>
|
|
26
|
-
<Button
|
|
27
|
-
:loading="saveHistoryLoading"
|
|
28
|
-
type="primary"
|
|
29
|
-
class="save-btn"
|
|
30
|
-
style="width: 100%"
|
|
31
|
-
@click="saveHistory"
|
|
32
|
-
>
|
|
33
|
-
保存
|
|
34
|
-
</Button>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
<Button ghost type="primary"> 保存</Button>
|
|
38
|
-
</Popover>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
|
-
<script setup lang="ts">
|
|
42
|
-
import type { Terms } from '../typing';
|
|
43
|
-
import type { PropType } from 'vue';
|
|
44
|
-
import { ref, reactive } from 'vue';
|
|
45
|
-
import { Form, Button, FormItem, Popover, Textarea, message } from 'ant-design-vue'
|
|
46
|
-
import { isFunction } from 'lodash-es';
|
|
47
|
-
|
|
48
|
-
const props = defineProps({
|
|
49
|
-
terms: {
|
|
50
|
-
type: Object as PropType<Terms>,
|
|
51
|
-
default: () => ({}),
|
|
52
|
-
},
|
|
53
|
-
target: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: '',
|
|
56
|
-
required: true,
|
|
57
|
-
},
|
|
58
|
-
request: {
|
|
59
|
-
type: Function as PropType<(data: any, target: string) => Promise<any>>,
|
|
60
|
-
default: null,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const saveHistoryLoading = ref(false);
|
|
65
|
-
|
|
66
|
-
const visible = ref(false);
|
|
67
|
-
|
|
68
|
-
const formRef = ref();
|
|
69
|
-
|
|
70
|
-
const modelRef = reactive({
|
|
71
|
-
name: undefined,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const visibleChange = (e: boolean) => {
|
|
75
|
-
visible.value = e;
|
|
76
|
-
if (!e) {
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
modelRef.name = undefined;
|
|
79
|
-
}, 100);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 保存当前查询条件
|
|
85
|
-
*/
|
|
86
|
-
const saveHistory = async () => {
|
|
87
|
-
// 获取当前查询条件并转化为字符串
|
|
88
|
-
const formData = await formRef.value.validate();
|
|
89
|
-
if (formData && props.request && isFunction(props.request)) {
|
|
90
|
-
formData.content = JSON.stringify(props.terms);
|
|
91
|
-
saveHistoryLoading.value = true;
|
|
92
|
-
const resp = await props.request(formData, props.target);
|
|
93
|
-
saveHistoryLoading.value = false;
|
|
94
|
-
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
95
|
-
message.success('操作成功');
|
|
96
|
-
visibleChange(false);
|
|
97
|
-
} else {
|
|
98
|
-
message.error('操作失败');
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style scoped lang="less">
|
|
105
|
-
.save-btn {
|
|
106
|
-
width: 100%;
|
|
107
|
-
}
|
|
108
|
-
</style>
|
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Form :model="termsData" @finish="searchSubmit">
|
|
3
|
-
<div
|
|
4
|
-
ref="searchRef"
|
|
5
|
-
:class="['JSearch-warp', 'senior', props.class]"
|
|
6
|
-
:style="style"
|
|
7
|
-
>
|
|
8
|
-
<!-- 高级模式 -->
|
|
9
|
-
<div
|
|
10
|
-
v-if="props.type === 'advanced'"
|
|
11
|
-
ref="searchRefContentRef"
|
|
12
|
-
:class="[
|
|
13
|
-
'JSearch-content',
|
|
14
|
-
expand || compatible ? 'senior-expand' : 'pack-up',
|
|
15
|
-
screenSize ? 'big' : 'small',
|
|
16
|
-
]"
|
|
17
|
-
>
|
|
18
|
-
<div
|
|
19
|
-
:class="[
|
|
20
|
-
'JSearch-items',
|
|
21
|
-
expand ? 'items-expand' : '',
|
|
22
|
-
layout,
|
|
23
|
-
]"
|
|
24
|
-
>
|
|
25
|
-
<div class="left">
|
|
26
|
-
<div class="left-items">
|
|
27
|
-
<SearchItem
|
|
28
|
-
:expand="expand"
|
|
29
|
-
:index="1"
|
|
30
|
-
:columns="searchItems"
|
|
31
|
-
:terms-item="termsData.terms[0].terms[0]"
|
|
32
|
-
:reset="resetNumber"
|
|
33
|
-
@change="(v) => itemValueChange(v, 1)"
|
|
34
|
-
/>
|
|
35
|
-
<SearchItem
|
|
36
|
-
v-if="expand"
|
|
37
|
-
:expand="expand"
|
|
38
|
-
:index="2"
|
|
39
|
-
:columns="searchItems"
|
|
40
|
-
:terms-item="termsData.terms[0].terms[1]"
|
|
41
|
-
:reset="resetNumber"
|
|
42
|
-
@change="(v) => itemValueChange(v, 2)"
|
|
43
|
-
/>
|
|
44
|
-
<SearchItem
|
|
45
|
-
v-if="expand"
|
|
46
|
-
:expand="expand"
|
|
47
|
-
:index="3"
|
|
48
|
-
:columns="searchItems"
|
|
49
|
-
:terms-item="termsData.terms[0].terms[2]"
|
|
50
|
-
:reset="resetNumber"
|
|
51
|
-
@change="(v) => itemValueChange(v, 3)"
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<div v-if="expand" class="center">
|
|
56
|
-
<Select
|
|
57
|
-
v-model:value="termsData.terms[1].type"
|
|
58
|
-
class="center-select"
|
|
59
|
-
style="width: 100px"
|
|
60
|
-
:options="typeOptions"
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
<div v-if="expand" class="right">
|
|
64
|
-
<div class="right-items">
|
|
65
|
-
<SearchItem
|
|
66
|
-
v-for="item in [4, 5, 6]"
|
|
67
|
-
:key="`search_item_${item}`"
|
|
68
|
-
:expand="expand"
|
|
69
|
-
:index="item"
|
|
70
|
-
:columns="searchItems"
|
|
71
|
-
:terms-item="termsData.terms[1].terms[item - 4]"
|
|
72
|
-
:reset="resetNumber"
|
|
73
|
-
@change="(v) => itemValueChange(v, item)"
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<div
|
|
79
|
-
:class="[
|
|
80
|
-
'JSearch-footer',
|
|
81
|
-
expand || compatible ? 'expand' : '',
|
|
82
|
-
]"
|
|
83
|
-
>
|
|
84
|
-
<div class="JSearch-footer--btns">
|
|
85
|
-
<Button type="stroke" @click="reset"> 重置</Button>
|
|
86
|
-
<SaveHistory
|
|
87
|
-
:terms="termsData"
|
|
88
|
-
:target="target"
|
|
89
|
-
:request="request"
|
|
90
|
-
/>
|
|
91
|
-
<History
|
|
92
|
-
:target="target"
|
|
93
|
-
:request="historyRequest"
|
|
94
|
-
:delete-request="deleteRequest"
|
|
95
|
-
:delete-key="deleteKey"
|
|
96
|
-
@click="searchSubmit"
|
|
97
|
-
@itemClick="historyItemClick"
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
100
|
-
<Button
|
|
101
|
-
type="link"
|
|
102
|
-
class="more-btn"
|
|
103
|
-
@click="expandChange"
|
|
104
|
-
>
|
|
105
|
-
<span class="more-text"> 更多筛选 </span>
|
|
106
|
-
<AIcon
|
|
107
|
-
type="DoubleRightOutlined"
|
|
108
|
-
:class="[
|
|
109
|
-
'more-icon',
|
|
110
|
-
expand ? 'more-up' : 'more-down',
|
|
111
|
-
]"
|
|
112
|
-
/>
|
|
113
|
-
</Button>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
<!-- 简单模式 -->
|
|
117
|
-
<div v-else class="JSearch-content single big pack-up">
|
|
118
|
-
<div class="JSearch-items">
|
|
119
|
-
<div class="left">
|
|
120
|
-
<SearchItem
|
|
121
|
-
:expand="false"
|
|
122
|
-
:index="1"
|
|
123
|
-
:columns="searchItems"
|
|
124
|
-
:terms-item="termsData.terms[0].terms[0]"
|
|
125
|
-
:reset="resetNumber"
|
|
126
|
-
@change="(v) => itemValueChange(v, 1)"
|
|
127
|
-
/>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
<div class="JSearch-footer">
|
|
131
|
-
<div class="JSearch-footer--btns">
|
|
132
|
-
<FormItemRest>
|
|
133
|
-
<Button type="stroke" @click="reset">
|
|
134
|
-
重置
|
|
135
|
-
</Button>
|
|
136
|
-
<Button html-type="submit" type="primary">
|
|
137
|
-
搜索
|
|
138
|
-
</Button>
|
|
139
|
-
</FormItemRest>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</Form>
|
|
145
|
-
</template>
|
|
146
|
-
|
|
147
|
-
<script setup lang="ts">
|
|
148
|
-
import SearchItem from '../Item.vue';
|
|
149
|
-
import { optionsMapKey, typeOptions } from '../setting';
|
|
150
|
-
import { useElementSize } from '@vueuse/core';
|
|
151
|
-
import { useRouteQuery } from '@vueuse/router';
|
|
152
|
-
import { PropType, ref, reactive, watch, provide } from 'vue';
|
|
153
|
-
import SaveHistory from './SaveHistory.vue';
|
|
154
|
-
import History from './History.vue';
|
|
155
|
-
import type {
|
|
156
|
-
SearchItemData,
|
|
157
|
-
SearchProps,
|
|
158
|
-
Terms,
|
|
159
|
-
JColumnsProps,
|
|
160
|
-
} from '../typing';
|
|
161
|
-
import {
|
|
162
|
-
compatibleOldTerms,
|
|
163
|
-
getTermTypeFn,
|
|
164
|
-
handleQData,
|
|
165
|
-
hasExpand,
|
|
166
|
-
termsParamsFormat,
|
|
167
|
-
} from '../util';
|
|
168
|
-
import { Select, Button, Form, FormItemRest } from 'ant-design-vue'
|
|
169
|
-
import { AIcon } from '../../../'
|
|
170
|
-
import { cloneDeep } from 'lodash-es';
|
|
171
|
-
|
|
172
|
-
type UrlParam = {
|
|
173
|
-
q: string | null;
|
|
174
|
-
target: string | null;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
interface Emit {
|
|
178
|
-
(e: 'search', data: Terms): void;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const props = defineProps({
|
|
182
|
-
columns: {
|
|
183
|
-
type: Array as PropType<JColumnsProps[]>,
|
|
184
|
-
default: () => [],
|
|
185
|
-
required: true,
|
|
186
|
-
},
|
|
187
|
-
type: {
|
|
188
|
-
type: String,
|
|
189
|
-
default: 'advanced',
|
|
190
|
-
},
|
|
191
|
-
target: {
|
|
192
|
-
type: String,
|
|
193
|
-
default: '',
|
|
194
|
-
required: true,
|
|
195
|
-
},
|
|
196
|
-
class: {
|
|
197
|
-
type: String,
|
|
198
|
-
default: '',
|
|
199
|
-
},
|
|
200
|
-
request: {
|
|
201
|
-
type: Function as PropType<(data: any, target: string) => Promise<any>>,
|
|
202
|
-
default: undefined,
|
|
203
|
-
},
|
|
204
|
-
historyRequest: {
|
|
205
|
-
type: Function as PropType<(target: string) => Promise<any>>,
|
|
206
|
-
default: undefined,
|
|
207
|
-
},
|
|
208
|
-
deleteRequest: {
|
|
209
|
-
type: Function as PropType<
|
|
210
|
-
(target: string, id: string) => Promise<any>
|
|
211
|
-
>,
|
|
212
|
-
default: null,
|
|
213
|
-
},
|
|
214
|
-
deleteKey: {
|
|
215
|
-
type: String,
|
|
216
|
-
default: 'key',
|
|
217
|
-
},
|
|
218
|
-
routerMode: {
|
|
219
|
-
type: String,
|
|
220
|
-
default: 'hash',
|
|
221
|
-
},
|
|
222
|
-
style: {
|
|
223
|
-
type: [String, Object],
|
|
224
|
-
default: undefined,
|
|
225
|
-
},
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const searchRef = ref(null);
|
|
229
|
-
const searchRefContentRef = ref(null);
|
|
230
|
-
const {width} = useElementSize(searchRef);
|
|
231
|
-
|
|
232
|
-
const q = useRouteQuery('q');
|
|
233
|
-
const target = useRouteQuery('target');
|
|
234
|
-
const hasOnceSearch = ref(false);
|
|
235
|
-
|
|
236
|
-
// 是否展开更多筛选
|
|
237
|
-
const expand = ref(false);
|
|
238
|
-
|
|
239
|
-
// 组件方向
|
|
240
|
-
const layout = ref('horizontal');
|
|
241
|
-
const compatible = ref(false);
|
|
242
|
-
// 当前组件宽度 true 大于1000
|
|
243
|
-
const screenSize = ref(true);
|
|
244
|
-
const resetNumber = ref(1);
|
|
245
|
-
|
|
246
|
-
const searchItems = ref<SearchProps[]>([]); // 当前查询条件
|
|
247
|
-
|
|
248
|
-
const termsData = reactive<Terms>({
|
|
249
|
-
terms: [
|
|
250
|
-
{terms: [null, null, null]},
|
|
251
|
-
{terms: [null, null, null], type: 'and'},
|
|
252
|
-
],
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
const columnOptionMap = ref(new Map());
|
|
256
|
-
|
|
257
|
-
provide(optionsMapKey, columnOptionMap);
|
|
258
|
-
|
|
259
|
-
const emit = defineEmits<Emit>();
|
|
260
|
-
|
|
261
|
-
const expandChange = () => {
|
|
262
|
-
expand.value = !expand.value;
|
|
263
|
-
if (!expand.value) {
|
|
264
|
-
// 收起
|
|
265
|
-
const firstItem = termsData.terms[0].terms[0];
|
|
266
|
-
termsData.terms = [
|
|
267
|
-
{terms: [firstItem, null, null]},
|
|
268
|
-
{type: 'or', terms: [null, null, null]},
|
|
269
|
-
];
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const itemValueChange = (value: SearchItemData, index: number) => {
|
|
274
|
-
if (index < 4) {
|
|
275
|
-
// 第一组数据
|
|
276
|
-
termsData.terms[0].terms[index - 1] = value;
|
|
277
|
-
} else {
|
|
278
|
-
// 第二组数据
|
|
279
|
-
termsData.terms[1].terms[index - 4] = value;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const addUrlParams = () => {
|
|
284
|
-
q.value = encodeURI(JSON.stringify(termsData));
|
|
285
|
-
target.value = props.target;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
const submitData = () => {
|
|
289
|
-
emit('search', termsParamsFormat(termsData, columnOptionMap.value));
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* 提交
|
|
294
|
-
*/
|
|
295
|
-
const searchSubmit = () => {
|
|
296
|
-
submitData();
|
|
297
|
-
if (props.type === 'advanced') {
|
|
298
|
-
addUrlParams();
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* 重置查询
|
|
304
|
-
*/
|
|
305
|
-
const reset = () => {
|
|
306
|
-
termsData.terms = [
|
|
307
|
-
{terms: [null, null, null]},
|
|
308
|
-
{terms: [null, null, null], type: 'and'},
|
|
309
|
-
];
|
|
310
|
-
expand.value = false;
|
|
311
|
-
if (props.type === 'advanced') {
|
|
312
|
-
q.value = null;
|
|
313
|
-
target.value = null;
|
|
314
|
-
}
|
|
315
|
-
resetNumber.value += 1;
|
|
316
|
-
emit('search', {terms: []});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
watch(
|
|
320
|
-
width,
|
|
321
|
-
(value) => {
|
|
322
|
-
if (value < 1000) {
|
|
323
|
-
layout.value = 'vertical';
|
|
324
|
-
screenSize.value = false;
|
|
325
|
-
compatible.value = value < 760;
|
|
326
|
-
} else {
|
|
327
|
-
layout.value = 'horizontal';
|
|
328
|
-
screenSize.value = true;
|
|
329
|
-
compatible.value = false;
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
{immediate: true},
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
const historyItemClick = (content: string) => {
|
|
336
|
-
try {
|
|
337
|
-
termsData.terms = handleQData(compatibleOldTerms(content))?.terms || [];
|
|
338
|
-
expand.value = hasExpand(termsData.terms);
|
|
339
|
-
searchSubmit();
|
|
340
|
-
} catch (e) {
|
|
341
|
-
console.warn(`Search组件中handleUrlParams处理JSON时异常:【${e}】`);
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* 处理URL中的查询参数
|
|
347
|
-
* @param _params
|
|
348
|
-
*/
|
|
349
|
-
const handleUrlParams = (_params: UrlParam) => {
|
|
350
|
-
// URL中的target和props的一致,则还原查询参数
|
|
351
|
-
if (props.target && _params.target === props.target && _params.q) {
|
|
352
|
-
const qStr = decodeURI(_params.q);
|
|
353
|
-
termsData.terms = handleQData(compatibleOldTerms(qStr))?.terms || [];
|
|
354
|
-
expand.value = hasExpand(termsData.terms);
|
|
355
|
-
emit('search', termsParamsFormat(termsData, columnOptionMap.value));
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* 处理每项的key为Item组件所需要的key
|
|
361
|
-
*/
|
|
362
|
-
const handleItems = () => {
|
|
363
|
-
searchItems.value = [];
|
|
364
|
-
columnOptionMap.value.clear();
|
|
365
|
-
props.columns!.forEach((item, index) => {
|
|
366
|
-
const _item = cloneDeep(item);
|
|
367
|
-
if (_item.search && Object.keys(_item.search).length) {
|
|
368
|
-
columnOptionMap.value.set(
|
|
369
|
-
// _item.search?.rename || _item.dataIndex,
|
|
370
|
-
_item.dataIndex,
|
|
371
|
-
_item.search,
|
|
372
|
-
);
|
|
373
|
-
|
|
374
|
-
// 默认值
|
|
375
|
-
const {search} = _item;
|
|
376
|
-
let defaultTerms = null;
|
|
377
|
-
// 包含defaultValue 或者 defaultOnceValue
|
|
378
|
-
if (search.defaultValue !== undefined || search.defaultOnceValue) {
|
|
379
|
-
const _value = search.defaultValue || search.defaultOnceValue;
|
|
380
|
-
defaultTerms = {
|
|
381
|
-
type: 'and',
|
|
382
|
-
value: _value,
|
|
383
|
-
termType:
|
|
384
|
-
search.defaultTermType || getTermTypeFn(search.type),
|
|
385
|
-
column: _item.dataIndex,
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (
|
|
390
|
-
search.defaultValue !== undefined ||
|
|
391
|
-
search.defaultOnceValue !== undefined
|
|
392
|
-
) {
|
|
393
|
-
hasOnceSearch.value = true;
|
|
394
|
-
}
|
|
395
|
-
searchItems.value.push({
|
|
396
|
-
..._item.search,
|
|
397
|
-
sortIndex: _item.search.first ? 0 : index + 1,
|
|
398
|
-
title: _item.title as any,
|
|
399
|
-
// column: _item.search?.rename || _item.dataIndex,
|
|
400
|
-
column: _item.dataIndex,
|
|
401
|
-
});
|
|
402
|
-
if (defaultTerms) {
|
|
403
|
-
itemValueChange(defaultTerms, search.first ? 1 : index + 1);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
submitData();
|
|
409
|
-
|
|
410
|
-
handleUrlParams({q: q.value, target: target.value});
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
watch(
|
|
414
|
-
() => props.columns,
|
|
415
|
-
() => {
|
|
416
|
-
termsData.terms = [
|
|
417
|
-
{terms: [null, null, null]},
|
|
418
|
-
{terms: [null, null, null], type: 'and'},
|
|
419
|
-
];
|
|
420
|
-
expand.value = false;
|
|
421
|
-
if (props.type === 'advanced') {
|
|
422
|
-
q.value = null;
|
|
423
|
-
target.value = null;
|
|
424
|
-
}
|
|
425
|
-
handleItems();
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
deep: true,
|
|
429
|
-
},
|
|
430
|
-
);
|
|
431
|
-
|
|
432
|
-
handleItems();
|
|
433
|
-
</script>
|
|
434
|
-
|
|
435
|
-
<style scoped lang="less"></style>
|