|
@@ -0,0 +1,86 @@
|
|
|
+<template>
|
|
|
+ <div class="tool-bar-wrap">
|
|
|
+ <div class="tool-bar-item tool-bar-range-item"
|
|
|
+ v-show="showPickerSlots">
|
|
|
+ <slot name="picker" />
|
|
|
+ </div>
|
|
|
+ <div class="tool-bar-item"
|
|
|
+ v-for="(field, index) in text"
|
|
|
+ :key="field">
|
|
|
+ <p class="label">{{label[index]}}</p>
|
|
|
+ <a-input v-model:value="fields[field]"
|
|
|
+ :placeholder="label[index]"
|
|
|
+ size="large" />
|
|
|
+ </div>
|
|
|
+ <slot />
|
|
|
+ <div class="tool-bar-item">
|
|
|
+ <a-button type="primary"
|
|
|
+ size="large">
|
|
|
+ <template #icon>
|
|
|
+ <search-outlined />
|
|
|
+ </template>
|
|
|
+ 查询
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+import { defineComponent, PropType, ref } from "vue";
|
|
|
+import { SearchOutlined } from "@ant-design/icons-vue";
|
|
|
+
|
|
|
+const ToolBar = defineComponent({
|
|
|
+ components: {
|
|
|
+ SearchOutlined,
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ text: {
|
|
|
+ type: Object as PropType<string[]>,
|
|
|
+ default: () => ref<string[]>([]),
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ type: Object as PropType<string[]>,
|
|
|
+ default: () => ref<string[]>([]),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ setup(props, { emit, slots }) {
|
|
|
+ const fields = ref<{ [key: string]: string }>({});
|
|
|
+
|
|
|
+ let showPickerSlots = ref(!!slots.picker);
|
|
|
+
|
|
|
+ props.text.forEach((field) => {
|
|
|
+ fields.value[field] = "";
|
|
|
+ });
|
|
|
+
|
|
|
+ return { fields, showPickerSlots };
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+export default ToolBar;
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.tool-bar-wrap {
|
|
|
+ @include flex($space: flex-start, $align: flex-end);
|
|
|
+ flex-flow: row wrap;
|
|
|
+ border-bottom: 1px solid #d4d4d4;
|
|
|
+ margin-bottom: 10px;
|
|
|
+
|
|
|
+ .tool-bar-item {
|
|
|
+ width: 25%;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 10px 15px;
|
|
|
+
|
|
|
+ .label {
|
|
|
+ text-align: left;
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.tool-bar-range-item {
|
|
|
+ width: 30%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|