agilebuilder-ui 1.0.70 → 1.0.71-tmp2

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.
@@ -0,0 +1,250 @@
1
+ <template>
2
+ <div>
3
+ <el-form
4
+ v-if="searchableColumns.length > 0"
5
+ ref="searchForm"
6
+ :model="searchForm"
7
+ :rules="rules"
8
+ class="grid-search-form-mobile"
9
+ label-position="top"
10
+ size="default"
11
+ >
12
+ <!--初始进入台账页面时 或 展开时显示按钮--->
13
+ <div style="padding-bottom: 40px;padding-top: 35px;">
14
+ <search-form-item
15
+ v-for="(column, index) in searchableColumns"
16
+ :key="index"
17
+ :search-form="searchForm"
18
+ :column="column"
19
+ :code="code"
20
+ :is-sql="isSql"
21
+ :table-name="tableName"
22
+ :is-join-table="isJoinTable"
23
+ />
24
+ </div>
25
+ <div class="search-btn-mobile">
26
+ <search-button
27
+ ref="searchBtnOpen"
28
+ @submit-form="$emit('submit-form')"
29
+ @reset-form="$emit('reset-form')"
30
+ @save-condition="$emit('save-condition')"
31
+ />
32
+ </div>
33
+ </el-form>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import {$on, $off, $once, $emit} from '../../utils/gogocodeTransfer'
39
+ import searchMethods from './search-methods'
40
+ import store from './store'
41
+ import {addDynamicProp, addDynamicPropDateSection} from './utils'
42
+ import eventBus from '../../../src/utils/eventBus'
43
+ import SearchFormItem from './search-form-item.vue'
44
+ import SearchButton from './search-button.vue'
45
+
46
+ export default {
47
+ name: 'SearchFormMobile',
48
+ components: {
49
+ SearchFormItem,
50
+ SearchButton
51
+ },
52
+ props: {
53
+ searchableColumns: {
54
+ type: Array,
55
+ default: null,
56
+ },
57
+ searchForm: {
58
+ type: Object,
59
+ default: null,
60
+ },
61
+ rules: {
62
+ type: Object,
63
+ default: null,
64
+ },
65
+ labelWidth: {
66
+ type: String,
67
+ default: null,
68
+ },
69
+ query: {
70
+ type: Object,
71
+ default: null,
72
+ },
73
+ code: {
74
+ type: String,
75
+ default: null,
76
+ },
77
+ isSql: {
78
+ type: Boolean,
79
+ default: false,
80
+ },
81
+ loadCompleteQuery: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ },
86
+ data() {
87
+ const gridParams = store.get(this.code)
88
+ let tableName
89
+ if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
90
+ tableName = gridParams.basicInfo.tableName
91
+ }
92
+ let isHasJoinTable
93
+ if (
94
+ gridParams &&
95
+ gridParams.basicInfo &&
96
+ gridParams.basicInfo.hasJoinTable
97
+ ) {
98
+ isHasJoinTable = gridParams.basicInfo.hasJoinTable
99
+ }
100
+ const customComponentNames = new Set()
101
+ return {
102
+ customComponentNames: customComponentNames,
103
+ dateOne: null,
104
+ dataTwo: null,
105
+ tableName,
106
+ isJoinTable: isHasJoinTable, // 是否是关联表
107
+ isOpen: false,
108
+ }
109
+ },
110
+ computed: {},
111
+ watch: {},
112
+ created() {
113
+ },
114
+ methods: {
115
+ ...searchMethods,
116
+ validateForm() {
117
+ return new Promise((resolve, reject) => {
118
+ this.$refs.searchForm.validate((valid) => {
119
+ resolve(valid)
120
+ })
121
+ })
122
+ },
123
+ resetForm() {
124
+ $emit(eventBus, 'remoteMethod')
125
+ // console.log('customComponentNames=', this.customComponentNames)
126
+ if (this.customComponentNames && this.customComponentNames.length > 0) {
127
+ for (const componentName of this.customComponentNames) {
128
+ // 遍历
129
+ this.$refs[componentName][0].resetField()
130
+ }
131
+ }
132
+ this.$refs.searchForm.resetFields()
133
+ // 当是保持页数默认赋值的查询字段resetFields()不会被清空,需要下面的方法遍历设未null
134
+ this.searchableColumns.forEach((column) => {
135
+ // 表示没有默认初始查询字段
136
+ if (column.prop && column.prop.indexOf('.') > 0) {
137
+ if (column.componentType === 'dateSection') {
138
+ addDynamicPropDateSection(this.searchForm, column.prop)
139
+ } else {
140
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
141
+ addDynamicProp(this.searchForm, column.prop)
142
+ }
143
+ } else {
144
+ if (column.componentType === 'dateSection') {
145
+ this.searchForm[column.prop] = [new Date(), new Date()]
146
+ } else if (column.componentType === 'yearRange') {
147
+ this.searchForm[column.prop][0] = ''
148
+ this.searchForm[column.prop][1] = ''
149
+ } else if (
150
+ column.componentType === 'inputNumber' &&
151
+ this.searchForm[column.prop]
152
+ ) {
153
+ this.searchForm[column.prop][0] = 0
154
+ this.searchForm[column.prop][1] = 0
155
+ } else {
156
+ this.searchForm[column.prop] = null
157
+ }
158
+ this.setDefaultQueryValue(column, this.searchForm)
159
+ }
160
+ })
161
+ // 取消当前选中的条件列表的信息
162
+ // this.$refs.searchConditionList.editConditionId = null
163
+ // this.$emit('reset')
164
+ // 重置条件后查询列表
165
+ $emit(this, 'submit-form')
166
+ },
167
+ openFold(isOpen) {
168
+ this.isOpen = isOpen
169
+ $emit(this, 'open-fold', isOpen)
170
+ },
171
+ // 查询完毕
172
+ searchComplete() {
173
+ if (this.$refs.searchBtnOpen) {
174
+ if (Array.isArray(this.$refs.searchBtnOpen)) {
175
+ if (this.$refs.searchBtnOpen.length > 0) {
176
+ this.$refs.searchBtnOpen[0].searchComplete()
177
+ }
178
+ } else {
179
+ this.$refs.searchBtnOpen.searchComplete()
180
+ }
181
+ }
182
+ }
183
+ },
184
+ emits: [
185
+ 'submit-form',
186
+ 'reset-form',
187
+ 'save-condition',
188
+ 'remoteMethod',
189
+ ],
190
+ }
191
+ </script>
192
+
193
+ <style lang="scss" scoped>
194
+ .grid-search-form-mobile {
195
+ overflow: auto;
196
+ }
197
+
198
+ .grid-search-form-mobile {
199
+ :deep(.el-form-item) {
200
+ margin-bottom: 5px;
201
+ }
202
+ }
203
+
204
+ .grid-search-form-mobile {
205
+ :deep(.el-form-item__label) {
206
+ overflow: hidden;
207
+ text-overflow: ellipsis;
208
+ white-space: nowrap;
209
+ word-break: keep-all;
210
+ }
211
+ }
212
+
213
+ .grid-search-form-mobile {
214
+ :deep(.search-btn) {
215
+ margin-bottom: 5px;
216
+ text-align: center;
217
+ }
218
+ }
219
+
220
+ .grid-search-form-mobile {
221
+ :deep(.el-select) {
222
+ width: 100%;
223
+ }
224
+
225
+ :deep(.customComponent) {
226
+ width: 100%;
227
+ }
228
+ }
229
+
230
+ .grid-search-form-mobile {
231
+ :deep(.el-row) {
232
+ padding-right: 24px;
233
+ }
234
+ }
235
+
236
+ .grid-search-form-mobile {
237
+ :deep(.el-col) {
238
+ padding-left: 10px;
239
+ padding-bottom: 16px;
240
+ }
241
+ }
242
+ .search-btn-mobile {
243
+ padding-top: 10px;
244
+ position: fixed;
245
+ bottom: 0;
246
+ background-color: #ffffff;
247
+ width: 50%;
248
+ height: 40px;
249
+ }
250
+ </style>
@@ -1,96 +1,124 @@
1
1
  <template>
