@ctzy-web-client/plugin-component-vue 1.0.0
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/package.json +43 -0
- package/src/advance-select/advance-operation.vue +44 -0
- package/src/advance-select/advance-option.vue +115 -0
- package/src/advance-select/advance-select.vue +343 -0
- package/src/advance-select/events-helpers.js +40 -0
- package/src/advance-select/index.js +13 -0
- package/src/advance-select/use-advance-option.js +58 -0
- package/src/advance-select/use-advance-select.js +142 -0
- package/src/application-slot/application-slot.js +70 -0
- package/src/application-slot/breadcrumb-item.vue +12 -0
- package/src/application-slot/header-tools-item.vue +12 -0
- package/src/application-slot/index.js +17 -0
- package/src/breadcrumb-select/breadcrumb-select.vue +97 -0
- package/src/breadcrumb-select/index.js +6 -0
- package/src/components.js +39 -0
- package/src/contextmenu/contextmenu-item.vue +13 -0
- package/src/contextmenu/contextmenu.vue +56 -0
- package/src/contextmenu/index.js +11 -0
- package/src/contextmenu/use-contextmenu.js +117 -0
- package/src/data-form/data-form-item.vue +49 -0
- package/src/data-form/data-form.vue +212 -0
- package/src/data-form/dynamic-component.js +24 -0
- package/src/data-form/form-components/Blots/AtBlot.js +32 -0
- package/src/data-form/form-components/bwa-date-picker.vue +43 -0
- package/src/data-form/form-components/bwa-date-time-picker.vue +49 -0
- package/src/data-form/form-components/bwa-input-float.vue +41 -0
- package/src/data-form/form-components/bwa-input-integer.vue +58 -0
- package/src/data-form/form-components/bwa-input.vue +32 -0
- package/src/data-form/form-components/bwa-multi-select.vue +27 -0
- package/src/data-form/form-components/bwa-rich-text-tinymce.vue +561 -0
- package/src/data-form/form-components/bwa-rich-text.vue +395 -0
- package/src/data-form/form-components/bwa-select.vue +67 -0
- package/src/data-form/form-components/bwa-textarea.vue +28 -0
- package/src/data-form/form-components/bwa-upload.vue +145 -0
- package/src/data-form/form-components/bwa-user-multi-select.vue +25 -0
- package/src/data-form/form-components/bwa-user-select.vue +81 -0
- package/src/data-form/index.js +35 -0
- package/src/data-table/data-column-view.vue +131 -0
- package/src/data-table/data-table-card.vue +81 -0
- package/src/data-table/data-table-column.vue +52 -0
- package/src/data-table/data-table.vue +426 -0
- package/src/data-table/dynamic-component.js +58 -0
- package/src/data-table/index.js +13 -0
- package/src/data-table/use-datatable-drag.js +156 -0
- package/src/datatable-settings/datatable-settings.vue +323 -0
- package/src/datatable-settings/index.js +6 -0
- package/src/date-range/date-picker.vue +115 -0
- package/src/date-range/date-range.vue +202 -0
- package/src/date-range/index.js +6 -0
- package/src/drag-list/constants.js +1 -0
- package/src/drag-list/drag-item.vue +46 -0
- package/src/drag-list/drag-list.vue +50 -0
- package/src/drag-list/index.js +6 -0
- package/src/drag-list/use-drag-list.js +209 -0
- package/src/dragable/constants.js +3 -0
- package/src/dragable/dragable-item.vue +19 -0
- package/src/dragable/dragable-operation.vue +28 -0
- package/src/dragable/dragable.vue +26 -0
- package/src/dragable/index.js +14 -0
- package/src/dragable/use-dragable.js +227 -0
- package/src/filter-panel/conditions/condition.js +35 -0
- package/src/filter-panel/conditions/date-range-condition.vue +35 -0
- package/src/filter-panel/conditions/department-condition/data.json +29537 -0
- package/src/filter-panel/conditions/department-condition/department-condition.vue +92 -0
- package/src/filter-panel/conditions/department-condition/department-node.vue +52 -0
- package/src/filter-panel/conditions/index.js +22 -0
- package/src/filter-panel/conditions/input-condition.vue +63 -0
- package/src/filter-panel/conditions/multi-user-condition.vue +56 -0
- package/src/filter-panel/conditions/multiple-menu-condition.vue +45 -0
- package/src/filter-panel/conditions/single-menu-condition.vue +58 -0
- package/src/filter-panel/conditions/single-user-condition.vue +56 -0
- package/src/filter-panel/filter-panel-item.vue +46 -0
- package/src/filter-panel/filter-panel.vue +149 -0
- package/src/filter-panel/index.js +17 -0
- package/src/filter-panel/use-filter-panel-item.js +59 -0
- package/src/filter-panel/use-filter-panel.js +203 -0
- package/src/hooks/use-data/index.js +234 -0
- package/src/index.js +48 -0
- package/src/layout/index.js +6 -0
- package/src/layout/layout.vue +74 -0
- package/src/make-installer.js +36 -0
- package/src/math/Rectangle.js +28 -0
- package/src/menu/index.js +6 -0
- package/src/menu/menu-item.vue +41 -0
- package/src/menu/menu.vue +53 -0
- package/src/panel/index.js +6 -0
- package/src/panel/panel.vue +42 -0
- package/src/panel-tabs/index.js +6 -0
- package/src/panel-tabs/panel-tabs.js +92 -0
- package/src/pct-filter-panel/index.js +10 -0
- package/src/pct-filter-panel/pct-compents/index.js +10 -0
- package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +63 -0
- package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +60 -0
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +177 -0
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +142 -0
- package/src/pct-filter-panel/pct-filter-panel-item.vue +46 -0
- package/src/pct-filter-panel/pct-filter-panel.vue +201 -0
- package/src/pct-filter-panel/use-filter-panel-item.js +61 -0
- package/src/pct-filter-panel/use-filter-panel.js +206 -0
- package/src/plugins.js +3 -0
- package/src/progress/index.js +8 -0
- package/src/progress/progress-item.vue +81 -0
- package/src/progress/progress.vue +58 -0
- package/src/progress/use-progress.js +66 -0
- package/src/utils/db.js +8 -0
- package/src/utils.js +263 -0
- package/src/where-filter-panel/index.js +0 -0
- package/src/where-filter-panel/use-where-filter-panel.js +28 -0
- package/src/where-filter-panel/where-filter-panel.vue +9 -0
- package/style/advance-select.scss +316 -0
- package/style/breadcrumb-select.scss +80 -0
- package/style/common/var.scss +240 -0
- package/style/common.scss +48 -0
- package/style/contextmenu.scss +58 -0
- package/style/data-form.scss +35 -0
- package/style/data-table.scss +81 -0
- package/style/datatable-settings.scss +125 -0
- package/style/date-range.scss +136 -0
- package/style/department-condition.scss +39 -0
- package/style/drag-list.scss +68 -0
- package/style/dragable.scss +8 -0
- package/style/filter-panel.scss +199 -0
- package/style/index.scss +22 -0
- package/style/input-condition.scss +30 -0
- package/style/layout.scss +70 -0
- package/style/menu.scss +184 -0
- package/style/mixins/_var.scss +21 -0
- package/style/mixins/config.scss +4 -0
- package/style/mixins/function.scss +62 -0
- package/style/mixins/mixins.scss +88 -0
- package/style/panel-tabs.scss +60 -0
- package/style/panel.scss +110 -0
- package/style/pct-filter-panel.scss +306 -0
- package/style/progress.scss +122 -0
- package/style/rich-text.scss +30 -0
- package/style/theme/theme.scss +161 -0
- package/style/theme/var.scss +34 -0
- package/style/var.scss +21 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ElMenuItem v-if="!children.length" :index="id">
|
|
3
|
+
<i v-if="item.iconName" :class="['ptp-icon', `ptp-${item.iconName}`]"></i>
|
|
4
|
+
<span :class="ns.be('item', 'content')">{{ item.title }}</span>
|
|
5
|
+
</ElMenuItem>
|
|
6
|
+
<ElSubMenu v-else :index="id" :popper-class="ns.b('sub')">
|
|
7
|
+
<template #title>
|
|
8
|
+
<i v-if="item.iconName" :class="['ptp-icon', `ptp-${item.iconName}`]"></i>
|
|
9
|
+
<span :class="ns.be('item', 'content')">{{ item.title }}</span>
|
|
10
|
+
</template>
|
|
11
|
+
<BwaMenuItem v-for="child in children" :item="child" :key="child.id" />
|
|
12
|
+
</ElSubMenu>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import { useNamespace } from 'web-base-client-vue';
|
|
17
|
+
import { computed } from 'vue';
|
|
18
|
+
|
|
19
|
+
defineOptions({
|
|
20
|
+
name: 'BwaMenuItem',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const ns = useNamespace('menu');
|
|
24
|
+
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
item: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const id = computed(() => {
|
|
33
|
+
if (typeof props.id !== 'number' && !props.item.id) {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return props.item.id + '';
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const children = computed(() => props.item?.children || []);
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ElMenu
|
|
3
|
+
:default-active="currentMenuID"
|
|
4
|
+
:class="[ns.b(), collapsed ? ns.m('collapsed') : '']"
|
|
5
|
+
:collapse="collapsed"
|
|
6
|
+
@select="handleSelect"
|
|
7
|
+
>
|
|
8
|
+
<MenuItem v-for="item in menus" :key="item.id" :item="item" />
|
|
9
|
+
</ElMenu>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { useNamespace } from 'web-base-client-vue';
|
|
14
|
+
import MenuItem from './menu-item.vue';
|
|
15
|
+
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: 'BwaMenu',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
currentMenuID: String,
|
|
22
|
+
menus: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: () => [],
|
|
25
|
+
},
|
|
26
|
+
collapsed: { type: Boolean, default: false },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const emit = defineEmits(['select']);
|
|
30
|
+
|
|
31
|
+
const ns = useNamespace('menu');
|
|
32
|
+
|
|
33
|
+
const getMenuById = (id) => {
|
|
34
|
+
const menus = props.menus || [];
|
|
35
|
+
|
|
36
|
+
let list = [...menus];
|
|
37
|
+
for (let i = 0; i < list.length; i++) {
|
|
38
|
+
const item = list[i];
|
|
39
|
+
|
|
40
|
+
if (item.id === id) {
|
|
41
|
+
return item;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
list = list.concat(item.children || []);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleSelect = (id) => {
|
|
51
|
+
emit('select', getMenuById(id));
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ns.b()">
|
|
3
|
+
<div :class="ns.e('header')" v-if="slots.header">
|
|
4
|
+
<slot name="header"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div :class="ns.e('tools')" v-if="slots.tools">
|
|
8
|
+
<slot name="tools"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div :class="ns.e('body')">
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div :class="ns.e('footer')" v-if="slots.footer">
|
|
16
|
+
<slot name="footer"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { useSlots } from 'vue';
|
|
23
|
+
import { useNamespace } from 'web-base-client-vue';
|
|
24
|
+
|
|
25
|
+
defineOptions({
|
|
26
|
+
name: 'BwaPanel',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
defineProps({
|
|
30
|
+
name: {
|
|
31
|
+
type: String,
|
|
32
|
+
},
|
|
33
|
+
label: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const ns = useNamespace('panel');
|
|
40
|
+
|
|
41
|
+
const slots = useSlots();
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ElTabPane, ElTabs } from 'element-plus';
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
ref,
|
|
6
|
+
useAttrs,
|
|
7
|
+
useSlots,
|
|
8
|
+
unref,
|
|
9
|
+
reactive,
|
|
10
|
+
watch,
|
|
11
|
+
computed,
|
|
12
|
+
} from 'vue';
|
|
13
|
+
import { useNamespace } from 'web-base-client-vue';
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
name: 'BwaPanelTabs',
|
|
17
|
+
props: {
|
|
18
|
+
modelValue: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
emits: ['update:modelValue'],
|
|
24
|
+
setup(props, { emit }) {
|
|
25
|
+
const slots = useSlots();
|
|
26
|
+
const attrs = useAttrs();
|
|
27
|
+
const ns = useNamespace('panel-tabs');
|
|
28
|
+
|
|
29
|
+
const modelValue = ref(props.modelValue || '');
|
|
30
|
+
const visibledNames = [];
|
|
31
|
+
|
|
32
|
+
watch(
|
|
33
|
+
modelValue,
|
|
34
|
+
(modelValue) => {
|
|
35
|
+
emit('update:modelValue', modelValue);
|
|
36
|
+
if (modelValue && !visibledNames.includes(modelValue)) {
|
|
37
|
+
visibledNames.push(modelValue);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{ immediate: true }
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
watch(
|
|
44
|
+
computed(() => props.modelValue),
|
|
45
|
+
(value) => {
|
|
46
|
+
modelValue.value = value || '';
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
let panels = slots.default?.() ?? [];
|
|
52
|
+
|
|
53
|
+
panels = panels.filter(
|
|
54
|
+
(panel) => panel.props?.label && panel.props?.name
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (!modelValue.value && panels.length) {
|
|
58
|
+
modelValue.value = panels[0].props.name;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return h(
|
|
62
|
+
ElTabs,
|
|
63
|
+
{
|
|
64
|
+
class: ns.b(),
|
|
65
|
+
type: 'card',
|
|
66
|
+
...attrs,
|
|
67
|
+
modelValue: unref(modelValue),
|
|
68
|
+
'onUpdate:modelValue': (value) => {
|
|
69
|
+
modelValue.value = value;
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
default: () =>
|
|
74
|
+
panels.map((panel) => {
|
|
75
|
+
return h(
|
|
76
|
+
ElTabPane,
|
|
77
|
+
{
|
|
78
|
+
class: ns.b('item'),
|
|
79
|
+
label: panel.props.label,
|
|
80
|
+
name: panel.props.name,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
default: () =>
|
|
84
|
+
visibledNames.includes(panel.props.name) ? panel : null,
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}),
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withInstall } from 'element-plus/es/utils/vue/install';
|
|
2
|
+
import PctFilterPanel from "./pct-filter-panel.vue"
|
|
3
|
+
|
|
4
|
+
import PctFilterPanelItem from './pct-filter-panel-item.vue'
|
|
5
|
+
|
|
6
|
+
export const BwaPctFilterPanel = withInstall(PctFilterPanel, {
|
|
7
|
+
PctFilterPanelItem,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default PctFilterPanel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import {withInstall} from "element-plus/es/utils/vue/install";
|
|
3
|
+
import PctMultipleMenuCondition from './pct-multiple-menu-condition.vue'
|
|
4
|
+
import PctInputCondition from './pct-Input-condition.vue'
|
|
5
|
+
import PctDateRangeCondition from './pct-date-range-condition.vue'
|
|
6
|
+
|
|
7
|
+
export const BwaPctInputCondition = withInstall(PctInputCondition, {});
|
|
8
|
+
export const BwaPctMultipleMenuCondition = withInstall(PctMultipleMenuCondition, {});
|
|
9
|
+
export const BwaPctDateRangeCondition = withInstall(PctDateRangeCondition, {});
|
|
10
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ns.e('inputCon')">
|
|
3
|
+
<span v-if="showTitle" :class="ns.e('title')">{{column.title}}</span>
|
|
4
|
+
<el-input
|
|
5
|
+
:prefix-icon="showIcon ? prefixIcon : ''"
|
|
6
|
+
size="small"
|
|
7
|
+
clearable
|
|
8
|
+
:class="ns.e('search')"
|
|
9
|
+
:placeholder="placeholderStr"
|
|
10
|
+
v-model="modelValue"
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import { useNamespace, filterPanelItemKey } from 'web-base-client-vue';
|
|
17
|
+
import {computed, defineEmits, inject, useAttrs} from 'vue';
|
|
18
|
+
import {dataProps} from "../../hooks/use-data";
|
|
19
|
+
const ns = useNamespace('pct-input');
|
|
20
|
+
const emit = defineEmits(['update:modelValue']);
|
|
21
|
+
defineOptions({
|
|
22
|
+
name: 'BwaPctInputCondition',
|
|
23
|
+
__conditionTitle__: '输入框',
|
|
24
|
+
__conditionDefault__: () => [],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
...dataProps,
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: null,
|
|
31
|
+
},
|
|
32
|
+
placeholder: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '请输入',
|
|
35
|
+
},
|
|
36
|
+
prefixIcon: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'Search',
|
|
39
|
+
},
|
|
40
|
+
showIcon: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const filterPanelItem = inject(filterPanelItemKey, null);
|
|
47
|
+
const column = computed(() => filterPanelItem?.column ?? null);
|
|
48
|
+
|
|
49
|
+
const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title)
|
|
50
|
+
|
|
51
|
+
const attrs = useAttrs();
|
|
52
|
+
const showTitle = computed(() => attrs.showTitle)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const modelValue = computed({
|
|
56
|
+
get: () => props.modelValue,
|
|
57
|
+
set: (v) => emit('update:modelValue', v),
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style scoped>
|
|
62
|
+
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ns.e('cont')">
|
|
3
|
+
<div v-if="column && showTitle" :class="ns.e('label')">{{ column.title }}</div>
|
|
4
|
+
<el-date-picker
|
|
5
|
+
v-model="value"
|
|
6
|
+
type="daterange"
|
|
7
|
+
range-separator="至"
|
|
8
|
+
start-placeholder="开始日期"
|
|
9
|
+
end-placeholder="结束日期"
|
|
10
|
+
:value-format="valueFormat"
|
|
11
|
+
size="small"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import {computed, inject} from 'vue';
|
|
18
|
+
import {useNamespace, filterPanelItemKey} from 'web-base-client-vue';
|
|
19
|
+
const ns = useNamespace('pct-daterange');
|
|
20
|
+
defineOptions({
|
|
21
|
+
name: 'BwaPctDateRangeCondition',
|
|
22
|
+
__conditionTitle__: '日期选择',
|
|
23
|
+
__conditionDefault__: () => ({ start: '', end: '' }),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: null,
|
|
29
|
+
},
|
|
30
|
+
valueFormat: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'YYYY-MM-DD',
|
|
33
|
+
},
|
|
34
|
+
showTitle: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const emit = defineEmits(['update:modelValue']);
|
|
41
|
+
|
|
42
|
+
const filterPanelItem = inject(filterPanelItemKey);
|
|
43
|
+
const column = computed(() => filterPanelItem?.column ?? null);
|
|
44
|
+
|
|
45
|
+
const value = computed({
|
|
46
|
+
get: () => {
|
|
47
|
+
if (props.modelValue && props.modelValue.start && props.modelValue.end) {
|
|
48
|
+
return [props.modelValue.start, props.modelValue.end];
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
},
|
|
52
|
+
set: (v) => {
|
|
53
|
+
if (v && v.length === 2) {
|
|
54
|
+
emit('update:modelValue', { start: v[0], end: v[1] });
|
|
55
|
+
} else {
|
|
56
|
+
emit('update:modelValue', { start: '', end: '' });
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="ns.e('conditbox')">
|
|
3
|
+
<div v-if="showTitle" :class="ns.e('title')">{{column.title}}</div>
|
|
4
|
+
<el-select
|
|
5
|
+
:multiple="multiple"
|
|
6
|
+
v-model="modelValue"
|
|
7
|
+
@visible-change="visibleChange"
|
|
8
|
+
:class="ns.e('options')"
|
|
9
|
+
:loading="loading"
|
|
10
|
+
:placeholder="placeholderStr"
|
|
11
|
+
:clearable="true"
|
|
12
|
+
:filterable="showSearch"
|
|
13
|
+
:remote="remote"
|
|
14
|
+
:remote-method="remoteMethod"
|
|
15
|
+
size="small"
|
|
16
|
+
>
|
|
17
|
+
<el-option
|
|
18
|
+
v-for="item in data"
|
|
19
|
+
:key="item[valuePropStr] + ''"
|
|
20
|
+
:value="item[valuePropStr] + ''"
|
|
21
|
+
:label="item[labelPropStr] + ''"
|
|
22
|
+
/>
|
|
23
|
+
</el-select>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
import { useNamespace } from 'web-base-client-vue';
|
|
29
|
+
import {computed, unref, defineEmits, inject, ref, useAttrs, watch} from 'vue';
|
|
30
|
+
import {dataProps} from "../../hooks/use-data";
|
|
31
|
+
|
|
32
|
+
import {
|
|
33
|
+
useService,
|
|
34
|
+
HttpRequest,
|
|
35
|
+
filterPanelItemKey
|
|
36
|
+
} from 'web-base-client-vue';
|
|
37
|
+
|
|
38
|
+
const httpRequest = useService(HttpRequest);
|
|
39
|
+
defineOptions({
|
|
40
|
+
name: 'BwaPctMultipleMenuCondition',
|
|
41
|
+
__conditionTitle__: '多选列表',
|
|
42
|
+
__conditionDefault__: () => [],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const props = defineProps({
|
|
46
|
+
...dataProps,
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: null,
|
|
49
|
+
},
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [],
|
|
53
|
+
},
|
|
54
|
+
labelProp: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: 'label',
|
|
57
|
+
},
|
|
58
|
+
valueProp: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'value',
|
|
61
|
+
},
|
|
62
|
+
multiple: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
66
|
+
showSearch: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true,
|
|
69
|
+
},
|
|
70
|
+
placeholder: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '请选择',
|
|
73
|
+
},
|
|
74
|
+
remote: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true,
|
|
77
|
+
},
|
|
78
|
+
size: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: 'small',
|
|
81
|
+
},
|
|
82
|
+
searchPlaceholder: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: '',
|
|
85
|
+
},
|
|
86
|
+
labelAttr: '',
|
|
87
|
+
valueAttr: '',
|
|
88
|
+
searchAttr: '',
|
|
89
|
+
itfInfo: null,
|
|
90
|
+
// 自定义选项时 是否通过展开自动触发自定义search
|
|
91
|
+
isRequiredByVisibleChange: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const ns = useNamespace('pctfilterpanel-item');
|
|
98
|
+
const isShowPopper = ref(false)
|
|
99
|
+
|
|
100
|
+
const attrs = useAttrs();
|
|
101
|
+
const showTitle = computed(() => attrs.showTitle)
|
|
102
|
+
|
|
103
|
+
const data = ref([])
|
|
104
|
+
const loading = ref(false)
|
|
105
|
+
const emit = defineEmits(['update:modelValue', 'search']);
|
|
106
|
+
|
|
107
|
+
const filterPanelItem = inject(filterPanelItemKey, null);
|
|
108
|
+
const column = computed(() => filterPanelItem?.column ?? null);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 页面参数层级覆盖配置文件传递的参数层级
|
|
112
|
+
*/
|
|
113
|
+
if (props.itfInfo) {
|
|
114
|
+
column.value.componentProps = {
|
|
115
|
+
itfInfo: props.itfInfo || {},
|
|
116
|
+
labelAttr: props.labelAttr || 'label',
|
|
117
|
+
valueAttr: props.valueAttr || 'value',
|
|
118
|
+
searchAttr: props.searchAttr || 'search'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const searchPlaceholderStr = computed(() => column.value?.componentProps?.searchPlaceholder || props.searchPlaceholder)
|
|
123
|
+
const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title)
|
|
124
|
+
|
|
125
|
+
const labelPropStr = computed(() => column.value?.componentProps?.labelAttr || props.labelProp)
|
|
126
|
+
const valuePropStr = computed(() => column.value?.componentProps?.valueAttr || props.valueProp)
|
|
127
|
+
|
|
128
|
+
const getData = async (query) => {
|
|
129
|
+
loading.value = true
|
|
130
|
+
const { itfInfo, searchAttr } = column.value.componentProps
|
|
131
|
+
const {url, method, options, params } = {
|
|
132
|
+
url: unref(itfInfo).url,
|
|
133
|
+
method: unref(itfInfo).method || 'POST',
|
|
134
|
+
options: unref(itfInfo).options || {},
|
|
135
|
+
params: { ...unref(itfInfo).params, [searchAttr]: query || ''} || {},
|
|
136
|
+
}
|
|
137
|
+
data.value = (await unref(httpRequest)[method.toLowerCase()](url, params, options))?.data
|
|
138
|
+
loading.value = false
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
data.value = props.options ?? []
|
|
142
|
+
const visibleChange = (val) => {
|
|
143
|
+
isShowPopper.value = val
|
|
144
|
+
if (!val || !column.value.componentProps || column.value?.componentProps?.options) {
|
|
145
|
+
if (isShowPopper.value && props.isRequiredByVisibleChange) {
|
|
146
|
+
emit('search', '')
|
|
147
|
+
}
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
getData()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const remoteMethod = (query) => {
|
|
154
|
+
if (column.value.componentProps) {
|
|
155
|
+
getData(query)
|
|
156
|
+
} else {
|
|
157
|
+
emit('search', query)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const modelValue = computed({
|
|
162
|
+
get: () => {
|
|
163
|
+
if (props.multiple) {
|
|
164
|
+
return Array.isArray(props.modelValue)
|
|
165
|
+
? props.modelValue.map((item) => item )
|
|
166
|
+
: [];
|
|
167
|
+
} else {
|
|
168
|
+
return props.modelValue == null || Array.isArray(props.modelValue) ? '' : props.modelValue;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
set: (v) => emit('update:modelValue', v),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
defineExpose({
|
|
175
|
+
data
|
|
176
|
+
})
|
|
177
|
+
</script>
|