t20-common-lib 0.9.1 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t20-common-lib",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -3,7 +3,6 @@
3
3
  v-model="branchBankNo"
4
4
  v-select-lazy="lazyGet"
5
5
  :multiple="multiple"
6
- :loading="loading"
7
6
  filterable
8
7
  clearable
9
8
  :filter-method="debouncedFilter"
@@ -80,7 +79,6 @@ export default {
80
79
  return {
81
80
  branchBankNo: this.value,
82
81
  branchBankList: [],
83
- loading: false,
84
82
  page: {
85
83
  current: 1,
86
84
  size: 20,
@@ -114,12 +112,11 @@ export default {
114
112
  }
115
113
  },
116
114
  async fetchBranchData(isInitial = false) {
117
- if (this.loading || !this.page.hasMore) return;
115
+ if (!this.page.hasMore) return;
118
116
  if (typeof this.requestFn !== 'function') {
119
117
  console.error("requestFn prop must be a function.");
120
118
  return;
121
119
  }
122
- this.loading = true;
123
120
 
124
121
  const params = {
125
122
  "page.size": this.page.size,
@@ -144,9 +141,7 @@ export default {
144
141
  this.page.hasMore = data.length === this.page.size;
145
142
  } catch (error) {
146
143
  console.error("Failed to fetch branch data:", error);
147
- } finally {
148
- this.loading = false;
149
- }
144
+ }
150
145
  },
151
146
  handleFilter(val) {
152
147
  this.page.key = val;
@@ -1,11 +1,11 @@
1
1
  <template>
2
- <div class="flex-column" :class="$slots.header ? 'main-page' : ''">
2
+ <div class="flex-column main-page">
3
3
  <div v-if="$slots.header" class="header">
4
4
  <slot name="header"></slot>
5
5
  </div>
6
6
  <div v-if="$slots.card || $slots.tab" style="position: relative;">
7
7
  <slot name="card"></slot>
8
- <div :class="$slots.card ? 'tab1' : 'tab2'" v-if="$slots.tab">
8
+ <div class="tab" v-if="$slots.tab">
9
9
  <slot name="tab"></slot>
10
10
  </div>
11
11
  </div>
@@ -22,15 +22,11 @@ export default {
22
22
  </script>
23
23
 
24
24
  <style lang="scss" scoped>
25
- .tab1 {
25
+ .tab {
26
26
  position: absolute;
27
27
  bottom: -40px;
28
28
  left: 8px;
29
29
  }
30
- .tab2 {
31
- position: absolute;
32
- bottom: -34px;
33
- }
34
30
 
35
31
  .bg-white {
36
32
  background-color: #fff !important;
@@ -0,0 +1,8 @@
1
+ import TabPage from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ TabPage.install = function(Vue) {
5
+ Vue.component(TabPage.name, TabPage);
6
+ };
7
+
8
+ export default TabPage;
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="flex-column" :class="rootClasses">
3
+ <div v-if="hasHeader" class="header">
4
+ <slot name="back"></slot>
5
+ <slot name="unit"></slot>
6
+ </div>
7
+ <div v-if="$slots.tab" class="tab-container">
8
+ <div class="tab" :class="tabClasses">
9
+ <slot name="tab"></slot>
10
+ </div>
11
+ </div>
12
+ <div class="content-wrapper flex-1 overflow" :class="contentClasses">
13
+ <slot></slot>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'TabPage',
21
+ props: {
22
+ level: {
23
+ type: Number,
24
+ default: 1
25
+ }
26
+ },
27
+ computed: {
28
+ hasUnitSlot() {
29
+ return !!this.$slots.unit;
30
+ },
31
+ hasHeader() {
32
+ return !!this.$slots.back || this.hasUnitSlot;
33
+ },
34
+ rootClasses() {
35
+ return {
36
+ tabPage: this.hasUnitSlot,
37
+ 'level2-content': this.level === 2
38
+ };
39
+ },
40
+ tabClasses() {
41
+ return {
42
+ level1: this.level === 1 && this.hasUnitSlot,
43
+ level2: !(this.level === 1 && this.hasUnitSlot)
44
+ };
45
+ },
46
+ contentClasses() {
47
+ return {
48
+ 'px-8': this.hasUnitSlot,
49
+ 'bg-white': true
50
+ };
51
+ }
52
+ }
53
+ }
54
+ </script>
55
+
56
+ <style lang="scss" scoped>
57
+ .tabPage {
58
+ padding: 0 !important; // 建议审查 !important 的必要性,优先通过提升选择器权重解决样式覆盖问题
59
+ background: #f0f2f5;
60
+ }
61
+
62
+ .header {
63
+ height: 32px;
64
+ line-height: 32px;
65
+ }
66
+
67
+ .tab-container {
68
+ position: relative;
69
+ height: 0; // 容器不占位
70
+ }
71
+
72
+ .tab {
73
+ position: absolute;
74
+ bottom: -34px;
75
+ z-index: 1; // 确保 tab 在内容区域之上
76
+ }
77
+
78
+ .tabPage .tab {
79
+ bottom: -42px;
80
+ }
81
+
82
+ .level1 {
83
+ padding-left: 8px;
84
+ }
85
+
86
+ .level2 {
87
+ // 可以保留为空或添加 level2 的特定样式
88
+ }
89
+
90
+ .content-wrapper {
91
+ position: relative; // 确保内容在 tab 下方
92
+ }
93
+
94
+ .level2-content {
95
+ height: calc(100% - 34px);
96
+ margin-top: 34px;
97
+ }
98
+
99
+ .bg-white {
100
+ background-color: #fff !important; // 建议审查 !important 的必要性
101
+ }
102
+ </style>
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ import PageHeader from '../packages/page-header/index.js'
13
13
  import CommonCollapse from '../packages/common-collapse/index.js'
14
14
  import MultiCurrencyStatistics from '../packages/multi-currency-statistics/index.js'
15
15
  import BranchBankSelect from '../packages/branch-bank-select/index.js'
16
+ import TabPage from '../packages/tab-page/index.js'
16
17
 
17
18
  // 存储组件列表
18
19
  const components = [
@@ -60,6 +61,7 @@ export {
60
61
  CommonCollapse,
61
62
  TabPane,
62
63
  PageHeader,
64
+ TabPage,
63
65
  MultiCurrencyStatistics,
64
66
  BranchBankSelect,
65
67
  repairEl,