2
2
  <div>
3
- <search-condition-list
4
- v-if="searchConditions.length > 0"
5
- ref="searchConditionList"
6
- :search-conditions="searchConditions"
7
- :search-type="searchType"
8
- @remove-condition="removeCondition"
9
- @select-condition="selectCondition"
10
- />
11
- <search-form-ordinary-search
12
- v-if="searchType === 'normal'"
13
- ref="searchFormOrdinarySearch"
3
+ <el-drawer v-if="isMobile" v-model="isShowMobileForm" :close-on-click-modal="false" :close-on-press-escape="false" direction="rtl" size="50%" @close="closeMobileSearch()">
4
+ <div class="search-condition-mobile">
5
+ <search-condition-list
6
+ v-if="searchConditions.length > 0"
7
+ ref="searchConditionList"
8
+ :search-conditions="searchConditions"
9
+ :search-type="searchType"
10
+ @remove-condition="removeCondition"
11
+ @select-condition="selectCondition"
12
+ />
13
+ </div>
14
+ <search-form-mobile
15
+ v-if="isMobile && searchType === 'normal'"
16
+ ref="searchFormMobile"
14
17
  :code="code"
15
- :field-num="fieldNum"
16
18
  :is-sql="isSql"
17
- :label-width="labelWidth"
18
19
  :load-complete-query="loadCompleteQuery"
