Преглед на файлове

fixed: 修改搜索栏位数量较多时按钮展示问题

liuyang преди 2 години
родител
ревизия
640dc32234

+ 8 - 6
common/vue/project/vue3-vite-ts-template/src/assets/css/element.scss

@ -418,7 +418,7 @@ html, body{
418 418
    }
419 419
  }
420 420
  .page-container {
421
    height: calc(100vh - 190px);
421
    height: calc(100vh - 160px);
422 422
    // height: 100%;
423 423
  }
424 424
  .page-show-container{
@ -492,7 +492,7 @@ html, body{
492 492
    width: 100%;
493 493
    text-align: right;
494 494
    // margin-top: 18px;
495
    padding-right: 20px;
495
    // padding-right: 20px;
496 496
    box-sizing: border-box;
497 497
  }
498 498
}
@ -503,13 +503,14 @@ html, body{
503 503
  height: 100%;
504 504
  display: flex;
505 505
  flex-direction: column;
506
  overflow-x: hidden;
506 507
  overflow-y: auto;
507 508

508
  .content {
509
  .aiot-page-content {
509 510
    background: #fff;
510
    padding: 10px 16px 4px 16px;
511
    margin-top: 12px;
512
    flex-grow: 1;
511
    padding: 12px 16px 4px 16px;
512
    flex: 1;
513
    overflow-x: hidden;
513 514
    display: flex;
514 515
    flex-direction: column;
515 516
    .aiot-content-btns {
@ -530,6 +531,7 @@ html, body{
530 531
    height: 40px;
531 532
  }
532 533
}
534
.aiot-page-pannel::-webkit-scrollbar { width: 0 !important }
533 535

534 536
.aiot-form-el{
535 537
  display: block;

+ 2 - 2
common/vue/project/vue3-vite-ts-template/src/assets/icons/common/down.svg

@ -1,4 +1,4 @@
1 1
<svg width="10" height="9" viewBox="0 0 10 9" fill="none" xmlns="http://www.w3.org/2000/svg">
2
<path d="M1 4L4.88119 8L9 4" stroke="#455A74"/>
3
<path d="M1 1L4.88119 5L9 1" stroke="#455A74"/>
2
<path d="M1 4L4.88119 8L9 4" stroke="currentColor"/>
3
<path d="M1 1L4.88119 5L9 1" stroke="currentColor"/>
4 4
</svg>

+ 2 - 2
common/vue/project/vue3-vite-ts-template/src/assets/icons/common/up.svg

@ -1,4 +1,4 @@
1 1
<svg width="10" height="9" viewBox="0 0 10 9" fill="none" xmlns="http://www.w3.org/2000/svg">
2
<path d="M1 5L4.88119 1L9 5" stroke="#455A74"/>
3
<path d="M1 8L4.88119 4L9 8" stroke="#455A74"/>
2
<path d="M1 5L4.88119 1L9 5" stroke="currentColor"/>
3
<path d="M1 8L4.88119 4L9 8" stroke="currentColor"/>
4 4
</svg>

+ 52 - 17
common/vue/project/vue3-vite-ts-template/src/components/form/AiotForm.vue

@ -2,7 +2,7 @@
2 2
 * @Author: Devin
3 3
 * @Date: 2022-11-15 11:23:35
4 4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-02 21:31:55
5
 * @LastEditTime: 2023-01-11 14:34:53
6 6
 * @Description: ts工程开发
7 7
-->
8 8
<template>
@ -24,26 +24,53 @@
24 24
        <el-col></el-col>
25 25
      </el-row>
26 26
    </template>
27
    <!--
28
      1. 搜索项 forms.length < 4, 展示搜索和重置按钮
29
      2. 搜索项forms.length >= 4, 按钮展示更多,并首行只展示3个搜索项,其余收起;
27 30
31
    -->
28 32
    <!-- search -->
29 33
    <template v-else>
30 34
      <el-row :gutter="20">
31
        <el-col
32
          v-for="formItem in forms"
33
          :key="formItem['name']"
34
          :span="formItem['col']"
35
        >
36
          <form-item
37
            :form-item="formItem"
38
            @change-event="changeEvent"
39
            @input-event="inputEvent"
40
          ></form-item>
41
        </el-col>
42
        <el-col :span="6">
43
          <el-form-item class="form-last-btns">
44
            <slot name="btns"></slot>
45
          </el-form-item>
46
        </el-col>
35
        <template v-if="showSearch">
36
          <el-col
37
            v-for="formItem in forms"
38
            :key="formItem['name']"
39
            :span="formItem['col']"
40
          >
41
            <form-item
42
              :form-item="formItem"
43
              @change-event="changeEvent"
44
              @input-event="inputEvent"
45
            ></form-item>
46
          </el-col>
47
          <el-col :span="6" class="form-last-btn-col">
48
            <el-form-item class="form-last-btns">
49
              <slot name="btns"></slot>
50
            </el-form-item>
51
          </el-col>
52
        </template>
53
54
        <template v-else>
55
          <!-- 收起 -->
56
          <el-col
57
            v-for="formItem in forms.slice(0, 3)"
58
            :key="formItem['name']"
59
            :span="formItem['col']"
60
          >
61
            <form-item
62
              :form-item="formItem"
63
              @change-event="changeEvent"
64
              @input-event="inputEvent"
65
            ></form-item>
66
          </el-col>
67
68
          <el-col :span="6">
69
            <el-form-item class="form-last-btns">
70
              <slot name="btns"></slot>
71
            </el-form-item>
72
          </el-col>
73
        </template>
47 74
      </el-row>
48 75
    </template>
49 76
  </el-form>
@ -62,6 +89,11 @@ defineProps({
62 89
  formType: {
63 90
    type: String,
64 91
    default: () => 'form'
92
  },
93
  // 是否隐藏筛选项
94
  showSearch: {
95
    type: Boolean,
96
    default: () => false
65 97
  }
66 98
});
67 99
const emits = defineEmits(['changeEvent', 'blurEvent']);
@ -111,4 +143,7 @@ defineExpose({
111 143
  width: calc(100% - 24px);
112 144
  margin-top: 18px;
113 145
}
146
.form-last-btn-col {
147
  margin-left: auto;
148
}
114 149
</style>

+ 2 - 30
common/vue/project/vue3-vite-ts-template/src/components/panel/PagePanel.vue

@ -2,7 +2,7 @@
2 2
 * @Author: Devin
3 3
 * @Date: 2022-11-24 17:05:58
4 4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-02 22:14:51
5
 * @LastEditTime: 2023-01-11 14:46:20
6 6
 * @Description: 列表页面公共模板
7 7
-->
8 8
<template>
@ -18,7 +18,7 @@
18 18
        <slot></slot>
19 19
      </aiot-search>
20 20
    </div>
21
    <div class="content">
21
    <div class="aiot-page-content">
22 22
      <div v-if="btnList?.length" class="aiot-content-btns">
23 23
        <el-button
24 24
          v-for="btn in btnList"
@ -178,32 +178,4 @@ function changeEvent(form: any) {
178 178
.table-btn-icon {
179 179
  margin: -2px 5px 0 0;
180 180
}
181
// .aiot-page-pannel {
182
//   height: 100%;
183
//   display: flex;
184
//   flex-direction: column;
185
//   overflow-y: auto;
186
187
//   .content {
188
//     background: #fff;
189
//     padding: 10px 16px;
190
//     margin-top: 16px;
191
//     flex-grow: 1;
192
//     display: flex;
193
//     flex-direction: column;
194
//     .aiot-content-btns {
195
//       height: 36px;
196
//     }
197
//   }
198
//   .search {
199
//     padding: 0px 16px;
200
//     background: #fff;
201
//   }
202
//   .table {
203
//     margin: 10px 0 4px 0;
204
//   }
205
//   .footer {
206
//     height: 40px;
207
//   }
208
// }
209 181
</style>

+ 19 - 2
common/vue/project/vue3-vite-ts-template/src/components/search/AiotSearch.vue

@ -6,6 +6,7 @@
6 6
      :model="formValues"
7 7
      :forms="searchParams"
8 8
      :form-type="'search'"
9
      :show-search="showSearch"
9 10
      @change-event="changeEvent"
10 11
      @blur-event="blurEvent"
11 12
    >
@ -13,6 +14,17 @@
13 14
        <div class="aiot-search-btns">
14 15
          <el-button type="primary" @click.stop="doSearch">查询</el-button>
15 16
          <el-button @click.stop="clearSearch">重置</el-button>
17
          <el-button
18
            v-show="searchParams.length > 3"
19
            @click.stop="() => (showSearch = !showSearch)"
20
          >
21
            {{ showSearch ? '收起' : '展开' }}
22
            <svg-icon
23
              class="icon"
24
              :size="12"
25
              :name="showSearch ? 'common-up' : 'common-down'"
26
            ></svg-icon>
27
          </el-button>
16 28
        </div>
17 29
      </template>
18 30
    </aiot-form>
@ -20,9 +32,11 @@
20 32
</template>
21 33
22 34
<script lang="ts" setup>
23
import { watch } from 'vue';
35
import { watch, ref } from 'vue';
24 36
import AiotForm from '../form/AiotForm.vue';
25 37
38
// 是否展开筛选项
39
const showSearch = ref<any>(false);
26 40
const emits = defineEmits([
27 41
  'doSearch',
28 42
  'clearSearch',
@ -180,8 +194,11 @@ doSearch();
180 194
    width: 100%;
181 195
    text-align: right;
182 196
    // margin-top: 18px;
183
    padding-right: 20px;
197
    // padding-right: 20px;
184 198
    box-sizing: border-box;
199
    .icon {
200
      margin-left: 5px;
201
    }
185 202
  }
186 203
}
187 204
</style>

+ 18 - 3
common/vue/project/vue3-vite-ts-template/src/views/Home.vue

@ -2,13 +2,28 @@
2 2
 * @Author: Devin
3 3
 * @Date: 2023-01-10 16:28:32
4 4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-10 16:28:36
5
 * @LastEditTime: 2023-01-10 18:02:35
6 6
 * @Description: 
7 7
-->
8 8
<template>
9
  <div class="home">我是主体部分</div>
9
  <div class="home">
10
    我是主体部分
11
    <div class="svg">
12
      <img src="../assets/icons/common/add-item.svg" class="svg-color" alt="" />
13
    </div>
14
  </div>
10 15
</template>
11 16
12 17
<script setup lang="ts"></script>
13 18
14
<style scoped></style>
19
<style scoped lang="scss">
20
.svg {
21
  width: 30px;
22
  height: 30px;
23
  overflow: hidden;
24
}
25
.svg-color {
26
  transform: translateX(30px);
27
  filter: drop-shadow(#ff0000 -30px 0px 0px);
28
}
29
</style>

+ 47 - 3
common/vue/project/vue3-vite-ts-template/src/views/_config.ts

@ -2,7 +2,7 @@
2 2
 * @Author: Devin
3 3
 * @Date: 2023-01-10 16:34:50
4 4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-10 16:41:07
5
 * @LastEditTime: 2023-01-11 09:55:33
6 6
 * @Description: 页面配置文件
7 7
 */
8 8
import { ref } from 'vue';
@ -21,10 +21,54 @@ export const searchConfig = ref<any>({
21 21
        }
22 22
      },
23 23
      {
24
        col: 6
24
        label: '名称1',
25
        name: 'name1',
26
        type: 'input',
27
        value: '',
28
        col: 6,
29
        attrs: {
30
          clearable: true
31
        }
32
      },
33
      {
34
        label: '名称2',
35
        name: 'name2',
36
        type: 'input',
37
        value: '',
38
        col: 6,
39
        attrs: {
40
          clearable: true
41
        }
42
      },
43
      {
44
        label: '名称3',
45
        name: 'name3',
46
        type: 'input',
47
        value: '',
48
        col: 6,
49
        attrs: {
50
          clearable: true
51
        }
52
      },
53
      {
54
        label: '名称4',
55
        name: 'name4',
56
        type: 'input',
57
        value: '',
58
        col: 6,
59
        attrs: {
60
          clearable: true
61
        }
25 62
      },
26 63
      {
27
        col: 6
64
        label: '名称5',
65
        name: 'name5',
66
        type: 'input',
67
        value: '',
68
        col: 6,
69
        attrs: {
70
          clearable: true
71
        }
28 72
      }
29 73
    ],
30 74