Przeglądaj źródła

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

liuyang 2 lat temu
rodzic
commit
640dc32234

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

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

508

508
  .content {
509
  .aiot-page-content {
509
    background: #fff;
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
    display: flex;
514
    display: flex;
514
    flex-direction: column;
515
    flex-direction: column;
515
    .aiot-content-btns {
516
    .aiot-content-btns {
530
    height: 40px;
531
    height: 40px;
531
  }
532
  }
532
}
533
}
534
.aiot-page-pannel::-webkit-scrollbar { width: 0 !important }
533

535

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

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

1
<svg width="10" height="9" viewBox="0 0 10 9" fill="none" xmlns="http://www.w3.org/2000/svg">
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
</svg>
4
</svg>

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

1
<svg width="10" height="9" viewBox="0 0 10 9" fill="none" xmlns="http://www.w3.org/2000/svg">
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
</svg>
4
</svg>

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

2
 * @Author: Devin
2
 * @Author: Devin
3
 * @Date: 2022-11-15 11:23:35
3
 * @Date: 2022-11-15 11:23:35
4
 * @LastEditors: Devin
4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-02 21:31:55
5
 * @LastEditTime: 2023-01-11 14:34:53
6
 * @Description: ts工程开发
6
 * @Description: ts工程开发
7
-->
7
-->
8
<template>
8
<template>
24
        <el-col></el-col>
24
        <el-col></el-col>
25
      </el-row>
25
      </el-row>
26
    </template>
26
    </template>
27
    <!--
28
      1. 搜索项 forms.length < 4, 展示搜索和重置按钮
29
      2. 搜索项forms.length >= 4, 按钮展示更多,并首行只展示3个搜索项,其余收起;
27
30
31
    -->
28
    <!-- search -->
32
    <!-- search -->
29
    <template v-else>
33
    <template v-else>
30
      <el-row :gutter="20">
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
      </el-row>
74
      </el-row>
48
    </template>
75
    </template>
49
  </el-form>
76
  </el-form>
62
  formType: {
89
  formType: {
63
    type: String,
90
    type: String,
64
    default: () => 'form'
91
    default: () => 'form'
92
  },
93
  // 是否隐藏筛选项
94
  showSearch: {
95
    type: Boolean,
96
    default: () => false
65
  }
97
  }
66
});
98
});
67
const emits = defineEmits(['changeEvent', 'blurEvent']);
99
const emits = defineEmits(['changeEvent', 'blurEvent']);
111
  width: calc(100% - 24px);
143
  width: calc(100% - 24px);
112
  margin-top: 18px;
144
  margin-top: 18px;
113
}
145
}
146
.form-last-btn-col {
147
  margin-left: auto;
148
}
114
</style>
149
</style>

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

2
 * @Author: Devin
2
 * @Author: Devin
3
 * @Date: 2022-11-24 17:05:58
3
 * @Date: 2022-11-24 17:05:58
4
 * @LastEditors: Devin
4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-02 22:14:51
5
 * @LastEditTime: 2023-01-11 14:46:20
6
 * @Description: 列表页面公共模板
6
 * @Description: 列表页面公共模板
7
-->
7
-->
8
<template>
8
<template>
18
        <slot></slot>
18
        <slot></slot>
19
      </aiot-search>
19
      </aiot-search>
20
    </div>
20
    </div>
21
    <div class="content">
21
    <div class="aiot-page-content">
22
      <div v-if="btnList?.length" class="aiot-content-btns">
22
      <div v-if="btnList?.length" class="aiot-content-btns">
23
        <el-button
23
        <el-button
24
          v-for="btn in btnList"
24
          v-for="btn in btnList"
178
.table-btn-icon {
178
.table-btn-icon {
179
  margin: -2px 5px 0 0;
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
</style>
181
</style>

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

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

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

2
 * @Author: Devin
2
 * @Author: Devin
3
 * @Date: 2023-01-10 16:28:32
3
 * @Date: 2023-01-10 16:28:32
4
 * @LastEditors: Devin
4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-10 16:28:36
5
 * @LastEditTime: 2023-01-10 18:02:35
6
 * @Description: 
6
 * @Description: 
7
-->
7
-->
8
<template>
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
</template>
15
</template>
11
16
12
<script setup lang="ts"></script>
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
 * @Author: Devin
2
 * @Author: Devin
3
 * @Date: 2023-01-10 16:34:50
3
 * @Date: 2023-01-10 16:34:50
4
 * @LastEditors: Devin
4
 * @LastEditors: Devin
5
 * @LastEditTime: 2023-01-10 16:41:07
5
 * @LastEditTime: 2023-01-11 09:55:33
6
 * @Description: 页面配置文件
6
 * @Description: 页面配置文件
7
 */
7
 */
8
import { ref } from 'vue';
8
import { ref } from 'vue';
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