19
20
  :query="query"
20
- :row-num="rowNum"
21
21
  :rules="rules"
22
22
  :search-form="searchForm"
23
23
  :searchable-columns="searchableColumns"
24
- :span-num="spanNum"
25
24
  @submit-form="submitForm('searchForm')"
26
25
  @reset-form="resetForm('searchForm')"
27
26
  @save-condition="saveCondition()"
28
- @open-fold="openFold"
29
- />
30
- <search-form-advanced-query
31
- v-if="searchType === 'advanced'"
32
- ref="searchFormAdvancedQuery"
33
- :code="code"
34
- :is-sql="isSql"
35
- :prop-map="propMap"
36
- :search-form-list="searchFormList"
37
- :searchable-columns="advancedQueryColumns"
38
- style="padding-bottom: 10px"
39
- @resetForm="resetSearchFormList"
40
- />
41
- <div
42
- v-if="searchType === 'advanced'"
43
- style="padding-top: 10px; padding-bottom: 10px; text-align: center"
44
- >
45
- <el-button
46
- :loading="loading"
47
- size="default"
48
- type="primary"
49
- @click="submitForm('searchForm')"
50
- >
51
- {{ $t('imatrixUIPublicModel.sure') }}
52
- </el-button>
53
- <el-button
54
- :loading="loading"
55
- size="default"
56
- @click="resetForm('searchForm')"
27
+ />
28
+ </el-drawer>
29
+ <div v-else>
30
+ <search-condition-list
31
+ v-if="searchConditions.length > 0"
32
+ ref="searchConditionList"
33
+ :search-conditions="searchConditions"
34
+ :search-type="searchType"
35
+ @remove-condition="removeCondition"
36
+ @select-condition="selectCondition"
37
+ />
38
+ <search-form-ordinary-search
39
+ v-if="searchType === 'normal'"
40
+ ref="searchFormOrdinarySearch"
41
+ :code="code"
42
+ :field-num="fieldNum"
43
+ :is-sql="isSql"
44
+ :label-width="labelWidth"
45
+ :load-complete-query="loadCompleteQuery"
46
+ :query="query"
47
+ :row-num="rowNum"
48
+ :rules="rules"
49
+ :search-form="searchForm"
50
+ :searchable-columns="searchableColumns"
51
+ :span-num="spanNum"
52
+ @submit-form="submitForm('searchForm')"
53
+ @reset-form="resetForm('searchForm')"
54
+ @save-condition="saveCondition()"
55
+ @open-fold="openFold"
56
+ />
57
+ <search-form-advanced-query
58
+ v-if="searchType === 'advanced'"
59
+ ref="searchFormAdvancedQuery"
60
+ :code="code"
61
+ :is-sql="isSql"
62
+ :prop-map="propMap"
63
+ :search-form-list="searchFormList"
64
+ :searchable-columns="advancedQueryColumns"
65
+ style="padding-bottom: 10px"
66
+ @resetForm="resetSearchFormList"
67
+ />
68
+ <div
69
+ v-if="searchType === 'advanced'"
70
+ style="padding-top: 10px; padding-bottom: 10px; text-align: center"
57
71
  >
