af-mobile-client-vue3 1.0.69 → 1.0.71

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.
@@ -1,230 +1,240 @@
1
- <script setup lang="ts">
2
- import {defineEmits, defineModel, defineProps, onMounted, ref, watch} from 'vue'
3
- import {
4
- Button as VanButton,
5
- Col as VanCol,
6
- DropdownItem as VanDropdownItem,
7
- DropdownMenu as VanDropdownMenu,
8
- Icon as VanIcon,
9
- Row as VanRow,
10
- showFailToast,
11
- } from 'vant'
12
- import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
13
- import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
14
- const props = defineProps<{
15
- orderVal?: string
16
- sortordVal?: string
17
- orderList?: any[]
18
- formQuery?: any[]
19
- }>()
20
-
21
- const emit = defineEmits([
22
- 'update:orderVal',
23
- 'update:sortordVal',
24
- 'update:conditionParams',
25
- 'onRefresh',
26
- ])
27
- // 排序字段
28
- const currentOrderVal = defineModel('orderVal')
29
- // 排序规则
30
- const currentSortordVal = defineModel('sortordVal')
31
- // 下拉菜单元素
32
- const listFilterMenu = ref(null)
33
- // 排序规则列表
34
- const sortordList = ref([
35
- { title: '正序', value: 'ascend' },
36
- { title: '倒序', value: 'descend' },
37
- ])
38
- const colFieldNames = {
39
- text: 'title',
40
- value: 'value'
41
- }
42
- // 查询条件参数 !!!!!建议最后点击确认的时候完成这个的整理
43
- const conditionParams = ref({})
44
-
45
- // 重置某个选项
46
- function resetOptionItem(type) {
47
- if(conditionParams.value[type] != undefined){
48
- conditionParams.value[type] = undefined
49
- }
50
- }
51
- // 重置所有选项
52
- function resetOption() {
53
- currentOrderVal.value = undefined
54
- currentSortordVal.value = undefined
55
- // 条件参数
56
- conditionParams.value = {}
57
- }
58
- function checkOrderOption() {
59
- let isCheck = true
60
- if (currentOrderVal.value) {
61
- if (!currentSortordVal.value) {
62
- showFailToast('排序规则不能为空')
63
- isCheck = false
64
- }
65
- }
66
- else if (currentSortordVal.value) {
67
- if (!currentOrderVal.value) {
68
- showFailToast('排序字段不能为空')
69
- isCheck = false
70
- }
71
- }
72
- return isCheck
73
- }
74
- // 确认筛选条件
75
- function confirmOption() {
76
- const isCheck = checkOrderOption()
77
- if (isCheck) {
78
- const isEmptyObject = Object.keys(conditionParams.value).length === 0
79
- emit('update:conditionParams', isEmptyObject ? undefined : conditionParams.value)
80
- emit('onRefresh', {})
81
- listFilterMenu.value.toggle(false)
82
- }
83
- }
84
-
85
- onMounted(() => {
86
- // currentOrderVal.value = props.orderVal
87
- // currentSortordVal.value = props.sortordVal
88
- // disposalData()
89
- })
90
-
91
- </script>
92
-
93
- <template>
94
- <div id="XCellListFilter">
95
- <VanDropdownMenu :close-on-click-outside="false">
96
- <VanDropdownItem ref="listFilterMenu">
97
- <template #title>
98
- <VanIcon name="filter-o" size="20" />
99
- </template>
100
- <div class="order-condition">
101
- <template v-if="props.orderList.length>0">
102
- <VanRow justify="space-between" class="filter-title">
103
- <VanCol span="10">
104
- 排序字段
105
- </VanCol>
106
- <VanCol span="2">
107
- <div class="reset-item" @click.stop="currentOrderVal = undefined">
108
- 重置
109
- </div>
110
- </VanCol>
111
- </VanRow>
112
- <XGridDropOption :columns="props.orderList" :columns-field-names="colFieldNames" v-model="currentOrderVal"/>
113
- <VanRow justify="space-between" class="filter-title">
114
- <VanCol span="10">
115
- 排序规则
116
- </VanCol>
117
- <VanCol span="2">
118
- <div class="reset-item" @click.stop="currentSortordVal = undefined">
119
- 重置
120
- </div>
121
- </VanCol>
122
- </VanRow>
123
- <XGridDropOption :columns="sortordList" :columns-field-names="colFieldNames" v-model="currentSortordVal"/>
124
- </template>
125
- <template v-for="(item, index) in props.formQuery" :key="item.model">
126
- <VanRow justify="space-between" class="filter-title">
127
- <VanCol span="10">
128
- {{ item.name }}
129
- </VanCol>
130
- <VanCol span="2">
131
- <div class="reset-item" @click.stop="resetOptionItem(item.model)">
132
- 重置
133
- </div>
134
- </VanCol>
135
- </VanRow>
136
- <XFormItem :attr="item" v-model="conditionParams[item.model]" :show-label="false"/>
137
- </template>
138
- </div>
139
- <div class="operations-panel">
140
- <VanButton type="default" @click="resetOption">
141
- 重置
142
- </VanButton>
143
- <VanButton type="primary" @click="confirmOption">
144
- 查询
145
- </VanButton>
146
- </div>
147
- </VanDropdownItem>
148
- </VanDropdownMenu>
149
- </div>
150
- </template>
151
-
152
- <style scoped lang="less">
153
- #XCellListFilter {
154
- .order-condition {
155
- // padding-bottom: 10px;
156
- max-height: calc(var(--van-picker-toolbar-height) + var(--van-padding-base) + var(--van-tabs-line-height) + 35vh);
157
- overflow-y: auto;
158
- width: 100%;
159
- background-color: white;
160
- .filter-title {
161
- height: 2rem;
162
- font-size: 13px;
163
- font-weight: 600;
164
- line-height: 2rem;
165
- margin: 5px 1rem 1px 1rem;
166
- color: black;
167
- }
168
- .range-picker-list {
169
- .range-picker-title {
170
- height: 2rem;
171
- font-size: 13px;
172
- font-weight: 600;
173
- line-height: 2rem;
174
- margin: 5px 1rem 1px 1rem;
175
- color: black;
176
- }
177
- .range-picker-time {
178
- display: inline-block;
179
- background: #f8f8f8;
180
- border-radius: 8px;
181
- font-size: 13px;
182
- margin: 0 1rem;
183
- height: 2rem;
184
- line-height: 2rem;
185
- width: 40vw;
186
- text-align: center;
187
- }
188
- /* 已完成选择的时间 */
189
- .active-picker-time {
190
- color: blue;
191
- }
192
- }
193
- /* 重置元素按钮 */
194
- .reset-item {
195
- font-weight: 500;
196
- color: blue;
197
- }
198
- }
199
- /* 下拉菜单的操作面板 */
200
- .operations-panel {
201
- display: flex;
202
- overflow: hidden;
203
- user-select: none;
204
- padding: 10px;
205
-
206
- & > .van-button {
207
- flex: 1;
208
- margin: 0;
209
-
210
- &:first-child {
211
- margin-right: 12px;
212
- }
213
- }
214
- }
215
- /* 时间范围组件 */
216
- .rangePicker-comp-box {
217
- :deep(.van-calendar) {
218
- height: 58vh;
219
- }
220
- :deep(.van-calendar__header-title) {
221
- background-color: rgba(25, 137, 250, 0.1);
222
- height: 8vh;
223
- line-height: 8vh;
224
- }
225
- :deep(.van-calendar__month-mark) {
226
- color: rgba(25, 137, 250, 0.1);
227
- }
228
- }
229
- }
230
- </style>
1
+ <script setup lang="ts">
2
+ import { defineEmits, defineModel, defineProps, onMounted, ref } from 'vue'
3
+ import {
4
+ Button as VanButton,
5
+ Col as VanCol,
6
+ DropdownItem as VanDropdownItem,
7
+ DropdownMenu as VanDropdownMenu,
8
+ Icon as VanIcon,
9
+ Row as VanRow,
10
+ showFailToast,
11
+ } from 'vant'
12
+ import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
13
+ import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
14
+
15
+ const props = defineProps<{
16
+ orderVal?: string
17
+ sortordVal?: string
18
+ orderList?: any[]
19
+ formQuery?: any[]
20
+ buttonState?: any
21
+ }>()
22
+
23
+ const emit = defineEmits([
24
+ 'update:orderVal',
25
+ 'update:sortordVal',
26
+ 'update:conditionParams',
27
+ 'onRefresh',
28
+ 'addOption',
29
+ ])
30
+ // 排序字段
31
+ const currentOrderVal = defineModel('orderVal')
32
+ // 排序规则
33
+ const currentSortordVal = defineModel('sortordVal')
34
+ // 下拉菜单元素
35
+ const listFilterMenu = ref(null)
36
+ // 排序规则列表
37
+ const sortordList = ref([
38
+ { title: '正序', value: 'ascend' },
39
+ { title: '倒序', value: 'descend' },
40
+ ])
41
+ const colFieldNames = {
42
+ text: 'title',
43
+ value: 'value',
44
+ }
45
+ // 查询条件参数 !!!!!建议最后点击确认的时候完成这个的整理
46
+ const conditionParams = ref({})
47
+
48
+ // 重置某个选项
49
+ function resetOptionItem(type) {
50
+ if (conditionParams.value[type] !== undefined)
51
+ conditionParams.value[type] = undefined
52
+ }
53
+ // 重置所有选项
54
+ function resetOption() {
55
+ currentOrderVal.value = undefined
56
+ currentSortordVal.value = undefined
57
+ // 条件参数
58
+ conditionParams.value = {}
59
+ }
60
+ function checkOrderOption() {
61
+ let isCheck = true
62
+ if (currentOrderVal.value) {
63
+ if (!currentSortordVal.value) {
64
+ showFailToast('排序规则不能为空')
65
+ isCheck = false
66
+ }
67
+ }
68
+ else if (currentSortordVal.value) {
69
+ if (!currentOrderVal.value) {
70
+ showFailToast('排序字段不能为空')
71
+ isCheck = false
72
+ }
73
+ }
74
+ return isCheck
75
+ }
76
+ // 确认筛选条件
77
+ function confirmOption() {
78
+ const isCheck = checkOrderOption()
79
+ if (isCheck) {
80
+ const isEmptyObject = Object.keys(conditionParams.value).length === 0
81
+ emit('update:conditionParams', isEmptyObject ? undefined : conditionParams.value)
82
+ emit('onRefresh', {})
83
+ listFilterMenu.value.toggle(false)
84
+ }
85
+ }
86
+
87
+ // 新增按钮
88
+ function addOption() {
89
+ emit('addOption')
90
+ }
91
+
92
+ onMounted(() => {
93
+ // currentOrderVal.value = props.orderVal
94
+ // currentSortordVal.value = props.sortordVal
95
+ // disposalData()
96
+ })
97
+ </script>
98
+
99
+ <template>
100
+ <div id="XCellListFilter">
101
+ <VanDropdownMenu :close-on-click-outside="false">
102
+ <VanDropdownItem ref="listFilterMenu">
103
+ <template #title>
104
+ <VanIcon name="filter-o" size="20" />
105
+ </template>
106
+ <div class="order-condition">
107
+ <template v-if="props.orderList.length > 0">
108
+ <VanRow justify="space-between" class="filter-title">
109
+ <VanCol span="10">
110
+ 排序字段
111
+ </VanCol>
112
+ <VanCol span="2">
113
+ <div class="reset-item" @click.stop="currentOrderVal = undefined">
114
+ 重置
115
+ </div>
116
+ </VanCol>
117
+ </VanRow>
118
+ <XGridDropOption :columns="props.orderList" :columns-field-names="colFieldNames" />
119
+ <VanRow justify="space-between" class="filter-title">
120
+ <VanCol span="10">
121
+ 排序规则
122
+ </VanCol>
123
+ <VanCol span="2">
124
+ <div class="reset-item" @click.stop="currentSortordVal = undefined">
125
+ 重置
126
+ </div>
127
+ </VanCol>
128
+ </VanRow>
129
+ <XGridDropOption :columns="sortordList" :columns-field-names="colFieldNames" />
130
+ </template>
131
+ <template v-for="(item, index) in props.formQuery" :key="`${item.model}${index}`">
132
+ <VanRow justify="space-between" class="filter-title">
133
+ <VanCol span="10">
134
+ {{ item.name }}
135
+ </VanCol>
136
+ <VanCol span="2">
137
+ <div class="reset-item" @click.stop="resetOptionItem(item.model)">
138
+ 重置
139
+ </div>
140
+ </VanCol>
141
+ </VanRow>
142
+ <XFormItem v-model="conditionParams[item.model]" :attr="item" :show-label="false" />
143
+ </template>
144
+ </div>
145
+ <div class="operations-panel">
146
+ <VanButton type="default" @click="resetOption">
147
+ 重置
148
+ </VanButton>
149
+ <VanButton v-if="props.buttonState.add && props.buttonState.add === true" type="primary" @click="addOption">
150
+ 新增
151
+ </VanButton>
152
+ <VanButton type="primary" @click="confirmOption">
153
+ 查询
154
+ </VanButton>
155
+ </div>
156
+ </VanDropdownItem>
157
+ </VanDropdownMenu>
158
+ </div>
159
+ </template>
160
+
161
+ <style scoped lang="less">
162
+ #XCellListFilter {
163
+ .order-condition {
164
+ // padding-bottom: 10px;
165
+ max-height: calc(var(--van-picker-toolbar-height) + var(--van-padding-base) + var(--van-tabs-line-height) + 35vh);
166
+ overflow-y: auto;
167
+ width: 100%;
168
+ background-color: white;
169
+ .filter-title {
170
+ height: 2rem;
171
+ font-size: 13px;
172
+ font-weight: 600;
173
+ line-height: 2rem;
174
+ margin: 5px 1rem 1px 1rem;
175
+ color: black;
176
+ }
177
+ .range-picker-list {
178
+ .range-picker-title {
179
+ height: 2rem;
180
+ font-size: 13px;
181
+ font-weight: 600;
182
+ line-height: 2rem;
183
+ margin: 5px 1rem 1px 1rem;
184
+ color: black;
185
+ }
186
+ .range-picker-time {
187
+ display: inline-block;
188
+ background: #f8f8f8;
189
+ border-radius: 8px;
190
+ font-size: 13px;
191
+ margin: 0 1rem;
192
+ height: 2rem;
193
+ line-height: 2rem;
194
+ width: 40vw;
195
+ text-align: center;
196
+ }
197
+ /* 已完成选择的时间 */
198
+ .active-picker-time {
199
+ color: blue;
200
+ }
201
+ }
202
+ /* 重置元素按钮 */
203
+ .reset-item {
204
+ font-weight: 500;
205
+ color: blue;
206
+ }
207
+ }
208
+ /* 下拉菜单的操作面板 */
209
+ .operations-panel {
210
+ display: flex;
211
+ overflow: hidden;
212
+ user-select: none;
213
+ padding: 10px;
214
+ gap: 12px;
215
+
216
+ & > .van-button {
217
+ flex: 1;
218
+ margin: 0;
219
+
220
+ //&:first-child {
221
+ // margin-right: 12px;
222
+ //}
223
+ }
224
+ }
225
+ /* 时间范围组件 */
226
+ .rangePicker-comp-box {
227
+ :deep(.van-calendar) {
228
+ height: 58vh;
229
+ }
230
+ :deep(.van-calendar__header-title) {
231
+ background-color: rgba(25, 137, 250, 0.1);
232
+ height: 8vh;
233
+ line-height: 8vh;
234
+ }
235
+ :deep(.van-calendar__month-mark) {
236
+ color: rgba(25, 137, 250, 0.1);
237
+ }
238
+ }
239
+ }
240
+ </style>