58
- {{ $t('imatrixUIPublicModel.reset') }}
59
- </el-button>
60
- <el-button size="default" @click="saveCondition">
61
- {{ $t('superGrid.saveCondition') }}
62
- </el-button>
63
- <span
72
+ <el-button
73
+ :loading="loading"
74
+ size="default"
75
+ type="primary"
76
+ @click="submitForm('searchForm')"
77
+ >
78
+ {{ $t('imatrixUIPublicModel.sure') }}
79
+ </el-button>
80
+ <el-button
81
+ :loading="loading"
82
+ size="default"
83
+ @click="resetForm('searchForm')"
84
+ >
85
+ {{ $t('imatrixUIPublicModel.reset') }}
86
+ </el-button>
87
+ <el-button size="default" @click="saveCondition">
88
+ {{ $t('superGrid.saveCondition') }}
89
+ </el-button>
90
+ <span
64
91
  v-if="
65
- advancedQuery !== null &&
66
- advancedQuery !== undefined &&
67
- advancedQuery === true &&
68
- normalQuery !== null &&
69
- normalQuery !== undefined &&
70
- normalQuery === true
71
- "
72
- style="margin-left: 10px"
73
- >
74
- <el-button
75
- v-if="searchType === 'advanced'"
76
- size="default"
77
- @click="searchType = 'normal'"
78
- >
79
- {{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
80
- </el-button>
81
- <el-button
82
- v-if="searchType === 'normal'"
83
- size="default"
84
- @click="searchType = 'advanced'"
85
- >
86
- {{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
87
- </el-button>
88
- </span>
92
+ advancedQuery !== null &&
93
+ advancedQuery !== undefined &&
94
+ advancedQuery === true &&
95
+ normalQuery !== null &&
96
+ normalQuery !== undefined &&
97
+ normalQuery === true
98
+ "
99
+ style="margin-left: 10px"
100
+ >
101
+ <el-button
102
+ v-if="searchType === 'advanced'"
103
+ size="default"
104
+ @click="searchType = 'normal'"
105
+ >
106
+ {{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
107
+ </el-button>
108
+ <el-button
109
+ v-if="searchType === 'normal'"
110
+ size="default"
111
+ @click="searchType = 'advanced'"
112
+ >
113
+ {{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
114
+ </el-button>
115
+ </span>
116
+ </div>
89
117
  </div>
90
- <search-condition-input
118
+ <search-condition-input
91
119
  v-if="isShowSearchCondition"
92
120
  @close="saveConditionValue"
93
- />
121
+ />
94
122
  </div>
95
123
  </template>
96
124
 
@@ -106,6 +134,8 @@ import {addDynamicProp, addDynamicPropDateSection} from './utils'
106
134
  import * as Vue from 'vue'
107
135
  import SearchConditionInput from './search-condition-input.vue'
108
136
  import SearchConditionList from './search-condition-list.vue'
137
+ import SearchFormMobile from './search-form-mobile.vue'
138
+ import {isMobileBrowser} from '../../../src/utils/common-util'
109
139
 
110
140
  export default {
111
141
  name: 'SearchForm',
@@ -114,7 +144,8 @@ export default {
114
144
  SearchConditionInput,
115
145
  SearchConditionList,
116
146
  searchFormOrdinarySearch,
117
- searchFormAdvancedQuery
147
+ searchFormAdvancedQuery,
148
+ SearchFormMobile
118
149
  },
119
150
  provide() {
120
151
  return {
@@ -207,6 +238,13 @@ export default {
207
238
  }
208
239
  }
209
240
  })
241
+
242
+ const isMobile = isMobileBrowser()
243
+ let canShowMobileSearch = false
244
+ if(isMobile && searchColumns && searchColumns.length > 0){
245
+ // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
246
+ canShowMobileSearch = true
247
+ }
210
248
  const spanNum = this.getSpanNum(searchColumns)
211
249
  const fieldNum = this.getFieldNumPerRow(searchColumns)
212
250
  const rowNum = Math.ceil(searchColumns.length / fieldNum)
@@ -215,7 +253,6 @@ export default {
215
253
  // console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
216
254
  // // -2是把
217
255
  // const dateSpanNum = (spanNum - 2) / 2
218
-
219
256
  return {
220
257
  searchForm,
221
258
  rules: {},
@@ -237,6 +274,9 @@ export default {
237
274
  normalQuery,
238
275
  searchFormList: [],
239
276
  searchType: null,
277
+ isMobile, // 是否是移动端
278
+ isShowMobileForm: true, // 是否显示表单
279
+ canShowMobileSearch
240
280
  }
241
281
  },
242
282
  computed: {
@@ -262,6 +302,11 @@ export default {
262
302
  } else if (this.advancedQuery) {
263
303
  this.searchType = 'advanced'
264
304
  }
305
+ console.log('this.canShowMobileSearch----', this.canShowMobileSearch)
306
+ if(this.canShowMobileSearch){
307
+ // 如果是移动端,且有查询字段,则新页面需要显示“查询”按钮
308
+ this.$emit('can-show-mobile-search')
309
+ }
265
310
  },
266
311
  methods: {
267
312
  ...searchMethods,
@@ -482,7 +527,17 @@ export default {
482
527
  return false
483
528
  },
484
529
  submitForm() {
485
- if (this.searchType === 'normal') {
530
+ if(this.isMobile){
531
+ this.$refs.searchFormMobile.validateForm().then((valid) => {
532
+ if (valid) {
533
+ // this.loading = true
534
+ this.searchParams = this.packageSearchParam()
535
+ $emit(this, 'search', this.searchParams)
536
+ } else {
537
+ return false
538
+ }
539
+ })
540
+ }else if (this.searchType === 'normal') {
486
541
  this.$refs.searchFormOrdinarySearch.validateForm().then((valid) => {
487
542
  if (valid) {
488
543
  // this.loading = true
@@ -508,7 +563,9 @@ export default {
508
563
  if (this.$refs.searchConditionList) {
509
564
  this.$refs.searchConditionList.editConditionId = null
510
565
  }
511
- if (this.searchType === 'normal') {
566
+ if(this.isMobile){
567
+ this.$refs.searchFormMobile.resetForm()
568
+ } else if (this.searchType === 'normal') {
512
569
  this.$refs.searchFormOrdinarySearch.resetForm()
513
570
  } else if (this.searchType === 'advanced') {
514
571
  this.$refs.searchFormAdvancedQuery.resetForm()
@@ -739,12 +796,21 @@ export default {
739
796
  },
740
797
  // 查询完毕
741
798
  searchComplete() {
742
- if (this.$refs.searchFormOrdinarySearch) {
799
+ if(this.isMobile && this.$refs.searchFormMobile){
800
+ this.$refs.searchFormMobile.searchComplete()
801
+ }else if (this.$refs.searchFormOrdinarySearch) {
743
802
  this.$refs.searchFormOrdinarySearch.searchComplete()
744
803
  }
745
804
  },
805
+ closeMobileSearch() {
806
+ this.isShowMobileForm = false
807
+ $emit(this, 'close-mobile-search')
808
+ },
809
+ showMobileSearch(){
810
+ this.isShowMobileForm = true
811
+ }
746
812
  },
747
- emits: ['search', 'open-fold', 'reset'],
813
+ emits: ['search', 'open-fold', 'reset', 'show-mobile-search', 'close-mobile-search'],
748
814
  }
749
815
  </script>
750
816
 
@@ -766,4 +832,15 @@ export default {
766
832
  .grid-search-form :deep(.customComponent) {
767
833
  width: 100%;
768
834
  }
835
+
836
+
837
+ .search-condition-mobile {
838
+ padding-bottom: 10px;
839
+ position: fixed;
840
+ top: 37px;
841
+ background-color: #ffffff;
842
+ width: 46%;
843
+ height: 40px;
844
+ z-index: 1500;
845
+ }
769
846
  </style>
@@ -7,6 +7,7 @@
7
7
  query &&
8
8
  query.showType === 'embedded'
9
9
  "
10
+ v-show="!isMobile || (isMobile && isShowMobileSearch)"
10
11
  ref="sf"
11
12
  :columns="columns"
12
13
  :code="code"
@@ -21,6 +22,8 @@
21
22
  @search="doSearch"
22
23
  @reset="resetSearch"
23
24
  @open-fold="openFold"
25
+ @can-show-mobile-search="$emit('can-show-mobile-search', code)"
26
+ @close-mobile-search="isShowMobileSearch=false"
24
27
  />
25
28
  <search-form-dialog
26
29
  v-if="hasLoadedColumns && query && query.showType === 'popup'"
@@ -246,7 +249,7 @@ import formValidatorService from './formValidatorUtil'
246
249
  import {getSystemCode} from '../../../src/utils/permissionAuth'
247
250
  import apis from './apis'
248
251
  import headerContextMenu from './header-context-menu.vue'
249
- import {isPromise} from '../../../src/utils/common-util'
252
+ import {isMobileBrowser, isPromise} from '../../../src/utils/common-util'
250
253
  import {checkPermission} from '../../../src/utils/permission'
251
254
 
252
255
  export default {
@@ -389,6 +392,7 @@ export default {
389
392
  if(this.options && this.options.pageContext){
390
393
  pageContext = this.options.pageContext
391
394
  }
395
+ const isMobile = isMobileBrowser()
392
396
  return {
393
397
  isLoading: false,
394
398
  currentPage: 1,
@@ -452,7 +456,9 @@ export default {
452
456
  tableStyle, // 表格的style
453
457
  tableClass, // 表格的class
454
458
  pageContext, // 页面配置上下文
455
- configureObj // 表格配置信息
459
+ configureObj, // 表格配置信息
460
+ isMobile, // 是否是移动端
461
+ isShowMobileSearch: false // 是否显示移动端查询区域
456
462
  }
457
463
  },
458
464
  computed: {
@@ -908,7 +914,7 @@ export default {
908
914
  const gridParams = store.get(this.code)
909
915
  if (isHasOptionFunction('resizeHeight', this.code)) {
910
916
  let searchHeight = 0
911
- if (this.$refs.sf) {
917
+ if (this.$refs.sf && !this.isMobile) {
912
918
  // 获得查询区高度
913
919
  searchHeight = this.$refs.sf.$el.offsetHeight
914
920
  }
@@ -2859,7 +2865,7 @@ export default {
2859
2865
  listCode: this.code,
2860
2866
  entity: row,
2861
2867
  columns: gridParams.columns,
2862
- isMobile: false,
2868
+ isMobile: this.isMobile,
2863
2869
  pageGridData: isSubTableShowPage ? gridParams.gridData : null,
2864
2870
  pageSize,
2865
2871
  additionalParamMap: gridParams.additionalParamMap,
@@ -2966,7 +2972,7 @@ export default {
2966
2972
  const isSubTableShowPage = gridParams.isSubTableShowPage
2967
2973
  // 每页显示多少条
2968
2974
  const pageSize = gridParams.pagination && gridParams.pagination.pageSize
2969
- const isMobile = false
2975
+ const isMobile = this.isMobile
2970
2976
  const row = popPageSetting.row
2971
2977
  const eventParams = {
2972
2978
  position: popPageSetting._position,
@@ -3190,6 +3196,16 @@ export default {
3190
3196
  }
3191
3197
  this.selectionChange(newSelection)
3192
3198
  },
3199
+ // 显示移动端查询区域
3200
+ showMobileSearch(){
3201
+ console.log('showMobileSearch-----this.isShowMobileSearch=', this.isShowMobileSearch, 'isMobile=', this.isMobile)
3202
+ this.isShowMobileSearch = true
3203
+ if (this.$refs.sf) {
3204
+ // 获得查询区高度
3205
+ this.$refs.sf.showMobileSearch()
3206
+ }
3207
+
3208
+ }
3193
3209
  },
3194
3210
  emits: [
3195
3211
  'change-grid-data',